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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8f4fac14fa1f7077df8aae4adf403ba4f7773ae5 | 94e1a8cd679491c0d6b923f3164c151eb525fd44 | /app/src/main/java/roomies/com/roomies/controllers/secondactivity/lists/edit/EditListFragment.java | 080d81259053381e0c8e6997ad8acac4929e707f | [] | no_license | AlixAmoureux/Roomies-Android | 6ff6470760efb769dfb90ee27325d624538a6359 | d51b526bf6072d83661e9d65ebcb8b72dacfbddc | refs/heads/master | 2021-06-10T18:05:45.628942 | 2017-02-22T16:32:27 | 2017-02-22T16:32:27 | 79,747,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,529 | java | package roomies.com.roomies.controllers.secondactivity.lists.edit;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import roomies.com.roomies.R;
import roomies.com.roomies.controllers.ManageObjects;
import roomies.com.roomies.controllers.secondactivity.lists.display.ManageListsFragment;
import roomies.com.roomies.models.lists.ListsItemsInfos;
public class EditListFragment extends Fragment {
private TextView mListName;
private ListView mListView;
private Button mEditList;
private Button mRemoveList;
private List<ListsItemsInfos> mListItems;
private TextView mMessage;
private String mListNameVal;
private String mToken;
private String mColocId;
private String mListId;
private EditListAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e("EditListFragment", "onCreate !");
mListItems = new ArrayList<>();
mAdapter = new EditListAdapter();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_edit_list, container, false);
mListView = (ListView) v.findViewById(R.id.listview_edit_listitems);
mEditList = (Button) v.findViewById(R.id.edit_list_button);
mRemoveList = (Button) v.findViewById(R.id.remove_list_button);
mListName = (TextView) v.findViewById(R.id.list_name);
mMessage = (TextView) v.findViewById(R.id.edit_list_message);
return (v);
}
@Override
public void onResume() {
super.onResume();
Log.e("EditListFragment", "onResume !");
mMessage.setVisibility(View.INVISIBLE);
mColocId = ManageObjects.readColocInfosInPrefs("colocInfos", getActivity()).id;
mToken = ManageObjects.readUserInfosInPrefs("userInfos", getActivity()).token;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
mListId = prefs.getString("listId", "");
getActivity().setTitle("Manage your list");
mListItems.clear();
getListItems();
mEditList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
updateListItems();
}
});
mRemoveList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
deleteList();
}
});
}
private void deleteList() {
// HTTP DELETE
String url = getString(R.string.url_base) + "/api/roomies-group/" + mColocId + "/lists/" + mListId;
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
JSONObject object = new JSONObject();
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, url, object,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Toast.makeText(getContext(), "The list has been removed", Toast.LENGTH_LONG).show();
Fragment newFragment = new ManageListsFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.container, newFragment);
transaction.addToBackStack(null);
transaction.commit();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Remove List", error.getMessage());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Authorization", "Bearer " + mToken);
return headers;
}
};
requestQueue.add(jsonObjectRequest);
}
private void getListItems() {
// HTTP GET
String url = getString(R.string.url_base) + "/api/roomies-group/" + mColocId + "/lists/" + mListId + "/items";
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
try {
StringRequest jsonobject = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray lists = new JSONArray(response);
for (int i = 0; i < lists.length(); i++) {
JSONObject item = lists.getJSONObject(i);
boolean done = item.getBoolean("done");
String title = item.getString("title");
String id = item.getString("id");
ListsItemsInfos tmpList = new ListsItemsInfos();
tmpList.setTitle(title);
tmpList.setDone(done);
tmpList.setId(id);
mListItems.add(tmpList);
}
mAdapter.setLists(mListItems);
mListView.setAdapter(mAdapter);
} catch (JSONException e) {
Log.e("ManageListFragment", e.getMessage());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "Application/json");
headers.put("Authorization", "Bearer " + mToken);
return headers;
}
};
requestQueue.add(jsonobject);
} catch (Exception e) {
e.printStackTrace();
}
}
private void updateListItems() {
mMessage.setVisibility(View.VISIBLE);
for (int i = 0; i < mListItems.size(); i++) {
updateItem(mListItems.get(i));
}
//mMessage.setText("The list has been updated");
//mMessage.setTextColor(getResources().getColor(R.color.messageSuccess));
Toast.makeText(getContext(), "The list has been updated", Toast.LENGTH_LONG).show();
Fragment newFragment = new ManageListsFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.container, newFragment);
transaction.addToBackStack(null);
transaction.commit();
}
private void updateItem(ListsItemsInfos item) {
// HTTP PUT
String url = getString(R.string.url_base) + "/api/roomies-group/" + mColocId + "/lists/" + mListId + "/items/" + item.getId();
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("title", item.getTitle());
jsonObject.put("done", item.isDone());
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, url, jsonObject,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("EditListFragment", "SUCCESS");
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Update Profile", error.getMessage());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Authorization", "Bearer " + mToken);
return headers;
}
};
requestQueue.add(jsonObjectRequest);
}
}
| [
"alix.amoureux@epitech.eu"
] | alix.amoureux@epitech.eu |
6d25d088b11b47f54fbff4d17bb0a308d611b261 | 55060cb3471b4d00543cde26e0b6f0e3f4cb525a | /src/test/_617mergeTrees.java | 86f870baff2cd21b8c78ba10bca1a9956bbc5f78 | [] | no_license | kuangbo/leetcode | 3fc72ac079ca586bc3f5260b4107a2d9c4d4d8c6 | a912371c27d27e49cb97c8f1149fbf20f0faec70 | refs/heads/main | 2023-04-16T10:28:22.182877 | 2021-04-13T13:23:30 | 2021-04-13T13:23:30 | 313,488,467 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package test;
/**
* Created with IntelliJ IDEA.
* User: kuangbo
* Date: 2020/8/21
* Time: 下午12:27
*/
public class _617mergeTrees {
public TreeNode mergeTrees(TreeNode t1, TreeNode t2) {
if(t1 == null && t2 == null)
return null;
if(t1 == null)
return t2;
if(t2 == null)
return t1;
t1.val = t1.val + t2.val;
t1.left = mergeTrees(t1.left, t2.left);
t1.right = mergeTrees(t1.right, t2.right);
return t1;
}
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
}
| [
"193976337@qq.com"
] | 193976337@qq.com |
76b083e8c56d94b764991bf93d845c891cd3bd7a | f38263d8861fcd1814d94ded0dc7365c61e43014 | /app/src/main/java/autoimageslider/IndicatorView/draw/drawer/type/SlideDrawer.java | 2fae28e72625d430571f37ee96fa18fc73ca6df5 | [] | no_license | dechantoine/what-could-i-cook-app | dbcd9c3168dc05876d2d0c05e76a4b13c622d75d | 0d95b410ab9dfb380a6ae80b06d284aaac89e0fe | refs/heads/master | 2023-08-18T07:36:15.164446 | 2020-01-24T10:55:34 | 2020-01-24T10:55:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package autoimageslider.IndicatorView.draw.drawer.type;
import android.graphics.Canvas;
import android.graphics.Paint;
import androidx.annotation.NonNull;
import autoimageslider.IndicatorView.animation.data.Value;
import autoimageslider.IndicatorView.animation.data.type.SlideAnimationValue;
import autoimageslider.IndicatorView.draw.data.Indicator;
import autoimageslider.IndicatorView.draw.data.Orientation;
public class SlideDrawer extends BaseDrawer {
public SlideDrawer(@NonNull Paint paint, @NonNull Indicator indicator) {
super(paint, indicator);
}
public void draw(
@NonNull Canvas canvas,
@NonNull Value value,
int coordinateX,
int coordinateY) {
if (!(value instanceof SlideAnimationValue)) {
return;
}
SlideAnimationValue v = (SlideAnimationValue) value;
int coordinate = v.getCoordinate();
int unselectedColor = indicator.getUnselectedColor();
int selectedColor = indicator.getSelectedColor();
int radius = indicator.getRadius();
paint.setColor(unselectedColor);
canvas.drawCircle(coordinateX, coordinateY, radius, paint);
paint.setColor(selectedColor);
if (indicator.getOrientation() == Orientation.HORIZONTAL) {
canvas.drawCircle(coordinate, coordinateY, radius, paint);
} else {
canvas.drawCircle(coordinateX, coordinate, radius, paint);
}
}
}
| [
"zanis.timsans@gmail.com"
] | zanis.timsans@gmail.com |
2df4c3c012454857f5f8a9879189705fb745a343 | b2c4cf8182f6f918ee1174d8bfc0c37a88e20244 | /src/javapreviousversion/com/lambda/Greeter.java | 9f97cf9916cc8984a71e2010f22c3e5b3e5870d7 | [] | no_license | fame2105/Lambda_Java_8 | 23ffb22389c0fef0798a8834c04b41f1058e1777 | 07f0e30e31b371db0e62751fabcd56e00ce3098a | refs/heads/master | 2021-07-02T16:08:13.541942 | 2017-09-22T03:36:55 | 2017-09-22T04:27:44 | 104,066,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package javapreviousversion.com.lambda;
public class Greeter {
public void greet(Greeting greeting) {
greeting.perform();
// System.out.print("Hello World");
}
public static void main(String[] args) {
Greeter greeter = new Greeter();
// greeter.greet();
Greeting helloWorldGreeting = new HelloWorldGreeting();
greeter.greet(helloWorldGreeting);
Greeting myLambdaFunction = () -> System.out.println("Hello World");
// MyAdd addFunction = (int a, int b) -> a+b;
}
}
/*interface MyLambda {
void foo();
}*/
/*interface MyAdd{
int add(int a, int b);
}*/
| [
"fame.issrani@appdirect.com"
] | fame.issrani@appdirect.com |
366974d276e86daa033e6100599455635131548a | 5dbaa26cf3ee5c3d035f23466f57b4622f7887e9 | /day3-array/Concatenate.java | 6d895977e1e27cbcec9f49feef61cf73f0c51cc6 | [] | no_license | pssruthy/learnJava | 89a4e8c10d87d517709a9069e0d127fda00a8e3a | dd9012f0b6409b9a689639de5ad799cbb550717c | refs/heads/main | 2023-01-05T11:52:03.125366 | 2020-10-30T20:29:53 | 2020-10-30T20:29:53 | 306,053,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | public class Concatenate {
public static void printArray(int[] array) {
for (int i : array) {
System.out.println(i);
}
}
public static int[] concatenate(int[] array1, int[] array2) {
int[] concatenatedArray = new int[array1.length + array2.length];
for(int index = 0; index < array1.length; index++) {
concatenatedArray[index] = array1[index];
}
for(int index = array1.length; index < concatenatedArray.length; index++) {
concatenatedArray[index] = array2[index - array1.length];
}
return concatenatedArray;
}
public static void main(String[] args) {
int[] array1 = {1, 2, 3, 4};
int[] array2 = {5, 6, 7, 8, 4, 9};
printArray(concatenate(array1, array2));
}
} | [
"58027046+pssruthy@users.noreply.github.com"
] | 58027046+pssruthy@users.noreply.github.com |
2d908925c99c6d98558eb732b534e714fcafe2fe | 9794e4557796766971bb365dfd1c5f336ee75351 | /src/main/java/com/jyall/mapper/ProductMapper.java | 8fbecfaa5afd1685d48e4453dd0c2bfa52aaa72f | [] | no_license | wanglinqiao/demo-provider | 8758d4aaa3a7a534587cf56641ae690df5444d97 | 2c8417cb556e3095126433d492094d5831efa3ab | refs/heads/master | 2021-01-13T13:18:06.395319 | 2016-12-02T09:01:15 | 2016-12-02T09:01:15 | 72,634,846 | 0 | 0 | null | 2016-12-02T09:01:15 | 2016-11-02T11:49:49 | Java | UTF-8 | Java | false | false | 503 | java | package com.jyall.mapper;
import com.jyall.mapper.provider.ProductMapperProvider;
import com.jyall.pojo.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
import java.util.Map;
/**
* Created by wang.linqiao on 2016/10/31.
*/
@Mapper
public interface ProductMapper {
@SelectProvider(type = ProductMapperProvider.class,method = "getProductList")
public List<Product> getProductList(Map<String, String> param);
}
| [
"wang.linqiao@jyall.com"
] | wang.linqiao@jyall.com |
3e3cb01fb29289a24a4b49aef1d49e3c69b4cb8e | 036b9d00098d45fc3ecc8a2fb7ef0c11dae65941 | /src/main/java/com/saviorru/comsserver/cli/command/StartTournamentCommand.java | 3fdc1077046ca835a52b6620cfce555018666d9c | [] | no_license | Doomsday46/coms-server | 7c202564965b20bea609fd4c1c6fa8fa607ce58c | 99ad0c85d08d6a18cf33130aa18afb1551399691 | refs/heads/master | 2021-04-18T11:16:33.603491 | 2018-07-28T12:21:09 | 2018-07-28T12:21:09 | 126,798,974 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | package com.saviorru.comsserver.cli.command;
import com.saviorru.comsserver.domain.tournament.Tournament;
public class StartTournamentCommand implements Command {
private Tournament tournament;
public StartTournamentCommand(Tournament tournament) {
if (tournament == null) throw new NullPointerException("Tournament not created");
this.tournament = tournament;
}
@Override
public Boolean execute(){
tournament.start();
return true;
}
}
| [
"Gallifrey46@gmail.com"
] | Gallifrey46@gmail.com |
7fd46490fdccb4f71dcf24988639b031ff2f5225 | bfdc2e4e6a1f329ea5fc0a5836744ed5ac6d0d2e | /jaql/src/main/java/com/bordereast/jaql/JAQL.java | b5e17341736467eeabb1c2fba41150bd5659f969 | [] | no_license | bordereast/jaql | edb1acde27a75bb82534122bd08a3ed1d7e16b46 | 99ffca171777590ddb4cfde614e37be69da18c91 | refs/heads/master | 2021-01-20T06:35:48.884267 | 2017-08-26T19:55:41 | 2017-08-26T19:55:41 | 101,509,551 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,998 | java | package com.bordereast.jaql;
import com.bordereast.jaql.arango.Keyword;
import com.bordereast.jaql.arango.Logical;
import com.bordereast.jaql.arango.Operator;
import java.util.Map;
import java.util.Optional;
import com.bordereast.jaql.arango.Filter;
import com.bordereast.jaql.arango.For;
import com.bordereast.jaql.arango.ReturnEntity;
import com.bordereast.jaql.arango.ReturnProperty;
public final class JAQL {
private JAQLCollections lists;
private String[] aliases = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","aa","bb","cc","dd","ee","ff","gg","hh","ii","jj","kk","ll","mm","nn","oo","pp","qq","rr","ss","tt","uu","vv","ww","xx","yy","zz"};
private int index = -1;
public JAQL() {
lists = new JAQLCollections();
}
public JAQL(int aliasIndex) {
super();
lists = new JAQLCollections();
index = aliasIndex;
}
public Map<String, Object> bindVars() {
return lists.paramList;
}
public <T extends Object> JAQL forEntity(T entity) {
lists.put(Keyword.FOR, new For<T>(entity, aliases[++index]));
lists.entityList.put(entity.getClass().getSimpleName(), entity);
return this;
}
public JAQL forCollection(String collection) {
lists.put(Keyword.FOR, new For(collection, aliases[++index]));
return this;
}
public <T extends Object> JAQL returnEntity(T entity) throws NoSuchFieldException, SecurityException {
for(Pair p : lists.queryList) {
if(p.getKey().equals(Keyword.FOR)) {
For f = (For)p.getValue();
if(f.entity.getClass().getSimpleName().equals(entity.getClass().getSimpleName())) {
lists.put(Keyword.RETURN, new ReturnEntity(entity, f));
break;
}
}
}
return this;
}
public JAQL returnProperty(String alias, String property) {
lists.put(Keyword.RETURN, new ReturnProperty(alias, property));
return this;
}
public JAQL withParam(String parameter, Object value) {
lists.paramList.put(parameter, value);
return this;
}
public String addParam(String parameter, Object value) {
lists.paramList.put(parameter, value);
return "@" + parameter;
}
public String addCollectionParam(String parameter, Object value) {
lists.paramList.put(parameter, value);
return "@@" + parameter;
}
public JAQL filter(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.BLANK, left, operator, right));
return this;
}
public JAQL filter(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.BLANK, left, operatorA, operatorB, right));
return this;
}
public JAQL and(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.AND, left, operator, right));
return this;
}
public JAQL and(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.AND, left, operatorA, operatorB, right));
return this;
}
public JAQL or(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.OR, left, operator, right));
return this;
}
public JAQL or(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.OR, left, operatorA, operatorB, right));
return this;
}
public JAQL not(String left, Operator operator, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.NOT, left, operator, right));
return this;
}
public JAQL not(String left, Operator operatorA, Operator operatorB, String right) {
lists.put(Keyword.FILTER, new Filter(Logical.NOT, left, operatorA, operatorB, right));
return this;
}
public JAQL logical(Logical logical) {
lists.put(Keyword.LOGICAL, logical);
return this;
}
public JAQL keyword(Keyword keyword) {
lists.put(keyword, null);
return this;
}
public String currentAlias() {
return aliases[index];
}
public String build() throws InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException {
return new JAQLBuilder(lists, aliases, index).build().replaceAll(" {2,}", " ");
}
} | [
"agrothe@gmail.com"
] | agrothe@gmail.com |
1b914bb29552c69b2368065fca2ae541b4377041 | 3aff018554883e2def5ef477deb66cfcc7ff8d9a | /app/src/main/java/com/example/tutorial/GameObject.java | f70e0e3aff78058fba5eacf5ec2d8621ce56d438 | [] | no_license | LBWNB2020/GAME | 373682249779ac8bc6f28a75e90ba6c83014d983 | f60d19e8fc96033e02de6d3b2f63ffce7438b9a6 | refs/heads/master | 2022-11-12T21:06:52.684492 | 2020-06-30T05:32:46 | 2020-06-30T05:32:46 | 276,001,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package com.example.tutorial;
import android.graphics.Canvas;
public interface GameObject {
public void draw(Canvas canvas);
public void update();
}
| [
"67581178+LBWNB2020@users.noreply.github.com"
] | 67581178+LBWNB2020@users.noreply.github.com |
a160e48adafd625ce8e6e0f97b7c907c7b58b525 | 004c1c68ab5933be098633eacc158f1b45a1aad1 | /src/main/java/com/gmail/socraticphoenix/sponge/star/chat/command/conversation/CommandPrompt.java | 2074599a2a045b3fac3f30545522f7ef862a3b10 | [] | no_license | intronate67/StarAPI | 0a269e5f00769a7911384227291ad42510339302 | 06eaec7c93d3345e3abfdb3d97a737d2a47d6dfd | refs/heads/master | 2021-01-22T16:45:00.016330 | 2015-12-24T03:50:47 | 2015-12-24T03:50:47 | 48,661,770 | 0 | 0 | null | 2015-12-27T21:51:45 | 2015-12-27T21:51:44 | null | UTF-8 | Java | false | false | 2,589 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 socraticphoenix@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @author Socratic_Phoenix (socraticphoenix@gmail.com)
*/
package com.gmail.socraticphoenix.sponge.star.chat.command.conversation;
import com.gmail.socraticphoenix.sponge.star.chat.arguments.StarArgumentValue;
import com.gmail.socraticphoenix.sponge.star.chat.condition.Verifier;
import com.gmail.socraticphoenix.sponge.star.chat.conversation.Conversation;
import com.gmail.socraticphoenix.sponge.star.chat.conversation.Prompt;
import java.util.Deque;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColors;
public class CommandPrompt extends Prompt {
private Deque<Prompt> prompts;
private String argName;
private Verifier verifier;
public CommandPrompt(Deque<Prompt> prompts, String argName, Verifier verifier) {
this.prompts = prompts;
this.argName = argName;
this.verifier = verifier;
}
@Override
public Verifier getVerifier() {
return this.verifier;
}
@Override
public Text getMessage() {
return Texts.builder("Please enter '".concat(this.argName).concat("'")).color(TextColors.GOLD).build();
}
@Override
public Prompt process(StarArgumentValue value, Conversation conversation) {
conversation.getArguments().put(this.argName, value.getValue().orElse(null));
return this.prompts.isEmpty() ? Prompt.END : this.prompts.pollFirst();
}
}
| [
"socraticphoenix@gmail.com"
] | socraticphoenix@gmail.com |
545d30ec4a25908cecae3e9f6c02ab9c3a618ae5 | 39b05cd987000e95a68f70abe52c23cb73434f02 | /app/src/main/java/com/utsman/moviedb/model/Genre.java | fe3269a2a637c62488a1613f2ee7b24cfe632f86 | [] | no_license | TeknopediaAsia/MovieDb | f1d1eb3cd61541f98ec0e9d6815409a0bc783fe4 | 38fb63ff303bcac44ce14256e443d401ae9ac467 | refs/heads/master | 2020-06-22T19:27:13.149315 | 2019-07-19T14:42:18 | 2019-07-19T14:42:18 | 197,789,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package com.utsman.moviedb.model;
import com.google.gson.annotations.SerializedName;
public class Genre {
@SerializedName("id")
private Integer id;
@SerializedName("name")
private String name;
public Genre(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"kucingapes@gmail.com"
] | kucingapes@gmail.com |
2e1947a55cf40dfda60e21fac390ea616c695e3e | 81b3d03841dd7039fed5b11e2f48859f23eec685 | /CareerCups/ReverseWords.java | 9972e7ed44fdf3f9c2f6228684a62c3c76adca31 | [] | no_license | choitom/Algorithm | 451f74856deee514ab96e6d60e755699646371a9 | 918da6bd8457a26e88beae528cd77856c586298f | refs/heads/master | 2020-05-22T08:14:35.772977 | 2016-09-26T02:50:01 | 2016-09-26T02:50:01 | 65,788,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | /**
Author : Tom Choi
Date : 08/16/2016
Problem
-> Given an input string, reverse the string word by word
where a word is defined as a sequence of non space characters
ex) the sky is blue -> blue is sky the
*/
public class ReverseWords{
public static void main(String[] args){
String str = "the sky is blue and sometimes is red";
String reverseStr = reverse(str);
System.out.println(str);
System.out.println(reverseStr);
}
/**
* Split the words by empty space and reverse append
*/
public static String reverse(String str){
String[] strArr = str.split(" ");
String reversed = "";
for(int i = strArr.length-1; i >= 0; i--){
if(i != 0){
reversed = reversed + strArr[i] + " ";
}else{
reversed = reversed + strArr[i];
}
}
return reversed;
}
} | [
"choito@carleton.edu"
] | choito@carleton.edu |
1e5fadf6ba214ea3d914b3137d6e88da76d71dd1 | 46577474beb29b57604ab2887f56c388f4faa3c0 | /eventPlanner/src/main/java/com/anz/eventplanner/controller/UserController.java | 7d7c03c8558e2afe95662faf181227dc1178d742 | [] | no_license | Amuthalakshmi/eventPlanner | 7e0ec2cc2ab3d61bb75234f60c1d28607613178e | d665f58d1445984ba835ac8bb8c203dc775b2e42 | refs/heads/master | 2021-01-20T04:54:10.806426 | 2017-06-10T05:48:29 | 2017-06-10T05:48:29 | 89,747,139 | 0 | 0 | null | 2017-06-10T05:48:29 | 2017-04-28T21:47:01 | Java | UTF-8 | Java | false | false | 2,578 | java | package com.anz.eventplanner.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.anz.eventplanner.model.Event;
import com.anz.eventplanner.model.EventManager;
import com.anz.eventplanner.model.EventOrganiser;
import com.anz.eventplanner.model.Participant;
import com.anz.eventplanner.model.User;
import com.anz.eventplanner.service.EventManagerService;
import com.anz.eventplanner.service.EventOrganiserService;
import com.anz.eventplanner.service.EventService;
import com.anz.eventplanner.service.ParticipantService;
@Controller
public class UserController {
@Autowired
MessageSource messageSource;
User user = new User();
@Autowired
EventService eventService;
@Autowired
EventManagerService eventManagerService;
@Autowired
EventOrganiserService eventOrganiserService;
@Autowired
ParticipantService participantService;
public UserController() {
user.setLANId("USR1WLG");
}
@RequestMapping(value = { "/" }, method = RequestMethod.GET)
public String homepage(ModelMap model) {
String LANId = user.getLANId();
model.addAttribute("isEventManager", isEventManager(LANId));
if (isEventOrganiser(LANId)){
EventOrganiser eventOrganiser = eventOrganiserService.findByLANId(LANId);
model.addAttribute("isEventOrganiser", isEventOrganiser(LANId));
model.addAttribute("eventOrganiserId", eventOrganiser.getEventOrganiserId());
}
List<Participant> participation = participantService.findAllParticipantByLANId(LANId);
model.addAttribute("participation", participation);
List<Event> events = eventService.findAllEventByStatus("Initiated");
for(Participant p:participation){
if(events.contains(p.getEvent())){
events.remove(p.getEvent());
}
}
model.addAttribute("events", events);
return "home";
}
public boolean isEventManager(String LANId) {
EventManager eventManager = eventManagerService.findByLANId(LANId);
if (eventManager == null) {
return false;
}
return true;
}
public boolean isEventOrganiser(String LANId) {
EventOrganiser eventOrganiser = eventOrganiserService.findByLANId(LANId);
if (eventOrganiser == null) {
return false;
}
return true;
}
} | [
"ammu.veera@gmail.com"
] | ammu.veera@gmail.com |
5220f07c8bd9ef7a00934353761722df3a2eee80 | 7c8896ebd1acab1bcbe3c42f71337be1066e8e34 | /src/main/java/muic/ooc/zork/items/Spinach.java | 720c313d7933cdcea5890ebda12a6ff2d2b54c69 | [] | no_license | thecheesynachos/zork_game | 6cc1ca2e373fd3ab062dccc40fe6017b79164cf7 | 40af522b5d41d3cc679a0b10d985513b35473d4d | refs/heads/master | 2020-05-25T21:10:26.449729 | 2019-05-24T15:56:27 | 2019-05-24T15:56:27 | 187,994,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package muic.ooc.zork.items;
import muic.ooc.zork.gameplay.GameBag;
import muic.ooc.zork.gameplay.Observation;
public class Spinach extends Item {
public Observation use(GameBag gameBag) {
gameBag.getPlayer().incrementMaxHealth();
gameBag.getPlayer().incrementMaxAttack();
gameBag.getPlayer().incrementMaxMana();
gameBag.getPlayer().incrementMana();
gameBag.getPlayer().incrementHealth();
return new Observation("And like Popeye, you are now stronger than before!");
}
public boolean canDeplete() {
return true;
}
}
| [
"apivich.hemachandra@gmail.com"
] | apivich.hemachandra@gmail.com |
9f641ead912ce88055e19105bef8f44570c891c0 | 0305ac4a0e235825dbb8fc05f54352341e290a2c | /src/test/Test2.java | 6443c92c2b9c3ef42b73d65c9a40ae9c137bad73 | [
"MIT"
] | permissive | benTrust/Test | c9d1f7b69a9fa84a6a6e7947331bbbb98fabc76b | 7d0ba9146fc895dc09bbd319515aefe4a42d70ca | refs/heads/master | 2021-07-02T19:31:45.134946 | 2017-02-01T20:31:55 | 2017-02-01T20:31:55 | 34,114,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package test;
public class Test2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Ca ne marche pas ?");
}
}
| [
"ben@debianBen"
] | ben@debianBen |
69745b4e053f7823cde53f4c4a04449a36b67ed4 | 1a7c86c16e74a67db230e9eadf5239384cdb8d00 | /src/main/java/app/constant/UserRegistreationConstants.java | 4e61d42f46d1f12938d9e6fab479d8931c37aa59 | [] | no_license | tech-zinfinity/mumbanksocialapp | 4ed1fe48f5e011c2bfee7911ac53aafe9a6d7d23 | 21d10ea4d6286c8ad68c7028f2ff18f32ae2ba53 | refs/heads/master | 2023-06-30T13:55:28.066761 | 2021-01-10T17:55:20 | 2021-01-10T17:55:20 | 216,885,906 | 0 | 0 | null | 2023-06-14T22:31:46 | 2019-10-22T18:45:14 | Java | UTF-8 | Java | false | false | 72 | java | package app.constant;
public interface UserRegistreationConstants {
}
| [
"darshan.redkar@zinfinity.in"
] | darshan.redkar@zinfinity.in |
4619646ec0c4b4e57d804e4d84eb62b618931c20 | 6e0b9487e3b77b4ff7e9b91b68d85d53f5e3ca17 | /src/com/zhxy/chapter9/interfaces/Apply.java | 5cf87ff8f7d100f0b69d130616a52f52ccc9d53c | [] | no_license | zhxysky/thinginjava | ee1adcdce3d020ebbaa0d1a895fac061ecd96815 | dce8e09e08020631ffd0cff5d8b6d39a13169f73 | refs/heads/master | 2020-04-06T07:05:58.905479 | 2016-08-29T13:58:42 | 2016-08-29T13:58:42 | 65,739,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.zhxy.chapter9.interfaces;
public class Apply {
public static void process(Processor p,Object s) {
System.out.println("Using Processor "+p.name());
System.out.println(p.process(s));
}
}
| [
"zhangxiaoyan@zhangxiaoyandeMacBook-Pro.local"
] | zhangxiaoyan@zhangxiaoyandeMacBook-Pro.local |
c99e90d76d7c5f9a85fd5014c658160390ae631b | 85f2b0db09ff47517d5c31368c862e714acdc614 | /FibBenchGithub/src/ExpectedSarsa/RewardCalculator.java | 6817e96e7bc99086bb5368bc7f48e82f90c3bca5 | [] | no_license | paridee/elasticDAGscheduler | 3db4df05ce3ee89ed9f23f122f50a31481642234 | 60e7171a54dc9570925fb0f7e087e50940bc3593 | refs/heads/master | 2021-01-01T04:12:59.852207 | 2016-05-26T22:07:42 | 2016-05-26T22:07:42 | 59,289,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package ExpectedSarsa;
public interface RewardCalculator {
double giveReward();
}
| [
"paride.casulli@gmail.com"
] | paride.casulli@gmail.com |
2a50f2b53ddec8be24d16825d26a2a45ae4d5141 | 008e36b8328909c10deb72a6ce6c951d648498c7 | /tracker-storm/src/main/java/com/tracker/storm/drpc/drpcprocess/Drpc_Example.java | 65092f6698ddb9e7a6ea2e332b389914d758d93c | [] | no_license | luxr123/UserAnalysis | 3f090e32c35da31fd98412df673db5607a95b32c | e2c5740d5ba0db69bf6d9908714e2c3425702506 | refs/heads/master | 2021-01-10T19:58:49.544112 | 2014-10-31T02:04:22 | 2014-10-31T02:04:22 | 25,714,894 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,176 | java | package com.tracker.storm.drpc.drpcprocess;
//this is no longer used just for sampling
//Drpc request field value
//CLIENT-->DRPC SERVER-->TRANSPORT BOLT-->REAL TIME BOLT -->this-->Aggregate Bolt-->CLIENT
import java.io.Serializable;
import java.util.Calendar;
import java.util.Properties;
import java.util.Set;
import com.tracker.common.utils.ConfigExt;
import com.tracker.common.utils.StringUtil;
import com.tracker.storm.drpc.drpcresult.DrpcResult;
public class Drpc_Example extends DrpcProcess implements Serializable{
/**
*
*/
private static final long serialVersionUID = -7654832864335215661L;
private Properties m_properties;
public static String ProcessFunc = "toprecord";
public Drpc_Example(){
// get cluster infomation
String hdfsLocation = java.lang.System.getenv("HDFS_LOCATION");
String configFile = java.lang.System.getenv("COMMON_CONFIG");
m_properties = ConfigExt.getProperties(hdfsLocation,
configFile);
}
@Override
public boolean isProcessable(String input) {
// TODO Auto-generated method stub
boolean retVal = false;
String splits[] = input.split(StringUtil.ARUGEMENT_SPLIT);
if(input.contains("toprecord") && splits.length == 6){ //toprecord:ip/cost/:Engine:SearchType:startIndex:endIndex
retVal = true;
}
return retVal;
}
@Override
public DrpcResult process(String input, Object localbuff) {
// TODO Auto-generated method stub
// String splits[] = input.split(StringUtil.ARUGEMENT_SPLIT);
// Calendar cal = Calendar.getInstance();
// TopRecordResult trr = new TopRecordResult();
// String key = (cal.get(Calendar.MONTH) + 1) + StringUtil.ARUGEMENT_SPLIT + cal.get(Calendar.DAY_OF_MONTH)
// + StringUtil.ARUGEMENT_SPLIT + splits[1] + StringUtil.ARUGEMENT_SPLIT+ splits[2];
// if(splits[1].equals("ip") || splits[3].equals("")){
//
// }else{
// key += StringUtil.ARUGEMENT_SPLIT + splits[3];
// }
// Set<String> retStr = JedisUtil.getInstance(m_properties).SORTSET.zrevrange(key, Integer.parseInt(splits[4]), Integer.parseInt(splits[5]));
// trr.setString(retStr);
// trr.setTotal(JedisUtil.getInstance(m_properties).SORTSET.zlength(key));
// return trr;
return null;
}
}
| [
"luxr123@gmail.com"
] | luxr123@gmail.com |
9582fbedf8f06d23cb24a463c11aeaaf441ed4fa | 653a0b15c48a5c12e8b6a841aacec1815384fdf8 | /src/main/java/com/wang/bean/Red.java | 928e3dfa55d9b781e794e17c3c3ac55b31271af7 | [] | no_license | SillyBoy007/spring-annotation | fe5eadb3d04c0a00a996cd657d99101eaad3465d | 1c467c0f09b5123f6fb099f38140f3cc6aa09761 | refs/heads/master | 2020-04-13T18:36:16.541103 | 2019-03-13T05:14:18 | 2019-03-13T05:14:18 | 163,379,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45 | java | package com.wang.bean;
public class Red {
}
| [
"814752288@qq.com"
] | 814752288@qq.com |
c9ae0bf03ec733ba665280de97f65ec6f74b86d8 | ce0feed6f9693bf48c09d2fcc7ee1a36a315d2cb | /src/main/java/net/suncaper/mallanlisb/common/domain/Admin.java | b955608d6fc04a4974625c2d1732183fb8075fe7 | [] | no_license | smalldandan/mallanlisb | ffe665e3731067bc463c66f8e2e1b6b06f1626d2 | c7136b8c369a144a41bfd0242b4765f654e91df6 | refs/heads/master | 2022-06-23T23:07:49.379853 | 2019-12-28T12:30:03 | 2019-12-28T12:30:03 | 230,587,870 | 0 | 0 | null | 2022-06-21T02:32:17 | 2019-12-28T09:24:36 | Java | UTF-8 | Java | false | false | 1,586 | java | package net.suncaper.mallanlisb.common.domain;
import java.util.Date;
public class Admin {
private Integer id;
private String loginname;
private String password;
private Date lastlogintime;
private String remark;
public Admin(String loginname, String password) {
this.loginname = loginname;
this.password = password;
}
public Admin() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname == null ? null : loginname.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Date getLastlogintime() {
return lastlogintime;
}
public void setLastlogintime(Date lastlogintime) {
this.lastlogintime = lastlogintime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
@Override
public String toString() {
return "Admin{" +
"id=" + id +
", loginname='" + loginname + '\'' +
", password='" + password + '\'' +
", lastlogintime=" + lastlogintime +
", remark='" + remark + '\'' +
'}';
}
} | [
"1209295751@qq.com"
] | 1209295751@qq.com |
d29767f44ed9270f7b8cbf5af2387ebb0e42c083 | 628e45dd5f6e4ba2b16f50988ed215bded06e6a6 | /udemy-hibernate/com.mastercard.hibernate/src/main/java/com/mastercard/hibernate/demo/entity5/Course.java | b000222294136de3fbca4b04978b7c9d1cfd4abd | [] | no_license | JessyTerada/spring-hibernate | 1dc63000754f29da92c2c3309f344de80dcfea03 | 4cd1e84825f44a93cd64c581cd78d4b5ecf3357e | refs/heads/master | 2021-07-05T02:44:13.329392 | 2017-09-28T19:39:02 | 2017-09-28T19:39:02 | 103,560,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | package com.mastercard.hibernate.demo.entity5;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="course")
public class Course {
//define our fields
//define constructors
//define getter setters
//define tostring
//annotate fields
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="title")
private String title;
@ManyToOne(cascade= {CascadeType.PERSIST, CascadeType.MERGE,
CascadeType.DETACH, CascadeType.REFRESH})
@JoinColumn(name="instructor_id")
private Instructor instructor;
@OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
@JoinColumn(name="course_id")
private List<Review> reviews;
public Course() {
}
public Course(String title) {
this.title = title;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Instructor getInstructor() {
return instructor;
}
public void setInstructor(Instructor instructor) {
this.instructor = instructor;
}
public List<Review> getReviews() {
return reviews;
}
public void setReviews(List<Review> reviews) {
this.reviews = reviews;
}
//add a convenience method
public void addReview(Review theReview) {
if (reviews == null) {
reviews = new ArrayList<Review>();
}
reviews.add(theReview);
}
@Override
public String toString() {
return "Course [id=" + id + ", title=" + title + "]";
}
}
| [
"JE385653@wipro.com"
] | JE385653@wipro.com |
b04fa2f0141b68080849352afcb4e58ad3c819a9 | 7549c76c26095f2b6bb174cac78f7dd7b5094aad | /chicha/src/main/java/com/chicha/genericlib/FileLib.java | f691f6627db1d3a57cd190beb63462cab2805e2a | [] | no_license | yeshwanth135/chotu | 6d42db65c79ecbdfc735bf9beb1382ea84548169 | e2b5b5ddbd9880d10a3dce0196291d8d214fbefa | refs/heads/main | 2023-08-23T17:13:57.724168 | 2021-09-24T14:23:50 | 2021-09-24T14:23:50 | 405,900,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,566 | java | package com.chicha.genericlib;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Properties;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class FileLib {
public String readpropData(String propPath, String key) throws Throwable {
FileInputStream fis=new FileInputStream(propPath);
Properties prop=new Properties();
prop.load(fis);
String propValue=prop.getProperty(key, "incorrect key");
return propValue;
}
public void writeexcelData(String excelpath, String sheetname,int row,int cell,String data) throws Throwable {
FileInputStream fis=new FileInputStream(excelpath);
Workbook wb=WorkbookFactory.create(fis);
wb.getSheet(sheetname).getRow(row).createCell(cell).setCellValue(data);
FileOutputStream fos=new FileOutputStream(excelpath);
wb.write(fos);
}
public String readexcelData(String excelpath,String sheetname,int row,int cell) throws Throwable{
FileInputStream fis=new FileInputStream(excelpath);
Workbook wb=WorkbookFactory.create(fis);
String excelvalue=wb.getSheet(sheetname).getRow(row).getCell(cell).toString();
return excelvalue;
}
public int getrowCount(String excelpath,String sheetName) throws Throwable {
FileInputStream fis=new FileInputStream(excelpath);
Workbook wb=WorkbookFactory.create(fis);
int rowCount=wb.getSheet(sheetName).getLastRowNum();
return rowCount;
}
}
| [
"sunny@DESKTOP-R6249JK"
] | sunny@DESKTOP-R6249JK |
6fce2a6a7faf06a6a6e81cb3e66613c83a2d36c4 | 5df6e828df86c74c88b8ff686dd2e78fc14519a9 | /iDrive/src/com/ccpress/izijia/util/GDLocationUtil.java | ffef8dda240e4c794afdb15e3dc927a679440cc1 | [] | no_license | dmz1024/IDrive | 366d317e348ee73453bec08fff6f141ef7ae5986 | abc8c2853a7a385eb967b7a37df1d3d1225ec53d | refs/heads/master | 2020-12-25T14:39:05.753920 | 2016-06-22T02:31:05 | 2016-06-22T02:31:05 | 61,682,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,962 | java | package com.ccpress.izijia.util;
import android.content.Context;
import android.content.SharedPreferences;
import com.amap.api.location.AMapLocation;
import com.ccpress.izijia.Constant;
import com.ccpress.izijia.entity.CityEntity;
/**
* Created by Wu Jingyu
* Date: 2015/9/8
* Time: 10:27
*/
public class GDLocationUtil {
public static void setGDGpsLocation(Context ctx, AMapLocation location){
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_GPS_CITY_CODE, location.getCityCode());
editor.putString(Constant.GD_SP_LOCATION_GPS_CITY, location.getCity());
editor.putString(Constant.GD_SP_LOCATION_GPS_PROVINCE, location.getProvince());
editor.commit();
}
}
public static String getGDGpsCityCode(Context ctx) {
String cityCode = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
cityCode = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_CITY_CODE,
Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE_DEFAULT);
}
return cityCode;
}
public static String getGDGpsCity(Context ctx){
String city = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
city = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_CITY,
Constant.GD_SP_LOCATION_CURRENT_SET_CITY_DEFAULT);
}
return city;
}
public static String getGDGCity(Context ctx){
String city = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
city = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_CITY,
Constant.GD_SP_LOCATION_CURRENT_SET_CITY_DEFAULT);
}
return city;
}
public static String getGDGpsProvince(Context ctx) {
String province = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
province = sharedPref.getString(Constant.GD_SP_LOCATION_GPS_PROVINCE,
Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_DEFAULT);
}
return province;
}
public static String getGDGpsProvinceCode(Context ctx) {
String provinceCode = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
provinceCode = sharedPref.getString(Constant.SP_LOCATION_GPS_PROVINCE_CODE,
Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE_DEFAULT);
}
return provinceCode;
}
public static void setGDCurrentLocation(Context ctx, CityEntity entity) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE, entity.getCode());
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY, entity.getName());
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE, entity.getProvince());
editor.commit();
}
}
public static void setGDCurrentSetCity(Context ctx, String city) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY, city);
editor.commit();
}
}
public static void setGDCurrentSetCityCode(Context ctx, String cityCode) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE, cityCode);
editor.commit();
}
}
public static void setGDCurrentSetProvince(Context ctx, String province) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE, province);
editor.commit();
}
}
public static void setGDCurrentSetProvinceCode(Context ctx, String provinceCode) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE, provinceCode);
editor.commit();
}
}
public static String getGDCurrentSetCityCode(Context ctx) {
String cityCode = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
cityCode = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE,
"");
}
return cityCode;
}
public static String getGDCurrentSetCity(Context ctx) {
String city = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
city = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY,
"");
}
return city;
}
public static String getGDCurrentSetProvince(Context ctx) {
String province = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
province = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE,
"");
}
return province;
}
public static String getGDCurrentSetProvinceCode(Context ctx) {
String province = "";
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
province = sharedPref.getString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE,
"");
}
return province;
}
public static void clearGDCurrentLocation(Context ctx) {
SharedPreferences sharedPref = ctx.getSharedPreferences(Constant.GD_SP_LOCATION, Context.MODE_PRIVATE);
if(sharedPref != null){
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY_CODE, "");
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_CITY, "");
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE, "");
editor.putString(Constant.GD_SP_LOCATION_CURRENT_SET_PROVINCE_CODE, "");
editor.commit();
}
}
public static String getGDProvinceCode(Context ctx) {
String provinceCode = "";
String provinceCode_sp = GDLocationUtil.getGDCurrentSetProvinceCode(ctx);
if(provinceCode_sp.equals("")){
provinceCode = GDLocationUtil.getGDGpsProvinceCode(ctx);
} else {
provinceCode = provinceCode_sp;
}
return provinceCode;
}
public static String getGDProvince(Context ctx) {
String province = "";
String province_sp = GDLocationUtil.getGDCurrentSetProvince(ctx);
if(province_sp.equals("")){
province = GDLocationUtil.getGDGpsProvince(ctx);
} else {
province = province_sp;
}
return province;
}
public static String getGDCityCode(Context ctx) {
String cityCode = "";
String cityCode_sp = GDLocationUtil.getGDCurrentSetCityCode(ctx);
if(cityCode_sp.equals("")){
cityCode = GDLocationUtil.getGDGpsCityCode(ctx);
} else {
cityCode = cityCode_sp;
}
return cityCode;
}
public static String getGDCity(Context ctx) {
String city = "";
String city_sp = GDLocationUtil.getGDCurrentSetCity(ctx);
if(city_sp.equals("")){
city = GDLocationUtil.getGDGpsCity(ctx);
} else {
city = city_sp;
}
return city;
}
}
| [
"894350911@qq.com"
] | 894350911@qq.com |
849fa88a038ce667d3ed57a04a1ab3af3498ad27 | 70d1d5547ba3faf5347f247ab3dbf7db62cd04a3 | /pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/DockerLabelStepTest.java | a602ed72eefdc0084eaec83a1844c7dfe0c21614 | [] | no_license | cloudbeers/pipeline-model-definition-plugin | c29b48ce0b75fad82653475286f92df1cc1ba84e | d646f0a758f7187c9808fb76d4091482942d848b | refs/heads/master | 2020-12-24T12:01:37.026433 | 2016-11-04T23:24:21 | 2016-11-04T23:24:21 | 73,097,623 | 0 | 2 | null | 2016-11-07T16:21:07 | 2016-11-07T16:21:06 | null | UTF-8 | Java | false | false | 5,381 | java | /*
* The MIT License
*
* Copyright (c) 2016, CloudBees, Inc.
*
* 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 org.jenkinsci.plugins.pipeline.modeldefinition.steps;
import com.cloudbees.hudson.plugins.folder.Folder;
import hudson.ExtensionList;
import hudson.model.Slave;
import org.jenkinsci.plugins.pipeline.modeldefinition.AbstractModelDefTest;
import org.jenkinsci.plugins.pipeline.modeldefinition.config.DockerLabelProvider;
import org.jenkinsci.plugins.pipeline.modeldefinition.config.FolderConfig;
import org.jenkinsci.plugins.pipeline.modeldefinition.config.GlobalConfig;
import org.junit.Test;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertThat;
/**
* Tests {@link DockerLabelStep}.
*
* And related configurations like {@link DockerLabelProvider}.
*/
public class DockerLabelStepTest extends AbstractModelDefTest {
@Test
public void plainSystemConfig() throws Exception {
GlobalConfig.get().setDockerLabel("config_docker");
expect("dockerLabel").logContains("Docker Label is: config_docker").go();
}
@Test
public void testExtensionOrdinal() {
ExtensionList<DockerLabelProvider> all = DockerLabelProvider.all();
assertThat(all, hasSize(2));
assertThat(all.get(0), instanceOf(FolderConfig.FolderDockerLabelProvider.class));
assertThat(all.get(1), instanceOf(GlobalConfig.GlobalConfigDockerLabelProvider.class));
}
@Test
public void directParent() throws Exception {
Folder folder = j.createProject(Folder.class);
folder.addProperty(new FolderConfig("folder_docker"));
expect("dockerLabel").inFolder(folder).runFromRepo(false).logContains("Docker Label is: folder_docker").go();
}
@Test
public void directParentNotSystem() throws Exception {
GlobalConfig.get().setDockerLabel("config_docker");
Folder folder = j.createProject(Folder.class);
folder.addProperty(new FolderConfig("folder_docker"));
expect("dockerLabel").inFolder(folder).runFromRepo(false)
.logContains("Docker Label is: folder_docker").logNotContains("config_docker").go();
}
@Test
public void grandParent() throws Exception {
Folder grandParent = j.createProject(Folder.class);
grandParent.addProperty(new FolderConfig("parent_docker"));
Folder parent = grandParent.createProject(Folder.class, "testParent"); //Can be static since grandParent should be unique
expect("dockerLabel").inFolder(parent).runFromRepo(false).logContains("Docker Label is: parent_docker").go();
}
@Test
public void grandParentOverride() throws Exception {
Folder grandParent = j.createProject(Folder.class);
grandParent.addProperty(new FolderConfig("grand_parent_docker"));
Folder parent = grandParent.createProject(Folder.class, "testParent"); //Can be static since grandParent should be unique
parent.addProperty(new FolderConfig("parent_docker"));
expect("dockerLabel").inFolder(parent).runFromRepo(false)
.logContains("Docker Label is: parent_docker")
.logNotContains("grand_parent_docker").go();
}
@Test
public void runsOnCorrectSlave() throws Exception {
assumeDocker();
Slave s = j.createOnlineSlave();
s.setLabelString("notthis");
env(s).put("DOCKER_INDICATOR", "WRONG").set();
s = j.createOnlineSlave();
s.setLabelString("thisone");
env(s).put("DOCKER_INDICATOR", "CORRECT").set();
GlobalConfig.get().setDockerLabel("thisone");
expect("agentDockerEnvTest").runFromRepo(false).logContains("Running on assumed Docker agent").go();
}
@Test
public void runsOnSpecifiedSlave() throws Exception {
assumeDocker();
Slave s = j.createOnlineSlave();
s.setLabelString("thisspec");
env(s).put("DOCKER_INDICATOR", "SPECIFIED").set();
s = j.createOnlineSlave();
s.setLabelString("thisone");
env(s).put("DOCKER_INDICATOR", "CORRECT").set();
GlobalConfig.get().setDockerLabel("thisone");
expect("agentDockerEnvSpecLabel").runFromRepo(false).logContains("Running on assumed Docker agent").go();
}
} | [
"rsandell@cloudbees.com"
] | rsandell@cloudbees.com |
6eb6241244dbfda80afe984b66e27ca035e871a3 | 49009bfd3531fc9b326931f5f4f598840e2fa5ec | /app/src/main/java/cn/bsd/learn/transfer/files/utils/Utils.java | 5eccfa9e8191e9dcf1f097ba1298ccf53a185bd5 | [] | no_license | ApeCold/Learn_Transfer_Files | 04e08434d1b8be64a1d6f42c8e3a964a19db0f81 | 513c4401b6d7ddabbbbab27c7ab82da5dfed37be | refs/heads/master | 2020-05-27T05:58:21.042622 | 2019-05-25T02:26:06 | 2019-05-25T02:26:06 | 188,511,138 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package cn.bsd.learn.transfer.files.utils;
import com.netease.async.library.EventBus;
import com.netease.async.library.util.Constants;
import java.io.File;
import java.text.DecimalFormat;
public class Utils {
// 获取文件大小
public static String getFileSize(long length) {
DecimalFormat df = new DecimalFormat("######0.00");
double d1 = 3.23456;
double d2 = 0.0;
double d3 = 2.0;
df.format(d1);
df.format(d2);
df.format(d3);
long l = length / 1000;//KB
if (l < 1024) {
return df.format(l) + "KB";
} else if (l < 1024 * 1024.f) {
return df.format((l / 1024.f)) + "MB";
}
return df.format(l / 1024.f / 1024.f) + "GB";
}
// 删除所有文件
public static void deleteAll() {
File dir = Constants.DIR;
if (dir.exists() && dir.isDirectory()) {
File[] fileNames = dir.listFiles();
if (fileNames != null) {
for (File fileName : fileNames) {
fileName.delete();
}
}
}
EventBus.getDefault().post(Constants.RxBusEventType.LOAD_BOOK_LIST);
}
// 获取文件名
public static String getFileName(String pathandname) {
int start = pathandname.lastIndexOf("/");
int end = pathandname.lastIndexOf(".");
if (start != -1 && end != -1) {
return pathandname.substring(start + 1, end);
} else {
return null;
}
}
}
| [
"bishiduo@126.com"
] | bishiduo@126.com |
742ff2a508b566cca481a291fc225a9e4ae8f517 | e08682a48609402c31d059215cfb62adb32c993b | /core/src/main/java/com/gaoding/datay/core/container/util/JobAssignUtil.java | 6dbcc95c903c921a7984bbd76af6883593f3014e | [] | no_license | ywq20011/DataY | 96b1af92bf98899efc303dc2d21a94ef9fdb643a | 60310a86f69c13a21dcacc16e294486fd79b79b4 | refs/heads/main | 2023-03-15T17:58:53.379236 | 2021-03-08T09:57:09 | 2021-03-08T09:57:09 | 345,607,997 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,669 | java | package com.gaoding.datay.core.container.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import com.gaoding.datay.common.constant.CommonConstant;
import com.gaoding.datay.common.util.Configuration;
import com.gaoding.datay.core.util.container.CoreConstant;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.StringUtils;
public final class JobAssignUtil {
private JobAssignUtil() {
}
/**
* 公平的分配 task 到对应的 taskGroup 中。
* 公平体现在:会考虑 task 中对资源负载作的 load 标识进行更均衡的作业分配操作。
* TODO 具体文档举例说明
*/
public static List<Configuration> assignFairly(Configuration configuration, int channelNumber, int channelsPerTaskGroup) {
Validate.isTrue(configuration != null, "框架获得的 Job 不能为 null.");
List<Configuration> contentConfig = configuration.getListConfiguration(CoreConstant.DATAX_JOB_CONTENT);
Validate.isTrue(contentConfig.size() > 0, "框架获得的切分后的 Job 无内容.");
Validate.isTrue(channelNumber > 0 && channelsPerTaskGroup > 0,
"每个channel的平均task数[averTaskPerChannel],channel数目[channelNumber],每个taskGroup的平均channel数[channelsPerTaskGroup]都应该为正数");
int taskGroupNumber = (int) Math.ceil(1.0 * channelNumber / channelsPerTaskGroup);
Configuration aTaskConfig = contentConfig.get(0);
String readerResourceMark = aTaskConfig.getString(CoreConstant.JOB_READER_PARAMETER + "." +
CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
String writerResourceMark = aTaskConfig.getString(CoreConstant.JOB_WRITER_PARAMETER + "." +
CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
boolean hasLoadBalanceResourceMark = StringUtils.isNotBlank(readerResourceMark) ||
StringUtils.isNotBlank(writerResourceMark);
if (!hasLoadBalanceResourceMark) {
// fake 一个固定的 key 作为资源标识(在 reader 或者 writer 上均可,此处选择在 reader 上进行 fake)
for (Configuration conf : contentConfig) {
conf.set(CoreConstant.JOB_READER_PARAMETER + "." +
CommonConstant.LOAD_BALANCE_RESOURCE_MARK, "aFakeResourceMarkForLoadBalance");
}
// 是为了避免某些插件没有设置 资源标识 而进行了一次随机打乱操作
Collections.shuffle(contentConfig, new Random(System.currentTimeMillis()));
}
LinkedHashMap<String, List<Integer>> resourceMarkAndTaskIdMap = parseAndGetResourceMarkAndTaskIdMap(contentConfig);
List<Configuration> taskGroupConfig = doAssign(resourceMarkAndTaskIdMap, configuration, taskGroupNumber);
// 调整 每个 taskGroup 对应的 Channel 个数(属于优化范畴)
adjustChannelNumPerTaskGroup(taskGroupConfig, channelNumber);
return taskGroupConfig;
}
private static void adjustChannelNumPerTaskGroup(List<Configuration> taskGroupConfig, int channelNumber) {
int taskGroupNumber = taskGroupConfig.size();
int avgChannelsPerTaskGroup = channelNumber / taskGroupNumber;
int remainderChannelCount = channelNumber % taskGroupNumber;
// 表示有 remainderChannelCount 个 taskGroup,其对应 Channel 个数应该为:avgChannelsPerTaskGroup + 1;
// (taskGroupNumber - remainderChannelCount)个 taskGroup,其对应 Channel 个数应该为:avgChannelsPerTaskGroup
int i = 0;
for (; i < remainderChannelCount; i++) {
taskGroupConfig.get(i).set(CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_CHANNEL, avgChannelsPerTaskGroup + 1);
}
for (int j = 0; j < taskGroupNumber - remainderChannelCount; j++) {
taskGroupConfig.get(i + j).set(CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_CHANNEL, avgChannelsPerTaskGroup);
}
}
/**
* 根据task 配置,获取到:
* 资源名称 --> taskId(List) 的 map 映射关系
*/
private static LinkedHashMap<String, List<Integer>> parseAndGetResourceMarkAndTaskIdMap(List<Configuration> contentConfig) {
// key: resourceMark, value: taskId
LinkedHashMap<String, List<Integer>> readerResourceMarkAndTaskIdMap = new LinkedHashMap<String, List<Integer>>();
LinkedHashMap<String, List<Integer>> writerResourceMarkAndTaskIdMap = new LinkedHashMap<String, List<Integer>>();
for (Configuration aTaskConfig : contentConfig) {
int taskId = aTaskConfig.getInt(CoreConstant.TASK_ID);
// 把 readerResourceMark 加到 readerResourceMarkAndTaskIdMap 中
String readerResourceMark = aTaskConfig.getString(CoreConstant.JOB_READER_PARAMETER + "." + CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
if (readerResourceMarkAndTaskIdMap.get(readerResourceMark) == null) {
readerResourceMarkAndTaskIdMap.put(readerResourceMark, new LinkedList<Integer>());
}
readerResourceMarkAndTaskIdMap.get(readerResourceMark).add(taskId);
// 把 writerResourceMark 加到 writerResourceMarkAndTaskIdMap 中
String writerResourceMark = aTaskConfig.getString(CoreConstant.JOB_WRITER_PARAMETER + "." + CommonConstant.LOAD_BALANCE_RESOURCE_MARK);
if (writerResourceMarkAndTaskIdMap.get(writerResourceMark) == null) {
writerResourceMarkAndTaskIdMap.put(writerResourceMark, new LinkedList<Integer>());
}
writerResourceMarkAndTaskIdMap.get(writerResourceMark).add(taskId);
}
if (readerResourceMarkAndTaskIdMap.size() >= writerResourceMarkAndTaskIdMap.size()) {
// 采用 reader 对资源做的标记进行 shuffle
return readerResourceMarkAndTaskIdMap;
} else {
// 采用 writer 对资源做的标记进行 shuffle
return writerResourceMarkAndTaskIdMap;
}
}
/**
* /**
* 需要实现的效果通过例子来说是:
* <pre>
* a 库上有表:0, 1, 2
* a 库上有表:3, 4
* c 库上有表:5, 6, 7
*
* 如果有 4个 taskGroup
* 则 assign 后的结果为:
* taskGroup-0: 0, 4,
* taskGroup-1: 3, 6,
* taskGroup-2: 5, 2,
* taskGroup-3: 1, 7
*
* </pre>
*/
private static List<Configuration> doAssign(LinkedHashMap<String, List<Integer>> resourceMarkAndTaskIdMap, Configuration jobConfiguration, int taskGroupNumber) {
List<Configuration> contentConfig = jobConfiguration.getListConfiguration(CoreConstant.DATAX_JOB_CONTENT);
Configuration taskGroupTemplate = jobConfiguration.clone();
taskGroupTemplate.remove(CoreConstant.DATAX_JOB_CONTENT);
List<Configuration> result = new LinkedList<Configuration>();
List<List<Configuration>> taskGroupConfigList = new ArrayList<List<Configuration>>(taskGroupNumber);
for (int i = 0; i < taskGroupNumber; i++) {
taskGroupConfigList.add(new LinkedList<Configuration>());
}
int mapValueMaxLength = -1;
List<String> resourceMarks = new ArrayList<String>();
for (Map.Entry<String, List<Integer>> entry : resourceMarkAndTaskIdMap.entrySet()) {
resourceMarks.add(entry.getKey());
if (entry.getValue().size() > mapValueMaxLength) {
mapValueMaxLength = entry.getValue().size();
}
}
int taskGroupIndex = 0;
for (int i = 0; i < mapValueMaxLength; i++) {
for (String resourceMark : resourceMarks) {
if (resourceMarkAndTaskIdMap.get(resourceMark).size() > 0) {
int taskId = resourceMarkAndTaskIdMap.get(resourceMark).get(0);
taskGroupConfigList.get(taskGroupIndex % taskGroupNumber).add(contentConfig.get(taskId));
taskGroupIndex++;
resourceMarkAndTaskIdMap.get(resourceMark).remove(0);
}
}
}
Configuration tempTaskGroupConfig;
for (int i = 0; i < taskGroupNumber; i++) {
tempTaskGroupConfig = taskGroupTemplate.clone();
tempTaskGroupConfig.set(CoreConstant.DATAX_JOB_CONTENT, taskGroupConfigList.get(i));
tempTaskGroupConfig.set(CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_ID, i);
result.add(tempTaskGroupConfig);
}
return result;
}
}
| [
"yuanfang@gaoding.com"
] | yuanfang@gaoding.com |
e0726350e938059d6e2fa730b638ab59560c5235 | 53efcbcb8210a01c3a57cdc2784926ebc22d6412 | /src/main/java/br/com/fieesq/model54330/FieEsq05343.java | 0ea52701cdde3f344be411901c0fbc6606220415 | [] | no_license | fie23777/frontCercamento | d57846ac985f4023a8104a0872ca4a226509bbf2 | 6282f842544ab4ea332fe7802d08cf4e352f0ae3 | refs/heads/master | 2021-04-27T17:29:56.793349 | 2018-02-21T10:32:23 | 2018-02-21T10:32:23 | 122,322,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package br.com.fieesq.model54330;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
@Entity
public class FieEsq05343 {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String numEsq05343;
@Transient
private String esqParam;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNumEsq05343() {
return numEsq05343;
}
public void setNumEsq05343(String numEsq05343) {
this.numEsq05343 = numEsq05343;
}
public String getEsqParam() {
return esqParam;
}
public void setEsqParam(String esqParam) {
this.esqParam = esqParam;
}
}
| [
"fie2377@gmail.com"
] | fie2377@gmail.com |
f14ae67125e078a96992d16c72cc163a592346e8 | c827bfebbde82906e6b14a3f77d8f17830ea35da | /Development3.0/TeevraServer/platform/businessobject/src/main/java/org/fixprotocol/fixml_5_0_sp2/BidDescReqGrpBlockT.java | 9ec4cf85c90bff9dc11a4a775c90c7487421cb05 | [] | no_license | GiovanniPucariello/TeevraCore | 13ccf7995c116267de5c403b962f1dc524ac1af7 | 9d755cc9ca91fb3ebc5b227d9de6bcf98a02c7b7 | refs/heads/master | 2021-05-29T18:12:29.174279 | 2013-04-22T07:44:28 | 2013-04-22T07:44:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,413 | java |
package org.fixprotocol.fixml_5_0_sp2;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for BidDescReqGrp_Block_t complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="BidDescReqGrp_Block_t">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <group ref="{http://www.fixprotocol.org/FIXML-5-0-SP2}BidDescReqGrpElements"/>
* </sequence>
* <attGroup ref="{http://www.fixprotocol.org/FIXML-5-0-SP2}BidDescReqGrpAttributes"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BidDescReqGrp_Block_t")
public class BidDescReqGrpBlockT {
@XmlAttribute(name = "BidDescptrTyp")
protected BigInteger bidDescptrTyp;
@XmlAttribute(name = "BidDescptr")
protected String bidDescptr;
@XmlAttribute(name = "SideValuInd")
protected BigInteger sideValuInd;
@XmlAttribute(name = "LqdtyValu")
protected BigDecimal lqdtyValu;
@XmlAttribute(name = "LqdtyNumSecurities")
protected BigInteger lqdtyNumSecurities;
@XmlAttribute(name = "LqdtyPctLow")
protected BigDecimal lqdtyPctLow;
@XmlAttribute(name = "LqdtyPctHigh")
protected BigDecimal lqdtyPctHigh;
@XmlAttribute(name = "EFPTrkngErr")
protected BigDecimal efpTrkngErr;
@XmlAttribute(name = "FairValu")
protected BigDecimal fairValu;
@XmlAttribute(name = "OutsideNdxPct")
protected BigDecimal outsideNdxPct;
@XmlAttribute(name = "ValuOfFuts")
protected BigDecimal valuOfFuts;
/**
* Gets the value of the bidDescptrTyp property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getBidDescptrTyp() {
return bidDescptrTyp;
}
/**
* Sets the value of the bidDescptrTyp property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setBidDescptrTyp(BigInteger value) {
this.bidDescptrTyp = value;
}
/**
* Gets the value of the bidDescptr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBidDescptr() {
return bidDescptr;
}
/**
* Sets the value of the bidDescptr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBidDescptr(String value) {
this.bidDescptr = value;
}
/**
* Gets the value of the sideValuInd property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSideValuInd() {
return sideValuInd;
}
/**
* Sets the value of the sideValuInd property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSideValuInd(BigInteger value) {
this.sideValuInd = value;
}
/**
* Gets the value of the lqdtyValu property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLqdtyValu() {
return lqdtyValu;
}
/**
* Sets the value of the lqdtyValu property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLqdtyValu(BigDecimal value) {
this.lqdtyValu = value;
}
/**
* Gets the value of the lqdtyNumSecurities property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getLqdtyNumSecurities() {
return lqdtyNumSecurities;
}
/**
* Sets the value of the lqdtyNumSecurities property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setLqdtyNumSecurities(BigInteger value) {
this.lqdtyNumSecurities = value;
}
/**
* Gets the value of the lqdtyPctLow property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLqdtyPctLow() {
return lqdtyPctLow;
}
/**
* Sets the value of the lqdtyPctLow property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLqdtyPctLow(BigDecimal value) {
this.lqdtyPctLow = value;
}
/**
* Gets the value of the lqdtyPctHigh property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getLqdtyPctHigh() {
return lqdtyPctHigh;
}
/**
* Sets the value of the lqdtyPctHigh property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setLqdtyPctHigh(BigDecimal value) {
this.lqdtyPctHigh = value;
}
/**
* Gets the value of the efpTrkngErr property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getEFPTrkngErr() {
return efpTrkngErr;
}
/**
* Sets the value of the efpTrkngErr property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setEFPTrkngErr(BigDecimal value) {
this.efpTrkngErr = value;
}
/**
* Gets the value of the fairValu property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getFairValu() {
return fairValu;
}
/**
* Sets the value of the fairValu property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setFairValu(BigDecimal value) {
this.fairValu = value;
}
/**
* Gets the value of the outsideNdxPct property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getOutsideNdxPct() {
return outsideNdxPct;
}
/**
* Sets the value of the outsideNdxPct property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setOutsideNdxPct(BigDecimal value) {
this.outsideNdxPct = value;
}
/**
* Gets the value of the valuOfFuts property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getValuOfFuts() {
return valuOfFuts;
}
/**
* Sets the value of the valuOfFuts property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setValuOfFuts(BigDecimal value) {
this.valuOfFuts = value;
}
}
| [
"ritwik.bose@headstrong.com"
] | ritwik.bose@headstrong.com |
1b1fde14f4f58b1f3bbaa233520a47327e12f1a3 | 056483e0e2fbe72fb86264f3aff0066d22b18db5 | /ch06/src/Exercise15/MemberService.java | a22d4fcddc974bcb186f5e66a2de6c6d1e0255da | [] | no_license | lx9203/java-lecture | f614f6b31f5ae547bd3d00104184dcb926255c16 | 6bf104b394fc25558c46c79bf65cf855a599bb9c | refs/heads/master | 2020-04-28T19:55:37.974525 | 2019-05-20T01:05:07 | 2019-05-20T01:05:07 | 175,526,926 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package Exercise15;
public class MemberService {
public boolean login(String string, String string2) {
if (string == "hong") {
if (string2 == "12345")
return true;
}
return false;
}
public void logout(String string) {
if (string == "hong")
System.out.println("로그아웃 되었습니다.");
}
}
| [
"lx9203@naver.com"
] | lx9203@naver.com |
34ed07d42150ad4cc31c677a8e7b32262ca1d33d | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/MATH-49b-3-17-Single_Objective_GGA-IntegrationSingleObjective-/org/apache/commons/math/linear/OpenMapRealVector_ESTest.java | 31fd48b76569e49c6a1d5d759170f7ce249d62ad | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,725 | java | /*
* This file was automatically generated by EvoSuite
* Mon May 18 02:42:33 UTC 2020
*/
package org.apache.commons.math.linear;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math.linear.OpenMapRealVector;
import org.apache.commons.math.linear.RealVector;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class OpenMapRealVector_ESTest extends OpenMapRealVector_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
Double[] doubleArray0 = new Double[3];
Double double0 = new Double(0.6299605249474366);
doubleArray0[0] = double0;
Double double1 = new Double(0.6299605249474366);
doubleArray0[1] = double1;
Double double2 = new Double(0.6299605249474366);
doubleArray0[2] = double2;
OpenMapRealVector openMapRealVector0 = new OpenMapRealVector(doubleArray0, (double) doubleArray0[1]);
openMapRealVector0.getDimension();
RealVector realVector0 = openMapRealVector0.mapDivideToSelf((double) doubleArray0[0]);
Double double3 = new Double(0.6299605249474366);
Double double4 = new Double(0.0);
Double double5 = new Double((double) doubleArray0[1]);
OpenMapRealVector openMapRealVector1 = new OpenMapRealVector(doubleArray0, (double) doubleArray0[0]);
realVector0.getDimension();
RealVector realVector1 = openMapRealVector0.mapDivideToSelf(185.043344952252);
// Undeclared exception!
openMapRealVector1.ebeMultiply(realVector1);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
601166cab691187a3748c7533cbab447483f7ab2 | 8fe74121699e5da3df1419360356679692c28f2f | /gui.mtm/src/main/java/zenryokuservice/gui/lwjgl/tutoriral/gitbook/chapter6/engine/graph/Mesh.java | f4f5c56ad1e8e9f51b019682c876c404dd98154c | [
"MIT"
] | permissive | ZenryokuService/MultiTaskManager | 8ee87cd2f08805898a41587c14942c812299094b | 04f3573cbdb15ca56676e55ed2e31772a7c27edd | refs/heads/master | 2021-06-09T03:36:57.853552 | 2021-04-12T11:37:40 | 2021-04-12T11:37:40 | 151,907,430 | 0 | 0 | MIT | 2020-10-13T10:18:02 | 2018-10-07T04:57:02 | Java | UTF-8 | Java | false | false | 3,206 | java | package zenryokuservice.gui.lwjgl.tutoriral.gitbook.chapter6.engine.graph;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL30.*;
import org.lwjgl.system.MemoryUtil;
public class Mesh {
private final int vaoId;
private final int posVboId;
private final int colourVboId;
private final int idxVboId;
private final int vertexCount;
public Mesh(float[] positions, float[] colours, int[] indices) {
FloatBuffer posBuffer = null;
FloatBuffer colourBuffer = null;
IntBuffer indicesBuffer = null;
try {
vertexCount = indices.length;
vaoId = glGenVertexArrays();
glBindVertexArray(vaoId);
// Position VBO
posVboId = glGenBuffers();
posBuffer = MemoryUtil.memAllocFloat(positions.length);
posBuffer.put(positions).flip();
glBindBuffer(GL_ARRAY_BUFFER, posVboId);
glBufferData(GL_ARRAY_BUFFER, posBuffer, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
// Colour VBO
colourVboId = glGenBuffers();
colourBuffer = MemoryUtil.memAllocFloat(colours.length);
colourBuffer.put(colours).flip();
glBindBuffer(GL_ARRAY_BUFFER, colourVboId);
glBufferData(GL_ARRAY_BUFFER, colourBuffer, GL_STATIC_DRAW);
glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);
// Index VBO
idxVboId = glGenBuffers();
indicesBuffer = MemoryUtil.memAllocInt(indices.length);
indicesBuffer.put(indices).flip();
// メモリの解放
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicesBuffer, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
} finally {
if (posBuffer != null) {
MemoryUtil.memFree(posBuffer);
}
if (colourBuffer != null) {
MemoryUtil.memFree(colourBuffer);
}
if (indicesBuffer != null) {
MemoryUtil.memFree(indicesBuffer);
}
}
}
public int getVaoId() {
return vaoId;
}
public int getVertexCount() {
return vertexCount;
}
public void cleanUp() {
glDisableVertexAttribArray(0);
// Delete the VBOs
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(posVboId);
glDeleteBuffers(colourVboId);
glDeleteBuffers(idxVboId);
// Delete the VAO
glBindVertexArray(0);
glDeleteVertexArrays(vaoId);
}
// 追加メソッド
public void render() {
glBindVertexArray(getVaoId());
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glDrawElements(GL_TRIANGLES, getVertexCount(), GL_UNSIGNED_INT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glBindVertexArray(0);
}
}
| [
"yogotak45@gmail.com"
] | yogotak45@gmail.com |
fab4e0e77db32618063b846904261599066f1fc1 | 473b76b1043df2f09214f8c335d4359d3a8151e0 | /benchmark/bigclonebenchdata_partial/13949581.java | 749e6bd5f503f268cdab2cb04b5c606743bfcf3f | [] | no_license | whatafree/JCoffee | 08dc47f79f8369af32e755de01c52d9a8479d44c | fa7194635a5bd48259d325e5b0a190780a53c55f | refs/heads/master | 2022-11-16T01:58:04.254688 | 2020-07-13T20:11:17 | 2020-07-13T20:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java |
class c13949581 {
public static String cryptografar(String senha) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(senha.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
senha = hash.toString(16);
} catch (NoSuchAlgorithmException ns) {
ns.printStackTrace();
}
return senha;
}
}
| [
"piyush16066@iiitd.ac.in"
] | piyush16066@iiitd.ac.in |
5e0846ed167a386905e870604b1596360ff8a52f | 442d904a36e566e8568dc04a72edef1c0f7dfcd0 | /src/main/java/br/com/caelum/ingresso/validacao/GerenciadorDeSessao.java | d466a5127d6d3481fea7bf52d2a8821d20062b7b | [] | no_license | rodrigotavares1511/fj22-ingressos | f2db9fa5720be4ac4a258846d5804a9bc69557ad | 49ae7a10e2036fde60b519697fa1aeaab1109012 | refs/heads/master | 2021-07-19T15:42:23.770191 | 2017-10-28T00:23:14 | 2017-10-28T00:23:14 | 108,051,882 | 0 | 0 | null | 2017-10-23T23:26:51 | 2017-10-23T23:26:51 | null | UTF-8 | Java | false | false | 1,095 | java | package br.com.caelum.ingresso.validacao;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import br.com.caelum.ingresso.model.Sessao;
public class GerenciadorDeSessao {
private List<Sessao> sessoesDaSala;
public GerenciadorDeSessao(List<Sessao> sessoesDaSala){
this.sessoesDaSala = sessoesDaSala;
}
private boolean horarioIsValido(Sessao sessaoExistente, Sessao sessaoAtual){
LocalDate hoje = LocalDate.now();
LocalDateTime horarioSessao = sessaoExistente.getHorario().atDate(hoje);
LocalDateTime horarioAtual = sessaoAtual.getHorario().atDate(hoje);
boolean ehAntes = sessaoAtual.getHorario().isBefore(sessaoExistente.getHorario());
if(ehAntes){
return sessaoAtual.getHorarioTermino()
.isBefore(horarioSessao);
}else{
return sessaoExistente.getHorarioTermino()
.isBefore(horarioAtual);
}
}
public boolean cabe(Sessao sessaoAtual){
return sessoesDaSala
.stream()
.map(sessaoExistente -> horarioIsValido(sessaoExistente, sessaoAtual))
.reduce(Boolean::logicalAnd)
.orElse(true);
}
}
| [
"rodrigotavares1511@gmail.com"
] | rodrigotavares1511@gmail.com |
a6a37e630074e999bd30f61f8ebf6dcb2ca26034 | 3a1c71927bb1c3c779199e0a3877ffef55118e28 | /src/创建型_单例模式/Singleton1.java | 0e3c3fcad8cd947f860bcf82f93eb9bc543d4896 | [] | no_license | Moujianming/DesignPattern | 7d4ade682f348a88bbc5926227e0d002b7d49518 | 85e32c3a3c4b23998ab5e2d36b7ac4ea3b3a4c32 | refs/heads/master | 2020-03-11T23:46:21.986041 | 2018-04-23T07:33:57 | 2018-04-23T07:33:57 | 130,331,348 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 555 | java | package 创建型_单例模式;
public class Singleton1 {
/* 持有私有静态实例,防止被引用,此处赋值为null,目的是实现延迟加载 */
private static Singleton1 single = null;
/* 私有构造方法,防止被实例化 */
private Singleton1() {};
/* 静态工程方法,创建实例 */
public static Singleton1 getinstance()
{
if(null==single)
{
return new Singleton1();
}
return single;
}
/*序列化前后要保持一致*/
public Object solve()
{
return single;
}
}
| [
"31647832+Moujianming@users.noreply.github.com"
] | 31647832+Moujianming@users.noreply.github.com |
0aca9aea5f0226e93a61d6f4e8aa121b3cde987d | 37749ead9c55b6674070555c8d8d658c6e12ec20 | /SipCommunicator-Fall05/net/java/sip/communicator/sip/CallDispatcher.java | 2fc946aba900c319f157b17a74d3ce790a077194 | [
"Apache-1.1"
] | permissive | azaoui/sip-proxy-communicator | 3e22e0208b3772304d4a44108cdd28ae55017228 | 2de6a1d0181e003d393d3bd66afca3e2874d95e4 | refs/heads/master | 2021-01-10T14:00:47.675004 | 2011-04-07T18:38:22 | 2011-04-07T18:38:22 | 49,427,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,133 | java | /* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
*/
package net.java.sip.communicator.sip;
import java.util.*;
import javax.sip.*;
import javax.sip.message.*;
import net.java.sip.communicator.common.*;
import net.java.sip.communicator.sip.event.*;
/**
* <p>Title: SIP COMMUNICATOR</p>
* <p>Description:JAIN-SIP Audio/Video phone application</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr) </p>
* <p>Network Research Team (http://www-r2.u-strasbg.fr))</p>
* <p>Louis Pasteur University - Strasbourg - France</p>
* @author Emil Ivov (http://www.emcho.com)
* @version 1.1
*
*/
class CallDispatcher
implements CallListener
{
private static final Console console =
Console.getConsole(CallDispatcher.class);
/**
* All currently active calls.
*/
Hashtable calls = new Hashtable();
Call createCall(Dialog dialog,
Request initialRequest
)
{
try {
console.logEntry();
Call call = null;
if (dialog.getDialogId() != null) {
call = findCall(dialog);
}
if (call == null) {
call = new Call();
}
call.setDialog(dialog);
call.setInitialRequest(initialRequest);
// call.setState(Call.DIALING);
calls.put(new Integer(call.hashCode()), call);
if (console.isDebugEnabled()) {
console.debug("created call" + call);
}
call.addStateChangeListener(this);
return call;
}
finally {
console.logExit();
}
}
Call getCall(int id)
{
return (Call) calls.get(new Integer(id));
}
/**
* Find the call that contains the specified dialog.
* @param dialog the dialog whose containg call is to be found
* @return the call that contains the specified dialog.
*/
Call findCall(Dialog dialog)
{
try {
console.logEntry();
if (dialog == null) {
return null;
}
synchronized (calls) {
Enumeration<Object> enumeration = calls.elements();
while (enumeration.hasMoreElements()) {
Call item = (Call) enumeration.nextElement();
if (item.getDialog().getCallId().equals(dialog.getCallId())) {
return item;
}
}
}
return null;
}
finally {
console.logExit();
}
}
/**
* Find the call with the specified CallID header value.
* @param callID the CallID header value of the searched call.
* @return the call with the specified CallID header value.
*/
Call findCall(String callId)
{
try {
console.logEntry();
if (callId == null) {
return null;
}
synchronized (calls) {
Enumeration<Object> enumeration = calls.elements();
while (enumeration.hasMoreElements()) {
Call item = (Call) enumeration.nextElement();
if (item.getDialog().getCallId().equals(callId)) {
return item;
}
}
}
return null;
}
finally {
console.logExit();
}
}
Object[] getAllCalls()
{
return calls.keySet().toArray();
}
private void removeCall(Call call)
{
try {
console.logEntry();
if (console.isDebugEnabled()) {
console.debug("removing call" + call);
}
calls.remove(new Integer(call.getID()));
}
finally {
console.logExit();
}
}
//================================ DialogListener =================
public void callStateChanged(CallStateEvent evt)
{
if (evt.getNewState().equals(Call.DISCONNECTED))
removeCall(evt.getSourceCall());
}
} | [
"alzaxo@gmail.com"
] | alzaxo@gmail.com |
ea047ce552d1324f5995e02aeb9a824e852571bd | eab12c28c69c3f2dbf1ae9c8336d2d75af14f0bb | /app/src/main/java/com/youqu/piclbs/hot/HotAdapter.java | 988788aff2a04964d581b9445ff3bdc07b6b6936 | [] | no_license | huangjingqiang/jiazqlx | 9d33407829b9844f7167dde2391bc02be0a47e49 | ff29122870bd7d59ec0f9cde9cf8d2812b0c8e87 | refs/heads/master | 2021-04-28T21:44:32.895744 | 2017-01-03T10:53:02 | 2017-01-03T10:53:02 | 77,736,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,794 | java | package com.youqu.piclbs.hot;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.youqu.piclbs.R;
import com.youqu.piclbs.bean.AddressBean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by hjq on 16-12-22.
*/
public class HotAdapter extends RecyclerView.Adapter<HotAdapter.MyViewHolder>{
private Activity activity;
private List<AddressBean.TopLocationBean> items;
private onHotItemClickLinstener hotItemClickLinstener;
private List<Boolean> isClick;
public interface onHotItemClickLinstener{
void ItemClisk(int pos,boolean isex);
}
public HotAdapter(Activity activity,List<AddressBean.TopLocationBean> items){
this.activity = activity;
this.items = items;
isClick = new ArrayList<>();
for (int i=0;i<items.size();i++){
isClick.add(false);
}
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(activity).inflate(R.layout.item_text,parent,false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
holder.address.setText(items.get(position).location);
holder.title.setText(items.get(position).name);
if (isClick.get(position)){
holder.title.setSelected(true);
holder.address.setSelected(true);
}else {
holder.title.setSelected(false);
holder.address.setSelected(false);
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (int i=0;i<items.size();i++){
isClick.set(i,false);
}
isClick.set(position,true);
if (hotItemClickLinstener != null){
hotItemClickLinstener.ItemClisk(position,isClick.get(position));
}
}
});
}
@Override
public int getItemCount() {
return items.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder{
TextView title;
TextView address;
public MyViewHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.item_name);
address = (TextView) itemView.findViewById(R.id.item_address);
}
}
public void setHotItemClickLinstener(onHotItemClickLinstener listener){
this.hotItemClickLinstener = listener;
}
}
| [
"1192563856@qq.com"
] | 1192563856@qq.com |
a2466f150ddf5a5987f9f65998a23194d8739362 | 55f0bb56c3e2cefe50f7f8573c6b63973ae57a68 | /src/main/java/com/zerphy/separategwt/web/rest/errors/InternalServerErrorException.java | d3c0b5a069503dbb545ff543b8a3331cffca4a7e | [] | no_license | szerphy/separate-gwt | 9e9fab573caf44fdf607001d64a02c654953201d | 1ff54871214a3f29c7d1da1561f4df05ac23a4df | refs/heads/master | 2020-04-08T14:58:01.894434 | 2018-11-28T07:16:48 | 2018-11-28T07:16:48 | 159,459,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.zerphy.separategwt.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
/**
* Simple exception with a message, that returns an Internal Server Error code.
*/
public class InternalServerErrorException extends AbstractThrowableProblem {
private static final long serialVersionUID = 1L;
public InternalServerErrorException(String message) {
super(ErrorConstants.DEFAULT_TYPE, message, Status.INTERNAL_SERVER_ERROR);
}
}
| [
"zerphy@gmail.com"
] | zerphy@gmail.com |
ccac2b0df261e84b4cf6ab553e5afea06a66e54f | 680aff4a8cb4c1a933fc6ab4e2fc4291d09ca0b5 | /blankApp-jar/src/main/java/org/silverpeas/components/blankApp/blankStuff/BlankStuffService.java | 30e88a109216dd903027eb1144a2e910a1050538 | [] | no_license | ndup0nt/archetype-sandbox | 00987b92459a6ca4a19db2cee96ee81905c86eee | 5d5b0b03e4baad6914c9bf55479b19bb83af588d | refs/heads/master | 2021-01-18T18:32:17.179830 | 2012-10-30T14:47:14 | 2012-10-30T14:47:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,359 | java | /**
* Copyright (C) 2000 - 2012 Silverpeas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* As a special exception to the terms and conditions of version 3.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* Open Source Software ("FLOSS") applications as described in Silverpeas's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* "http://www.silverpeas.org/docs/core/legal/floss_exception.html"
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.silverpeas.components.blankApp.blankStuff;
import java.util.List;
public interface BlankStuffService {
BlankStuff createNewBlankStuff(BlankStuff blankStuff);
List<BlankStuff> getAllBlankStuffs();
}
| [
"nicolas.dupont@oosphere.com"
] | nicolas.dupont@oosphere.com |
c47014c5a3dc2dd4e7a11577d61155d406253c16 | 945b8742f6ce9eaaed44c374d453bcdec3f38376 | /src/main/java/demo/testdemo.java | 65bbcc312f0a1bf7e5719797ab154fd2236b7e69 | [] | no_license | bignyy/gmall2020-parent | ee7534aa45dbc1c071b888156a9083eac08dd4ea | cd1894b298ab5f3cc432dc1e21a6d00b55cafae6 | refs/heads/master | 2022-11-20T07:56:54.815100 | 2020-07-16T07:22:40 | 2020-07-16T07:22:40 | 280,075,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package demo;
public class testdemo {
public static void main(String[] args) {
System.out.println("hahaha");
}
}
| [
"bignyy@126.com"
] | bignyy@126.com |
5c28c08ea5578d6b028c744539e979b50c315d1a | 5cd3c28fa0c396a943b8a32fabf6106e9cb02ad4 | /src/main/java/me/caixin/configuration/RocketMQConfiguration.java | b519f3d85aa0d6c28a806d013f98a0efd10830f3 | [
"Apache-2.0"
] | permissive | cairenjie1985/springBoot-demo | 4a43610129a619299cc979147cdbfebb8e42ba48 | 7d8c55200e84f264758bd783af209cdeaae74bd2 | refs/heads/master | 2021-01-22T00:20:33.474698 | 2017-09-05T01:36:51 | 2017-09-05T01:36:51 | 102,188,894 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,845 | java | package me.caixin.configuration;
import com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import me.caixin.listener.MessageListener;
import me.caixin.rocketmq.RocketMQClientImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.annotation.Order;
/**
* Project Name: spring-boot-demo
* Package Name: me.caixin.configuration
* Function:
* User: roy
* Date: 2017-09-05
*/
@Configuration
@ConfigurationProperties(prefix = "rocketmq")
@PropertySource(value = "classpath:/config/rocketmq.properties")
public class RocketMQConfiguration {
@Order(1)
@Bean(name = "consumer")
public DefaultMQPushConsumer defaultMQPushConsumer(){
DefaultMQPushConsumer defaultMQPushConsumer = new DefaultMQPushConsumer();
defaultMQPushConsumer.setConsumerGroup(this.consumerGroup);
defaultMQPushConsumer.setNamesrvAddr(this.addr);
return defaultMQPushConsumer;
}
@Order(1)
@Bean(name = "producer")
public DefaultMQProducer defaultMQProducer(){
DefaultMQProducer defaultMQProducer = new DefaultMQProducer();
defaultMQProducer.setProducerGroup(this.producerGroup);
defaultMQProducer.setNamesrvAddr(this.addr);
return defaultMQProducer;
}
@Order(1)
@Bean(name="messageListener")
public MessageListener messageListener(){
return new MessageListener();
}
@Order(2)
@Bean(name = "mqClient",initMethod = "init")
public RocketMQClientImpl rocketMQClient(){
RocketMQClientImpl rocketMQClient = new RocketMQClientImpl(this.defaultMQPushConsumer(), this.defaultMQProducer());
rocketMQClient.setMessageListener(this.messageListener());
rocketMQClient.setTopicTags(this.topicTags);
return rocketMQClient;
}
private String consumerGroup ;
private String addr;
private String producerGroup;
private String topicTags;
public String getConsumerGroup() {
return consumerGroup;
}
public void setConsumerGroup(String consumerGroup) {
this.consumerGroup = consumerGroup;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getProducerGroup() {
return producerGroup;
}
public void setProducerGroup(String producerGroup) {
this.producerGroup = producerGroup;
}
public String getTopicTags() {
return topicTags;
}
public void setTopicTags(String topicTags) {
this.topicTags = topicTags;
}
}
| [
"cairenjie1985@163.com"
] | cairenjie1985@163.com |
ec7a9fc92ab52ab8c226960241e6fe0285dd7ff9 | 25836d343d8ad830b4452c5affe127a869cff882 | /src/test/java/it/uom/cse/MathOperationTest.java | 8d22b787c0ba98a21452e1b5c80b1e52a039c4e3 | [] | no_license | Sathira443/cse-workshop | 9f3584754a640650363f9ef4bcf644cb08abd9f8 | a8f4314e1630ca9c89ff274850837c508704a545 | refs/heads/master | 2023-08-14T08:59:09.080032 | 2021-09-23T05:13:38 | 2021-09-23T05:13:38 | 409,442,988 | 1 | 0 | null | 2021-09-23T04:40:11 | 2021-09-23T04:06:41 | Java | UTF-8 | Java | false | false | 346 | java | package it.uom.cse;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
//This is a comment
class MathOperationTest {
@Test
void add() {
assertEquals(MathOperation.add(1, 1), 2);
}
@Test
void subtract() {
assertEquals(MathOperation.subtract(2, 1), 1);
}
}
| [
"liyanapathiranasathira@gmail.com"
] | liyanapathiranasathira@gmail.com |
e88965ebeb8812931d308b706bc96bf6b42d0ebd | 947fc9eef832e937f09f04f1abd82819cd4f97d3 | /src/apk/e/a/b/E.java | 3842b2795a0e33420ca11e29d547c3fc350260e7 | [] | no_license | thistehneisen/cifra | 04f4ac1b230289f8262a0b9cf7448a1172d8f979 | d46c6f4764c9d4f64e45c56fa42fddee9b44ff5a | refs/heads/master | 2020-09-22T09:35:57.739040 | 2019-12-01T19:39:59 | 2019-12-01T19:39:59 | 225,136,583 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | package e.a.b;
import java.nio.charset.Charset;
/* compiled from: Util */
final class E {
/* renamed from: a reason: collision with root package name */
public static final Charset f7872a = Charset.forName("UTF-8");
public static int a(int i2) {
return ((i2 & 255) << 24) | ((-16777216 & i2) >>> 24) | ((16711680 & i2) >>> 8) | ((65280 & i2) << 8);
}
public static short a(short s) {
short s2 = s & 65535;
return (short) (((s2 & 255) << 8) | ((65280 & s2) >>> 8));
}
public static void a(long j2, long j3, long j4) {
if ((j3 | j4) < 0 || j3 > j2 || j2 - j3 < j4) {
throw new ArrayIndexOutOfBoundsException(String.format("size=%s offset=%s byteCount=%s", new Object[]{Long.valueOf(j2), Long.valueOf(j3), Long.valueOf(j4)}));
}
}
private static <T extends Throwable> void b(Throwable th) throws Throwable {
throw th;
}
public static void a(Throwable th) {
b(th);
throw null;
}
public static boolean a(byte[] bArr, int i2, byte[] bArr2, int i3, int i4) {
for (int i5 = 0; i5 < i4; i5++) {
if (bArr[i5 + i2] != bArr2[i5 + i3]) {
return false;
}
}
return true;
}
}
| [
"putnins@nils.digital"
] | putnins@nils.digital |
3a697cb7700e6809f284eeb76575eabc966eae46 | 25599b5830f6d669336fbfe08bf6244822b24468 | /src/main/java/pl/edu/icm/comac/vis/server/model/Node.java | 5d1cab0d7bfb5f1989e5193fc937f8a672ecda73 | [] | no_license | CeON/comac-navigator-backend | ad7fd8417b4f4c1eedb0158d515db79b24829853 | 4ab1a2518d0c4b66bfae184f38fff8c6cdf26037 | refs/heads/master | 2021-01-10T18:12:45.562628 | 2016-11-04T10:13:36 | 2016-11-04T10:13:36 | 47,757,382 | 1 | 1 | null | 2016-11-04T10:13:37 | 2015-12-10T11:25:02 | Java | UTF-8 | Java | false | false | 1,385 | 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 pl.edu.icm.comac.vis.server.model;
/**
*
* @author Aleksander Nowinski <a.nowinski@icm.edu.pl>
*/
public class Node {
String id;
NodeType type;
String name;
double importance=1.0;
boolean favourite=false;
public Node() {
}
public Node(String id, NodeType type, String name, double importance) {
this.id = id;
this.type = type;
this.name = name;
this.importance = importance;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getImportance() {
return importance;
}
public void setImportance(double importance) {
this.importance = importance;
}
public boolean isFavourite() {
return favourite;
}
public void setFavourite(boolean favourite) {
this.favourite = favourite;
}
public NodeType getType() {
return type;
}
public void setType(NodeType type) {
this.type = type;
}
}
| [
"aleksander.nowinski@gmail.com"
] | aleksander.nowinski@gmail.com |
b43fef39e70a47e2401297ad5a086e3991fb6936 | 65e1eeaabac6009e8be0a5adb36ac6a999d348c8 | /ofdrw-reader/src/main/java/org/ofdrw/reader/tools/NameSpaceCleaner.java | 633dd52f7a8dbe29bf3ac23e02b439edbaadfe96 | [
"Apache-2.0"
] | permissive | cpacm/ofdrw | 92e67ae5c5968e8d6a16b5b6042525c2646b1f0f | 157f48ec00faa6d3b22d4c0f5aa83ae58d3d44f0 | refs/heads/master | 2022-08-29T08:44:30.574990 | 2022-07-20T12:14:51 | 2022-07-20T12:14:51 | 253,667,094 | 1 | 1 | MIT | 2020-04-07T02:30:04 | 2020-04-07T02:30:04 | null | UTF-8 | Java | false | false | 1,024 | java | package org.ofdrw.reader.tools;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.VisitorSupport;
import org.dom4j.tree.DefaultElement;
/**
* 命名空间清理类
* <p>
* 用于清理已经存在的命名空间
*
* @author libra19911018
* @since 2020-10-15 19:38:15
*/
public class NameSpaceCleaner extends VisitorSupport {
public void visit(Document document) {
((DefaultElement) document.getRootElement()).setNamespace(Namespace.NO_NAMESPACE);
document.getRootElement().additionalNamespaces().clear();
}
public void visit(Namespace namespace) {
namespace.detach();
}
// public void visit(Attribute node) {
// if (node.toString().contains("xmlns") || node.toString().contains("ofd:")) {
// node.detach();
// }
// }
public void visit(Element node) {
if (node instanceof DefaultElement) {
((DefaultElement) node).setNamespace(Namespace.NO_NAMESPACE);
}
}
}
| [
"005006007"
] | 005006007 |
d7074a55a17d9f9cb665bf70e834045b8b2b664a | f3d2df2f2aff927bad0b6bae713fc93dcbba052c | /src/me/daddychurchill/CityWorld/Support/SupportChunk.java | ed8eb6f300673589dbab4fc29b5e8773a63592e8 | [] | no_license | lazareth241/CityWorld | dbbb8f709d3df905138c5f58db41339edffeb70b | 9112f4fb1f50ff30b18bb09c38dced3975038dda | refs/heads/master | 2021-01-16T20:42:59.610649 | 2013-05-24T16:49:45 | 2013-05-24T16:49:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,698 | java | package me.daddychurchill.CityWorld.Support;
import me.daddychurchill.CityWorld.WorldGenerator;
import org.bukkit.Material;
import org.bukkit.World;
public abstract class SupportChunk {
public World world;
public int chunkX;
public int chunkZ;
public int worldX;
public int worldZ;
public int width;
public int height;
// private byte[] ores;
public static final int chunksBlockWidth = 16;
public static final int sectionsPerChunk = 16;
public static final byte airId = (byte) Material.AIR.getId();
public static final byte stoneId = (byte) Material.STONE.getId();
public static final byte ironId = (byte) Material.IRON_ORE.getId();
public static final byte goldId = (byte) Material.GOLD_ORE.getId();
public static final byte lapisId = (byte) Material.LAPIS_ORE.getId();
public static final byte redstoneId = (byte) Material.REDSTONE_ORE.getId();
public static final byte diamondId = (byte) Material.DIAMOND_ORE.getId();
public static final byte coalId = (byte) Material.COAL_ORE.getId();
public static final byte dirtId = (byte) Material.DIRT.getId();
public static final byte grassId = (byte) Material.GRASS.getId();
public static final byte stepId = (byte) Material.STEP.getId();
public static final byte snowId = (byte) Material.SNOW.getId();
public static final byte iceId = (byte) Material.ICE.getId(); // the fluid type
public static final byte waterId = (byte) Material.WATER.getId(); // the fluid type
public static final byte lavaId = (byte) Material.LAVA.getId(); // the fluid type
public static final byte stillWaterId = (byte) Material.STATIONARY_WATER.getId(); // the fluid type
public static final byte stillLavaId = (byte) Material.STATIONARY_LAVA.getId(); // the fluid type
public SupportChunk(WorldGenerator generator) {
super();
world = generator.getWorld();
width = chunksBlockWidth;
height = generator.height;
}
public static int getBlockX(int chunkX, int x) {
return chunkX * chunksBlockWidth + x;
}
public static int getBlockZ(int chunkZ, int z) {
return chunkZ * chunksBlockWidth + z;
}
public final int getBlockX(int x) {
return getOriginX() + x;
}
public final int getBlockZ(int z) {
return getOriginZ() + z;
}
public final int getOriginX() {
return chunkX * width;
}
public final int getOriginZ() {
return chunkZ * width;
}
public abstract int getBlockType(int x, int y, int z);
public abstract void setBlock(int x, int y, int z, byte materialId);
public abstract void setBlocks(int x1, int x2, int y, int z1, int z2, byte materialId);
public abstract void setBlocks(int x, int y1, int y2, int z, byte materialId);
public abstract void clearBlock(int x, int y, int z);
public abstract void clearBlocks(int x, int y1, int y2, int z);
public abstract void clearBlocks(int x1, int x2, int y1, int y2, int z1, int z2);
public final boolean isType(int x, int y, int z, int type) {
return getBlockType(x, y, z) == type;
}
public final boolean isType(int x, int y, int z, Material material) {
return getBlockType(x, y, z) == material.getId();
}
public final boolean isOfTypes(int x, int y, int z, Material ... types) {
int type = getBlockType(x, y, z);
for (Material test : types)
if (type == test.getId())
return true;
return false;
}
public final boolean isOfTypes(int x, int y, int z, int ... types) {
int type = getBlockType(x, y, z);
for (int test : types)
if (type == test)
return true;
return false;
}
public final boolean isEmpty(int x, int y, int z) {
return getBlockType(x, y, z) == airId;
}
public final boolean isPlantable(int x, int y, int z) {
return getBlockType(x, y, z) == grassId;
}
public final boolean isWater(int x, int y, int z) {
return isOfTypes(x, y, z, stillWaterId, waterId);
}
public final boolean isLava(int x, int y, int z) {
return isOfTypes(x, y, z, stillLavaId, lavaId);
}
public final boolean isLiquid(int x, int y, int z) {
return isOfTypes(x, y, z, stillWaterId, stillLavaId, waterId, lavaId, iceId);
}
public final boolean isSurroundedByEmpty(int x, int y, int z) {
return (x > 0 && x < 15 && z > 0 && z < 15) &&
(isEmpty(x - 1, y, z) &&
isEmpty(x + 1, y, z) &&
isEmpty(x, y, z - 1) &&
isEmpty(x, y, z + 1));
}
public final boolean isSurroundedByWater(int x, int y, int z) {
return (x > 0 && x < 15 && z > 0 && z < 15) &&
(isWater(x - 1, y, z) ||
isWater(x + 1, y, z) ||
isWater(x, y, z - 1) ||
isWater(x, y, z + 1));
}
public final void setBlocks(int x, int y1, int y2, int z, byte primaryId, byte secondaryId, MaterialFactory maker) {
maker.placeMaterial(this, primaryId, secondaryId, x, y1, y2, z);
}
public final void setBlocks(int x1, int x2, int y1, int y2, int z1, int z2, byte primaryId, byte secondaryId, MaterialFactory maker) {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
setBlocks(x, y1, y2, z, primaryId, secondaryId, maker);
}
}
}
private void drawCircleBlocks(int cx, int cz, int x, int z, int y, byte materialId) {
// Ref: Notes/BCircle.PDF
setBlock(cx + x, y, cz + z, materialId); // point in octant 1
setBlock(cx + z, y, cz + x, materialId); // point in octant 2
setBlock(cx - z - 1, y, cz + x, materialId); // point in octant 3
setBlock(cx - x - 1, y, cz + z, materialId); // point in octant 4
setBlock(cx - x - 1, y, cz - z - 1, materialId); // point in octant 5
setBlock(cx - z - 1, y, cz - x - 1, materialId); // point in octant 6
setBlock(cx + z, y, cz - x - 1, materialId); // point in octant 7
setBlock(cx + x, y, cz - z - 1, materialId); // point in octant 8
}
private void drawCircleBlocks(int cx, int cz, int x, int z, int y1, int y2, byte materialId) {
for (int y = y1; y < y2; y++) {
drawCircleBlocks(cx, cz, x, z, y, materialId);
}
}
private void fillCircleBlocks(int cx, int cz, int x, int z, int y, byte materialId) {
// Ref: Notes/BCircle.PDF
setBlocks(cx - x - 1, cx - x, y, cz - z - 1, cz + z + 1, materialId); // point in octant 5
setBlocks(cx - z - 1, cx - z, y, cz - x - 1, cz + x + 1, materialId); // point in octant 6
setBlocks(cx + z, cx + z + 1, y, cz - x - 1, cz + x + 1, materialId); // point in octant 7
setBlocks(cx + x, cx + x + 1, y, cz - z - 1, cz + z + 1, materialId); // point in octant 8
}
private void fillCircleBlocks(int cx, int cz, int x, int z, int y1, int y2, byte materialId) {
for (int y = y1; y < y2; y++) {
fillCircleBlocks(cx, cz, x, z, y, materialId);
}
}
public final void setCircle(int cx, int cz, int r, int y, byte materialId, boolean fill) {
setCircle(cx, cz, r, y, y + 1, materialId, fill);
}
public final void setCircle(int cx, int cz, int r, int y1, int y2, byte materialId, boolean fill) {
// Ref: Notes/BCircle.PDF
int x = r;
int z = 0;
int xChange = 1 - 2 * r;
int zChange = 1;
int rError = 0;
while (x >= z) {
if (fill)
fillCircleBlocks(cx, cz, x, z, y1, y2, materialId);
else
drawCircleBlocks(cx, cz, x, z, y1, y2, materialId);
z++;
rError += zChange;
zChange += 2;
if (2 * rError + xChange > 0) {
x--;
rError += xChange;
xChange += 2;
}
}
}
public final void setSphere(int cx, int cy, int cz, int r, byte materialId, boolean fill) {
for (int r1 = 1; r1 < r; r1++) {
setCircle(cx, cz, r - r1, cy + r1, materialId, fill);
setCircle(cx, cz, r - r1, cy - r1, materialId, fill);
}
setCircle(cx, cz, r, cy, materialId, fill);
}
}
| [
"eddie@virtualchurchill.com"
] | eddie@virtualchurchill.com |
ca474693a37982ea918bb4bc68b114e9d9f39924 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/plugin/game/luggage/p429b/C34286d.java | 313ad3c3c08084a66308aa787ec4d27d79ea5fc7 | [] | 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 | 2,437 | java | package com.tencent.p177mm.plugin.game.luggage.p429b;
import android.content.Context;
import com.tencent.luggage.p146d.C37393a.C32183a;
import com.tencent.luggage.p147g.C32192i;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.plugin.game.luggage.p432d.C12140e;
import com.tencent.p177mm.plugin.webview.luggage.jsapi.C22840bc.C22841a;
import com.tencent.p177mm.plugin.webview.luggage.jsapi.C46419bd;
import com.tencent.p177mm.plugin.webview.p768b.C35582b;
import com.tencent.p177mm.sdk.platformtools.C4990ab;
import com.tencent.p177mm.sdk.platformtools.C5046bo;
import org.json.JSONArray;
import org.json.JSONObject;
/* renamed from: com.tencent.mm.plugin.game.luggage.b.d */
public class C34286d extends C46419bd<C12140e> {
public final String name() {
return "clearGameData";
}
public final int biG() {
return 1;
}
/* renamed from: b */
public final void mo9618b(C32183a c32183a) {
}
/* renamed from: a */
public final void mo9617a(Context context, String str, C22841a c22841a) {
AppMethodBeat.m2504i(135869);
C4990ab.m7416i("MicroMsg.JsApiClearGameData", "invokeInMM");
JSONObject bQ = C32192i.m52508bQ(str);
if (bQ == null) {
C4990ab.m7412e("MicroMsg.JsApiClearGameData", "data is null");
c22841a.mo26722d("null_data", null);
AppMethodBeat.m2505o(135869);
return;
}
String optString = bQ.optString("preVerifyAppId");
if (C5046bo.isNullOrNil(optString)) {
C4990ab.m7416i("MicroMsg.JsApiClearGameData", "appId is null");
c22841a.mo26722d("appid_null", null);
AppMethodBeat.m2505o(135869);
return;
}
JSONArray optJSONArray = bQ.optJSONArray("keys");
boolean optBoolean = bQ.optBoolean("clearAllData", false);
if (optJSONArray != null && optJSONArray.length() > 0) {
C35582b.cWi().mo56313b(optString, optJSONArray);
c22841a.mo26722d(null, null);
AppMethodBeat.m2505o(135869);
} else if (optBoolean) {
C35582b.cWi().adY(optString);
c22841a.mo26722d(null, null);
AppMethodBeat.m2505o(135869);
} else {
C4990ab.m7416i("MicroMsg.JsApiClearGameData", "keys is null");
c22841a.mo26722d("fail", null);
AppMethodBeat.m2505o(135869);
}
}
}
| [
"alwangsisi@163.com"
] | alwangsisi@163.com |
2db963d0fa4200919e1004a72cf03f842adbaa15 | a86f2d6be5d9f5c678f6feba007602a3d2d4e723 | /src/io/harkema/requests/PermitRequest.java | e1fba4e7cde59ac330efef5a9f63c03be28898bb | [] | no_license | tomasharkema/ooad-opdracht | cf8d92b80e23a18b8aef5951188cdd8b04a9d295 | 26269db6ca0ead3136c2fc83dbb249e440e38c70 | refs/heads/master | 2021-01-12T01:04:49.052862 | 2017-01-08T13:55:22 | 2017-01-08T13:55:22 | 78,342,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package io.harkema.requests;
import io.harkema.models.Event;
import io.harkema.models.Partner;
import io.harkema.models.User;
import java.util.Date;
/**
* Created by tomas on 08-01-17.
*/
public class PermitRequest {
public int quantity;
public String location;
public Partner partner;
public PermitRequest(int quantity, String location, Partner partner) {
this.quantity = quantity;
this.location = location;
this.partner = partner;
}
}
| [
"tomas@harkema.in"
] | tomas@harkema.in |
be9e469a51000737f85d0f51e4fdd780ca13fb93 | ebc4c021ba6cd87e08fdb344e1a6db3ab2abb758 | /xdengue/src/com/smartcommunities/xdengue/breedingSitesActivity.java | bfe49dd8ad82e7bf8743b2570da299d3e67d5fb1 | [] | no_license | achyut1991/Dengue | b2c614e7bd83ca605b19899985e00297e34ddccc | faf914ae39a077e30bc51ae3fbfb57e8ac60dfd2 | refs/heads/master | 2020-05-31T22:05:42.730609 | 2012-08-15T15:02:44 | 2012-08-15T15:02:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,521 | java | package com.smartcommunities.xdengue;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.Toast;
public class breedingSitesActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.breedingsites);
// Reference the Gallery view
Gallery g = (Gallery) findViewById(R.id.breedingsites);
// Set the adapter to our custom adapter (below)
g.setAdapter(new ImageAdapter(this));
// Set a item click listener, and just Toast the clicked position
/*.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
Toast.makeText(Gallery1.this, "" + position, Toast.LENGTH_SHORT).show();
}
});*/
// We also want to show context menu for longpressed items in the gallery
registerForContextMenu(g);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
menu.add(R.string.breedingSitetext);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Toast.makeText(this, "Longpress: " + info.position, Toast.LENGTH_SHORT).show();
return true;
}
public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
public ImageAdapter(Context c) {
mContext = c;
// See res/values/attrs.xml for the <declare-styleable> that defines
// Gallery1.
TypedArray a = obtainStyledAttributes(R.styleable.xdengue);
mGalleryItemBackground = a.getResourceId(
R.styleable.xdengue_android_galleryItemBackground, 0);
a.recycle();
}
public int getCount() {
return mImageIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);
i.setImageResource(mImageIds[position]);
i.setScaleType(ImageView.ScaleType.FIT_XY);
//i.setLayoutParams(new Gallery.LayoutParams(136, 88));
// The preferred Gallery item background
i.setBackgroundResource(mGalleryItemBackground);
return i;
}
private Context mContext;
private Integer[] mImageIds = {
R.drawable.breedingsites1,
R.drawable.breedingsites2,
R.drawable.breedingsites3,
R.drawable.breedingsites4,
R.drawable.breedingsites5
};
}
}
| [
"achyut1991@gmail.com"
] | achyut1991@gmail.com |
b581be9dc2ebd77a2dce27a452637681c556da54 | 7ab4a314aa15ef538b0e6fc390325b1086c3a4a3 | /Layout/020_Controle1/src/Fenetre.java | 2155f32876916d87d5795dfe848de47cc0fe4120 | [] | no_license | S-IN/JAVA-overview | c15181f98e5fb0c974878d4e4b58066b2268d69a | 455961e661ac4bae00bda70609dd8092ecc7fda7 | refs/heads/master | 2020-05-27T09:25:30.066614 | 2019-05-25T14:13:54 | 2019-05-25T14:13:54 | 188,565,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,991 | java | // ==========================================================================
// Fenetre avec 2 CASES A COCHER et deux Labels pour avoir l'etat des cases
// Utilisation de GridLayout et FlowLayout...
// ==========================================================================
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import utilitairesMG.graphique.*;
public class Fenetre extends JFrame implements ActionListener
{
private JPanel panneauFond;
private JPanel panneauHaut;
private JCheckBox case1;
private JLabel texte1;
private JPanel panneauBas;
private JCheckBox case2;
private JLabel texte2;
public Fenetre(String s)
{
super(s);
addWindowListener(new EcouteFenetre());
// --------------------------------------------------------------------------
// Creation du panneau de fond : on l'organise en GridLayout de deux lignes
// et une colonne. Chaque case va contenir un panneau contenant deux
// composants (JCheckBox, JLabel).
// --------------------------------------------------------------------------
panneauFond = new JPanel();
panneauFond.setLayout(new GridLayout(2, 1));
// --------------------------------------------------------------------------
// Creation du panneau a mettre en haut de panneauFond :
// --------------------------------------------------------------------------
panneauHaut = new JPanel();
panneauHaut.setLayout(new FlowLayout(FlowLayout.LEFT));
panneauHaut.setBackground(Color.white);
case1 = new JCheckBox("Case 1");
case1.setBackground(Color.white);
case1.addActionListener(this);
texte1 = new JLabel("Case 1 non sélectionnée");
texte1.setForeground(Color.red);
texte1.setToolTipText("Etat de la première case");
panneauHaut.add(case1);
panneauHaut.add(texte1);
// --------------------------------------------------------------------------
// Creation du panneau a mettre en bas de panneauFond :
// --------------------------------------------------------------------------
panneauBas = new JPanel();
panneauBas.setLayout(new FlowLayout(FlowLayout.LEFT));
panneauBas.setBackground(Color.white);
case2 = new JCheckBox("Case 2");
case2.setBackground(Color.white);
case2.addActionListener(this);
texte2 = new JLabel("Case 2 non sélectionnée");
texte2.setForeground(Color.red);
texte2.setToolTipText("Etat de la deuxième case");
panneauBas.add(case2);
panneauBas.add(texte2);
// --------------------------------------------------------------------------
// Ajout de panneauHaut et panneauBas a panneauFond :
// --------------------------------------------------------------------------
panneauFond.add(panneauHaut);
panneauFond.add(panneauBas);
// --------------------------------------------------------------------------
// Placement du panneauFond dans la zone de contenu de la fenetre :
// --------------------------------------------------------------------------
add(panneauFond);
pack();
setVisible(true);
}
// --------------------------------------------------------------------------
// Methode de l'interface ActionListener :
// --------------------------------------------------------------------------
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == case1)
{
if (case1.isSelected())
{
texte1.setText("Case 1 sélectionnée");
}
else
{
texte1.setText("Case 1 non sélectionnée");
}
}
else
{
if (case2.isSelected())
{
texte2.setText("Case 2 sélectionnée");
}
else
{
texte2.setText("Case 2 non sélectionnée");
}
}
}
}
| [
"annievegie@gmail.com"
] | annievegie@gmail.com |
1341895a69c89195750b8d8d5fbf609b631c0f46 | cd2ba4c9c0aff4adaa184328949849afbaea9703 | /src/main/java/com/jzc/think/mode/structure/interfacezz/AdapterSub.java | f3e72a66e21845414307864d553742a399158894 | [] | no_license | jiango0/Think | 4b2eb88a06e9d7af1d2bb83c9aa876a69bb28707 | 7d21e660a2040afa1a400fe32fe921e1837ee9c1 | refs/heads/master | 2021-01-19T23:20:17.513626 | 2017-04-24T10:03:40 | 2017-04-24T10:03:40 | 88,965,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package com.jzc.think.mode.structure.interfacezz;
public class AdapterSub extends AbstractWapper {
public void method(){
System.out.println("AdapterSub method");
}
}
| [
"jiangzhichao@yryz.com"
] | jiangzhichao@yryz.com |
1a6c714d0d16d3aa14746fd0e7f29a5d0c004214 | 09ffad4c41819210de5f337bade47bbad8e537bb | /BikeShare_V2/app/src/main/java/com/example/bikeshare/EndRideActivity.java | 351a4a963b8e19838a1a9630b83090533ed96d06 | [] | no_license | Jepp0103/Mobile_App_Development_BikeShare_Project | 70be7cdfbb8eb57336285d45c7e41d38bbcc859c | 48be27703138ab97bfa3eefe6e603dd0d1022e42 | refs/heads/main | 2023-01-10T05:12:57.840644 | 2020-11-19T14:50:03 | 2020-11-19T14:50:03 | 314,276,814 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,609 | java | package com.example.bikeshare;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.*;
import android.widget.*;
public class EndRideActivity extends Activity {
// GUI variables
private Button mAddRide;
private TextView mLastAdded;
private TextView mNewWhat;
private TextView mNewWhere;
private Ride mLast = new Ride("", "","");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_end_ride);
mLastAdded = (TextView) findViewById(R.id.last_thing);
updateUI();
// Button
mAddRide = (Button) findViewById(R.id.endRide_button);
// Texts
mNewWhat = (TextView) findViewById(R.id.what_text);
mNewWhere = (TextView) findViewById(R.id.where_text);
//View products click event
mAddRide.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ((mNewWhat.getText().length() > 0) && (mNewWhere.getText().length() > 0)) {
mLast.setBikeName(mNewWhat.getText().toString().trim());
mLast.setStartRide(mNewWhere.getText().toString().trim());
// Reset text fields
mNewWhat.setText("");
mNewWhere.setText("");
updateUI();
}
}
});
}
private void updateUI() {
mLastAdded.setText(mLast.toString());
}
} | [
"jeppendyekjaer@hotmail.com"
] | jeppendyekjaer@hotmail.com |
6d8e0f8c9f1a52e0cd9a6005962d5296e25e30f7 | 9686591e4b297f882f372d446f60eb2a8ecdc3b7 | /src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/index/entry/data/IndexEntryFixtures.java | a7e91361c1d00f878a01a7f78a6fc5404ac8008d | [
"MIT"
] | permissive | rpatil524/FAIRDataPoint | d496091072cd7a4aecfba57b9313d22140c9732f | a55fcf528853ee6a0b88a21d59d95f7e49781a67 | refs/heads/master | 2023-08-31T19:45:02.107983 | 2022-04-04T06:50:27 | 2022-04-04T06:50:27 | 184,922,667 | 0 | 0 | MIT | 2023-06-09T18:52:29 | 2019-05-04T17:04:22 | Java | UTF-8 | Java | false | false | 4,502 | java | /**
* The MIT License
* Copyright © 2017 DTL
*
* 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 nl.dtls.fairdatapoint.database.mongo.migration.development.index.entry.data;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntry;
import nl.dtls.fairdatapoint.entity.index.entry.RepositoryMetadata;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.HashMap;
import static nl.dtls.fairdatapoint.entity.index.entry.IndexEntryState.*;
@Service
public class IndexEntryFixtures {
public IndexEntry entryActive() {
String clientUri = "https://example.com/my-valid-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("8987abc1-15a4-4752-903c-8f8a5882cca6", clientUri, Valid, Instant.now(), Instant.now(),
Instant.now(), repositoryData);
}
public IndexEntry entryActive2() {
String clientUri = "https://app.fairdatapoint.org";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
Instant date = Instant.parse("2020-05-30T23:38:23.085Z");
return new IndexEntry("c912331f-4a77-4300-a469-dbaf5fc0b4e2", clientUri, Valid, date, date, date,
repositoryData);
}
public IndexEntry entryInactive() {
String clientUri = "https://example.com/my-valid-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
Instant date = Instant.parse("2020-05-30T23:38:23.085Z");
return new IndexEntry("b5851ebe-aacf-4de9-bf0a-3686e9256e73", clientUri, Valid, date, date, date,
repositoryData);
}
public IndexEntry entryUnreachable() {
String clientUri = "https://example.com/my-unreachable-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("dae46b47-87fb-4fdf-995c-8aa3739a27fc", clientUri, Unreachable, Instant.now(),
Instant.now(), Instant.now(), repositoryData);
}
public IndexEntry entryInvalid() {
String clientUri = "https://example.com/my-invalid-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("b37e8c1f-ac0e-49f8-8e07-35571c4f8235", clientUri, Invalid, Instant.now(),
Instant.now(), Instant.now(), repositoryData);
}
public IndexEntry entryUnknown() {
String clientUri = "https://example.com/my-unknown-fairdatapoint";
RepositoryMetadata repositoryData = new RepositoryMetadata(
RepositoryMetadata.CURRENT_VERSION,
clientUri,
new HashMap<>()
);
return new IndexEntry("4471d7c5-8c5b-4581-a9bc-d175456492c4", clientUri, Unknown, Instant.now(),
Instant.now(), Instant.now(), repositoryData);
}
}
| [
"vknaisl@gmail.com"
] | vknaisl@gmail.com |
a490ab9c4d44a0abeaac176e7e4d338ad43b6713 | 3543f57f016e573d42fcec746f5e7375191ccf81 | /src/main/java/com/leetcode/PredictTheWinner.java | 97d75e933d1ecef3a260ef8bd30cb29f4edf950d | [] | no_license | chzh1229/LeetCode | 5c9cd93289305b5a46ca2d577d5cc781ea59debc | b001de6c8bef5764b5e375766a3fc61ff9875a96 | refs/heads/master | 2021-12-20T23:38:34.029527 | 2021-12-20T13:51:26 | 2021-12-20T13:51:26 | 112,096,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.leetcode;
import java.util.Arrays;
public class PredictTheWinner {
public boolean PredictTheWinner(int[] nums) {
int[][] d = new int[nums.length][nums.length];
for (int k=0; k<nums.length; k++) {
d[k][k] = nums[k];
}
for (int i = nums.length - 1; i>=0; i--) {
for (int j = i+1; j<nums.length; j++) {
d[i][j] = Math.max(nums[i] - d[i+1][j], nums[j] - d[i][j-1]);
}
}
return d[0][nums.length] >= 0;
}
public static void main(String[] args) {
int[] nums = new int[] {1,5,233,7};
PredictTheWinner p = new PredictTheWinner();
p.PredictTheWinner(nums);
}
}
| [
"chenzhang1229@googlemail.com"
] | chenzhang1229@googlemail.com |
bbd0195f7a1cba1ae923888c8b4205d01c2f5dc0 | c9ff4c7d1c23a05b4e5e1e243325d6d004829511 | /aws-java-sdk-applicationinsights/src/main/java/com/amazonaws/services/applicationinsights/model/transform/ObservationMarshaller.java | 9b3556d87c062f724b9416d228454b1d4ae7b962 | [
"Apache-2.0"
] | permissive | Purushotam-Thakur/aws-sdk-java | 3c5789fe0b0dbd25e1ebfdd48dfd71e25a945f62 | ab58baac6370f160b66da96d46afa57ba5bdee06 | refs/heads/master | 2020-07-22T23:27:57.700466 | 2019-09-06T23:28:26 | 2019-09-06T23:28:26 | 207,350,924 | 1 | 0 | Apache-2.0 | 2019-09-09T16:11:46 | 2019-09-09T16:11:45 | null | UTF-8 | Java | false | false | 5,653 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.applicationinsights.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.applicationinsights.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ObservationMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ObservationMarshaller {
private static final MarshallingInfo<String> ID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Id").build();
private static final MarshallingInfo<java.util.Date> STARTTIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("StartTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<java.util.Date> ENDTIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("EndTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<String> SOURCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("SourceType").build();
private static final MarshallingInfo<String> SOURCEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("SourceARN").build();
private static final MarshallingInfo<String> LOGGROUP_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("LogGroup").build();
private static final MarshallingInfo<java.util.Date> LINETIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("LineTime").timestampFormat("unixTimestamp").build();
private static final MarshallingInfo<String> LOGTEXT_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("LogText").build();
private static final MarshallingInfo<String> LOGFILTER_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("LogFilter").build();
private static final MarshallingInfo<String> METRICNAMESPACE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("MetricNamespace").build();
private static final MarshallingInfo<String> METRICNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("MetricName").build();
private static final MarshallingInfo<String> UNIT_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Unit").build();
private static final MarshallingInfo<Double> VALUE_BINDING = MarshallingInfo.builder(MarshallingType.DOUBLE).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Value").build();
private static final ObservationMarshaller instance = new ObservationMarshaller();
public static ObservationMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(Observation observation, ProtocolMarshaller protocolMarshaller) {
if (observation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(observation.getId(), ID_BINDING);
protocolMarshaller.marshall(observation.getStartTime(), STARTTIME_BINDING);
protocolMarshaller.marshall(observation.getEndTime(), ENDTIME_BINDING);
protocolMarshaller.marshall(observation.getSourceType(), SOURCETYPE_BINDING);
protocolMarshaller.marshall(observation.getSourceARN(), SOURCEARN_BINDING);
protocolMarshaller.marshall(observation.getLogGroup(), LOGGROUP_BINDING);
protocolMarshaller.marshall(observation.getLineTime(), LINETIME_BINDING);
protocolMarshaller.marshall(observation.getLogText(), LOGTEXT_BINDING);
protocolMarshaller.marshall(observation.getLogFilter(), LOGFILTER_BINDING);
protocolMarshaller.marshall(observation.getMetricNamespace(), METRICNAMESPACE_BINDING);
protocolMarshaller.marshall(observation.getMetricName(), METRICNAME_BINDING);
protocolMarshaller.marshall(observation.getUnit(), UNIT_BINDING);
protocolMarshaller.marshall(observation.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
20095520228de68002f0052057606d7e02cf7825 | 11c811f67f6951352e60efb0241603e50fc23606 | /webflux-mysql/src/main/java/co/com/jsierra/webfluxmysql/controllers/Handler.java | 93e864d83e0fd26fb53e0c53fa1455631dd69dfb | [] | no_license | jsierra93/SpringWebflux_MySQL_R2DBC | f0860c90d9177fce8c212a383f0c95eb9c041698 | b45dc9f779858a7892c87e5eab17bead735a9586 | refs/heads/master | 2023-01-21T09:24:56.515476 | 2020-11-30T18:46:41 | 2020-11-30T18:46:41 | 317,211,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,433 | java | package co.com.jsierra.webfluxmysql.controllers;
import co.com.jsierra.webfluxmysql.models.UserModels;
import co.com.jsierra.webfluxmysql.services.DatabaseOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
@Component
public class Handler {
@Autowired
DatabaseOperations databaseOperations;
public Mono<ServerResponse> findUsers(ServerRequest serverRequest) {
return ServerResponse.ok()
.body(databaseOperations.findUsers()
.log()
, UserModels.class);
}
public Mono<ServerResponse> findUserById(ServerRequest serverRequest) {
return ServerResponse.ok()
.body(databaseOperations.findUsersById(serverRequest.pathVariable("id"))
.log(), UserModels.class);
}
public Mono<ServerResponse> saveUser(ServerRequest serverRequest) {
Mono<UserModels> newUser = serverRequest.bodyToMono(UserModels.class)
.flatMap(user ->
databaseOperations.saveUser(user));
return ServerResponse.ok()
.body(newUser, UserModels.class);
}
public Mono<ServerResponse> updateUserById(ServerRequest serverRequest) {
Mono<UserModels> updateUser = serverRequest.bodyToMono(UserModels.class)
.flatMap(user ->
databaseOperations.updateUserById(user, serverRequest.pathVariable("id"))
);
return ServerResponse.ok()
.body(updateUser, UserModels.class);
}
public Mono<ServerResponse> updateUserByUsername(ServerRequest serverRequest) {
Mono<UserModels> updateUser = serverRequest.bodyToMono(UserModels.class)
.flatMap(user ->
databaseOperations.updateUserByUsername(user)
);
return ServerResponse.ok()
.body(updateUser, UserModels.class);
}
public Mono<ServerResponse> deleteUser(ServerRequest serverRequest) {
return ServerResponse.ok()
.body(databaseOperations.deleteUser(serverRequest.pathVariable("id"))
, String.class);
}
}
| [
"jsierra93@hotmail.com"
] | jsierra93@hotmail.com |
44bf055af23ca32e7be56a8c0b4df1551c380387 | 206cce7698b959470b5cd7cfbc2221b33d82b84f | /src/main/java/com/stgutah/model/ParkingSlot.java | bcf2c6e531a5eea94bdc14732f608faaa97e0d83 | [] | no_license | dempey/AirportParking | 9e498fada97852725485f9c478d715f2994a6a7b | aa9457589ad982d3758ca258ffab073b25095f48 | refs/heads/master | 2021-01-01T15:55:41.727506 | 2014-06-19T19:11:00 | 2014-06-19T19:11:00 | 20,691,100 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.stgutah.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "PARKING_SLOT")
public class ParkingSlot
{
@Id
@Column(name = "PARKING_SLOT_ID")
@GeneratedValue
private Integer parkingSlotId;
@Column(name = "NUMBER", nullable = false)
private String number;
@ManyToOne
@JoinColumn(name = "PARKING_LOT_ID", nullable = false, referencedColumnName="PARKING_LOT_ID")
private ParkingLot parkingLot;
public Integer getParkingSlotId()
{
return parkingSlotId;
}
public void setParkingSlotId(Integer parkingSlotId)
{
this.parkingSlotId = parkingSlotId;
}
public String getNumber()
{
return number;
}
public void setNumber(String number)
{
this.number = number;
}
public ParkingLot getParkingLot()
{
return parkingLot;
}
public void setParkingLot(ParkingLot parkingLot)
{
this.parkingLot = parkingLot;
}
}
| [
"empey.david@gmail.com"
] | empey.david@gmail.com |
4de334e6cd59e6e73ee845a72789cf9e17185b27 | eab8d595315fdedc308ef9046888e27f2dc8f7bf | /app/src/androidTest/java/com/dl/dlslidebanner/ApplicationTest.java | d5d88173502c20117d019397b3f42de89bed0a7b | [
"Apache-2.0"
] | permissive | DHASA2017/slidebanner | 9df8ce9307500b80ceb600c2172696e8fc6a1348 | cb636aa04516fe95d26a8c70dee9b11f0d3bdf17 | refs/heads/master | 2021-01-25T06:56:18.307348 | 2017-06-08T07:10:28 | 2017-06-08T07:10:28 | 93,629,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.dl.dlslidebanner;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"liulin@jiuqi.com.cn"
] | liulin@jiuqi.com.cn |
8c6b9a6d0a7cd6c065daa374fd60263e9ed9cf06 | 9a412bc0aa853099ab582431d9b01f28dd3e92da | /src/main/java/com/singleandcluster/util/ListRedisUtil.java | ab94ac46876a43f34e880190bcb0b468e0e0f018 | [] | no_license | dsl1888888/common-redis | a11cf50ddacbbcb2d050ee47007735796df12580 | c9b85c35312efd480caebc7b43ce0833bbddf633 | refs/heads/master | 2021-07-08T20:49:05.328859 | 2020-12-23T03:11:50 | 2020-12-23T03:11:50 | 222,342,025 | 0 | 0 | null | 2020-10-13T17:32:13 | 2019-11-18T01:52:51 | Java | UTF-8 | Java | false | false | 8,183 | java | package com.singleandcluster.util;
import java.util.List;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.core.StringRedisTemplate;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class ListRedisUtil
{
private StringRedisTemplate redisTemplate;
/**
* 批量删除对应的value
*
* @param keys
*/
public void remove(String tv, final String... keys)
{
for (String key : keys)
{
remove(tv, key);
}
}
/**
* 删除对应的value
*
* @param key
*/
public void remove(String tv, long i, Object value)
{
ListOperations<String, String> listOper = redisTemplate.opsForList();
listOper.remove(tv, i, value);
}
/*
* 返回模块数量
*/
public Long size(final String tv)
{
long result = 0;
result = redisTemplate.execute(new SessionCallback<Long>()
{
@Override
public Long execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.size(tv);
}
catch (Exception e)
{
e.printStackTrace();
return (long) 0;
}
}
});
return result;
}
/**
* 写入缓存
*
* @param key
* @param value
* @return
*/
public List<Object> getall(final String tv)
{
List<Object> result = redisTemplate.execute(new SessionCallback<List<Object>>()
{
@Override
public List<Object> execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.range(tv, 0, size(tv));
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
/**
* 出队
*
* @param key
* @return
*/
public Object popCache(final String tv)
{
Object result = redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.rightPop(tv);
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
public List<Object> pageCache(final String tv, int page, int rows)
{
List<Object> result = (List<Object>) redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
int start=0;
int end=0;
if (page<0 || rows<0 )
{
//默认 第一页 10条
//1 页
start= (1-1)*10;
end=start-1+10;
}else {
//2 页
start= (page-1)*rows;
end=start-1+rows;
// //1 页
// start= (1-1)*2;
// end=start-1+rows;
//
// //2 页
// start= (2-1)*2;
// end=start-1+rows;
//
// //3 页
// start= (3-1)*2;
// end=start-1+rows;
//
// //4 页
// start= (4-1)*2;
// end=start-1+rows;
}
List<Object> list = listOper.range(tv, start , end);
return list;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
// lrange key start end // 从左边依次返回key的[start,end] 的所有值,注意返回结果包含两端的值。
//
// ltrim key start end //删除指定索引之外的所有元素,注意删除之后保留的元素包含两端的start和end索引值。
/**
* 出队
*
* @param key
* @return
*/
public List<Object> popCacheNumleft(final String tv, int size)
{
List<Object> result = (List<Object>) redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
List<Object> list = listOper.range(tv, size(tv) - size, size(tv));
listOper.trim(tv, size, size(tv));
return list;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
// lrange key start end // 从左边依次返回key的[start,end] 的所有值,注意返回结果包含两端的值。
//
// ltrim key start end //删除指定索引之外的所有元素,注意删除之后保留的元素包含两端的start和end索引值。
/**
* 出队
*
* @param key
* @return
*/
public List<Object> popCacheNumRight(final String tv, int size)
{
List<Object> result = (List<Object>) redisTemplate.execute(new SessionCallback<Object>()
{
@Override
public Object execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
List<Object> list = listOper.range(tv, 0, size(tv) - size);
listOper.trim(tv, 0, size(tv) - size - 1);
return list;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
});
return result;
}
/**
* 入队
*
* @param key
* @param value
* @return
*/
public long pushCache(final String tv, final Object ob)
{
long result = 0;
result = redisTemplate.execute(new SessionCallback<Long>()
{
@Override
public Long execute(RedisOperations operations)
{
try
{
ListOperations<String, Object> listOper = operations.opsForList();
return listOper.leftPush(tv, ob);
}
catch (Exception e)
{
e.printStackTrace();
return (long) 0;
}
}
});
return result;
}
public void setRedisTemplate(StringRedisTemplate redisTemplate)
{
this.redisTemplate = redisTemplate;
}
}
| [
"dsl1888888@163.com"
] | dsl1888888@163.com |
0157da5445708b17db722fd91f04ca6f4cf42e84 | 82c44f4ec47692d4621c191a4a57cdf25d90a881 | /app/src/main/java/com/basicflags/ui/activities/base/BaseRxActivity.java | 8ce58a32b1b89ed9c13619c6823a0281b96e4b32 | [] | no_license | Kolyall/BasicFlags | d25a855af557d98514a19f043c74993a951feb7d | bb7bf50ead79fb49309c55015e6d51906142f974 | refs/heads/master | 2021-01-21T11:16:05.161594 | 2017-03-01T10:55:00 | 2017-03-01T10:55:00 | 83,543,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,128 | java | package com.basicflags.ui.activities.base;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.basicflags.module.DependencyInjection;
import com.basicflags.service.RxApiService;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import lombok.Getter;
import lombok.experimental.Accessors;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;
/**
* Created by Nick Unuchek (skype: kolyall) on 06.10.2016.
*/
@Accessors(prefix = "m")
public abstract class BaseRxActivity extends AppCompatActivity {
private CompositeSubscription mSubscriptions;
@Getter @Inject RxApiService mRxApiService;
@CallSuper
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSubscriptions = new CompositeSubscription();
DependencyInjection.inject(this);
}
@CallSuper
@Override
protected void onStart() {
super.onStart();
subscribe();
}
private void subscribe() {
for (Subscription subscription : createSubscriptions()) {
mSubscriptions.add(subscription);
}
}
@CallSuper
@Override
protected void onStop() {
super.onStop();
unsubscribeAll();
}
protected void unsubscribeAll() {
if (mSubscriptions == null) { return; }
mSubscriptions.clear();
mSubscriptions = new CompositeSubscription();
}
protected void unsubscribe(Subscription subscription) {
if (subscription == null || mSubscriptions == null) { return; }
mSubscriptions.remove(subscription);
}
public Subscription addSubscription(Subscription subscription) {
mSubscriptions.add(subscription);
return subscription;
}
/**
* Subscribe to the {@link Observable}s that should be started on {@link android.support.v4.app .Fragment#onActivityCreated} and then
* return the subscriptions that you want attached to this fragment's lifecycle. Each {@link Subscription} will have {@link
* Subscription#unsubscribe() unsubscribe()} called when {@link android.support.v4.app.Fragment#onDetach() onDetach()} is fired.
* <p>The default implementation returns an empty array.</p>
*/
protected List<Subscription> createSubscriptions() {
return new ArrayList<>(0);
}
// quick subscriptions
protected <T> Subscription createAndAddSubscription(Observable<T> observable, Observer<T> observer) {
return addSubscription(bindObservable(observable, observer));
}
protected <T> Subscription createAndAddSubscription(Observable<T> observable) {
return addSubscription(bindObservable(observable));
}
private <T> Subscription bindObservable(Observable<T> observable, Observer<T> observer) {
return observable
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.doOnError(new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
doOnError(throwable);
}
})
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(new Action0() {
@Override
public void call() {
doOnSubscribe();
}
})
.observeOn(AndroidSchedulers.mainThread())
.doOnCompleted(new Action0() {
@Override
public void call() {
doOnCompleted();
}
})
.subscribe(observer);
}
public <T> Observable<Boolean> bindOnNextAction(Observable<T> observable,Action1<T> onNextAction) {
return observable.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread()).doOnNext(onNextAction)
.map(new Func1<T, Boolean>() {
@Override
public Boolean call(T t) {
return true;
}
});
}
public <T> Subscription bindObservable(Observable<T> observable) {
Observer<T> observer = new Observer<T>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable throwable) {
}
@Override
public void onNext(T t) {
}
};
return bindObservable(observable,observer);
}
public abstract void doOnSubscribe();
public abstract void doOnError(Throwable throwable);
public abstract void doOnCompleted();
} | [
"nikolay.unuchek@gmail.com"
] | nikolay.unuchek@gmail.com |
afe87ae7c535f21913a103b4e7f76f5188631011 | 0b06fed24042da28b3ebbdd9ad21810598515765 | /src/obj/Seito.java | e088d39933cb2a1f425f0115773bf13eb8880beb | [] | no_license | t-you96/lesson | 754e989a02e85bd11af29e1858c782c2e990b82e | 56794326d20cabab23c329ba442335945996615d | refs/heads/master | 2022-06-25T19:16:26.832936 | 2020-05-12T04:45:56 | 2020-05-12T04:45:56 | 257,788,412 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package obj;
public class Seito {
String name;
int kokugo;
int math;
int society;
public Seito(String name,int kokugo,int math,int society) {
this.name = name;
this.kokugo = kokugo;
this.math = math;
this.society = society;
}
public void show() {
System.out.print(name + " 国語" + kokugo + "点 数学" + math + "点 社会" + society + "点" );
}
public int goukei() {
int g = kokugo + math + society;
return g;
}
public double heikin() {
double h = (kokugo + math + society) / 3.0;
return h;
}
}
| [
"edu02@EDUPC02.n00d01.kis.co.jp"
] | edu02@EDUPC02.n00d01.kis.co.jp |
20442e2a89974984fbb02779202df968a4b7f0e4 | 4d0e0eda0a33a520a95920e0600a4b47d51435b7 | /router-api/src/main/java/com/dovar/router_api/multiprocess/MultiRouterResponse.java | 1a44f0632a37874c76afe9047ab8d0bdff6c972b | [
"MIT"
] | permissive | huangbqsky/DRouter | 83e2872fb1bd3a10cc3fde113970a9501fb94d12 | f68606d729c86c46bfa434259d988d1c271a7fa1 | refs/heads/master | 2022-11-27T20:07:44.799420 | 2020-07-20T15:11:12 | 2020-07-20T15:11:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,511 | java | package com.dovar.router_api.multiprocess;
import android.os.Parcel;
import android.os.Parcelable;
/**
* auther by heweizong on 2018/8/21
* description:
*/
public class MultiRouterResponse implements Parcelable {
private String mMessage = "";
private Parcelable mData;
public String getMessage() {
return mMessage;
}
public MultiRouterResponse setMessage(String mMessage) {
this.mMessage = mMessage;
return this;
}
public Parcelable getData() {
return mData;
}
public MultiRouterResponse setData(Parcelable mParcelable) {
this.mData = mParcelable;
return this;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.mMessage);
dest.writeParcelable(this.mData, flags);
}
public MultiRouterResponse() {
}
protected MultiRouterResponse(Parcel in) {
this.mMessage = in.readString();
this.mData = in.readParcelable(Parcelable.class.getClassLoader());
}
public static final Creator<MultiRouterResponse> CREATOR = new Creator<MultiRouterResponse>() {
@Override
public MultiRouterResponse createFromParcel(Parcel source) {
return new MultiRouterResponse(source);
}
@Override
public MultiRouterResponse[] newArray(int size) {
return new MultiRouterResponse[size];
}
};
}
| [
"heweizong@itouchtv.cn"
] | heweizong@itouchtv.cn |
b0516fb8bb4353d60fdf2e9078a46a509f3dbe92 | 95bca13063bbdc013c85335c082778822f445298 | /src/test/java/com/tw/codeavengers/tradeawayapi/web/category/CategoryControllerTest.java | 1bba06f73af5513f03b5f6501db5d52151fe7ba6 | [] | no_license | kunalhiray7/trade-away-api | abf5256110cf101166880432d3ad44b29db01671 | b4b9343ceec65c909d6c38ee1e6193f173e2ddc9 | refs/heads/master | 2020-04-01T21:32:17.921651 | 2018-10-18T17:26:19 | 2018-10-18T17:26:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | package com.tw.codeavengers.tradeawayapi.web.category;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.tw.codeavengers.tradeawayapi.model.Category;
import com.tw.codeavengers.tradeawayapi.service.CategoryService;
import org.hamcrest.core.Is;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
//import org.mockito.Mockito;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.*;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(MockitoJUnitRunner.class)
public class CategoryControllerTest {
@Mock
CategoryService categoryService;
@InjectMocks
CategoryController categoryController;
MockMvc mockMvc;
@Before
public void setUp() {
MockitoAnnotations.initMocks(categoryController);
mockMvc = MockMvcBuilders.standaloneSetup(categoryController).build();
}
@Test
public void shouldReturnCategoryResponseContainingCategoriesReturnedByCategoryService() throws Exception {
Category category = new Category();
category.setCategoryName("category");
List<Category> categories = Collections.singletonList(category);
when(categoryService.getAllCategories()).thenReturn(categories);
mockMvc.perform(get("/category")).andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.categories[0].categoryName", is("category")));
verify(categoryService, times(1)).getAllCategories();
}
} | [
"kunal.hire@hexad.de"
] | kunal.hire@hexad.de |
e0bcfb0815d67dd72671ebbfd4387671a7a9f217 | c45dc278f9325d983d4eeb70a2f1e49fbb472d57 | /FragTransaction/app/src/main/java/com/example/rahul/fragtransaction/FragmentA.java | c22646cd6d36fe22d4e91578036675bd3e8a26e0 | [] | no_license | rahuldas11694/android | 58e90b7f55c89f05a288cd5106cf63b40fddd191 | 0d0e88064ee133b85a29b6cf432a72425f6fcd2b | refs/heads/master | 2020-05-23T05:05:12.180707 | 2017-03-28T12:13:31 | 2017-03-28T12:13:31 | 84,751,140 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,281 | java | package com.example.rahul.fragtransaction;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by rahul on 23/03/17.
*/
public class FragmentA extends Fragment {
@Override
public void onAttach(Context context) {
Log.d("rahul","FragmentA onAttach");
super.onAttach(context);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("rahul","Fragment on create");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_a,container,false);
Log.d("rahul","Fragment oncreateview");
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.d("rahul","OnActivity created");
}
@Override
public void onPause() {
super.onPause();
Log.d("rahul","Fragment a onpause");
}
@Override
public void onStop() {
super.onStop();
Log.d("rahul","Fragment a onStop");
}
@Override
public void onResume() {
super.onResume();
Log.d("rahul","FragmentA onResume");
}
@Override
public void onStart() {
super.onStart();
Log.d("rahul","Fragment a onStart");
}
@Override
public void onDestroyView() {
super.onDestroy();
Log.d("rahul","Fragment a onDestroyView");
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d("rahul","Fragment a onDestroy");
}
@Override
public void onDetach() {
super.onDetach();
Log.d("rahul","Fragment a onDetach");
}
}
/*
sequence:
D/rahul: Fragment on create
D/rahul: Fragment oncreateview
D/rahul: OnActivity created
D/rahul: Fragment a onStart
D/rahul: FragmentA onResume
D/rahul: Fragment a onpause
D/rahul: Fragment a onStop
D/rahul: Fragment a onStart
D/rahul: FragmentA onResume
*/ | [
"rahuldas11694@gmail.com"
] | rahuldas11694@gmail.com |
9d66a03f2295baf3ee875997a56641c114ccc567 | 8a2df01eabf4625a84b66b77a9d48ddd004066c9 | /meinian_parent/meinian_interface/src/main/java/com/atguigu/service/TravelGroupService.java | e224f9ef878ce9350305bf2ce38ff0a98064c7ee | [] | no_license | zhangsanatguigu/meinian2020 | 2080e14ca14e4471f980d71b00d73b04b446d6c4 | 7530596e504447623d935d2cf484f81db420434f | refs/heads/master | 2023-02-03T09:21:36.523954 | 2020-12-22T03:37:04 | 2020-12-22T03:37:04 | 311,566,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package com.atguigu.service;
import com.atguigu.entity.PageResult;
import com.atguigu.pojo.TravelGroup;
import java.util.List;
public interface TravelGroupService {
void add(TravelGroup travelGroup, Integer[] travelItemIds);
PageResult findPage(Integer currentPage, Integer pageSize, String queryString);
TravelGroup findById(Integer id);
List<Integer> findTravelItemIdByTravelgroupId(Integer id);
void edit(TravelGroup travelGroup, Integer[] travelItemIds);
List<TravelGroup> findAll();
}
| [
"jlsp-zy@163.com"
] | jlsp-zy@163.com |
f03a37f8120a6c780b447ccaf7a488b063e3fb05 | a645a2a11345ea2cfd6c932c93c6a7b26abd4631 | /study/src/main/java/kr/green/study/service/MemberServiceImp.java | 556ae894e70801b1d33d9f83bf7274605799d60f | [] | no_license | kimjavi611/project_mj | cc94afcc75f6bc55e766dce8fc82c445f0312826 | 1555b9f7c375a9326fcc7ad6e9c98b906807bbdb | refs/heads/main | 2023-07-08T23:19:13.093603 | 2021-08-04T17:39:46 | 2021-08-04T17:39:46 | 361,574,822 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,452 | java | package kr.green.study.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.web.util.WebUtils;
import kr.green.study.dao.MemberDAO;
import kr.green.study.pagination.Criteria;
import kr.green.study.vo.MemberVO;
import lombok.AllArgsConstructor;
@Service
@AllArgsConstructor
public class MemberServiceImp implements MemberService{
MemberDAO memberDao;
BCryptPasswordEncoder passwordEncoder;
@Override
public boolean signup(MemberVO user) {
if(user == null)
return false;
//jsp에서 유효성 검사를 하지만 이중으로 걸러주기 위해 서버에서 한번 더 해줌
//아이디 유효성 검사
String idRegex = "^[a-z0-9_-]{5,20}$";
//Pattern.matches() 문자열이랑 정규표현식 비교할때 사용하는 메소드
if(user.getId() == null || !Pattern.matches(idRegex, user.getId()))
return false;
//비밀번호 유효성 검사
String pwRegex = "^[a-zA-Z0-9!@#]{8,16}$";
if(user.getPw()==null || !Pattern.matches(pwRegex, user.getPw()))
return false;
//이메일 유효성 검사
//xx@yy.zz or xx@yy.zz.cc
String emailRegex = "\\w+@\\w+\\.\\w+(\\.\\w+)?";
if(user.getEmail()==null || !Pattern.matches(emailRegex, user.getEmail()))
return false;
//이름 유효성 검사
if(user.getName()==null || user.getName().trim().length()==0)
return false;
//성별 유효성 검사
if(user.getGender()== null )
return false;
//비밀번호 암호화
String encPw = passwordEncoder.encode(user.getPw());
user.setPw(encPw);
memberDao.insertMember(user);
return false;
}
@Override
public MemberVO signin(MemberVO user) {
if(user == null || user.getId() == null)
return null;
MemberVO dbUser = memberDao.selectUser(user.getId());
//잘못된 ID == 회원이 아닌
if(dbUser == null)
return null;
//잘못된 비번
if(user.getPw() == null || !passwordEncoder.matches(user.getPw(), dbUser.getPw()))
return null;
//자동로그인 기능을 위해
dbUser.setUseCookie(user.getUseCookie());
return dbUser;
}
@Override
public Object getMember(String id) {
if(id == null)
return null;
return memberDao.selectUser(id);
}
@Override
public void signout(HttpServletRequest request, HttpServletResponse response) {
if(request == null || response == null)
return;
MemberVO user = getMemberByRequest(request);
if(user == null)
return;
HttpSession session = request.getSession();
session.removeAttribute("user");
session.invalidate();
//request.getSession().removeAttribute("user");
Cookie loginCookie = WebUtils.getCookie(request, "loginCookie");
if(loginCookie == null)
return ;
loginCookie.setPath("/");
loginCookie.setMaxAge(0);
response.addCookie(loginCookie);
keepLogin(user.getId(), "none", new Date());
}
@Override
public void keepLogin(String id, String session_id, Date session_limit) {
if(id == null) {
return ;
}
memberDao.keepLogin(id, session_id, session_limit);
}
@Override
public MemberVO getMemberByCookie(String session_id) {
if(session_id == null)
return null;
return memberDao.selectUserBySession(session_id);
}
@Override
public MemberVO getMemberByRequest(HttpServletRequest request) {
if(request == null)
return null;
return (MemberVO)request.getSession().getAttribute("user");
}
@Override
public ArrayList<MemberVO> getMemberList(MemberVO user, Criteria cri) {
if(user == null || user.getAuthority().equals("USER"))
return null;
return memberDao.selectUserList(user.getAuthority(),cri);
}
@Override
public boolean updateAuthority(MemberVO user, MemberVO loginUser) {
if(user == null || loginUser == null)
return false;
System.out.println(loginUser.compareAuthority(user));
if(loginUser.compareAuthority(user) <= 0)
return false;
MemberVO dbUser = memberDao.selectUser(user.getId());
System.out.println(dbUser);
dbUser.setAuthority(user.getAuthority());
memberDao.updateUser(dbUser);
return true;
}
@Override
public int getTotalCount(MemberVO user) {
if(user == null)
return 0;
return memberDao.getTotalCount(user.getAuthority());
}
}
| [
"kimjavi611@gmail.com"
] | kimjavi611@gmail.com |
5b185c96a502b57262db5d09de602b6bd469fabe | 61d34b919382cbce5e9b8791e4880755904b8cde | /spring_boot/spring_boot-email/src/main/java/com/example/email/service/Impl/EmailServiceImp.java | a2ced2b0c62082738cddf150aea783bf1a8f2aa5 | [] | no_license | taotaozhan/learningDemo | bdf398e91593339c7834c4c7080416c601a1d7c0 | b6eab6de2b6e256b20e191c774aa34c302ae9ad1 | refs/heads/master | 2022-06-27T05:21:52.373524 | 2020-06-29T07:40:17 | 2020-06-29T07:40:17 | 225,545,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package com.example.email.service.Impl;
import com.example.email.entity.Email;
import com.example.email.service.EmailService;
import com.example.email.util.MailUtil;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.mail.internet.MimeMessage;
import java.util.HashMap;
import java.util.Map;
/**
* @author zhangtao
* @data 创建时间
* @version 1.0
*/
@Service
public class EmailServiceImp implements EmailService {
@Autowired
//执行者
private JavaMailSender mailSender;
/**
* freemark
*/
@Autowired
public Configuration configuration;
@Autowired
public SpringTemplateEngine springTemplateEngine;
@Value("${spring.mail.username}")
private String from;
@Override
public void send(Email email) throws Exception {
MailUtil mailUtil = new MailUtil();
SimpleMailMessage mailMessage = new SimpleMailMessage();
//发送人
mailMessage.setFrom(from);
//接收人
mailMessage.setTo(email.getEmail());
//邮件主题
mailMessage.setSubject(email.getSubject());
//邮件内容
mailMessage.setText(email.getContent());
mailUtil.start(mailSender,mailMessage);
}
@Override
public void sendHtml(Email email) throws Exception {
}
@Override
public void sendFreemark(Email mail) throws Exception {
MimeMessage mailMessage = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mailMessage,true);
helper.setFrom(from);
helper.setTo(mail.getEmail());
helper.setSubject(mail.getSubject());
Map<String, Object> model = new HashMap<String, Object>();
model.put("content", mail.getContent());
Template template = configuration.getTemplate(mail.getTemplate()+".flt");
String text = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
helper.setText(text, true);
mailSender.send(mailMessage);
}
@Override
public void sendThymeleaf(Email email) throws Exception {
}
}
| [
"1186447959@qq.com"
] | 1186447959@qq.com |
f9208ba949f4f4cd85b9396a23b51c2607a0e5a7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_9fa9dcd5f3d5df6295ea366e24a6a5f80301531e/NYSuffolkCountyAParserTest/10_9fa9dcd5f3d5df6295ea366e24a6a5f80301531e_NYSuffolkCountyAParserTest_s.java | 9f21967c4f73dc77a70aa4c758e3c1eeff117414 | [] | 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 | 10,144 | java | package net.anei.cadpage.parsers.NY;
import net.anei.cadpage.parsers.BaseParserTest;
import net.anei.cadpage.parsers.NY.NYSuffolkCountyAParser;
import org.junit.Test;
public class NYSuffolkCountyAParserTest extends BaseParserTest {
public NYSuffolkCountyAParserTest() {
setParser(new NYSuffolkCountyAParser(), "SUFFOLK COUNTY", "NY");
}
@Test
public void testParser() {
doTest("T1",
"TYPE: GAS LEAKS / GAS ODOR (NATURAL / L.P.G.) LOC: 11 BRENTWOOD PKWY BRENTW HOMELESS SHELTER CROSS: PENNSYLVANIA AV / SUFFOLK AV CODE: 60-B-2 TIME: 12:54:16",
"CALL:GAS LEAKS / GAS ODOR (NATURAL / L.P.G.)",
"ADDR:11 BRENTWOOD PKWY",
"CITY:Brentwood",
"PLACE:HOMELESS SHELTER",
"X:PENNSYLVANIA AV / SUFFOLK AV",
"CODE:60-B-2",
"TIME:12:54:16");
doTest("T2",
"TYPE: STRUCTURE FIRE LOC: 81 NEW HAMPSHIRE AV NBAYSH CROSS: E FORKS RD / E 3 AV CODE: 69-D-10 TIME: 16:36:48",
"CALL:STRUCTURE FIRE",
"ADDR:81 NEW HAMPSHIRE AV",
"MADDR:81 NEW HAMPSHIRE AVE",
"CITY:Bay Shore",
"X:E FORKS RD / E 3 AV",
"CODE:69-D-10",
"TIME:16:36:48");
doTest("T3",
"TYPE: OPEN BURNING LOC: 65 GRANT AVE BRENTW CROSS: SUFFOLK AVE CODE: 54-C-6 TIME: 18:39:20",
"CALL:OPEN BURNING",
"ADDR:65 GRANT AVE",
"X:SUFFOLK AVE",
"CITY:Brentwood",
"CODE:54-C-6",
"TIME:18:39:20");
doTest("T4",
"TYPE: BLEEDING / LACERATIONS LOC: 462 SPUR DR N NBAYSH CROSS: WB SSP OFF RAMP-X42N 5TH AV / E 3 AV CODE: 21-A-1 TIME: 03:36:22",
"CALL:BLEEDING / LACERATIONS",
"ADDR:462 SPUR DR N",
"CITY:Bay Shore",
"X:WB SSP OFF RAMP-X42N 5TH AV / E 3 AV",
"CODE:21-A-1",
"TIME:03:36:22");
doTest("T5",
"TYPE: PREGNANCY / CHILDBIRTH / MISCARRIAGE LOC: 330 MOTOR PKWY HAUPPA:@FELDMAN, KRAMER & MONACO STE 400 CROSS: WASHINGTON AV / MARCUS BLVD C",
"CALL:PREGNANCY / CHILDBIRTH / MISCARRIAGE",
"ADDR:330 MOTOR PKWY",
"CITY:Hauppauge",
"PLACE:FELDMAN, KRAMER & MONACO STE 400",
"X:WASHINGTON AV / MARCUS BLVD");
doTest("T6",
"TYPE: PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE LOC: 200 WIRELESS BLVD HAUPPA: @SOCIAL SERVICES HAUPPAUGE INTERVIEW AREA CROSS: MORELAND RD /",
"CALL:PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE",
"ADDR:200 WIRELESS BLVD",
"CITY:Hauppauge",
"PLACE:SOCIAL SERVICES HAUPPAUGE INTERVIEW AREA",
"X:MORELAND RD /");
doTest("T7",
"FAINTING (NEAR) LOC: 46 SAUNDERS AV CENTEM:@KINGS CHAPEL CHURCH CROSS: ROWEIN RD CODE: 31-D-2 TIME: 17:24:12",
"CALL:FAINTING (NEAR)",
"ADDR:46 SAUNDERS AV",
"MADDR:46 SAUNDERS AVE",
"CITY:Center Moriches",
"PLACE:KINGS CHAPEL CHURCH",
"X:ROWEIN RD",
"CODE:31-D-2",
"TIME:17:24:12");
doTest("T8",
"SEIZURES LOC: 20 TRAINOR AV CENTEM CROSS: SUNRISE HWY S BERNSTEIN BLVD CODE: 12-C-1 TIME: 03:39:02",
"CALL:SEIZURES",
"ADDR:20 TRAINOR AV",
"MADDR:20 TRAINOR AVE",
"CITY:Center Moriches",
"X:SUNRISE HWY S BERNSTEIN BLVD",
"CODE:12-C-1",
"TIME:03:39:02");
doTest("T9",
"ABDOMINAL PAINS LOC: 18 INWOOD RD CENTEM CROSS: UNION AV / BEACHFERN RD CODE: 1-A-1 TIME: 21:21:39",
"CALL:ABDOMINAL PAINS",
"ADDR:18 INWOOD RD",
"CITY:Center Moriches",
"X:UNION AV / BEACHFERN RD",
"CODE:1-A-1",
"TIME:21:21:39");
doTest("T10",
"UNKNOWN PROBLEM LOC: 150 CHICHESTER AV CENTEM CROSS: YARMOUTH LN / FROWEIN RD CODE: TIME: 08:01:10",
"CALL:UNKNOWN PROBLEM",
"ADDR:150 CHICHESTER AV",
"MADDR:150 CHICHESTER AVE",
"CITY:Center Moriches",
"X:YARMOUTH LN / FROWEIN RD",
"TIME:08:01:10");
doTest("T11",
"FAINTING (NEAR) LOC: 6 FROWEIN RD EMORIC: @CEDAR LODGE NURSING HOME IN THE DINING ROOM CROSS: WALDEN CT OAK ST CODE: 31-D-3 TIME: 18:51:38",
"CALL:FAINTING (NEAR)",
"ADDR:6 FROWEIN RD",
"CITY:East Moriches",
"PLACE:CEDAR LODGE NURSING HOME IN THE DINING ROOM",
"X:WALDEN CT OAK ST",
"CODE:31-D-3",
"TIME:18:51:38");
doTest("T12",
"GAS ODOR (NATURAL L.P.G.) LOC: MCGRAW ST SHIRLE I/V/O SHIRLEY PLAZA CROSS: GRAND AV / OAK AV CODE: 60-C-2 TIME: 02:06:34",
"CALL:GAS ODOR (NATURAL L.P.G.)",
"ADDR:MCGRAW ST",
"MADDR:MCGRAW ST & GRAND AVE",
"CITY:Shirley",
"PLACE:I / V / O SHIRLEY PLAZA",
"X:GRAND AV / OAK AV",
"CODE:60-C-2",
"TIME:02:06:34");
doTest("T13",
"FAINTING (NEAR) LOC: 53-10 LONG TREE LN MORICH: @PINE HILLS SOUTH CLUBHOUSE COMMUNITY ROOM CROSS: CODE: 31-E-1 TIME: 14:54:18",
"CALL:FAINTING (NEAR)",
"ADDR:53-10 LONG TREE LN",
"MADDR:53 LONG TREE LN",
"CITY:Moriches",
"PLACE:PINE HILLS SOUTH CLUBHOUSE COMMUNITY ROOM",
"CODE:31-E-1",
"TIME:14:54:18");
doTest("T14",
"TYPE: ALARMS LOC: 127 CRYSTAL BEACH BLVD MORICH CROSS: BEVERLY CT / CODE: 52-B-1C TIME: 21:15:11",
"CALL:ALARMS",
"ADDR:127 CRYSTAL BEACH BLVD",
"CITY:Moriches",
"X:BEVERLY CT /",
"CODE:52-B-1C",
"TIME:21:15:11");
doTest("T15",
"TYPE: PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE LOC: 79 ABBOTT AV MASTIC ***_VIP_***: CROSS: ELGIN ST / FOXCROFT ST CODE: 25-B-6 TIME: 14:36:05",
"CALL:PSYCHIATRIC / ABNORMAL BEHAVIOR / SUICIDE",
"ADDR:79 ABBOTT AV",
"MADDR:79 ABBOTT AVE",
"CITY:Mastic",
"PLACE:***_VIP_***",
"X:ELGIN ST / FOXCROFT ST",
"CODE:25-B-6",
"TIME:14:36:05");
doTest("T16",
"TYPE: ALARMS LOC: 100 PATRICIA CT OAKDAL @OAKDALE APARTMENTS APARTMENT 3 CROSS: RACE PL / CODE: 52-C-1S TIME: 19:16:55",
"CALL:ALARMS",
"ADDR:100 PATRICIA CT",
"CITY:Oakdale",
"PLACE:OAKDALE APARTMENTS APARTMENT 3",
"X:RACE PL /",
"CODE:52-C-1S",
"TIME:19:16:55");
doTest("T18",
"FWD: TYPE: STRUCTURE FIRE LOC: 1 WILBUR AV MANORV CROSS: SOHMER ST / CODE: 69-D-5 TIME: 17:17:43",
"CALL:STRUCTURE FIRE",
"ADDR:1 WILBUR AV",
"MADDR:1 WILBUR AVE",
"CITY:Manorville",
"X:SOHMER ST /",
"CODE:69-D-5",
"TIME:17:17:43");
doTest("T19",
"TYPE: MOTOR VEHICLE ACCIDENT CROSS: CHURCH ST / LAKELAND AV CODE: 29-B-1U TIME: 09:04:01",
"CALL:MOTOR VEHICLE ACCIDENT",
"ADDR:CHURCH ST & LAKELAND AV",
"MADDR:CHURCH ST & LAKELAND AVE",
"CODE:29-B-1U",
"TIME:09:04:01");
doTest("T20",
"TYPE: ALARMS LOC: 311 BAY AV EPATCH: @BAY HOUSE CROSS: NEWINS ST / PARK ST CODE: 52-C-3G TIME: 15:33:58\n\n",
"CALL:ALARMS",
"ADDR:311 BAY AV",
"MADDR:311 BAY AVE",
"CITY:East Patchogue",
"PLACE:BAY HOUSE",
"X:NEWINS ST / PARK ST",
"CODE:52-C-3G",
"TIME:15:33:58");
doTest("T21",
"TYPE: CHEST PAIN LOC: 3845 VETERANS MEMORIAL HWY RONKON: @HOLIDAY INN RONKONKOMA: @HOLIDAY INN RONKONKOMA:06:12.4418,40:48:13.4 PARKI",
"CALL:CHEST PAIN",
"ADDR:3845 VETERANS MEMORIAL HWY",
"CITY:Ronkonkoma",
"PLACE:HOLIDAY INN RONKONKOMA",
"INFO:HOLIDAY INN RONKONKOMA 06 12.4418,40 48 13.4 PARKI");
doTest("T22",
"TYPE: UNKNOWN PROBLEM LOC: 195 CUBA HILL RD GREENL CROSS: MANOR RD / DANVILLE DR CODE: 32-B-2 TIME: 17:30:40",
"CALL:UNKNOWN PROBLEM",
"ADDR:195 CUBA HILL RD",
"CITY:Greenlawn",
"X:MANOR RD / DANVILLE DR",
"CODE:32-B-2",
"TIME:17:30:40");
doTest("T23",
"TYPE: STRUCTURE FIRE LOC: 1 ARNOLD DR HUNTIN CROSS: PARTRIDGE LN / CODE: default TIME: 06:38:03",
"CALL:STRUCTURE FIRE",
"ADDR:1 ARNOLD DR",
"CITY:Huntington",
"X:PARTRIDGE LN /",
"CODE:default",
"TIME:06:38:03");
doTest("T24",
"TYPE: STRUCTURE FIRE LOC: 6 MAJESTIC DR DIXHIL CROSS: ROYAL LN / REGENCY LN CODE: 69-D-6 TIME: 02:22:25",
"CALL:STRUCTURE FIRE",
"ADDR:6 MAJESTIC DR",
"CITY:Dix Hills",
"X:ROYAL LN / REGENCY LN",
"CODE:69-D-6",
"TIME:02:22:25");
doTest("T25",
"TYPE: FALLS LOC: 37 WATERSIDE AV NORTHP CROSS: MONROE ST / WILLIS ST CODE: 17-B-3 TIME: 13:40:45",
"CALL:FALLS",
"ADDR:37 WATERSIDE AV",
"MADDR:37 WATERSIDE AVE",
"CITY:Northport",
"X:MONROE ST / WILLIS ST",
"CODE:17-B-3",
"TIME:13:40:45");
doTest("T26",
"TYPE: HEADACHE LOC: 68 FOREST AV SHIRLE CROSS: DAWN DR / WINSTON DR CODE: 18-C-2 TIME: 16:09:54\n\n",
"CALL:HEADACHE",
"ADDR:68 FOREST AV",
"MADDR:68 FOREST AVE",
"CITY:Shirley",
"X:DAWN DR / WINSTON DR",
"CODE:18-C-2",
"TIME:16:09:54");
doTest("T27",
"TYPE: RESPIRATORY LOC: 16 TEAL CRSN GREATR CROSS: / WIDGEON CT CODE: 6-D-1 TIME: 15:59:03",
"CALL:RESPIRATORY",
"ADDR:16 TEAL CRSN",
"MADDR:16 TEAL CRESCENT",
"CITY:Great River",
"X:/ WIDGEON CT",
"CODE:6-D-1",
"TIME:15:59:03");
doTest("T28",
"TYPE: STRUCTURE FIRE LOC: 605 7 AV ENORTH CROSS: 6 ST / OWEN CT CODE: 69-D-6 TIME: 11:34:38",
"CALL:STRUCTURE FIRE",
"ADDR:605 7 AV",
"MADDR:605 7 AVE",
"CITY:East Northport",
"X:6 ST / OWEN CT",
"CODE:69-D-6",
"TIME:11:34:38");
}
public static void main(String[] args) {
new NYSuffolkCountyAParserTest().generateTests("T1", "CALL ADDR CITY PLACE X CODE INFO TIME");
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1602b02aa3751dab3e8602c002b38041c78abe92 | 7ad54455ccfdd0c2fa6c060b345488ec8ebb1cf4 | /com/ibm/icu/text/RuleBasedBreakIterator.java | 4feaa169c00814b095e4ce17988baeb25b2ee82b | [] | no_license | chetanreddym/segmentation-correction-tool | afdbdaa4642fcb79a21969346420dd09eea72f8c | 7ca3b116c3ecf0de3a689724e12477a187962876 | refs/heads/master | 2021-05-13T20:09:00.245175 | 2018-01-10T04:42:03 | 2018-01-10T04:42:03 | 116,817,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 54,372 | java | package com.ibm.icu.text;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.util.CompactByteArray;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
public class RuleBasedBreakIterator
extends BreakIterator
{
protected static final byte IGNORE = -1;
private static final String IGNORE_VAR = "_ignore_";
private static final short START_STATE = 1;
private static final short STOP_STATE = 0;
private String description;
private CompactByteArray charCategoryTable = null;
private short[] stateTable = null;
private short[] backwardsStateTable = null;
private boolean[] endStates = null;
private boolean[] lookaheadStates = null;
private int numCategories;
private CharacterIterator text = null;
public RuleBasedBreakIterator(String description)
{
this.description = description;
Builder builder = makeBuilder();
builder.buildBreakIterator();
}
protected Builder makeBuilder()
{
return new Builder();
}
public Object clone()
{
RuleBasedBreakIterator result = (RuleBasedBreakIterator)super.clone();
if (text != null) {
text = ((CharacterIterator)text.clone());
}
return result;
}
public boolean equals(Object that)
{
try
{
RuleBasedBreakIterator other = (RuleBasedBreakIterator)that;
if (!description.equals(description)) {
return false;
}
if (text == null) {
return text == null;
}
return text.equals(text);
}
catch (ClassCastException e) {}
return false;
}
public String toString()
{
return description;
}
public int hashCode()
{
return description.hashCode();
}
public void debugDumpTables()
{
System.out.println("Character Classes:");
int currentCharClass = 257;
int startCurrentRange = 0;
int initialStringLength = 0;
StringBuffer[] charClassRanges = new StringBuffer[numCategories];
for (int i = 0; i < numCategories; i++) {
charClassRanges[i] = new StringBuffer();
}
for (int i = 0; i < 65535; i++) {
if (charCategoryTable.elementAt((char)i) != currentCharClass) {
if (currentCharClass != 257)
{
if (i != startCurrentRange + 1) {
charClassRanges[currentCharClass].append("-" + Integer.toHexString(i - 1));
}
if (charClassRanges[currentCharClass].length() % 72 < initialStringLength % 72) {
charClassRanges[currentCharClass].append("\n ");
}
}
currentCharClass = charCategoryTable.elementAt((char)i);
startCurrentRange = i;
initialStringLength = charClassRanges[currentCharClass].length();
if (charClassRanges[currentCharClass].length() > 0)
charClassRanges[currentCharClass].append(", ");
charClassRanges[currentCharClass].append(Integer.toHexString(i));
}
}
for (int i = 0; i < numCategories; i++) {
System.out.println(i + ": " + charClassRanges[i]);
}
System.out.println("\n\nState Table. *: end state %: look ahead state");
System.out.print("C:\t");
for (int i = 0; i < numCategories; i++)
System.out.print(Integer.toString(i) + "\t");
System.out.println();System.out.print("=================================================");
for (int i = 0; i < stateTable.length; i++) {
if (i % numCategories == 0) {
System.out.println();
if (endStates[(i / numCategories)] != 0) {
System.out.print("*");
} else
System.out.print(" ");
if (lookaheadStates[(i / numCategories)] != 0) {
System.out.print("%");
}
else
System.out.print(" ");
System.out.print(Integer.toString(i / numCategories) + ":\t");
}
if (stateTable[i] == 0) {
System.out.print(".\t");
} else {
System.out.print(Integer.toString(stateTable[i]) + "\t");
}
}
System.out.println();
}
public void writeTablesToFile(FileOutputStream file, boolean littleEndian)
throws IOException
{
DataOutputStream out = new DataOutputStream(file);
byte[] comment = "Copyright (C) 1999, International Business Machines Corp. and others. All Rights Reserved.".getBytes("US-ASCII");
short headerSize = (short)(comment.length + 1 + 24);
short realHeaderSize = (short)(headerSize + (headerSize % 16 == 0 ? 0 : 16 - headerSize % 16));
writeSwappedShort(realHeaderSize, out, littleEndian);
out.write(218);
out.write(39);
writeSwappedShort((short)20, out, littleEndian);
writeSwappedShort((short)0, out, littleEndian);
if (littleEndian) {
out.write(0);
} else {
out.write(1);
}
out.write(0);
out.write(2);
out.write(0);
out.writeInt(1112689491);
out.writeInt(0);
out.writeInt(0);
out.write(comment);
out.write(0);
while (headerSize < realHeaderSize) {
out.write(0);
headerSize = (short)(headerSize + 1);
}
writeSwappedInt(numCategories, out, littleEndian);
int fileEnd = 36;
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += (description.length() + 1) * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += charCategoryTable.getIndexArray().length * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += charCategoryTable.getValueArray().length;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += stateTable.length * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += backwardsStateTable.length * 2;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += endStates.length;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
fileEnd += lookaheadStates.length;
fileEnd += (fileEnd % 4 == 0 ? 0 : 4 - fileEnd % 4);
writeSwappedInt(fileEnd, out, littleEndian);
for (int i = 0; i < description.length(); i++)
writeSwappedShort((short)description.charAt(i), out, littleEndian);
out.writeShort(0);
if ((description.length() + 1) % 2 == 1) {
out.writeShort(0);
}
char[] temp1 = charCategoryTable.getIndexArray();
for (int i = 0; i < temp1.length; i++)
writeSwappedShort((short)temp1[i], out, littleEndian);
if (temp1.length % 2 == 1)
out.writeShort(0);
byte[] temp2 = charCategoryTable.getValueArray();
out.write(temp2);
switch (temp2.length % 4) {
case 1: out.write(0);
case 2: out.write(0);
case 3: out.write(0);
}
for (int i = 0; i < stateTable.length; i++)
writeSwappedShort(stateTable[i], out, littleEndian);
if (stateTable.length % 2 == 1)
out.writeShort(0);
for (int i = 0; i < backwardsStateTable.length; i++)
writeSwappedShort(backwardsStateTable[i], out, littleEndian);
if (backwardsStateTable.length % 2 == 1) {
out.writeShort(0);
}
for (int i = 0; i < endStates.length; i++)
out.writeBoolean(endStates[i]);
switch (endStates.length % 4) {
case 1: out.write(0);
case 2: out.write(0);
case 3: out.write(0);
}
for (int i = 0; i < lookaheadStates.length; i++)
out.writeBoolean(lookaheadStates[i]);
switch (lookaheadStates.length % 4) {
case 1: out.write(0);
case 2: out.write(0);
case 3: out.write(0);
}
}
protected void writeSwappedShort(short x, DataOutputStream out, boolean littleEndian)
throws IOException
{
if (littleEndian) {
out.write((byte)(x & 0xFF));
out.write((byte)(x >> 8 & 0xFF));
}
else {
out.write((byte)(x >> 8 & 0xFF));
out.write((byte)(x & 0xFF));
}
}
protected void writeSwappedInt(int x, DataOutputStream out, boolean littleEndian)
throws IOException
{
if (littleEndian) {
out.write((byte)(x & 0xFF));
out.write((byte)(x >> 8 & 0xFF));
out.write((byte)(x >> 16 & 0xFF));
out.write((byte)(x >> 24 & 0xFF));
}
else {
out.write((byte)(x >> 24 & 0xFF));
out.write((byte)(x >> 16 & 0xFF));
out.write((byte)(x >> 8 & 0xFF));
out.write((byte)(x & 0xFF));
}
}
public int first()
{
CharacterIterator t = getText();
t.first();
return t.getIndex();
}
public int last()
{
CharacterIterator t = getText();
t.setIndex(t.getEndIndex());
return t.getIndex();
}
public int next(int n)
{
int result = current();
while (n > 0) {
result = handleNext();
n--;
}
while (n < 0) {
result = previous();
n++;
}
return result;
}
public int next()
{
return handleNext();
}
public int previous()
{
CharacterIterator text = getText();
if (current() == text.getBeginIndex()) {
return -1;
}
int start = current();
text.previous();
int lastResult = handlePrevious();
int result = lastResult;
while ((result != -1) && (result < start)) {
lastResult = result;
result = handleNext();
}
text.setIndex(lastResult);
return lastResult;
}
protected static final void checkOffset(int offset, CharacterIterator text)
{
if ((offset < text.getBeginIndex()) || (offset > text.getEndIndex())) {
throw new IllegalArgumentException("offset out of bounds");
}
}
public int following(int offset)
{
CharacterIterator text = getText();
if (offset == text.getEndIndex()) {
return -1;
}
checkOffset(offset, text);
text.setIndex(offset);
if (offset == text.getBeginIndex()) {
return handleNext();
}
int result = handlePrevious();
while ((result != -1) && (result <= offset)) {
result = handleNext();
}
return result;
}
public int preceding(int offset)
{
CharacterIterator text = getText();
checkOffset(offset, text);
text.setIndex(offset);
return previous();
}
public boolean isBoundary(int offset)
{
CharacterIterator text = getText();
checkOffset(offset, text);
if (offset == text.getBeginIndex()) {
return true;
}
return following(offset - 1) == offset;
}
public int current()
{
return getText().getIndex();
}
public CharacterIterator getText()
{
if (text == null) {
text = new StringCharacterIterator("");
}
return text;
}
public void setText(CharacterIterator newText)
{
int end = newText.getEndIndex();
newText.setIndex(end);
if (newText.getIndex() != end)
{
text = new SafeCharIterator(newText);
}
else {
text = newText;
}
text.first();
}
protected int handleNext()
{
CharacterIterator text = getText();
if (text.getIndex() == text.getEndIndex()) {
return -1;
}
int result = text.getIndex() + 1;
int lookaheadResult = 0;
int state = 1;
char c = text.current();
char lastC = c;
int lastCPos = 0;
if (lookupCategory(c) == -1) {
while (lookupCategory(c) == -1) {
c = text.next();
}
if ((Character.getType(c) == 6) || (Character.getType(c) == 7))
{
return text.getIndex();
}
}
while ((c != 65535) && (state != 0))
{
int category = lookupCategory(c);
if (category != -1) {
state = lookupState(state, category);
}
if (lookaheadStates[state] != 0) {
if (endStates[state] != 0) {
if (lookaheadResult > 0) {
result = lookaheadResult;
}
else {
result = text.getIndex() + 1;
}
}
else {
lookaheadResult = text.getIndex() + 1;
}
}
else if (endStates[state] != 0) {
result = text.getIndex() + 1;
}
if ((category != -1) && (state != 0)) {
lastC = c;
lastCPos = text.getIndex();
}
c = text.next();
}
if ((c == 65535) && (lookaheadResult == text.getEndIndex())) {
result = lookaheadResult;
}
else if ("\n\r\f
".indexOf(lastC) != -1) {
result = lastCPos + 1;
}
text.setIndex(result);
return result;
}
protected int handlePrevious()
{
CharacterIterator text = getText();
int state = 1;
int category = 0;
int lastCategory = 0;
char c = text.current();
while ((c != 65535) && (state != 0))
{
lastCategory = category;
category = lookupCategory(c);
if (category != -1) {
state = lookupBackwardState(state, category);
}
c = text.previous();
}
if (c != 65535) {
if (lastCategory != -1) {
text.setIndex(text.getIndex() + 2);
}
else {
text.next();
}
}
return text.getIndex();
}
protected int lookupCategory(char c)
{
return charCategoryTable.elementAt(c);
}
protected int lookupState(int state, int category)
{
return stateTable[(state * numCategories + category)];
}
protected int lookupBackwardState(int state, int category)
{
return backwardsStateTable[(state * numCategories + category)];
}
private static UnicodeSet intersection(UnicodeSet a, UnicodeSet b)
{
UnicodeSet result = new UnicodeSet(a);
result.retainAll(b);
return result;
}
protected class Builder
{
protected Vector categories = null;
protected Hashtable expressions = null;
protected UnicodeSet ignoreChars = null;
protected Vector tempStateTable = null;
protected Vector decisionPointList = null;
protected Stack decisionPointStack = null;
protected Vector loopingStates = null;
protected Vector statesToBackfill = null;
protected Vector mergeList = null;
protected boolean clearLoopingStates = false;
protected static final int END_STATE_FLAG = 32768;
protected static final int DONT_LOOP_FLAG = 16384;
protected static final int LOOKAHEAD_STATE_FLAG = 8192;
protected static final int ALL_FLAGS = 57344;
public Builder() {}
public void buildBreakIterator()
{
Vector tempRuleList = buildRuleList(description);
buildCharCategories(tempRuleList);
buildStateTable(tempRuleList);
buildBackwardsStateTable(tempRuleList);
}
private Vector buildRuleList(String description)
{
Vector tempRuleList = new Vector();
Stack parenStack = new Stack();
int p = 0;
int ruleStart = 0;
char c = '\000';
char lastC = '\000';
char lastOpen = '\000';
boolean haveEquals = false;
boolean havePipe = false;
boolean sawVarName = false;
boolean sawIllegalChar = false;
int illegalCharPos = 0;
String charsThatCantPrecedeAsterisk = "=/<(|>*+?;\000";
if ((description.length() != 0) && (description.charAt(description.length() - 1) != ';')) {
description = description + ";";
}
while (p < description.length()) {
c = description.charAt(p);
switch (c)
{
case '(':
case '[':
case '{':
if (lastOpen == '{') {
error("Can't nest brackets inside {}", p, description);
}
if ((lastOpen == '[') && (c != '[')) {
error("Can't nest anything in [] but []", p, description);
}
if ((c == '{') && ((haveEquals) || (havePipe))) {
error("Unknown variable name", p, description);
}
lastOpen = c;
parenStack.push(new Character(c));
if (c == '{') {
sawVarName = true;
}
break;
case ')':
case ']':
case '}':
char expectedClose = '\000';
switch (lastOpen) {
case '{':
expectedClose = '}';
break;
case '[':
expectedClose = ']';
break;
case '(':
expectedClose = ')';
}
if (c != expectedClose) {
error("Unbalanced parentheses", p, description);
}
if (lastC == lastOpen) {
error("Parens don't contain anything", p, description);
}
parenStack.pop();
if (!parenStack.empty()) {
lastOpen = ((Character)parenStack.peek()).charValue();
}
else {
lastOpen = '\000';
}
break;
case '*':
case '+':
case '?':
if (("=/<(|>*+?;\000".indexOf(lastC) != -1) && ((c != '?') || (lastC != '*')))
{
error("Misplaced *, +, or ?", p, description);
}
break;
case '=':
if ((haveEquals) || (havePipe)) {
error("More than one = or / in rule", p, description);
}
haveEquals = true;
sawIllegalChar = false;
break;
case '/':
if ((haveEquals) || (havePipe)) {
error("More than one = or / in rule", p, description);
}
if (sawVarName) {
error("Unknown variable name", p, description);
}
havePipe = true;
break;
case '!':
if ((lastC != ';') && (lastC != 0)) {
error("! can only occur at the beginning of a rule", p, description);
}
break;
case '\\':
p++;
break;
case '.':
break;
case '&':
case '-':
case ':':
case '^':
if ((lastOpen != '[') && (lastOpen != '{') && (!sawIllegalChar)) {
sawIllegalChar = true;
illegalCharPos = p;
}
break;
case ';':
if (sawIllegalChar) {
error("Illegal character", illegalCharPos, description);
}
if ((lastC == ';') || (lastC == 0)) {
error("Empty rule", p, description);
}
if (!parenStack.empty()) {
error("Unbalanced parenheses", p, description);
}
if (parenStack.empty())
{
if (haveEquals) {
description = processSubstitution(description.substring(ruleStart, p), description, p + 1);
}
else
{
if (sawVarName) {
error("Unknown variable name", p, description);
}
tempRuleList.addElement(description.substring(ruleStart, p));
}
ruleStart = p + 1;
haveEquals = havePipe = sawVarName = sawIllegalChar = 0;
}
break;
case '|':
if (lastC == '|') {
error("Empty alternative", p, description);
}
if ((parenStack.empty()) || (lastOpen != '(')) {
error("Misplaced |", p, description);
}
break;
default:
if ((c >= ' ') && (c < '') && (!Character.isLetter(c)) && (!Character.isDigit(c)) && (!sawIllegalChar))
{
sawIllegalChar = true;
illegalCharPos = p;
}
break; }
lastC = c;
p++;
}
if (tempRuleList.size() == 0) {
error("No valid rules in description", p, description);
}
return tempRuleList;
}
protected String processSubstitution(String substitutionRule, String description, int startPos)
{
int equalPos = substitutionRule.indexOf('=');
if (substitutionRule.charAt(0) != '$') {
error("Missing '$' on left-hand side of =", startPos, description);
}
String replace = substitutionRule.substring(1, equalPos);
String replaceWith = substitutionRule.substring(equalPos + 1);
handleSpecialSubstitution(replace, replaceWith, startPos, description);
if (replaceWith.length() == 0) {
error("Nothing on right-hand side of =", startPos, description);
}
if (replace.length() == 0) {
error("Nothing on left-hand side of =", startPos, description);
}
if (((replaceWith.charAt(0) != '[') || (replaceWith.charAt(replaceWith.length() - 1) != ']')) && ((replaceWith.charAt(0) != '(') || (replaceWith.charAt(replaceWith.length() - 1) != ')')))
{
error("Illegal right-hand side for =", startPos, description);
}
replace = "$" + replace;
StringBuffer result = new StringBuffer();
result.append(description.substring(0, startPos));
int lastPos = startPos;
int pos = description.indexOf(replace, startPos);
while (pos != -1)
{
if ((description.charAt(pos - 1) == ';') && (description.charAt(pos + replace.length()) == '='))
{
error("Attempt to redefine " + replace, pos, description);
}
result.append(description.substring(lastPos, pos));
result.append(replaceWith);
lastPos = pos + replace.length();
pos = description.indexOf(replace, lastPos);
}
result.append(description.substring(lastPos));
return result.toString();
}
protected void handleSpecialSubstitution(String replace, String replaceWith, int startPos, String description)
{
if (replace.equals("_ignore_")) {
if (replaceWith.charAt(0) == '(') {
error("Ignore group can't be enclosed in (", startPos, description);
}
ignoreChars = new UnicodeSet(replaceWith, false);
}
}
protected void buildCharCategories(Vector tempRuleList)
{
int bracketLevel = 0;
int p = 0;
int lineNum = 0;
expressions = new Hashtable();
while (lineNum < tempRuleList.size()) {
String line = (String)tempRuleList.elementAt(lineNum);
p = 0;
while (p < line.length()) {
char c = line.charAt(p);
switch (c) {
case '!': case '(':
case ')': case '*':
case '+': case '.':
case '/': case ';':
case '?':
case '|':
break;
case '[':
int q = p + 1;
bracketLevel++;
while ((q < line.length()) && (bracketLevel != 0)) {
c = line.charAt(q);
if (c == '[') {
bracketLevel++;
}
else if (c == ']') {
bracketLevel--;
}
q++;
}
if (expressions.get(line.substring(p, q)) == null) {
expressions.put(line.substring(p, q), new UnicodeSet(line.substring(p, q), false));
}
p = q - 1;
break;
case '\\':
p++;
c = line.charAt(p);
default:
UnicodeSet s = new UnicodeSet();
s.add(line.charAt(p));
expressions.put(line.substring(p, p + 1), s);
}
p++;
}
lineNum++;
}
categories = new Vector();
if (this.ignoreChars != null) {
categories.addElement(this.ignoreChars);
}
else {
categories.addElement(new UnicodeSet());
}
this.ignoreChars = null;
mungeExpressionList(expressions);
Enumeration iter = expressions.elements();
while (iter.hasMoreElements())
{
UnicodeSet work = new UnicodeSet((UnicodeSet)iter.nextElement());
for (int j = categories.size() - 1; (!work.isEmpty()) && (j > 0); j--)
{
UnicodeSet cat = (UnicodeSet)categories.elementAt(j);
UnicodeSet overlap = RuleBasedBreakIterator.intersection(work, cat);
if (!overlap.isEmpty())
{
if (!overlap.equals(cat)) {
cat.removeAll(overlap);
categories.addElement(overlap);
}
work.removeAll(overlap);
}
}
if (!work.isEmpty()) {
categories.addElement(work);
}
}
UnicodeSet allChars = new UnicodeSet();
for (int i = 1; i < categories.size(); i++)
allChars.addAll((UnicodeSet)categories.elementAt(i));
UnicodeSet ignoreChars = (UnicodeSet)categories.elementAt(0);
ignoreChars.removeAll(allChars);
iter = expressions.keys();
while (iter.hasMoreElements()) {
String key = (String)iter.nextElement();
UnicodeSet cs = (UnicodeSet)expressions.get(key);
StringBuffer cats = new StringBuffer();
for (int j = 1; j < categories.size(); j++) {
UnicodeSet cat = new UnicodeSet((UnicodeSet)categories.elementAt(j));
if (cs.containsAll(cat))
{
cats.append((char)(256 + j));
if (cs.equals(cat)) {
break;
}
}
}
expressions.put(key, cats.toString());
}
charCategoryTable = new CompactByteArray((byte)0);
for (int i = 0; i < categories.size(); i++) {
UnicodeSet chars = (UnicodeSet)categories.elementAt(i);
int n = chars.getRangeCount();
for (int j = 0; j < n; j++) {
int rangeStart = chars.getRangeStart(j);
if (rangeStart >= 65536) {
break;
}
if (i != 0) {
charCategoryTable.setElementAt((char)rangeStart, (char)chars.getRangeEnd(j), (byte)i);
}
else
{
charCategoryTable.setElementAt((char)rangeStart, (char)chars.getRangeEnd(j), (byte)-1);
}
}
}
charCategoryTable.compact();
numCategories = categories.size();
}
protected void mungeExpressionList(Hashtable expressions) {}
private void buildStateTable(Vector tempRuleList)
{
tempStateTable = new Vector();
tempStateTable.addElement(new short[numCategories + 1]);
tempStateTable.addElement(new short[numCategories + 1]);
for (int i = 0; i < tempRuleList.size(); i++) {
String rule = (String)tempRuleList.elementAt(i);
if (rule.charAt(0) != '!') {
parseRule(rule, true);
}
}
finishBuildingStateTable(true);
}
private void parseRule(String rule, boolean forward)
{
int p = 0;
int currentState = 1;
int lastState = currentState;
String pendingChars = "";
decisionPointStack = new Stack();
decisionPointList = new Vector();
loopingStates = new Vector();
statesToBackfill = new Vector();
boolean sawEarlyBreak = false;
if (!forward) {
loopingStates.addElement(new Integer(1));
}
decisionPointList.addElement(new Integer(currentState));
currentState = tempStateTable.size() - 1;
short[] state;
while (p < rule.length()) {
char c = rule.charAt(p);
clearLoopingStates = false;
if ((c == '[') || (c == '\\') || (Character.isLetter(c)) || (Character.isDigit(c)) || (c < ' ') || (c == '.') || (c >= ''))
{
if (c != '.') {
int q = p;
if (c == '\\') {
q = p + 2;
p++;
}
else if (c == '[') {
int bracketLevel = 1;
while (bracketLevel > 0) {
q++;
c = rule.charAt(q);
if (c == '[') {
bracketLevel++;
}
else if (c == ']') {
bracketLevel--;
}
else if (c == '\\') {
q++;
}
}
q++;
}
else
{
q = p + 1;
}
pendingChars = (String)expressions.get(rule.substring(p, q));
p = q - 1;
}
else
{
int rowNum = ((Integer)decisionPointList.lastElement()).intValue();
state = (short[])tempStateTable.elementAt(rowNum);
if ((p + 1 < rule.length()) && (rule.charAt(p + 1) == '*') && (state[0] != 0)) {
decisionPointList.addElement(new Integer(state[0]));
pendingChars = "";
p++;
if ((p + 1 < rule.length()) && (rule.charAt(p + 1) == '?'))
{
setLoopingStates(decisionPointList, decisionPointList);
p++;
}
}
else
{
StringBuffer temp = new StringBuffer();
for (int i = 0; i < numCategories; i++)
temp.append((char)(i + 256));
pendingChars = temp.toString();
}
}
if (pendingChars.length() != 0)
{
if ((p + 1 < rule.length()) && ((rule.charAt(p + 1) == '*') || (rule.charAt(p + 1) == '?')))
{
decisionPointStack.push(decisionPointList.clone());
}
int newState = tempStateTable.size();
if (loopingStates.size() != 0) {
statesToBackfill.addElement(new Integer(newState));
}
state = new short[numCategories + 1];
if (sawEarlyBreak) {
state[numCategories] = 16384;
}
tempStateTable.addElement(state);
updateStateTable(decisionPointList, pendingChars, (short)newState);
decisionPointList.removeAllElements();
lastState = currentState;
do {
currentState++;
decisionPointList.addElement(new Integer(currentState));
} while (currentState + 1 < tempStateTable.size());
}
}
if ((c == '+') || (c == '*') || (c == '?'))
{
if ((c == '*') || (c == '+'))
{
for (int i = lastState + 1; i < tempStateTable.size(); i++) {
Vector temp = new Vector();
temp.addElement(new Integer(i));
updateStateTable(temp, pendingChars, (short)(lastState + 1));
}
while (currentState + 1 < tempStateTable.size()) {
decisionPointList.addElement(new Integer(++currentState));
}
}
if ((c == '*') || (c == '?')) {
Vector temp = (Vector)decisionPointStack.pop();
for (int i = 0; i < decisionPointList.size(); i++)
temp.addElement(decisionPointList.elementAt(i));
decisionPointList = temp;
if ((c == '*') && (p + 1 < rule.length()) && (rule.charAt(p + 1) == '?'))
{
setLoopingStates(decisionPointList, decisionPointList);
p++;
}
}
}
if (c == '(')
{
tempStateTable.addElement(new short[numCategories + 1]);
lastState = currentState;
currentState++;
decisionPointList.insertElementAt(new Integer(currentState), 0);
decisionPointStack.push(decisionPointList.clone());
decisionPointStack.push(new Vector());
}
if (c == '|')
{
Vector oneDown = (Vector)decisionPointStack.pop();
Vector twoDown = (Vector)decisionPointStack.peek();
decisionPointStack.push(oneDown);
for (int i = 0; i < decisionPointList.size(); i++)
oneDown.addElement(decisionPointList.elementAt(i));
decisionPointList = ((Vector)twoDown.clone());
}
if (c == ')')
{
Vector exitPoints = (Vector)decisionPointStack.pop();
for (int i = 0; i < decisionPointList.size(); i++)
exitPoints.addElement(decisionPointList.elementAt(i));
decisionPointList = exitPoints;
if ((p + 1 >= rule.length()) || ((rule.charAt(p + 1) != '*') && (rule.charAt(p + 1) != '+') && (rule.charAt(p + 1) != '?')))
{
decisionPointStack.pop();
}
else
{
exitPoints = (Vector)decisionPointList.clone();
Vector temp = (Vector)decisionPointStack.pop();
int tempStateNum = ((Integer)temp.firstElement()).intValue();
short[] tempState = (short[])tempStateTable.elementAt(tempStateNum);
if ((rule.charAt(p + 1) == '?') || (rule.charAt(p + 1) == '*')) {
for (int i = 0; i < decisionPointList.size(); i++)
temp.addElement(decisionPointList.elementAt(i));
decisionPointList = temp;
}
if ((rule.charAt(p + 1) == '+') || (rule.charAt(p + 1) == '*')) {
for (int i = 0; i < tempState.length; i++) {
if (tempState[i] > tempStateNum) {
updateStateTable(exitPoints, new Character((char)(i + 256)).toString(), tempState[i]);
}
}
}
lastState = currentState;
currentState = tempStateTable.size() - 1;
p++;
}
}
if (c == '/') {
sawEarlyBreak = true;
for (int i = 0; i < decisionPointList.size(); i++) {
state = (short[])tempStateTable.elementAt(((Integer)decisionPointList.elementAt(i)).intValue()); int
tmp1456_1453 = numCategories; short[] tmp1456_1447 = state;tmp1456_1447[tmp1456_1453] = ((short)(tmp1456_1447[tmp1456_1453] | 0x2000));
}
}
if (clearLoopingStates) {
setLoopingStates(null, decisionPointList);
}
p++;
}
setLoopingStates(null, decisionPointList);
for (int i = 0; i < decisionPointList.size(); i++) {
int rowNum = ((Integer)decisionPointList.elementAt(i)).intValue();
state = (short[])tempStateTable.elementAt(rowNum); int
tmp1561_1558 = numCategories; short[] tmp1561_1552 = state;tmp1561_1552[tmp1561_1558] = ((short)(tmp1561_1552[tmp1561_1558] | 0x8000));
if (sawEarlyBreak) {
int tmp1582_1579 = numCategories; short[] tmp1582_1573 = state;tmp1582_1573[tmp1582_1579] = ((short)(tmp1582_1573[tmp1582_1579] | 0x2000));
}
}
}
private void updateStateTable(Vector rows, String pendingChars, short newValue)
{
short[] newValues = new short[numCategories + 1];
for (int i = 0; i < pendingChars.length(); i++) {
newValues[(pendingChars.charAt(i) - 'Ā')] = newValue;
}
for (int i = 0; i < rows.size(); i++) {
mergeStates(((Integer)rows.elementAt(i)).intValue(), newValues, rows);
}
}
private void mergeStates(int rowNum, short[] newValues, Vector rowsBeingUpdated)
{
short[] oldValues = (short[])tempStateTable.elementAt(rowNum);
boolean isLoopingState = loopingStates.contains(new Integer(rowNum));
for (int i = 0; i < oldValues.length; i++)
{
if (oldValues[i] != newValues[i])
{
if ((isLoopingState) && (loopingStates.contains(new Integer(oldValues[i])))) {
if (newValues[i] != 0) {
if (oldValues[i] == 0) {
clearLoopingStates = true;
}
oldValues[i] = newValues[i];
}
}
else if (oldValues[i] == 0) {
oldValues[i] = newValues[i];
}
else if (i == numCategories) {
oldValues[i] = ((short)(newValues[i] & 0xE000 | oldValues[i]));
}
else if ((oldValues[i] != 0) && (newValues[i] != 0))
{
int combinedRowNum = searchMergeList(oldValues[i], newValues[i]);
if (combinedRowNum != 0) {
oldValues[i] = ((short)combinedRowNum);
}
else
{
int oldRowNum = oldValues[i];
int newRowNum = newValues[i];
combinedRowNum = tempStateTable.size();
if (mergeList == null) {
mergeList = new Vector();
}
mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum });
short[] newRow = new short[numCategories + 1];
short[] oldRow = (short[])tempStateTable.elementAt(oldRowNum);
System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1);
tempStateTable.addElement(newRow);
oldValues[i] = ((short)combinedRowNum);
if (((decisionPointList.contains(new Integer(oldRowNum))) || (decisionPointList.contains(new Integer(newRowNum)))) && (!decisionPointList.contains(new Integer(combinedRowNum))))
{
decisionPointList.addElement(new Integer(combinedRowNum));
}
if (((rowsBeingUpdated.contains(new Integer(oldRowNum))) || (rowsBeingUpdated.contains(new Integer(newRowNum)))) && (!rowsBeingUpdated.contains(new Integer(combinedRowNum))))
{
decisionPointList.addElement(new Integer(combinedRowNum));
}
for (int k = 0; k < decisionPointStack.size(); k++) {
Vector dpl = (Vector)decisionPointStack.elementAt(k);
if (((dpl.contains(new Integer(oldRowNum))) || (dpl.contains(new Integer(newRowNum)))) && (!dpl.contains(new Integer(combinedRowNum))))
{
dpl.addElement(new Integer(combinedRowNum));
}
}
mergeStates(combinedRowNum, (short[])tempStateTable.elementAt(newValues[i]), rowsBeingUpdated);
}
}
}
}
}
private int searchMergeList(int a, int b)
{
if (mergeList == null) {
return 0;
}
for (int i = 0; i < mergeList.size(); i++) {
int[] entry = (int[])mergeList.elementAt(i);
if (((entry[0] == a) && (entry[1] == b)) || ((entry[0] == b) && (entry[1] == a))) {
return entry[2];
}
if ((entry[2] == a) && ((entry[0] == b) || (entry[1] == b))) {
return entry[2];
}
if ((entry[2] == b) && ((entry[0] == a) || (entry[1] == a))) {
return entry[2];
}
}
return 0;
}
private void setLoopingStates(Vector newLoopingStates, Vector endStates)
{
if (!loopingStates.isEmpty()) {
int loopingState = ((Integer)loopingStates.lastElement()).intValue();
for (int i = 0; i < endStates.size(); i++) {
eliminateBackfillStates(((Integer)endStates.elementAt(i)).intValue());
}
for (int i = 0; i < statesToBackfill.size(); i++) {
int rowNum = ((Integer)statesToBackfill.elementAt(i)).intValue();
short[] state = (short[])tempStateTable.elementAt(rowNum);
state[numCategories] = ((short)(state[numCategories] & 0xE000 | loopingState));
}
statesToBackfill.removeAllElements();
loopingStates.removeAllElements();
}
if (newLoopingStates != null) {
loopingStates = ((Vector)newLoopingStates.clone());
}
}
private void eliminateBackfillStates(int baseState)
{
if (statesToBackfill.contains(new Integer(baseState)))
{
statesToBackfill.removeElement(new Integer(baseState));
short[] state = (short[])tempStateTable.elementAt(baseState);
for (int i = 0; i < numCategories; i++) {
if (state[i] != 0) {
eliminateBackfillStates(state[i]);
}
}
}
}
private void backfillLoopingStates()
{
short[] loopingState = null;
int loopingStateRowNum = 0;
for (int i = 0; i < tempStateTable.size(); i++) {
short[] state = (short[])tempStateTable.elementAt(i);
int fromState = state[numCategories] & 0xFFFF1FFF;
if (fromState > 0)
{
if (fromState != loopingStateRowNum) {
loopingStateRowNum = fromState;
loopingState = (short[])tempStateTable.elementAt(loopingStateRowNum);
}
int tmp71_68 = numCategories; short[] tmp71_63 = state;tmp71_63[tmp71_68] = ((short)(tmp71_63[tmp71_68] & 0xE000));
for (int j = 0; j < state.length; j++) {
if (state[j] == 0) {
state[j] = loopingState[j];
}
else if (state[j] == 16384) {
state[j] = 0;
}
}
}
}
}
private void finishBuildingStateTable(boolean forward)
{
backfillLoopingStates();
int[] rowNumMap = new int[tempStateTable.size()];
Stack rowsToFollow = new Stack();
rowsToFollow.push(new Integer(1));
rowNumMap[1] = 1;
int i;
for (;
rowsToFollow.size() != 0;
i < numCategories)
{
int rowNum = ((Integer)rowsToFollow.pop()).intValue();
short[] row = (short[])tempStateTable.elementAt(rowNum);
i = 0; continue;
if ((row[i] != 0) &&
(rowNumMap[row[i]] == 0)) {
rowNumMap[row[i]] = row[i];
rowsToFollow.push(new Integer(row[i]));
}
i++;
}
int[] stateClasses = new int[tempStateTable.size()];
int nextClass = numCategories + 1;
short[] state1;
for (int i = 1; i < stateClasses.length; i++) {
if (rowNumMap[i] != 0)
{
state1 = (short[])tempStateTable.elementAt(i);
for (int j = 0; j < numCategories; j++) {
if (state1[j] != 0) {
stateClasses[i] += 1;
}
}
if (stateClasses[i] == 0)
stateClasses[i] = nextClass;
}
}
nextClass++;
int lastClass;
do
{
int currentClass = 1;
lastClass = nextClass;
while (currentClass < nextClass)
{
boolean split = false;
short[] state2; state1 = state2 = null;
for (int i = 0; i < stateClasses.length; i++) {
if (stateClasses[i] == currentClass)
{
if (state1 == null) {
state1 = (short[])tempStateTable.elementAt(i);
}
else {
state2 = (short[])tempStateTable.elementAt(i);
for (int j = 0; j < state2.length; j++)
if (((j == numCategories) && (state1[j] != state2[j]) && (forward)) || ((j != numCategories) && (stateClasses[state1[j]] != stateClasses[state2[j]])))
{
stateClasses[i] = nextClass;
split = true;
break;
}
}
}
}
if (split) {
nextClass++;
}
currentClass++;
}
} while (lastClass != nextClass);
int[] representatives = new int[nextClass];
for (int i = 1; i < stateClasses.length; i++) {
if (representatives[stateClasses[i]] == 0) {
representatives[stateClasses[i]] = i;
}
else {
rowNumMap[i] = representatives[stateClasses[i]];
}
}
for (int i = 1; i < rowNumMap.length; i++) {
if (rowNumMap[i] != i) {
tempStateTable.setElementAt(null, i);
}
}
int newRowNum = 1;
for (int i = 1; i < rowNumMap.length; i++) {
if (tempStateTable.elementAt(i) != null) {
rowNumMap[i] = (newRowNum++);
}
}
for (int i = 1; i < rowNumMap.length; i++) {
if (tempStateTable.elementAt(i) == null) {
rowNumMap[i] = rowNumMap[rowNumMap[i]];
}
}
if (forward) {
endStates = new boolean[newRowNum];
lookaheadStates = new boolean[newRowNum];
stateTable = new short[newRowNum * numCategories];
int p = 0;
int p2 = 0;
for (int i = 0; i < tempStateTable.size(); i++) {
short[] row = (short[])tempStateTable.elementAt(i);
if (row != null)
{
for (int j = 0; j < numCategories; j++) {
stateTable[p] = ((short)rowNumMap[row[j]]);
p++;
}
endStates[p2] = ((row[numCategories] & 0x8000) != 0 ? 1 : 0);
lookaheadStates[p2] = ((row[numCategories] & 0x2000) != 0 ? 1 : 0);
p2++;
}
}
}
else
{
backwardsStateTable = new short[newRowNum * numCategories];
int p = 0;
for (int i = 0; i < tempStateTable.size(); i++) {
short[] row = (short[])tempStateTable.elementAt(i);
if (row != null)
{
for (int j = 0; j < numCategories; j++) {
backwardsStateTable[p] = ((short)rowNumMap[row[j]]);
p++;
}
}
}
}
}
private void buildBackwardsStateTable(Vector tempRuleList)
{
tempStateTable = new Vector();
tempStateTable.addElement(new short[numCategories + 1]);
tempStateTable.addElement(new short[numCategories + 1]);
for (int i = 0; i < tempRuleList.size(); i++) {
String rule = (String)tempRuleList.elementAt(i);
if (rule.charAt(0) == '!') {
parseRule(rule.substring(1), false);
}
}
backfillLoopingStates();
int backTableOffset = tempStateTable.size();
if (backTableOffset > 2) {
backTableOffset++;
}
for (int i = 0; i < numCategories + 1; i++) {
tempStateTable.addElement(new short[numCategories + 1]);
}
short[] state = (short[])tempStateTable.elementAt(backTableOffset - 1);
for (int i = 0; i < numCategories; i++) {
state[i] = ((short)(i + backTableOffset));
}
int numRows = stateTable.length / numCategories;
for (int column = 0; column < numCategories; column++) {
for (int row = 0; row < numRows; row++) {
int nextRow = lookupState(row, column);
if (nextRow != 0) {
for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) {
int cellValue = lookupState(nextRow, nextColumn);
if (cellValue != 0) {
state = (short[])tempStateTable.elementAt(nextColumn + backTableOffset);
state[column] = ((short)(column + backTableOffset));
}
}
}
}
}
if (backTableOffset > 1)
{
state = (short[])tempStateTable.elementAt(1);
for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) {
short[] state2 = (short[])tempStateTable.elementAt(i);
for (int j = 0; j < numCategories; j++) {
if ((state[j] != 0) && (state2[j] != 0)) {
state2[j] = state[j];
}
}
}
state = (short[])tempStateTable.elementAt(backTableOffset - 1);
for (int i = 1; i < backTableOffset - 1; i++) {
short[] state2 = (short[])tempStateTable.elementAt(i);
if ((state2[numCategories] & 0x8000) == 0) {
for (int j = 0; j < numCategories; j++) {
if (state2[j] == 0) {
state2[j] = state[j];
}
}
}
}
}
finishBuildingStateTable(false);
}
protected void error(String message, int position, String context)
{
throw new IllegalArgumentException("Parse error: " + message + "\n" + Utility.escape(context.substring(0, position)) + "\n\n" + Utility.escape(context.substring(position)));
}
protected void debugPrintVector(String label, Vector v)
{
System.out.print(label);
for (int i = 0; i < v.size(); i++)
System.out.print(v.elementAt(i).toString() + "\t");
System.out.println();
}
protected void debugPrintVectorOfVectors(String label1, String label2, Vector v)
{
System.out.println(label1);
for (int i = 0; i < v.size(); i++) {
debugPrintVector(label2, (Vector)v.elementAt(i));
}
}
protected void debugPrintTempStateTable()
{
System.out.println(" tempStateTable:");
System.out.print(" C:\t");
for (int i = 0; i <= numCategories; i++)
System.out.print(Integer.toString(i) + "\t");
System.out.println();
for (int i = 1; i < tempStateTable.size(); i++) {
short[] row = (short[])tempStateTable.elementAt(i);
System.out.print(" " + i + ":\t");
for (int j = 0; j < row.length; j++) {
if (row[j] == 0) {
System.out.print(".\t");
}
else {
System.out.print(Integer.toString(row[j]) + "\t");
}
}
System.out.println();
}
}
}
private static final class SafeCharIterator
implements CharacterIterator, Cloneable
{
private CharacterIterator base;
private int rangeStart;
private int rangeLimit;
private int currentIndex;
SafeCharIterator(CharacterIterator base)
{
this.base = base;
rangeStart = base.getBeginIndex();
rangeLimit = base.getEndIndex();
currentIndex = base.getIndex();
}
public char first() {
return setIndex(rangeStart);
}
public char last() {
return setIndex(rangeLimit - 1);
}
public char current() {
if ((currentIndex < rangeStart) || (currentIndex >= rangeLimit)) {
return 65535;
}
return base.setIndex(currentIndex);
}
public char next()
{
currentIndex += 1;
if (currentIndex >= rangeLimit) {
currentIndex = rangeLimit;
return 65535;
}
return base.setIndex(currentIndex);
}
public char previous()
{
currentIndex -= 1;
if (currentIndex < rangeStart) {
currentIndex = rangeStart;
return 65535;
}
return base.setIndex(currentIndex);
}
public char setIndex(int i)
{
if ((i < rangeStart) || (i > rangeLimit)) {
throw new IllegalArgumentException("Invalid position");
}
currentIndex = i;
return current();
}
public int getBeginIndex() {
return rangeStart;
}
public int getEndIndex() {
return rangeLimit;
}
public int getIndex() {
return currentIndex;
}
public Object clone()
{
SafeCharIterator copy = null;
try {
copy = (SafeCharIterator)super.clone();
}
catch (CloneNotSupportedException e) {
throw new Error("Clone not supported: " + e);
}
CharacterIterator copyOfBase = (CharacterIterator)base.clone();
base = copyOfBase;
return copy;
}
}
public static void debugPrintln(String s)
{
String zeros = "0000";
StringBuffer out = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if ((c >= ' ') && (c < '')) {
out.append(c);
}
else {
out.append("\\u");
String temp = Integer.toHexString(c);
out.append("0000".substring(0, 4 - temp.length()));
out.append(temp);
}
}
System.out.println(out);
}
}
| [
"chetanb4u2009@outlook.com"
] | chetanb4u2009@outlook.com |
10c03f524b861160489b972133ac4ec477563d26 | 3da4e7cbac527b42c86065e4cc239b1b3559c7c0 | /app/src/main/java/com/example/keepfit/ui/dashboard/GoalsFragment.java | 7682d92f88c1126c5c8099134ca2b573a4c0c75b | [] | no_license | gmc112/KeepFit | 714c6099c5bcae13a8ae796110e2a92a4093ca9f | 388a924f53abf90bc35b22092a47af8ea89aa553 | refs/heads/master | 2020-12-29T10:28:42.399666 | 2020-02-06T00:17:43 | 2020-02-06T00:17:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package com.example.keepfit.ui.dashboard;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.keepfit.R;
public class GoalsFragment extends Fragment {
private GoalsViewModel goalsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
goalsViewModel =
ViewModelProviders.of(this).get(GoalsViewModel.class);
View root = inflater.inflate(R.layout.fragment_goals, container, false);
final ListView listView = root.findViewById(R.id.text_dashboard);
goalsViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
}
});
return root;
}
} | [
"ntb15144@uni.strath.ac.uk"
] | ntb15144@uni.strath.ac.uk |
54620d6bbf513c0f3825a3906b9d9c1ee087b32e | e14769597d30adfc88b38d807053cbcfa92239ce | /subprojects/web/src/dtrack/web/actions/AddCommentAction.java | 4846e5afed0b1f1309c2ffb6436e776f7af6c0ef | [] | no_license | osobolev/dtrack | a99c9d2b541509f55c8e383604f7f1fbdb31146e | 023cb2bd8625260061b4c8b9e22f89fe8e1fd661 | refs/heads/master | 2023-03-10T23:53:39.590458 | 2023-02-28T14:43:15 | 2023-02-28T14:43:15 | 215,111,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,418 | java | package dtrack.web.actions;
import dtrack.web.dao.BugEditDao;
import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;
import java.util.Map;
public final class AddCommentAction extends Action {
private final int bugId;
private final int bugNum;
private final ProjectInfo request;
public AddCommentAction(int bugId, int bugNum, ProjectInfo request) {
this.bugId = bugId;
this.bugNum = bugNum;
this.request = request;
}
private Integer createComment(BugEditDao dao, Map<String, String> parameters) throws ValidationException, SQLException {
String untrustedHtml = parameters.get("comment");
if (untrustedHtml == null)
throw new ValidationException("Missing 'comment' parameter");
String safeHtml = UploadUtil.POLICY.sanitize(untrustedHtml);
return dao.addBugComment(bugId, request.getUserId(), safeHtml);
}
@Override
public String post(Context ctx, HttpServletRequest req) throws Exception {
BugEditDao dao = new BugEditDao(ctx.connection);
UploadUtil<Integer> util = new UploadUtil<>(parameters -> createComment(dao, parameters));
util.post(
req,
(commentId, fileName, content) -> dao.addCommentAttachment(commentId.intValue(), fileName, content)
);
ctx.connection.commit();
return request.getBugUrl(bugNum);
}
}
| [
"sobolev_ov@mail.ru"
] | sobolev_ov@mail.ru |
0e19ecf884d7984337aec711b90c3adac175fb43 | 4591c6ebdba6ef84ced586da2bdd9eb95a93fa53 | /src/main/java/com/kevin/Chapter/one/ufTest.java | d238db667a9d71bc7506126eb4f03e5a8df87466 | [] | no_license | kevin19931015/MyAlgorithm | 355cbf3ba4e41657225d281dc0b7ce0754cba7ad | a11a417b8cfa68acefd5cbda5bcd1c116f79a071 | refs/heads/master | 2021-05-12T00:12:57.866257 | 2018-01-17T12:54:03 | 2018-01-17T12:54:03 | 117,529,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.kevin.Chapter.one;
import edu.princeton.cs.introcs.StdIn;
import edu.princeton.cs.introcs.StdOut;
public class ufTest {
public static void main(String[] args){
int N = StdIn.readInt();
UnionFind uf = new UnionFind(N);
while (!StdIn.isEmpty()){
int p = StdIn.readInt();
int q = StdIn.readInt();
uf.union(p,q);
StdOut.println(uf.find(p)+"---"+uf.find(q));
StdOut.println(p+"---"+q);
StdOut.println(uf.count());
}
}
}
| [
"1137885445@qq.com"
] | 1137885445@qq.com |
fd8ea75442fdaec9d20273a14bb12641c1ab5bdc | adcf82e8f6ca858305504d13d8db79c0a6970323 | /Basic Code/Classes.java | 0d7c09db082395b9cce8bee28a41769f209dc880 | [] | no_license | Genius1237/CRUx-Android-Workshop | 8927a769f5dc22786cd467f6f9fce35a7f53a2e6 | c4c53255bfef0c8a736d7220f1921d490034bed3 | refs/heads/master | 2021-01-11T14:18:27.322624 | 2017-03-06T13:37:52 | 2017-03-06T13:37:52 | 81,328,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | class One{
int x;
float y;
char name[100];
char id[10];
//Classes can have functions inside them
int doSomething(){
}
public void doNothing(){
}
//Constructor
One(){
}
//Constructor with arguments
One(int x,float y){
}
public static void main(String args[]){
//Object Creation
int x=5;
One y=new One();
//Each time an object is created, memory must be alotted using new operator
One z;
//No object is created here. z points to null
}
} | [
"anirudhsriniv@gmail.com"
] | anirudhsriniv@gmail.com |
bd916b6adde21dc97534c7fed6e85f123a70961b | bb75a0924633fcffd620a2dbf6d6c61340c7c553 | /tradeportal/WEB-INF/src/java/com/cxsample/tradeportal/PayBill.java | 5941d017e842f4a819e91de97dc289a81440d372 | [] | no_license | Checkmarx-Clinic/TP-INSTRUCTOR | 2786391d5d8f2c0dc37944696a228d362159d85b | 40d3b3615271770ad4f3ede0e4c70927e98e9b05 | refs/heads/master | 2022-11-18T19:04:12.842675 | 2020-06-23T16:18:01 | 2020-06-23T16:18:01 | 274,244,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 924 | java | package com.cxsample.tradeportal;
import com.opensymphony.xwork2.ActionSupport;
import com.cxsample.tradeportal.database.ConnectionFactory;
import com.cxsample.tradeportal.model.Account;
import com.cxsample.tradeportal.model.AccountService;
import net.sf.hibernate.Session;
import net.sf.hibernate.Query;
import net.sf.hibernate.Criteria;
import net.sf.hibernate.expression.Expression;
import org.apache.struts2.ServletActionContext;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
public class PayBill extends AdminSupport
{
private List accounts;
public String execute() throws Exception
{
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getRemoteUser();
accounts = AccountService.getAccounts(username);
super.execute();
return SUCCESS;
}
public List getAccounts() {
return accounts;
}
}
| [
"checkmarx.sample@gmail.com"
] | checkmarx.sample@gmail.com |
f1abbb4a61bde85a5069a9348ffb6a211eb0e310 | 95691177074cccb1281ddf9f84a8d88f9ef23164 | /src/main/java/com/sys/mype/sysce/pe/dto/ItemDTO.java | d6b3a2a3af220593cbfab927a806e0e0276cc7d7 | [] | no_license | ctucnoc/Sysce | c80381fb4afe08393f115ab9d279aeea3a0396d7 | c4223601fc312772da3a838d3585e3a93854899f | refs/heads/master | 2023-06-13T21:54:06.351568 | 2021-07-04T20:09:30 | 2021-07-04T20:09:30 | 352,447,990 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package com.sys.mype.sysce.pe.dto;
import lombok.Data;
@Data
public class ItemDTO {
private String displayName;
private String iconName;
private String route;
private String code;
}
| [
"ctc.tucno@gmail.com"
] | ctc.tucno@gmail.com |
a681f798226e7454a52655448923cac6aadaabd4 | 27ca483176c24274329e6c63d9903421d1ca0a8d | /src/Client/UniqClient.java | 295a7194947ded9e7e4a03d7e2ccd21e28598a15 | [] | no_license | surajbabar/unix-tools | 860abd453ebe13c6c2612d86dca8fbb9416a23bb | 2a43a59c74e68c097c6d63272a40103b925f4ae5 | refs/heads/master | 2021-01-25T10:15:11.182620 | 2017-10-15T16:57:11 | 2017-10-15T16:57:11 | 15,743,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package Client;
import surajbab.unixTools.Uniq;
import surajbab.unixTools.lib.File;
public class UniqClient {
public static void main(String[] args) {
Uniq uniq = new Uniq();
String filename = args[0], fileData;
fileData = new File().readFile(filename);
System.out.println(uniq.UniqLines(fileData));
}
}
| [
"surajbab@thoughtworks.com"
] | surajbab@thoughtworks.com |
9e5d3f73f5e7a9cd7ffd21df8bd677e35973653b | 1b2e63d4a971b8e9910f95acac013087f294970e | /src/com/cokiMing/layer/bullet/BaseBullet.java | 10be451c8cd2451013cdfd5b2407a6f26c6c0871 | [] | no_license | cokiMing/Issac-Java | 40ca761e0f9cd5c7845b58e6953d29f6683a764d | 89eeb64bf64b832aa83df5712d53713e312be567 | refs/heads/master | 2021-01-01T20:07:12.633979 | 2017-08-01T10:03:12 | 2017-08-01T10:03:12 | 98,767,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,551 | java | package com.cokiMing.layer.bullet;
import com.cokiMing.layer.buff.BaseBuff;
import com.cokiMing.layer.role.BaseRole;
import com.cokiMing.constant.Direction;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Coki on 2017/7/30.
*/
public abstract class BaseBullet {
//速度
protected double speed;
//x方向弹速
protected int xSpeed;
//y方向弹速
protected int ySpeed;
//坐标x
protected int x;
//坐标y
protected int y;
//子弹方向
protected Direction direction;
//伤害值
protected double damage;
//是否可穿越障碍物
protected boolean acrossBlock;
//是否可穿越敌人
protected boolean acrossEnemy;
//子弹的加成
protected BaseBuff baseBuff;
//敌我区分标记
protected boolean isGood;
//发射子弹的对象
protected BaseRole baseRole;
//图片映射
protected Map<String,Image> imageMap = new HashMap<>();
public BaseBullet(){
}
public BaseBullet(BaseRole baseRole){
this.baseRole = baseRole;
this.x = baseRole.getX();
this.y = baseRole.getY();
init();
}
public void init(){
initBullet();
initImageMap();
}
/**
* 绘制方法
* @param graphics
*/
public abstract void draw(Graphics graphics);
/**
* 初始化贴图映射
*/
protected abstract void initImageMap();
/**
* 初始化子弹形状
*/
protected abstract void initBullet();
}
| [
"wuyiming@123feng.com"
] | wuyiming@123feng.com |
5d84db6898f2e0fa2179c305c86e665d7b4dd3ab | 02c248a868a2788cae024232cefd27abb2f00931 | /app/src/main/java/xyz/romakononovich/firebase/models/Message.java | 19ffc374c2c9447e9d74763b7b4cad9ab2946c62 | [] | no_license | romakononovich/Firebase | fe555d2d5c0fa5d12f325ffca6fdebb9b3d5c542 | 55dab4a23c26f3263b3d4b1f2c3e445bc77a2dfa | refs/heads/master | 2020-04-05T14:34:40.209241 | 2017-09-05T16:35:54 | 2017-09-05T16:35:54 | 94,694,121 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package xyz.romakononovich.firebase.models;
import java.util.Objects;
/**
* Created by romank on 13.06.17.
*/
public class Message {
private String time;
private String message;
private String title;
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Message{" +
"time='" + time + '\'' +
", message='" + message + '\'' +
", title='" + title + '\'' +
", id=" + id +
'}';
}
@Override
public boolean equals(Object obj) {
Message other = (Message) obj;
if (!Objects.equals(id, other.id)) {
return false;
}
return true;
}
}
| [
"romakononovich@gmail.com"
] | romakononovich@gmail.com |
af0b280699774c58829d0367dea621315b44a4a2 | 2727bb9cf60f98034615e578cef6321d79c2bb23 | /photoviewerkit/src/main/java/com/khoinguyen/photoviewerkit/interfaces/IPhotoBackdropView.java | b70796691d926b2984b8df0a354b082298a49ae9 | [] | no_license | khoi-nguyen-2359/wallpaper-gallery | fec0c51bae66b06027808d12c194f3de8176642a | d6564aa4b3baccbba0ea897a481a9db45f2150e6 | refs/heads/master | 2021-01-21T14:40:00.711878 | 2016-07-15T09:54:32 | 2016-07-15T09:54:32 | 55,956,629 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.khoinguyen.photoviewerkit.interfaces;
/**
* Created by khoinguyen on 6/27/16.
*/
public interface IPhotoBackdropView<D> extends IPhotoViewerKitComponent<D> {
void updateAlphaOnShrinkAnimationUpdate(float animationProgress);
void updateAlphaOnRevealAnimationUpdate(float animationProgress);
}
| [
"akhoi90@gmail.com"
] | akhoi90@gmail.com |
cbe789660422a1c534daa3bc19257f1d8e034e77 | 064c1c2a39de354aef90228bfc32aa1e44f46183 | /ArtificialIntelegence/src/BasicBayesian/ParseDataSet.java | c49a2aca8367a414927585e9847e1cac6fdce6ec | [] | no_license | dibranxhymshiti/Viti_2_Projektet | 648dd01506f99c05865397c7926bc03bbf0f35c7 | 8dd8e1b54f75c7fc5a2540814b6345a8a90419ba | refs/heads/master | 2020-03-27T07:25:14.976659 | 2016-06-23T01:36:26 | 2016-06-23T01:36:26 | 61,762,546 | 0 | 0 | null | 2016-06-23T01:36:26 | 2016-06-23T01:15:12 | Java | UTF-8 | Java | false | false | 2,575 | java | package BasicBayesian;
import java.io.*;
public class ParseDataSet
{
/*
* ==========================================================================
* =* paseDataset
* ============================================================
* ===============
*/
public int[][] parseDataset(String training_dataset_path, int number_of_attributes ) throws IOException
{
int [][] training_data = new int [countRows(training_dataset_path)][number_of_attributes+1];
String read_transaction = "";
try {
FileReader fileReader = new FileReader(training_dataset_path);
BufferedReader bufferedReader = new BufferedReader(fileReader);
int ID_ItemSet = 0;
while((read_transaction = bufferedReader.readLine()) != null)
{ if(validate(read_transaction.charAt(0)+""))
{
String[] transaction_box = read_transaction.split(" ");
training_data[ID_ItemSet][0] = Integer.parseInt(transaction_box[0]); // gets class label value
for(int i = 1; i<transaction_box.length; i++)
{
String[] index_value = transaction_box[i].split(":");
training_data[ID_ItemSet][Integer.parseInt(index_value[0])] = Integer.parseInt(index_value[1]);
}
ID_ItemSet++;
}
}
bufferedReader.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
return training_data;
}
/*
* ==========================================================================
* =* countRows
* ==============================================================
* =============
*/
public static int countRows(String filename) throws IOException
{
LineNumberReader reader = new LineNumberReader(new FileReader(filename));
int count = 0;
String lineRead = "";
while ((lineRead = reader.readLine()) != null)
{
}
count = reader.getLineNumber();
reader.close();
return count;
}
public boolean validate(String s)
{
boolean answer = false;
if(s.equals("0") || s.equals("-")|| s.equals("+"))
answer = true;
return answer;
}
public static void main(String[] args) throws IOException
{
String path = "C:\\Users\\dibran\\Desktop\\generated_data.txt";
ParseDataSet p = new ParseDataSet();
int[][] dataset = p.parseDataset(path, 10);
for (int i = 0; i < dataset.length; i++)
{
for (int j = 0; j < dataset[0].length; j++)
{
System.out.print(dataset[i][j] + " ");
}
System.out.println();
}
}
}
| [
"dibranxhymshiti@hotmail.com"
] | dibranxhymshiti@hotmail.com |
d9d857059da10c6045b53d4d71093bb6f6e80f7b | dc49c77325e801959163c386b832f8e0a8a0089e | /src/Airplane/cabin/Meal.java | 4ed7b0ae6a5d7bef986cf30c3e574162483dc0ce | [] | no_license | Herbert-Karl/Software-Engineering-I | f2e78cf2ed169199f8b60bdfe72a752a48547fe0 | fe5ea077fd3e928d4bfafc0ce459a1a4e994f514 | refs/heads/master | 2020-04-02T05:48:56.653090 | 2019-01-07T14:27:20 | 2019-01-07T14:27:20 | 154,107,562 | 9 | 25 | null | 2019-01-07T14:10:15 | 2018-10-22T08:07:41 | Java | UTF-8 | Java | false | false | 420 | java | package Airplane.cabin;
public class Meal {
private String description;
private double weight;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
}
| [
"ko.goldbach@gmail.com"
] | ko.goldbach@gmail.com |
7dd1174a90b6da2f5ef01818f7aa389b53805e60 | 5d3d78d93c49823a91f5e1e18bd1565893002321 | /src/main/java/org/gwtproject/i18n/shared/cldr/impl/NumberConstantsImpl_en_TO.java | 78a0259224222abd1b0b52ab8a6b4c2757cb857f | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | vegegoku/gwt-i18n-cldr | ecf38343c0448bab21118c8cdc017ed91b628e71 | fdf25c7f898993a50ef9d10fe41ccc44c1ee500f | refs/heads/master | 2021-06-11T05:07:57.695293 | 2020-08-27T08:26:12 | 2020-08-27T08:26:12 | 128,426,644 | 2 | 1 | null | 2020-07-17T17:29:11 | 2018-04-06T17:38:54 | Java | UTF-8 | Java | false | false | 2,382 | java | // /*
// * Copyright 2012 Google Inc.
// *
// * Licensed under the Apache License, Version 2.0 (the "License"); you may not
// * use this file except in compliance with the License. You may obtain a copy of
// * the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// * License for the specific language governing permissions and limitations under
// * the License.
// */
//
package org.gwtproject.i18n.shared.cldr.impl;
import java.lang.Override;
import java.lang.String;
import javax.annotation.Generated;
import org.gwtproject.i18n.shared.cldr.NumberConstantsImpl;
@Generated("gwt-cldr-importer : org.gwtproject.tools.cldr.NumberConstantsProcessor, CLDR version : release-34")
public class NumberConstantsImpl_en_TO implements NumberConstantsImpl {
@Override
public String notANumber() {
return "NaN";
}
@Override
public String decimalPattern() {
return "#,##0.###";
}
@Override
public String decimalSeparator() {
return ".";
}
@Override
public String defCurrencyCode() {
return "TOP";
}
@Override
public String exponentialSymbol() {
return "E";
}
@Override
public String groupingSeparator() {
return ",";
}
@Override
public String infinity() {
return "∞";
}
@Override
public String minusSign() {
return "-";
}
@Override
public String monetaryGroupingSeparator() {
return ",";
}
@Override
public String monetarySeparator() {
return ".";
}
@Override
public String percent() {
return "%";
}
@Override
public String percentPattern() {
return "#,##0%";
}
@Override
public String perMill() {
return "‰";
}
@Override
public String plusSign() {
return "+";
}
@Override
public String scientificPattern() {
return "#E0";
}
@Override
public String currencyPattern() {
return "¤#,##0.00";
}
@Override
public String simpleCurrencyPattern() {
return "¤¤¤¤#,##0.00";
}
@Override
public String globalCurrencyPattern() {
return "¤¤¤¤#,##0.00 ¤¤";
}
@Override
public String zeroDigit() {
return "0";
}
}
| [
"akabme@gmail.com"
] | akabme@gmail.com |
8181053053ab01b4dc41113fccdc8857c13adc45 | 4916ed5c8041b83dd051b5a24756bcdd5b043c3d | /src/java/demo/RulesEngine.java | fa82e0ab2851704509447cd4ce87c7611d4117c7 | [] | no_license | barba-dorada/drools-test | 8e3440efa5109df3c3845ecf6ca3f2451dcb38db | 4eb05c5c0fc10f42d7bd665bad1cf070962d8241 | refs/heads/master | 2021-01-17T17:43:29.731171 | 2016-10-11T11:06:56 | 2016-10-11T11:06:56 | 70,585,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | package demo;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.event.DebugWorkingMemoryEventListener;
import org.drools.rule.Package;
public class RulesEngine {
private RuleBase rules;
private boolean debug = false;
public RulesEngine(String rulesFile) throws RulesEngineException {
super();
try {
// Read in the rules source file
Reader source = new InputStreamReader(RulesEngine.class
.getResourceAsStream("/rules/" + rulesFile));
// Use package builder to build up a rule package
PackageBuilder builder = new PackageBuilder();
// This will parse and compile in one step
builder.addPackageFromDrl(source);
// Get the compiled package
Package pkg = builder.getPackage();
// Add the package to a rulebase (deploy the rule package).
rules = RuleBaseFactory.newRuleBase();
rules.addPackage(pkg);
} catch (Exception e) {
throw new RulesEngineException(
"Could not load/compile rules file: " + rulesFile, e);
}
}
public RulesEngine(String rulesFile, boolean debug)
throws RulesEngineException {
this(rulesFile);
this.debug = debug;
}
public void executeRules(WorkingEnvironmentCallback callback) {
WorkingMemory workingMemory = rules.newStatefulSession();
if (debug) {
workingMemory
.addEventListener(new DebugWorkingMemoryEventListener());
}
callback.initEnvironment(workingMemory);
workingMemory.fireAllRules();
}
}
| [
"vad.tishenko@gmail.com"
] | vad.tishenko@gmail.com |
21c790e4fe73a65412e65f13e49a6b1a03c09cd5 | 6a4689aa2453f8a4a289db88f8a4be5eef0cf739 | /src/main/java/com/devops/service/IJobService.java | 0df3706e4d4c31d53b2e5bccf7dfbfb9d2037abd | [
"Apache-2.0"
] | permissive | bradlyyd/testsff | 8310253a7fe75af977824bdd851d027a8fbd14db | a4b5a1547d81838fd41978561572738becdab4f9 | refs/heads/master | 2020-03-22T07:04:39.864151 | 2018-06-26T09:18:20 | 2018-06-26T09:18:20 | 139,676,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | package com.devops.service;
import java.util.Map;
import org.springframework.scheduling.annotation.Async;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.devops.entity.JenkinsJob;
import com.devops.entity.Template;
/**
*
* SysUser
*
*/
public interface IJobService extends IService<JenkinsJob> {
public void insertJob(JenkinsJob job,Template tpl)throws Exception ;
public void updateJob(JenkinsJob job) throws Exception;
void delete(Integer id,String jobName)throws Exception;
public void restartPipeline(String jobName,int buildNum,String stageName)throws Exception;
void build(JenkinsJob job)throws Exception;
public void doBuild(JenkinsJob job);
Page<Map<Object, Object>> selectJobList(Page<Map<Object, Object>> page, Map<String ,Object> map);
} | [
"szjack@163.com"
] | szjack@163.com |
84d01abde09e4e6674ddfedb22a17107f8ba8acd | c0e62d59b77aefe46ddb392a6f9e1087080c4aee | /SweetShop/src/cakes/special/Advertising.java | 761e205e1277a126f8bd2e3b725e81ca9e312619 | [] | no_license | borisb955/ITtalentsHW | 66666e46aa9783314d04b38f31014653f9314e08 | 3ff6aae1cae6d3c8f999d317cb38aa63fd92fa58 | refs/heads/master | 2021-01-01T16:51:34.846783 | 2017-08-29T20:09:19 | 2017-08-29T20:09:19 | 97,931,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | package cakes.special;
import cakes.Cake;
import cakes.Cake.CakeKind;
import cakes.standard.Biscuit;
public class Advertising extends Cake implements Comparable<Advertising>{
private String name;
public Advertising(String name, String descr, int price, int pieces, String ownerName) {
super(name, descr, price, pieces, CakeKind.SPECIAL, "Advertising");
this.name = ownerName;
}
@Override
public int compareTo(Advertising o) {
return o.price - this.price;
}
}
| [
"borisb95@abv.bg"
] | borisb95@abv.bg |
5d4fb55aeba8ae930d3c60a0cab70408aa91529f | 043472b8681153ee6754b98449dd192703e0b8d2 | /future-auth/future-auth-cas-server/src/main/java/com/github/peterchenhdu/future/auth/cas/ticket/proxy/ProxyHandler.java | acba111adb87581dea8f2e21e70690bbaef29542 | [
"Apache-2.0"
] | permissive | peterchenhdu/future-framework | 4f59c9b56a28a4e1a05bcccddc460dbcb47e5bd1 | e41555f876ffe18cf9b8aa5fee867165afc363d6 | refs/heads/master | 2018-10-25T20:02:09.896630 | 2018-08-24T14:34:55 | 2018-08-24T14:34:55 | 62,036,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,099 | java | /*
* Copyright (c) 2011-2025 PiChen
*/
package com.github.peterchenhdu.future.auth.cas.ticket.proxy;
import com.github.peterchenhdu.future.auth.cas.authentication.principal.Credentials;
/**
* Abstraction for what needs to be done to handle proxies. Useful because the
* generic flow for all authentication is similar the actions taken for proxying
* are different. One can swap in/out implementations but keep the flow of
* events the same.
*
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.0
* <p>
* This is a published and supported CAS Server 3 API.
* </p>
*/
public interface ProxyHandler {
/**
* Method to actually process the proxy request.
*
* @param credentials The credentials of the item that will be proxying.
* @param proxyGrantingTicketId The ticketId for the ProxyGrantingTicket (in
* CAS 3 this is a TicketGrantingTicket)
* @return the String value that needs to be passed to the CAS client.
*/
String handle(Credentials credentials, String proxyGrantingTicketId);
}
| [
"cp_hdu@163.com"
] | cp_hdu@163.com |
cc50fa6666ba0aca7ba2eb381e2a7a471596debc | 6e07004a9f84f6c45911677e02e33ce503412bc8 | /client/android/prover-e/swypeidenterprise/src/main/java/io/prover/swypeid/enterprise/viewholder/model/Hints.java | 9f841452588566ce4453279e4ab7580cb4fbf01d | [] | no_license | ProverProject/prover-enterprise-public | d0b4d54bd53696946406b4013eaa799f1282303e | c30de48346f7a926d23f9e733706093d7ca7a307 | refs/heads/master | 2020-04-04T03:50:16.959537 | 2019-07-15T08:57:52 | 2019-07-15T08:57:52 | 155,727,930 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,640 | java | package io.prover.swypeid.enterprise.viewholder.model;
import io.prover.swypeid.enterprise.R;
public enum Hints {
Other, AllDone, MakeCircular, SwypeCodeFailed, NoMoney, VideoNotConfirmed, CalculatingVideoHash, VideoHashPosted, NetworkError,
ErrorPostingHash, FileHashAddedToBlockchain, LowContrast;
public Hint object() {
switch (this) {
case AllDone:
return new Hint.Builder(this)
.setMessage(R.string.swypeCodeOk, 3500)
.setImageId(R.drawable.ic_all_done, 2000)
.setMinifyDrawableId(R.drawable.ic_all_done_shrink)
.setStartDelay(1200)
.build();
case MakeCircular:
return new Hint.Builder(this)
.setMessage(R.string.makeProver, 5000)
.setImageId(R.drawable.make_circular_movement_animated, 2000)
.setMinifyDrawableId(R.drawable.make_circular_movement_minimize)
.setMinifiedDrawableId(R.drawable.make_circular_movement_minimized)
.setMinifiedDelay(15_000)
.setMinifiedRepeatCount(-1)
.build();
case VideoNotConfirmed:
return new Hint.Builder(this)
.setMessage(R.string.videoNotConfirmed, 4000)
.setImageId(R.drawable.ic_not_verified_anim, 3000)
.build();
case SwypeCodeFailed:
return new Hint.Builder(this)
.setMessage(R.string.swypeCodeFailedTryAgain, 3500)
.setImageId(R.drawable.make_circular_movement_animated, 2000)
.setMinifyDrawableId(R.drawable.make_circular_movement_minimize)
.setMinifiedDrawableId(R.drawable.make_circular_movement_minimized)
.setMinifiedDelay(1500)
.setMinifiedRepeatCount(-1)
.setStartDelay(1000)
.build();
case NoMoney:
return new Hint.Builder(this)
.setMessage(R.string.notEnoughMoney, 3500)
.setImageId(R.drawable.no_money_anim, 3000)
.build();
case VideoHashPosted:
return new Hint.Builder(this)
.setMessage(R.string.videoHashPosted, 3000)
.build();
case CalculatingVideoHash:
return new Hint.Builder(this)
.setMessage(R.string.calculatingVideoHash, 4000)
.build();
case ErrorPostingHash:
return new Hint.Builder(this)
.setMessage(R.string.videoHashPostFailed, 4000)
.build();
case FileHashAddedToBlockchain:
return new Hint.Builder(this)
.setMessage(R.string.videoHashAddedToBlockchain, 3000)
.build();
case LowContrast:
return new Hint.Builder(this)
.setMessage(R.string.lowContrastWarning, Integer.MAX_VALUE)
.setUseTopHintView(false)
.setWarning(true)
.setAnimationTime(100)
.setMinHintVisibleTime(0)
.build();
default:
throw new RuntimeException("Not implemented for: " + this);
}
}
}
| [
"babay@mail.ru"
] | babay@mail.ru |
4e387e558c4b043838eaa904c14bbc4ae6e7829f | e9dbdb017ec4ca2ad396286ecf379923683cc6bb | /SobelEdgeDetection/src/main/EdgeDetection.java | 1cb2c07a1c5cb9de31e1f238de5168a7b3be0408 | [] | no_license | eman3220/sobelEdgeDetection | 382a1dada3d341a7184f069a9dff2fdd23f43e62 | 5eafe880518e3bb825640746a8eb1f4a287c2b38 | refs/heads/master | 2021-01-23T12:35:06.168540 | 2014-08-03T22:28:38 | 2014-08-03T22:28:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,737 | java | package main;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
* Author: Emmanuel Godinez 300251168
*
* input: image file. Only use .png files. (note: tiff images don't seem to like
* java's BufferedImage class) output: image file with edge detection highlights
*
*/
public class EdgeDetection {
public static void main(String[] args) {
if (args.length != 1) {
JOptionPane.showMessageDialog(null, "One argument please");
return;
}
if (!args[0].endsWith(".png")) {
JOptionPane.showMessageDialog(null, "PNG file please");
return;
}
new EdgeDetection(args[0]);
}
public EdgeDetection(String imagepath) {
int[][] img = ImageHandler.readImage(imagepath);
ImageHandler.displayImage("original", img);
// create convolution masks
// Vertical Mask
double[][] rowMask = { { -1, -2, -1 }, { 0, 0, 0 }, { 1, 2, 1 } };
// Horizontal Mask
double[][] columnMask = { { -1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } };
// Apply convolution masks
int[][] rowOutput = ImageHandler.applyConvolutionMask(img, rowMask);
ImageHandler.brightenImage(rowOutput);
ImageHandler.displayImage("Row Output", rowOutput);
int[][] columnOutput = ImageHandler.applyConvolutionMask(img,
columnMask);
ImageHandler.brightenImage(columnOutput);
ImageHandler.displayImage("Column Output", columnOutput);
// combine images
int[][] finalOutput = new int[columnOutput.length][columnOutput[0].length];
int maxVal = Integer.MIN_VALUE;
int minVal = Integer.MAX_VALUE;
for (int y = 0; y < columnOutput[0].length; y++) {
for (int x = 0; x < columnOutput.length; x++) {
finalOutput[x][y] = (rowOutput[x][y]+columnOutput[x][y])/2;
// finalOutput[x][y] =
// (int)Math.tanh(rowOutput[x][y]/columnOutput[x][y]);
// finalOutput[x][y] = (int) Math.sqrt(Math
// .pow(rowOutput[x][y], 2)
// * Math.pow(columnOutput[x][y], 2));
if (finalOutput[x][y] < minVal) {
minVal = finalOutput[x][y];
}
if (finalOutput[x][y] > maxVal) {
maxVal = finalOutput[x][y];
}
}
}
// fix image
int range = maxVal - minVal;
for (int y = 0; y < finalOutput[0].length; y++) {
for (int x = 0; x < finalOutput.length; x++) {
double temporary1 = (double) Math.abs(finalOutput[x][y])
/ (double) range;
double temporary2 = temporary1 * 255;
finalOutput[x][y] = (int) temporary2;
}
}
ImageHandler.brightenImage(finalOutput);
try {
Thread.sleep(30);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ImageHandler.displayImage("Final", finalOutput);
}
}
| [
"manuel.godinez22@gmail.com"
] | manuel.godinez22@gmail.com |
859f1da776e37f1ed9b6fccfd520441e8d7c38cd | aced47fa8684cffe5a95880305de4dfda16712f3 | /CodeInTheAir/src/com/Android/CodeInTheAir/Events/CallbackManager.java | 972f5bf69e80d769c89734665f5d3007ec6d9e87 | [] | no_license | anirudhSK/cita | ff176b7e18ea94d719bebd7b3c6b8bbefc582b15 | 9c54d26aa63268b88526dbe1ab84773248925220 | refs/heads/master | 2020-05-22T14:10:03.805098 | 2012-06-26T01:49:58 | 2012-06-26T01:49:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,056 | java | package com.Android.CodeInTheAir.Events;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import android.util.Log;
import com.Android.CodeInTheAir.Callback.Callback_Accl_Data;
import com.Android.CodeInTheAir.Callback.Callback_Accl_Shake;
import com.Android.CodeInTheAir.Callback.Callback_Accl_Walking;
import com.Android.CodeInTheAir.Callback.Callback_Constants.ResultCode;
import com.Android.CodeInTheAir.Callback.Callback_Constants.StopCode;
import com.Android.CodeInTheAir.Callback.Callback_GSM_CellChange;
import com.Android.CodeInTheAir.Callback.Callback_GSM_RSSIChange;
import com.Android.CodeInTheAir.Callback.Callback_Generic;
import com.Android.CodeInTheAir.Callback.Callback_Listener_Interface;
import com.Android.CodeInTheAir.Callback.Callback_Sample_Accl;
import com.Android.CodeInTheAir.Callback.Callback_Sample_GSM;
public class CallbackManager
{
static ConcurrentHashMap<String, String> hEventStrCbId;
static ConcurrentHashMap<String, String> hCbIdEventStr;
static ConcurrentHashMap<String, Callback_Generic> hCbIdCallbackObj;
static ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>> hTaskEventActionTagSubId;
static ConcurrentHashMap<String, ConcurrentHashMap<String, CallbackInfo>> hCbIdSubIdCallbackInfo;
static ConcurrentHashMap<String, String> hSubIdCbId;
private static ReentrantReadWriteLock lock;
public static void init()
{
hEventStrCbId = new ConcurrentHashMap<String, String>();
hCbIdEventStr = new ConcurrentHashMap<String, String>();
hCbIdCallbackObj = new ConcurrentHashMap<String, Callback_Generic>();
hCbIdSubIdCallbackInfo = new ConcurrentHashMap<String, ConcurrentHashMap<String, CallbackInfo>>();
hTaskEventActionTagSubId = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>>();
hSubIdCbId = new ConcurrentHashMap<String, String>();
lock = new ReentrantReadWriteLock();
}
public static String addCallback(
String taskId, String source,
String event, String param, String action, String tag
)
{
String eventStr = event + param;
String subId = TaskUtils.getUniqueId();
CallbackInfo callbackInfo = new CallbackInfo(taskId, source, event, action, tag);
String cbId = null;
Callback_Generic callbackObj = null;
lock.writeLock().lock();
try
{
if (!hEventStrCbId.containsKey(eventStr))
{
cbId = TaskUtils.getUniqueId();
callbackObj = getCallbackObj(event);
if (callbackObj == null)
{
return null;
}
Log.v("CITA:Param-----------", param);
boolean initResult = callbackObj.initParams(param);
if (!initResult)
{
return null;
}
callbackObj.setCallbackId(cbId);
}
else
{
cbId = hEventStrCbId.get(eventStr);
}
if (!hTaskEventActionTagSubId.containsKey(taskId))
{
hTaskEventActionTagSubId.put(taskId, new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>());
}
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (!hEventActionTagSubId.containsKey(event))
{
hEventActionTagSubId.put(event, new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>());
}
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
if (!hActionTagSubId.containsKey(action))
{
hActionTagSubId.put(action, new ConcurrentHashMap<String, String>());
}
ConcurrentHashMap<String, String> hTagSubId = hActionTagSubId.get(action);
if (!hTagSubId.containsKey(tag))
{
hTagSubId.put(tag, subId);
}
else
{
subId = hTagSubId.get(tag);
return subId;
}
hSubIdCbId.put(subId, cbId);
if (!hEventStrCbId.containsKey(eventStr))
{
callbackObj.start();
hEventStrCbId.put(eventStr, cbId);
hCbIdEventStr.put(cbId, eventStr);
hCbIdCallbackObj.put(cbId, callbackObj);
hCbIdSubIdCallbackInfo.put(cbId, new ConcurrentHashMap<String, CallbackInfo>());
}
ConcurrentHashMap<String, CallbackInfo> hSubIdCallbackInfo = hCbIdSubIdCallbackInfo.get(cbId);
hSubIdCallbackInfo.put(subId, callbackInfo);
}
catch (Exception e)
{
}
finally
{
lock.writeLock().unlock();
}
return subId;
}
public static void removeCallback(
String taskId,
String event, String action, String tag,
boolean isLocked
)
{
if (!isLocked)
{
lock.writeLock().lock();
}
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (hEventActionTagSubId.containsKey(event))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
if (hActionTagSubId.containsKey(action))
{
ConcurrentHashMap<String, String> hTagSubId = hActionTagSubId.get(action);
if (hTagSubId.containsKey(tag))
{
String subId = hTagSubId.get(tag);
String cbId = hSubIdCbId.get(subId);
hCbIdSubIdCallbackInfo.get(cbId).remove(subId);
if (hCbIdSubIdCallbackInfo.get(cbId).keySet().size() == 0)
{
Callback_Generic callbackObj = hCbIdCallbackObj.get(cbId);
callbackObj.stop();
String eventStr = hCbIdEventStr.get(cbId);
hEventStrCbId.remove(eventStr);
hCbIdEventStr.remove(cbId);
hCbIdCallbackObj.remove(cbId);
hCbIdSubIdCallbackInfo.remove(cbId);
}
hTagSubId.remove(tag);
hSubIdCbId.remove(subId);
}
}
if (hActionTagSubId.get(action).keySet().size() == 0)
{
hActionTagSubId.remove(action);
}
}
if (hEventActionTagSubId.get(event).keySet().size() == 0)
{
hEventActionTagSubId.remove(event);
}
}
if (hTaskEventActionTagSubId.get(taskId).keySet().size() == 0)
{
hTaskEventActionTagSubId.remove(taskId);
}
if (!isLocked)
{
lock.writeLock().unlock();
}
}
public static void removeCallback(
String taskId,
String event, String action,
boolean isLocked
)
{
if (!isLocked)
{
lock.writeLock().lock();
}
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (hEventActionTagSubId.containsKey(event))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
if (hActionTagSubId.containsKey(action))
{
ConcurrentHashMap<String, String> hTagSubId = hActionTagSubId.get(action);
Iterator<String> i = hTagSubId.keySet().iterator();
while (i.hasNext())
{
String tag = i.next();
removeCallback(taskId, event, action, tag, true);
}
}
}
}
if (!isLocked)
{
lock.writeLock().unlock();
}
}
public static void removeCallback(
String taskId,
String event,
boolean isLocked
)
{
if (!isLocked)
{
lock.writeLock().lock();
}
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
if (hEventActionTagSubId.containsKey(event))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> hActionTagSubId = hEventActionTagSubId.get(event);
Iterator<String> i = hActionTagSubId.keySet().iterator();
while (i.hasNext())
{
String action = i.next();
Log.v("CITA:ConcurrentHashMap", taskId + " " + event + action);
removeCallback(taskId, event, action, true);
}
}
}
if (!isLocked)
{
lock.writeLock().unlock();
}
}
public static void removeCallback(String taskId)
{
lock.writeLock().lock();
if (hTaskEventActionTagSubId.containsKey(taskId))
{
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> hEventActionTagSubId = hTaskEventActionTagSubId.get(taskId);
Iterator<String> i = hEventActionTagSubId.keySet().iterator();
while (i.hasNext())
{
String event = i.next();
removeCallback(taskId, event, true);
}
}
lock.writeLock().unlock();
}
public static void removeCallbackId(String subId)
{
lock.writeLock().lock();
if (hSubIdCbId.containsKey(subId))
{
String cbId = hSubIdCbId.get(subId);
CallbackInfo callbackInfo = hCbIdSubIdCallbackInfo.get(cbId).get(subId);
removeCallback(callbackInfo.taskId, callbackInfo.event, callbackInfo.action, callbackInfo.tag, true);
}
lock.writeLock().unlock();
}
private static void removeCallbackCbId(String cbId)
{
lock.writeLock().lock();
if (hCbIdSubIdCallbackInfo.containsKey(cbId))
{
Iterator<String> i = hCbIdSubIdCallbackInfo.get(cbId).keySet().iterator();
while (i.hasNext())
{
removeCallbackId(i.next());
}
}
lock.writeLock().unlock();
}
public static Callback_Generic getCallbackObj(String event)
{
if (event.equalsIgnoreCase("accl.data"))
{
return new Callback_Accl_Data(new CallbackListener());
}
if (event.equalsIgnoreCase("accl.sample"))
{
return new Callback_Sample_Accl(new CallbackListener());
}
if (event.equalsIgnoreCase("gsm.cellChange"))
{
return new Callback_GSM_CellChange(new CallbackListener());
}
if (event.equalsIgnoreCase("gsm.rssiChange"))
{
return new Callback_GSM_RSSIChange(new CallbackListener());
}
if (event.equalsIgnoreCase("gsm.sample"))
{
return new Callback_Sample_GSM(new CallbackListener());
}
if (event.equalsIgnoreCase("shake"))
{
return new Callback_Accl_Shake(new CallbackListener());
}
if (event.equalsIgnoreCase("walking"))
{
return new Callback_Accl_Walking(new CallbackListener());
}
return null;
}
static class CallbackListener implements Callback_Listener_Interface
{
public void event(String cbId, ResultCode resultCode, String valueType, String value)
{
Log.v("CITA:event", "event");
List<CallbackInfo> lstCallbackInfo = new ArrayList<CallbackInfo>();
lock.readLock().lock();
if (hCbIdSubIdCallbackInfo.containsKey(cbId))
{
Iterator<String> i = hCbIdSubIdCallbackInfo.get(cbId).keySet().iterator();
while (i.hasNext())
{
String subId = i.next();
CallbackInfo callbackInfo = hCbIdSubIdCallbackInfo.get(cbId).get(subId);
lstCallbackInfo.add(callbackInfo);
}
}
lock.readLock().unlock();
Log.v("CITA:event", lstCallbackInfo.size() + "");
for (int i = 0; i < lstCallbackInfo.size(); i++)
{
CallbackInfo callbackInfo = lstCallbackInfo.get(i);
long time = System.currentTimeMillis();
Event_Callback_Data event = new Event_Callback_Data(time, callbackInfo.source,
callbackInfo.event, callbackInfo.action, callbackInfo.tag,
resultCode, valueType, value);
Task task = TaskManager.getTask(callbackInfo.taskId);
if (task != null)
{
task.getTaskContext().postEvent(event);
}
}
}
public void stop(String cbId, StopCode stopCode)
{
if (stopCode != StopCode.CALL)
{
removeCallbackCbId(cbId);
}
}
}
}
| [
"sk.anirudh@gmail.com"
] | sk.anirudh@gmail.com |
d3834293b22c77ad622ec3b5eea7347b457d59b9 | fd0c6d66e12565fcf02fb51596ccc8a79000874b | /src/test/java/com/jsoniter/output/TestString.java | c834a285ba0d506159aa2089f878e0bbd9396ff1 | [
"MIT"
] | permissive | whitekat98/javaFinal | bd06da6e637ffa7bc1e7c88ee61dece0af432ca5 | 38bf262f7af8f8f5fab4e3b9df2a6e728365f9d7 | refs/heads/master | 2022-11-20T07:53:40.130895 | 2020-02-04T14:59:07 | 2020-02-04T14:59:07 | 238,229,167 | 0 | 0 | MIT | 2022-11-16T10:36:26 | 2020-02-04T14:43:45 | HTML | UTF-8 | Java | false | false | 507 | java | package com.jsoniter.output;
import com.jsoniter.spi.Config;
import junit.framework.TestCase;
public class TestString extends TestCase {
public void test_unicode() {
String output = JsonStream.serialize(new Config.ReBuilder().escapeUnicode(false).build(), "中文");
assertEquals("\"中文\"", output);
}
public void test_escape_control_character() {
String output = JsonStream.serialize(new String(new byte[]{0}));
assertEquals("\"\\u0000\"", output);
}
}
| [
"59207956+whitekat98@users.noreply.github.com"
] | 59207956+whitekat98@users.noreply.github.com |
d908bad6a83881962c9f00d7aa722d2cc2de4775 | 1620a03731950562567a6427ae4e8c431a90442d | /JUnitTests/app/src/main/java/com/example/sandicarobert/junittests/MainActivity.java | bb2f1b9b2508b5836f17996e725835bbd1f5e062 | [] | no_license | sandicaRobert/UnitTests | d29523f010f238f6602ef252776c15a6459453ab | c8125aed2f6318df133f554dd5f9c66cdb2752a3 | refs/heads/master | 2021-01-01T04:04:31.052386 | 2016-05-06T17:58:54 | 2016-05-06T17:58:54 | 56,917,251 | 0 | 1 | null | 2016-05-06T17:58:54 | 2016-04-23T12:06:05 | Java | UTF-8 | Java | false | false | 349 | java | package com.example.sandicarobert.junittests;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"sandica_robert@yahoo.ro"
] | sandica_robert@yahoo.ro |
e1bec13110c7b0ae189368c4427e8be97afa79b9 | 437e47e6bd1803d491811f23de5be90be17bcec3 | /api/src/main/java/org/lpro/entity/Quantity.java | fa55c9a2bfed7f7c9bf47a1dabe2d3d323b07d89 | [] | no_license | MorganDbs/JavaAPI | 6a4172a7fcfac8dac2c0c581cdbc7286d537e855 | e3ebaa3188c069ceefed508183cf1e926eaeab26 | refs/heads/master | 2021-05-04T14:43:41.141937 | 2018-03-27T13:25:08 | 2018-03-27T13:25:08 | 120,208,965 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,012 | 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 org.lpro.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import static org.eclipse.persistence.sessions.remote.corba.sun.TransporterHelper.id;
/**
*
* @author morgan
*/
@Entity
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@NamedQuery(name="Quantity.findAll",query="SELECT q FROM Quantity q")
public class Quantity implements Serializable{
@Id
private String id;
private int quantity;
private String commande_id;
private String sandwich_id;
private String taille_id;
public Quantity(){}
public Quantity(int quantity, String commande_id, String sandwich_id, String taille_id){
this.quantity= quantity;
this.commande_id = commande_id;
this.sandwich_id = sandwich_id;
this.taille_id = taille_id;
}
public String getTaille_id() {
return taille_id;
}
public void setTaille_id(String taille_id) {
this.taille_id = taille_id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getCommande_id() {
return commande_id;
}
public void setCommande_id(String commande_id) {
this.commande_id = commande_id;
}
public String getSandwich_id() {
return sandwich_id;
}
public void setSandwich_id(String sandwich_id) {
this.sandwich_id = sandwich_id;
}
}
| [
"mailmorgandubois@gmail.com"
] | mailmorgandubois@gmail.com |
702dacb779370ae88c5a6b80f7d6ba7c6c0f4bf0 | dedb0b71ad97f51a3db72cc8fa741be4c9e7c3c3 | /AndroidApp/app/src/main/java/com/example/ecg/ble/Utilidades/LocationPermission.java | 4fb7c697644cd3c83feebc6932b5579cf501b69e | [] | no_license | fabianastudillo/vitalhealthuc | eee56e939320c249675394e6525c7d4604a017ad | 117177752ac8e5c535edf24a3423e90973a414a9 | refs/heads/main | 2023-03-05T02:05:47.006505 | 2021-02-12T01:44:18 | 2021-02-12T01:44:18 | 338,193,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,770 | java | package com.example.ecg.ble.Utilidades;
import android.app.Activity;
import android.content.pm.PackageManager;
import com.polidea.rxandroidble2.RxBleClient;
import androidx.core.app.ActivityCompat;
public class LocationPermission {
private LocationPermission(){
}
private static final int REQUEST_PERMISSION_BLE_SCAN = 9358;
public static void requestLocationPermission(final Activity activity, final RxBleClient client) {
ActivityCompat.requestPermissions(
activity,
/*
* the below would cause a ArrayIndexOutOfBoundsException on API < 23. Yet it should not be called then as runtime
* permissions are not needed and RxBleClient.isScanRuntimePermissionGranted() returns `true`
*/
new String[]{client.getRecommendedScanRuntimePermissions()[0]},
REQUEST_PERMISSION_BLE_SCAN
);
}
public static boolean isRequestLocationPermissionGranted(final int requestCode, final String[] permissions,
final int[] grantResults, RxBleClient client) {
if (requestCode != REQUEST_PERMISSION_BLE_SCAN) {
return false;
}
String[] recommendedScanRuntimePermissions = client.getRecommendedScanRuntimePermissions();
for (int i = 0; i < permissions.length; i++) {
for (String recommendedScanRuntimePermission : recommendedScanRuntimePermissions) {
if (permissions[i].equals(recommendedScanRuntimePermission)
&& grantResults[i] == PackageManager.PERMISSION_GRANTED) {
return true;
}
}
}
return false;
}
}
| [
"75911523+jlef2991@users.noreply.github.com"
] | 75911523+jlef2991@users.noreply.github.com |
e9c982ac2dcd70a0f24790425b1acd876d9b92e4 | 020c3bf8424bb2a04acfca0e3e5bcf02743970da | /yakhont/src/core/java/akha/yakhont/debug/BaseDialogFragment.java | 583fb5e1c6a3996320be6999094bdab671d266f7 | [
"Apache-2.0"
] | permissive | perlynk/Yakhont | 8594166c8dc9b02bcb97fa556216f32dc917fc64 | 04cb1eedab043777b0d43b902f5d924e82280aea | refs/heads/master | 2021-08-06T18:22:40.033100 | 2017-10-31T13:47:50 | 2017-10-31T13:47:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,340 | java | /*
* Copyright (C) 2015-2017 akha, a.k.a. Alexander Kharitonov
*
* 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 akha.yakhont.debug;
import akha.yakhont.Core.Utils;
import akha.yakhont.CoreLogger;
import akha.yakhont.CoreLogger.Level;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.Arrays;
/**
* The <code>BaseDialogFragment</code> class is intended for debug purposes. Overridden methods most of the time just adds lifecycle logging.
* Some additional debug Fragments can be found in the full version. {@yakhont.preprocessor.remove.in.generated}
*
* @author akha
*/
@SuppressWarnings("JavaDoc")
@TargetApi(Build.VERSION_CODES.HONEYCOMB) //YakhontPreprocessor:removeInFlavor
public class BaseDialogFragment extends DialogFragment { // don't modify this line: it's subject to change by the Yakhont preprocessor
/**
* Initialises a newly created {@code BaseDialogFragment} object.
*/
public BaseDialogFragment() {
}
/**
* Override to change the logging message.
*
* @return The logging message (for debugging)
*/
@SuppressWarnings("JavaDoc")
protected String getDebugMessage() {
return "dialog fragment " + BaseFragment.getFragmentName(this);
}
/**
* Override to change the logging level.
* <br>The default value is {@link Level#WARNING WARNING}.
*
* @return The logging priority level (for debugging)
*/
@SuppressWarnings("SameReturnValue")
protected Level getDebugLevel() {
return Level.WARNING;
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onActivityCreated(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onActivityCreated(savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
CoreLogger.log(getDebugMessage() + ", requestCode " + requestCode +
", resultCode " + resultCode + " " + Utils.getActivityResultString(resultCode));
super.onActivityResult(requestCode, resultCode, data);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
@SuppressWarnings("deprecation")
public void onAttach(Activity activity) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onAttach(activity);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onAttach(Context context) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onAttach(context);
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-protected void onBindDialogView(View view) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- super.onBindDialogView(view);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onCancel(DialogInterface dialog) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onCancel(dialog);
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-public void onClick(DialogInterface dialog, int which) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage() + ", which " + which, false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- super.onClick(dialog, which);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onConfigurationChanged(Configuration newConfig) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", newConfig " + newConfig, false);
super.onConfigurationChanged(newConfig);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onCreate(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onCreate(savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
return super.onCreateDialog(savedInstanceState);
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-protected View onCreateDialogView(Context context) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- return super.onCreateDialogView(context);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
return super.onCreateView(inflater, container, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDestroy() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDestroy();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDestroyView() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDestroyView();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDetach() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDetach();
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-public void onDialogClosed(boolean positiveResult) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage() + ", positiveResult " + positiveResult, false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment- super.onDialogClosed(positiveResult);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragment,ListPreferenceDialogFragmentCompat,MultiSelectListPreferenceDialogFragment-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onDismiss(DialogInterface dialog) {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onDismiss(dialog);
}
/**
* Please refer to the base method description.
*/
@CallSuper //YakhontPreprocessor:removeInFlavor
@Override //YakhontPreprocessor:removeInFlavor
@SuppressWarnings("deprecation") //YakhontPreprocessor:removeInFlavor
public void onInflate(AttributeSet attrs, Bundle savedInstanceState) { //YakhontPreprocessor:removeInFlavor
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", attrs " + attrs + //YakhontPreprocessor:removeInFlavor
", savedInstanceState " + savedInstanceState, false); //YakhontPreprocessor:removeInFlavor
super.onInflate(attrs, savedInstanceState); //YakhontPreprocessor:removeInFlavor
} //YakhontPreprocessor:removeInFlavor
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
@SuppressWarnings("deprecation")
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", attrs " + attrs + ", savedInstanceState " + savedInstanceState, false);
super.onInflate(activity, attrs, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", attrs " + attrs + ", savedInstanceState " + savedInstanceState, false);
super.onInflate(context, attrs, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onLowMemory() {
CoreLogger.log(Utils.getOnLowMemoryLevel(), getDebugMessage(), false);
super.onLowMemory();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onPause() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onPause();
}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment- super.onPrepareDialogBuilder(builder);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragment,ListPreferenceDialogFragment,MultiSelectListPreferenceDialogFragment-}
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-/** Please refer to the base method description. */
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-@CallSuper
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-@Override
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-protected void onPrepareDialogBuilder(android.support.v7.app.AlertDialog.Builder builder) {
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat- CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat- super.onPrepareDialogBuilder(builder);
//YakhontPreprocessor:addToGenerated-EditTextPreferenceDialogFragmentCompat,ListPreferenceDialogFragmentCompat-}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", requestCode " + requestCode +
", permissions " + Arrays.deepToString(permissions) +
", grantResults " + Arrays.toString(grantResults), false);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onResume() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onResume();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onSaveInstanceState(Bundle outState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", outState " + outState, false);
super.onSaveInstanceState(outState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onStart() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onStart();
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onStop() {
CoreLogger.log(getDebugLevel(), getDebugMessage(), false);
super.onStop();
}
/**
* Please refer to the base method description.
*/
@CallSuper //YakhontPreprocessor:removeInFlavor
@Override //YakhontPreprocessor:removeInFlavor
public void onTrimMemory(int level) { //YakhontPreprocessor:removeInFlavor
CoreLogger.log(Utils.getOnTrimMemoryLevel(level), getDebugMessage() + ", level " + Utils.getOnTrimMemoryLevelString(level), false); //YakhontPreprocessor:removeInFlavor
super.onTrimMemory(level); //YakhontPreprocessor:removeInFlavor
} //YakhontPreprocessor:removeInFlavor
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onViewCreated(view, savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void onViewStateRestored(Bundle savedInstanceState) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", savedInstanceState " + savedInstanceState, false);
super.onViewStateRestored(savedInstanceState);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void setRetainInstance(boolean retain) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", retain " + retain, true);
super.setRetainInstance(retain);
}
/**
* Please refer to the base method description.
*/
@CallSuper
@Override
public void setTargetFragment(Fragment fragment, int requestCode) {
CoreLogger.log(getDebugLevel(), getDebugMessage() + ", fragment " + fragment + ", requestCode " + requestCode, true);
super.setTargetFragment(fragment, requestCode);
}
}
| [
"akha.yakhont@gmail.com"
] | akha.yakhont@gmail.com |
0ff854619cb1c1a33ef80b24f8bdf2969b6270ed | e157a8811bcf44365782f37734d991ae01f4379c | /Chapter11/src/sec02/exam05_static_method/RemoteControl.java | 2a28af0da927917206582905390e7390696b1a60 | [] | no_license | KIMDev-sever/study-java- | c212bf4950d20bd9b71aa72eb969ddbeffff1b44 | 1bd2dc2ff086aa449df1799b57391a764449aabf | refs/heads/master | 2022-12-20T07:42:44.537338 | 2020-10-06T01:25:40 | 2020-10-06T01:25:40 | 276,258,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package sec02.exam05_static_method;
public interface RemoteControl {
// 상수 public static final
int MAX_VOLUME = 10;
int MIN_VOLUME = 0;
//추상 메서드 public abstract
void turnOn();
void turnOff();
void setVolume(int volume);
//디폴트 메서드 public
default void setMute(boolean mute) {
if(mute) {
System.out.println("무음처리");
}else {
System.out.println("무음해제");
}
}
//정적 메서드 public
static void changeBattery() {
System.out.println("건전지 교체");
}
}
| [
"lunatic7208@gmail.com"
] | lunatic7208@gmail.com |
873aa75a6cf7c6531510a5dd5b45838d0b2fb907 | c811b112852833555fc46b18a91142d48652ed21 | /CrfSvm/src/crfsvm/crf/een_phuong/semi_createUlbTrainingData.java | d565b0e5aa4a4b5ddfa6868d222df255e2567096 | [] | no_license | albaniliu/thesis-nlp | 1b8348d4718c092c75d01ec13d3d7183892996aa | 258b3f0fae531aa89576508b96eaecde9cd83f82 | refs/heads/master | 2021-01-19T18:08:05.337771 | 2011-11-01T17:08:46 | 2011-11-01T17:08:46 | 38,242,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,563 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* semi_createUlbTrainingData.java
*
* Created on Mar 8, 2011, 4:14:31 PM
*/
package crfsvm.crf.een_phuong;
import java.awt.Color;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.BadLocationException;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Document;
import javax.swing.text.Highlighter;
import javax.swing.text.Highlighter.HighlightPainter;
import javax.swing.text.JTextComponent;
import java.io.*; //my addition
import javax.swing.UIManager;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author Thien
*/
public class semi_createUlbTrainingData extends javax.swing.JFrame {
/** Creates new form semi_createUlbTrainingData */
public semi_createUlbTrainingData() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jTextField2 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setName("Form"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(semi_createUlbTrainingData.class);
jTextField1.setText(resourceMap.getString("inField.text")); // NOI18N
jTextField1.setName("inField"); // NOI18N
jButton1.setText(resourceMap.getString("inPutton.text")); // NOI18N
jButton1.setName("inPutton"); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
inButton_Action(evt);
}
});
jTextField2.setText(resourceMap.getString("outField.text")); // NOI18N
jTextField2.setName("outField"); // NOI18N
jButton2.setText(resourceMap.getString("outButton.text")); // NOI18N
jButton2.setName("outButton"); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
outButton_Action(evt);
}
});
jButton3.setText(resourceMap.getString("execute.text")); // NOI18N
jButton3.setName("execute"); // NOI18N
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jTextField2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(44, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(260, Short.MAX_VALUE)
.addComponent(jButton3)
.addGap(255, 255, 255))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2))
.addGap(27, 27, 27)
.addComponent(jButton3)
.addContainerGap(192, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void inButton_Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inButton_Action
// TODO add your handling code here:
JFileChooser choose = new JFileChooser();
ExampleFileFilter filter = new ExampleFileFilter("txt","txt File");
choose.addChoosableFileFilter(filter);
int f = choose.showOpenDialog(this);
if (f == JFileChooser.APPROVE_OPTION) {
File inFile = choose.getSelectedFile();
jTextField1.setText(inFile.getPath());
}
}//GEN-LAST:event_inButton_Action
private void outButton_Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outButton_Action
// TODO add your handling code here:
JFileChooser choose = new JFileChooser();
//ExampleFileFilter filter = new ExampleFileFilter();
//choose.addChoosableFileFilter(filter);
choose.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
//choose.setAcceptAllFileFilterUsed(false);
int f = choose.showOpenDialog(this);
if (f == JFileChooser.APPROVE_OPTION) {
File outFile = choose.getSelectedFile();
jTextField2.setText(outFile.getPath());
}
}//GEN-LAST:event_outButton_Action
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
BufferedWriter bw = null;
BufferedReader br = null;
try
{
String save = "", line = "",toAppend = "";
char c = 'a';
int len = 0;
br = new BufferedReader(new InputStreamReader(new FileInputStream(jTextField1.getText()), "UTF-8"));
while ((line = br.readLine()) != null)
{
line = line.trim();
toAppend = "";
c = 'a';
len = line.length();
if (line.length() != 0)
{
while (c != ' ')
{
c = line.charAt(len - 1);
len--;
}
save += line.substring(0, len).trim() + "\n";
}
else
save += "\n";
}
br.close();
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(jTextField2.getText()), "UTF-8"));
bw.write(save);
bw.flush();
bw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new semi_createUlbTrainingData().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables
}
| [
"anhdungle1986@gmail.com"
] | anhdungle1986@gmail.com |
ef67d8255ec2cd0c62351f12d338d5878fa38ddb | 8cb04a820f6eb5b91a7b400a0b7790b1dabf2f43 | /src/main/java/sunyu/demo/security/manager/config/tld/ClassPathTldsLoader.java | babee2f067eff4e693433b3c5cac44d6cc67d45d | [
"MIT"
] | permissive | Asura0923/security-manager | f9275cd206a73c9bbae38dc1ebf17c16387cfbd5 | 7540cdf778ae7c6a15249a1a0d204f0b1a29f57e | refs/heads/master | 2020-07-14T11:57:37.119134 | 2019-08-20T06:07:16 | 2019-08-20T06:07:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package sunyu.demo.security.manager.config.tld;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.List;
/**
* tlds classpath loader
*
* @author SunYu
*/
public class ClassPathTldsLoader {
@Autowired
private FreeMarkerConfigurer freeMarkerConfigurer;
@PostConstruct
public void loadClassPathTlds() {
freeMarkerConfigurer.getTaglibFactory().setClasspathTlds(classPathTldList);
}
final private List<String> classPathTldList;
public ClassPathTldsLoader(String... classPathTlds) {
super();
if (classPathTlds.length == 0) {
this.classPathTldList = Arrays.asList("/META-INF/security.tld");
} else {
this.classPathTldList = Arrays.asList(classPathTlds);
}
}
} | [
"89333367@qq.com"
] | 89333367@qq.com |
da626828eac6ece1a8c6a03a20a7fd0a06bb3614 | ddc0744590673e6ec51d2ca47b8f534f1d794f32 | /src/main/test/com/mobiquity/service/FileServiceImplTest.java | 4c61a0f77f4f4114a5783a3e7e7d4121bec57fec | [] | no_license | tomassirio/Backend-code-assignment---Mobiquity-2021 | 4e33eeaad47b10a69f4dc62ea2486d6733a84db0 | e7e2a2162301e2f3354a8e5323d64af8fcf173c4 | refs/heads/master | 2023-05-06T13:15:35.100413 | 2021-05-26T00:29:03 | 2021-05-26T00:29:03 | 370,475,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,708 | java | package com.mobiquity.service;
import com.mobiquity.exception.APIException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
@RunWith(PowerMockRunner.class)
@PrepareForTest(FileServiceImpl.class)
@PowerMockIgnore("jdk.internal.reflect.*")
public class FileServiceImplTest {
@Mock
FileServiceImpl fileService;
@Test
public void openFileHappyPath() throws APIException {
when(fileService.openFile(any())).thenReturn(new File("src/main/test/resources/test_file"));
assertEquals(fileService.openFile("Test"), new File("src/main/test/resources/test_file"));
}
@Test(expected = APIException.class)
public void openFileThrowsWrongPathException() throws APIException {
doThrow(APIException.class)
.when(fileService)
.openFile(anyString());
fileService.openFile(anyString());
}
@Test(expected = IOException.class)
public void openFileThrowsWrongFormatException() throws APIException {
doThrow(IOException.class)
.when(fileService)
.openFile(anyString());
fileService.openFile(anyString());
}
@Test
public void writeToFileHappyPath() {
File file = new File("src/main/test/resources/test_file");
try {
doNothing().when(fileService).writeToPath(file.getPath(), "Lorem Ipsum");
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
assertEquals(scanner.nextLine(), "Lorem Ipsum");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (APIException e) {
e.printStackTrace();
}
}
@Test(expected = APIException.class)
public void writeToFileWhichDoesntExist() throws APIException {
File file = new File("sample");
try {
doNothing().when(fileService).writeToPath(file.getPath(), "Lorem Ipsum");
Scanner scanner = new Scanner(file);
} catch (FileNotFoundException e) {
throw new APIException("File was not found", e);
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
| [
"tomassirio@gmail.com"
] | tomassirio@gmail.com |
026c1d669c58000a8ff5516f7438dc75d4173728 | 6ac9188162e53a028191962c4c7398cfd47ff250 | /topcoder/output/CombiningSlimes.java | 1e1b45740326a2da3a0383181b9ba63753619d27 | [] | no_license | mastersobg/contests | dbc83096be1b667c2546e6daba2f68472824d8eb | 822eda17a251e1ee978ff9265c2960c9d289986d | refs/heads/master | 2021-01-23T10:00:37.439738 | 2015-11-10T05:19:09 | 2015-11-10T05:19:09 | 2,923,871 | 0 | 1 | null | 2015-06-20T13:50:30 | 2011-12-06T10:09:40 | Java | UTF-8 | Java | false | false | 752 | java | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.List;
public class CombiningSlimes {
public int maxMascots(int[] a) {
List<Integer> list = ArraysUtil.asList(a);
int ret = 0;
while (list.size() > 1) {
int x = list.get(0);
int y = list.get(1);
list.remove((Integer) x);
list.remove((Integer) y);
list.add(x + y);
ret += x * y;
}
return ret;
}
}
class ArraysUtil {
public static List<Integer> asList(int[] arr) {
List<Integer> list = new ArrayList<Integer>(arr.length);
for (int a : arr)
list.add(a);
return list;
}
}
| [
"gorbachev.ivan@gmail.com"
] | gorbachev.ivan@gmail.com |
3b847c82efe75ff433bd180538dee2208df304b5 | 58505311d768cd861a95bb4f39f8af0840d18b1e | /WallJumper/src/com/me/walljumper/screens/GameScreen.java | 3834e3cc700c64e72a95aa164c99bebcb142d1d5 | [] | no_license | VjDroider/WallJumper | d3f0eaf96d4ac668d3fbb361cb91252f28a50c27 | 8c28d4a94cb5d37ce5f04b1a8d0ddbefd223e734 | refs/heads/master | 2021-01-18T07:34:51.414082 | 2014-06-15T02:43:03 | 2014-06-15T02:43:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,098 | java | package com.me.walljumper.screens;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.Interpolation;
import com.me.walljumper.DirectedGame;
import com.me.walljumper.ProfileLoader;
import com.me.walljumper.WallJumper;
import com.me.walljumper.screens.screentransitions.ScreenTransition;
import com.me.walljumper.screens.screentransitions.ScreenTransitionFade;
import com.me.walljumper.screens.screentransitions.ScreenTransitionSlice;
import com.me.walljumper.tools.AudioManager;
import com.me.walljumper.tools.InputManager;
public class GameScreen extends ScreenHelper {
public GameScreen(DirectedGame game) {
super(game);
}
@Override
public void render(float delta) {
World.controller.render(delta);
}
@Override
public void resize(int width, int height) {
World.controller.resize(width, height);
}
@Override
public void show() {
World.controller = new World(game, this);
World.controller.show();
WallJumper.currentScreen = this;
}
@Override
public void hide() {
World.controller.hide();
}
@Override
public void pause() {
super.pause();
World.controller.pause();
}
@Override
public void resume() {
World.controller.resume();
}
@Override
public void dispose() {
World.controller.dispose();
}
public boolean handleTouchInput(int screenX, int screenY, int pointer, int button){
return World.controller.handleTouchInput(screenX, screenY, pointer, button);
}
public boolean handleKeyInput(int keycode) {
return World.controller.handleKeyInput(keycode);
}
//CHANGE LEVEL METHODS
//Set spawnpoint to null, destroy and init world controller and go to next level
public void nextLevel(){
WallJumper.level++;
World.controller.setSpawnPoint(null, false);
World.controller.destroy();
World.controller.init();
}
public void changeScreen(ScreenHelper screen) {
((Game) Gdx.app.getApplicationListener()).setScreen(screen);
}
@Override
public InputProcessor getInputProcessor() {
return InputManager.inputManager;
}
}
| [
"joeyauby@gmail.com"
] | joeyauby@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.