blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
94bf474d776b021cbcc1ad14f77d70932105df8c | 12,206,297,094,724 | 66cb2fd0d8ca2223dace7d46f8699a5dce6740b3 | /core/src/com/tomblachut/holdem/GameManager.java | 661553200f670984000ff3b02bbe4750b325b8a2 | [] | no_license | tomblachut/Hold-em | https://github.com/tomblachut/Hold-em | 9b5d41fa57cde983abbc3d0f9a4d6c024c5870d2 | 179eda10c04e31179b636dc059f31ffad4541937 | refs/heads/master | 2019-07-09T10:53:57.271000 | 2016-08-06T23:10:42 | 2016-08-06T23:10:42 | 65,105,776 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tomblachut.holdem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumMap;
/**
* Created by Tomasz on 25.03.2016.
*/
public class GameManager {
public static final int BIG_BLIND = 200;
public static final int SMALL_BLIND = BIG_BLIND / 2;
Round round;
public ArrayList<Player> connectedPlayers = new ArrayList<>();
public ArrayList<Player> players;
public Player currentPlayer;
private int currentIndex = -1;
private int dealerIndex = -1;
Player dealer;
int madeBet;
public ArrayList<Card> communityCards = new ArrayList<>();
public ArrayList<Hand> winningHands = new ArrayList<>();
public Deck deck;
public int pot;
public int currentBet;
protected EnumMap<Round, Runnable> roundEnterRunnables = new EnumMap<>(Round.class);
private EnumMap<Round, Runnable> roundLeaveRunnables = new EnumMap<>(Round.class);
protected Runnable turnChangedRunnable;
public GameManager() {
// dealer = connectedPlayers.get(connectedPlayers.size() - 1);
}
public void stop() {
communityCards.clear();
winningHands.clear();
// connectedPlayers.forEach(player -> player.inGame = false);
}
public void nextPlay() {
// connectedPlayers.forEach(player -> player.inGame = true);
players = new ArrayList<>(connectedPlayers);
players.forEach(Player::nextPlay);
madeBet = 0;
pot = 0;
deck = new Deck();
communityCards.clear();
winningHands.clear();
currentBet = BIG_BLIND;
round = Round.PREFLOP;
for (int i = 0; i < 2; i++)
players.forEach(player -> player.addCard(deck.dealCard()));
currentIndex = dealerIndex;
nextPlayer(true);
dealerIndex = currentIndex;
// currentIndex = connectedPlayers.indexOf(dealer);
dealer = players.get(currentIndex);
nextPlayer(true);
players.get(currentIndex).changeBet(SMALL_BLIND);
nextPlayer(true);
players.get(currentIndex).changeBet(BIG_BLIND);
nextPlayer(true);
if (roundEnterRunnables.containsKey(round)) {
roundEnterRunnables.get(round).run();
}
if (turnChangedRunnable != null) {
turnChangedRunnable.run();
}
}
public boolean fold(Player player) {
if (player != currentPlayer) return false;
// TODO: 09.05.2016 decide if this condition is worth checking
if (!player.hasFolded) {
player.hasFolded = true;
players.remove(player);
currentIndex--;
nextTurn();
return true;
}
return false;
}
public boolean checkOrCall(Player player) {
if (player != currentPlayer) return false;
// TODO: 25.03.2016 handle all in
int diff = currentBet - player.getBet();
if (player.getBalance() >= diff) {
if (diff > 0) {
player.setBalance(player.getBalance() - diff);
player.setBet(player.getBet() + diff);
}
madeBet++;
nextTurn();
return true;
}
return false;
}
public boolean raise(Player player, int amount) {
if (player != currentPlayer) return false;
// TODO: 09.05.2016 Check if minimal amount was passed
// TODO: 25.03.2016 handle all in
int diff = currentBet - player.getBet() + amount;
if (diff > 0 && player.getBalance() >= diff) {
player.setBalance(player.getBalance() - diff);
player.setBet(player.getBet() + diff);
currentBet += amount;
madeBet = 1;
nextTurn();
return true;
}
return false;
}
public boolean leave(Player player) {
player.hasFolded = true;
players.remove(player);
if (player == currentPlayer) {
currentIndex--;
nextTurn();
}
return true;
}
public void showdown() {
ArrayList<Hand> hands = new ArrayList<>();
players.forEach(player -> {
player.hand = new HandResolver(player.getCards(), communityCards).resolve();
player.hand.player = player;
hands.add(player.hand);
});
Hand max = Collections.max(hands);
winningHands.add(max);
hands.forEach(hand -> {
if (hand == max) return;
if (hand.compareTo(max) == 0) {
winningHands.add(hand);
}
});
winningHands.forEach(hand -> hand.player.changeBalance(pot / winningHands.size()));
pot = 0;
System.out.println(max.toString());
}
public void noshowdown() {
players.get(0).changeBalance(pot);
pot = 0;
}
private void nextRound(boolean end) {
currentIndex = 0; // start left from dealer
currentPlayer = players.get(currentIndex);
madeBet = 0;
currentBet = 0;
connectedPlayers.forEach(player -> {
pot += player.getBet();
player.resetBet();
});
if (end) {
round = Round.NOSHOWDOWN;
noshowdown();
} else {
switch (round) {
case PREFLOP:
round = Round.FLOP;
communityCards.addAll(Arrays.asList(deck.dealCards(3, true)));
break;
case FLOP:
round = Round.TURN;
communityCards.add(deck.dealCard(true));
break;
case TURN:
round = Round.RIVER;
communityCards.add(deck.dealCard(true));
break;
case RIVER:
round = Round.SHOWDOWN;
showdown();
break;
}
}
if (roundEnterRunnables.containsKey(round)) {
roundEnterRunnables.get(round).run();
}
if (turnChangedRunnable != null && round != Round.SHOWDOWN && round != Round.NOSHOWDOWN) {
turnChangedRunnable.run();
}
}
protected void nextPlayer(boolean suppressUpdate) {
int index = players.indexOf(currentPlayer) + 1;
index %= players.size();
currentPlayer = players.get(index);
currentIndex++;
if (currentIndex >= players.size()) currentIndex = 0;
currentPlayer = players.get(currentIndex);
if (!suppressUpdate && turnChangedRunnable != null) {
turnChangedRunnable.run();
}
}
public void nextTurn() {
if (players.size() == 1) {
nextRound(true);
} else if (players.size() == madeBet) {
nextRound(false);
} else {
nextPlayer(false);
}
}
public boolean setRoundEnterRunnable(Round round, Runnable runnable) {
if (runnable != null) {
roundEnterRunnables.put(round, runnable);
return true;
}
return false;
}
public boolean setTurnChangedRunnable(Runnable runnable) {
if (runnable != null) {
turnChangedRunnable = runnable;
return true;
}
return false;
}
}
| UTF-8 | Java | 7,356 | java | GameManager.java | Java | [
{
"context": "ions;\nimport java.util.EnumMap;\n\n/**\n * Created by Tomasz on 25.03.2016.\n */\npublic class GameManager {\n ",
"end": 166,
"score": 0.9976513385772705,
"start": 160,
"tag": "NAME",
"value": "Tomasz"
}
] | null | [] | package com.tomblachut.holdem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumMap;
/**
* Created by Tomasz on 25.03.2016.
*/
public class GameManager {
public static final int BIG_BLIND = 200;
public static final int SMALL_BLIND = BIG_BLIND / 2;
Round round;
public ArrayList<Player> connectedPlayers = new ArrayList<>();
public ArrayList<Player> players;
public Player currentPlayer;
private int currentIndex = -1;
private int dealerIndex = -1;
Player dealer;
int madeBet;
public ArrayList<Card> communityCards = new ArrayList<>();
public ArrayList<Hand> winningHands = new ArrayList<>();
public Deck deck;
public int pot;
public int currentBet;
protected EnumMap<Round, Runnable> roundEnterRunnables = new EnumMap<>(Round.class);
private EnumMap<Round, Runnable> roundLeaveRunnables = new EnumMap<>(Round.class);
protected Runnable turnChangedRunnable;
public GameManager() {
// dealer = connectedPlayers.get(connectedPlayers.size() - 1);
}
public void stop() {
communityCards.clear();
winningHands.clear();
// connectedPlayers.forEach(player -> player.inGame = false);
}
public void nextPlay() {
// connectedPlayers.forEach(player -> player.inGame = true);
players = new ArrayList<>(connectedPlayers);
players.forEach(Player::nextPlay);
madeBet = 0;
pot = 0;
deck = new Deck();
communityCards.clear();
winningHands.clear();
currentBet = BIG_BLIND;
round = Round.PREFLOP;
for (int i = 0; i < 2; i++)
players.forEach(player -> player.addCard(deck.dealCard()));
currentIndex = dealerIndex;
nextPlayer(true);
dealerIndex = currentIndex;
// currentIndex = connectedPlayers.indexOf(dealer);
dealer = players.get(currentIndex);
nextPlayer(true);
players.get(currentIndex).changeBet(SMALL_BLIND);
nextPlayer(true);
players.get(currentIndex).changeBet(BIG_BLIND);
nextPlayer(true);
if (roundEnterRunnables.containsKey(round)) {
roundEnterRunnables.get(round).run();
}
if (turnChangedRunnable != null) {
turnChangedRunnable.run();
}
}
public boolean fold(Player player) {
if (player != currentPlayer) return false;
// TODO: 09.05.2016 decide if this condition is worth checking
if (!player.hasFolded) {
player.hasFolded = true;
players.remove(player);
currentIndex--;
nextTurn();
return true;
}
return false;
}
public boolean checkOrCall(Player player) {
if (player != currentPlayer) return false;
// TODO: 25.03.2016 handle all in
int diff = currentBet - player.getBet();
if (player.getBalance() >= diff) {
if (diff > 0) {
player.setBalance(player.getBalance() - diff);
player.setBet(player.getBet() + diff);
}
madeBet++;
nextTurn();
return true;
}
return false;
}
public boolean raise(Player player, int amount) {
if (player != currentPlayer) return false;
// TODO: 09.05.2016 Check if minimal amount was passed
// TODO: 25.03.2016 handle all in
int diff = currentBet - player.getBet() + amount;
if (diff > 0 && player.getBalance() >= diff) {
player.setBalance(player.getBalance() - diff);
player.setBet(player.getBet() + diff);
currentBet += amount;
madeBet = 1;
nextTurn();
return true;
}
return false;
}
public boolean leave(Player player) {
player.hasFolded = true;
players.remove(player);
if (player == currentPlayer) {
currentIndex--;
nextTurn();
}
return true;
}
public void showdown() {
ArrayList<Hand> hands = new ArrayList<>();
players.forEach(player -> {
player.hand = new HandResolver(player.getCards(), communityCards).resolve();
player.hand.player = player;
hands.add(player.hand);
});
Hand max = Collections.max(hands);
winningHands.add(max);
hands.forEach(hand -> {
if (hand == max) return;
if (hand.compareTo(max) == 0) {
winningHands.add(hand);
}
});
winningHands.forEach(hand -> hand.player.changeBalance(pot / winningHands.size()));
pot = 0;
System.out.println(max.toString());
}
public void noshowdown() {
players.get(0).changeBalance(pot);
pot = 0;
}
private void nextRound(boolean end) {
currentIndex = 0; // start left from dealer
currentPlayer = players.get(currentIndex);
madeBet = 0;
currentBet = 0;
connectedPlayers.forEach(player -> {
pot += player.getBet();
player.resetBet();
});
if (end) {
round = Round.NOSHOWDOWN;
noshowdown();
} else {
switch (round) {
case PREFLOP:
round = Round.FLOP;
communityCards.addAll(Arrays.asList(deck.dealCards(3, true)));
break;
case FLOP:
round = Round.TURN;
communityCards.add(deck.dealCard(true));
break;
case TURN:
round = Round.RIVER;
communityCards.add(deck.dealCard(true));
break;
case RIVER:
round = Round.SHOWDOWN;
showdown();
break;
}
}
if (roundEnterRunnables.containsKey(round)) {
roundEnterRunnables.get(round).run();
}
if (turnChangedRunnable != null && round != Round.SHOWDOWN && round != Round.NOSHOWDOWN) {
turnChangedRunnable.run();
}
}
protected void nextPlayer(boolean suppressUpdate) {
int index = players.indexOf(currentPlayer) + 1;
index %= players.size();
currentPlayer = players.get(index);
currentIndex++;
if (currentIndex >= players.size()) currentIndex = 0;
currentPlayer = players.get(currentIndex);
if (!suppressUpdate && turnChangedRunnable != null) {
turnChangedRunnable.run();
}
}
public void nextTurn() {
if (players.size() == 1) {
nextRound(true);
} else if (players.size() == madeBet) {
nextRound(false);
} else {
nextPlayer(false);
}
}
public boolean setRoundEnterRunnable(Round round, Runnable runnable) {
if (runnable != null) {
roundEnterRunnables.put(round, runnable);
return true;
}
return false;
}
public boolean setTurnChangedRunnable(Runnable runnable) {
if (runnable != null) {
turnChangedRunnable = runnable;
return true;
}
return false;
}
}
| 7,356 | 0.552066 | 0.54323 | 255 | 27.847059 | 21.478401 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.556863 | false | false | 9 |
06bb23ab54a7d6aec4b7fc8f452a4c84e54a7272 | 16,793,322,174,510 | a4741860116166d113ae3d21f5a791c55367f075 | /CharTwo/src/CharTwo/Client.java | 09dafd252793ee8cc6c3e21caa758ac62c0a7db0 | [] | no_license | HANJIYEONN/ChattingTwo | https://github.com/HANJIYEONN/ChattingTwo | 3f8479752cb34bcff76979b5f06582908ef06db7 | d06b42e565f2f370b94f4f98c1a29313d1a3e4fd | refs/heads/master | 2020-06-17T12:58:48.763000 | 2019-07-09T04:19:52 | 2019-07-09T04:19:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package CharTwo;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
public class Client {
public Client() {
try {
Socket s = new Socket("192.168.0.100", 7109);
InputStream is = System.in;
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
OutputStream os = s.getOutputStream();
PrintWriter out = new PrintWriter(os, true);
String data = br.readLine();
while (data != null) {
out.println(data);
data = br.readLine();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 721 | java | Client.java | Java | [
{
"context": " Client() {\r\n\t\ttry {\r\n\r\n\t\t\tSocket s = new Socket(\"192.168.0.100\", 7109);\r\n\r\n\t\t\tInputStream is = System.in;\r\n\t\t\tIn",
"end": 295,
"score": 0.9997805953025818,
"start": 282,
"tag": "IP_ADDRESS",
"value": "192.168.0.100"
}
] | null | [] | package CharTwo;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
public class Client {
public Client() {
try {
Socket s = new Socket("192.168.0.100", 7109);
InputStream is = System.in;
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
OutputStream os = s.getOutputStream();
PrintWriter out = new PrintWriter(os, true);
String data = br.readLine();
while (data != null) {
out.println(data);
data = br.readLine();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| 721 | 0.656033 | 0.636616 | 33 | 19.848484 | 16.16416 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.969697 | false | false | 9 |
28b51d6506a0867a74d56ace16952a77c6bfcc29 | 14,697,378,143,813 | 787a93221563e8e845d21b0a04bb66ce8baf6801 | /app/src/main/java/com/example/taehun/totalmanager/Sub2Fragment.java | 89b378eea6e5646f0a8e10401639319e9ff9d621 | [] | no_license | xognsxo1491/Companion-Animal-Loss-Prevention-App-Beacon | https://github.com/xognsxo1491/Companion-Animal-Loss-Prevention-App-Beacon | 2d7b56efe33d56292eec910426f7b2ab4429308a | b5a07344546bdaed149c1d299cfab56ce62ee6f0 | refs/heads/master | 2020-03-31T18:16:54.266000 | 2019-12-26T07:15:49 | 2019-12-26T07:15:49 | 152,452,379 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.taehun.totalmanager;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.Volley;
import com.example.taehun.totalmanager.Request.MypageRequest;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
public class Sub2Fragment extends Fragment {
ArrayList<BeaconListItem> myBeacons = new ArrayList<>();
Button btn_logout, btn_edit, btn_beaocn, btn_missing;
TextView text_page_id, text_page_email;
SharedPreferences preferences;
JSONArray jsonArray;
AlertDialog dialog;
String myJSON;
private static final String TAG_UUID = "UUID";
private static final String TAG_MAJOR = "Major";
private static final String TAG_Minor = "Minor";
private static final String TAG_RESULT = "result";
public Sub2Fragment() { }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_sub2, container, false);
final Activity activity = getActivity();
btn_logout = (Button) view.findViewById(R.id.btn_logout);
btn_edit = (Button) view.findViewById(R.id.btn_edit);
btn_beaocn = (Button)view.findViewById(R.id.btn_beacon);
btn_missing =(Button)view.findViewById(R.id.btn_missing);
preferences = activity.getSharedPreferences("freeLogin", Context.MODE_PRIVATE); // freelogin키 안에 데이터 불러오기
getBeaconsFromDataBase("http://xognsxo1491.cafe24.com/Beacon_connect.php");
final String userid = preferences.getString("Id", null);
btn_logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { //로그아웃 설정
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
dialog = builder.setMessage("로그아웃 하시겠습니까?")
.setPositiveButton("취소",null)
.setNegativeButton("확인", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(activity, Sign_InActivity.class);
SharedPreferences preferences = activity.getSharedPreferences("freeLogin", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.remove("Id");
editor.commit();
startActivity(intent);
}
})
.create();
dialog.show();
}
});
btn_edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Sign_editActivity.class);
intent.putExtra("id", userid);
startActivity(intent);
}
});
btn_beaocn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(myBeacons.size()>0){
Intent notificationIntent = new Intent(getContext(), Popup3Activity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(notificationIntent);
}else {
Toast.makeText(activity, "등록된 비콘이 없습니다.", Toast.LENGTH_SHORT).show();
}
}
});
btn_missing.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(myBeacons.size()>0){
Intent notificationIntent = new Intent(getContext(), Popup2Activity.class);
notificationIntent.putExtra("UUID", myBeacons.get(0).getUUID());
notificationIntent.putExtra("Major", myBeacons.get(0).getMajor());
notificationIntent.putExtra("Minor", myBeacons.get(0).getMinor());
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(notificationIntent);
}else{
Toast.makeText(activity, "등록된 비콘이 없습니다.", Toast.LENGTH_SHORT).show();
}
}
});
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
boolean success = jsonObject.getBoolean("success");
text_page_id = view.findViewById(R.id.text_page_id);
text_page_email = view.findViewById(R.id.text_page_email);
if (success) {
String user_id = jsonObject.getString("Id");
text_page_id.setText(user_id);
String user_email = jsonObject.getString("Email");
text_page_email.setText(user_email);
} else
Toast.makeText(activity, "불러오기가 실패하였습니다.", Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
};
MypageRequest mypageRequest = new MypageRequest(userid, responseListener); // 입력값 넣기 위해서
RequestQueue queue = Volley.newRequestQueue(activity);
queue.add(mypageRequest);
return view;
}
public void getBeaconsFromDataBase(String url) { // php 파싱관련
class GetDataJSON extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String uri = params[0];
BufferedReader bufferedReader = null;
String postParameter = "Id="+ preferences.getString("Id","");
Log.d("Number", postParameter);
try {
URL url = new URL(uri);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.connect();
OutputStream outputStream = connection.getOutputStream();
outputStream.write(postParameter.getBytes("UTF-8"));
outputStream.flush();
outputStream.close();
int responseStatusCode = connection.getResponseCode();
InputStream inputStream;
if(responseStatusCode == HttpURLConnection.HTTP_OK) {
inputStream = connection.getInputStream();
}
else{
inputStream = connection.getErrorStream();
}
StringBuilder builder = new StringBuilder();
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String json;
while ((json = bufferedReader.readLine()) != null) {
builder.append(json + "\n");
}
return builder.toString().trim();
} catch (Exception e) {
return null;
}
}
@Override
protected void onPostExecute(String s) { // url 추출
myJSON = s;
addBeacons(myBeacons);
}
}
GetDataJSON getDataJSON = new GetDataJSON();
getDataJSON.execute(url);
}
protected void addBeacons(ArrayList<BeaconListItem> beacons) { // php 파싱 설정
try {
JSONObject jsonObject = new JSONObject(myJSON);
jsonArray = jsonObject.getJSONArray(TAG_RESULT);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String UUID = object.getString(TAG_UUID);
String major = object.getString(TAG_MAJOR);
String minor = object.getString(TAG_Minor);
System.out.println("비콘 " + UUID + " " + major + " " +minor);
beacons.add(new BeaconListItem(UUID, major, minor));
}
} catch (JSONException e) { // 오류 캐치
e.printStackTrace();
}
}
} | UTF-8 | Java | 9,878 | java | Sub2Fragment.java | Java | [] | null | [] | package com.example.taehun.totalmanager;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.Volley;
import com.example.taehun.totalmanager.Request.MypageRequest;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
public class Sub2Fragment extends Fragment {
ArrayList<BeaconListItem> myBeacons = new ArrayList<>();
Button btn_logout, btn_edit, btn_beaocn, btn_missing;
TextView text_page_id, text_page_email;
SharedPreferences preferences;
JSONArray jsonArray;
AlertDialog dialog;
String myJSON;
private static final String TAG_UUID = "UUID";
private static final String TAG_MAJOR = "Major";
private static final String TAG_Minor = "Minor";
private static final String TAG_RESULT = "result";
public Sub2Fragment() { }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_sub2, container, false);
final Activity activity = getActivity();
btn_logout = (Button) view.findViewById(R.id.btn_logout);
btn_edit = (Button) view.findViewById(R.id.btn_edit);
btn_beaocn = (Button)view.findViewById(R.id.btn_beacon);
btn_missing =(Button)view.findViewById(R.id.btn_missing);
preferences = activity.getSharedPreferences("freeLogin", Context.MODE_PRIVATE); // freelogin키 안에 데이터 불러오기
getBeaconsFromDataBase("http://xognsxo1491.cafe24.com/Beacon_connect.php");
final String userid = preferences.getString("Id", null);
btn_logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { //로그아웃 설정
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
dialog = builder.setMessage("로그아웃 하시겠습니까?")
.setPositiveButton("취소",null)
.setNegativeButton("확인", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(activity, Sign_InActivity.class);
SharedPreferences preferences = activity.getSharedPreferences("freeLogin", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.remove("Id");
editor.commit();
startActivity(intent);
}
})
.create();
dialog.show();
}
});
btn_edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Sign_editActivity.class);
intent.putExtra("id", userid);
startActivity(intent);
}
});
btn_beaocn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(myBeacons.size()>0){
Intent notificationIntent = new Intent(getContext(), Popup3Activity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(notificationIntent);
}else {
Toast.makeText(activity, "등록된 비콘이 없습니다.", Toast.LENGTH_SHORT).show();
}
}
});
btn_missing.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(myBeacons.size()>0){
Intent notificationIntent = new Intent(getContext(), Popup2Activity.class);
notificationIntent.putExtra("UUID", myBeacons.get(0).getUUID());
notificationIntent.putExtra("Major", myBeacons.get(0).getMajor());
notificationIntent.putExtra("Minor", myBeacons.get(0).getMinor());
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(notificationIntent);
}else{
Toast.makeText(activity, "등록된 비콘이 없습니다.", Toast.LENGTH_SHORT).show();
}
}
});
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
boolean success = jsonObject.getBoolean("success");
text_page_id = view.findViewById(R.id.text_page_id);
text_page_email = view.findViewById(R.id.text_page_email);
if (success) {
String user_id = jsonObject.getString("Id");
text_page_id.setText(user_id);
String user_email = jsonObject.getString("Email");
text_page_email.setText(user_email);
} else
Toast.makeText(activity, "불러오기가 실패하였습니다.", Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
};
MypageRequest mypageRequest = new MypageRequest(userid, responseListener); // 입력값 넣기 위해서
RequestQueue queue = Volley.newRequestQueue(activity);
queue.add(mypageRequest);
return view;
}
public void getBeaconsFromDataBase(String url) { // php 파싱관련
class GetDataJSON extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String uri = params[0];
BufferedReader bufferedReader = null;
String postParameter = "Id="+ preferences.getString("Id","");
Log.d("Number", postParameter);
try {
URL url = new URL(uri);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.connect();
OutputStream outputStream = connection.getOutputStream();
outputStream.write(postParameter.getBytes("UTF-8"));
outputStream.flush();
outputStream.close();
int responseStatusCode = connection.getResponseCode();
InputStream inputStream;
if(responseStatusCode == HttpURLConnection.HTTP_OK) {
inputStream = connection.getInputStream();
}
else{
inputStream = connection.getErrorStream();
}
StringBuilder builder = new StringBuilder();
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String json;
while ((json = bufferedReader.readLine()) != null) {
builder.append(json + "\n");
}
return builder.toString().trim();
} catch (Exception e) {
return null;
}
}
@Override
protected void onPostExecute(String s) { // url 추출
myJSON = s;
addBeacons(myBeacons);
}
}
GetDataJSON getDataJSON = new GetDataJSON();
getDataJSON.execute(url);
}
protected void addBeacons(ArrayList<BeaconListItem> beacons) { // php 파싱 설정
try {
JSONObject jsonObject = new JSONObject(myJSON);
jsonArray = jsonObject.getJSONArray(TAG_RESULT);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String UUID = object.getString(TAG_UUID);
String major = object.getString(TAG_MAJOR);
String minor = object.getString(TAG_Minor);
System.out.println("비콘 " + UUID + " " + major + " " +minor);
beacons.add(new BeaconListItem(UUID, major, minor));
}
} catch (JSONException e) { // 오류 캐치
e.printStackTrace();
}
}
} | 9,878 | 0.567484 | 0.564599 | 253 | 37.367588 | 29.39299 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.675889 | false | false | 9 |
87cb9345483f171c29e04fa3e82a619d1eed6df9 | 11,665,131,183,188 | 3962d20dd7a145adff5bde0d007126d75fd58ae3 | /src/main/java/kkdev/kksystem/plugin/tts/engines/ITTSEngine.java | dfc26b85b283e9b1f826775cc4d0f5625675cd18 | [] | no_license | Garikk/kkcar-plugin-tts | https://github.com/Garikk/kkcar-plugin-tts | 646e583df343503e9e8d6f6884e7f927e58f59d5 | c436406364d4054092ec1c7fdde7279b1d1c7367 | refs/heads/master | 2021-05-23T05:59:14.563000 | 2019-10-04T15:45:00 | 2019-10-04T15:45:00 | 54,640,360 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 kkdev.kksystem.plugin.tts.engines;
/**
*
* @author sayma_000
*/
public interface ITTSEngine {
/**
*
* @param Text
*/
void SayText(String Text);
}
| UTF-8 | Java | 386 | java | ITTSEngine.java | Java | [
{
"context": "ksystem.plugin.tts.engines;\r\n\r\n/**\r\n *\r\n * @author sayma_000\r\n */\r\npublic interface ITTSEngine {\r\n\r\n /**\r\n ",
"end": 265,
"score": 0.9987751841545105,
"start": 256,
"tag": "USERNAME",
"value": "sayma_000"
}
] | null | [] | /*
* 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 kkdev.kksystem.plugin.tts.engines;
/**
*
* @author sayma_000
*/
public interface ITTSEngine {
/**
*
* @param Text
*/
void SayText(String Text);
}
| 386 | 0.626943 | 0.619171 | 19 | 18.31579 | 21.807899 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 9 |
f2d58ef1ac71a3a5640c0143224e96bf6ef0f712 | 12,094,627,914,662 | 0ded5a08e2733216adc80cce51f3a18b35260955 | /app/src/main/java/com/telecom/ast/sitesurvey/database/AtmDatabase.java | 96a9ed6ab2cd73721eed116765e747d14257d97a | [] | no_license | neerajk0702/astsitesurvey | https://github.com/neerajk0702/astsitesurvey | f32b73578ecced6bbefea5b398b50593fc1b41a5 | 73cac2c0947292d6e085ba9dd3a85ba58146e2b3 | refs/heads/master | 2020-03-23T05:16:35.524000 | 2019-07-12T09:01:09 | 2019-07-12T09:01:09 | 141,134,521 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.telecom.ast.sitesurvey.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.telecom.ast.sitesurvey.ASTGson;
import com.telecom.ast.sitesurvey.constants.Constant;
import com.telecom.ast.sitesurvey.constants.Contants;
import com.telecom.ast.sitesurvey.model.OfflineDataModel;
import com.telecom.ast.sitesurvey.model.BasicDataModel;
import com.telecom.ast.sitesurvey.model.BtsInfoData;
import com.telecom.ast.sitesurvey.model.CircleMasterDataModel;
import com.telecom.ast.sitesurvey.model.CompanyDetail;
import com.telecom.ast.sitesurvey.model.ContentData;
import com.telecom.ast.sitesurvey.model.Data;
import com.telecom.ast.sitesurvey.model.DistrictMasterDataModel;
import com.telecom.ast.sitesurvey.model.EbMeterDataModel;
import com.telecom.ast.sitesurvey.model.EquipCapacityDataModel;
import com.telecom.ast.sitesurvey.model.EquipDescriptionDataModel;
import com.telecom.ast.sitesurvey.model.EquipMakeDataModel;
import com.telecom.ast.sitesurvey.model.EquipTypeDataModel;
import com.telecom.ast.sitesurvey.model.EquipmentMasterDataModel;
import com.telecom.ast.sitesurvey.model.OrderData;
import com.telecom.ast.sitesurvey.model.SSAmasterDataModel;
import com.telecom.ast.sitesurvey.model.SelectedEquipmentDataModel;
import com.telecom.ast.sitesurvey.model.SiteMasterDataModel;
import com.telecom.ast.sitesurvey.model.SiteOnBatteryBankDataModel;
import com.telecom.ast.sitesurvey.model.SiteOnDG;
import com.telecom.ast.sitesurvey.model.SiteOnEbDataModel;
import java.util.ArrayList;
import java.util.List;
public class AtmDatabase extends SQLiteOpenHelper {
//http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "AST_Survey.db";
//private static final String DATABASE_NAME = Contants.outputDirectoryLocation + "AST_Survey.db";
// table name
private static final String TABLE_CIRCLE = "circle";
private static final String TABLE_DISTRICT = "district";
private static final String TABLE_SSA = "SSA";
private static final String TABLE_SITE = "site";
private static final String TABLE_EQUIPMENT = "equipment";
private static final String TABLE_BASIC_DATA = "basic_data";
private static final String TABLE_EQUIPMENT_SELECTED = "eq_battery";
private static final String TABLE_EB_METER = "eb_meter";
private static final String TABLE_SITE_ON_BB = "site_on_bb";
private static final String TABLE_SITE_ON_DG = "site_on_dg";
private static final String TABLE_SITE_ON_EB = "site_on_eb";
private static final String TABLE_EQUIPMENT_TYPE = "equipment_type";
private static final String TABLE_EQUIPMENT_MAKE = "equipment_make";
private static final String TABLE_EQUIPMENT_CAPACITY = "equipment_capacity";
private static final String TABLE_EQUIPMENT_DESCRIPTION = "equipment_description";
private static final String KEY_ID = "id";
private static final String USERID = "user_id";
// Equipment Type Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_TYPE_NAME = "type_name";
private static final String EQUIPMENT_TYPE_ID = "type_id";
private static final String EQUIPMENT_TYPE_LAST_UPDATED = "last_updated";
// Equipment Make Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_MAKE_NAME = "make_name";
private static final String EQUIPMENT_MAKE_ID = "make_id";
private static final String EQUIPMENT_MAKE_TYPE_ID = "make_type_id";
private static final String EQUIPMENT_MAKE_LAST_UPDATED = "last_updated";
// Equipment Capacity Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_CAPACITY_NAME = "capacity_name";
private static final String EQUIPMENT_CAPACITY_ID = "capacity_id";
private static final String EQUIPMENT_CAPACITY_MAKE_ID = "capacity_make_id";
private static final String EQUIPMENT_CAPACITY_LAST_UPDATED = "last_updated";
// Equipment Description Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_DESCRIPTION_NAME = "description_name";
private static final String EQUIPMENT_DESCRIPTION_ID = "description_id";
private static final String EQUIPMENT_DESCRIPTION_CAPACITY_ID = "description_capacity_id";
private static final String EQUIPMENT_DESCRIPTION_LAST_UPDATED = "last_updated";
// Circle Table Columns
//private static final String KEY_ID = "id";
private static final String CIRCLE_NAME = "circle_name";
private static final String CIRCLE_ID = "circle_id";
private static final String CIRCLE_LAST_UPDATED = "last_updated";
// District Table Columns
//private static final String KEY_ID = "id";
private static final String DISTRICT_NAME = "district_name";
private static final String DISTRICT_ID = "district_id";
private static final String Tehsil_NAME = "tehsil_name";
private static final String DISTRICT_CIRCLE_ID = "circle_id";
private static final String DISTRICT_LAST_UPDATED = "last_updated";
// SSA Table Columns
//private static final String KEY_ID = "id";
private static final String SSA_NAME = "SSA_name";
private static final String SSA_ID = "SSA_id";
private static final String SSA_CIRCLE_ID = "SSA_circle_id";
private static final String SSA_LAST_UPDATED = "last_updated";
// Site Table Columns
//private static final String KEY_ID = "id";
private static final String SITE_ID = "site_id";
private static final String SITE_NAME = "site_name";
private static final String SITE_CUSTOMER_SITE_ID = "customer_site_id";
private static final String SITE_CIRCLE_ID = "circle_id";
private static final String SITE_CIRCLE_NAME = "circle_name";
private static final String SITE_SSA_ID = "SSA_id";
private static final String SITE_SSA_NAME = "SSA_name";
private static final String SITE_Address = "Address";
private static final String SITE_City = "City";
private static final String SITE_LAST_UPDATED = "last_updated";
// Equipment Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIP_ID = "equip_id";
private static final String EQUIP_TYPE = "equip_type";
private static final String EQUIP_CODE = "equip_code";
private static final String EQUIP_DES = "equip_des";
private static final String EQUIP_MAKE = "equip_make";
private static final String EQUIP_MODEL = "equip_model";
private static final String EQUIP_RATING = "equip_rating";
private static final String EQUIP_LAST_UPDATED = "last_updated";
// BASIC DATA FORM Table Columns
//private static final String KEY_ID = "id";
private static final String BASIC_DATE_TIME = "date_time";
private static final String BASIC_SURVEYOR_NAME = "surveyor_name";
private static final String BASIC_SITE_ID = "site_id";
private static final String BASIC_SITE_NAME = "site_name";
private static final String BASIC_ADDRESS = "address";
private static final String BASIC_CIRCLE = "circle";
private static final String BASIC_SSA = "ssa";
private static final String BASIC_DISTRICT = "district";
private static final String BASIC_CITY = "city";
private static final String BASIC_PINCODE = "pincode";
// EQUIPMENT FORM Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_FORM_TYPE = "equptype";
private static final String EQUIPMENT_MAKE = "make";
private static final String EQUIPMENT_MODEL = "model";
private static final String EQUIPMENT_CAPACITY = "capacity";
private static final String EQUIPMENT_FORM_MAKE_ID = "makeId";
private static final String EQUIPMENT_FORM_MODEL_ID = "modelId";
private static final String EQUIPMENT_FORM_CAPACITY_ID = "capacityId";
private static final String EQUIPMENT_SERIAL_NUMBER = "serial_number";
private static final String EQUIPMENT_DATE_OF_MANUFACTURING = "date_of_manufacturing";
private static final String EQUIPMENT_DESCRIPTION = "description";
private static final String EQUIPMENT_ID = "equipment_id";
private static final String EQUIPMENT_PHOTO_1 = "photo1";
private static final String EQUIPMENT_PHOTO_2 = "photo2";
private static final String EQUIPMENT_PHOTO_1_NAME = "photo1_name";
private static final String EQUIPMENT_PHOTO_2_NAME = "photo2_name";
private static final String EQUIPMENT_TYPE = "type";
private static final String EQUIPMENT_NUMBER_OF_AIR_CONDITIONER = "num_of_AC";
private static final String EQUIPMENT_SITE_ID = "site_id";
// EB Meter FORM Table Columns
//private static final String KEY_ID = "id";
private static final String METER_READING = "meter_reading";
private static final String METER_NUMBER = "meter_number";
private static final String AVAILABLE_HOURS = "available_hours";
private static final String SUPPLY_SINGLE_PHASE = "supply_single_phase";
private static final String SUPPLY_THREE_PHASE = "supply_three_phase";
private static final String EB_METER_PHOTO_1 = "photo1";
private static final String EB_METER_PHOTO_2 = "photo2";
private static final String EB_METER_PHOTO_1_NAME = "photo1_name";
private static final String EB_METER_PHOTO_2_NAME = "photo2_name";
private static final String EB_METER_SITE_ID = "site_id";
// Site On Battery Bank FORM Table Columns
//private static final String KEY_ID = "id";
private static final String BB_DISCHARGE_CURRENT = "discharge_current";
private static final String BB_DISCHARGE_VOLTAGE = "discharge_voltage";
private static final String BB_SITE_ID = "site_id";
// SITE ON DG SET FORM Table Columns
//private static final String KEY_ID = "id";
private static final String DG_CURRENT = "dg_current";
private static final String DG_FREQUENCY = "dg_frequency";
private static final String DG_VOLTAGE = "dg_voltage";
private static final String DG_BATTERY_CHARGE_CURRENT = "battery_charge_current";
private static final String DG_BATTERY_VOLTAGE = "battery_voltage";
private static final String DG_SITE_ID = "site_id";
// SITE ON EB FORM Table Columns
//private static final String KEY_ID = "id";
private static final String GRID_CURRENT = "grid_current";
private static final String GRID_VOLTAGE = "grid_voltage";
private static final String GRID_FREQUENCY = "grid_frequency";
private static final String GRID_SITE_ID = "grid_site_id";
public AtmDatabase(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_CIRCLE_TABLE = "CREATE TABLE " + TABLE_CIRCLE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ CIRCLE_ID + " TEXT," + CIRCLE_NAME + " TEXT,"
+ CIRCLE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_CIRCLE_TABLE);
String CREATE_DISTRICT_TABLE = "CREATE TABLE " + TABLE_DISTRICT + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ DISTRICT_ID + " TEXT," + DISTRICT_NAME + " TEXT,"
+ Tehsil_NAME + " TEXT," + DISTRICT_CIRCLE_ID + " TEXT," + DISTRICT_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_DISTRICT_TABLE);
String CREATE_SSA_TABLE = "CREATE TABLE " + TABLE_SSA + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ SSA_ID + " TEXT," + SSA_NAME + " TEXT,"
+ SSA_CIRCLE_ID + " TEXT," + SSA_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_SSA_TABLE);
String CREATE_SITE_TABLE = "CREATE TABLE " + TABLE_SITE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + SITE_ID + " TEXT," + SITE_NAME + " TEXT,"
+ SITE_CUSTOMER_SITE_ID + " TEXT," + SITE_CIRCLE_ID + " TEXT,"
+ SITE_CIRCLE_NAME + " TEXT," + SITE_SSA_ID + " TEXT," + SITE_SSA_NAME + " TEXT,"
+ SITE_Address + " TEXT," + SITE_City + " TEXT," + SITE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_SITE_TABLE);
String CREATE_EQUIPMENT_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIP_ID + " TEXT," + EQUIP_TYPE + " TEXT,"
+ EQUIP_CODE + " TEXT," + EQUIP_DES + " TEXT,"
+ EQUIP_MAKE + " TEXT," + EQUIP_MODEL + " TEXT," + EQUIP_RATING + " TEXT,"
+ EQUIP_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_EQUIPMENT_TABLE);
String CREATE_BASIC_DATA_TABLE = "CREATE TABLE " + TABLE_BASIC_DATA + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + BASIC_DATE_TIME + " TEXT," + BASIC_SURVEYOR_NAME + " TEXT,"
+ BASIC_SITE_ID + " TEXT," + BASIC_SITE_NAME + " TEXT," + BASIC_ADDRESS + " TEXT," + BASIC_CIRCLE + " TEXT,"
+ BASIC_SSA + " TEXT," + BASIC_DISTRICT + " TEXT," + BASIC_CITY + " TEXT," + BASIC_PINCODE + " TEXT, " + USERID + " TEXT)";
db.execSQL(CREATE_BASIC_DATA_TABLE);
String CREATE_EQUIPMENT_SELECTED_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_SELECTED + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_MAKE + " TEXT," + EQUIPMENT_MODEL + " TEXT,"
+ EQUIPMENT_CAPACITY + " TEXT," + EQUIPMENT_SERIAL_NUMBER + " TEXT," + EQUIPMENT_DATE_OF_MANUFACTURING + " TEXT,"
+ EQUIPMENT_DESCRIPTION + " TEXT," + EQUIPMENT_ID + " TEXT," + EQUIPMENT_PHOTO_1 + " TEXT,"
+ EQUIPMENT_PHOTO_2 + " TEXT," + EQUIPMENT_PHOTO_1_NAME + " TEXT," + EQUIPMENT_PHOTO_2_NAME + " TEXT,"
+ EQUIPMENT_TYPE + " TEXT," + EQUIPMENT_NUMBER_OF_AIR_CONDITIONER + " TEXT, " + EQUIPMENT_SITE_ID + " TEXT, "
+ EQUIPMENT_FORM_MAKE_ID + " TEXT," + EQUIPMENT_FORM_MODEL_ID + " TEXT, " + EQUIPMENT_FORM_CAPACITY_ID + " TEXT, "
+ EQUIPMENT_FORM_TYPE + " TEXT, " + USERID + " TEXT)";
db.execSQL(CREATE_EQUIPMENT_SELECTED_TABLE);
String CREATE_EB_METER_TABLE = "CREATE TABLE " + TABLE_EB_METER + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + METER_READING + " TEXT," + METER_NUMBER + " TEXT,"
+ AVAILABLE_HOURS + " TEXT," + SUPPLY_SINGLE_PHASE + " TEXT," + SUPPLY_THREE_PHASE + " TEXT,"
+ EB_METER_PHOTO_1 + " " + "TEXT,"
+ EB_METER_PHOTO_2 + " TEXT," + EB_METER_PHOTO_1_NAME + " TEXT,"
+ EB_METER_PHOTO_2_NAME + " TEXT," + EB_METER_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_EB_METER_TABLE);
String CREATE_SITE_ON_BB_TABLE = "CREATE TABLE " + TABLE_SITE_ON_BB + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + BB_DISCHARGE_CURRENT + " TEXT," + BB_DISCHARGE_VOLTAGE + " TEXT,"
+ BB_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_SITE_ON_BB_TABLE);
String CREATE_SITE_ON_DG_TABLE = "CREATE TABLE " + TABLE_SITE_ON_DG + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + DG_CURRENT + " TEXT," + DG_FREQUENCY + " TEXT,"
+ DG_VOLTAGE + " TEXT," + DG_BATTERY_CHARGE_CURRENT + " TEXT," + DG_BATTERY_VOLTAGE + " TEXT,"
+ DG_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_SITE_ON_DG_TABLE);
String CREATE_SITE_ON_EB_TABLE = "CREATE TABLE " + TABLE_SITE_ON_EB + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + GRID_CURRENT + " TEXT," + GRID_VOLTAGE + " TEXT,"
+ GRID_FREQUENCY + " TEXT," + GRID_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_SITE_ON_EB_TABLE);
String CREATE_TYPE_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_TYPE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_TYPE_NAME + " TEXT," + EQUIPMENT_TYPE_ID + " TEXT,"
+ EQUIPMENT_TYPE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_TYPE_TABLE);
String CREATE_MAKE_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_MAKE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_MAKE_NAME + " TEXT," + EQUIPMENT_MAKE_ID + " TEXT,"
+ EQUIPMENT_MAKE_TYPE_ID + " TEXT," + EQUIPMENT_MAKE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_MAKE_TABLE);
String CREATE_CAPACITY_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_CAPACITY + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_CAPACITY_NAME + " TEXT," + EQUIPMENT_CAPACITY_ID + " TEXT,"
+ EQUIPMENT_CAPACITY_MAKE_ID + " TEXT," + EQUIPMENT_CAPACITY_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_CAPACITY_TABLE);
String CREATE_DESCRIPTION_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_DESCRIPTION + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_DESCRIPTION_ID + " TEXT," + EQUIPMENT_DESCRIPTION_NAME + " TEXT,"
+ EQUIPMENT_DESCRIPTION_CAPACITY_ID + " TEXT," + EQUIPMENT_DESCRIPTION_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_DESCRIPTION_TABLE);
String CREATE_BTSInfo_TABLE = "CREATE TABLE BTSInfo(sno INTEGR,type TEXT,btsName TEXT, CabinetQty TEXT,NoofDCDBBox TEXT,NoofKroneBox TEXT,NoofTransmissionRack TEXT," +
"Microwave TEXT,OperatorType TEXT,TypeofBTS TEXT, BTSMake TEXT,YearInstallationSite TEXT,PostionAntennaTower TEXT)";
db.execSQL(CREATE_BTSInfo_TABLE);
String CREATE_OrderData_TABLE = "CREATE TABLE OrderDataInfo(CircleId INTEGR,CircleName TEXT,CompanyDetail TEXT)";
db.execSQL(CREATE_OrderData_TABLE);
String CREATE_SITELIST_TABLE = "CREATE TABLE SiteList(SiteId INTEGER,SiteName TEXT,CustomerSiteId TEXT,CustomerName TEXT,CircleId INTEGER,CircleName TEXT,SSAName TEXT,SSAId INTEGER,Address TEXT,City TEXT,DistictId INTEGER,DistrictName TEXT,TehsilId INTEGER,TehsilName TEXT)";
db.execSQL(CREATE_SITELIST_TABLE);
String CREATE_SITELISTNEW_TABLE = "CREATE TABLE SiteListnew(id INTEGER, siteListData TEXT)";
db.execSQL(CREATE_SITELISTNEW_TABLE);
//Offline Data
String CREATE_BasicDataoffline_TABLE = "CREATE TABLE BasicDataofflineinfo(siteId INTEGR,basicdatajson TEXT)";
db.execSQL(CREATE_BasicDataoffline_TABLE);
String CREATE_Equipmentoffline_TABLE = "CREATE TABLE EquipmentDataofflineinfo(siteId INTEGR,equipmentId INTEGR," +
"itemid INTEGR ,equipmendatajson TEXT,filedata TEXT)";
db.execSQL(CREATE_Equipmentoffline_TABLE);
String CREATE_OtherEquipoffline_TABLE = "CREATE TABLE OtherEquipmentDataofflineinfo(id INTEGER PRIMARY KEY autoincrement,siteId INTEGR," +
"equipmendatajson TEXT,filedata TEXT)";
db.execSQL(CREATE_OtherEquipoffline_TABLE);
String CREATE_planlist_TABLE = "CREATE TABLE PlanListinfo(Plan_Id TEXT,Site_Id TEXT," +
"CustomerSiteId TEXT,SiteName TEXT,Plandate TEXT,Task_Id TEXT,Task TEXT,Activity_Id TEXT,Activity TEXT, FEId TEXT,FEName TEXT)";
db.execSQL(CREATE_planlist_TABLE);
String CREATE_SurveySiteDetail_TABLE = "CREATE TABLE SurveySiteDetail(surveySitelist TEXT)";
db.execSQL(CREATE_SurveySiteDetail_TABLE);
String CREATE_SurveySpinnerList_TABLE = "CREATE TABLE SurveySpinnerList(SurveySpinner TEXT)";
db.execSQL(CREATE_SurveySpinnerList_TABLE);
String CREATE_RCAList_TABLE = "CREATE TABLE RCAListInfo(RCATypeId INTEGER ,RCATypeName TEXT,jsonDataStr TEXT)";
db.execSQL(CREATE_RCAList_TABLE);
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + TABLE_CIRCLE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_DISTRICT);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SSA);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_BASIC_DATA);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_SELECTED);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EB_METER);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE_ON_BB);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE_ON_DG);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE_ON_EB);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_TYPE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_MAKE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_CAPACITY);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_DESCRIPTION);
db.execSQL("DROP TABLE IF EXISTS BTSInfo");
db.execSQL("DROP TABLE IF EXISTS OrderDataInfo");
db.execSQL("DROP TABLE IF EXISTS SiteList");
db.execSQL("DROP TABLE IF EXISTS SiteListnew");
db.execSQL("DROP TABLE IF EXISTS BasicDataofflineinfo");
db.execSQL("DROP TABLE IF EXISTS EquipmentDataofflineinfo");
db.execSQL("DROP TABLE IF EXISTS OtherEquipmentDataofflineinfo");
db.execSQL("DROP TABLE IF EXISTS PlanListinfo");
db.execSQL("DROP TABLE IF EXISTS SurveySiteDetail");
db.execSQL("DROP TABLE IF EXISTS SurveySpinnerList");
db.execSQL("DROP TABLE IF EXISTS RCAListInfo");
onCreate(db);
}
/**
* All CRUD(Create, Read, Update, Delete) Operations
*/
// -------------------------------Adding new Circle---------------------------------------
public boolean addCircleData(List<CircleMasterDataModel> circleDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < circleDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(CIRCLE_NAME, circleDataList.get(i).getCircleName());
values.put(CIRCLE_ID, circleDataList.get(i).getCircleId());
values.put(CIRCLE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_CIRCLE, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Circle Data-------------------------------------------
public ArrayList<CircleMasterDataModel> getAllCircleData(String sortType) {
ArrayList<CircleMasterDataModel> circleList = new ArrayList<CircleMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_CIRCLE;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
CircleMasterDataModel circleModel = new CircleMasterDataModel();
circleModel.setCircleName(cursor.getString(cursor.getColumnIndex(CIRCLE_NAME)));
circleModel.setCircleId(cursor.getString(cursor.getColumnIndex(CIRCLE_ID)));
circleModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(CIRCLE_LAST_UPDATED)));
// Adding contact to list
circleList.add(circleModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return circleList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new SSA---------------------------------------
public boolean addDistrictData(List<DistrictMasterDataModel> districtDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < districtDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(DISTRICT_ID, districtDataList.get(i).getDistrictId());
values.put(DISTRICT_NAME, districtDataList.get(i).getDistrictName());
values.put(Tehsil_NAME, districtDataList.get(i).getTehsilListStr());
values.put(DISTRICT_LAST_UPDATED, time);
values.put(DISTRICT_CIRCLE_ID, districtDataList.get(i).getCircleId());
// Inserting Row
db.insert(TABLE_DISTRICT, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All District Data-------------------------------------------
public ArrayList<DistrictMasterDataModel> getAllDistrictData(String sortType, String circleId) {
ArrayList<DistrictMasterDataModel> districtList = new ArrayList<DistrictMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_DISTRICT + " WHERE " + DISTRICT_CIRCLE_ID + " = " + circleId;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
DistrictMasterDataModel districtMasterDataModel = new DistrictMasterDataModel();
districtMasterDataModel.setCircleId(cursor.getString(cursor.getColumnIndex(DISTRICT_CIRCLE_ID)));
districtMasterDataModel.setDistrictName(cursor.getString(cursor.getColumnIndex(DISTRICT_NAME)));
districtMasterDataModel.setTehsilListStr(cursor.getString(cursor.getColumnIndex(Tehsil_NAME)));
districtMasterDataModel.setDistrictId(cursor.getString(cursor.getColumnIndex(DISTRICT_ID)));
districtMasterDataModel.setDistrictLastUpdated(cursor.getString(cursor.getColumnIndex(DISTRICT_LAST_UPDATED)));
// Adding contact to list
districtList.add(districtMasterDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return districtList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new SSA---------------------------------------
public boolean addSSAData(List<SSAmasterDataModel> SSADataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < SSADataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(SSA_ID, SSADataList.get(i).getSSAid());
values.put(SSA_NAME, SSADataList.get(i).getSSAname());
values.put(SSA_CIRCLE_ID, SSADataList.get(i).getCircleId());
values.put(SSA_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_SSA, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All SSA Data-------------------------------------------
public ArrayList<SSAmasterDataModel> getAllSSAData(String sortType, String columnValue) {
ArrayList<SSAmasterDataModel> SSAList = new ArrayList<SSAmasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_SSA + " WHERE " + SSA_CIRCLE_ID + " = " + columnValue;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
SSAmasterDataModel ssaDataModel = new SSAmasterDataModel();
ssaDataModel.setCircleId(cursor.getString(cursor.getColumnIndex(SSA_CIRCLE_ID)));
ssaDataModel.setSSAid(cursor.getString(cursor.getColumnIndex(SSA_ID)));
ssaDataModel.setSSAname(cursor.getString(cursor.getColumnIndex(SSA_NAME)));
ssaDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(SSA_LAST_UPDATED)));
// Adding contact to list
SSAList.add(ssaDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return SSAList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site---------------------------------------
public boolean addSiteData(List<SiteMasterDataModel> siteDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(SITE_ID, siteDataList.get(i).getSiteId());
values.put(SITE_NAME, siteDataList.get(i).getSiteName());
values.put(SITE_CUSTOMER_SITE_ID, siteDataList.get(i).getCustomerSiteId());
values.put(SITE_CIRCLE_ID, siteDataList.get(i).getCircleId());
values.put(SITE_CIRCLE_NAME, siteDataList.get(i).getCircleName());
values.put(SITE_SSA_ID, siteDataList.get(i).getSiteId());
values.put(SITE_SSA_NAME, siteDataList.get(i).getSiteName());
values.put(SITE_Address, siteDataList.get(i).getAddress());
values.put(SITE_City, siteDataList.get(i).getCity());
values.put(SITE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_SITE, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Site Data-------------------------------------------
public ArrayList<SiteMasterDataModel> getAllSiteData(String sortType) {
ArrayList<SiteMasterDataModel> siteList = new ArrayList<SiteMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_SITE;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
SiteMasterDataModel siteDataModel = new SiteMasterDataModel();
siteDataModel.setSiteId(cursor.getString(cursor.getColumnIndex(SITE_ID)));
siteDataModel.setSiteName(cursor.getString(cursor.getColumnIndex(SITE_NAME)));
siteDataModel.setCustomerSiteId(cursor.getString(cursor.getColumnIndex(SITE_CUSTOMER_SITE_ID)));
siteDataModel.setCircleId(cursor.getString(cursor.getColumnIndex(SITE_CIRCLE_ID)));
siteDataModel.setCircleName(cursor.getString(cursor.getColumnIndex(SITE_CIRCLE_NAME)));
siteDataModel.setSsaName(cursor.getString(cursor.getColumnIndex(SITE_SSA_NAME)));
siteDataModel.setSsaId(cursor.getString(cursor.getColumnIndex(SITE_SSA_ID)));
siteDataModel.setAddress(cursor.getString(cursor.getColumnIndex(SITE_Address)));
siteDataModel.setCity(cursor.getString(cursor.getColumnIndex(SITE_City)));
siteDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(SITE_LAST_UPDATED)));
// Adding contact to list
siteList.add(siteDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return siteList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Data---------------------------------------
public boolean addEquipData(List<EquipmentMasterDataModel> equipDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < equipDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIP_ID, equipDataList.get(i).getEquipId());
values.put(EQUIP_TYPE, equipDataList.get(i).getEquipType());
values.put(EQUIP_CODE, equipDataList.get(i).getEquipCode());
values.put(EQUIP_DES, equipDataList.get(i).getEquipDes());
values.put(EQUIP_MAKE, equipDataList.get(i).getEquipMake());
values.put(EQUIP_MODEL, equipDataList.get(i).getEquipModel());
values.put(EQUIP_RATING, equipDataList.get(i).getEquipRating());
values.put(EQUIP_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Equipment Data-------------------------------------------
public ArrayList<EquipmentMasterDataModel> getAllEquipmentData(String sortType, String equipmentType) {
ArrayList<EquipmentMasterDataModel> equipList = new ArrayList<EquipmentMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
if (equipmentType.equals("NA")) {
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT;
} else {
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT + " WHERE " + EQUIP_TYPE + " = '" + equipmentType + "'";
}
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipmentMasterDataModel equipDataModel = new EquipmentMasterDataModel();
equipDataModel.setEquipId(cursor.getString(cursor.getColumnIndex(EQUIP_ID)));
equipDataModel.setEquipType(cursor.getString(cursor.getColumnIndex(EQUIP_TYPE)));
equipDataModel.setEquipCode(cursor.getString(cursor.getColumnIndex(EQUIP_CODE)));
equipDataModel.setEquipDes(cursor.getString(cursor.getColumnIndex(EQUIP_DES)));
equipDataModel.setEquipMake(cursor.getString(cursor.getColumnIndex(EQUIP_MAKE)));
equipDataModel.setEquipModel(cursor.getString(cursor.getColumnIndex(EQUIP_MODEL)));
equipDataModel.setEquipRating(cursor.getString(cursor.getColumnIndex(EQUIP_RATING)));
equipDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(EQUIP_LAST_UPDATED)));
// Adding contact to list
equipList.add(equipDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Data---------------------------------------
public boolean addNewEquipData(ArrayList<EquipTypeDataModel> equipTypeList, ArrayList<EquipMakeDataModel> equipMakeList,
ArrayList<EquipCapacityDataModel> equipCapacityList, ArrayList<EquipDescriptionDataModel> equipDescriptionList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < equipTypeList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_TYPE_ID, equipTypeList.get(i).getId());
values.put(EQUIPMENT_TYPE_NAME, equipTypeList.get(i).getName());
values.put(EQUIPMENT_TYPE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_TYPE, null, values);
//return insert > 0;
}
for (int i = 0; i < equipMakeList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_MAKE_ID, equipMakeList.get(i).getId());
values.put(EQUIPMENT_MAKE_NAME, equipMakeList.get(i).getName());
values.put(EQUIPMENT_MAKE_TYPE_ID, equipMakeList.get(i).getTypeId());
values.put(EQUIPMENT_MAKE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_MAKE, null, values);
}
for (int i = 0; i < equipCapacityList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_CAPACITY_ID, equipCapacityList.get(i).getId());
values.put(EQUIPMENT_CAPACITY_NAME, equipCapacityList.get(i).getName());
values.put(EQUIPMENT_CAPACITY_MAKE_ID, equipCapacityList.get(i).getMakeId());
values.put(EQUIPMENT_CAPACITY_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_CAPACITY, null, values);
}
for (int i = 0; i < equipDescriptionList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_DESCRIPTION_ID, equipDescriptionList.get(i).getId());
values.put(EQUIPMENT_DESCRIPTION_NAME, equipDescriptionList.get(i).getName());
values.put(EQUIPMENT_DESCRIPTION_CAPACITY_ID, equipDescriptionList.get(i).getCapacityId());
values.put(EQUIPMENT_DESCRIPTION_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_DESCRIPTION, null, values);
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting Equipment Data-------------------------------------------
public ArrayList<EquipMakeDataModel> getEquipmentData(String equipmentType) {
ArrayList<EquipMakeDataModel> equipMakeList = new ArrayList<EquipMakeDataModel>();
String selectQuery = "";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_TYPE + " WHERE " + EQUIPMENT_TYPE_NAME + " = '" + equipmentType + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipMakeDataModel equipMakeDataModel = new EquipMakeDataModel();
equipMakeDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_TYPE_ID)));
equipMakeDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_TYPE_NAME)));
equipMakeDataModel.setLastUpdated(cursor.getString(cursor.getColumnIndex(EQUIPMENT_TYPE_LAST_UPDATED)));
// Adding contact to list
equipMakeList.add(equipMakeDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipMakeList;
}
public ArrayList<EquipMakeDataModel> getEquipmentMakeData(String sortType, String equipmentType) {
ArrayList<EquipMakeDataModel> equipMakeList = new ArrayList<EquipMakeDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_MAKE + " WHERE " + EQUIPMENT_MAKE_TYPE_ID + " = '" + equipmentType + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipMakeDataModel equipMakeDataModel = new EquipMakeDataModel();
equipMakeDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_MAKE_ID)));
equipMakeDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_MAKE_NAME)));
equipMakeDataModel.setLastUpdated(cursor.getString(cursor.getColumnIndex(EQUIPMENT_MAKE_LAST_UPDATED)));
// Adding contact to list
equipMakeList.add(equipMakeDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipMakeList;
}
public ArrayList<EquipCapacityDataModel> getEquipmentCapacityData(String sortType, String makeName) {
ArrayList<EquipCapacityDataModel> equipCapacityList = new ArrayList<EquipCapacityDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_CAPACITY + " WHERE " + EQUIPMENT_CAPACITY_MAKE_ID + " = '" + makeName + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipCapacityDataModel equipCapacityDataModel = new EquipCapacityDataModel();
equipCapacityDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_CAPACITY_ID)));
equipCapacityDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_CAPACITY_NAME)));
equipCapacityDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(EQUIPMENT_CAPACITY_LAST_UPDATED)));
// Adding contact to list
equipCapacityList.add(equipCapacityDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipCapacityList;
}
public ArrayList<EquipDescriptionDataModel> getEquipmentDescriptionData(String sortType, String capacityName) {
ArrayList<EquipDescriptionDataModel> equipDescriptionList = new ArrayList<EquipDescriptionDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_DESCRIPTION + " WHERE " + EQUIPMENT_DESCRIPTION_CAPACITY_ID + " = '" + capacityName + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipDescriptionDataModel equipDescriptionDataModel = new EquipDescriptionDataModel();
equipDescriptionDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_DESCRIPTION_ID)));
equipDescriptionDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_DESCRIPTION_NAME)));
equipDescriptionDataModel.setLastUpdateDate(cursor.getString(cursor.getColumnIndex(EQUIPMENT_DESCRIPTION_LAST_UPDATED)));
// Adding contact to list
equipDescriptionList.add(equipDescriptionDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipDescriptionList;
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Form Data---------------------------------------
public boolean addEquipmentFormData(List<SelectedEquipmentDataModel> selectedEquipmentDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < selectedEquipmentDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_FORM_TYPE, selectedEquipmentDataList.get(i).getEquipmentType());
values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).getEquipmentMake());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getEquipmentModel());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getEquipmentCapacity());
values.put(EQUIPMENT_FORM_MAKE_ID, selectedEquipmentDataList.get(i).getMakeId());
values.put(EQUIPMENT_FORM_MODEL_ID, selectedEquipmentDataList.get(i).getModelId());
values.put(EQUIPMENT_FORM_CAPACITY_ID, selectedEquipmentDataList.get(i).getCapacityId());
values.put(EQUIPMENT_SERIAL_NUMBER, selectedEquipmentDataList.get(i).getSerialNumber());
values.put(EQUIPMENT_DATE_OF_MANUFACTURING, selectedEquipmentDataList.get(i).getDateOfManufacturing());
values.put(EQUIPMENT_DESCRIPTION, selectedEquipmentDataList.get(i).getDescription());
values.put(EQUIPMENT_ID, selectedEquipmentDataList.get(i).getEquipmentId());
/*values.put(EQUIPMENT_PHOTO_1, selectedEquipmentDataList.get(i).getPhoto1());
values.put(EQUIPMENT_PHOTO_2, selectedEquipmentDataList.get(i).getPhoto2());
values.put(EQUIPMENT_PHOTO_1_NAME, selectedEquipmentDataList.get(i).getPhoto1Name());
values.put(EQUIPMENT_PHOTO_2_NAME, selectedEquipmentDataList.get(i).getPhoto2Name());*/
values.put(EQUIPMENT_TYPE, selectedEquipmentDataList.get(i).getType());
values.put(EQUIPMENT_NUMBER_OF_AIR_CONDITIONER, selectedEquipmentDataList.get(i).getNumberOfAC());
values.put(EQUIPMENT_SITE_ID, selectedEquipmentDataList.get(i).getSiteId());
values.put(USERID, selectedEquipmentDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_EQUIPMENT_SELECTED, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Form Data---------------------------------------
public boolean addEbMeterFormData(List<EbMeterDataModel> ebMeterDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < ebMeterDataList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(METER_READING, ebMeterDataList.get(i).getMeterReading());
values.put(METER_NUMBER, ebMeterDataList.get(i).getMeterNumber());
values.put(AVAILABLE_HOURS, ebMeterDataList.get(i).getAvailableHours());
values.put(SUPPLY_SINGLE_PHASE, ebMeterDataList.get(i).getSupplySinglePhase());
values.put(SUPPLY_THREE_PHASE, ebMeterDataList.get(i).getSupplyThreePhase());
/*values.put(EB_METER_PHOTO_1, ebMeterDataList.get(i).getPhoto1());
values.put(EB_METER_PHOTO_2, ebMeterDataList.get(i).getPhoto2());
values.put(EB_METER_PHOTO_1_NAME, ebMeterDataList.get(i).getPhoto1Name());
values.put(EB_METER_PHOTO_2_NAME, ebMeterDataList.get(i).getPhoto2Name());*/
values.put(EB_METER_SITE_ID, ebMeterDataList.get(i).getSiteId());
values.put(USERID, ebMeterDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_EB_METER, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site On BB Form Data---------------------------------------
public boolean addSiteOnBbFormData(List<SiteOnBatteryBankDataModel> siteOnBatteryBankDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteOnBatteryBankDataList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(BB_DISCHARGE_CURRENT, siteOnBatteryBankDataList.get(i).getDischargeCurrent());
values.put(BB_DISCHARGE_VOLTAGE, siteOnBatteryBankDataList.get(i).getDischargeVoltage());
values.put(BB_SITE_ID, siteOnBatteryBankDataList.get(i).getSiteId());
values.put(USERID, siteOnBatteryBankDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_SITE_ON_BB, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site On DG Form Data---------------------------------------
public boolean addSiteOnDgFormData(List<SiteOnDG> siteOnDgDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteOnDgDataList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(DG_CURRENT, siteOnDgDataList.get(i).getDgCurrent());
values.put(DG_FREQUENCY, siteOnDgDataList.get(i).getDgFrequency());
values.put(DG_VOLTAGE, siteOnDgDataList.get(i).getDgVoltage());
values.put(DG_BATTERY_CHARGE_CURRENT, siteOnDgDataList.get(i).getBatteryChargeCurrent());
values.put(DG_BATTERY_VOLTAGE, siteOnDgDataList.get(i).getBatteryVoltage());
values.put(DG_SITE_ID, siteOnDgDataList.get(i).getSiteId());
values.put(USERID, siteOnDgDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_SITE_ON_DG, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site On BB Form Data---------------------------------------
public boolean addSiteOnEbFormData(List<SiteOnEbDataModel> siteOnEbDataModelList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteOnEbDataModelList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(GRID_CURRENT, siteOnEbDataModelList.get(i).getGridCurrent());
values.put(GRID_FREQUENCY, siteOnEbDataModelList.get(i).getGridFrequency());
values.put(GRID_VOLTAGE, siteOnEbDataModelList.get(i).getGridVoltage());
values.put(GRID_SITE_ID, siteOnEbDataModelList.get(i).getSiteId());
values.put(USERID, siteOnEbDataModelList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_SITE_ON_EB, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
public void deleteAllRows(String tableName) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(tableName, null, null);
db.close();
}
// upsert BTSInfo for local use
public boolean upsertBTSInfo(BtsInfoData ob) {
boolean done = false;
BtsInfoData data = null;
if (ob.getsNo() != 0) {
data = getBTSInfoById(ob.getsNo());
if (data == null) {
done = insertBTSInfoData(ob);
} else {
done = updateBTSInfoData(ob);
}
}
return done;
}
public BtsInfoData getBTSInfoById(int id) {
String query = "Select * FROM BTSInfo WHERE sno = '" + id + "' ";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
BtsInfoData ob = new BtsInfoData();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateBTSInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate BTSInfo list data
private void populateBTSInfoData(Cursor cursor, BtsInfoData ob) {
ob.setsNo(cursor.getInt(0));
ob.setType(cursor.getString(1));
ob.setName(cursor.getString(2));
ob.setCabinetQty(cursor.getString(3));
ob.setNoofDCDBBox(cursor.getString(4));
ob.setNoofKroneBox(cursor.getString(5));
ob.setNoofTransmissionRack(cursor.getString(6));
ob.setMicrowave(cursor.getString(7));
ob.setOperatorType(cursor.getString(8));
ob.setTypeofBTS(cursor.getString(9));
ob.setBTSMake(cursor.getString(10));
ob.setYearInstallationSite(cursor.getString(11));
ob.setPostionAntennaTower(cursor.getString(12));
}
public boolean insertBTSInfoData(BtsInfoData ob) {
ContentValues values = new ContentValues();
populateBTSInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("BTSInfo", null, values);
db.close();
return i > 0;
}
public boolean updateBTSInfoData(BtsInfoData ob) {
ContentValues values = new ContentValues();
populateBTSInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("BTSInfo", values, " sno = '" + ob.getsNo() + "'", null);
db.close();
return i > 0;
}
public void populateBTSInfoValueData(ContentValues values, BtsInfoData ob) {
values.put("sno", ob.getsNo());
values.put("type", ob.getType());
values.put("btsName", ob.getName());
values.put("CabinetQty", ob.getCabinetQty());
values.put("NoofDCDBBox", ob.getNoofDCDBBox());
values.put("NoofKroneBox", ob.getNoofKroneBox());
values.put("NoofTransmissionRack", ob.getNoofTransmissionRack());
values.put("Microwave", ob.getMicrowave());
values.put("OperatorType", ob.getOperatorType());
values.put("TypeofBTS", ob.getTypeofBTS());
values.put("BTSMake", ob.getBTSMake());
values.put("YearInstallationSite", ob.getYearInstallationSite());
values.put("PostionAntennaTower", ob.getPostionAntennaTower());
}
public ArrayList<BtsInfoData> getAllBTSInfoList() {
String query = "Select * FROM BTSInfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<BtsInfoData> list = new ArrayList<BtsInfoData>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
BtsInfoData ob = new BtsInfoData();
populateBTSInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
public void deleteBTCRows(int id) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete("BTSInfo", " sno = '" + id + "'", null);
db.close();
}
/**
* Order Data Company Name Upsert
*
* @param ob
* @return
*/
public boolean upsertOrderData(OrderData ob) {
boolean done = false;
OrderData data = null;
if (ob.getCircleId() != 0) {
data = getOrderDataByID(ob.getCircleId());
if (data == null) {
done = insertOrderData(ob);
} else {
done = updateOrderData(ob);
}
}
return done;
}
public OrderData getOrderDataByID(long CircleId) {
String query = "Select * FROM OrderDataInfo WHERE CircleId = '" + CircleId + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OrderData ob = new OrderData();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateOrderData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
private void populateOrderData(Cursor cursor, OrderData ob) {
ob.setCircleId(cursor.getInt(0));
ob.setCircleName(cursor.getString(1));
ArrayList<CompanyDetail> companyDetails = new Gson().fromJson(cursor.getString(2), new TypeToken<ArrayList<CompanyDetail>>() {
}.getType());
ob.setCompanyDetail(companyDetails);
}
public boolean insertOrderData(OrderData ob) {
ContentValues values = new ContentValues();
populateOrderDataValue(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("OrderDataInfo", null, values);
db.close();
return i > 0;
}
public void populateOrderDataValue(ContentValues values, OrderData ob) {
values.put("CircleId", ob.getCircleId());
values.put("CircleName", ob.getCircleName());
String companydetails = new Gson().toJson(ob.getCompanyDetail());
values.put("CompanyDetail", companydetails);
}
public boolean updateOrderData(OrderData ob) {
ContentValues values = new ContentValues();
populateOrderDataValue(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("OrderDataInfo", values, " CircleId = '" + ob.getCircleId() + "'", null);
db.close();
return i > 0;
}
public ArrayList<OrderData> getAllOrderData() {
String query = "Select * FROM OrderDataInfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OrderData> list = new ArrayList<OrderData>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OrderData ob = new OrderData();
populateOrderData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
public boolean insertSiteListnewData(String ob) {
ContentValues values = new ContentValues();
values.put("id", 1);//only for single data
values.put("siteListData", ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SiteListnew", null, values);
db.close();
return i > 0;
}
public ArrayList<String> getAllSitetListDatanew() {
String query = "Select * FROM SiteListnew";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<String> list = new ArrayList<String>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
String data = cursor.getString(1);
list.add(data);
cursor.moveToNext();
}
}
db.close();
return list;
}
public String getSitetListDatanew() {
String siteListStr = null;
int id = 1;
String query = "Select * FROM SiteListnew WHERE id = '" + id + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
cursor.moveToFirst();
siteListStr = cursor.getString(1);
cursor.close();
} else {
siteListStr = null;
}
db.close();
return siteListStr;
}
//...................................................................................................
// get All Site List data
private void populateSiteListData(Cursor cursor, Data ob) {
ob.setSiteId(cursor.getInt(0));
ob.setSiteName(cursor.getString(1));
ob.setCustomerSiteId(cursor.getString(2));
ob.setCustomerName(cursor.getString(3));
ob.setCircleId(cursor.getInt(4));
ob.setCircleName(cursor.getString(5));
ob.setSSAId(cursor.getInt(6));
ob.setSSAName(cursor.getString(7));
ob.setAddress(cursor.getString(8));
ob.setCity(cursor.getString(9));
ob.setDistrictName(cursor.getString(10));
ob.setDistictId(cursor.getInt(11));
ob.setTehsilId(cursor.getInt(12));
ob.setTehsilName(cursor.getString(13));
}
public boolean insertSiteListData(Data ob) {
ContentValues values = new ContentValues();
populateSiteListValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SiteList", null, values);
db.close();
return i > 0;
}
public void populateSiteListValueData(ContentValues values, Data ob) {
values.put("SiteId", ob.getSiteId());
values.put("SiteName", ob.getSiteName());
values.put("CustomerSiteId", ob.getCustomerSiteId());
values.put("CustomerName", ob.getCustomerName());
values.put("CircleId", ob.getCircleId());
values.put("CircleName", ob.getCircleName());
values.put("SSAName", ob.getSSAName());
values.put("SSAId", ob.getSSAId());
values.put("Address", ob.getAddress());
values.put("City", ob.getCity());
values.put("DistictId", ob.getDistictId());
values.put("DistrictName", ob.getDistrictName());
values.put("TehsilId", ob.getTehsilId());
values.put("TehsilName", ob.getTehsilName());
}
public ArrayList<Data> getAllSitetListData() {
String query = "Select * FROM SiteList";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<Data> list = new ArrayList<Data>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
Data ob = new Data();
populateSiteListData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Save Basic Data Offline Info
*/
public boolean upsertBasicDataofflineInfo(OfflineDataModel ob) {
boolean done = false;
OfflineDataModel data = null;
if (ob.getSiteId() != 0) {
data = getBasicDataofflineInfoInfoById(ob.getSiteId());
if (data == null) {
done = insertBasicDataofflineInfoData(ob);
} else {
done = updateBasicDataofflineInfoInfoData(ob);
}
}
return done;
}
public OfflineDataModel getBasicDataofflineInfoInfoById(long siteId) {
String query = "Select * FROM BasicDataofflineinfo WHERE siteId = '" + siteId + "' ";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OfflineDataModel ob = new OfflineDataModel();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateBasicDataofflineInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate BasicDataofflineInfoInfo list data
private void populateBasicDataofflineInfoData(Cursor cursor, OfflineDataModel ob) {
ob.setSiteId(cursor.getLong(0));
ob.setBasicdatajson(cursor.getString(1));
}
public boolean insertBasicDataofflineInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateBasicDataofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("BasicDataofflineinfo", null, values);
db.close();
return i > 0;
}
public boolean updateBasicDataofflineInfoInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateBasicDataofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("BasicDataofflineinfo", values, " siteId = '" + ob.getSiteId() + "'", null);
db.close();
return i > 0;
}
public void populateBasicDataofflineInfoValueData(ContentValues values, OfflineDataModel ob) {
values.put("siteId", ob.getSiteId());
values.put("basicdatajson", ob.getBasicdatajson());
}
public ArrayList<OfflineDataModel> getAllBasicDataofflineInfoList() {
String query = "Select * FROM BasicDataofflineinfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OfflineDataModel> list = new ArrayList<OfflineDataModel>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OfflineDataModel ob = new OfflineDataModel();
populateBasicDataofflineInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Save Equipment Data Info
*/
public boolean upsertEquipmentofflineInfo(OfflineDataModel ob) {
boolean done = false;
OfflineDataModel data = null;
if (ob.getSiteId() != 0) {
data = getEquipmentofflineInfoInfoById(ob.getSiteId(), ob.getEquipmentId(), ob.getItemid());
if (data == null) {
done = insertEquipmentofflineInfoData(ob);
} else {
done = updateEquipmentofflineInfoInfoData(ob);
}
}
return done;
}
public OfflineDataModel getEquipmentofflineInfoInfoById(long siteId, long equipmentId,
int itemid) {
String query = "Select * FROM EquipmentDataofflineinfo WHERE siteId = '" + siteId + "' AND equipmentId='" + equipmentId
+ "' AND itemid='" + itemid + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OfflineDataModel ob = new OfflineDataModel();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateEquipmentofflineInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate EquipmentofflineInfoInfo list data
private void populateEquipmentofflineInfoData(Cursor cursor, OfflineDataModel ob) {
ob.setSiteId(cursor.getLong(0));
ob.setEquipmentId(cursor.getLong(1));
ob.setItemid(cursor.getInt(2));
ob.setEquipmendatajson(cursor.getString(3));
ob.setFiledata(cursor.getString(4));
}
public boolean insertEquipmentofflineInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateEquipmentofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("EquipmentDataofflineinfo", null, values);
db.close();
return i > 0;
}
public boolean updateEquipmentofflineInfoInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateEquipmentofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("EquipmentDataofflineinfo", values, " siteId = '" + ob.getSiteId() + "' AND equipmentId = '"
+ ob.getEquipmentId() + "' AND itemid = '"
+ ob.getItemid() + "'", null);
db.close();
return i > 0;
}
public void populateEquipmentofflineInfoValueData(ContentValues values, OfflineDataModel ob) {
values.put("siteId", ob.getSiteId());
values.put("equipmentId", ob.getEquipmentId());
values.put("itemid", ob.getItemid());
values.put("equipmendatajson", ob.getEquipmendatajson());
values.put("filedata", ob.getFiledata());
}
public ArrayList<OfflineDataModel> getAllEquipmentofflineInfoList() {
String query = "Select * FROM EquipmentDataofflineinfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OfflineDataModel> list = new ArrayList<OfflineDataModel>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OfflineDataModel ob = new OfflineDataModel();
populateEquipmentofflineInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Save Other Equipment Data Info
*/
public boolean upsertOtherEquipmenttofflineInfo(OfflineDataModel ob) {
boolean done = false;
OfflineDataModel data = null;
if (ob.getSiteId() != 0) {
data = getOtherEquipmenttofflineInfoInfoById(ob.getSiteId(), ob.getId());
if (data == null) {
done = insertOtherEquipmenttofflineInfoData(ob);
} else {
done = updateOtherEquipmenttofflineInfoInfoData(ob);
}
}
return done;
}
public OfflineDataModel getOtherEquipmenttofflineInfoInfoById(long siteId, int id) {
String query = "Select * FROM OtherEquipmentDataofflineinfo WHERE siteId = '" + siteId + "' AND id='" + id + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OfflineDataModel ob = new OfflineDataModel();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateOtherEquipmenttofflineInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate OtherEquipmenttofflineInfoInfo list data
private void populateOtherEquipmenttofflineInfoData(Cursor cursor, OfflineDataModel ob) {
ob.setId(cursor.getInt(0));
ob.setSiteId(cursor.getLong(1));
ob.setEquipmendatajson(cursor.getString(2));
ob.setFiledata(cursor.getString(3));
}
public boolean insertOtherEquipmenttofflineInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateOtherEquipmenttofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("OtherEquipmentDataofflineinfo", null, values);
db.close();
return i > 0;
}
public boolean updateOtherEquipmenttofflineInfoInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateOtherEquipmenttofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("OtherEquipmentDataofflineinfo", values, " id = '" + +ob.getId() + "' AND siteId = '"
+ ob.getSiteId() + "'", null);
db.close();
return i > 0;
}
public void populateOtherEquipmenttofflineInfoValueData(ContentValues
values, OfflineDataModel ob) {
values.put("siteId", ob.getSiteId());
values.put("equipmendatajson", ob.getEquipmendatajson());
values.put("filedata", ob.getFiledata());
}
public ArrayList<OfflineDataModel> getAllOtherEquipmenttofflineInfoList() {
String query = "Select * FROM OtherEquipmentDataofflineinfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OfflineDataModel> list = new ArrayList<OfflineDataModel>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OfflineDataModel ob = new OfflineDataModel();
populateOtherEquipmenttofflineInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Add Offlinr Plan Data
*
* @param planList
* @return
*/
public boolean addPlanDataList(List<Data> planList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
for (int i = 0; i < planList.size(); i++) {
ContentValues values = new ContentValues();
values.put("Plan_Id", planList.get(i).getPlan_Id());
values.put("Site_Id", planList.get(i).getSite_Id());
values.put("CustomerSiteId", planList.get(i).getCustomerSiteId());
values.put("SiteName", planList.get(i).getSiteName());
values.put("Plandate", planList.get(i).getPlandate());
values.put("Task_Id", planList.get(i).getTask_Id());
values.put("Task", planList.get(i).getTask());
values.put("Activity_Id", planList.get(i).getActivity_Id());
values.put("Activity", planList.get(i).getActivity());
values.put("FEId", planList.get(i).getFEId());
values.put("FEName", planList.get(i).getFEName());
db.insert("PlanListinfo", null, values);
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Plan Data-------------------------------------------
public ArrayList<Data> getPlanListdb() {
ArrayList<Data> planListData = new ArrayList<Data>();
String selectQuery = "";
selectQuery = "SELECT * FROM PlanListinfo";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
Data plandata = new Data();
plandata.setPlan_Id(cursor.getString(cursor.getColumnIndex("Plan_Id")));
plandata.setSite_Id(cursor.getString(cursor.getColumnIndex("Site_Id")));
plandata.setCustomerSiteId(cursor.getString(cursor.getColumnIndex("CustomerSiteId")));
plandata.setSiteName(cursor.getString(cursor.getColumnIndex("SiteName")));
plandata.setPlandate(cursor.getString(cursor.getColumnIndex("Plandate")));
plandata.setTask_Id(cursor.getString(cursor.getColumnIndex("Task_Id")));
plandata.setTask(cursor.getString(cursor.getColumnIndex("Task")));
plandata.setActivity_Id(cursor.getString(cursor.getColumnIndex("Activity_Id")));
plandata.setActivity(cursor.getString(cursor.getColumnIndex("Activity")));
plandata.setFEId(cursor.getString(cursor.getColumnIndex("FEId")));
plandata.setFEName(cursor.getString(cursor.getColumnIndex("FEName")));
planListData.add(plandata);
} while (cursor.moveToNext());
}
db.close();
return planListData;
}
public boolean insertSurveySiteDetail(String ob) {
ContentValues values = new ContentValues();
values.put("surveySitelist", ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SurveySiteDetail", null, values);
db.close();
return i > 0;
}
public String getAllSurveySiteDetail() {
String query = "Select * FROM SurveySiteDetail";
SQLiteDatabase db = this.getReadableDatabase();
String data = null;
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
data = cursor.getString(0);
cursor.moveToNext();
}
}
db.close();
return data;
}
/**
* GetSurveySpinnerList
* @param ob
* @return
*/
public boolean insertSSurveySpinnerList (String ob) {
ContentValues values = new ContentValues();
values.put("SurveySpinner", ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SurveySpinnerList", null, values);
db.close();
return i > 0;
}
public String getAllSurveySpinnerList () {
String query = "Select * FROM SurveySpinnerList";
SQLiteDatabase db = this.getReadableDatabase();
String data = null;
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
data = cursor.getString(0);
cursor.moveToNext();
}
}
db.close();
return data;
}
/**
* get RCA List
*
* @param ob
* @return
*/
public boolean insertRCAListData(OrderData ob) {
ContentValues values = new ContentValues();
populateRCAListValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("RCAListInfo", null, values);
db.close();
return i > 0;
}
public void populateRCAListValueData(ContentValues values, OrderData ob) {
values.put("RCATypeId", ob.getRCATypeId());
values.put("RCATypeName", ob.getRCATypeName());
if (ob.getData() != null && ob.getData().size() > 0) {
String orderdata = new Gson().toJson(ob.getData());
values.put("jsonDataStr", orderdata);
}
}
private void populateRCAListData(Cursor cursor, OrderData ob) {
ob.setRCATypeId(cursor.getInt(0));
ob.setRCATypeName(cursor.getString(1));
ArrayList<Data> datajson = new Gson().fromJson(cursor.getString(2), new TypeToken<ArrayList<Data>>() {
}.getType());
ob.setData(datajson);
}
public ArrayList<OrderData> getAllRCAList() {
String query = "Select * FROM RCAListInfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OrderData> list = new ArrayList<OrderData>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OrderData ob = new OrderData();
populateRCAListData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
}
| UTF-8 | Java | 83,015 | java | AtmDatabase.java | Java | [
{
"context": "tion\";\n\n private static final String KEY_ID = \"id\";\n private static final String USERID = \"user_",
"end": 3265,
"score": 0.9696952700614929,
"start": 3263,
"tag": "KEY",
"value": "id"
},
{
"context": "= \"id\";\n private static final String USERID = \"us... | null | [] | package com.telecom.ast.sitesurvey.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.telecom.ast.sitesurvey.ASTGson;
import com.telecom.ast.sitesurvey.constants.Constant;
import com.telecom.ast.sitesurvey.constants.Contants;
import com.telecom.ast.sitesurvey.model.OfflineDataModel;
import com.telecom.ast.sitesurvey.model.BasicDataModel;
import com.telecom.ast.sitesurvey.model.BtsInfoData;
import com.telecom.ast.sitesurvey.model.CircleMasterDataModel;
import com.telecom.ast.sitesurvey.model.CompanyDetail;
import com.telecom.ast.sitesurvey.model.ContentData;
import com.telecom.ast.sitesurvey.model.Data;
import com.telecom.ast.sitesurvey.model.DistrictMasterDataModel;
import com.telecom.ast.sitesurvey.model.EbMeterDataModel;
import com.telecom.ast.sitesurvey.model.EquipCapacityDataModel;
import com.telecom.ast.sitesurvey.model.EquipDescriptionDataModel;
import com.telecom.ast.sitesurvey.model.EquipMakeDataModel;
import com.telecom.ast.sitesurvey.model.EquipTypeDataModel;
import com.telecom.ast.sitesurvey.model.EquipmentMasterDataModel;
import com.telecom.ast.sitesurvey.model.OrderData;
import com.telecom.ast.sitesurvey.model.SSAmasterDataModel;
import com.telecom.ast.sitesurvey.model.SelectedEquipmentDataModel;
import com.telecom.ast.sitesurvey.model.SiteMasterDataModel;
import com.telecom.ast.sitesurvey.model.SiteOnBatteryBankDataModel;
import com.telecom.ast.sitesurvey.model.SiteOnDG;
import com.telecom.ast.sitesurvey.model.SiteOnEbDataModel;
import java.util.ArrayList;
import java.util.List;
public class AtmDatabase extends SQLiteOpenHelper {
//http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "AST_Survey.db";
//private static final String DATABASE_NAME = Contants.outputDirectoryLocation + "AST_Survey.db";
// table name
private static final String TABLE_CIRCLE = "circle";
private static final String TABLE_DISTRICT = "district";
private static final String TABLE_SSA = "SSA";
private static final String TABLE_SITE = "site";
private static final String TABLE_EQUIPMENT = "equipment";
private static final String TABLE_BASIC_DATA = "basic_data";
private static final String TABLE_EQUIPMENT_SELECTED = "eq_battery";
private static final String TABLE_EB_METER = "eb_meter";
private static final String TABLE_SITE_ON_BB = "site_on_bb";
private static final String TABLE_SITE_ON_DG = "site_on_dg";
private static final String TABLE_SITE_ON_EB = "site_on_eb";
private static final String TABLE_EQUIPMENT_TYPE = "equipment_type";
private static final String TABLE_EQUIPMENT_MAKE = "equipment_make";
private static final String TABLE_EQUIPMENT_CAPACITY = "equipment_capacity";
private static final String TABLE_EQUIPMENT_DESCRIPTION = "equipment_description";
private static final String KEY_ID = "id";
private static final String USERID = "user_id";
// Equipment Type Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_TYPE_NAME = "type_name";
private static final String EQUIPMENT_TYPE_ID = "type_id";
private static final String EQUIPMENT_TYPE_LAST_UPDATED = "last_updated";
// Equipment Make Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_MAKE_NAME = "make_name";
private static final String EQUIPMENT_MAKE_ID = "make_id";
private static final String EQUIPMENT_MAKE_TYPE_ID = "make_type_id";
private static final String EQUIPMENT_MAKE_LAST_UPDATED = "last_updated";
// Equipment Capacity Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_CAPACITY_NAME = "capacity_name";
private static final String EQUIPMENT_CAPACITY_ID = "capacity_id";
private static final String EQUIPMENT_CAPACITY_MAKE_ID = "capacity_make_id";
private static final String EQUIPMENT_CAPACITY_LAST_UPDATED = "last_updated";
// Equipment Description Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_DESCRIPTION_NAME = "description_name";
private static final String EQUIPMENT_DESCRIPTION_ID = "description_id";
private static final String EQUIPMENT_DESCRIPTION_CAPACITY_ID = "description_capacity_id";
private static final String EQUIPMENT_DESCRIPTION_LAST_UPDATED = "last_updated";
// Circle Table Columns
//private static final String KEY_ID = "id";
private static final String CIRCLE_NAME = "circle_name";
private static final String CIRCLE_ID = "circle_id";
private static final String CIRCLE_LAST_UPDATED = "last_updated";
// District Table Columns
//private static final String KEY_ID = "id";
private static final String DISTRICT_NAME = "district_name";
private static final String DISTRICT_ID = "district_id";
private static final String Tehsil_NAME = "tehsil_name";
private static final String DISTRICT_CIRCLE_ID = "circle_id";
private static final String DISTRICT_LAST_UPDATED = "last_updated";
// SSA Table Columns
//private static final String KEY_ID = "id";
private static final String SSA_NAME = "SSA_name";
private static final String SSA_ID = "SSA_id";
private static final String SSA_CIRCLE_ID = "SSA_circle_id";
private static final String SSA_LAST_UPDATED = "last_updated";
// Site Table Columns
//private static final String KEY_ID = "id";
private static final String SITE_ID = "site_id";
private static final String SITE_NAME = "site_name";
private static final String SITE_CUSTOMER_SITE_ID = "customer_site_id";
private static final String SITE_CIRCLE_ID = "circle_id";
private static final String SITE_CIRCLE_NAME = "circle_name";
private static final String SITE_SSA_ID = "SSA_id";
private static final String SITE_SSA_NAME = "SSA_name";
private static final String SITE_Address = "Address";
private static final String SITE_City = "City";
private static final String SITE_LAST_UPDATED = "last_updated";
// Equipment Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIP_ID = "equip_id";
private static final String EQUIP_TYPE = "equip_type";
private static final String EQUIP_CODE = "equip_code";
private static final String EQUIP_DES = "equip_des";
private static final String EQUIP_MAKE = "equip_make";
private static final String EQUIP_MODEL = "equip_model";
private static final String EQUIP_RATING = "equip_rating";
private static final String EQUIP_LAST_UPDATED = "last_updated";
// BASIC DATA FORM Table Columns
//private static final String KEY_ID = "id";
private static final String BASIC_DATE_TIME = "date_time";
private static final String BASIC_SURVEYOR_NAME = "surveyor_name";
private static final String BASIC_SITE_ID = "site_id";
private static final String BASIC_SITE_NAME = "site_name";
private static final String BASIC_ADDRESS = "address";
private static final String BASIC_CIRCLE = "circle";
private static final String BASIC_SSA = "ssa";
private static final String BASIC_DISTRICT = "district";
private static final String BASIC_CITY = "city";
private static final String BASIC_PINCODE = "pincode";
// EQUIPMENT FORM Table Columns
//private static final String KEY_ID = "id";
private static final String EQUIPMENT_FORM_TYPE = "equptype";
private static final String EQUIPMENT_MAKE = "make";
private static final String EQUIPMENT_MODEL = "model";
private static final String EQUIPMENT_CAPACITY = "capacity";
private static final String EQUIPMENT_FORM_MAKE_ID = "makeId";
private static final String EQUIPMENT_FORM_MODEL_ID = "modelId";
private static final String EQUIPMENT_FORM_CAPACITY_ID = "capacityId";
private static final String EQUIPMENT_SERIAL_NUMBER = "serial_number";
private static final String EQUIPMENT_DATE_OF_MANUFACTURING = "date_of_manufacturing";
private static final String EQUIPMENT_DESCRIPTION = "description";
private static final String EQUIPMENT_ID = "equipment_id";
private static final String EQUIPMENT_PHOTO_1 = "photo1";
private static final String EQUIPMENT_PHOTO_2 = "photo2";
private static final String EQUIPMENT_PHOTO_1_NAME = "photo1_name";
private static final String EQUIPMENT_PHOTO_2_NAME = "photo2_name";
private static final String EQUIPMENT_TYPE = "type";
private static final String EQUIPMENT_NUMBER_OF_AIR_CONDITIONER = "num_of_AC";
private static final String EQUIPMENT_SITE_ID = "site_id";
// EB Meter FORM Table Columns
//private static final String KEY_ID = "id";
private static final String METER_READING = "meter_reading";
private static final String METER_NUMBER = "meter_number";
private static final String AVAILABLE_HOURS = "available_hours";
private static final String SUPPLY_SINGLE_PHASE = "supply_single_phase";
private static final String SUPPLY_THREE_PHASE = "supply_three_phase";
private static final String EB_METER_PHOTO_1 = "photo1";
private static final String EB_METER_PHOTO_2 = "photo2";
private static final String EB_METER_PHOTO_1_NAME = "photo1_name";
private static final String EB_METER_PHOTO_2_NAME = "photo2_name";
private static final String EB_METER_SITE_ID = "site_id";
// Site On Battery Bank FORM Table Columns
//private static final String KEY_ID = "id";
private static final String BB_DISCHARGE_CURRENT = "discharge_current";
private static final String BB_DISCHARGE_VOLTAGE = "discharge_voltage";
private static final String BB_SITE_ID = "site_id";
// SITE ON DG SET FORM Table Columns
//private static final String KEY_ID = "id";
private static final String DG_CURRENT = "dg_current";
private static final String DG_FREQUENCY = "dg_frequency";
private static final String DG_VOLTAGE = "dg_voltage";
private static final String DG_BATTERY_CHARGE_CURRENT = "battery_charge_current";
private static final String DG_BATTERY_VOLTAGE = "battery_voltage";
private static final String DG_SITE_ID = "site_id";
// SITE ON EB FORM Table Columns
//private static final String KEY_ID = "id";
private static final String GRID_CURRENT = "grid_current";
private static final String GRID_VOLTAGE = "grid_voltage";
private static final String GRID_FREQUENCY = "grid_frequency";
private static final String GRID_SITE_ID = "grid_site_id";
public AtmDatabase(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_CIRCLE_TABLE = "CREATE TABLE " + TABLE_CIRCLE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ CIRCLE_ID + " TEXT," + CIRCLE_NAME + " TEXT,"
+ CIRCLE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_CIRCLE_TABLE);
String CREATE_DISTRICT_TABLE = "CREATE TABLE " + TABLE_DISTRICT + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ DISTRICT_ID + " TEXT," + DISTRICT_NAME + " TEXT,"
+ Tehsil_NAME + " TEXT," + DISTRICT_CIRCLE_ID + " TEXT," + DISTRICT_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_DISTRICT_TABLE);
String CREATE_SSA_TABLE = "CREATE TABLE " + TABLE_SSA + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ SSA_ID + " TEXT," + SSA_NAME + " TEXT,"
+ SSA_CIRCLE_ID + " TEXT," + SSA_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_SSA_TABLE);
String CREATE_SITE_TABLE = "CREATE TABLE " + TABLE_SITE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + SITE_ID + " TEXT," + SITE_NAME + " TEXT,"
+ SITE_CUSTOMER_SITE_ID + " TEXT," + SITE_CIRCLE_ID + " TEXT,"
+ SITE_CIRCLE_NAME + " TEXT," + SITE_SSA_ID + " TEXT," + SITE_SSA_NAME + " TEXT,"
+ SITE_Address + " TEXT," + SITE_City + " TEXT," + SITE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_SITE_TABLE);
String CREATE_EQUIPMENT_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIP_ID + " TEXT," + EQUIP_TYPE + " TEXT,"
+ EQUIP_CODE + " TEXT," + EQUIP_DES + " TEXT,"
+ EQUIP_MAKE + " TEXT," + EQUIP_MODEL + " TEXT," + EQUIP_RATING + " TEXT,"
+ EQUIP_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_EQUIPMENT_TABLE);
String CREATE_BASIC_DATA_TABLE = "CREATE TABLE " + TABLE_BASIC_DATA + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + BASIC_DATE_TIME + " TEXT," + BASIC_SURVEYOR_NAME + " TEXT,"
+ BASIC_SITE_ID + " TEXT," + BASIC_SITE_NAME + " TEXT," + BASIC_ADDRESS + " TEXT," + BASIC_CIRCLE + " TEXT,"
+ BASIC_SSA + " TEXT," + BASIC_DISTRICT + " TEXT," + BASIC_CITY + " TEXT," + BASIC_PINCODE + " TEXT, " + USERID + " TEXT)";
db.execSQL(CREATE_BASIC_DATA_TABLE);
String CREATE_EQUIPMENT_SELECTED_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_SELECTED + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_MAKE + " TEXT," + EQUIPMENT_MODEL + " TEXT,"
+ EQUIPMENT_CAPACITY + " TEXT," + EQUIPMENT_SERIAL_NUMBER + " TEXT," + EQUIPMENT_DATE_OF_MANUFACTURING + " TEXT,"
+ EQUIPMENT_DESCRIPTION + " TEXT," + EQUIPMENT_ID + " TEXT," + EQUIPMENT_PHOTO_1 + " TEXT,"
+ EQUIPMENT_PHOTO_2 + " TEXT," + EQUIPMENT_PHOTO_1_NAME + " TEXT," + EQUIPMENT_PHOTO_2_NAME + " TEXT,"
+ EQUIPMENT_TYPE + " TEXT," + EQUIPMENT_NUMBER_OF_AIR_CONDITIONER + " TEXT, " + EQUIPMENT_SITE_ID + " TEXT, "
+ EQUIPMENT_FORM_MAKE_ID + " TEXT," + EQUIPMENT_FORM_MODEL_ID + " TEXT, " + EQUIPMENT_FORM_CAPACITY_ID + " TEXT, "
+ EQUIPMENT_FORM_TYPE + " TEXT, " + USERID + " TEXT)";
db.execSQL(CREATE_EQUIPMENT_SELECTED_TABLE);
String CREATE_EB_METER_TABLE = "CREATE TABLE " + TABLE_EB_METER + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + METER_READING + " TEXT," + METER_NUMBER + " TEXT,"
+ AVAILABLE_HOURS + " TEXT," + SUPPLY_SINGLE_PHASE + " TEXT," + SUPPLY_THREE_PHASE + " TEXT,"
+ EB_METER_PHOTO_1 + " " + "TEXT,"
+ EB_METER_PHOTO_2 + " TEXT," + EB_METER_PHOTO_1_NAME + " TEXT,"
+ EB_METER_PHOTO_2_NAME + " TEXT," + EB_METER_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_EB_METER_TABLE);
String CREATE_SITE_ON_BB_TABLE = "CREATE TABLE " + TABLE_SITE_ON_BB + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + BB_DISCHARGE_CURRENT + " TEXT," + BB_DISCHARGE_VOLTAGE + " TEXT,"
+ BB_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_SITE_ON_BB_TABLE);
String CREATE_SITE_ON_DG_TABLE = "CREATE TABLE " + TABLE_SITE_ON_DG + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + DG_CURRENT + " TEXT," + DG_FREQUENCY + " TEXT,"
+ DG_VOLTAGE + " TEXT," + DG_BATTERY_CHARGE_CURRENT + " TEXT," + DG_BATTERY_VOLTAGE + " TEXT,"
+ DG_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_SITE_ON_DG_TABLE);
String CREATE_SITE_ON_EB_TABLE = "CREATE TABLE " + TABLE_SITE_ON_EB + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + GRID_CURRENT + " TEXT," + GRID_VOLTAGE + " TEXT,"
+ GRID_FREQUENCY + " TEXT," + GRID_SITE_ID + " TEXT," + USERID + " TEXT)";
db.execSQL(CREATE_SITE_ON_EB_TABLE);
String CREATE_TYPE_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_TYPE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_TYPE_NAME + " TEXT," + EQUIPMENT_TYPE_ID + " TEXT,"
+ EQUIPMENT_TYPE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_TYPE_TABLE);
String CREATE_MAKE_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_MAKE + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_MAKE_NAME + " TEXT," + EQUIPMENT_MAKE_ID + " TEXT,"
+ EQUIPMENT_MAKE_TYPE_ID + " TEXT," + EQUIPMENT_MAKE_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_MAKE_TABLE);
String CREATE_CAPACITY_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_CAPACITY + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_CAPACITY_NAME + " TEXT," + EQUIPMENT_CAPACITY_ID + " TEXT,"
+ EQUIPMENT_CAPACITY_MAKE_ID + " TEXT," + EQUIPMENT_CAPACITY_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_CAPACITY_TABLE);
String CREATE_DESCRIPTION_TABLE = "CREATE TABLE " + TABLE_EQUIPMENT_DESCRIPTION + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement," + EQUIPMENT_DESCRIPTION_ID + " TEXT," + EQUIPMENT_DESCRIPTION_NAME + " TEXT,"
+ EQUIPMENT_DESCRIPTION_CAPACITY_ID + " TEXT," + EQUIPMENT_DESCRIPTION_LAST_UPDATED + " TEXT)";
db.execSQL(CREATE_DESCRIPTION_TABLE);
String CREATE_BTSInfo_TABLE = "CREATE TABLE BTSInfo(sno INTEGR,type TEXT,btsName TEXT, CabinetQty TEXT,NoofDCDBBox TEXT,NoofKroneBox TEXT,NoofTransmissionRack TEXT," +
"Microwave TEXT,OperatorType TEXT,TypeofBTS TEXT, BTSMake TEXT,YearInstallationSite TEXT,PostionAntennaTower TEXT)";
db.execSQL(CREATE_BTSInfo_TABLE);
String CREATE_OrderData_TABLE = "CREATE TABLE OrderDataInfo(CircleId INTEGR,CircleName TEXT,CompanyDetail TEXT)";
db.execSQL(CREATE_OrderData_TABLE);
String CREATE_SITELIST_TABLE = "CREATE TABLE SiteList(SiteId INTEGER,SiteName TEXT,CustomerSiteId TEXT,CustomerName TEXT,CircleId INTEGER,CircleName TEXT,SSAName TEXT,SSAId INTEGER,Address TEXT,City TEXT,DistictId INTEGER,DistrictName TEXT,TehsilId INTEGER,TehsilName TEXT)";
db.execSQL(CREATE_SITELIST_TABLE);
String CREATE_SITELISTNEW_TABLE = "CREATE TABLE SiteListnew(id INTEGER, siteListData TEXT)";
db.execSQL(CREATE_SITELISTNEW_TABLE);
//Offline Data
String CREATE_BasicDataoffline_TABLE = "CREATE TABLE BasicDataofflineinfo(siteId INTEGR,basicdatajson TEXT)";
db.execSQL(CREATE_BasicDataoffline_TABLE);
String CREATE_Equipmentoffline_TABLE = "CREATE TABLE EquipmentDataofflineinfo(siteId INTEGR,equipmentId INTEGR," +
"itemid INTEGR ,equipmendatajson TEXT,filedata TEXT)";
db.execSQL(CREATE_Equipmentoffline_TABLE);
String CREATE_OtherEquipoffline_TABLE = "CREATE TABLE OtherEquipmentDataofflineinfo(id INTEGER PRIMARY KEY autoincrement,siteId INTEGR," +
"equipmendatajson TEXT,filedata TEXT)";
db.execSQL(CREATE_OtherEquipoffline_TABLE);
String CREATE_planlist_TABLE = "CREATE TABLE PlanListinfo(Plan_Id TEXT,Site_Id TEXT," +
"CustomerSiteId TEXT,SiteName TEXT,Plandate TEXT,Task_Id TEXT,Task TEXT,Activity_Id TEXT,Activity TEXT, FEId TEXT,FEName TEXT)";
db.execSQL(CREATE_planlist_TABLE);
String CREATE_SurveySiteDetail_TABLE = "CREATE TABLE SurveySiteDetail(surveySitelist TEXT)";
db.execSQL(CREATE_SurveySiteDetail_TABLE);
String CREATE_SurveySpinnerList_TABLE = "CREATE TABLE SurveySpinnerList(SurveySpinner TEXT)";
db.execSQL(CREATE_SurveySpinnerList_TABLE);
String CREATE_RCAList_TABLE = "CREATE TABLE RCAListInfo(RCATypeId INTEGER ,RCATypeName TEXT,jsonDataStr TEXT)";
db.execSQL(CREATE_RCAList_TABLE);
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + TABLE_CIRCLE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_DISTRICT);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SSA);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_BASIC_DATA);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_SELECTED);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EB_METER);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE_ON_BB);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE_ON_DG);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SITE_ON_EB);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_TYPE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_MAKE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_CAPACITY);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EQUIPMENT_DESCRIPTION);
db.execSQL("DROP TABLE IF EXISTS BTSInfo");
db.execSQL("DROP TABLE IF EXISTS OrderDataInfo");
db.execSQL("DROP TABLE IF EXISTS SiteList");
db.execSQL("DROP TABLE IF EXISTS SiteListnew");
db.execSQL("DROP TABLE IF EXISTS BasicDataofflineinfo");
db.execSQL("DROP TABLE IF EXISTS EquipmentDataofflineinfo");
db.execSQL("DROP TABLE IF EXISTS OtherEquipmentDataofflineinfo");
db.execSQL("DROP TABLE IF EXISTS PlanListinfo");
db.execSQL("DROP TABLE IF EXISTS SurveySiteDetail");
db.execSQL("DROP TABLE IF EXISTS SurveySpinnerList");
db.execSQL("DROP TABLE IF EXISTS RCAListInfo");
onCreate(db);
}
/**
* All CRUD(Create, Read, Update, Delete) Operations
*/
// -------------------------------Adding new Circle---------------------------------------
public boolean addCircleData(List<CircleMasterDataModel> circleDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < circleDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(CIRCLE_NAME, circleDataList.get(i).getCircleName());
values.put(CIRCLE_ID, circleDataList.get(i).getCircleId());
values.put(CIRCLE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_CIRCLE, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Circle Data-------------------------------------------
public ArrayList<CircleMasterDataModel> getAllCircleData(String sortType) {
ArrayList<CircleMasterDataModel> circleList = new ArrayList<CircleMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_CIRCLE;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
CircleMasterDataModel circleModel = new CircleMasterDataModel();
circleModel.setCircleName(cursor.getString(cursor.getColumnIndex(CIRCLE_NAME)));
circleModel.setCircleId(cursor.getString(cursor.getColumnIndex(CIRCLE_ID)));
circleModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(CIRCLE_LAST_UPDATED)));
// Adding contact to list
circleList.add(circleModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return circleList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new SSA---------------------------------------
public boolean addDistrictData(List<DistrictMasterDataModel> districtDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < districtDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(DISTRICT_ID, districtDataList.get(i).getDistrictId());
values.put(DISTRICT_NAME, districtDataList.get(i).getDistrictName());
values.put(Tehsil_NAME, districtDataList.get(i).getTehsilListStr());
values.put(DISTRICT_LAST_UPDATED, time);
values.put(DISTRICT_CIRCLE_ID, districtDataList.get(i).getCircleId());
// Inserting Row
db.insert(TABLE_DISTRICT, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All District Data-------------------------------------------
public ArrayList<DistrictMasterDataModel> getAllDistrictData(String sortType, String circleId) {
ArrayList<DistrictMasterDataModel> districtList = new ArrayList<DistrictMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_DISTRICT + " WHERE " + DISTRICT_CIRCLE_ID + " = " + circleId;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
DistrictMasterDataModel districtMasterDataModel = new DistrictMasterDataModel();
districtMasterDataModel.setCircleId(cursor.getString(cursor.getColumnIndex(DISTRICT_CIRCLE_ID)));
districtMasterDataModel.setDistrictName(cursor.getString(cursor.getColumnIndex(DISTRICT_NAME)));
districtMasterDataModel.setTehsilListStr(cursor.getString(cursor.getColumnIndex(Tehsil_NAME)));
districtMasterDataModel.setDistrictId(cursor.getString(cursor.getColumnIndex(DISTRICT_ID)));
districtMasterDataModel.setDistrictLastUpdated(cursor.getString(cursor.getColumnIndex(DISTRICT_LAST_UPDATED)));
// Adding contact to list
districtList.add(districtMasterDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return districtList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new SSA---------------------------------------
public boolean addSSAData(List<SSAmasterDataModel> SSADataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < SSADataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(SSA_ID, SSADataList.get(i).getSSAid());
values.put(SSA_NAME, SSADataList.get(i).getSSAname());
values.put(SSA_CIRCLE_ID, SSADataList.get(i).getCircleId());
values.put(SSA_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_SSA, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All SSA Data-------------------------------------------
public ArrayList<SSAmasterDataModel> getAllSSAData(String sortType, String columnValue) {
ArrayList<SSAmasterDataModel> SSAList = new ArrayList<SSAmasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_SSA + " WHERE " + SSA_CIRCLE_ID + " = " + columnValue;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
SSAmasterDataModel ssaDataModel = new SSAmasterDataModel();
ssaDataModel.setCircleId(cursor.getString(cursor.getColumnIndex(SSA_CIRCLE_ID)));
ssaDataModel.setSSAid(cursor.getString(cursor.getColumnIndex(SSA_ID)));
ssaDataModel.setSSAname(cursor.getString(cursor.getColumnIndex(SSA_NAME)));
ssaDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(SSA_LAST_UPDATED)));
// Adding contact to list
SSAList.add(ssaDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return SSAList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site---------------------------------------
public boolean addSiteData(List<SiteMasterDataModel> siteDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(SITE_ID, siteDataList.get(i).getSiteId());
values.put(SITE_NAME, siteDataList.get(i).getSiteName());
values.put(SITE_CUSTOMER_SITE_ID, siteDataList.get(i).getCustomerSiteId());
values.put(SITE_CIRCLE_ID, siteDataList.get(i).getCircleId());
values.put(SITE_CIRCLE_NAME, siteDataList.get(i).getCircleName());
values.put(SITE_SSA_ID, siteDataList.get(i).getSiteId());
values.put(SITE_SSA_NAME, siteDataList.get(i).getSiteName());
values.put(SITE_Address, siteDataList.get(i).getAddress());
values.put(SITE_City, siteDataList.get(i).getCity());
values.put(SITE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_SITE, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Site Data-------------------------------------------
public ArrayList<SiteMasterDataModel> getAllSiteData(String sortType) {
ArrayList<SiteMasterDataModel> siteList = new ArrayList<SiteMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_SITE;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
SiteMasterDataModel siteDataModel = new SiteMasterDataModel();
siteDataModel.setSiteId(cursor.getString(cursor.getColumnIndex(SITE_ID)));
siteDataModel.setSiteName(cursor.getString(cursor.getColumnIndex(SITE_NAME)));
siteDataModel.setCustomerSiteId(cursor.getString(cursor.getColumnIndex(SITE_CUSTOMER_SITE_ID)));
siteDataModel.setCircleId(cursor.getString(cursor.getColumnIndex(SITE_CIRCLE_ID)));
siteDataModel.setCircleName(cursor.getString(cursor.getColumnIndex(SITE_CIRCLE_NAME)));
siteDataModel.setSsaName(cursor.getString(cursor.getColumnIndex(SITE_SSA_NAME)));
siteDataModel.setSsaId(cursor.getString(cursor.getColumnIndex(SITE_SSA_ID)));
siteDataModel.setAddress(cursor.getString(cursor.getColumnIndex(SITE_Address)));
siteDataModel.setCity(cursor.getString(cursor.getColumnIndex(SITE_City)));
siteDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(SITE_LAST_UPDATED)));
// Adding contact to list
siteList.add(siteDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return siteList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Data---------------------------------------
public boolean addEquipData(List<EquipmentMasterDataModel> equipDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < equipDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIP_ID, equipDataList.get(i).getEquipId());
values.put(EQUIP_TYPE, equipDataList.get(i).getEquipType());
values.put(EQUIP_CODE, equipDataList.get(i).getEquipCode());
values.put(EQUIP_DES, equipDataList.get(i).getEquipDes());
values.put(EQUIP_MAKE, equipDataList.get(i).getEquipMake());
values.put(EQUIP_MODEL, equipDataList.get(i).getEquipModel());
values.put(EQUIP_RATING, equipDataList.get(i).getEquipRating());
values.put(EQUIP_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Equipment Data-------------------------------------------
public ArrayList<EquipmentMasterDataModel> getAllEquipmentData(String sortType, String equipmentType) {
ArrayList<EquipmentMasterDataModel> equipList = new ArrayList<EquipmentMasterDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
if (equipmentType.equals("NA")) {
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT;
} else {
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT + " WHERE " + EQUIP_TYPE + " = '" + equipmentType + "'";
}
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipmentMasterDataModel equipDataModel = new EquipmentMasterDataModel();
equipDataModel.setEquipId(cursor.getString(cursor.getColumnIndex(EQUIP_ID)));
equipDataModel.setEquipType(cursor.getString(cursor.getColumnIndex(EQUIP_TYPE)));
equipDataModel.setEquipCode(cursor.getString(cursor.getColumnIndex(EQUIP_CODE)));
equipDataModel.setEquipDes(cursor.getString(cursor.getColumnIndex(EQUIP_DES)));
equipDataModel.setEquipMake(cursor.getString(cursor.getColumnIndex(EQUIP_MAKE)));
equipDataModel.setEquipModel(cursor.getString(cursor.getColumnIndex(EQUIP_MODEL)));
equipDataModel.setEquipRating(cursor.getString(cursor.getColumnIndex(EQUIP_RATING)));
equipDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(EQUIP_LAST_UPDATED)));
// Adding contact to list
equipList.add(equipDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipList;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Data---------------------------------------
public boolean addNewEquipData(ArrayList<EquipTypeDataModel> equipTypeList, ArrayList<EquipMakeDataModel> equipMakeList,
ArrayList<EquipCapacityDataModel> equipCapacityList, ArrayList<EquipDescriptionDataModel> equipDescriptionList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < equipTypeList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_TYPE_ID, equipTypeList.get(i).getId());
values.put(EQUIPMENT_TYPE_NAME, equipTypeList.get(i).getName());
values.put(EQUIPMENT_TYPE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_TYPE, null, values);
//return insert > 0;
}
for (int i = 0; i < equipMakeList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_MAKE_ID, equipMakeList.get(i).getId());
values.put(EQUIPMENT_MAKE_NAME, equipMakeList.get(i).getName());
values.put(EQUIPMENT_MAKE_TYPE_ID, equipMakeList.get(i).getTypeId());
values.put(EQUIPMENT_MAKE_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_MAKE, null, values);
}
for (int i = 0; i < equipCapacityList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_CAPACITY_ID, equipCapacityList.get(i).getId());
values.put(EQUIPMENT_CAPACITY_NAME, equipCapacityList.get(i).getName());
values.put(EQUIPMENT_CAPACITY_MAKE_ID, equipCapacityList.get(i).getMakeId());
values.put(EQUIPMENT_CAPACITY_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_CAPACITY, null, values);
}
for (int i = 0; i < equipDescriptionList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_DESCRIPTION_ID, equipDescriptionList.get(i).getId());
values.put(EQUIPMENT_DESCRIPTION_NAME, equipDescriptionList.get(i).getName());
values.put(EQUIPMENT_DESCRIPTION_CAPACITY_ID, equipDescriptionList.get(i).getCapacityId());
values.put(EQUIPMENT_DESCRIPTION_LAST_UPDATED, time);
// Inserting Row
db.insert(TABLE_EQUIPMENT_DESCRIPTION, null, values);
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting Equipment Data-------------------------------------------
public ArrayList<EquipMakeDataModel> getEquipmentData(String equipmentType) {
ArrayList<EquipMakeDataModel> equipMakeList = new ArrayList<EquipMakeDataModel>();
String selectQuery = "";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_TYPE + " WHERE " + EQUIPMENT_TYPE_NAME + " = '" + equipmentType + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipMakeDataModel equipMakeDataModel = new EquipMakeDataModel();
equipMakeDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_TYPE_ID)));
equipMakeDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_TYPE_NAME)));
equipMakeDataModel.setLastUpdated(cursor.getString(cursor.getColumnIndex(EQUIPMENT_TYPE_LAST_UPDATED)));
// Adding contact to list
equipMakeList.add(equipMakeDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipMakeList;
}
public ArrayList<EquipMakeDataModel> getEquipmentMakeData(String sortType, String equipmentType) {
ArrayList<EquipMakeDataModel> equipMakeList = new ArrayList<EquipMakeDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_MAKE + " WHERE " + EQUIPMENT_MAKE_TYPE_ID + " = '" + equipmentType + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipMakeDataModel equipMakeDataModel = new EquipMakeDataModel();
equipMakeDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_MAKE_ID)));
equipMakeDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_MAKE_NAME)));
equipMakeDataModel.setLastUpdated(cursor.getString(cursor.getColumnIndex(EQUIPMENT_MAKE_LAST_UPDATED)));
// Adding contact to list
equipMakeList.add(equipMakeDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipMakeList;
}
public ArrayList<EquipCapacityDataModel> getEquipmentCapacityData(String sortType, String makeName) {
ArrayList<EquipCapacityDataModel> equipCapacityList = new ArrayList<EquipCapacityDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_CAPACITY + " WHERE " + EQUIPMENT_CAPACITY_MAKE_ID + " = '" + makeName + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipCapacityDataModel equipCapacityDataModel = new EquipCapacityDataModel();
equipCapacityDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_CAPACITY_ID)));
equipCapacityDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_CAPACITY_NAME)));
equipCapacityDataModel.setLastUpdatedDate(cursor.getString(cursor.getColumnIndex(EQUIPMENT_CAPACITY_LAST_UPDATED)));
// Adding contact to list
equipCapacityList.add(equipCapacityDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipCapacityList;
}
public ArrayList<EquipDescriptionDataModel> getEquipmentDescriptionData(String sortType, String capacityName) {
ArrayList<EquipDescriptionDataModel> equipDescriptionList = new ArrayList<EquipDescriptionDataModel>();
// Select All Query
String selectQuery = "";
//selectQuery = "SELECT * FROM " + TABLE_CIRCLE + " ORDER BY " + CIRCLE_TOTAL_ALARM_SITES + " DESC";
selectQuery = "SELECT * FROM " + TABLE_EQUIPMENT_DESCRIPTION + " WHERE " + EQUIPMENT_DESCRIPTION_CAPACITY_ID + " = '" + capacityName + "'";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
EquipDescriptionDataModel equipDescriptionDataModel = new EquipDescriptionDataModel();
equipDescriptionDataModel.setId(cursor.getString(cursor.getColumnIndex(EQUIPMENT_DESCRIPTION_ID)));
equipDescriptionDataModel.setName(cursor.getString(cursor.getColumnIndex(EQUIPMENT_DESCRIPTION_NAME)));
equipDescriptionDataModel.setLastUpdateDate(cursor.getString(cursor.getColumnIndex(EQUIPMENT_DESCRIPTION_LAST_UPDATED)));
// Adding contact to list
equipDescriptionList.add(equipDescriptionDataModel);
} while (cursor.moveToNext());
}
db.close();
// return contact list
return equipDescriptionList;
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Form Data---------------------------------------
public boolean addEquipmentFormData(List<SelectedEquipmentDataModel> selectedEquipmentDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < selectedEquipmentDataList.size(); i++) {
ContentValues values = new ContentValues();
values.put(EQUIPMENT_FORM_TYPE, selectedEquipmentDataList.get(i).getEquipmentType());
values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).getEquipmentMake());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getEquipmentModel());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getEquipmentCapacity());
values.put(EQUIPMENT_FORM_MAKE_ID, selectedEquipmentDataList.get(i).getMakeId());
values.put(EQUIPMENT_FORM_MODEL_ID, selectedEquipmentDataList.get(i).getModelId());
values.put(EQUIPMENT_FORM_CAPACITY_ID, selectedEquipmentDataList.get(i).getCapacityId());
values.put(EQUIPMENT_SERIAL_NUMBER, selectedEquipmentDataList.get(i).getSerialNumber());
values.put(EQUIPMENT_DATE_OF_MANUFACTURING, selectedEquipmentDataList.get(i).getDateOfManufacturing());
values.put(EQUIPMENT_DESCRIPTION, selectedEquipmentDataList.get(i).getDescription());
values.put(EQUIPMENT_ID, selectedEquipmentDataList.get(i).getEquipmentId());
/*values.put(EQUIPMENT_PHOTO_1, selectedEquipmentDataList.get(i).getPhoto1());
values.put(EQUIPMENT_PHOTO_2, selectedEquipmentDataList.get(i).getPhoto2());
values.put(EQUIPMENT_PHOTO_1_NAME, selectedEquipmentDataList.get(i).getPhoto1Name());
values.put(EQUIPMENT_PHOTO_2_NAME, selectedEquipmentDataList.get(i).getPhoto2Name());*/
values.put(EQUIPMENT_TYPE, selectedEquipmentDataList.get(i).getType());
values.put(EQUIPMENT_NUMBER_OF_AIR_CONDITIONER, selectedEquipmentDataList.get(i).getNumberOfAC());
values.put(EQUIPMENT_SITE_ID, selectedEquipmentDataList.get(i).getSiteId());
values.put(USERID, selectedEquipmentDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_EQUIPMENT_SELECTED, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Equipment Form Data---------------------------------------
public boolean addEbMeterFormData(List<EbMeterDataModel> ebMeterDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < ebMeterDataList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(METER_READING, ebMeterDataList.get(i).getMeterReading());
values.put(METER_NUMBER, ebMeterDataList.get(i).getMeterNumber());
values.put(AVAILABLE_HOURS, ebMeterDataList.get(i).getAvailableHours());
values.put(SUPPLY_SINGLE_PHASE, ebMeterDataList.get(i).getSupplySinglePhase());
values.put(SUPPLY_THREE_PHASE, ebMeterDataList.get(i).getSupplyThreePhase());
/*values.put(EB_METER_PHOTO_1, ebMeterDataList.get(i).getPhoto1());
values.put(EB_METER_PHOTO_2, ebMeterDataList.get(i).getPhoto2());
values.put(EB_METER_PHOTO_1_NAME, ebMeterDataList.get(i).getPhoto1Name());
values.put(EB_METER_PHOTO_2_NAME, ebMeterDataList.get(i).getPhoto2Name());*/
values.put(EB_METER_SITE_ID, ebMeterDataList.get(i).getSiteId());
values.put(USERID, ebMeterDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_EB_METER, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site On BB Form Data---------------------------------------
public boolean addSiteOnBbFormData(List<SiteOnBatteryBankDataModel> siteOnBatteryBankDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteOnBatteryBankDataList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(BB_DISCHARGE_CURRENT, siteOnBatteryBankDataList.get(i).getDischargeCurrent());
values.put(BB_DISCHARGE_VOLTAGE, siteOnBatteryBankDataList.get(i).getDischargeVoltage());
values.put(BB_SITE_ID, siteOnBatteryBankDataList.get(i).getSiteId());
values.put(USERID, siteOnBatteryBankDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_SITE_ON_BB, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site On DG Form Data---------------------------------------
public boolean addSiteOnDgFormData(List<SiteOnDG> siteOnDgDataList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteOnDgDataList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(DG_CURRENT, siteOnDgDataList.get(i).getDgCurrent());
values.put(DG_FREQUENCY, siteOnDgDataList.get(i).getDgFrequency());
values.put(DG_VOLTAGE, siteOnDgDataList.get(i).getDgVoltage());
values.put(DG_BATTERY_CHARGE_CURRENT, siteOnDgDataList.get(i).getBatteryChargeCurrent());
values.put(DG_BATTERY_VOLTAGE, siteOnDgDataList.get(i).getBatteryVoltage());
values.put(DG_SITE_ID, siteOnDgDataList.get(i).getSiteId());
values.put(USERID, siteOnDgDataList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_SITE_ON_DG, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
// -------------------------------Adding new Site On BB Form Data---------------------------------------
public boolean addSiteOnEbFormData(List<SiteOnEbDataModel> siteOnEbDataModelList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
long time = System.currentTimeMillis();
for (int i = 0; i < siteOnEbDataModelList.size(); i++) {
ContentValues values = new ContentValues();
/*values.put(EQUIPMENT_MAKE, selectedEquipmentDataList.get(i).get());
values.put(EQUIPMENT_MODEL, selectedEquipmentDataList.get(i).getSurveyorName());
values.put(EQUIPMENT_CAPACITY, selectedEquipmentDataList.get(i).getSiteId());*/
values.put(GRID_CURRENT, siteOnEbDataModelList.get(i).getGridCurrent());
values.put(GRID_FREQUENCY, siteOnEbDataModelList.get(i).getGridFrequency());
values.put(GRID_VOLTAGE, siteOnEbDataModelList.get(i).getGridVoltage());
values.put(GRID_SITE_ID, siteOnEbDataModelList.get(i).getSiteId());
values.put(USERID, siteOnEbDataModelList.get(i).getUserId());
// Inserting Row
db.insert(TABLE_SITE_ON_EB, null, values);
//return insert > 0;
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
//---------------------------------------------------------------------------------------
public void deleteAllRows(String tableName) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(tableName, null, null);
db.close();
}
// upsert BTSInfo for local use
public boolean upsertBTSInfo(BtsInfoData ob) {
boolean done = false;
BtsInfoData data = null;
if (ob.getsNo() != 0) {
data = getBTSInfoById(ob.getsNo());
if (data == null) {
done = insertBTSInfoData(ob);
} else {
done = updateBTSInfoData(ob);
}
}
return done;
}
public BtsInfoData getBTSInfoById(int id) {
String query = "Select * FROM BTSInfo WHERE sno = '" + id + "' ";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
BtsInfoData ob = new BtsInfoData();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateBTSInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate BTSInfo list data
private void populateBTSInfoData(Cursor cursor, BtsInfoData ob) {
ob.setsNo(cursor.getInt(0));
ob.setType(cursor.getString(1));
ob.setName(cursor.getString(2));
ob.setCabinetQty(cursor.getString(3));
ob.setNoofDCDBBox(cursor.getString(4));
ob.setNoofKroneBox(cursor.getString(5));
ob.setNoofTransmissionRack(cursor.getString(6));
ob.setMicrowave(cursor.getString(7));
ob.setOperatorType(cursor.getString(8));
ob.setTypeofBTS(cursor.getString(9));
ob.setBTSMake(cursor.getString(10));
ob.setYearInstallationSite(cursor.getString(11));
ob.setPostionAntennaTower(cursor.getString(12));
}
public boolean insertBTSInfoData(BtsInfoData ob) {
ContentValues values = new ContentValues();
populateBTSInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("BTSInfo", null, values);
db.close();
return i > 0;
}
public boolean updateBTSInfoData(BtsInfoData ob) {
ContentValues values = new ContentValues();
populateBTSInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("BTSInfo", values, " sno = '" + ob.getsNo() + "'", null);
db.close();
return i > 0;
}
public void populateBTSInfoValueData(ContentValues values, BtsInfoData ob) {
values.put("sno", ob.getsNo());
values.put("type", ob.getType());
values.put("btsName", ob.getName());
values.put("CabinetQty", ob.getCabinetQty());
values.put("NoofDCDBBox", ob.getNoofDCDBBox());
values.put("NoofKroneBox", ob.getNoofKroneBox());
values.put("NoofTransmissionRack", ob.getNoofTransmissionRack());
values.put("Microwave", ob.getMicrowave());
values.put("OperatorType", ob.getOperatorType());
values.put("TypeofBTS", ob.getTypeofBTS());
values.put("BTSMake", ob.getBTSMake());
values.put("YearInstallationSite", ob.getYearInstallationSite());
values.put("PostionAntennaTower", ob.getPostionAntennaTower());
}
public ArrayList<BtsInfoData> getAllBTSInfoList() {
String query = "Select * FROM BTSInfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<BtsInfoData> list = new ArrayList<BtsInfoData>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
BtsInfoData ob = new BtsInfoData();
populateBTSInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
public void deleteBTCRows(int id) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete("BTSInfo", " sno = '" + id + "'", null);
db.close();
}
/**
* Order Data Company Name Upsert
*
* @param ob
* @return
*/
public boolean upsertOrderData(OrderData ob) {
boolean done = false;
OrderData data = null;
if (ob.getCircleId() != 0) {
data = getOrderDataByID(ob.getCircleId());
if (data == null) {
done = insertOrderData(ob);
} else {
done = updateOrderData(ob);
}
}
return done;
}
public OrderData getOrderDataByID(long CircleId) {
String query = "Select * FROM OrderDataInfo WHERE CircleId = '" + CircleId + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OrderData ob = new OrderData();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateOrderData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
private void populateOrderData(Cursor cursor, OrderData ob) {
ob.setCircleId(cursor.getInt(0));
ob.setCircleName(cursor.getString(1));
ArrayList<CompanyDetail> companyDetails = new Gson().fromJson(cursor.getString(2), new TypeToken<ArrayList<CompanyDetail>>() {
}.getType());
ob.setCompanyDetail(companyDetails);
}
public boolean insertOrderData(OrderData ob) {
ContentValues values = new ContentValues();
populateOrderDataValue(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("OrderDataInfo", null, values);
db.close();
return i > 0;
}
public void populateOrderDataValue(ContentValues values, OrderData ob) {
values.put("CircleId", ob.getCircleId());
values.put("CircleName", ob.getCircleName());
String companydetails = new Gson().toJson(ob.getCompanyDetail());
values.put("CompanyDetail", companydetails);
}
public boolean updateOrderData(OrderData ob) {
ContentValues values = new ContentValues();
populateOrderDataValue(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("OrderDataInfo", values, " CircleId = '" + ob.getCircleId() + "'", null);
db.close();
return i > 0;
}
public ArrayList<OrderData> getAllOrderData() {
String query = "Select * FROM OrderDataInfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OrderData> list = new ArrayList<OrderData>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OrderData ob = new OrderData();
populateOrderData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
public boolean insertSiteListnewData(String ob) {
ContentValues values = new ContentValues();
values.put("id", 1);//only for single data
values.put("siteListData", ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SiteListnew", null, values);
db.close();
return i > 0;
}
public ArrayList<String> getAllSitetListDatanew() {
String query = "Select * FROM SiteListnew";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<String> list = new ArrayList<String>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
String data = cursor.getString(1);
list.add(data);
cursor.moveToNext();
}
}
db.close();
return list;
}
public String getSitetListDatanew() {
String siteListStr = null;
int id = 1;
String query = "Select * FROM SiteListnew WHERE id = '" + id + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
cursor.moveToFirst();
siteListStr = cursor.getString(1);
cursor.close();
} else {
siteListStr = null;
}
db.close();
return siteListStr;
}
//...................................................................................................
// get All Site List data
private void populateSiteListData(Cursor cursor, Data ob) {
ob.setSiteId(cursor.getInt(0));
ob.setSiteName(cursor.getString(1));
ob.setCustomerSiteId(cursor.getString(2));
ob.setCustomerName(cursor.getString(3));
ob.setCircleId(cursor.getInt(4));
ob.setCircleName(cursor.getString(5));
ob.setSSAId(cursor.getInt(6));
ob.setSSAName(cursor.getString(7));
ob.setAddress(cursor.getString(8));
ob.setCity(cursor.getString(9));
ob.setDistrictName(cursor.getString(10));
ob.setDistictId(cursor.getInt(11));
ob.setTehsilId(cursor.getInt(12));
ob.setTehsilName(cursor.getString(13));
}
public boolean insertSiteListData(Data ob) {
ContentValues values = new ContentValues();
populateSiteListValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SiteList", null, values);
db.close();
return i > 0;
}
public void populateSiteListValueData(ContentValues values, Data ob) {
values.put("SiteId", ob.getSiteId());
values.put("SiteName", ob.getSiteName());
values.put("CustomerSiteId", ob.getCustomerSiteId());
values.put("CustomerName", ob.getCustomerName());
values.put("CircleId", ob.getCircleId());
values.put("CircleName", ob.getCircleName());
values.put("SSAName", ob.getSSAName());
values.put("SSAId", ob.getSSAId());
values.put("Address", ob.getAddress());
values.put("City", ob.getCity());
values.put("DistictId", ob.getDistictId());
values.put("DistrictName", ob.getDistrictName());
values.put("TehsilId", ob.getTehsilId());
values.put("TehsilName", ob.getTehsilName());
}
public ArrayList<Data> getAllSitetListData() {
String query = "Select * FROM SiteList";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<Data> list = new ArrayList<Data>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
Data ob = new Data();
populateSiteListData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Save Basic Data Offline Info
*/
public boolean upsertBasicDataofflineInfo(OfflineDataModel ob) {
boolean done = false;
OfflineDataModel data = null;
if (ob.getSiteId() != 0) {
data = getBasicDataofflineInfoInfoById(ob.getSiteId());
if (data == null) {
done = insertBasicDataofflineInfoData(ob);
} else {
done = updateBasicDataofflineInfoInfoData(ob);
}
}
return done;
}
public OfflineDataModel getBasicDataofflineInfoInfoById(long siteId) {
String query = "Select * FROM BasicDataofflineinfo WHERE siteId = '" + siteId + "' ";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OfflineDataModel ob = new OfflineDataModel();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateBasicDataofflineInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate BasicDataofflineInfoInfo list data
private void populateBasicDataofflineInfoData(Cursor cursor, OfflineDataModel ob) {
ob.setSiteId(cursor.getLong(0));
ob.setBasicdatajson(cursor.getString(1));
}
public boolean insertBasicDataofflineInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateBasicDataofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("BasicDataofflineinfo", null, values);
db.close();
return i > 0;
}
public boolean updateBasicDataofflineInfoInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateBasicDataofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("BasicDataofflineinfo", values, " siteId = '" + ob.getSiteId() + "'", null);
db.close();
return i > 0;
}
public void populateBasicDataofflineInfoValueData(ContentValues values, OfflineDataModel ob) {
values.put("siteId", ob.getSiteId());
values.put("basicdatajson", ob.getBasicdatajson());
}
public ArrayList<OfflineDataModel> getAllBasicDataofflineInfoList() {
String query = "Select * FROM BasicDataofflineinfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OfflineDataModel> list = new ArrayList<OfflineDataModel>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OfflineDataModel ob = new OfflineDataModel();
populateBasicDataofflineInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Save Equipment Data Info
*/
public boolean upsertEquipmentofflineInfo(OfflineDataModel ob) {
boolean done = false;
OfflineDataModel data = null;
if (ob.getSiteId() != 0) {
data = getEquipmentofflineInfoInfoById(ob.getSiteId(), ob.getEquipmentId(), ob.getItemid());
if (data == null) {
done = insertEquipmentofflineInfoData(ob);
} else {
done = updateEquipmentofflineInfoInfoData(ob);
}
}
return done;
}
public OfflineDataModel getEquipmentofflineInfoInfoById(long siteId, long equipmentId,
int itemid) {
String query = "Select * FROM EquipmentDataofflineinfo WHERE siteId = '" + siteId + "' AND equipmentId='" + equipmentId
+ "' AND itemid='" + itemid + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OfflineDataModel ob = new OfflineDataModel();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateEquipmentofflineInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate EquipmentofflineInfoInfo list data
private void populateEquipmentofflineInfoData(Cursor cursor, OfflineDataModel ob) {
ob.setSiteId(cursor.getLong(0));
ob.setEquipmentId(cursor.getLong(1));
ob.setItemid(cursor.getInt(2));
ob.setEquipmendatajson(cursor.getString(3));
ob.setFiledata(cursor.getString(4));
}
public boolean insertEquipmentofflineInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateEquipmentofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("EquipmentDataofflineinfo", null, values);
db.close();
return i > 0;
}
public boolean updateEquipmentofflineInfoInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateEquipmentofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("EquipmentDataofflineinfo", values, " siteId = '" + ob.getSiteId() + "' AND equipmentId = '"
+ ob.getEquipmentId() + "' AND itemid = '"
+ ob.getItemid() + "'", null);
db.close();
return i > 0;
}
public void populateEquipmentofflineInfoValueData(ContentValues values, OfflineDataModel ob) {
values.put("siteId", ob.getSiteId());
values.put("equipmentId", ob.getEquipmentId());
values.put("itemid", ob.getItemid());
values.put("equipmendatajson", ob.getEquipmendatajson());
values.put("filedata", ob.getFiledata());
}
public ArrayList<OfflineDataModel> getAllEquipmentofflineInfoList() {
String query = "Select * FROM EquipmentDataofflineinfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OfflineDataModel> list = new ArrayList<OfflineDataModel>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OfflineDataModel ob = new OfflineDataModel();
populateEquipmentofflineInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Save Other Equipment Data Info
*/
public boolean upsertOtherEquipmenttofflineInfo(OfflineDataModel ob) {
boolean done = false;
OfflineDataModel data = null;
if (ob.getSiteId() != 0) {
data = getOtherEquipmenttofflineInfoInfoById(ob.getSiteId(), ob.getId());
if (data == null) {
done = insertOtherEquipmenttofflineInfoData(ob);
} else {
done = updateOtherEquipmenttofflineInfoInfoData(ob);
}
}
return done;
}
public OfflineDataModel getOtherEquipmenttofflineInfoInfoById(long siteId, int id) {
String query = "Select * FROM OtherEquipmentDataofflineinfo WHERE siteId = '" + siteId + "' AND id='" + id + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
OfflineDataModel ob = new OfflineDataModel();
if (cursor.moveToFirst()) {
cursor.moveToFirst();
populateOtherEquipmenttofflineInfoData(cursor, ob);
cursor.close();
} else {
ob = null;
}
db.close();
return ob;
}
//populate OtherEquipmenttofflineInfoInfo list data
private void populateOtherEquipmenttofflineInfoData(Cursor cursor, OfflineDataModel ob) {
ob.setId(cursor.getInt(0));
ob.setSiteId(cursor.getLong(1));
ob.setEquipmendatajson(cursor.getString(2));
ob.setFiledata(cursor.getString(3));
}
public boolean insertOtherEquipmenttofflineInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateOtherEquipmenttofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("OtherEquipmentDataofflineinfo", null, values);
db.close();
return i > 0;
}
public boolean updateOtherEquipmenttofflineInfoInfoData(OfflineDataModel ob) {
ContentValues values = new ContentValues();
populateOtherEquipmenttofflineInfoValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = 0;
i = db.update("OtherEquipmentDataofflineinfo", values, " id = '" + +ob.getId() + "' AND siteId = '"
+ ob.getSiteId() + "'", null);
db.close();
return i > 0;
}
public void populateOtherEquipmenttofflineInfoValueData(ContentValues
values, OfflineDataModel ob) {
values.put("siteId", ob.getSiteId());
values.put("equipmendatajson", ob.getEquipmendatajson());
values.put("filedata", ob.getFiledata());
}
public ArrayList<OfflineDataModel> getAllOtherEquipmenttofflineInfoList() {
String query = "Select * FROM OtherEquipmentDataofflineinfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OfflineDataModel> list = new ArrayList<OfflineDataModel>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OfflineDataModel ob = new OfflineDataModel();
populateOtherEquipmenttofflineInfoData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
/**
* Add Offlinr Plan Data
*
* @param planList
* @return
*/
public boolean addPlanDataList(List<Data> planList) {
SQLiteDatabase db = null;
try {
db = this.getWritableDatabase();
for (int i = 0; i < planList.size(); i++) {
ContentValues values = new ContentValues();
values.put("Plan_Id", planList.get(i).getPlan_Id());
values.put("Site_Id", planList.get(i).getSite_Id());
values.put("CustomerSiteId", planList.get(i).getCustomerSiteId());
values.put("SiteName", planList.get(i).getSiteName());
values.put("Plandate", planList.get(i).getPlandate());
values.put("Task_Id", planList.get(i).getTask_Id());
values.put("Task", planList.get(i).getTask());
values.put("Activity_Id", planList.get(i).getActivity_Id());
values.put("Activity", planList.get(i).getActivity());
values.put("FEId", planList.get(i).getFEId());
values.put("FEName", planList.get(i).getFEName());
db.insert("PlanListinfo", null, values);
}
} catch (Exception e) {
return false;
} finally {
db.close(); // Closing database connection
}
return false;
}
// ------------------------Getting All Plan Data-------------------------------------------
public ArrayList<Data> getPlanListdb() {
ArrayList<Data> planListData = new ArrayList<Data>();
String selectQuery = "";
selectQuery = "SELECT * FROM PlanListinfo";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
Data plandata = new Data();
plandata.setPlan_Id(cursor.getString(cursor.getColumnIndex("Plan_Id")));
plandata.setSite_Id(cursor.getString(cursor.getColumnIndex("Site_Id")));
plandata.setCustomerSiteId(cursor.getString(cursor.getColumnIndex("CustomerSiteId")));
plandata.setSiteName(cursor.getString(cursor.getColumnIndex("SiteName")));
plandata.setPlandate(cursor.getString(cursor.getColumnIndex("Plandate")));
plandata.setTask_Id(cursor.getString(cursor.getColumnIndex("Task_Id")));
plandata.setTask(cursor.getString(cursor.getColumnIndex("Task")));
plandata.setActivity_Id(cursor.getString(cursor.getColumnIndex("Activity_Id")));
plandata.setActivity(cursor.getString(cursor.getColumnIndex("Activity")));
plandata.setFEId(cursor.getString(cursor.getColumnIndex("FEId")));
plandata.setFEName(cursor.getString(cursor.getColumnIndex("FEName")));
planListData.add(plandata);
} while (cursor.moveToNext());
}
db.close();
return planListData;
}
public boolean insertSurveySiteDetail(String ob) {
ContentValues values = new ContentValues();
values.put("surveySitelist", ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SurveySiteDetail", null, values);
db.close();
return i > 0;
}
public String getAllSurveySiteDetail() {
String query = "Select * FROM SurveySiteDetail";
SQLiteDatabase db = this.getReadableDatabase();
String data = null;
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
data = cursor.getString(0);
cursor.moveToNext();
}
}
db.close();
return data;
}
/**
* GetSurveySpinnerList
* @param ob
* @return
*/
public boolean insertSSurveySpinnerList (String ob) {
ContentValues values = new ContentValues();
values.put("SurveySpinner", ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("SurveySpinnerList", null, values);
db.close();
return i > 0;
}
public String getAllSurveySpinnerList () {
String query = "Select * FROM SurveySpinnerList";
SQLiteDatabase db = this.getReadableDatabase();
String data = null;
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
data = cursor.getString(0);
cursor.moveToNext();
}
}
db.close();
return data;
}
/**
* get RCA List
*
* @param ob
* @return
*/
public boolean insertRCAListData(OrderData ob) {
ContentValues values = new ContentValues();
populateRCAListValueData(values, ob);
SQLiteDatabase db = this.getWritableDatabase();
long i = db.insert("RCAListInfo", null, values);
db.close();
return i > 0;
}
public void populateRCAListValueData(ContentValues values, OrderData ob) {
values.put("RCATypeId", ob.getRCATypeId());
values.put("RCATypeName", ob.getRCATypeName());
if (ob.getData() != null && ob.getData().size() > 0) {
String orderdata = new Gson().toJson(ob.getData());
values.put("jsonDataStr", orderdata);
}
}
private void populateRCAListData(Cursor cursor, OrderData ob) {
ob.setRCATypeId(cursor.getInt(0));
ob.setRCATypeName(cursor.getString(1));
ArrayList<Data> datajson = new Gson().fromJson(cursor.getString(2), new TypeToken<ArrayList<Data>>() {
}.getType());
ob.setData(datajson);
}
public ArrayList<OrderData> getAllRCAList() {
String query = "Select * FROM RCAListInfo";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query, null);
ArrayList<OrderData> list = new ArrayList<OrderData>();
if (cursor.moveToFirst()) {
while (cursor.isAfterLast() == false) {
OrderData ob = new OrderData();
populateRCAListData(cursor, ob);
list.add(ob);
cursor.moveToNext();
}
}
db.close();
return list;
}
}
| 83,015 | 0.603361 | 0.601482 | 1,864 | 43.53487 | 33.828697 | 283 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.811159 | false | false | 9 |
d6ed8df280c1fed22228b6c51f7b90f08f55ed24 | 20,255,065,776,513 | 1c2ad35144be98b0f89d524e03af8290099d9297 | /src/main/java/org/tools4j/fx/make/execution/Order.java | 65177d189313fc1d02c5d6e0f7ccd254f01469f6 | [
"MIT"
] | permissive | kimmking/fx-market-making | https://github.com/kimmking/fx-market-making | 4a45725345f1011a7833eba15cc4565d1e01f803 | a2ffba65c2b2ae92015d91757a0ad3cef2e9187a | refs/heads/master | 2020-04-12T04:15:26.181000 | 2015-12-29T13:23:48 | 2015-12-29T13:23:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* The MIT License (MIT)
*
* Copyright (c) 2015 fx-market-making (tools4j), Marco Terzer
*
* 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.tools4j.fx.make.execution;
import java.util.concurrent.atomic.AtomicLong;
import org.tools4j.fx.make.asset.AssetPair;
/**
* An order. All members return non-null values.
*/
public interface Order {
/**
* The order ID unique among all orders even across different parties.
*
* @return unique order ID
*/
long getId();
/**
* The asset pair.
*
* @return the traded asset pair
*/
AssetPair<?, ?> getAssetPair();
/**
* The party behind this order
*
* @return the issuing party
*/
String getParty();
/**
* Returns the side, never null.
*
* @return the order side
*/
Side getSide();
/**
* The order price
*
* @return the price of this order
*/
double getPrice();
/**
* The quantity of the order, non-negative
*
* @return the quantity or amount, not negative
*/
long getQuantity();
/**
* Returns a string of the form: BUY:AUD/USD[1.2M@1.246370]
* @return a short string with side, symbol, quantity and price
*/
String toShortString();
/**
* Generator for unique order ID's.
*/
AtomicLong ID_GENERATOR = new AtomicLong(System.currentTimeMillis());
}
| UTF-8 | Java | 2,321 | java | Order.java | Java | [
{
"context": "\n * Copyright (c) 2015 fx-market-making (tools4j), Marco Terzer\n *\n * Permission is hereby granted, free of charg",
"end": 94,
"score": 0.9998618960380554,
"start": 82,
"tag": "NAME",
"value": "Marco Terzer"
}
] | null | [] | /**
* The MIT License (MIT)
*
* Copyright (c) 2015 fx-market-making (tools4j), <NAME>
*
* 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.tools4j.fx.make.execution;
import java.util.concurrent.atomic.AtomicLong;
import org.tools4j.fx.make.asset.AssetPair;
/**
* An order. All members return non-null values.
*/
public interface Order {
/**
* The order ID unique among all orders even across different parties.
*
* @return unique order ID
*/
long getId();
/**
* The asset pair.
*
* @return the traded asset pair
*/
AssetPair<?, ?> getAssetPair();
/**
* The party behind this order
*
* @return the issuing party
*/
String getParty();
/**
* Returns the side, never null.
*
* @return the order side
*/
Side getSide();
/**
* The order price
*
* @return the price of this order
*/
double getPrice();
/**
* The quantity of the order, non-negative
*
* @return the quantity or amount, not negative
*/
long getQuantity();
/**
* Returns a string of the form: BUY:AUD/USD[1.2M@1.246370]
* @return a short string with side, symbol, quantity and price
*/
String toShortString();
/**
* Generator for unique order ID's.
*/
AtomicLong ID_GENERATOR = new AtomicLong(System.currentTimeMillis());
}
| 2,315 | 0.702284 | 0.69539 | 86 | 25.988373 | 27.894941 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.011628 | false | false | 9 |
1d6334ec9a703f80763d53c5045e540e32e1404b | 20,255,065,773,107 | e0c19d3bb9c8d776d18b5d89645a9e4bf452b909 | /covering_statistic/test/test/CompareData.java | 081f5d340862116a7f096c3f92396844c6e9eb3d | [] | no_license | niuxintao/web-identify | https://github.com/niuxintao/web-identify | 18f9a2d55cc43be5adb458dfe956047990b26270 | 0a2a6456827f6648fd322ab7071357ee650efefc | refs/heads/master | 2020-12-25T17:04:51.071000 | 2018-05-31T09:22:19 | 2018-05-31T09:22:19 | 33,167,795 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.apache.commons.math3.stat.descriptive.rank.Max;
import org.apache.commons.math3.stat.descriptive.rank.Min;
public class CompareData {
public static int Mbo_up = 0;
public static int Mtop_down = 1;
public static int Missta = 2;
public static int Mhaming = 3;
public static int Msize = 0;
public static int Mtime = 1;
public static int Mrfd = 2;
public static String[] names = { "bottom-up", "top-down",
"bottom-up collartive", "top-down hamming" };
/**
* 第一个observation 就是随着 degree 增大, 生成的困难加大,所需时间和分析时间都大大增强,所以能够在给定时间内生 成完得很少
*/
/**
* 1. 每个维度具体走向,即 比较 2维维度下 的情形, 3维维度下的情形。
*
* 具体指标: 1. 在哪个维度下best 是,具体 比第二要好多少 ,差多少,(每个都要具体列出有哪些) 比剩下的要好多少, 差多少。
* 平均每个好多少(百分比,数值),差多少(百分比,数值) 然后是, 最后是 哪两个 (其中要稍微好一点)
*
*
* 2.综合比较不同维度的趋势, 即2到6维 的增长趋势
*
*
*/
// method, subject, degree
public double[][][] size;
public double[][][] time;
public double[][][] rfd;
public int[][] param;
// public String title;
public CompareData() {
ReadParam rp = new ReadParam();
param = rp.param;
GetData gd = new GetData();
gd.processAll();
size = gd.size;
time = gd.time;
rfd = gd.rfd;
}
// public void compare(double[][][] data, String title) {
//
// }
// public void getBest() {
//
// }
// public void compareTwoSets(double[][][] data, int degree, int method) {
//
// }
// public ComparativeData StatsABenchComparetive(List<ComparativeData> data)
// {
// ComparativeData results = new ComparativeData();
// // 都要好的
//
// for (ComparativeData da : data) {
// // for(int i = 0; )
// }
//
// return results;
// }
public double[] transfer(List<Double> input) {
double[] result = new double[input.size()];
for (int i = 0; i < result.length; i++)
result[i] = input.get(i);
return result;
}
public void compare(double[][][] data, String title, boolean smallIsGoodOrfalse) {
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
System.out.println("degree : " + degree);
System.out.println("-------------------------------------------");
System.out.println("-------------------------------------------");
System.out.println("-------------------------------------------");
// double[][] bench = new double[4][];
for (int method1 : new int[] { 0, 1, 2, 3 }) {
double[] d1 = getMethodAndDegree(data, method1, degree);
for (int method2 : new int[] { 0, 1, 2, 3 }) {
if (method2 > method1) {
double[] d2 = getMethodAndDegree(data, method2, degree);
ComparativeData da = this.compareTwoSets(d1, d2, smallIsGoodOrfalse);
statusComparativeData(da, names[method1], names[method2]);
}
}
}
}
}
public void statusComparativeData(ComparativeData data, String method1,
String method2) {
Mean mean = new Mean();
Max max = new Max();
Min min = new Min();
double[] betterDegree = transfer(data.betterDegree);
double[] lessDegree = transfer(data.lessDegree);
double[] paramNumBetter = new double[betterDegree.length];
for (int i = 0; i < paramNumBetter.length; i++)
paramNumBetter[i] = param[data.better.get(i)].length;
double[] paramNumLess = new double[lessDegree.length];
for (int i = 0; i < paramNumLess.length; i++)
paramNumLess[i] = param[data.less.get(i)].length;
System.out.println("-------------------------------------------");
System.out.println(method1 + " vs " + method2);
DecimalFormat df = new DecimalFormat("######0.00");
System.out.println("better number-- " + data.better.size());
System.out.println("equal number-- " + data.equal.size());
System.out.println("less number-- " + data.less.size());
System.out.println("-------------------------------------------");
System.out.println("better degree-- max:" + df.format(max.evaluate(betterDegree))
+ " min:" + df.format(min.evaluate(betterDegree)) + " average:"
+ df.format(mean.evaluate(betterDegree)));
System.out.println("-------------------------------------------");
System.out.println("better subject paramter number-- max:"
+ df.format(max.evaluate(paramNumBetter)) + " min:"
+ df.format(min.evaluate(paramNumBetter)) + " average:"
+ df.format(mean.evaluate(paramNumBetter)));
System.out.println("-------------------------------------------");
System.out.println("less degree-- max:" + df.format(max.evaluate(lessDegree))
+ " min:" + df.format(min.evaluate(lessDegree)) + " average:"
+ df.format(mean.evaluate(lessDegree)));
System.out.println("-------------------------------------------");
System.out.println("less subject paramter number-- max:"
+ df.format(max.evaluate(paramNumLess)) + " min:"
+ df.format(min.evaluate(paramNumLess)) + " average:"
+ df.format(mean.evaluate(paramNumLess)));
}
public ComparativeData compareTwoSets(double[] data1, double[] data2,
boolean smallisBetterOrNot) {
List<Integer> better = new ArrayList<Integer>();
List<Integer> equal = new ArrayList<Integer>();
List<Integer> less = new ArrayList<Integer>();
List<Double> betterDegree = new ArrayList<Double>();
List<Double> lessDegree = new ArrayList<Double>();
for (int i = 0; i < data1.length; i++) {
if(data1[i]== -1 || data2[i] == -1){
continue;
}
if ((smallisBetterOrNot && (data1[i] < data2[i]))
|| (!smallisBetterOrNot && (data1[i] > data2[i]))) {
// better
better.add(i);
betterDegree.add(Math.abs(data1[i] - data2[i])
/ Math.max(data1[i], data2[i]));
} else if (data1[i] == data2[i]) {
equal.add(i);
} else {
less.add(i);
lessDegree.add(Math.abs(data1[i] - data2[i])
/ Math.max(data1[i], data2[i]));
}
}
ComparativeData results = new ComparativeData();
results.better = better;
results.less = less;
results.equal = equal;
results.betterDegree = betterDegree;
results.lessDegree = lessDegree;
return results;
}
public void showTrend(double[][][] data, String title) {
System.out.println("Trend : " + title);
double[][] result = new double[4][5];
double[][] benchAll = new double[5][4];
for (int i = 0; i < 5; i++) {
// double[] bench = this.getBench(data, 2);
benchAll[i] = this.getBench(data, i + 2);
}
for (int method : new int[] { 0, 1, 2, 3 }) {
// double[][] Tdata = data[method];
// double Tbench = benchAll[0][method];
double[] ttr = new double[5];
ttr[0] = benchAll[0][method];
for (int i = 1; i < 5; i++) {
// System.out.println(benchAll[i][method] + " " +
// benchAll[i][0]);
ttr[i] = benchAll[i][method];
// ttr[i] = result[2][i]*(benchAll[i][method]/benchAll[i][2]);
}
result[method] = ttr;
}
for (double[] Tr : result) {
System.out.print("[");
for (double tr : Tr) {
System.out.print(tr + ", ");
}
System.out.println("], ");
}
}
public double[] getBench(double[][][] data, int degree) {
double[] result = new double[4];
// for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
bench[method] = size;
// this.showSize(size, degree);
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
// this.showSize(size, degree, bench);
double[] Tresult = new double[55];
double[][] Tbench = getMinmalMaximal(bench);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (size[i] != -1) {
if (Tbench[1][i] - Tbench[0][i] != 0)
thisValue = (size[i] - Tbench[0][i])
/ (Tbench[1][i] - Tbench[0][i]);
else
thisValue = 0;
}
Tresult[i] = thisValue;
}
double tempTT = 0;
double tempN = 0;
ArrayList<Double> arr = new ArrayList<Double>();
for (int i = 0; i < 55; i++) {
if (Tresult[i] != -1) {
tempTT += Tresult[i];
tempN++;
arr.add(Tresult[i]);
}
}
if (tempN != 0)
tempTT /= tempN;
else
tempTT = 0;
Collections.sort(arr);
result[method] = tempTT; // arr.get(arr.size()/2);
}
// }
// for (int i = 0; i < data.length; i++) {
// double[][] temp = data[i];
//
// }
return result;
}
/*
* trend[0] 2 , 3, 4 ,5, 6 每个 都是 * 比率
*
* trend[1] 3, 4, 5, 6 每个都是上面的比下面的
*
* bench 是对应方法的2-way的相对于其他方法的比率
*/
public double[][] getTrend(double[][] data, double bench) {
double[] trend = new double[5];
double[] multiTrend = new double[4];
trend[0] = bench;
// double[] bench = this.get2wayBench(data);
// 55 subjects
for (int j = 0; j < 5; j++) {
int k = j + 1;
if (k >= 5)
break;
// for(int k = j+1; k < data[0].length; k++){
double temp = 0;
double num = 0;
for (int i = 0; i < data.length; i++) {
if (data[i][j] != -1 && data[i][k] != -1) {
temp += data[i][k] / data[i][j];
num++;
}
}
if (num != 0) {
temp /= num;
}
multiTrend[j] = temp;
trend[k] = temp * trend[k - 1];
// }
}
double[][] result = new double[2][];
result[0] = trend;
result[1] = multiTrend;
return result;
}
// 是不是 bottom-up 在一起, 然后 top-down 在一起
public void showCommon(double[][][] data, String title) {
int[] models = new int[55];
for (int i = 0; i < 55; i++) {
models[i] = i;
}
System.out.println("show Common: " + title);
System.out
.println("Subject & Bottom-up & bottom-up-issta & Top-down & top-down - haiming");
DecimalFormat df = new DecimalFormat("######0.0");
for (int model : models) {
for (int method : new int[] { 0, 2, 1, 3 }) {
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
if (method == 3 && degree == 6) {
System.out.println(df
.format(data[method][model][degree - 2])
+ "\\\\");
} else {
System.out.print(df
.format(data[method][model][degree - 2]) + "&");
}
}
}
}
}
public double[] getMethodAndDegree(double[][][] data, int method, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++)
result[i] = data[method][i][degree - 2];
return result;
}
// rfd 除以 C(k,t) * v ^{t} 因为这和寻找 schema的多少有关
public void showRFDAll(double[][][] data) {
System.out.println("show RFD");
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] rfd = getMethodAndDegree(data, method, degree);
bench[method] = rfd;
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] rfd = getMethodAndDegree(data, method, degree);
this.showRFD(rfd, degree, bench);
}
}
}
// time 除以 C(k,t) * v ^{t} 因为这和寻找 schema的多少有关 //有点多
public void showTimeAll(double[][][] data) {
System.out.println("show Time");
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] time = getMethodAndDegree(data, method, degree);
bench[method] = time;
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] time = getMethodAndDegree(data, method, degree);
this.showTime(time, degree, bench);
}
}
}
// size 除以 logk * v^{t} , 因为这和寻找covering array 的大小有关
public void showSizeAll(double[][][] data) {
System.out.println("show Size");
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
bench[method] = size;
// this.showSize(size, degree);
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
this.showSize(size, degree, bench);
}
}
}
public double[][] getMinmalMaximal(double[][] data) {
double[][] result = new double[2][data[0].length];
for (int i = 0; i < data[0].length; i++) {
double min = -1;
double max = -1;
for (int j = 0; j < data.length; j++) {
if (data[j][i] > max) {
max = data[j][i];
}
if ((data[j][i] != -1 && min == -1)
|| (data[j][i] != -1 && data[j][i] < min)) {
min = data[j][i];
}
}
double max2 = -1;
for (int j = 0; j < data.length; j++) {
if (data[j][i] > max2 && data[j][i] != max) {
max2 = data[j][i];
}
}
result[0][i] = min;
result[1][i] = max;
}
return result;
}
public void showSize(double[] data, int degree, double[][] sizeTwo) {
double[] result = new double[55];
double[][] bench = getMinmalMaximal(sizeTwo);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (data[i] != -1) {
if (bench[1][i] - bench[0][i] != 0)
thisValue = (data[i] - bench[0][i])
/ (bench[1][i] - bench[0][i]);
else
thisValue = 0;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showTime(double[] data, int degree, double[][] sizeTwo) {
double[] result = new double[55];
double[][] bench = getMinmalMaximal(sizeTwo);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (data[i] != -1) {
if (bench[1][i] - bench[0][i] != 0)
thisValue = (data[i] - bench[0][i])
/ (bench[1][i] - bench[0][i]);
else
thisValue = 0;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showRFD(double[] data, int degree, double[][] sizeTwo) {
double[] result = new double[55];
double[][] bench = getMinmalMaximal(sizeTwo);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (data[i] != -1) {
if (bench[1][i] - bench[0][i] != 0)
thisValue = (data[i] - bench[0][i])
/ (bench[1][i] - bench[0][i]);
else
thisValue = 0;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showRFD(double[] data, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++) {
int[] param = this.getParam(i);
double benchStandlineRFD = this.theMinimalStandardLineRFD(param,
degree);
double thisValue = -1;
if (data[i] != -1) {
thisValue = data[i] / benchStandlineRFD;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showTime(double[] data, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++) {
int[] param = this.getParam(i);
double benchStandlineTime = this.theMinimalStandardLineTime(param,
degree);
double thisValue = -1;
if (data[i] != -1) {
thisValue = data[i] * 1000 / benchStandlineTime;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showSize(double[] data, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++) {
int[] param = this.getParam(i);
double benchStandlineSize = this.theMinimalStandardLineSize(param,
degree);
double thisValue = -1;
if (data[i] != -1) {
thisValue = data[i] / benchStandlineSize;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public int[] getParam(int model) {
return param[model];
}
public double theMinimalStandardLineRFD(int[] param, int degree) {
int[] maximaElements = this.getMaximaElements(param, degree);
double multi = this.getMultiple(maximaElements);
int indexNum = 1;
// int i = 1;
for (int k = 0; k < degree; k++) {
indexNum *= param.length - degree + k + 1;
indexNum /= (k + 1);
}
multi *= indexNum;
return multi;
}
public double theMinimalStandardLineTime(int[] param, int degree) {
int[] maximaElements = this.getMaximaElements(param, degree);
double multi = this.getMultiple(maximaElements);
int indexNum = 1;
// int i = 1;
for (int k = 0; k < degree; k++) {
indexNum *= param.length - degree + k + 1;
indexNum /= (k + 1);
}
multi *= indexNum;
return multi;
}
public double theMinimalStandardLineSize(int[] param, int degree) {
int[] maximaElements = this.getMaximaElements(param, degree);
double multi = this.getMultiple(maximaElements);
multi *= (Math.log(param.length) + 1);
return multi;
}
public int getMultiple(int[] elements) {
int result = 1;
for (int i : elements)
result *= i;
return result;
}
public int[] getMaximaElements(int[] param, int degree) {
int[] result = new int[degree];
int[] resultIndex = new int[degree];
for (int i = 0; i < degree; i++) {
int maxi = -1;
int maxj = -1;
for (int j = 0; j < param.length; j++) {
boolean conit = false;
for (int k = 0; k < i; k++) {
if (resultIndex[k] == j) {
conit = true;
break;
}
}
if (conit)
continue;
else {
if (param[j] > maxi) {
maxi = param[j];
maxj = j;
}
}
}
result[i] = maxi;
resultIndex[i] = maxj;
}
return result;
}
public static void main(String[] args) {
CompareData cd = new CompareData();
// cd.showCommon(cd.size, "size");
cd.showSizeAll(cd.size);
// cd.showCommon(cd.time, "time");
cd.showTimeAll(cd.time);
// cd.showCommon(cd.rfd, "rfd");
cd.showRFDAll(cd.rfd);
cd.showTrend(cd.size, "size");
cd.showTrend(cd.time, "time");
cd.showTrend(cd.rfd, "rfd");
cd.compare(cd.rfd, "rfd", false);
}
}
class ComparativeData {
public List<Integer> better;
public List<Integer> equal;
public List<Integer> less;
public List<Double> betterDegree;
public List<Double> lessDegree;
}
| GB18030 | Java | 19,688 | java | CompareData.java | Java | [] | null | [] | package test;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.apache.commons.math3.stat.descriptive.rank.Max;
import org.apache.commons.math3.stat.descriptive.rank.Min;
public class CompareData {
public static int Mbo_up = 0;
public static int Mtop_down = 1;
public static int Missta = 2;
public static int Mhaming = 3;
public static int Msize = 0;
public static int Mtime = 1;
public static int Mrfd = 2;
public static String[] names = { "bottom-up", "top-down",
"bottom-up collartive", "top-down hamming" };
/**
* 第一个observation 就是随着 degree 增大, 生成的困难加大,所需时间和分析时间都大大增强,所以能够在给定时间内生 成完得很少
*/
/**
* 1. 每个维度具体走向,即 比较 2维维度下 的情形, 3维维度下的情形。
*
* 具体指标: 1. 在哪个维度下best 是,具体 比第二要好多少 ,差多少,(每个都要具体列出有哪些) 比剩下的要好多少, 差多少。
* 平均每个好多少(百分比,数值),差多少(百分比,数值) 然后是, 最后是 哪两个 (其中要稍微好一点)
*
*
* 2.综合比较不同维度的趋势, 即2到6维 的增长趋势
*
*
*/
// method, subject, degree
public double[][][] size;
public double[][][] time;
public double[][][] rfd;
public int[][] param;
// public String title;
public CompareData() {
ReadParam rp = new ReadParam();
param = rp.param;
GetData gd = new GetData();
gd.processAll();
size = gd.size;
time = gd.time;
rfd = gd.rfd;
}
// public void compare(double[][][] data, String title) {
//
// }
// public void getBest() {
//
// }
// public void compareTwoSets(double[][][] data, int degree, int method) {
//
// }
// public ComparativeData StatsABenchComparetive(List<ComparativeData> data)
// {
// ComparativeData results = new ComparativeData();
// // 都要好的
//
// for (ComparativeData da : data) {
// // for(int i = 0; )
// }
//
// return results;
// }
public double[] transfer(List<Double> input) {
double[] result = new double[input.size()];
for (int i = 0; i < result.length; i++)
result[i] = input.get(i);
return result;
}
public void compare(double[][][] data, String title, boolean smallIsGoodOrfalse) {
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
System.out.println("degree : " + degree);
System.out.println("-------------------------------------------");
System.out.println("-------------------------------------------");
System.out.println("-------------------------------------------");
// double[][] bench = new double[4][];
for (int method1 : new int[] { 0, 1, 2, 3 }) {
double[] d1 = getMethodAndDegree(data, method1, degree);
for (int method2 : new int[] { 0, 1, 2, 3 }) {
if (method2 > method1) {
double[] d2 = getMethodAndDegree(data, method2, degree);
ComparativeData da = this.compareTwoSets(d1, d2, smallIsGoodOrfalse);
statusComparativeData(da, names[method1], names[method2]);
}
}
}
}
}
public void statusComparativeData(ComparativeData data, String method1,
String method2) {
Mean mean = new Mean();
Max max = new Max();
Min min = new Min();
double[] betterDegree = transfer(data.betterDegree);
double[] lessDegree = transfer(data.lessDegree);
double[] paramNumBetter = new double[betterDegree.length];
for (int i = 0; i < paramNumBetter.length; i++)
paramNumBetter[i] = param[data.better.get(i)].length;
double[] paramNumLess = new double[lessDegree.length];
for (int i = 0; i < paramNumLess.length; i++)
paramNumLess[i] = param[data.less.get(i)].length;
System.out.println("-------------------------------------------");
System.out.println(method1 + " vs " + method2);
DecimalFormat df = new DecimalFormat("######0.00");
System.out.println("better number-- " + data.better.size());
System.out.println("equal number-- " + data.equal.size());
System.out.println("less number-- " + data.less.size());
System.out.println("-------------------------------------------");
System.out.println("better degree-- max:" + df.format(max.evaluate(betterDegree))
+ " min:" + df.format(min.evaluate(betterDegree)) + " average:"
+ df.format(mean.evaluate(betterDegree)));
System.out.println("-------------------------------------------");
System.out.println("better subject paramter number-- max:"
+ df.format(max.evaluate(paramNumBetter)) + " min:"
+ df.format(min.evaluate(paramNumBetter)) + " average:"
+ df.format(mean.evaluate(paramNumBetter)));
System.out.println("-------------------------------------------");
System.out.println("less degree-- max:" + df.format(max.evaluate(lessDegree))
+ " min:" + df.format(min.evaluate(lessDegree)) + " average:"
+ df.format(mean.evaluate(lessDegree)));
System.out.println("-------------------------------------------");
System.out.println("less subject paramter number-- max:"
+ df.format(max.evaluate(paramNumLess)) + " min:"
+ df.format(min.evaluate(paramNumLess)) + " average:"
+ df.format(mean.evaluate(paramNumLess)));
}
public ComparativeData compareTwoSets(double[] data1, double[] data2,
boolean smallisBetterOrNot) {
List<Integer> better = new ArrayList<Integer>();
List<Integer> equal = new ArrayList<Integer>();
List<Integer> less = new ArrayList<Integer>();
List<Double> betterDegree = new ArrayList<Double>();
List<Double> lessDegree = new ArrayList<Double>();
for (int i = 0; i < data1.length; i++) {
if(data1[i]== -1 || data2[i] == -1){
continue;
}
if ((smallisBetterOrNot && (data1[i] < data2[i]))
|| (!smallisBetterOrNot && (data1[i] > data2[i]))) {
// better
better.add(i);
betterDegree.add(Math.abs(data1[i] - data2[i])
/ Math.max(data1[i], data2[i]));
} else if (data1[i] == data2[i]) {
equal.add(i);
} else {
less.add(i);
lessDegree.add(Math.abs(data1[i] - data2[i])
/ Math.max(data1[i], data2[i]));
}
}
ComparativeData results = new ComparativeData();
results.better = better;
results.less = less;
results.equal = equal;
results.betterDegree = betterDegree;
results.lessDegree = lessDegree;
return results;
}
public void showTrend(double[][][] data, String title) {
System.out.println("Trend : " + title);
double[][] result = new double[4][5];
double[][] benchAll = new double[5][4];
for (int i = 0; i < 5; i++) {
// double[] bench = this.getBench(data, 2);
benchAll[i] = this.getBench(data, i + 2);
}
for (int method : new int[] { 0, 1, 2, 3 }) {
// double[][] Tdata = data[method];
// double Tbench = benchAll[0][method];
double[] ttr = new double[5];
ttr[0] = benchAll[0][method];
for (int i = 1; i < 5; i++) {
// System.out.println(benchAll[i][method] + " " +
// benchAll[i][0]);
ttr[i] = benchAll[i][method];
// ttr[i] = result[2][i]*(benchAll[i][method]/benchAll[i][2]);
}
result[method] = ttr;
}
for (double[] Tr : result) {
System.out.print("[");
for (double tr : Tr) {
System.out.print(tr + ", ");
}
System.out.println("], ");
}
}
public double[] getBench(double[][][] data, int degree) {
double[] result = new double[4];
// for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
bench[method] = size;
// this.showSize(size, degree);
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
// this.showSize(size, degree, bench);
double[] Tresult = new double[55];
double[][] Tbench = getMinmalMaximal(bench);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (size[i] != -1) {
if (Tbench[1][i] - Tbench[0][i] != 0)
thisValue = (size[i] - Tbench[0][i])
/ (Tbench[1][i] - Tbench[0][i]);
else
thisValue = 0;
}
Tresult[i] = thisValue;
}
double tempTT = 0;
double tempN = 0;
ArrayList<Double> arr = new ArrayList<Double>();
for (int i = 0; i < 55; i++) {
if (Tresult[i] != -1) {
tempTT += Tresult[i];
tempN++;
arr.add(Tresult[i]);
}
}
if (tempN != 0)
tempTT /= tempN;
else
tempTT = 0;
Collections.sort(arr);
result[method] = tempTT; // arr.get(arr.size()/2);
}
// }
// for (int i = 0; i < data.length; i++) {
// double[][] temp = data[i];
//
// }
return result;
}
/*
* trend[0] 2 , 3, 4 ,5, 6 每个 都是 * 比率
*
* trend[1] 3, 4, 5, 6 每个都是上面的比下面的
*
* bench 是对应方法的2-way的相对于其他方法的比率
*/
public double[][] getTrend(double[][] data, double bench) {
double[] trend = new double[5];
double[] multiTrend = new double[4];
trend[0] = bench;
// double[] bench = this.get2wayBench(data);
// 55 subjects
for (int j = 0; j < 5; j++) {
int k = j + 1;
if (k >= 5)
break;
// for(int k = j+1; k < data[0].length; k++){
double temp = 0;
double num = 0;
for (int i = 0; i < data.length; i++) {
if (data[i][j] != -1 && data[i][k] != -1) {
temp += data[i][k] / data[i][j];
num++;
}
}
if (num != 0) {
temp /= num;
}
multiTrend[j] = temp;
trend[k] = temp * trend[k - 1];
// }
}
double[][] result = new double[2][];
result[0] = trend;
result[1] = multiTrend;
return result;
}
// 是不是 bottom-up 在一起, 然后 top-down 在一起
public void showCommon(double[][][] data, String title) {
int[] models = new int[55];
for (int i = 0; i < 55; i++) {
models[i] = i;
}
System.out.println("show Common: " + title);
System.out
.println("Subject & Bottom-up & bottom-up-issta & Top-down & top-down - haiming");
DecimalFormat df = new DecimalFormat("######0.0");
for (int model : models) {
for (int method : new int[] { 0, 2, 1, 3 }) {
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
if (method == 3 && degree == 6) {
System.out.println(df
.format(data[method][model][degree - 2])
+ "\\\\");
} else {
System.out.print(df
.format(data[method][model][degree - 2]) + "&");
}
}
}
}
}
public double[] getMethodAndDegree(double[][][] data, int method, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++)
result[i] = data[method][i][degree - 2];
return result;
}
// rfd 除以 C(k,t) * v ^{t} 因为这和寻找 schema的多少有关
public void showRFDAll(double[][][] data) {
System.out.println("show RFD");
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] rfd = getMethodAndDegree(data, method, degree);
bench[method] = rfd;
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] rfd = getMethodAndDegree(data, method, degree);
this.showRFD(rfd, degree, bench);
}
}
}
// time 除以 C(k,t) * v ^{t} 因为这和寻找 schema的多少有关 //有点多
public void showTimeAll(double[][][] data) {
System.out.println("show Time");
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] time = getMethodAndDegree(data, method, degree);
bench[method] = time;
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] time = getMethodAndDegree(data, method, degree);
this.showTime(time, degree, bench);
}
}
}
// size 除以 logk * v^{t} , 因为这和寻找covering array 的大小有关
public void showSizeAll(double[][][] data) {
System.out.println("show Size");
for (int degree : new int[] { 2, 3, 4, 5, 6 }) {
double[][] bench = new double[4][];
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
bench[method] = size;
// this.showSize(size, degree);
}
for (int method : new int[] { 0, 1, 2, 3 }) {
double[] size = getMethodAndDegree(data, method, degree);
this.showSize(size, degree, bench);
}
}
}
public double[][] getMinmalMaximal(double[][] data) {
double[][] result = new double[2][data[0].length];
for (int i = 0; i < data[0].length; i++) {
double min = -1;
double max = -1;
for (int j = 0; j < data.length; j++) {
if (data[j][i] > max) {
max = data[j][i];
}
if ((data[j][i] != -1 && min == -1)
|| (data[j][i] != -1 && data[j][i] < min)) {
min = data[j][i];
}
}
double max2 = -1;
for (int j = 0; j < data.length; j++) {
if (data[j][i] > max2 && data[j][i] != max) {
max2 = data[j][i];
}
}
result[0][i] = min;
result[1][i] = max;
}
return result;
}
public void showSize(double[] data, int degree, double[][] sizeTwo) {
double[] result = new double[55];
double[][] bench = getMinmalMaximal(sizeTwo);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (data[i] != -1) {
if (bench[1][i] - bench[0][i] != 0)
thisValue = (data[i] - bench[0][i])
/ (bench[1][i] - bench[0][i]);
else
thisValue = 0;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showTime(double[] data, int degree, double[][] sizeTwo) {
double[] result = new double[55];
double[][] bench = getMinmalMaximal(sizeTwo);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (data[i] != -1) {
if (bench[1][i] - bench[0][i] != 0)
thisValue = (data[i] - bench[0][i])
/ (bench[1][i] - bench[0][i]);
else
thisValue = 0;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showRFD(double[] data, int degree, double[][] sizeTwo) {
double[] result = new double[55];
double[][] bench = getMinmalMaximal(sizeTwo);
for (int i = 0; i < 55; i++) {
double thisValue = -1;
if (data[i] != -1) {
if (bench[1][i] - bench[0][i] != 0)
thisValue = (data[i] - bench[0][i])
/ (bench[1][i] - bench[0][i]);
else
thisValue = 0;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showRFD(double[] data, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++) {
int[] param = this.getParam(i);
double benchStandlineRFD = this.theMinimalStandardLineRFD(param,
degree);
double thisValue = -1;
if (data[i] != -1) {
thisValue = data[i] / benchStandlineRFD;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showTime(double[] data, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++) {
int[] param = this.getParam(i);
double benchStandlineTime = this.theMinimalStandardLineTime(param,
degree);
double thisValue = -1;
if (data[i] != -1) {
thisValue = data[i] * 1000 / benchStandlineTime;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public void showSize(double[] data, int degree) {
double[] result = new double[55];
for (int i = 0; i < 55; i++) {
int[] param = this.getParam(i);
double benchStandlineSize = this.theMinimalStandardLineSize(param,
degree);
double thisValue = -1;
if (data[i] != -1) {
thisValue = data[i] / benchStandlineSize;
}
result[i] = thisValue;
}
DecimalFormat df = new DecimalFormat("######0.00");
System.out.print("[");
for (double thisValue : result) {
System.out.print(df.format(thisValue) + ", ");
}
System.out.println("], ");
}
public int[] getParam(int model) {
return param[model];
}
public double theMinimalStandardLineRFD(int[] param, int degree) {
int[] maximaElements = this.getMaximaElements(param, degree);
double multi = this.getMultiple(maximaElements);
int indexNum = 1;
// int i = 1;
for (int k = 0; k < degree; k++) {
indexNum *= param.length - degree + k + 1;
indexNum /= (k + 1);
}
multi *= indexNum;
return multi;
}
public double theMinimalStandardLineTime(int[] param, int degree) {
int[] maximaElements = this.getMaximaElements(param, degree);
double multi = this.getMultiple(maximaElements);
int indexNum = 1;
// int i = 1;
for (int k = 0; k < degree; k++) {
indexNum *= param.length - degree + k + 1;
indexNum /= (k + 1);
}
multi *= indexNum;
return multi;
}
public double theMinimalStandardLineSize(int[] param, int degree) {
int[] maximaElements = this.getMaximaElements(param, degree);
double multi = this.getMultiple(maximaElements);
multi *= (Math.log(param.length) + 1);
return multi;
}
public int getMultiple(int[] elements) {
int result = 1;
for (int i : elements)
result *= i;
return result;
}
public int[] getMaximaElements(int[] param, int degree) {
int[] result = new int[degree];
int[] resultIndex = new int[degree];
for (int i = 0; i < degree; i++) {
int maxi = -1;
int maxj = -1;
for (int j = 0; j < param.length; j++) {
boolean conit = false;
for (int k = 0; k < i; k++) {
if (resultIndex[k] == j) {
conit = true;
break;
}
}
if (conit)
continue;
else {
if (param[j] > maxi) {
maxi = param[j];
maxj = j;
}
}
}
result[i] = maxi;
resultIndex[i] = maxj;
}
return result;
}
public static void main(String[] args) {
CompareData cd = new CompareData();
// cd.showCommon(cd.size, "size");
cd.showSizeAll(cd.size);
// cd.showCommon(cd.time, "time");
cd.showTimeAll(cd.time);
// cd.showCommon(cd.rfd, "rfd");
cd.showRFDAll(cd.rfd);
cd.showTrend(cd.size, "size");
cd.showTrend(cd.time, "time");
cd.showTrend(cd.rfd, "rfd");
cd.compare(cd.rfd, "rfd", false);
}
}
class ComparativeData {
public List<Integer> better;
public List<Integer> equal;
public List<Integer> less;
public List<Double> betterDegree;
public List<Double> lessDegree;
}
| 19,688 | 0.554149 | 0.535471 | 695 | 25.502159 | 21.378593 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.946763 | false | false | 9 |
696d5119bb0b48c3ba7fef5eb9db49b4f12d8036 | 23,802,708,761,032 | a887f244c0d4e1f70119de0d5f101ebed03fac82 | /app/src/main/java/com/colpencil/secondhandcar/Present/Mine/MessagePresenter.java | 6a8434cc44ddefcf71dbf9c43092c99eb26d0ea1 | [] | no_license | zsj6102/sc | https://github.com/zsj6102/sc | 3725d0d4475088b4b9879a9acc2a822b9eff36bf | 4f2c9b72f8dde72bec06bde63eb5f47e404211a6 | refs/heads/master | 2020-12-02T19:44:55.317000 | 2017-08-10T01:15:45 | 2017-08-10T01:15:45 | 96,383,979 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.colpencil.secondhandcar.Present.Mine;
import com.colpencil.secondhandcar.Bean.Response.Message;
import com.colpencil.secondhandcar.Bean.ResultInfo;
import com.colpencil.secondhandcar.Model.Imples.IMessageModel;
import com.colpencil.secondhandcar.Model.Mine.MessageModel;
import com.colpencil.secondhandcar.Views.Imples.Mine.MessageView;
import com.property.colpencil.colpencilandroidlibrary.ControlerBase.MVP.ColpencilPresenter;
import java.util.HashMap;
import rx.Subscriber;
/**
* Created by Administrator on 2017/5/12.
*/
public class MessagePresenter extends ColpencilPresenter<MessageView> {
private IMessageModel messageModel;
public MessagePresenter(){
messageModel = new MessageModel();
}
public void getMessage(HashMap<String, String> params){
messageModel.getMessage(params);
Subscriber<ResultInfo<Message>> subscriber = new Subscriber<ResultInfo<Message>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(ResultInfo<Message> resultInfo) {
if(resultInfo.getCode() == 1){
mView.getMessage(resultInfo);
} else {
mView.loadError(resultInfo);
}
}
};
messageModel.sub(subscriber);
}
}
| UTF-8 | Java | 1,442 | java | MessagePresenter.java | Java | [] | null | [] | package com.colpencil.secondhandcar.Present.Mine;
import com.colpencil.secondhandcar.Bean.Response.Message;
import com.colpencil.secondhandcar.Bean.ResultInfo;
import com.colpencil.secondhandcar.Model.Imples.IMessageModel;
import com.colpencil.secondhandcar.Model.Mine.MessageModel;
import com.colpencil.secondhandcar.Views.Imples.Mine.MessageView;
import com.property.colpencil.colpencilandroidlibrary.ControlerBase.MVP.ColpencilPresenter;
import java.util.HashMap;
import rx.Subscriber;
/**
* Created by Administrator on 2017/5/12.
*/
public class MessagePresenter extends ColpencilPresenter<MessageView> {
private IMessageModel messageModel;
public MessagePresenter(){
messageModel = new MessageModel();
}
public void getMessage(HashMap<String, String> params){
messageModel.getMessage(params);
Subscriber<ResultInfo<Message>> subscriber = new Subscriber<ResultInfo<Message>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(ResultInfo<Message> resultInfo) {
if(resultInfo.getCode() == 1){
mView.getMessage(resultInfo);
} else {
mView.loadError(resultInfo);
}
}
};
messageModel.sub(subscriber);
}
}
| 1,442 | 0.660194 | 0.654646 | 49 | 28.428572 | 25.867006 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346939 | false | false | 9 |
3edd3c1044f85a089cbac3b00bea9367b7fe7fef | 6,803,228,207,543 | 0d5082cdb02b59c31724bd2f557e772824d08c65 | /TextAdventure/src/aceconsulting/adventure/ItemExamineChoice.java | 6a6efea346feb2410573d8bbea4a8589a697d6a0 | [] | no_license | AugustanaCS285FALL14/SimpleTextAdventure | https://github.com/AugustanaCS285FALL14/SimpleTextAdventure | 93091568f24b5c4e9313eed12a26fcfe1c99fa3c | d9027752a431bf6e3bb0b01e3f83258f432826f6 | refs/heads/master | 2016-09-02T01:43:53.811000 | 2014-10-24T20:36:13 | 2014-10-24T20:36:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package aceconsulting.adventure;
import aceconsulting.adventure.items.Item;
public class ItemExamineChoice extends ItemChoice {
public ItemExamineChoice(Item theItem) {
super("Examine " + theItem.getName(), theItem);
}
}
| UTF-8 | Java | 240 | java | ItemExamineChoice.java | Java | [] | null | [] | package aceconsulting.adventure;
import aceconsulting.adventure.items.Item;
public class ItemExamineChoice extends ItemChoice {
public ItemExamineChoice(Item theItem) {
super("Examine " + theItem.getName(), theItem);
}
}
| 240 | 0.741667 | 0.741667 | 11 | 19.818182 | 21.649347 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 9 |
08f3190ed54b45b91a5bae256c2f879c817b569d | 12,412,455,494,999 | fbf95d693ad5beddfb6ded0be170a9e810a10677 | /edcr/service/egov/egov-commons/src/main/java/org/egov/common/entity/edcr/Utility.java | 61da10f9ad808175c90dfe1ee103f628b53b5def | [
"MIT",
"LicenseRef-scancode-generic-cla",
"GPL-1.0-or-later",
"LicenseRef-scancode-proprietary-license"
] | permissive | egovernments/DIGIT-OSS | https://github.com/egovernments/DIGIT-OSS | 330cc364af1b9b66db8914104f64a0aba666426f | bf02a2c7eb783bf9fdf4b173faa37f402e05e96e | refs/heads/master | 2023-08-15T21:26:39.992000 | 2023-08-08T10:14:31 | 2023-08-08T10:14:31 | 353,807,330 | 25 | 91 | MIT | false | 2023-09-10T13:23:31 | 2021-04-01T19:35:55 | 2023-09-08T08:22:09 | 2023-09-10T13:23:30 | 471,133 | 30 | 107 | 25 | Java | false | false | /*
* eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency,
* accountability and the service delivery of the government organizations.
*
* Copyright (C) <2019> eGovernments Foundation
*
* The updated version of eGov suite of products as by eGovernments Foundation
* is available at http://www.egovernments.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/ or
* http://www.gnu.org/licenses/gpl.html .
*
* In addition to the terms of the GPL license to be adhered to in using this
* program, the following additional terms are to be complied with:
*
* 1) All versions of this program, verbatim or modified must carry this
* Legal Notice.
* Further, all user interfaces, including but not limited to citizen facing interfaces,
* Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any
* derived works should carry eGovernments Foundation logo on the top right corner.
*
* For the logo, please refer http://egovernments.org/html/logo/egov_logo.png.
* For any further queries on attribution, including queries on brand guidelines,
* please contact contact@egovernments.org
*
* 2) Any misrepresentation of the origin of the material is prohibited. It
* is required that all modified versions of this material be marked in
* reasonable ways as different from the original version.
*
* 3) This license does not grant any rights to any user of the program
* with regards to rights under trademark law for use of the trade names
* or trademarks of eGovernments Foundation.
*
* In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org.
*/
package org.egov.common.entity.edcr;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class Utility extends Measurement {
private static final long serialVersionUID = 16L;
private List<WasteDisposal> wasteDisposalUnits = new ArrayList<>();
private List<WasteWaterRecyclePlant> wasteWaterRecyclePlant = new ArrayList<>();
private List<LiquidWasteTreatementPlant> liquidWasteTreatementPlant = new ArrayList<>();
private List<WellUtility> wells = new ArrayList<>();
private List<RoadOutput> wellDistance = new ArrayList<>();
private List<RainWaterHarvesting> rainWaterHarvest = new ArrayList<>();
private List<Solar> solar = new ArrayList<>();
private BigDecimal rainWaterHarvestingTankCapacity;
private List<BiometricWasteTreatment> biometricWasteTreatment = new ArrayList<>();
private List<SolidLiqdWasteTrtmnt> solidLiqdWasteTrtmnt = new ArrayList<>();
private List<Measurement> solarWaterHeatingSystems = new ArrayList<>();
private List<Measurement> segregationOfWaste = new ArrayList<>();
private BigDecimal waterTankCapacity;
private SupplyLine supplyLine;
public void setBiometricWasteTreatment(List<BiometricWasteTreatment> biometricWasteTreatment) {
this.biometricWasteTreatment = biometricWasteTreatment;
}
public List<BiometricWasteTreatment> getBiometricWasteTreatment() {
return biometricWasteTreatment;
}
public void addBiometricWasteTreatment(BiometricWasteTreatment biometricWasteTrtmnt) {
biometricWasteTreatment.add(biometricWasteTrtmnt);
}
public BigDecimal getRainWaterHarvestingTankCapacity() {
return rainWaterHarvestingTankCapacity;
}
public void setRainWaterHarvestingTankCapacity(BigDecimal rainWaterHarvestingTankCapacity) {
this.rainWaterHarvestingTankCapacity = rainWaterHarvestingTankCapacity;
}
public List<WasteDisposal> getWasteDisposalUnits() {
return wasteDisposalUnits;
}
public List<LiquidWasteTreatementPlant> getLiquidWasteTreatementPlant() {
return liquidWasteTreatementPlant;
}
public void addLiquidWasteTreatementPlant(LiquidWasteTreatementPlant lqWastTrtPlant) {
liquidWasteTreatementPlant.add(lqWastTrtPlant);
}
public void addWasteDisposal(WasteDisposal wasteDisposal) {
wasteDisposalUnits.add(wasteDisposal);
}
public void addWasteWaterRecyclePlant(WasteWaterRecyclePlant waterRecyclePlant) {
wasteWaterRecyclePlant.add(waterRecyclePlant);
}
public List<WasteWaterRecyclePlant> getWasteWaterRecyclePlant() {
return wasteWaterRecyclePlant;
}
public void addWells(WellUtility wellUtility) {
wells.add(wellUtility);
}
public List<WellUtility> getWells() {
return wells;
}
public List<RoadOutput> getWellDistance() {
return wellDistance;
}
public void setWellDistance(List<RoadOutput> wellDistance) {
this.wellDistance = wellDistance;
}
public void addSolar(Solar solarsystem) {
solar.add(solarsystem);
}
public List<Solar> getSolar() {
return solar;
}
public List<RainWaterHarvesting> getRainWaterHarvest() {
return rainWaterHarvest;
}
public void addRainWaterHarvest(RainWaterHarvesting rwh) {
rainWaterHarvest.add(rwh);
}
public List<SolidLiqdWasteTrtmnt> getSolidLiqdWasteTrtmnt() {
return solidLiqdWasteTrtmnt;
}
public void addSolidLiqdWasteTrtmnt(SolidLiqdWasteTrtmnt solidLiqdWasteTrtmnt) {
this.solidLiqdWasteTrtmnt.add(solidLiqdWasteTrtmnt);
}
public List<Measurement> getSolarWaterHeatingSystems() {
return solarWaterHeatingSystems;
}
public void setSolarWaterHeatingSystems(List<Measurement> solarWaterHeatingSystems) {
this.solarWaterHeatingSystems = solarWaterHeatingSystems;
}
public void setWasteDisposalUnits(List<WasteDisposal> wasteDisposalUnits) {
this.wasteDisposalUnits = wasteDisposalUnits;
}
public void setWasteWaterRecyclePlant(List<WasteWaterRecyclePlant> wasteWaterRecyclePlant) {
this.wasteWaterRecyclePlant = wasteWaterRecyclePlant;
}
public void setLiquidWasteTreatementPlant(List<LiquidWasteTreatementPlant> liquidWasteTreatementPlant) {
this.liquidWasteTreatementPlant = liquidWasteTreatementPlant;
}
public void setWells(List<WellUtility> wells) {
this.wells = wells;
}
public void setRainWaterHarvest(List<RainWaterHarvesting> rainWaterHarvest) {
this.rainWaterHarvest = rainWaterHarvest;
}
public void setSolar(List<Solar> solar) {
this.solar = solar;
}
public void setSolidLiqdWasteTrtmnt(List<SolidLiqdWasteTrtmnt> solidLiqdWasteTrtmnt) {
this.solidLiqdWasteTrtmnt = solidLiqdWasteTrtmnt;
}
public List<Measurement> getSegregationOfWaste() {
return segregationOfWaste;
}
public void setSegregationOfWaste(List<Measurement> segregationOfWaste) {
this.segregationOfWaste = segregationOfWaste;
}
public BigDecimal getWaterTankCapacity() {
return waterTankCapacity;
}
public void setWaterTankCapacity(BigDecimal waterTankCapacity) {
this.waterTankCapacity = waterTankCapacity;
}
public SupplyLine getSupplyLine() {
return supplyLine;
}
public void setSupplyLine(SupplyLine supplyLine) {
this.supplyLine = supplyLine;
}
}
| UTF-8 | Java | 7,865 | java | Utility.java | Java | [
{
"context": "ies on brand guidelines,\n * please contact contact@egovernments.org\n *\n * 2) Any misrepresentation of the origin",
"end": 1804,
"score": 0.9999188184738159,
"start": 1780,
"tag": "EMAIL",
"value": "contact@egovernments.org"
},
{
"context": " queries, you... | null | [] | /*
* eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency,
* accountability and the service delivery of the government organizations.
*
* Copyright (C) <2019> eGovernments Foundation
*
* The updated version of eGov suite of products as by eGovernments Foundation
* is available at http://www.egovernments.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/ or
* http://www.gnu.org/licenses/gpl.html .
*
* In addition to the terms of the GPL license to be adhered to in using this
* program, the following additional terms are to be complied with:
*
* 1) All versions of this program, verbatim or modified must carry this
* Legal Notice.
* Further, all user interfaces, including but not limited to citizen facing interfaces,
* Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any
* derived works should carry eGovernments Foundation logo on the top right corner.
*
* For the logo, please refer http://egovernments.org/html/logo/egov_logo.png.
* For any further queries on attribution, including queries on brand guidelines,
* please contact <EMAIL>
*
* 2) Any misrepresentation of the origin of the material is prohibited. It
* is required that all modified versions of this material be marked in
* reasonable ways as different from the original version.
*
* 3) This license does not grant any rights to any user of the program
* with regards to rights under trademark law for use of the trade names
* or trademarks of eGovernments Foundation.
*
* In case of any queries, you can reach eGovernments Foundation at <EMAIL>.
*/
package org.egov.common.entity.edcr;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class Utility extends Measurement {
private static final long serialVersionUID = 16L;
private List<WasteDisposal> wasteDisposalUnits = new ArrayList<>();
private List<WasteWaterRecyclePlant> wasteWaterRecyclePlant = new ArrayList<>();
private List<LiquidWasteTreatementPlant> liquidWasteTreatementPlant = new ArrayList<>();
private List<WellUtility> wells = new ArrayList<>();
private List<RoadOutput> wellDistance = new ArrayList<>();
private List<RainWaterHarvesting> rainWaterHarvest = new ArrayList<>();
private List<Solar> solar = new ArrayList<>();
private BigDecimal rainWaterHarvestingTankCapacity;
private List<BiometricWasteTreatment> biometricWasteTreatment = new ArrayList<>();
private List<SolidLiqdWasteTrtmnt> solidLiqdWasteTrtmnt = new ArrayList<>();
private List<Measurement> solarWaterHeatingSystems = new ArrayList<>();
private List<Measurement> segregationOfWaste = new ArrayList<>();
private BigDecimal waterTankCapacity;
private SupplyLine supplyLine;
public void setBiometricWasteTreatment(List<BiometricWasteTreatment> biometricWasteTreatment) {
this.biometricWasteTreatment = biometricWasteTreatment;
}
public List<BiometricWasteTreatment> getBiometricWasteTreatment() {
return biometricWasteTreatment;
}
public void addBiometricWasteTreatment(BiometricWasteTreatment biometricWasteTrtmnt) {
biometricWasteTreatment.add(biometricWasteTrtmnt);
}
public BigDecimal getRainWaterHarvestingTankCapacity() {
return rainWaterHarvestingTankCapacity;
}
public void setRainWaterHarvestingTankCapacity(BigDecimal rainWaterHarvestingTankCapacity) {
this.rainWaterHarvestingTankCapacity = rainWaterHarvestingTankCapacity;
}
public List<WasteDisposal> getWasteDisposalUnits() {
return wasteDisposalUnits;
}
public List<LiquidWasteTreatementPlant> getLiquidWasteTreatementPlant() {
return liquidWasteTreatementPlant;
}
public void addLiquidWasteTreatementPlant(LiquidWasteTreatementPlant lqWastTrtPlant) {
liquidWasteTreatementPlant.add(lqWastTrtPlant);
}
public void addWasteDisposal(WasteDisposal wasteDisposal) {
wasteDisposalUnits.add(wasteDisposal);
}
public void addWasteWaterRecyclePlant(WasteWaterRecyclePlant waterRecyclePlant) {
wasteWaterRecyclePlant.add(waterRecyclePlant);
}
public List<WasteWaterRecyclePlant> getWasteWaterRecyclePlant() {
return wasteWaterRecyclePlant;
}
public void addWells(WellUtility wellUtility) {
wells.add(wellUtility);
}
public List<WellUtility> getWells() {
return wells;
}
public List<RoadOutput> getWellDistance() {
return wellDistance;
}
public void setWellDistance(List<RoadOutput> wellDistance) {
this.wellDistance = wellDistance;
}
public void addSolar(Solar solarsystem) {
solar.add(solarsystem);
}
public List<Solar> getSolar() {
return solar;
}
public List<RainWaterHarvesting> getRainWaterHarvest() {
return rainWaterHarvest;
}
public void addRainWaterHarvest(RainWaterHarvesting rwh) {
rainWaterHarvest.add(rwh);
}
public List<SolidLiqdWasteTrtmnt> getSolidLiqdWasteTrtmnt() {
return solidLiqdWasteTrtmnt;
}
public void addSolidLiqdWasteTrtmnt(SolidLiqdWasteTrtmnt solidLiqdWasteTrtmnt) {
this.solidLiqdWasteTrtmnt.add(solidLiqdWasteTrtmnt);
}
public List<Measurement> getSolarWaterHeatingSystems() {
return solarWaterHeatingSystems;
}
public void setSolarWaterHeatingSystems(List<Measurement> solarWaterHeatingSystems) {
this.solarWaterHeatingSystems = solarWaterHeatingSystems;
}
public void setWasteDisposalUnits(List<WasteDisposal> wasteDisposalUnits) {
this.wasteDisposalUnits = wasteDisposalUnits;
}
public void setWasteWaterRecyclePlant(List<WasteWaterRecyclePlant> wasteWaterRecyclePlant) {
this.wasteWaterRecyclePlant = wasteWaterRecyclePlant;
}
public void setLiquidWasteTreatementPlant(List<LiquidWasteTreatementPlant> liquidWasteTreatementPlant) {
this.liquidWasteTreatementPlant = liquidWasteTreatementPlant;
}
public void setWells(List<WellUtility> wells) {
this.wells = wells;
}
public void setRainWaterHarvest(List<RainWaterHarvesting> rainWaterHarvest) {
this.rainWaterHarvest = rainWaterHarvest;
}
public void setSolar(List<Solar> solar) {
this.solar = solar;
}
public void setSolidLiqdWasteTrtmnt(List<SolidLiqdWasteTrtmnt> solidLiqdWasteTrtmnt) {
this.solidLiqdWasteTrtmnt = solidLiqdWasteTrtmnt;
}
public List<Measurement> getSegregationOfWaste() {
return segregationOfWaste;
}
public void setSegregationOfWaste(List<Measurement> segregationOfWaste) {
this.segregationOfWaste = segregationOfWaste;
}
public BigDecimal getWaterTankCapacity() {
return waterTankCapacity;
}
public void setWaterTankCapacity(BigDecimal waterTankCapacity) {
this.waterTankCapacity = waterTankCapacity;
}
public SupplyLine getSupplyLine() {
return supplyLine;
}
public void setSupplyLine(SupplyLine supplyLine) {
this.supplyLine = supplyLine;
}
}
| 7,831 | 0.734901 | 0.73363 | 221 | 34.588234 | 32.539536 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.334842 | false | false | 9 |
e4d656c0163cd18c1a34a8804c5efddf8a28dd20 | 12,412,455,499,103 | e5f80241002f1b80d5b003cc41462c9a4263be46 | /src/test/java/pages/PgeMyAccount.java | 115dac814916d78460fde0e7b21582322ec7d380 | [] | no_license | vinay4y/framework-auto-prac-vinay-koduri | https://github.com/vinay4y/framework-auto-prac-vinay-koduri | d4cbbbc581010bcc4fafd26529584b1d3b033483 | 4d6226a5d06b0f56c6919b77a225fb8a15c7a109 | refs/heads/master | 2021-07-06T13:49:36.435000 | 2019-06-14T04:32:12 | 2019-06-14T04:32:12 | 191,854,142 | 0 | 0 | null | false | 2020-10-13T13:53:22 | 2019-06-14T01:09:06 | 2019-06-14T04:32:14 | 2020-10-13T13:53:21 | 11,127 | 0 | 0 | 1 | HTML | false | false | package pages;
import common.BrowserDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class PgeMyAccount {
WebDriver objPgeMyAccount = BrowserDriver.getCurrentDriver();
//Constructor
public PgeMyAccount(WebDriver objPgeMyAccount){
this.objPgeMyAccount = objPgeMyAccount;
//This initElements method will create all WebElements
PageFactory.initElements(objPgeMyAccount, this);
}
@FindBy(xpath="//p[@class='info-account']")
public WebElement p_info_account;
}
| UTF-8 | Java | 642 | java | PgeMyAccount.java | Java | [] | null | [] | package pages;
import common.BrowserDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class PgeMyAccount {
WebDriver objPgeMyAccount = BrowserDriver.getCurrentDriver();
//Constructor
public PgeMyAccount(WebDriver objPgeMyAccount){
this.objPgeMyAccount = objPgeMyAccount;
//This initElements method will create all WebElements
PageFactory.initElements(objPgeMyAccount, this);
}
@FindBy(xpath="//p[@class='info-account']")
public WebElement p_info_account;
}
| 642 | 0.757009 | 0.757009 | 21 | 29.571428 | 21.864456 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false | 9 |
156a49b5083dcf8b57b003ece9ee97d7e846200f | 13,623,636,272,705 | e259fd3f62714f2cce7e0fb2e748647e9cc844e4 | /src/main/java/du/iit/payment/dupay/services/AdminNotificationService.java | 3a77b2728b311b2fb88985d8ce188ace09d55844 | [] | no_license | hasantarek2002/dupay | https://github.com/hasantarek2002/dupay | 47408b312f9fdefe1871ac7fd9184ed166d24ac8 | ecd7a857fdc88af5d8596a1bbdd5433a0612fc1a | refs/heads/master | 2020-08-23T07:34:33.170000 | 2019-10-21T09:43:13 | 2019-10-21T10:07:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package du.iit.payment.dupay.services;
import du.iit.payment.dupay.repositories.AdminNotificationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AdminNotificationService {
private AdminNotificationRepository adminNotificationRepository;
@Autowired
public AdminNotificationService(AdminNotificationRepository adminNotificationRepository) {
this.adminNotificationRepository = adminNotificationRepository;
}
}
| UTF-8 | Java | 519 | java | AdminNotificationService.java | Java | [] | null | [] | package du.iit.payment.dupay.services;
import du.iit.payment.dupay.repositories.AdminNotificationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AdminNotificationService {
private AdminNotificationRepository adminNotificationRepository;
@Autowired
public AdminNotificationService(AdminNotificationRepository adminNotificationRepository) {
this.adminNotificationRepository = adminNotificationRepository;
}
}
| 519 | 0.855491 | 0.855491 | 16 | 31.4375 | 31.02412 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 9 |
9006b920ae8c0ada049e3353096e6b2937ef7a22 | 20,418,274,575,722 | e8ff9502ea77c7a65c7292693f738a4e54c28dde | /cloudnet-modules/cloudnet-bridge/src/main/java/de/dytanic/cloudnet/ext/bridge/velocity/VelocityCloudNetPlayerInfo.java | 79862a96a0e4e6c914757050880e5149f85884d3 | [] | no_license | ProxieTV/CloudNet-v3 | https://github.com/ProxieTV/CloudNet-v3 | 9833c76ed64645574028f17c6cc3778d8e1f5c73 | 12e9cd267e5cef4b1f06beb3f1764397b2d09f60 | refs/heads/master | 2020-09-08T20:01:04.203000 | 2019-11-02T22:38:25 | 2019-11-02T22:38:25 | 221,231,633 | 1 | 0 | null | true | 2019-11-12T14:02:24 | 2019-11-12T14:02:23 | 2019-11-02T22:38:28 | 2019-11-11T21:14:50 | 87,618 | 0 | 0 | 0 | null | false | false | package de.dytanic.cloudnet.ext.bridge.velocity;
import de.dytanic.cloudnet.driver.network.HostAndPort;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.UUID;
@ToString
@EqualsAndHashCode
final class VelocityCloudNetPlayerInfo {
private UUID uniqueId;
private String name, server;
private int ping;
private HostAndPort address;
public VelocityCloudNetPlayerInfo(UUID uniqueId, String name, String server, int ping, HostAndPort address) {
this.uniqueId = uniqueId;
this.name = name;
this.server = server;
this.ping = ping;
this.address = address;
}
public UUID getUniqueId() {
return this.uniqueId;
}
public void setUniqueId(UUID uniqueId) {
this.uniqueId = uniqueId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getServer() {
return this.server;
}
public void setServer(String server) {
this.server = server;
}
public int getPing() {
return this.ping;
}
public void setPing(int ping) {
this.ping = ping;
}
public HostAndPort getAddress() {
return this.address;
}
public void setAddress(HostAndPort address) {
this.address = address;
}
} | UTF-8 | Java | 1,376 | java | VelocityCloudNetPlayerInfo.java | Java | [] | null | [] | package de.dytanic.cloudnet.ext.bridge.velocity;
import de.dytanic.cloudnet.driver.network.HostAndPort;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.UUID;
@ToString
@EqualsAndHashCode
final class VelocityCloudNetPlayerInfo {
private UUID uniqueId;
private String name, server;
private int ping;
private HostAndPort address;
public VelocityCloudNetPlayerInfo(UUID uniqueId, String name, String server, int ping, HostAndPort address) {
this.uniqueId = uniqueId;
this.name = name;
this.server = server;
this.ping = ping;
this.address = address;
}
public UUID getUniqueId() {
return this.uniqueId;
}
public void setUniqueId(UUID uniqueId) {
this.uniqueId = uniqueId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getServer() {
return this.server;
}
public void setServer(String server) {
this.server = server;
}
public int getPing() {
return this.ping;
}
public void setPing(int ping) {
this.ping = ping;
}
public HostAndPort getAddress() {
return this.address;
}
public void setAddress(HostAndPort address) {
this.address = address;
}
} | 1,376 | 0.639535 | 0.639535 | 69 | 18.956522 | 19.464151 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.42029 | false | false | 9 |
e23b84891afe7a4126a760f2fd4200f2278f3d8e | 3,341,484,590,118 | 878dbb97f271086973b27068f229def608964b97 | /src/com/leo/ssh/action/AdminsAction.java | 36a93ef6b1e516f3f8099f1639648f2142624353 | [] | no_license | HouQi9475/GoodsSales | https://github.com/HouQi9475/GoodsSales | c196155edc5f68cc827b726d2c6195f892891e5c | 122d5889b9dee713ea1fa31b1f3450397104fdf5 | refs/heads/master | 2020-04-05T23:03:01.663000 | 2017-04-03T15:11:11 | 2017-04-03T15:11:11 | 82,903,000 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.leo.ssh.action;
import java.util.List;
import com.leo.ssh.biz.IAdminRolesBiz;
import com.leo.ssh.biz.IAdminsBiz;
import com.leo.ssh.domain.Adminroles;
import com.leo.ssh.domain.Admins;
import com.leo.ssh.page.PageBean;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ModelDriven;
public class AdminsAction extends BaseAction implements ModelDriven<Admins> {
private Admins admins;
private IAdminsBiz adminsBiz;
private IAdminRolesBiz adminRolesBiz;
private int currentPage;
private String adminids;
public String getAdminids() {
return adminids;
}
public void setAdminids(String adminids) {
this.adminids = adminids;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public void setAdminRolesBiz(IAdminRolesBiz adminRolesBiz) {
this.adminRolesBiz = adminRolesBiz;
}
public void setAdmins(Admins admins) {
this.admins = admins;
}
public void setAdminsBiz(IAdminsBiz adminsBiz) {
this.adminsBiz = adminsBiz;
}
@Override
public Admins getModel() {
// TODO Auto-generated method stub
return this.admins;
}
public String preupdate() throws Exception{
int adminsid=this.admins.getAdminid();
Admins admins=this.adminsBiz.findById(adminsid);
this.getRequest().setAttribute("admins", admins);
List<Adminroles> lstAdminroles=this.adminRolesBiz.findAll();
this.getRequest().setAttribute("lstAdminroles", lstAdminroles);
return Action.SUCCESS;
}
public String update() throws Exception{
this.adminsBiz.update(admins);
return Action.SUCCESS;
}
public String delete() throws Exception{
int adminid=this.admins.getAdminid();
this.adminsBiz.delete(adminid);
return Action.SUCCESS;
}
public String delBatchClass() throws Exception{
String[] aids = this.adminids.split(",");
for (int i = 0; i < aids.length; i++) {
this.admins.setAdminid(Integer.parseInt(aids[i]));
this.adminsBiz.delete(this.admins.getAdminid());
}
return Action.SUCCESS;
}
public String preadd() throws Exception{
List<Adminroles> lstAdminroles=this.adminRolesBiz.findAll();
this.getRequest().setAttribute("lstAdminroles", lstAdminroles);
return Action.SUCCESS;
}
public String add() throws Exception{
this.adminsBiz.add(admins);
this.admins.setAdminacount(null);
this.admins.setAdminname(null);
return Action.SUCCESS;
}
public boolean usernameExists(String adminacount){
boolean flag=this.adminsBiz.usernameExists(adminacount);
return flag;
}
public String findAll() throws Exception{
List<Admins> lstAdmins=this.adminsBiz.findAll();
this.getRequest().setAttribute("lstAdmins", lstAdmins);
return Action.SUCCESS;
}
public String findByPages() throws Exception{
String strHQL="select c from Admins as c";
List<Admins> lstAdmins=this.adminsBiz.findAll();
this.getRequest().setAttribute("lstAdmins", lstAdmins);
Object[] params=new Object[]{};
if(currentPage==0){
currentPage=1;
}
// List<Adminroles> lstRoles=this.adminRolesBiz.findAll();
// this.getRequest().setAttribute("lstRoles", lstRoles);
PageBean pageBean=this.adminsBiz.findByPage(strHQL, currentPage, 5, params);
this.getRequest().setAttribute("adminsPage", pageBean);
return Action.SUCCESS;
}
}
| UTF-8 | Java | 3,278 | java | AdminsAction.java | Java | [] | null | [] | package com.leo.ssh.action;
import java.util.List;
import com.leo.ssh.biz.IAdminRolesBiz;
import com.leo.ssh.biz.IAdminsBiz;
import com.leo.ssh.domain.Adminroles;
import com.leo.ssh.domain.Admins;
import com.leo.ssh.page.PageBean;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ModelDriven;
public class AdminsAction extends BaseAction implements ModelDriven<Admins> {
private Admins admins;
private IAdminsBiz adminsBiz;
private IAdminRolesBiz adminRolesBiz;
private int currentPage;
private String adminids;
public String getAdminids() {
return adminids;
}
public void setAdminids(String adminids) {
this.adminids = adminids;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public void setAdminRolesBiz(IAdminRolesBiz adminRolesBiz) {
this.adminRolesBiz = adminRolesBiz;
}
public void setAdmins(Admins admins) {
this.admins = admins;
}
public void setAdminsBiz(IAdminsBiz adminsBiz) {
this.adminsBiz = adminsBiz;
}
@Override
public Admins getModel() {
// TODO Auto-generated method stub
return this.admins;
}
public String preupdate() throws Exception{
int adminsid=this.admins.getAdminid();
Admins admins=this.adminsBiz.findById(adminsid);
this.getRequest().setAttribute("admins", admins);
List<Adminroles> lstAdminroles=this.adminRolesBiz.findAll();
this.getRequest().setAttribute("lstAdminroles", lstAdminroles);
return Action.SUCCESS;
}
public String update() throws Exception{
this.adminsBiz.update(admins);
return Action.SUCCESS;
}
public String delete() throws Exception{
int adminid=this.admins.getAdminid();
this.adminsBiz.delete(adminid);
return Action.SUCCESS;
}
public String delBatchClass() throws Exception{
String[] aids = this.adminids.split(",");
for (int i = 0; i < aids.length; i++) {
this.admins.setAdminid(Integer.parseInt(aids[i]));
this.adminsBiz.delete(this.admins.getAdminid());
}
return Action.SUCCESS;
}
public String preadd() throws Exception{
List<Adminroles> lstAdminroles=this.adminRolesBiz.findAll();
this.getRequest().setAttribute("lstAdminroles", lstAdminroles);
return Action.SUCCESS;
}
public String add() throws Exception{
this.adminsBiz.add(admins);
this.admins.setAdminacount(null);
this.admins.setAdminname(null);
return Action.SUCCESS;
}
public boolean usernameExists(String adminacount){
boolean flag=this.adminsBiz.usernameExists(adminacount);
return flag;
}
public String findAll() throws Exception{
List<Admins> lstAdmins=this.adminsBiz.findAll();
this.getRequest().setAttribute("lstAdmins", lstAdmins);
return Action.SUCCESS;
}
public String findByPages() throws Exception{
String strHQL="select c from Admins as c";
List<Admins> lstAdmins=this.adminsBiz.findAll();
this.getRequest().setAttribute("lstAdmins", lstAdmins);
Object[] params=new Object[]{};
if(currentPage==0){
currentPage=1;
}
// List<Adminroles> lstRoles=this.adminRolesBiz.findAll();
// this.getRequest().setAttribute("lstRoles", lstRoles);
PageBean pageBean=this.adminsBiz.findByPage(strHQL, currentPage, 5, params);
this.getRequest().setAttribute("adminsPage", pageBean);
return Action.SUCCESS;
}
}
| 3,278 | 0.755034 | 0.753203 | 114 | 27.754387 | 20.84469 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.885965 | false | false | 9 |
f3ce1ebce5ed17b8f1abd8b3e724ba997c81e2dc | 24,180,665,900,296 | bd356293b8c795c62943aa5d7a12d05af53e3bfa | /src/cn/py/ack/wordcount/WordTopology.java | bbc0b4da09d5450d912d53be1c700f44c86d74ba | [
"Apache-2.0"
] | permissive | pacino616/storm02 | https://github.com/pacino616/storm02 | 526f30f9d70ff3643baab86c25724c0846e3a5d2 | bec571b888ae70d5abe87fd1c0809f06126065ef | refs/heads/master | 2020-04-09T10:51:16.466000 | 2018-12-04T02:34:25 | 2018-12-04T02:34:25 | 160,284,833 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.py.ack.wordcount;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.generated.StormTopology;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;
public class WordTopology {
public static void main(String[] args) throws Exception{
Config conf = new Config();
WordCountSpout countSpout = new WordCountSpout();
WordSplitBolt splitBolt = new WordSplitBolt();
WordCountBolt countBolt = new WordCountBolt();
WordPrintBolt printBolt = new WordPrintBolt();
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("countSpout", countSpout);
builder.setBolt("splitBolt", splitBolt,2).setNumTasks(4).shuffleGrouping("countSpout");
builder.setBolt("countBolt", countBolt,2).fieldsGrouping("splitBolt",new Fields("word"));
builder.setBolt("printBolt", printBolt).globalGrouping("countBolt");
StormTopology topology = builder.createTopology();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("countSpout", conf, topology);
// StormSubmitter cluster = new StormSubmitter();
// cluster.submitTopology("WordCountTopology", conf, topology);
}
}
| UTF-8 | Java | 1,188 | java | WordTopology.java | Java | [] | null | [] | package cn.py.ack.wordcount;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.generated.StormTopology;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;
public class WordTopology {
public static void main(String[] args) throws Exception{
Config conf = new Config();
WordCountSpout countSpout = new WordCountSpout();
WordSplitBolt splitBolt = new WordSplitBolt();
WordCountBolt countBolt = new WordCountBolt();
WordPrintBolt printBolt = new WordPrintBolt();
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("countSpout", countSpout);
builder.setBolt("splitBolt", splitBolt,2).setNumTasks(4).shuffleGrouping("countSpout");
builder.setBolt("countBolt", countBolt,2).fieldsGrouping("splitBolt",new Fields("word"));
builder.setBolt("printBolt", printBolt).globalGrouping("countBolt");
StormTopology topology = builder.createTopology();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("countSpout", conf, topology);
// StormSubmitter cluster = new StormSubmitter();
// cluster.submitTopology("WordCountTopology", conf, topology);
}
}
| 1,188 | 0.765993 | 0.763468 | 34 | 33.941177 | 26.280098 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.264706 | false | false | 9 |
43ffbe7ca495c0779bb8849758a829e0b76513eb | 17,497,696,826,296 | d5678884d1d6fc52f50a04bdfd50daf80b8eaa9c | /app/src/main/java/com/intellisense/review/activities/Personal_Info_activity.java | 76cf2da1e272051a0c9db4cca1c575786e696b5f | [] | no_license | SalwaImtiaz/ReviewApplication | https://github.com/SalwaImtiaz/ReviewApplication | 8e2d63acf2693b7c6ab26efdea26893ff296c67a | 783d0e8a3172fdce410eddcdfac16153b09977c3 | refs/heads/master | 2021-10-28T00:43:20.924000 | 2019-04-20T19:04:32 | 2019-04-20T19:04:32 | 164,220,052 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.intellisense.review.activities;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.intellisense.review.MainActivity;
import com.intellisense.review.R;
import com.intellisense.review.db_classes.SessionManager;
import java.util.Calendar;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Personal_Info_activity extends AppCompatActivity {
EditText name,email,contact;
TextView birth,anniversary;
TextView error,nameerror;
Button move;
ImageView btnbirth,btnanniversary;
SessionManager session;
private DatePickerDialog.OnDateSetListener mDateSetListner;
private DatePickerDialog.OnDateSetListener mDateSetListner1;
final Calendar myCalendar = Calendar.getInstance();
@Override
public void onBackPressed() {startActivity(new Intent (Personal_Info_activity.this, Review_one.class));}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate ( savedInstanceState );
setContentView ( R.layout.activity_personal__info_activity );
session = new SessionManager (getApplicationContext ());
initViews();
btnbirth.setOnClickListener(new View.OnClickListener () {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int year = myCalendar.get(Calendar.YEAR);
int month = myCalendar.get(Calendar.MONTH);
int day = myCalendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dialog = new DatePickerDialog (
Personal_Info_activity.this,
android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth,
mDateSetListner,
year,month,day);
dialog.getWindow ().setBackgroundDrawable ( new ColorDrawable ( Color.TRANSPARENT));;
dialog.show ();
}
});
mDateSetListner = new DatePickerDialog.OnDateSetListener () {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
month = month +1;
String date = month +"/" + dayOfMonth + "/" + year;
birth.setText(date);
}
};
btnanniversary.setOnClickListener(new View.OnClickListener () {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int year = myCalendar.get(Calendar.YEAR);
int month = myCalendar.get(Calendar.MONTH);
int day = myCalendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dialog = new DatePickerDialog (
Personal_Info_activity.this,
android.R.style.Theme_Holo_Light,
mDateSetListner1,
year,month,day);
dialog.getWindow ().setBackgroundDrawable ( new ColorDrawable ( Color.TRANSPARENT));
dialog.show ();
}
});
mDateSetListner1 = new DatePickerDialog.OnDateSetListener () {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
month = month +1;
String date = month +"/" + dayOfMonth + "/" + year;
anniversary.setText(date);
}
};
}
private boolean isValidMobile(String phone) {
boolean check= false;
if(!Pattern.matches("[a-zA-Z]+", phone)) {
if(phone.length() < 6 || phone.length() > 13) {
check = false;
// Toast.makeText(Personal_Info_activity.this,"Invalid number",Toast.LENGTH_SHORT).show();
} else {
check = true;
}
} else {
check=false;
}
return check;
}
private boolean isValidEmail(String email) {
String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern pattern = Pattern.compile(EMAIL_PATTERN);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
private void initViews(){
name = (EditText) findViewById ( R.id.name );
email = (EditText) findViewById ( R.id.email);
contact = (EditText) findViewById ( R.id.contact);
birth = (TextView) findViewById ( R.id.DOB);
anniversary = (TextView) findViewById ( R.id.anniversary);
move = (Button) findViewById ( R.id.next );
error = (TextView) findViewById ( R.id.error );
nameerror = (TextView) findViewById ( R.id. nameerror);
btnbirth =(ImageView)findViewById ( R.id.btnbirth );
btnanniversary = (ImageView) findViewById ( R.id.btnanniversary );
}
public void move_activity(View v) {
//getting values
String customerName = name.getText ().toString () ;
String customerEmail = email.getText ().toString () ;
String customerContact = contact.getText ().toString () ;
String customerBirth = birth.getText ().toString () ;
String customerAnniversary = anniversary.getText ().toString () ;
if(customerName.length () <= 2 )
{
error.setVisibility ( View.VISIBLE );
nameerror.setVisibility ( View.VISIBLE );
error.setText("Please fill in your name correctly");
new Handler ().postDelayed( new Runnable() {
@Override
public void run() {
error.setVisibility ( View.INVISIBLE );
}
}, 4000);
}
else if (customerContact.length () != 0 && (customerContact.length () < 6 || customerContact.length () > 13)) {
// if(!isValidMobile ( customerContact))
// if (customerContact.length () < 6 || customerContact.length () > 13)
Toast.makeText ( Personal_Info_activity.this, "Recheck your number", Toast.LENGTH_SHORT ).show ();
}
else if (customerEmail.length () != 0 && (!isValidEmail(customerEmail))) {
// if
Toast.makeText(Personal_Info_activity.this,"Invalid Email",Toast.LENGTH_SHORT).show();
}
// else if(customerName.length () !=0 &&(customerContact.length () != 0 || customerContact.length () == 0 || customerEmail.length () != 0 || customerEmail.length () == 0 || customerBirth.length () != 0 || customerBirth.length () ==0 || customerAnniversary.length () != 0 ||customerAnniversary.length () ==0 ))
else{
Log.e("values from user",customerAnniversary+" "+customerBirth+" "+customerContact+" "+customerEmail+" "+customerName);
//storing to session
HashMap<String, String> user = session.getUserDetails ();
final String rate = user.get (SessionManager.ratings);
session.createLoginSession (rate,customerName,customerContact,customerEmail,customerBirth,customerAnniversary,null,null,null,null);
final String rate1 = user.get (SessionManager.ratings);
final String name = user.get (SessionManager.customer_name);
final String contact = user.get (SessionManager.customer_contact_no);
final String email = user.get (SessionManager.customer_email);
final String birth = user.get (SessionManager.customer_birthday);
final String anniversary = user.get (SessionManager.customer_anniversary);
Log.e("values from session",rate1+" "+name+" "+contact+" "+email+" "+birth+" "+anniversary);
startActivity(new Intent (Personal_Info_activity.this, More_Info_Activity.class));
// startActivity(new Intent( Settings.ACTION_ADD_ACCOUNT));
}
}
}
| UTF-8 | Java | 8,403 | java | Personal_Info_activity.java | Java | [] | null | [] | package com.intellisense.review.activities;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.intellisense.review.MainActivity;
import com.intellisense.review.R;
import com.intellisense.review.db_classes.SessionManager;
import java.util.Calendar;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Personal_Info_activity extends AppCompatActivity {
EditText name,email,contact;
TextView birth,anniversary;
TextView error,nameerror;
Button move;
ImageView btnbirth,btnanniversary;
SessionManager session;
private DatePickerDialog.OnDateSetListener mDateSetListner;
private DatePickerDialog.OnDateSetListener mDateSetListner1;
final Calendar myCalendar = Calendar.getInstance();
@Override
public void onBackPressed() {startActivity(new Intent (Personal_Info_activity.this, Review_one.class));}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate ( savedInstanceState );
setContentView ( R.layout.activity_personal__info_activity );
session = new SessionManager (getApplicationContext ());
initViews();
btnbirth.setOnClickListener(new View.OnClickListener () {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int year = myCalendar.get(Calendar.YEAR);
int month = myCalendar.get(Calendar.MONTH);
int day = myCalendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dialog = new DatePickerDialog (
Personal_Info_activity.this,
android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth,
mDateSetListner,
year,month,day);
dialog.getWindow ().setBackgroundDrawable ( new ColorDrawable ( Color.TRANSPARENT));;
dialog.show ();
}
});
mDateSetListner = new DatePickerDialog.OnDateSetListener () {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
month = month +1;
String date = month +"/" + dayOfMonth + "/" + year;
birth.setText(date);
}
};
btnanniversary.setOnClickListener(new View.OnClickListener () {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int year = myCalendar.get(Calendar.YEAR);
int month = myCalendar.get(Calendar.MONTH);
int day = myCalendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dialog = new DatePickerDialog (
Personal_Info_activity.this,
android.R.style.Theme_Holo_Light,
mDateSetListner1,
year,month,day);
dialog.getWindow ().setBackgroundDrawable ( new ColorDrawable ( Color.TRANSPARENT));
dialog.show ();
}
});
mDateSetListner1 = new DatePickerDialog.OnDateSetListener () {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
month = month +1;
String date = month +"/" + dayOfMonth + "/" + year;
anniversary.setText(date);
}
};
}
private boolean isValidMobile(String phone) {
boolean check= false;
if(!Pattern.matches("[a-zA-Z]+", phone)) {
if(phone.length() < 6 || phone.length() > 13) {
check = false;
// Toast.makeText(Personal_Info_activity.this,"Invalid number",Toast.LENGTH_SHORT).show();
} else {
check = true;
}
} else {
check=false;
}
return check;
}
private boolean isValidEmail(String email) {
String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern pattern = Pattern.compile(EMAIL_PATTERN);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
private void initViews(){
name = (EditText) findViewById ( R.id.name );
email = (EditText) findViewById ( R.id.email);
contact = (EditText) findViewById ( R.id.contact);
birth = (TextView) findViewById ( R.id.DOB);
anniversary = (TextView) findViewById ( R.id.anniversary);
move = (Button) findViewById ( R.id.next );
error = (TextView) findViewById ( R.id.error );
nameerror = (TextView) findViewById ( R.id. nameerror);
btnbirth =(ImageView)findViewById ( R.id.btnbirth );
btnanniversary = (ImageView) findViewById ( R.id.btnanniversary );
}
public void move_activity(View v) {
//getting values
String customerName = name.getText ().toString () ;
String customerEmail = email.getText ().toString () ;
String customerContact = contact.getText ().toString () ;
String customerBirth = birth.getText ().toString () ;
String customerAnniversary = anniversary.getText ().toString () ;
if(customerName.length () <= 2 )
{
error.setVisibility ( View.VISIBLE );
nameerror.setVisibility ( View.VISIBLE );
error.setText("Please fill in your name correctly");
new Handler ().postDelayed( new Runnable() {
@Override
public void run() {
error.setVisibility ( View.INVISIBLE );
}
}, 4000);
}
else if (customerContact.length () != 0 && (customerContact.length () < 6 || customerContact.length () > 13)) {
// if(!isValidMobile ( customerContact))
// if (customerContact.length () < 6 || customerContact.length () > 13)
Toast.makeText ( Personal_Info_activity.this, "Recheck your number", Toast.LENGTH_SHORT ).show ();
}
else if (customerEmail.length () != 0 && (!isValidEmail(customerEmail))) {
// if
Toast.makeText(Personal_Info_activity.this,"Invalid Email",Toast.LENGTH_SHORT).show();
}
// else if(customerName.length () !=0 &&(customerContact.length () != 0 || customerContact.length () == 0 || customerEmail.length () != 0 || customerEmail.length () == 0 || customerBirth.length () != 0 || customerBirth.length () ==0 || customerAnniversary.length () != 0 ||customerAnniversary.length () ==0 ))
else{
Log.e("values from user",customerAnniversary+" "+customerBirth+" "+customerContact+" "+customerEmail+" "+customerName);
//storing to session
HashMap<String, String> user = session.getUserDetails ();
final String rate = user.get (SessionManager.ratings);
session.createLoginSession (rate,customerName,customerContact,customerEmail,customerBirth,customerAnniversary,null,null,null,null);
final String rate1 = user.get (SessionManager.ratings);
final String name = user.get (SessionManager.customer_name);
final String contact = user.get (SessionManager.customer_contact_no);
final String email = user.get (SessionManager.customer_email);
final String birth = user.get (SessionManager.customer_birthday);
final String anniversary = user.get (SessionManager.customer_anniversary);
Log.e("values from session",rate1+" "+name+" "+contact+" "+email+" "+birth+" "+anniversary);
startActivity(new Intent (Personal_Info_activity.this, More_Info_Activity.class));
// startActivity(new Intent( Settings.ACTION_ADD_ACCOUNT));
}
}
}
| 8,403 | 0.611686 | 0.606688 | 202 | 40.58416 | 36.041031 | 319 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.846535 | false | false | 9 |
70d68218c08ff63f399e5f36aa93e225237e0400 | 21,268,678,097,504 | b91b62230eb5fdb06b0c8756b5fe0a1633e18053 | /src/main/java/com/houston/legacy/adapter/source/parts/SourceBlockPart.java | 0e9da7b6690469fa98cdd17e11663da8f9d2de13 | [] | no_license | pajuh/Legacy | https://github.com/pajuh/Legacy | 1ceffc9dba9e4c13b6fe0dfd6fc3ca54d319a0f0 | 99c7258f7e4e79c090511493361c5f722b163a82 | refs/heads/master | 2016-08-03T14:00:21.629000 | 2011-02-23T20:01:47 | 2011-02-23T20:01:47 | 1,386,028 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* @author pasi.honkanen@houston-inc.com
*/
package com.houston.legacy.adapter.source.parts;
import java.lang.reflect.Method;
import java.util.List;
public class SourceBlockPart implements MethodPart {
private final List<MethodPart> sourceBlockParts;
public SourceBlockPart(List<MethodPart> sourceBlockParts) {
this.sourceBlockParts = sourceBlockParts;
}
@Override
public String build(Method method) {
StringBuilder content = new StringBuilder();
content.append("{");
for (MethodPart part : sourceBlockParts) {
content.append(part.build(method));
}
content.append("}");
return content.toString();
}
} | UTF-8 | Java | 635 | java | SourceBlockPart.java | Java | [
{
"context": "/**\n * @author pasi.honkanen@houston-inc.com\n */\npackage com.houston.legacy.adapter.source.par",
"end": 44,
"score": 0.9998583197593689,
"start": 15,
"tag": "EMAIL",
"value": "pasi.honkanen@houston-inc.com"
}
] | null | [] | /**
* @author <EMAIL>
*/
package com.houston.legacy.adapter.source.parts;
import java.lang.reflect.Method;
import java.util.List;
public class SourceBlockPart implements MethodPart {
private final List<MethodPart> sourceBlockParts;
public SourceBlockPart(List<MethodPart> sourceBlockParts) {
this.sourceBlockParts = sourceBlockParts;
}
@Override
public String build(Method method) {
StringBuilder content = new StringBuilder();
content.append("{");
for (MethodPart part : sourceBlockParts) {
content.append(part.build(method));
}
content.append("}");
return content.toString();
}
} | 613 | 0.744882 | 0.744882 | 28 | 21.714285 | 20.281691 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.214286 | false | false | 9 |
0b1f8a934aa993abc1eee60cd4405d2500c67de9 | 5,514,738,031,111 | d91833a8ecaabb4884fd8ffa456b737c21a3fb9a | /src/main/java/fun/lewisdev/sponsoredslots/slot/SponsoredSlot.java | 7a7e51667d331419fd76e40dd2127f1941fd6af7 | [] | no_license | ItsLewizzz/SponsoredSlotsAPI | https://github.com/ItsLewizzz/SponsoredSlotsAPI | 8c7577f758cb61f52dda0f5b4dd848a52606383b | f66d2b186a8a9368986110c65e8dd8d365ab7307 | refs/heads/master | 2022-12-17T09:01:48.201000 | 2020-09-18T13:39:05 | 2020-09-18T13:39:05 | 296,631,125 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fun.lewisdev.sponsoredslots.slot;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
public class SponsoredSlot {
public boolean isClaimed() {
return false;
}
public final long getExpiryTime() {
return 0L;
}
public long getTimeLeft() {
return 0L;
}
public UUID getOwner() {
return null;
}
public String getCommand() {
return null;
}
public double getPrice() {
return 0.0;
}
public String getMessage() {
return null;
}
public void setMessage(String message) {
}
public boolean isCustomMessageSet() {
return false;
}
public void setCustomMessageSet(boolean customMessageSet) {
}
public void setClaimed(boolean claimed) {
}
public void setTimeLeft(long timeLeft) {
}
public ItemStack getCachedHead() {
return null;
}
public OfflinePlayer getOfflinePlayer() {
return null;
}
public String getCurrencyProvider() {
return null;
}
}
| UTF-8 | Java | 1,108 | java | SponsoredSlot.java | Java | [] | null | [] | package fun.lewisdev.sponsoredslots.slot;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
public class SponsoredSlot {
public boolean isClaimed() {
return false;
}
public final long getExpiryTime() {
return 0L;
}
public long getTimeLeft() {
return 0L;
}
public UUID getOwner() {
return null;
}
public String getCommand() {
return null;
}
public double getPrice() {
return 0.0;
}
public String getMessage() {
return null;
}
public void setMessage(String message) {
}
public boolean isCustomMessageSet() {
return false;
}
public void setCustomMessageSet(boolean customMessageSet) {
}
public void setClaimed(boolean claimed) {
}
public void setTimeLeft(long timeLeft) {
}
public ItemStack getCachedHead() {
return null;
}
public OfflinePlayer getOfflinePlayer() {
return null;
}
public String getCurrencyProvider() {
return null;
}
}
| 1,108 | 0.609206 | 0.605596 | 69 | 15.057971 | 16.318287 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.217391 | false | false | 9 |
bf4011794aba5afd0392ee58c1491770ca0332fa | 26,912,265,115,694 | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/RT_News_com.rt.mobile.english/javafiles/com/google/android/gms/internal/ads/zzko.java | 6ac14a94b5b0c528a679533615555c7920e65c57 | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | https://github.com/Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789000 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.gms.internal.ads;
import android.os.*;
import com.google.android.gms.ads.formats.PublisherAdViewOptions;
// Referenced classes of package com.google.android.gms.internal.ads:
// zzek, zzkn, zzrm, zzel,
// zzrj, zzjn, zzlg, zzli,
// zzpl, zzrg, zzrd, zzra,
// zzqx, zzkh, zzkj
public abstract class zzko extends zzek
implements zzkn
{
public zzko()
{
super("com.google.android.gms.ads.internal.client.IAdLoaderBuilder");
// 0 0:aload_0
// 1 1:ldc1 #10 <String "com.google.android.gms.ads.internal.client.IAdLoaderBuilder">
// 2 3:invokespecial #13 <Method void zzek(String)>
// 3 6:return
}
protected final boolean dispatchTransaction(int i, Parcel parcel, Parcel parcel1, int j)
throws RemoteException
{
Object obj;
Object obj1;
obj1 = null;
// 0 0:aconst_null
// 1 1:astore 6
obj = null;
// 2 3:aconst_null
// 3 4:astore 5
i;
// 4 6:iload_1
JVM INSTR tableswitch 1 10: default 60
// 1 309
// 2 250
// 3 232
// 4 218
// 5 193
// 6 176
// 7 117
// 8 93
// 9 76
// 10 62;
// 5 7:tableswitch 1 10: default 60
// 1 309
// 2 250
// 3 232
// 4 218
// 5 193
// 6 176
// 7 117
// 8 93
// 9 76
// 10 62
goto _L1 _L2 _L3 _L4 _L5 _L6 _L7 _L8 _L9 _L10 _L11
_L1:
return false;
// 6 60:iconst_0
// 7 61:ireturn
_L11:
zza(zzrm.zzq(parcel.readStrongBinder()));
// 8 62:aload_0
// 9 63:aload_2
// 10 64:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 11 67:invokestatic #30 <Method zzrl zzrm.zzq(IBinder)>
// 12 70:invokevirtual #34 <Method void zza(zzrl)>
break; /* Loop/switch isn't completed */
// 13 73:goto 243
_L10:
zza((PublisherAdViewOptions)zzel.zza(parcel, PublisherAdViewOptions.CREATOR));
// 14 76:aload_0
// 15 77:aload_2
// 16 78:getstatic #40 <Field android.os.Parcelable$Creator PublisherAdViewOptions.CREATOR>
// 17 81:invokestatic #45 <Method android.os.Parcelable zzel.zza(Parcel, android.os.Parcelable$Creator)>
// 18 84:checkcast #36 <Class PublisherAdViewOptions>
// 19 87:invokevirtual #48 <Method void zza(PublisherAdViewOptions)>
break; /* Loop/switch isn't completed */
// 20 90:goto 243
_L9:
zza(zzrj.zzp(parcel.readStrongBinder()), (zzjn)zzel.zza(parcel, zzjn.CREATOR));
// 21 93:aload_0
// 22 94:aload_2
// 23 95:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 24 98:invokestatic #54 <Method zzri zzrj.zzp(IBinder)>
// 25 101:aload_2
// 26 102:getstatic #57 <Field android.os.Parcelable$Creator zzjn.CREATOR>
// 27 105:invokestatic #45 <Method android.os.Parcelable zzel.zza(Parcel, android.os.Parcelable$Creator)>
// 28 108:checkcast #56 <Class zzjn>
// 29 111:invokevirtual #60 <Method void zza(zzri, zzjn)>
break; /* Loop/switch isn't completed */
// 30 114:goto 243
_L8:
parcel = ((Parcel) (parcel.readStrongBinder()));
// 31 117:aload_2
// 32 118:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 33 121:astore_2
if(parcel == null)
//* 34 122:aload_2
//* 35 123:ifnonnull 132
{
parcel = ((Parcel) (obj));
// 36 126:aload 5
// 37 128:astore_2
} else
//* 38 129:goto 168
{
android.os.IInterface iinterface = ((IBinder) (parcel)).queryLocalInterface("com.google.android.gms.ads.internal.client.ICorrelationIdProvider");
// 39 132:aload_2
// 40 133:ldc1 #62 <String "com.google.android.gms.ads.internal.client.ICorrelationIdProvider">
// 41 135:invokeinterface #68 <Method android.os.IInterface IBinder.queryLocalInterface(String)>
// 42 140:astore 5
if(iinterface instanceof zzlg)
//* 43 142:aload 5
//* 44 144:instanceof #70 <Class zzlg>
//* 45 147:ifeq 159
parcel = ((Parcel) ((zzlg)iinterface));
// 46 150:aload 5
// 47 152:checkcast #70 <Class zzlg>
// 48 155:astore_2
else
//* 49 156:goto 168
parcel = ((Parcel) (new zzli(((IBinder) (parcel)))));
// 50 159:new #72 <Class zzli>
// 51 162:dup
// 52 163:aload_2
// 53 164:invokespecial #75 <Method void zzli(IBinder)>
// 54 167:astore_2
}
zzb(((zzlg) (parcel)));
// 55 168:aload_0
// 56 169:aload_2
// 57 170:invokevirtual #79 <Method void zzb(zzlg)>
break; /* Loop/switch isn't completed */
// 58 173:goto 243
_L7:
zza((zzpl)zzel.zza(parcel, zzpl.CREATOR));
// 59 176:aload_0
// 60 177:aload_2
// 61 178:getstatic #82 <Field android.os.Parcelable$Creator zzpl.CREATOR>
// 62 181:invokestatic #45 <Method android.os.Parcelable zzel.zza(Parcel, android.os.Parcelable$Creator)>
// 63 184:checkcast #81 <Class zzpl>
// 64 187:invokevirtual #85 <Method void zza(zzpl)>
break; /* Loop/switch isn't completed */
// 65 190:goto 243
_L6:
zza(parcel.readString(), zzrg.zzo(parcel.readStrongBinder()), zzrd.zzn(parcel.readStrongBinder()));
// 66 193:aload_0
// 67 194:aload_2
// 68 195:invokevirtual #89 <Method String Parcel.readString()>
// 69 198:aload_2
// 70 199:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 71 202:invokestatic #95 <Method zzrf zzrg.zzo(IBinder)>
// 72 205:aload_2
// 73 206:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 74 209:invokestatic #101 <Method zzrc zzrd.zzn(IBinder)>
// 75 212:invokevirtual #104 <Method void zza(String, zzrf, zzrc)>
break; /* Loop/switch isn't completed */
// 76 215:goto 243
_L5:
zza(zzra.zzm(parcel.readStrongBinder()));
// 77 218:aload_0
// 78 219:aload_2
// 79 220:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 80 223:invokestatic #110 <Method zzqz zzra.zzm(IBinder)>
// 81 226:invokevirtual #113 <Method void zza(zzqz)>
break; /* Loop/switch isn't completed */
// 82 229:goto 243
_L4:
zza(zzqx.zzl(parcel.readStrongBinder()));
// 83 232:aload_0
// 84 233:aload_2
// 85 234:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 86 237:invokestatic #119 <Method zzqw zzqx.zzl(IBinder)>
// 87 240:invokevirtual #122 <Method void zza(zzqw)>
_L13:
parcel1.writeNoException();
// 88 243:aload_3
// 89 244:invokevirtual #125 <Method void Parcel.writeNoException()>
break; /* Loop/switch isn't completed */
// 90 247:goto 323
_L3:
parcel = ((Parcel) (parcel.readStrongBinder()));
// 91 250:aload_2
// 92 251:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 93 254:astore_2
if(parcel == null)
//* 94 255:aload_2
//* 95 256:ifnonnull 265
{
parcel = ((Parcel) (obj1));
// 96 259:aload 6
// 97 261:astore_2
} else
//* 98 262:goto 301
{
android.os.IInterface iinterface1 = ((IBinder) (parcel)).queryLocalInterface("com.google.android.gms.ads.internal.client.IAdListener");
// 99 265:aload_2
// 100 266:ldc1 #127 <String "com.google.android.gms.ads.internal.client.IAdListener">
// 101 268:invokeinterface #68 <Method android.os.IInterface IBinder.queryLocalInterface(String)>
// 102 273:astore 5
if(iinterface1 instanceof zzkh)
//* 103 275:aload 5
//* 104 277:instanceof #129 <Class zzkh>
//* 105 280:ifeq 292
parcel = ((Parcel) ((zzkh)iinterface1));
// 106 283:aload 5
// 107 285:checkcast #129 <Class zzkh>
// 108 288:astore_2
else
//* 109 289:goto 301
parcel = ((Parcel) (new zzkj(((IBinder) (parcel)))));
// 110 292:new #131 <Class zzkj>
// 111 295:dup
// 112 296:aload_2
// 113 297:invokespecial #132 <Method void zzkj(IBinder)>
// 114 300:astore_2
}
zzb(((zzkh) (parcel)));
// 115 301:aload_0
// 116 302:aload_2
// 117 303:invokevirtual #135 <Method void zzb(zzkh)>
if(true) goto _L13; else goto _L12
// 118 306:goto 243
_L2:
parcel = ((Parcel) (zzdh()));
// 119 309:aload_0
// 120 310:invokevirtual #139 <Method zzkk zzdh()>
// 121 313:astore_2
parcel1.writeNoException();
// 122 314:aload_3
// 123 315:invokevirtual #125 <Method void Parcel.writeNoException()>
zzel.zza(parcel1, ((android.os.IInterface) (parcel)));
// 124 318:aload_3
// 125 319:aload_2
// 126 320:invokestatic #142 <Method void zzel.zza(Parcel, android.os.IInterface)>
_L12:
return true;
// 127 323:iconst_1
// 128 324:ireturn
}
}
| UTF-8 | Java | 9,724 | java | zzko.java | Java | [
{
"context": "// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.kpdus.com/jad.html\n",
"end": 61,
"score": 0.999560534954071,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null | [] | // Decompiled by Jad v1.5.8g. Copyright 2001 <NAME>.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.gms.internal.ads;
import android.os.*;
import com.google.android.gms.ads.formats.PublisherAdViewOptions;
// Referenced classes of package com.google.android.gms.internal.ads:
// zzek, zzkn, zzrm, zzel,
// zzrj, zzjn, zzlg, zzli,
// zzpl, zzrg, zzrd, zzra,
// zzqx, zzkh, zzkj
public abstract class zzko extends zzek
implements zzkn
{
public zzko()
{
super("com.google.android.gms.ads.internal.client.IAdLoaderBuilder");
// 0 0:aload_0
// 1 1:ldc1 #10 <String "com.google.android.gms.ads.internal.client.IAdLoaderBuilder">
// 2 3:invokespecial #13 <Method void zzek(String)>
// 3 6:return
}
protected final boolean dispatchTransaction(int i, Parcel parcel, Parcel parcel1, int j)
throws RemoteException
{
Object obj;
Object obj1;
obj1 = null;
// 0 0:aconst_null
// 1 1:astore 6
obj = null;
// 2 3:aconst_null
// 3 4:astore 5
i;
// 4 6:iload_1
JVM INSTR tableswitch 1 10: default 60
// 1 309
// 2 250
// 3 232
// 4 218
// 5 193
// 6 176
// 7 117
// 8 93
// 9 76
// 10 62;
// 5 7:tableswitch 1 10: default 60
// 1 309
// 2 250
// 3 232
// 4 218
// 5 193
// 6 176
// 7 117
// 8 93
// 9 76
// 10 62
goto _L1 _L2 _L3 _L4 _L5 _L6 _L7 _L8 _L9 _L10 _L11
_L1:
return false;
// 6 60:iconst_0
// 7 61:ireturn
_L11:
zza(zzrm.zzq(parcel.readStrongBinder()));
// 8 62:aload_0
// 9 63:aload_2
// 10 64:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 11 67:invokestatic #30 <Method zzrl zzrm.zzq(IBinder)>
// 12 70:invokevirtual #34 <Method void zza(zzrl)>
break; /* Loop/switch isn't completed */
// 13 73:goto 243
_L10:
zza((PublisherAdViewOptions)zzel.zza(parcel, PublisherAdViewOptions.CREATOR));
// 14 76:aload_0
// 15 77:aload_2
// 16 78:getstatic #40 <Field android.os.Parcelable$Creator PublisherAdViewOptions.CREATOR>
// 17 81:invokestatic #45 <Method android.os.Parcelable zzel.zza(Parcel, android.os.Parcelable$Creator)>
// 18 84:checkcast #36 <Class PublisherAdViewOptions>
// 19 87:invokevirtual #48 <Method void zza(PublisherAdViewOptions)>
break; /* Loop/switch isn't completed */
// 20 90:goto 243
_L9:
zza(zzrj.zzp(parcel.readStrongBinder()), (zzjn)zzel.zza(parcel, zzjn.CREATOR));
// 21 93:aload_0
// 22 94:aload_2
// 23 95:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 24 98:invokestatic #54 <Method zzri zzrj.zzp(IBinder)>
// 25 101:aload_2
// 26 102:getstatic #57 <Field android.os.Parcelable$Creator zzjn.CREATOR>
// 27 105:invokestatic #45 <Method android.os.Parcelable zzel.zza(Parcel, android.os.Parcelable$Creator)>
// 28 108:checkcast #56 <Class zzjn>
// 29 111:invokevirtual #60 <Method void zza(zzri, zzjn)>
break; /* Loop/switch isn't completed */
// 30 114:goto 243
_L8:
parcel = ((Parcel) (parcel.readStrongBinder()));
// 31 117:aload_2
// 32 118:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 33 121:astore_2
if(parcel == null)
//* 34 122:aload_2
//* 35 123:ifnonnull 132
{
parcel = ((Parcel) (obj));
// 36 126:aload 5
// 37 128:astore_2
} else
//* 38 129:goto 168
{
android.os.IInterface iinterface = ((IBinder) (parcel)).queryLocalInterface("com.google.android.gms.ads.internal.client.ICorrelationIdProvider");
// 39 132:aload_2
// 40 133:ldc1 #62 <String "com.google.android.gms.ads.internal.client.ICorrelationIdProvider">
// 41 135:invokeinterface #68 <Method android.os.IInterface IBinder.queryLocalInterface(String)>
// 42 140:astore 5
if(iinterface instanceof zzlg)
//* 43 142:aload 5
//* 44 144:instanceof #70 <Class zzlg>
//* 45 147:ifeq 159
parcel = ((Parcel) ((zzlg)iinterface));
// 46 150:aload 5
// 47 152:checkcast #70 <Class zzlg>
// 48 155:astore_2
else
//* 49 156:goto 168
parcel = ((Parcel) (new zzli(((IBinder) (parcel)))));
// 50 159:new #72 <Class zzli>
// 51 162:dup
// 52 163:aload_2
// 53 164:invokespecial #75 <Method void zzli(IBinder)>
// 54 167:astore_2
}
zzb(((zzlg) (parcel)));
// 55 168:aload_0
// 56 169:aload_2
// 57 170:invokevirtual #79 <Method void zzb(zzlg)>
break; /* Loop/switch isn't completed */
// 58 173:goto 243
_L7:
zza((zzpl)zzel.zza(parcel, zzpl.CREATOR));
// 59 176:aload_0
// 60 177:aload_2
// 61 178:getstatic #82 <Field android.os.Parcelable$Creator zzpl.CREATOR>
// 62 181:invokestatic #45 <Method android.os.Parcelable zzel.zza(Parcel, android.os.Parcelable$Creator)>
// 63 184:checkcast #81 <Class zzpl>
// 64 187:invokevirtual #85 <Method void zza(zzpl)>
break; /* Loop/switch isn't completed */
// 65 190:goto 243
_L6:
zza(parcel.readString(), zzrg.zzo(parcel.readStrongBinder()), zzrd.zzn(parcel.readStrongBinder()));
// 66 193:aload_0
// 67 194:aload_2
// 68 195:invokevirtual #89 <Method String Parcel.readString()>
// 69 198:aload_2
// 70 199:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 71 202:invokestatic #95 <Method zzrf zzrg.zzo(IBinder)>
// 72 205:aload_2
// 73 206:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 74 209:invokestatic #101 <Method zzrc zzrd.zzn(IBinder)>
// 75 212:invokevirtual #104 <Method void zza(String, zzrf, zzrc)>
break; /* Loop/switch isn't completed */
// 76 215:goto 243
_L5:
zza(zzra.zzm(parcel.readStrongBinder()));
// 77 218:aload_0
// 78 219:aload_2
// 79 220:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 80 223:invokestatic #110 <Method zzqz zzra.zzm(IBinder)>
// 81 226:invokevirtual #113 <Method void zza(zzqz)>
break; /* Loop/switch isn't completed */
// 82 229:goto 243
_L4:
zza(zzqx.zzl(parcel.readStrongBinder()));
// 83 232:aload_0
// 84 233:aload_2
// 85 234:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 86 237:invokestatic #119 <Method zzqw zzqx.zzl(IBinder)>
// 87 240:invokevirtual #122 <Method void zza(zzqw)>
_L13:
parcel1.writeNoException();
// 88 243:aload_3
// 89 244:invokevirtual #125 <Method void Parcel.writeNoException()>
break; /* Loop/switch isn't completed */
// 90 247:goto 323
_L3:
parcel = ((Parcel) (parcel.readStrongBinder()));
// 91 250:aload_2
// 92 251:invokevirtual #24 <Method IBinder Parcel.readStrongBinder()>
// 93 254:astore_2
if(parcel == null)
//* 94 255:aload_2
//* 95 256:ifnonnull 265
{
parcel = ((Parcel) (obj1));
// 96 259:aload 6
// 97 261:astore_2
} else
//* 98 262:goto 301
{
android.os.IInterface iinterface1 = ((IBinder) (parcel)).queryLocalInterface("com.google.android.gms.ads.internal.client.IAdListener");
// 99 265:aload_2
// 100 266:ldc1 #127 <String "com.google.android.gms.ads.internal.client.IAdListener">
// 101 268:invokeinterface #68 <Method android.os.IInterface IBinder.queryLocalInterface(String)>
// 102 273:astore 5
if(iinterface1 instanceof zzkh)
//* 103 275:aload 5
//* 104 277:instanceof #129 <Class zzkh>
//* 105 280:ifeq 292
parcel = ((Parcel) ((zzkh)iinterface1));
// 106 283:aload 5
// 107 285:checkcast #129 <Class zzkh>
// 108 288:astore_2
else
//* 109 289:goto 301
parcel = ((Parcel) (new zzkj(((IBinder) (parcel)))));
// 110 292:new #131 <Class zzkj>
// 111 295:dup
// 112 296:aload_2
// 113 297:invokespecial #132 <Method void zzkj(IBinder)>
// 114 300:astore_2
}
zzb(((zzkh) (parcel)));
// 115 301:aload_0
// 116 302:aload_2
// 117 303:invokevirtual #135 <Method void zzb(zzkh)>
if(true) goto _L13; else goto _L12
// 118 306:goto 243
_L2:
parcel = ((Parcel) (zzdh()));
// 119 309:aload_0
// 120 310:invokevirtual #139 <Method zzkk zzdh()>
// 121 313:astore_2
parcel1.writeNoException();
// 122 314:aload_3
// 123 315:invokevirtual #125 <Method void Parcel.writeNoException()>
zzel.zza(parcel1, ((android.os.IInterface) (parcel)));
// 124 318:aload_3
// 125 319:aload_2
// 126 320:invokestatic #142 <Method void zzel.zza(Parcel, android.os.IInterface)>
_L12:
return true;
// 127 323:iconst_1
// 128 324:ireturn
}
}
| 9,714 | 0.560366 | 0.456705 | 250 | 37.896 | 26.535206 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.588 | false | false | 9 |
1d01126b6ef3bb4afe5ed8776bc0227b2882db0e | 8,899,172,263,149 | cf46c457be788b7aa29481ec2f62ea4c01d24081 | /src/cursos/Sueco.java | bba5c7b6ccee1752f6736b10c59f64e479a9ff29 | [] | no_license | Lucas-Christopher/Prova_2_2015.1 | https://github.com/Lucas-Christopher/Prova_2_2015.1 | 52d52efe66cc35776f560e05e5e072466860dbe0 | b7e4547c621823c7c5d9fb88ece64849fce1c7d4 | refs/heads/master | 2016-09-18T00:20:51.949000 | 2016-09-06T03:54:38 | 2016-09-06T03:54:38 | 67,459,732 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cursos;
import escola_idiomas.Aluno;
import excecoes.MatriculaInvalidaException;
import excecoes.ProeficienciaInvalidaException;
import excecoes.StringInvalidaException;
public class Sueco extends Curso {
public Sueco(String nomeCurso) {
super(nomeCurso);
}
@Override
public double calculaFacilidade(double escrita, double escuta, double fala, double leitura)
throws MatriculaInvalidaException {
double facilidade = (0.1 * leitura) + (0.1 * escrita) + (0.3 * fala) + (0.5 * escuta);
return facilidade;
}
@Override
public String cumprimenta(String nomeAluno, double mensalidade, double escrita, double escuta, double fala,
double leitura) throws StringInvalidaException, ProeficienciaInvalidaException {
Aluno aluno = new Aluno(nomeAluno, mensalidade, escrita, escuta, fala, leitura);
String saudacao = "Hej hej! Jag heter " + aluno.getNome() + ". Trevligt att träffas.";
return saudacao;
}
}
| ISO-8859-1 | Java | 934 | java | Sueco.java | Java | [] | null | [] | package cursos;
import escola_idiomas.Aluno;
import excecoes.MatriculaInvalidaException;
import excecoes.ProeficienciaInvalidaException;
import excecoes.StringInvalidaException;
public class Sueco extends Curso {
public Sueco(String nomeCurso) {
super(nomeCurso);
}
@Override
public double calculaFacilidade(double escrita, double escuta, double fala, double leitura)
throws MatriculaInvalidaException {
double facilidade = (0.1 * leitura) + (0.1 * escrita) + (0.3 * fala) + (0.5 * escuta);
return facilidade;
}
@Override
public String cumprimenta(String nomeAluno, double mensalidade, double escrita, double escuta, double fala,
double leitura) throws StringInvalidaException, ProeficienciaInvalidaException {
Aluno aluno = new Aluno(nomeAluno, mensalidade, escrita, escuta, fala, leitura);
String saudacao = "Hej hej! Jag heter " + aluno.getNome() + ". Trevligt att träffas.";
return saudacao;
}
}
| 934 | 0.762058 | 0.753483 | 30 | 30.1 | 33.517509 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.7 | false | false | 9 |
cb97f01e6509063a671013559809a0e51ed2be23 | 23,759,759,151,618 | 6de511b9be72cbcd7e1bc4802abae2329ed7bcaf | /mimosa-orm/src/main/java/org/mimosaframework/orm/resolve/FunctionActionResolve.java | 8711a9ff245def1023662b082fb502760373a494 | [
"Apache-2.0"
] | permissive | yangankang/mimosa | https://github.com/yangankang/mimosa | d52c4c623bc73f9f45954f0854158fa43be59cbd | 7e227885c1d4775d6db24acc3b6c1d42bcf107e0 | refs/heads/master | 2018-08-27T10:39:45.272000 | 2018-05-06T16:14:04 | 2018-05-06T16:14:04 | 87,049,408 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.mimosaframework.orm.resolve;
public interface FunctionActionResolve extends ActionResolve {
}
| UTF-8 | Java | 107 | java | FunctionActionResolve.java | Java | [] | null | [] | package org.mimosaframework.orm.resolve;
public interface FunctionActionResolve extends ActionResolve {
}
| 107 | 0.850467 | 0.850467 | 4 | 25.75 | 26.423239 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 9 |
312a78426f3738b893ba91b61519fdf9423dd6c5 | 28,063,316,336,344 | 28dc5cd4de7fc834cb3282eef200c1c8abb04ac1 | /src/main/java/xyz/kvantum/bukkit/objects/KvantumPlayer.java | abf1fe862459ef4406e8e697449041bec1bd47a6 | [
"Apache-2.0"
] | permissive | Citymonstret/KvantumBukkit | https://github.com/Citymonstret/KvantumBukkit | 6318f6bc715ee2a6aa1c154415992c1328ec424c | 782487778a20c1644801a8b39687ce15b70a6d56 | refs/heads/master | 2021-08-27T23:00:13.896000 | 2017-12-10T16:14:42 | 2017-12-10T16:14:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2017 Kvantum
*
* 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 xyz.kvantum.bukkit.objects;
import edu.umd.cs.findbugs.annotations.Nullable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.json.simple.JSONObject;
import xyz.kvantum.server.api.orm.annotations.KvantumConstructor;
import xyz.kvantum.server.api.orm.annotations.KvantumField;
import xyz.kvantum.server.api.orm.annotations.KvantumInsert;
import xyz.kvantum.server.api.orm.annotations.KvantumObject;
/**
* Kvantum representation of Bukkit {@link Player}
*/
@EqualsAndHashCode
@KvantumObject
public class KvantumPlayer
{
@KvantumField( defaultValue = "" )
@Getter
private String username;
@KvantumField( defaultValue = "" )
@Getter
private String uuid;
@KvantumField( defaultValue = "" )
@Getter
private String world;
@Getter
private final boolean complete;
@Getter
private boolean online;
/**
* Kvantum constructor
*
* @param username nullable player username
* @param uuid nullable player uuid
* @param world nullable player world
*/
@KvantumConstructor
public KvantumPlayer(@Nullable @KvantumInsert( "username" ) final String username,
@Nullable @KvantumInsert( "uuid") final String uuid,
@Nullable @KvantumInsert( "world" ) final String world)
{
this.username = username;
this.uuid = uuid;
this.world = world;
this.complete = false;
}
/**
* Construct a Kvantum player from a Bukkit player
*
* @param bukkitPlayer Bukkit player
*/
public KvantumPlayer(@NonNull final Player bukkitPlayer)
{
this.username = bukkitPlayer.getDisplayName();
this.uuid = bukkitPlayer.getUniqueId().toString();
this.world = bukkitPlayer.getWorld().getName();
this.complete = true;
this.online = true;
}
/**
* Construct a Kvantum player from a Bukkit offline player
*
* @param offlinePlayer Bukkit offline player
*/
public KvantumPlayer(@NonNull final OfflinePlayer offlinePlayer)
{
this.username = offlinePlayer.getName();
this.uuid = offlinePlayer.getUniqueId().toString();
final Location location = offlinePlayer.getBedSpawnLocation();
if ( location != null )
{
this.world = location.getWorld().getName();
} else
{
this.world = Bukkit.getWorlds().get( 0 ).getName();
}
this.complete = true;
this.online = false;
}
/**
* Get a JSON object representing the player
*
* @return JSON object
*/
public JSONObject toJson()
{
final JSONObject object = new JSONObject();
object.put( "username", this.username );
object.put( "uuid", this.uuid );
object.put( "online", this.online );
object.put( "world", this.world );
return object;
}
}
| UTF-8 | Java | 3,669 | java | KvantumPlayer.java | Java | [
{
"context": "/*\n * Copyright (C) 2017 Kvantum\n *\n * Licensed under the Apache License, Version ",
"end": 35,
"score": 0.9897160530090332,
"start": 28,
"tag": "USERNAME",
"value": "Kvantum"
},
{
"context": " final String world)\n {\n this.username = username;\n ... | null | [] | /*
* Copyright (C) 2017 Kvantum
*
* 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 xyz.kvantum.bukkit.objects;
import edu.umd.cs.findbugs.annotations.Nullable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.json.simple.JSONObject;
import xyz.kvantum.server.api.orm.annotations.KvantumConstructor;
import xyz.kvantum.server.api.orm.annotations.KvantumField;
import xyz.kvantum.server.api.orm.annotations.KvantumInsert;
import xyz.kvantum.server.api.orm.annotations.KvantumObject;
/**
* Kvantum representation of Bukkit {@link Player}
*/
@EqualsAndHashCode
@KvantumObject
public class KvantumPlayer
{
@KvantumField( defaultValue = "" )
@Getter
private String username;
@KvantumField( defaultValue = "" )
@Getter
private String uuid;
@KvantumField( defaultValue = "" )
@Getter
private String world;
@Getter
private final boolean complete;
@Getter
private boolean online;
/**
* Kvantum constructor
*
* @param username nullable player username
* @param uuid nullable player uuid
* @param world nullable player world
*/
@KvantumConstructor
public KvantumPlayer(@Nullable @KvantumInsert( "username" ) final String username,
@Nullable @KvantumInsert( "uuid") final String uuid,
@Nullable @KvantumInsert( "world" ) final String world)
{
this.username = username;
this.uuid = uuid;
this.world = world;
this.complete = false;
}
/**
* Construct a Kvantum player from a Bukkit player
*
* @param bukkitPlayer Bukkit player
*/
public KvantumPlayer(@NonNull final Player bukkitPlayer)
{
this.username = bukkitPlayer.getDisplayName();
this.uuid = bukkitPlayer.getUniqueId().toString();
this.world = bukkitPlayer.getWorld().getName();
this.complete = true;
this.online = true;
}
/**
* Construct a Kvantum player from a Bukkit offline player
*
* @param offlinePlayer Bukkit offline player
*/
public KvantumPlayer(@NonNull final OfflinePlayer offlinePlayer)
{
this.username = offlinePlayer.getName();
this.uuid = offlinePlayer.getUniqueId().toString();
final Location location = offlinePlayer.getBedSpawnLocation();
if ( location != null )
{
this.world = location.getWorld().getName();
} else
{
this.world = Bukkit.getWorlds().get( 0 ).getName();
}
this.complete = true;
this.online = false;
}
/**
* Get a JSON object representing the player
*
* @return JSON object
*/
public JSONObject toJson()
{
final JSONObject object = new JSONObject();
object.put( "username", this.username );
object.put( "uuid", this.uuid );
object.put( "online", this.online );
object.put( "world", this.world );
return object;
}
}
| 3,669 | 0.657127 | 0.654674 | 126 | 28.119047 | 23.326736 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.412698 | false | false | 9 |
04d16d0f0c33502746fcde6d4f87a48e4917a535 | 32,804,960,222,524 | 9eb21fa34e6c933f9f1251d69c0db83a4b376dc7 | /Workspace/LojaR/LojaJSF/src/br/unit/mbean/NovaCategoria.java | e6ed35b86eabdda4f6141ab022ea674b6de47217 | [] | no_license | RafasTavares/TecWEB_III | https://github.com/RafasTavares/TecWEB_III | e8c0d796f81cf8a7d4322c2f1244c6441507c0e4 | 5d8edff7ce2efc4f2a9886af248a8ab574c441d9 | refs/heads/master | 2016-09-10T00:17:02.840000 | 2014-06-15T17:43:22 | 2014-06-15T17:43:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.unit.mbean;
import java.io.IOException;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import br.unit.classes.Categoria;
import br.unit.ejb.GerenciarCategorias;
public class NovaCategoria {
private Categoria categoria;
private int codigoEditando;
private ExternalContext ex = FacesContext.getCurrentInstance()
.getExternalContext();
@EJB
private GerenciarCategorias gerenciador;
public Categoria getCategoria() {
if (ex.getRequestMap()
.get("codigoCategoria") != null){
codigoEditando = (Integer)ex.getRequestMap()
.get("codigoCategoria");
categoria = gerenciador.obterCategoriaPorCodigo(codigoEditando);
}else if (categoria == null) {
categoria = new Categoria();
}
return categoria;
}
public void cbSalvarActionListener(ActionEvent event) throws IOException {
if (categoria.getCodigo() == 0) {
categoria.setCodigo(codigoEditando);
gerenciador.inserirCategoria(categoria);
}else {
gerenciador.alterarNomeCategoria(categoria.getCodigo(), categoria.getNome());
}
}
}
| UTF-8 | Java | 1,241 | java | NovaCategoria.java | Java | [] | null | [] | package br.unit.mbean;
import java.io.IOException;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import br.unit.classes.Categoria;
import br.unit.ejb.GerenciarCategorias;
public class NovaCategoria {
private Categoria categoria;
private int codigoEditando;
private ExternalContext ex = FacesContext.getCurrentInstance()
.getExternalContext();
@EJB
private GerenciarCategorias gerenciador;
public Categoria getCategoria() {
if (ex.getRequestMap()
.get("codigoCategoria") != null){
codigoEditando = (Integer)ex.getRequestMap()
.get("codigoCategoria");
categoria = gerenciador.obterCategoriaPorCodigo(codigoEditando);
}else if (categoria == null) {
categoria = new Categoria();
}
return categoria;
}
public void cbSalvarActionListener(ActionEvent event) throws IOException {
if (categoria.getCodigo() == 0) {
categoria.setCodigo(codigoEditando);
gerenciador.inserirCategoria(categoria);
}else {
gerenciador.alterarNomeCategoria(categoria.getCodigo(), categoria.getNome());
}
}
}
| 1,241 | 0.764706 | 0.7639 | 45 | 26.577778 | 21.368189 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.866667 | false | false | 9 |
344f32fd6df15adf25b08250972fe289dfd096ea | 28,999,619,189,538 | 454eb75d7402c4a0da0e4c30fb91aca4856bbd03 | /o2o/trunk/public/entity/src/main/java/cn/com/dyninfo/o2o/communication/PaymentRequest.java | c35bfee0af89a850b1f4d7bf43a497d90decdb3b | [] | no_license | fengclondy/guanhongshijia | https://github.com/fengclondy/guanhongshijia | 15a43f6007cdf996f57c4d09f61b25143b117d73 | c710fe725022fe82aefcb552ebe6d86dcb598d75 | refs/heads/master | 2020-04-15T16:43:37.291000 | 2016-09-09T05:44:14 | 2016-09-09T05:44:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.com.dyninfo.o2o.communication;
import cn.com.dyninfo.o2o.communication.common.BaseRequest;
/**
* Created by Administrator on 2016/7/29.
*/
public class PaymentRequest extends BaseRequest {
//TODO 待确认是否通过后台
}
| UTF-8 | Java | 257 | java | PaymentRequest.java | Java | [
{
"context": "nication.common.BaseRequest;\r\n\r\n/**\r\n * Created by Administrator on 2016/7/29.\r\n */\r\npublic class PaymentRequest e",
"end": 140,
"score": 0.8318501114845276,
"start": 127,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package cn.com.dyninfo.o2o.communication;
import cn.com.dyninfo.o2o.communication.common.BaseRequest;
/**
* Created by Administrator on 2016/7/29.
*/
public class PaymentRequest extends BaseRequest {
//TODO 待确认是否通过后台
}
| 257 | 0.723849 | 0.686192 | 11 | 19.727272 | 22.119884 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 9 |
a832fd9916a123ac4f92a93a6a88b7682a84d5bf | 28,999,619,191,730 | 276ace4098cc43a130615a35369c3f2c7042b555 | /algorithm/src/main/java/org/api4/java/algorithm/IAlgorithmConfig.java | f2b15ed9a7c2754db2441f3174dbd0a00bd3f9ec | [] | no_license | starlibs/api4 | https://github.com/starlibs/api4 | 0773c04424dc25fcff6946593b8ff9d9712d00d1 | 890d50637838bfb92618f7af247ac3e769bd1715 | refs/heads/master | 2021-07-10T11:32:32.807000 | 2020-01-08T22:04:44 | 2020-01-08T22:04:44 | 195,792,781 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.api4.java.algorithm;
import org.api4.java.common.control.IConfig;
/**
* Defines some basic properties relevant to all algorithms.
*
* @author Felix Mohr
*
*/
public interface IAlgorithmConfig extends IConfig {
/**
* @return Number of CPU cores available for parallelization.
*/
public int cpus();
/**
* @return Number of threads that may be spawned by the algorithm. If set to -1, the number of CPUs is used as the number of threads. If set to 0, parallelization is deactivated.
*/
public int threads();
/**
* @return The main memory that is available to be used. This is merely a documentation variable since the true memory must be set over the JVM initialization anyway and cannot be restricted inside of it.
*/
public int memory();
/**
* @return Overall timeout for the algorithm in milliseconds.
*/
public long timeout();
}
| UTF-8 | Java | 908 | java | IAlgorithmConfig.java | Java | [
{
"context": "erties relevant to all algorithms.\r\n *\r\n * @author Felix Mohr\r\n *\r\n */\r\npublic interface IAlgorithmConfig exten",
"end": 176,
"score": 0.9997959136962891,
"start": 166,
"tag": "NAME",
"value": "Felix Mohr"
}
] | null | [] | package org.api4.java.algorithm;
import org.api4.java.common.control.IConfig;
/**
* Defines some basic properties relevant to all algorithms.
*
* @author <NAME>
*
*/
public interface IAlgorithmConfig extends IConfig {
/**
* @return Number of CPU cores available for parallelization.
*/
public int cpus();
/**
* @return Number of threads that may be spawned by the algorithm. If set to -1, the number of CPUs is used as the number of threads. If set to 0, parallelization is deactivated.
*/
public int threads();
/**
* @return The main memory that is available to be used. This is merely a documentation variable since the true memory must be set over the JVM initialization anyway and cannot be restricted inside of it.
*/
public int memory();
/**
* @return Overall timeout for the algorithm in milliseconds.
*/
public long timeout();
}
| 904 | 0.696035 | 0.69163 | 32 | 26.375 | 47.125332 | 205 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
3f73d64aacfd198f6d7756db5737db5fff70a48c | 27,814,208,240,378 | 3cf612db07a61355c2fa46240bb3ddbedd267bc0 | /RentaVehiculos/src/sgrv/dao/AdministradorDAO.java | 5b2b9c63da59547738264997a8a5ed9f862117a3 | [] | no_license | PaolaMarai/RentaAutos | https://github.com/PaolaMarai/RentaAutos | fc71dbe6a684802d96a13f0e048abb3e7b6adacd | 5c829c72c258b18fe203fca4b90699001d8b6a10 | refs/heads/master | 2020-03-17T07:14:02.072000 | 2018-06-11T19:52:21 | 2018-06-11T19:52:21 | 133,389,383 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 sgrv.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import sgrv.datasource.BaseDatos;
import sgrv.domain.Administrador;
import sgrv.domain.Usuario;
/**
*
* @author marai
*/
public class AdministradorDAO implements IAdministradorDAO{
@Override
public Administrador obtenerAdministrador(String correo) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| UTF-8 | Java | 860 | java | AdministradorDAO.java | Java | [
{
"context": "dor;\nimport sgrv.domain.Usuario;\n/**\n *\n * @author marai\n */\npublic class AdministradorDAO implements IAdm",
"end": 559,
"score": 0.9545458555221558,
"start": 554,
"tag": "USERNAME",
"value": "marai"
}
] | null | [] | /*
* 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 sgrv.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import sgrv.datasource.BaseDatos;
import sgrv.domain.Administrador;
import sgrv.domain.Usuario;
/**
*
* @author marai
*/
public class AdministradorDAO implements IAdministradorDAO{
@Override
public Administrador obtenerAdministrador(String correo) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| 860 | 0.75814 | 0.75814 | 31 | 26.741936 | 28.257992 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.580645 | false | false | 9 |
41aaf01d2fa54b061e414c33be0fdc36ef520e92 | 11,871,289,645,691 | aa097b782c7754ed43dce82e83f070cc2ed37410 | /Multilevelex1(inheritance).java | 1b7f2af27e22d6f9414679cfcd6be2832501f831 | [] | no_license | sravanimeduri/hello-world | https://github.com/sravanimeduri/hello-world | 196724da778b4847d44de928c6ae0f02677bc6e1 | c1f386af306cc0cd88ae002c8dd5870c15030ac4 | refs/heads/main | 2023-02-02T09:11:17.467000 | 2020-12-16T17:15:09 | 2020-12-16T17:15:09 | 308,038,071 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Electronics{
void Electronics(){
System.out.println("Electronics");
}
}
class Mobile extends Electronics{
void Mobile(){
System.out.println("Mobile");
}
}
class Realme extends Mobile{
void Realmemobile(){
System.out.println("Realme Mobile");
}
}
class Multilevel{
public static void main(String args[]){
Realme mob=new Realme();
mob.Realmemobile();
mob.Mobile();
mob.Electronics();
}
} | UTF-8 | Java | 422 | java | Multilevelex1(inheritance).java | Java | [] | null | [] | class Electronics{
void Electronics(){
System.out.println("Electronics");
}
}
class Mobile extends Electronics{
void Mobile(){
System.out.println("Mobile");
}
}
class Realme extends Mobile{
void Realmemobile(){
System.out.println("Realme Mobile");
}
}
class Multilevel{
public static void main(String args[]){
Realme mob=new Realme();
mob.Realmemobile();
mob.Mobile();
mob.Electronics();
}
} | 422 | 0.682464 | 0.682464 | 23 | 16.434782 | 12.940755 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.304348 | false | false | 9 |
95d114b7c7e7d08c2d08b54cec6eaef2222c414c | 6,519,760,411,450 | 8d627133d14ff6ec0976e99dc620935808639de2 | /automatic-release-web/src/main/java/com/trustlife/automatic/web/mapper/SmsMessageMapperImpl.java | 61072cff1e4850f56e9968670e6e8d5e19cf81cc | [] | no_license | danshijin/automatic-release | https://github.com/danshijin/automatic-release | 0deb7fbdb1fa09a4fb9151bc97f05222585231e9 | 472c0c5731c049c5c25e46aaba33370a655d7e74 | refs/heads/master | 2018-11-06T00:51:56.263000 | 2018-10-25T06:04:36 | 2018-10-25T06:04:36 | 104,158,584 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.trustlife.automatic.web.mapper;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.PostConstruct;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.trustlife.automatic.model.rate.SmsMessage;
import com.trustlife.automatic.utils.FileUtil;
@Repository
public class SmsMessageMapperImpl implements ISmsMessageMapper {
private List<SmsMessage> smsMessages = Collections.emptyList();
@Autowired
private ObjectMapper objectMapper;
@PostConstruct
private void init() {
String path = FileUtil.pathJoin(this.getClass().getClassLoader().getResource("").getPath(),
SmsMessage.class.getSimpleName() + ".json");
try {
smsMessages = objectMapper.readValue(new File(path),
new TypeReference<List<SmsMessage>>() {
});
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public List<SmsMessage> getSmsMessage(String templateCode) {
if(StringUtils.isBlank(templateCode)) {
return Collections.emptyList();
}
List<SmsMessage> list = new ArrayList<>(0);
for(SmsMessage smsMessage : smsMessages) {
if(smsMessage.getTemplateCode().equals(templateCode)) {
list.add(smsMessage);
}
}
return list;
}
}
| UTF-8 | Java | 2,014 | java | SmsMessageMapperImpl.java | Java | [] | null | [] | package com.trustlife.automatic.web.mapper;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.PostConstruct;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.trustlife.automatic.model.rate.SmsMessage;
import com.trustlife.automatic.utils.FileUtil;
@Repository
public class SmsMessageMapperImpl implements ISmsMessageMapper {
private List<SmsMessage> smsMessages = Collections.emptyList();
@Autowired
private ObjectMapper objectMapper;
@PostConstruct
private void init() {
String path = FileUtil.pathJoin(this.getClass().getClassLoader().getResource("").getPath(),
SmsMessage.class.getSimpleName() + ".json");
try {
smsMessages = objectMapper.readValue(new File(path),
new TypeReference<List<SmsMessage>>() {
});
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public List<SmsMessage> getSmsMessage(String templateCode) {
if(StringUtils.isBlank(templateCode)) {
return Collections.emptyList();
}
List<SmsMessage> list = new ArrayList<>(0);
for(SmsMessage smsMessage : smsMessages) {
if(smsMessage.getTemplateCode().equals(templateCode)) {
list.add(smsMessage);
}
}
return list;
}
}
| 2,014 | 0.657398 | 0.656902 | 61 | 31.016394 | 23.324154 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47541 | false | false | 9 |
c7d5a842d4ece0ca38cb03d6f04c486f436f0f55 | 25,323,127,204,171 | 72e5447d687519778c34fcc8049bef497e222187 | /src/com/example/whatiscommunityservice/IdeaGenerator.java | cc92a6d5c029eecb32587157809afdd4f632b668 | [] | no_license | sparc-hackathon-2-0/team23 | https://github.com/sparc-hackathon-2-0/team23 | 39e267131b273975e8a6251316870ffa38394720 | fade7e558b13bbd250dbacc85aa589bad24882a4 | refs/heads/master | 2020-04-27T08:55:42.160000 | 2012-08-26T00:30:21 | 2012-08-26T00:30:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.whatiscommunityservice;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class IdeaGenerator extends Activity implements OnClickListener {
public Button getIdea;
public TextView response;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ideas);
response = (TextView) findViewById(R.id.tvidea);
getIdea = (Button) findViewById(R.id.bGenerate);
getIdea.setOnClickListener(this);
}
public void onClick(View v) {
String[] ideas = {
"Pick Up Trash",
"42",
"Habitat For Humanity",
"10101010",
"汉语/漢語 华语/華語",
"Teach underpriviledged children to program",
"Feed the hungry",
"Stop Global Warming",
"Become a Lobster Farmer",
"1337",
"Do Nothing",
"Hello World",
"I can't let you do that Dave",
"Plant a garden or tree where the whole neighborhood can enjoy it",
"Recycle", "Make bird feeders for public places",
"Help family/friends conserve water",
"Testing drinking water for lead",
"Clean up a beach or riverbed",
"한국어/조선말",
"This option is not available in your country",
"漢字",
"Check indoor radon levels",
"Pick up litter",
"Telephone residents and encourage them to register to vote.",
"Help cook and/or serve a meal at homeless shelter",
"Adopt a Zoo Animal.",
"Null Pointer Exception!"
};
response.setText(ideas[(int) (Math.random() * 27)]);
}
}
| UTF-8 | Java | 1,656 | java | IdeaGenerator.java | Java | [
{
"context": "\",\n\t\t\t\t\"Hello World\",\n\t\t\t\t\"I can't let you do that Dave\",\n\t\t\t\t\"Plant a garden or tree where the whole nei",
"end": 997,
"score": 0.8204566240310669,
"start": 993,
"tag": "NAME",
"value": "Dave"
}
] | null | [] | package com.example.whatiscommunityservice;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class IdeaGenerator extends Activity implements OnClickListener {
public Button getIdea;
public TextView response;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ideas);
response = (TextView) findViewById(R.id.tvidea);
getIdea = (Button) findViewById(R.id.bGenerate);
getIdea.setOnClickListener(this);
}
public void onClick(View v) {
String[] ideas = {
"Pick Up Trash",
"42",
"Habitat For Humanity",
"10101010",
"汉语/漢語 华语/華語",
"Teach underpriviledged children to program",
"Feed the hungry",
"Stop Global Warming",
"Become a Lobster Farmer",
"1337",
"Do Nothing",
"Hello World",
"I can't let you do that Dave",
"Plant a garden or tree where the whole neighborhood can enjoy it",
"Recycle", "Make bird feeders for public places",
"Help family/friends conserve water",
"Testing drinking water for lead",
"Clean up a beach or riverbed",
"한국어/조선말",
"This option is not available in your country",
"漢字",
"Check indoor radon levels",
"Pick up litter",
"Telephone residents and encourage them to register to vote.",
"Help cook and/or serve a meal at homeless shelter",
"Adopt a Zoo Animal.",
"Null Pointer Exception!"
};
response.setText(ideas[(int) (Math.random() * 27)]);
}
}
| 1,656 | 0.697044 | 0.687192 | 58 | 27 | 19.070648 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.034483 | false | false | 9 |
4cd9079f4e395f83647e1e7ddab5a9989faa69a2 | 13,443,247,676,129 | 1de757fb5dc50df2a3b3b0afd6fea60dc8913cd6 | /TALLER/TALLER_2_PUNTO_3.java | 49e031446d5a3364b22c60ffeee1fceddfb249ab | [] | no_license | luiscamilosierraortiz/TALLER_2__DE_PROGRAMACION | https://github.com/luiscamilosierraortiz/TALLER_2__DE_PROGRAMACION | 33d9fe5ceba95ff0069c80b68469bef64f1d98b2 | bafbbc0475393743d0f90784794a6758511115e2 | refs/heads/main | 2023-07-20T07:02:15.831000 | 2021-09-03T23:56:32 | 2021-09-03T23:56:32 | 402,923,769 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package taller_2_punto_3;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TALLER_2_PUNTO_3 {
public static void main(String[] args) throws IOException {
BufferedReader leer = new BufferedReader(new InputStreamReader(System.in));
System.out.println(" CALCULAR ");
float num1,num2,num3,sm,mt,dv,prm;
System.out.println(" INGRESE UN NUMERO DECIMAL: ");
num1=Float.parseFloat(leer.readLine());
System.out.println(" INGRESE OTRO NUMERO DECIMAL: ");
num2=Float.parseFloat(leer.readLine());
System.out.println(" INGRESE OTRO NUMERO DECIMAL: ");
num3=Float.parseFloat(leer.readLine());
sm=num1+num2+num3;
mt=num1*num2*num3;
dv=num1/num2/num3;
prm=(num1+num2+num3)/3;
System.out.println(" LA SUMA FINAL ES: "+String.format("%.1f",sm));
System.out.println(" EL PROMEDIO FINAL ES: "+String.format("%.1f",prm));
System.out.println(" EL PRODUCTO FINAL ES: "+String.format("%.1f",mt));
System.out.println(" EL COCIENTE FINAL ES: "+String.format("%.1f",dv));
}
}
| UTF-8 | Java | 1,167 | java | TALLER_2_PUNTO_3.java | Java | [] | null | [] |
package taller_2_punto_3;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TALLER_2_PUNTO_3 {
public static void main(String[] args) throws IOException {
BufferedReader leer = new BufferedReader(new InputStreamReader(System.in));
System.out.println(" CALCULAR ");
float num1,num2,num3,sm,mt,dv,prm;
System.out.println(" INGRESE UN NUMERO DECIMAL: ");
num1=Float.parseFloat(leer.readLine());
System.out.println(" INGRESE OTRO NUMERO DECIMAL: ");
num2=Float.parseFloat(leer.readLine());
System.out.println(" INGRESE OTRO NUMERO DECIMAL: ");
num3=Float.parseFloat(leer.readLine());
sm=num1+num2+num3;
mt=num1*num2*num3;
dv=num1/num2/num3;
prm=(num1+num2+num3)/3;
System.out.println(" LA SUMA FINAL ES: "+String.format("%.1f",sm));
System.out.println(" EL PROMEDIO FINAL ES: "+String.format("%.1f",prm));
System.out.println(" EL PRODUCTO FINAL ES: "+String.format("%.1f",mt));
System.out.println(" EL COCIENTE FINAL ES: "+String.format("%.1f",dv));
}
}
| 1,167 | 0.637532 | 0.614396 | 32 | 35.4375 | 27.098129 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.96875 | false | false | 9 |
dfb68ebea65ce5fe5d837dbf1ff8e514adc15620 | 10,548,439,739,288 | 19822b31136b13a1e2de3710b7224af425970962 | /src/cvic/anirevo/editor/Controller.java | eaf5ece856be5f10dfd536e63e4e1e71c21d230d | [] | no_license | chenvictor/anirevo-data | https://github.com/chenvictor/anirevo-data | 854eb6d52a4a629947998ccdb4c5eb5bd004b367 | b875526fcf9c088cc3dbb0b53d1f7fd46ee09032 | refs/heads/master | 2020-03-27T06:46:17.216000 | 2018-12-29T17:20:27 | 2018-12-29T17:20:27 | 146,134,308 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cvic.anirevo.editor;
import cvic.anirevo.Log;
import cvic.anirevo.model.VenueManager;
import cvic.anirevo.model.ViewingRoomManager;
import cvic.anirevo.model.anirevo.*;
import cvic.anirevo.model.calendar.CalendarDate;
import cvic.anirevo.model.calendar.DateManager;
import cvic.anirevo.parser.*;
import cvic.anirevo.utils.JSONUtils;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Tab;
import javafx.scene.layout.AnchorPane;
import java.io.FileNotFoundException;
import java.io.IOException;
public class Controller {
@FXML
private AnchorPane navPane, contentPane;
@FXML
private Tab tabGeneral, tabLocations, tabEvents, tabGuests, tabViewingRooms, tabMap;
private TabInteractionHandler handler;
public void initialize() {
handler = new TabInteractionHandler();
loadAll();
// tabChanged(); loadAll already calls tabChanged();
}
@FXML
public void tabChanged() {
if (contentPane == null || navPane == null) {
return;
}
if (tabGeneral.isSelected()) {
loadTab(null, "tabs/tab_content_general.fxml");
} else if (tabLocations.isSelected()) {
loadTab("tabs/tab_nav_locations.fxml", "tabs/tab_content_locations.fxml");
} else if (tabEvents.isSelected()) {
loadTab("tabs/tab_nav_events.fxml", "tabs/tab_content_events.fxml");
} else if (tabGuests.isSelected()) {
loadTab("tabs/tab_nav_guests.fxml", "tabs/tab_content_guests.fxml");
} else if (tabViewingRooms.isSelected()) {
loadTab("tabs/tab_nav_viewing_rooms.fxml", "tabs/tab_content_viewing_rooms.fxml");
} else if (tabMap.isSelected()) {
loadTab("tabs/tab_nav_map.fxml", "tabs/tab_content_map.fxml");
}
}
public void onSave() {
Unparser.info();
Unparser.locations();
Unparser.events();
Unparser.guests();
Unparser.viewingRooms();
Unparser.map();
Log.notify("Anirevo-data", "Data saved");
}
public void onLoad() {
loadAll();
Log.notify("Anirevo-data", "Data loaded");
}
private void loadTab(String navFXML, String contentFXML) {
Node node;
Object navController = null;
Object contentController = null;
if (navFXML != null) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(navFXML));
node = loader.load();
navController = loader.getController();
navPane.getChildren().setAll(node);
} catch (IOException e) {
e.printStackTrace();
}
} else {
navPane.getChildren().clear();
}
if (contentFXML != null) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(contentFXML));
node = loader.load();
contentController = loader.getController();
contentPane.getChildren().setAll(node);
} catch (IOException e) {
e.printStackTrace();
}
} else {
contentPane.getChildren().clear();
}
handler.setContentController(contentController);
handler.setNavController(navController);
}
private void loadAll() {
//clear managers
LocationManager.getInstance().clear();
CategoryManager.getInstance().clear();
EventManager.getInstance().clear();
DateManager.getInstance().clear();
ViewingRoomManager.getInstance().clear();
GuestManager.getInstance().clear();
VenueManager.getInstance().clear();
TagManager.getInstance().clear();
try {
InfoParser.parseInfo(JSONUtils.getObject(DataPaths.JSON_INFO));
} catch (FileNotFoundException e) {
System.out.println("info.json not found");
e.printStackTrace();
}
try {
LocationParser.parseLocs(JSONUtils.getArray(DataPaths.JSON_LOCATIONS));
} catch (FileNotFoundException e) {
System.out.println("locations.json not found");
e.printStackTrace();
}
try {
EventParser.parseEvents(JSONUtils.getArray(DataPaths.JSON_EVENTS));
} catch (FileNotFoundException e) {
System.out.println("events.json not found");
e.printStackTrace();
}
try {
GuestParser.parseGuests(JSONUtils.getArray(DataPaths.JSON_GUESTS));
} catch (FileNotFoundException e) {
System.out.println("guests.json not found");
e.printStackTrace();
}
try {
ViewingRoomParser.parseViewingRoom(JSONUtils.getArray(DataPaths.JSON_VIEWING_ROOMS));
} catch (FileNotFoundException e) {
System.out.println("viewing_rooms.json not found");
e.printStackTrace();
}
try {
MapParser.parse(JSONUtils.getArray(DataPaths.JSON_MAP));
} catch (FileNotFoundException e) {
System.out.println("map.json not found");
e.printStackTrace();
}
//reset tab
tabChanged();
}
@FXML
private void printStatus() {
printViewingRoomManager();
}
private void printDateManager() {
System.out.println("Date Manager");
System.out.println("Year: " + DateManager.getInstance().getYear());
System.out.println("Dates:");
for (CalendarDate date : DateManager.getInstance().getDates()) {
System.out.println(" -" + date.getName());
}
}
private void printLocationManager() {
System.out.println("Location Manager");
System.out.println("Locations:");
for (ArLocation loc : LocationManager.getInstance()) {
System.out.println(loc.getPurpose() + " - " + loc.getLocation() + (loc.isSchedule() ? " sched" : ""));
}
}
private void printCategoryManager() {
System.out.println("Category Manager");
System.out.println("Categories:");
for (ArCategory cat : CategoryManager.getInstance()) {
System.out.println(" " + cat.getTitle() + ":");
for (ArEvent event : cat) {
System.out.println(" -" + event.getTitle());
}
}
}
private void printViewingRoomManager() {
System.out.println("ViewingRoom Manager");
System.out.println("Dates:");
for (CalendarDate date : DateManager.getInstance()) {
System.out.println(" " + date.getName() + ":");
for (ViewingRoomManager.ViewingRoom room : ViewingRoomManager.getInstance().getViewingRooms(date)) {
System.out.println(" -" + room.getPurpose());
}
}
}
}
| UTF-8 | Java | 6,891 | java | Controller.java | Java | [] | null | [] | package cvic.anirevo.editor;
import cvic.anirevo.Log;
import cvic.anirevo.model.VenueManager;
import cvic.anirevo.model.ViewingRoomManager;
import cvic.anirevo.model.anirevo.*;
import cvic.anirevo.model.calendar.CalendarDate;
import cvic.anirevo.model.calendar.DateManager;
import cvic.anirevo.parser.*;
import cvic.anirevo.utils.JSONUtils;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Tab;
import javafx.scene.layout.AnchorPane;
import java.io.FileNotFoundException;
import java.io.IOException;
public class Controller {
@FXML
private AnchorPane navPane, contentPane;
@FXML
private Tab tabGeneral, tabLocations, tabEvents, tabGuests, tabViewingRooms, tabMap;
private TabInteractionHandler handler;
public void initialize() {
handler = new TabInteractionHandler();
loadAll();
// tabChanged(); loadAll already calls tabChanged();
}
@FXML
public void tabChanged() {
if (contentPane == null || navPane == null) {
return;
}
if (tabGeneral.isSelected()) {
loadTab(null, "tabs/tab_content_general.fxml");
} else if (tabLocations.isSelected()) {
loadTab("tabs/tab_nav_locations.fxml", "tabs/tab_content_locations.fxml");
} else if (tabEvents.isSelected()) {
loadTab("tabs/tab_nav_events.fxml", "tabs/tab_content_events.fxml");
} else if (tabGuests.isSelected()) {
loadTab("tabs/tab_nav_guests.fxml", "tabs/tab_content_guests.fxml");
} else if (tabViewingRooms.isSelected()) {
loadTab("tabs/tab_nav_viewing_rooms.fxml", "tabs/tab_content_viewing_rooms.fxml");
} else if (tabMap.isSelected()) {
loadTab("tabs/tab_nav_map.fxml", "tabs/tab_content_map.fxml");
}
}
public void onSave() {
Unparser.info();
Unparser.locations();
Unparser.events();
Unparser.guests();
Unparser.viewingRooms();
Unparser.map();
Log.notify("Anirevo-data", "Data saved");
}
public void onLoad() {
loadAll();
Log.notify("Anirevo-data", "Data loaded");
}
private void loadTab(String navFXML, String contentFXML) {
Node node;
Object navController = null;
Object contentController = null;
if (navFXML != null) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(navFXML));
node = loader.load();
navController = loader.getController();
navPane.getChildren().setAll(node);
} catch (IOException e) {
e.printStackTrace();
}
} else {
navPane.getChildren().clear();
}
if (contentFXML != null) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(contentFXML));
node = loader.load();
contentController = loader.getController();
contentPane.getChildren().setAll(node);
} catch (IOException e) {
e.printStackTrace();
}
} else {
contentPane.getChildren().clear();
}
handler.setContentController(contentController);
handler.setNavController(navController);
}
private void loadAll() {
//clear managers
LocationManager.getInstance().clear();
CategoryManager.getInstance().clear();
EventManager.getInstance().clear();
DateManager.getInstance().clear();
ViewingRoomManager.getInstance().clear();
GuestManager.getInstance().clear();
VenueManager.getInstance().clear();
TagManager.getInstance().clear();
try {
InfoParser.parseInfo(JSONUtils.getObject(DataPaths.JSON_INFO));
} catch (FileNotFoundException e) {
System.out.println("info.json not found");
e.printStackTrace();
}
try {
LocationParser.parseLocs(JSONUtils.getArray(DataPaths.JSON_LOCATIONS));
} catch (FileNotFoundException e) {
System.out.println("locations.json not found");
e.printStackTrace();
}
try {
EventParser.parseEvents(JSONUtils.getArray(DataPaths.JSON_EVENTS));
} catch (FileNotFoundException e) {
System.out.println("events.json not found");
e.printStackTrace();
}
try {
GuestParser.parseGuests(JSONUtils.getArray(DataPaths.JSON_GUESTS));
} catch (FileNotFoundException e) {
System.out.println("guests.json not found");
e.printStackTrace();
}
try {
ViewingRoomParser.parseViewingRoom(JSONUtils.getArray(DataPaths.JSON_VIEWING_ROOMS));
} catch (FileNotFoundException e) {
System.out.println("viewing_rooms.json not found");
e.printStackTrace();
}
try {
MapParser.parse(JSONUtils.getArray(DataPaths.JSON_MAP));
} catch (FileNotFoundException e) {
System.out.println("map.json not found");
e.printStackTrace();
}
//reset tab
tabChanged();
}
@FXML
private void printStatus() {
printViewingRoomManager();
}
private void printDateManager() {
System.out.println("Date Manager");
System.out.println("Year: " + DateManager.getInstance().getYear());
System.out.println("Dates:");
for (CalendarDate date : DateManager.getInstance().getDates()) {
System.out.println(" -" + date.getName());
}
}
private void printLocationManager() {
System.out.println("Location Manager");
System.out.println("Locations:");
for (ArLocation loc : LocationManager.getInstance()) {
System.out.println(loc.getPurpose() + " - " + loc.getLocation() + (loc.isSchedule() ? " sched" : ""));
}
}
private void printCategoryManager() {
System.out.println("Category Manager");
System.out.println("Categories:");
for (ArCategory cat : CategoryManager.getInstance()) {
System.out.println(" " + cat.getTitle() + ":");
for (ArEvent event : cat) {
System.out.println(" -" + event.getTitle());
}
}
}
private void printViewingRoomManager() {
System.out.println("ViewingRoom Manager");
System.out.println("Dates:");
for (CalendarDate date : DateManager.getInstance()) {
System.out.println(" " + date.getName() + ":");
for (ViewingRoomManager.ViewingRoom room : ViewingRoomManager.getInstance().getViewingRooms(date)) {
System.out.println(" -" + room.getPurpose());
}
}
}
}
| 6,891 | 0.592657 | 0.592657 | 199 | 33.628139 | 24.642416 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.582915 | false | false | 9 |
e3e2b62b0f9dd7cd108dfe7efa0555b3e0b53a27 | 10,548,439,739,363 | 0beb481e2ee36bede0c82b5c11919d00f2dcbc5f | /java/src/vtf_tests/SleepTester.java | 7d84bdbdbe78ae50b3856a8aea7059d540468888 | [] | no_license | spikeh/vexjine | https://github.com/spikeh/vexjine | e327fd4d1f4ea7d0b0351c277e6f883bebec7b05 | 2f2099347946bda8574f209b7a27d199cfeb868b | refs/heads/master | 2016-08-09T06:02:07.810000 | 2016-01-21T11:06:26 | 2016-01-21T11:06:26 | 45,060,590 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vtf_tests;
public class SleepTester implements Runnable {
public void run() {
try {
System.out.println("in run() - sleep for 20 seconds");
Thread.sleep(20000);
System.out.println("in run() - woke up");
} catch (InterruptedException x) {
System.out.println("in run() - interrupted while sleeping");
return;
}
System.out.println("in run() - leaving normally");
}
public static void main(String[] args) {
long start, end;
SleepTester si = new SleepTester();
Thread t = new Thread(si);
start = System.nanoTime();
//t.start();
// Be sure that the new thread gets a chance to
// run for a while.
try {
Thread.sleep(2000);
System.out.println("in main() - interrupting after 2sec");
} catch (InterruptedException x) {
}
//System.out.println("in main() - interrupting other thread");
// t.interrupt();
System.out.println("in main() - leaving");
end = System.nanoTime();
System.out.println("Duration: " + (end-start));
}
}
| UTF-8 | Java | 991 | java | SleepTester.java | Java | [] | null | [] | package vtf_tests;
public class SleepTester implements Runnable {
public void run() {
try {
System.out.println("in run() - sleep for 20 seconds");
Thread.sleep(20000);
System.out.println("in run() - woke up");
} catch (InterruptedException x) {
System.out.println("in run() - interrupted while sleeping");
return;
}
System.out.println("in run() - leaving normally");
}
public static void main(String[] args) {
long start, end;
SleepTester si = new SleepTester();
Thread t = new Thread(si);
start = System.nanoTime();
//t.start();
// Be sure that the new thread gets a chance to
// run for a while.
try {
Thread.sleep(2000);
System.out.println("in main() - interrupting after 2sec");
} catch (InterruptedException x) {
}
//System.out.println("in main() - interrupting other thread");
// t.interrupt();
System.out.println("in main() - leaving");
end = System.nanoTime();
System.out.println("Duration: " + (end-start));
}
}
| 991 | 0.649849 | 0.63774 | 39 | 24.410257 | 20.523556 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.179487 | false | false | 9 |
aecec9ffd8acb293c9899e6f3292401e5915b2a9 | 16,784,732,196,000 | 7bfef1f5b17d128fa885585a52e140813bba4247 | /2021_05_15_JDBCTemplate/src_1/main/java/com/eleonoralion/database_1/servlets/UpdateUserServlet.java | 456933d98acf7873bffd979d80c1cf733e18e050 | [] | no_license | kimisiyamino/JavaFixGroupCourse | https://github.com/kimisiyamino/JavaFixGroupCourse | 1587521db25be91500b52f2f914985eeed649a5c | 7ef21572ccc58ee5d57c55be5c9c3e2d6d497e6f | refs/heads/master | 2023-08-23T18:39:39.687000 | 2021-10-12T13:12:48 | 2021-10-12T13:12:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.eleonoralion.database.servlets;
import com.eleonoralion.database.dao.UserDao;
import com.eleonoralion.database.dao.UsersDaoJdbcImpl;
import com.eleonoralion.database.dao.UsersDaoJdbcTemplateImpl;
import com.eleonoralion.database.models.User;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
@WebServlet("/updateUser")
public class UpdateUserServlet extends HttpServlet{
private UserDao usersDaoJdbc;
@Override
public void init() throws ServletException {
Properties properties = new Properties();
try {
properties.load(new FileInputStream(getServletContext().getRealPath("/WEB-INF/classes/db.properties")));
String dbUrl = properties.getProperty("db.url");
String dbUsername = properties.getProperty("db.username");
String dbPassword = properties.getProperty("db.password");
String dbClass = properties.getProperty("db.driverClassName");
DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
driverManagerDataSource.setDriverClassName(dbClass);
driverManagerDataSource.setUrl(dbUrl);
driverManagerDataSource.setUsername(dbUsername);
driverManagerDataSource.setPassword(dbPassword);
// DAO
usersDaoJdbc = new UsersDaoJdbcTemplateImpl(driverManagerDataSource);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int id = Integer.parseInt(request.getParameter("id"));
User user = usersDaoJdbc.find(id).orElse(null);
request.setAttribute("user", user);
getServletContext().getRequestDispatcher("/jsp/edit.jsp").forward(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
String firstName = request.getParameter("first-name");
String lastName = request.getParameter("last-name");
User user = new User(Integer.parseInt(id), firstName, lastName);
usersDaoJdbc.update(user);
response.sendRedirect(request.getContextPath() + "/show");
}
}
| UTF-8 | Java | 2,683 | java | UpdateUserServlet.java | Java | [] | null | [] | package com.eleonoralion.database.servlets;
import com.eleonoralion.database.dao.UserDao;
import com.eleonoralion.database.dao.UsersDaoJdbcImpl;
import com.eleonoralion.database.dao.UsersDaoJdbcTemplateImpl;
import com.eleonoralion.database.models.User;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
@WebServlet("/updateUser")
public class UpdateUserServlet extends HttpServlet{
private UserDao usersDaoJdbc;
@Override
public void init() throws ServletException {
Properties properties = new Properties();
try {
properties.load(new FileInputStream(getServletContext().getRealPath("/WEB-INF/classes/db.properties")));
String dbUrl = properties.getProperty("db.url");
String dbUsername = properties.getProperty("db.username");
String dbPassword = properties.getProperty("db.password");
String dbClass = properties.getProperty("db.driverClassName");
DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
driverManagerDataSource.setDriverClassName(dbClass);
driverManagerDataSource.setUrl(dbUrl);
driverManagerDataSource.setUsername(dbUsername);
driverManagerDataSource.setPassword(dbPassword);
// DAO
usersDaoJdbc = new UsersDaoJdbcTemplateImpl(driverManagerDataSource);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int id = Integer.parseInt(request.getParameter("id"));
User user = usersDaoJdbc.find(id).orElse(null);
request.setAttribute("user", user);
getServletContext().getRequestDispatcher("/jsp/edit.jsp").forward(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
String firstName = request.getParameter("first-name");
String lastName = request.getParameter("last-name");
User user = new User(Integer.parseInt(id), firstName, lastName);
usersDaoJdbc.update(user);
response.sendRedirect(request.getContextPath() + "/show");
}
}
| 2,683 | 0.724935 | 0.724935 | 70 | 37.328571 | 32.003448 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657143 | false | false | 9 |
ca1e5a62ee68e9232e0915c58a918005a258a660 | 1,297,080,177,073 | ed4e299a68c641723069abb735193e519b54ba41 | /rfid-messaging/src/main/java/com/bungholes/rfid/messages/TagReading.java | 829349346b46b50f401f796428704eeba28066c2 | [] | no_license | kalayl/rfid-java | https://github.com/kalayl/rfid-java | adc0b1b86430e2c320933a646f65400b66a6e692 | 922d17ba530d65cd78a16d70a22f5cfbd64fcc15 | refs/heads/master | 2020-04-05T20:11:13.970000 | 2014-02-17T11:49:30 | 2014-02-17T11:49:30 | 16,654,429 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bungholes.rfid.messages;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import javax.xml.bind.DatatypeConverter;
import java.io.Serializable;
import java.util.Date;
public class TagReading implements Serializable {
private final String tagId;
private final String antenna;
private final float phaseAngle;
private final String frequency;
private final String rssi;
private final Date time;
private final String tid;
public TagReading(String tagId, String antenna, float phaseAngle, String frequency, String rssi, String time, String tid) {
this.tagId = tagId;
this.antenna = antenna;
this.phaseAngle = phaseAngle;
this.frequency = frequency;
this.rssi = rssi;
this.time = determineTime(time);
this.tid = tid;
}
private Date determineTime(String time) {
return DatatypeConverter.parseDateTime(time).getTime();
}
public String getTagId() {
return tagId;
}
public String getAntenna() {
return antenna;
}
public float getPhaseAngle() {
return phaseAngle;
}
public String getFrequency() {
return frequency;
}
public String getRssi() {
return rssi;
}
public Date getTime() {
return time;
}
public String getTid() { return tid; }
public static Ordering<TagReading> dateOrdering() {
return Ordering.natural().onResultOf(new Function<TagReading, Date>() {
public Date apply(TagReading from) {
return from.getTime();
}
});
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TagReading that = (TagReading) o;
if (Float.compare(that.phaseAngle, phaseAngle) != 0) return false;
if (antenna != null ? !antenna.equals(that.antenna) : that.antenna != null) return false;
if (frequency != null ? !frequency.equals(that.frequency) : that.frequency != null) return false;
if (rssi != null ? !rssi.equals(that.rssi) : that.rssi != null) return false;
if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) return false;
if (tid != null ? !tid.equals(that.tid) : that.tid != null) return false;
if (time != null ? !time.equals(that.time) : that.time != null) return false;
return true;
}
@Override
public int hashCode() {
int result = tagId != null ? tagId.hashCode() : 0;
result = 31 * result + (antenna != null ? antenna.hashCode() : 0);
result = 31 * result + (phaseAngle != +0.0f ? Float.floatToIntBits(phaseAngle) : 0);
result = 31 * result + (frequency != null ? frequency.hashCode() : 0);
result = 31 * result + (rssi != null ? rssi.hashCode() : 0);
result = 31 * result + (time != null ? time.hashCode() : 0);
result = 31 * result + (tid != null ? tid.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "TagReading{" +
"tagId='" + tagId + '\'' +
", tid='" + tid + '\'' +
", antenna='" + antenna + '\'' +
", phaseAngle=" + phaseAngle +
", frequency='" + frequency + '\'' +
", rssi='" + rssi + '\'' +
", time='" + time + '\'' +
'}';
}
}
| UTF-8 | Java | 3,508 | java | TagReading.java | Java | [] | null | [] | package com.bungholes.rfid.messages;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import javax.xml.bind.DatatypeConverter;
import java.io.Serializable;
import java.util.Date;
public class TagReading implements Serializable {
private final String tagId;
private final String antenna;
private final float phaseAngle;
private final String frequency;
private final String rssi;
private final Date time;
private final String tid;
public TagReading(String tagId, String antenna, float phaseAngle, String frequency, String rssi, String time, String tid) {
this.tagId = tagId;
this.antenna = antenna;
this.phaseAngle = phaseAngle;
this.frequency = frequency;
this.rssi = rssi;
this.time = determineTime(time);
this.tid = tid;
}
private Date determineTime(String time) {
return DatatypeConverter.parseDateTime(time).getTime();
}
public String getTagId() {
return tagId;
}
public String getAntenna() {
return antenna;
}
public float getPhaseAngle() {
return phaseAngle;
}
public String getFrequency() {
return frequency;
}
public String getRssi() {
return rssi;
}
public Date getTime() {
return time;
}
public String getTid() { return tid; }
public static Ordering<TagReading> dateOrdering() {
return Ordering.natural().onResultOf(new Function<TagReading, Date>() {
public Date apply(TagReading from) {
return from.getTime();
}
});
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TagReading that = (TagReading) o;
if (Float.compare(that.phaseAngle, phaseAngle) != 0) return false;
if (antenna != null ? !antenna.equals(that.antenna) : that.antenna != null) return false;
if (frequency != null ? !frequency.equals(that.frequency) : that.frequency != null) return false;
if (rssi != null ? !rssi.equals(that.rssi) : that.rssi != null) return false;
if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) return false;
if (tid != null ? !tid.equals(that.tid) : that.tid != null) return false;
if (time != null ? !time.equals(that.time) : that.time != null) return false;
return true;
}
@Override
public int hashCode() {
int result = tagId != null ? tagId.hashCode() : 0;
result = 31 * result + (antenna != null ? antenna.hashCode() : 0);
result = 31 * result + (phaseAngle != +0.0f ? Float.floatToIntBits(phaseAngle) : 0);
result = 31 * result + (frequency != null ? frequency.hashCode() : 0);
result = 31 * result + (rssi != null ? rssi.hashCode() : 0);
result = 31 * result + (time != null ? time.hashCode() : 0);
result = 31 * result + (tid != null ? tid.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "TagReading{" +
"tagId='" + tagId + '\'' +
", tid='" + tid + '\'' +
", antenna='" + antenna + '\'' +
", phaseAngle=" + phaseAngle +
", frequency='" + frequency + '\'' +
", rssi='" + rssi + '\'' +
", time='" + time + '\'' +
'}';
}
}
| 3,508 | 0.574116 | 0.567845 | 111 | 30.603603 | 27.692415 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.594595 | false | false | 9 |
308cf8246bdd98b2d7513fc4bb81da19b966eeae | 23,974,507,474,098 | fe28a98a9023545830eea93236be1d6c22d1834e | /src/main/java/com/ecommerce/quoide9/model/PaymentMethod.java | 1915ac0c762b43981843edaa21cb9f187982749d | [] | no_license | asma625/QuoiDeNeufGroupe | https://github.com/asma625/QuoiDeNeufGroupe | 0a8140c38d750b09a3b5ee30de7b01cdb180c20c | 8c77569b9f3009f26695a8782da891d384a238bd | refs/heads/master | 2023-04-23T21:30:52.959000 | 2021-04-28T13:13:39 | 2021-04-28T13:13:39 | 362,471,958 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ecommerce.quoide9.model;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.List;
@Entity
@EntityListeners(AuditingEntityListener.class)
public class PaymentMethod {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String paymentMethodDescription;
@OneToMany(mappedBy= "paymentMethod")
private List<CustomerPaymentMethod> customerPaymentMethodList;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPaymentMethodDescription() {
return paymentMethodDescription;
}
public void setPaymentMethodDescription(String paymentMethodDescription) {
this.paymentMethodDescription = paymentMethodDescription;
}
public List<CustomerPaymentMethod> getCustomerPaymentMethodList() {
return customerPaymentMethodList;
}
public void setCustomerPaymentMethodList(List<CustomerPaymentMethod> customerPaymentMethodList) {
this.customerPaymentMethodList = customerPaymentMethodList;
}
} | UTF-8 | Java | 1,152 | java | PaymentMethod.java | Java | [] | null | [] | package com.ecommerce.quoide9.model;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.List;
@Entity
@EntityListeners(AuditingEntityListener.class)
public class PaymentMethod {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String paymentMethodDescription;
@OneToMany(mappedBy= "paymentMethod")
private List<CustomerPaymentMethod> customerPaymentMethodList;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPaymentMethodDescription() {
return paymentMethodDescription;
}
public void setPaymentMethodDescription(String paymentMethodDescription) {
this.paymentMethodDescription = paymentMethodDescription;
}
public List<CustomerPaymentMethod> getCustomerPaymentMethodList() {
return customerPaymentMethodList;
}
public void setCustomerPaymentMethodList(List<CustomerPaymentMethod> customerPaymentMethodList) {
this.customerPaymentMethodList = customerPaymentMethodList;
}
} | 1,152 | 0.747396 | 0.746528 | 44 | 25.204546 | 27.205095 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.295455 | false | false | 9 |
706400998f04bf545a33541cc4de94d2df21011a | 24,129,126,307,541 | edbdd671d56fc32d7e49aa85100d4e5d59781678 | /src/cz/mg/compiler/tasks/mg/resolver/context/component/structured/ClassContext.java | 901c249e2b0d9e0de78a6fece7a44209559e0158 | [
"Unlicense"
] | permissive | Gekoncze/JMgCompiler | https://github.com/Gekoncze/JMgCompiler | 8e2388ce0e18f3b20e164fdd1d8b4e4e9e413363 | 49b72634cf06f0e97d753a77dd7bbc57fa3b3177 | refs/heads/main | 2023-01-18T19:26:15.654000 | 2020-11-21T17:23:32 | 2020-11-21T17:23:32 | 312,845,971 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cz.mg.compiler.tasks.mg.resolver.context.component.structured;
import cz.mg.annotations.requirement.Optional;
import cz.mg.annotations.storage.Link;
import cz.mg.language.entities.mg.runtime.components.MgComponent;
import cz.mg.language.entities.mg.runtime.components.types.classes.MgClass;
import cz.mg.compiler.tasks.mg.resolver.context.Context;
import cz.mg.compiler.tasks.mg.resolver.search.Source;
public class ClassContext extends StructuredTypeContext {
@Optional @Link
private MgClass clazz;
public ClassContext(@Optional Context outerContext) {
super(outerContext);
}
@Override
public MgComponent getComponent() {
return clazz;
}
public MgClass getClazz() {
return clazz;
}
public void setClazz(MgClass clazz) {
this.clazz = clazz;
}
@Override
public Source getTypeSource() {
return super.getTypeSource();
}
@Override
public Source getInstanceSource() {
return super.getInstanceSource();
}
}
| UTF-8 | Java | 1,034 | java | ClassContext.java | Java | [] | null | [] | package cz.mg.compiler.tasks.mg.resolver.context.component.structured;
import cz.mg.annotations.requirement.Optional;
import cz.mg.annotations.storage.Link;
import cz.mg.language.entities.mg.runtime.components.MgComponent;
import cz.mg.language.entities.mg.runtime.components.types.classes.MgClass;
import cz.mg.compiler.tasks.mg.resolver.context.Context;
import cz.mg.compiler.tasks.mg.resolver.search.Source;
public class ClassContext extends StructuredTypeContext {
@Optional @Link
private MgClass clazz;
public ClassContext(@Optional Context outerContext) {
super(outerContext);
}
@Override
public MgComponent getComponent() {
return clazz;
}
public MgClass getClazz() {
return clazz;
}
public void setClazz(MgClass clazz) {
this.clazz = clazz;
}
@Override
public Source getTypeSource() {
return super.getTypeSource();
}
@Override
public Source getInstanceSource() {
return super.getInstanceSource();
}
}
| 1,034 | 0.709865 | 0.709865 | 41 | 24.219513 | 22.555635 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.341463 | false | false | 9 |
9a6a65d388b8e0dca9a490a382c3f4e88c1b98f5 | 7,730,941,164,798 | f6e6856e63bbbd7743c9f5ba79330d9fcb947a63 | /src/main/java/dev/nokee/init/internal/commands/ConfigureNokeeVersionCommand.java | 007747bcf02e1cb7565f65d41d86daafe9afb978 | [] | no_license | nokeedev/init.nokee.dev | https://github.com/nokeedev/init.nokee.dev | b579960adbfff0ff4f2c3e7fb65bb2cdcadb9102 | a5d46608c9df3b65ce575d220061534898befa98 | refs/heads/main | 2023-06-04T12:24:41.103000 | 2021-06-24T16:48:58 | 2021-06-24T16:48:58 | 286,994,510 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dev.nokee.init.internal.commands;
import dev.nokee.init.internal.versions.NokeeVersion;
import dev.nokee.init.internal.versions.NokeeVersionWriter;
import lombok.val;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Optional;
import java.util.function.Supplier;
public final class ConfigureNokeeVersionCommand implements Runnable {
public static final String FLAG = "use-version";
public static final String HELP_MESSAGE = "Specifies the nokee version to use in this project.";
private final Supplier<String> nokeeVersion;
private final File projectDirectory;
public ConfigureNokeeVersionCommand(Supplier<String> nokeeVersion, File projectDirectory) {
this.nokeeVersion = nokeeVersion;
this.projectDirectory = projectDirectory;
}
@Override
public void run() {
Optional.ofNullable(nokeeVersion.get()).ifPresent(version -> {
try (val writer = new NokeeVersionWriter(new FileOutputStream(new File(projectDirectory, ".gradle/nokee-version.txt")))) {
writer.write(NokeeVersion.parse(version));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
}
}
| UTF-8 | Java | 1,194 | java | ConfigureNokeeVersionCommand.java | Java | [] | null | [] | package dev.nokee.init.internal.commands;
import dev.nokee.init.internal.versions.NokeeVersion;
import dev.nokee.init.internal.versions.NokeeVersionWriter;
import lombok.val;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Optional;
import java.util.function.Supplier;
public final class ConfigureNokeeVersionCommand implements Runnable {
public static final String FLAG = "use-version";
public static final String HELP_MESSAGE = "Specifies the nokee version to use in this project.";
private final Supplier<String> nokeeVersion;
private final File projectDirectory;
public ConfigureNokeeVersionCommand(Supplier<String> nokeeVersion, File projectDirectory) {
this.nokeeVersion = nokeeVersion;
this.projectDirectory = projectDirectory;
}
@Override
public void run() {
Optional.ofNullable(nokeeVersion.get()).ifPresent(version -> {
try (val writer = new NokeeVersionWriter(new FileOutputStream(new File(projectDirectory, ".gradle/nokee-version.txt")))) {
writer.write(NokeeVersion.parse(version));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
}
}
| 1,194 | 0.783082 | 0.783082 | 35 | 33.114285 | 29.944492 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.571429 | false | false | 9 |
ade4b62e7cd7d4d0de3616fe1d49498f37a23ab2 | 24,739,011,664,884 | a97ab73bb5bb0f2d1e018b00311e1f979ee7287d | /src/DEA/Session2/StringMain.java | 5557b5cdafaa46362fbf3c69e9a26ee96e014248 | [] | no_license | trongtb88/hackerrank-solution | https://github.com/trongtb88/hackerrank-solution | 970f9c5c3169ca5325b32608d1c557251af128a7 | b93c8abfd80a523ff7c2b3253f5e2066ca577667 | refs/heads/master | 2023-07-26T07:54:04.415000 | 2021-09-11T03:21:18 | 2021-09-11T03:21:18 | 221,461,824 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package DEA.Session2;
public class StringMain {
public static void main(String [] args) {
String str = "Hello from VEF";
System.out.println(str.charAt(0));
System.out.println(str.substring(11));
System.out.println(str.substring(0, 5));
System.out.println(str.indexOf("VEF"));
System.out.println( str.equalsIgnoreCase("hello from vef"));
String str3 = "value1";
str3.concat("value2");
System.out.println(str3); //value1
str.toLowerCase();
str.toUpperCase();
Integer ten = new Integer(10);
System.out.println(ten++);
System.out.println(ten);
}
}
| UTF-8 | Java | 672 | java | StringMain.java | Java | [] | null | [] | package DEA.Session2;
public class StringMain {
public static void main(String [] args) {
String str = "Hello from VEF";
System.out.println(str.charAt(0));
System.out.println(str.substring(11));
System.out.println(str.substring(0, 5));
System.out.println(str.indexOf("VEF"));
System.out.println( str.equalsIgnoreCase("hello from vef"));
String str3 = "value1";
str3.concat("value2");
System.out.println(str3); //value1
str.toLowerCase();
str.toUpperCase();
Integer ten = new Integer(10);
System.out.println(ten++);
System.out.println(ten);
}
}
| 672 | 0.592262 | 0.571429 | 27 | 23.888889 | 19.97282 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.592593 | false | false | 9 |
8232a7a328a8be0d9a8560e057244420394b4446 | 644,245,130,129 | d9a6dcdc1bbbcb63c96d8a23dc41860ff6e5e31c | /datafari-core/src/main/java/com/francelabs/datafari/servlets/admin/QueryEvaluator.java | 34f9e3f260a3f0b3cb4f189313c9990596eda2d6 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-free-unknown",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"OFL-1.1",
"LicenseRef-scancode-jdom",
"BSD-3-Clause",
"CDDL-1.0",
"PostgreSQL"
] | permissive | marlemion/datafari | https://github.com/marlemion/datafari | d0b8130f8dd841ed094b3354de6d59ada3f9f613 | 308ebb5b4f753fa5dc883d70fc196963733cd564 | refs/heads/master | 2021-01-25T13:18:30.102000 | 2018-03-05T09:51:39 | 2018-03-05T09:51:39 | 123,552,394 | 0 | 0 | Apache-2.0 | true | 2018-03-02T08:28:34 | 2018-03-02T08:28:34 | 2018-01-09T15:49:00 | 2018-02-27T20:11:10 | 1,372,370 | 0 | 0 | 0 | null | false | null | /*******************************************************************************
* Copyright 2015 France Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.francelabs.datafari.servlets.admin;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import com.francelabs.datafari.exception.CodesReturned;
import com.francelabs.datafari.service.db.DocumentDataService;
import com.francelabs.datafari.service.search.SolrServers.Core;
import com.francelabs.datafari.servlets.constants.OutputConstants;
@WebServlet("/SearchExpert/queryEvaluator")
public class QueryEvaluator extends HttpServlet {
private final String server = Core.FILESHARE.toString();
private static final long serialVersionUID = 1L;
private final static Logger LOGGER = Logger.getLogger(QueryEvaluator.class.getName());
/**
* @see HttpServlet#HttpServlet()
*/
public QueryEvaluator() {
super();
}
/**
* @throws IOException
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
final JSONObject jsonResponse = new JSONObject();
request.setCharacterEncoding("utf8");
response.setContentType("application/json");
try {
String[] docIDs = request.getParameterValues("docids[]");
if (docIDs == null){
docIDs = request.getParameterValues("docids");
}
String query = request.getParameter("query");
// TODO : should use a "real" service layer
Map<String, Integer> rankedDocuments = DocumentDataService.getInstance().getRank(query, docIDs);
jsonResponse.put("docs", rankedDocuments).put(OutputConstants.CODE, CodesReturned.ALLOK.getValue());
// }
} catch (final Exception e) {
jsonResponse.put(OutputConstants.CODE, CodesReturned.GENERALERROR.getValue());
LOGGER.error("Error on marshal/unmarshal elevate.xml file ", e);
}
final PrintWriter out = response.getWriter();
out.print(jsonResponse);
}
/**
* @throws IOException
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
@Override
protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf8");
response.setContentType("application/json");
final JSONObject jsonResponse = new JSONObject();
if (request.getParameter("query") != null && !request.getParameter("query").equals("")) {
try {
// Retrieve the query used for the search
final String queryReq = request.getParameter("query");
// Retrieve the docId and the action to
// perform (elevate or remove from elevate)
final String docId = request.getParameter("item");
final String rank = request.getParameter("rank");
// TODO : should use a "real" service layer
synchronized (this) {
if (rank != null) {
DocumentDataService.getInstance().deleteRank(queryReq, docId);
DocumentDataService.getInstance().addRank(queryReq, docId, Integer.parseInt(rank));
} else {
DocumentDataService.getInstance().deleteRank(queryReq, docId);
}
}
jsonResponse.put(OutputConstants.CODE, CodesReturned.ALLOK.getValue());
} catch (final Exception e) {
jsonResponse.put(OutputConstants.CODE, CodesReturned.GENERALERROR.getValue());
LOGGER.error("Error on marshal/unmarshal elevate.xml file in solr/solrcloud/" + server + "/conf", e);
}
}
final PrintWriter out = response.getWriter();
out.print(jsonResponse);
}
}
| UTF-8 | Java | 4,573 | java | QueryEvaluator.java | Java | [
{
"context": "********************************\n * Copyright 2015 France Labs\n *\n * Licensed under the Apache License, Ver",
"end": 105,
"score": 0.7964857816696167,
"start": 99,
"tag": "NAME",
"value": "France"
}
] | null | [] | /*******************************************************************************
* Copyright 2015 France Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.francelabs.datafari.servlets.admin;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import com.francelabs.datafari.exception.CodesReturned;
import com.francelabs.datafari.service.db.DocumentDataService;
import com.francelabs.datafari.service.search.SolrServers.Core;
import com.francelabs.datafari.servlets.constants.OutputConstants;
@WebServlet("/SearchExpert/queryEvaluator")
public class QueryEvaluator extends HttpServlet {
private final String server = Core.FILESHARE.toString();
private static final long serialVersionUID = 1L;
private final static Logger LOGGER = Logger.getLogger(QueryEvaluator.class.getName());
/**
* @see HttpServlet#HttpServlet()
*/
public QueryEvaluator() {
super();
}
/**
* @throws IOException
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
final JSONObject jsonResponse = new JSONObject();
request.setCharacterEncoding("utf8");
response.setContentType("application/json");
try {
String[] docIDs = request.getParameterValues("docids[]");
if (docIDs == null){
docIDs = request.getParameterValues("docids");
}
String query = request.getParameter("query");
// TODO : should use a "real" service layer
Map<String, Integer> rankedDocuments = DocumentDataService.getInstance().getRank(query, docIDs);
jsonResponse.put("docs", rankedDocuments).put(OutputConstants.CODE, CodesReturned.ALLOK.getValue());
// }
} catch (final Exception e) {
jsonResponse.put(OutputConstants.CODE, CodesReturned.GENERALERROR.getValue());
LOGGER.error("Error on marshal/unmarshal elevate.xml file ", e);
}
final PrintWriter out = response.getWriter();
out.print(jsonResponse);
}
/**
* @throws IOException
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
@Override
protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf8");
response.setContentType("application/json");
final JSONObject jsonResponse = new JSONObject();
if (request.getParameter("query") != null && !request.getParameter("query").equals("")) {
try {
// Retrieve the query used for the search
final String queryReq = request.getParameter("query");
// Retrieve the docId and the action to
// perform (elevate or remove from elevate)
final String docId = request.getParameter("item");
final String rank = request.getParameter("rank");
// TODO : should use a "real" service layer
synchronized (this) {
if (rank != null) {
DocumentDataService.getInstance().deleteRank(queryReq, docId);
DocumentDataService.getInstance().addRank(queryReq, docId, Integer.parseInt(rank));
} else {
DocumentDataService.getInstance().deleteRank(queryReq, docId);
}
}
jsonResponse.put(OutputConstants.CODE, CodesReturned.ALLOK.getValue());
} catch (final Exception e) {
jsonResponse.put(OutputConstants.CODE, CodesReturned.GENERALERROR.getValue());
LOGGER.error("Error on marshal/unmarshal elevate.xml file in solr/solrcloud/" + server + "/conf", e);
}
}
final PrintWriter out = response.getWriter();
out.print(jsonResponse);
}
}
| 4,573 | 0.719003 | 0.716379 | 124 | 35.879032 | 28.970116 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.080645 | false | false | 9 |
0c661433f17996f2bebd52984ed9f625b023fc07 | 12,799,002,592,552 | 7a07ff5300a59e64b75e11de6f3fc44446761b5a | /sjMessage/sjMessage-search/src/main/java/cn/com/sparknet/sjMessage/repository/QueryMessageReporitory.java | 028f00196696a3a477875e6e1f3042f5b8a4d080 | [] | no_license | jack-chuan/sjMessage | https://github.com/jack-chuan/sjMessage | 4623a136651add18d27139b2fda0ab793c40ab49 | 1fa444999cd45643121bf8810578e91935cf0a92 | refs/heads/master | 2022-06-23T02:57:34.324000 | 2019-09-24T08:48:51 | 2019-09-24T08:48:51 | 210,551,628 | 1 | 0 | null | false | 2022-06-17T02:33:41 | 2019-09-24T08:29:54 | 2020-03-12T15:22:32 | 2022-06-17T02:33:41 | 4,083 | 1 | 0 | 8 | Java | false | false | package cn.com.sparknet.sjMessage.repository;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import cn.com.sparknet.sjMessage.domain.QueryMessage;
public interface QueryMessageReporitory extends ElasticsearchRepository<QueryMessage, String> {
}
| UTF-8 | Java | 284 | java | QueryMessageReporitory.java | Java | [] | null | [] | package cn.com.sparknet.sjMessage.repository;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import cn.com.sparknet.sjMessage.domain.QueryMessage;
public interface QueryMessageReporitory extends ElasticsearchRepository<QueryMessage, String> {
}
| 284 | 0.859155 | 0.859155 | 9 | 30.555555 | 36.542549 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 9 |
9b8d8e9cd49aec6be62d975c9e24b2be5cdd1f16 | 36,197,984,398,854 | 9b294c3bf262770e9bac252b018f4b6e9412e3ee | /camerazadas/source/apk/com.sonyericsson.android.camera/src-cfr-nocode/com/sonyericsson/cameracommon/contentsview/ContentsViewController.java | 07b853d33488acea27b5c96c1fc41e0c0b42dbfc | [] | no_license | h265/camera | https://github.com/h265/camera | 2c00f767002fd7dbb64ef4dc15ff667e493cd937 | 77b986a60f99c3909638a746c0ef62cca38e4235 | refs/heads/master | 2020-12-30T22:09:17.331000 | 2015-08-25T01:22:25 | 2015-08-25T01:22:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Decompiled with CFR 0_100.
*/
package com.sonyericsson.cameracommon.contentsview;
import android.app.Activity;
import android.net.Uri;
import android.view.View;
import android.view.animation.Animation;
import android.widget.RelativeLayout;
import com.sonyericsson.cameracommon.contentsview.ContentLoader;
import com.sonyericsson.cameracommon.contentsview.ContentPallet;
import com.sonyericsson.cameracommon.contentsview.ContentsContainer;
import com.sonyericsson.cameracommon.contentsview.PreloadThumbnail;
import com.sonyericsson.cameracommon.contentsview.contents.Content;
import com.sonyericsson.cameracommon.mediasaving.CameraStorageManager;
import com.sonyericsson.cameracommon.mediasaving.StorageController;
import com.sonyericsson.cameracommon.utility.IncrementalId;
/*
* Exception performing whole class analysis.
* Exception performing whole class analysis ignored.
*/
public class ContentsViewController
implements StorageController.StorageListener,
ContentLoader.ContentCreationCallback {
public static final int MAX_CONTENT_NUMBER = 1;
private static final String TAG;
private Activity mActivity;
private ClickListener mClickListener;
private OnClickThumbnailProgressListener mClickThumbnailProgressListener;
private boolean mClickable;
private final ContentsContainer mContentContainer;
private ContentCreatedListener mContentCreatedListener;
private ContentLoader mContentLoader;
private int mOrientation;
private int mProgressRequestId;
private final IncrementalId mRequestIdGenerator;
private CameraStorageManager mStorageManager;
private PreloadThumbnail mThumbnail;
private ContentPallet.ThumbnailClickListener mThumbnailClickListener;
static;
public ContentsViewController(Activity var1, ContentLoader.SecurityLevel var2, CameraStorageManager var3, ContentPallet.ThumbnailClickListener var4);
static /* synthetic */ OnClickThumbnailProgressListener access$100(ContentsViewController var0);
private ContentPallet searchPallet(int var1);
public void addContent(int var1, Uri var2);
public void addContentOverlayView(int var1, View var2);
public void addContentOverlayView(int var1, View var2, RelativeLayout.LayoutParams var3);
public void clearContents();
public int createClearContentFrame();
public int createContentFrame();
public void disableClick();
public void enableClick();
public void hide();
public void hideThumbnail();
public boolean isLoading();
@Override
public void onAvailableSizeUpdated(long var1);
@Override
public void onContentCreated(int var1, Content var2);
@Override
public void onDestinationToSaveChanged();
@Override
public void onStorageStateChanged(String var1);
public void pause();
public void release();
public void reload();
public void removeContentInfo();
public void removeContentOverlayView(int var1, View var2);
public void removeEarlyThumbnailView();
public void requestLayout();
public void setClickThumbnailProgressListener(OnClickThumbnailProgressListener var1);
public void setContentCreatedListener(ContentCreatedListener var1);
public void setEarlyThumbnailView(View var1);
public void setSensorOrientation(int var1);
public void show();
public void showProgress(int var1);
public void startAnimation(Animation var1);
public void startInsertAnimation(int var1);
public void startInsertAnimation(int var1, Animation.AnimationListener var2);
public void stopAnimation(boolean var1);
public void updateSecurityLevel(ContentLoader.SecurityLevel var1);
/*
* Exception performing whole class analysis.
* Exception performing whole class analysis ignored.
*/
private class ClickListener
implements View.OnClickListener {
final /* synthetic */ ContentsViewController this$0;
private ClickListener(ContentsViewController var1);
/* synthetic */ ClickListener(ContentsViewController var1, var2);
@Override
public void onClick(View var1);
}
public static interface ContentCreatedListener {
public void onContentCreated();
}
public static interface OnClickThumbnailProgressListener {
public void onClickThumbnailProgress();
}
}
| UTF-8 | Java | 4,361 | java | ContentsViewController.java | Java | [] | null | [] | /*
* Decompiled with CFR 0_100.
*/
package com.sonyericsson.cameracommon.contentsview;
import android.app.Activity;
import android.net.Uri;
import android.view.View;
import android.view.animation.Animation;
import android.widget.RelativeLayout;
import com.sonyericsson.cameracommon.contentsview.ContentLoader;
import com.sonyericsson.cameracommon.contentsview.ContentPallet;
import com.sonyericsson.cameracommon.contentsview.ContentsContainer;
import com.sonyericsson.cameracommon.contentsview.PreloadThumbnail;
import com.sonyericsson.cameracommon.contentsview.contents.Content;
import com.sonyericsson.cameracommon.mediasaving.CameraStorageManager;
import com.sonyericsson.cameracommon.mediasaving.StorageController;
import com.sonyericsson.cameracommon.utility.IncrementalId;
/*
* Exception performing whole class analysis.
* Exception performing whole class analysis ignored.
*/
public class ContentsViewController
implements StorageController.StorageListener,
ContentLoader.ContentCreationCallback {
public static final int MAX_CONTENT_NUMBER = 1;
private static final String TAG;
private Activity mActivity;
private ClickListener mClickListener;
private OnClickThumbnailProgressListener mClickThumbnailProgressListener;
private boolean mClickable;
private final ContentsContainer mContentContainer;
private ContentCreatedListener mContentCreatedListener;
private ContentLoader mContentLoader;
private int mOrientation;
private int mProgressRequestId;
private final IncrementalId mRequestIdGenerator;
private CameraStorageManager mStorageManager;
private PreloadThumbnail mThumbnail;
private ContentPallet.ThumbnailClickListener mThumbnailClickListener;
static;
public ContentsViewController(Activity var1, ContentLoader.SecurityLevel var2, CameraStorageManager var3, ContentPallet.ThumbnailClickListener var4);
static /* synthetic */ OnClickThumbnailProgressListener access$100(ContentsViewController var0);
private ContentPallet searchPallet(int var1);
public void addContent(int var1, Uri var2);
public void addContentOverlayView(int var1, View var2);
public void addContentOverlayView(int var1, View var2, RelativeLayout.LayoutParams var3);
public void clearContents();
public int createClearContentFrame();
public int createContentFrame();
public void disableClick();
public void enableClick();
public void hide();
public void hideThumbnail();
public boolean isLoading();
@Override
public void onAvailableSizeUpdated(long var1);
@Override
public void onContentCreated(int var1, Content var2);
@Override
public void onDestinationToSaveChanged();
@Override
public void onStorageStateChanged(String var1);
public void pause();
public void release();
public void reload();
public void removeContentInfo();
public void removeContentOverlayView(int var1, View var2);
public void removeEarlyThumbnailView();
public void requestLayout();
public void setClickThumbnailProgressListener(OnClickThumbnailProgressListener var1);
public void setContentCreatedListener(ContentCreatedListener var1);
public void setEarlyThumbnailView(View var1);
public void setSensorOrientation(int var1);
public void show();
public void showProgress(int var1);
public void startAnimation(Animation var1);
public void startInsertAnimation(int var1);
public void startInsertAnimation(int var1, Animation.AnimationListener var2);
public void stopAnimation(boolean var1);
public void updateSecurityLevel(ContentLoader.SecurityLevel var1);
/*
* Exception performing whole class analysis.
* Exception performing whole class analysis ignored.
*/
private class ClickListener
implements View.OnClickListener {
final /* synthetic */ ContentsViewController this$0;
private ClickListener(ContentsViewController var1);
/* synthetic */ ClickListener(ContentsViewController var1, var2);
@Override
public void onClick(View var1);
}
public static interface ContentCreatedListener {
public void onContentCreated();
}
public static interface OnClickThumbnailProgressListener {
public void onClickThumbnailProgress();
}
}
| 4,361 | 0.775052 | 0.765191 | 145 | 29.068966 | 28.227562 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.57931 | false | false | 9 |
8b1db0ac02ca548e34507c69a97f285d8dffaf72 | 6,768,868,497,746 | 731562a06dfd23b6bd789b789345e5bc59154f03 | /src/V20toolkit/model/v20Ability.java | 0564b426189abbef86fd37c11eaf70afc6cdb705 | [] | no_license | Scherben/V20toolkit | https://github.com/Scherben/V20toolkit | b456db91176136ebcec463bc2961d964f0bc45f1 | 2085e2b5f6dce37f75da2ce6ca48d5a0a002b0c5 | refs/heads/master | 2021-01-12T18:27:49.722000 | 2017-03-06T17:36:42 | 2017-03-06T17:36:42 | 71,384,118 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package V20toolkit.model;
import javafx.beans.property.SimpleStringProperty;
import java.util.ResourceBundle;
public class v20Ability extends v20Object{
public v20Ability(ResourceBundle i18n) {
this(
i18n.getString("v20_name_default"),
i18n.getString("v20_description_default"));
}
public v20Ability(String name, String description){
this.name = new SimpleStringProperty(name);
this.description = new SimpleStringProperty(description);
}
}
| UTF-8 | Java | 517 | java | v20Ability.java | Java | [] | null | [] | package V20toolkit.model;
import javafx.beans.property.SimpleStringProperty;
import java.util.ResourceBundle;
public class v20Ability extends v20Object{
public v20Ability(ResourceBundle i18n) {
this(
i18n.getString("v20_name_default"),
i18n.getString("v20_description_default"));
}
public v20Ability(String name, String description){
this.name = new SimpleStringProperty(name);
this.description = new SimpleStringProperty(description);
}
}
| 517 | 0.692456 | 0.653772 | 19 | 26.210526 | 24.005655 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 9 |
7fd6b63c7076233631a82ea60b2658a2bb07fd25 | 34,505,767,293,305 | 65ea21dd51b7e84fcaa7d25be8359941705862e3 | /sudoku/Sudoku/src/ste/sudoku/etape6/version3/SudokuFactoryV3.java | 88cae9ec6d0db109b03695fb4bf37955b0aa0850 | [] | no_license | HexaHexage/ExerciceSTE | https://github.com/HexaHexage/ExerciceSTE | f5fb1e3efb6d6f09f5c260030b416f9cc810111b | 4c0cf82ebc531d63904e9afd1395c655aed7f332 | refs/heads/master | 2020-05-25T15:32:19.020000 | 2017-03-14T12:01:36 | 2017-03-14T12:01:36 | 84,943,512 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ste.sudoku.etape6.version3;
import ste.sudoku.etape6.cellules.Cell1_4;
import ste.sudoku.etape6.cellules.Zone1_4;
import ste.sudoku.etape6.fabrique.AbstractSudokuFactory;
import ste.sudoku.etape6.sudokuInterface.Ecran;
import ste.sudoku.etape6.sudokuInterface.Sudoku;
import ste.sudoku.etape6.sudokuInterface.Zone;
public class SudokuFactoryV3 extends AbstractSudokuFactory {
@Override
public Sudoku createSudoku() {
int size = 5*4;
SudokuV3 sudo = new SudokuV3();
Zone[] zoneLine = new Zone1_4[size];
for(int i = 0;i<size;i++){
zoneLine[i] = new Zone1_4();
sudo.setMapzone("ligne", i, zoneLine[i]);
}
Zone[] zoneCol = new Zone1_4[size];
for(int i = 0;i<size;i++){
zoneCol[i] = new Zone1_4();
sudo.setMapzone("colonne", i, zoneCol[i]);
}
Zone[] zoneRegion = new Zone1_4[size];
for(int i = 0;i<size;i++){
zoneRegion[i] = new Zone1_4();
sudo.setMapzone("region", i, zoneRegion[i]);
}
Cell1_4[][] grid = new Cell1_4[sudo.getLineSize()][sudo.getColumnSize()];
sudo.setGrid(grid);
for (int l = 0; l < sudo.getLineSize(); l++) {
for (int c = 0; c < sudo.getColumnSize(); c++) {
if(sudo.isValidPosition(l,c)){
grid[l][c]=new Cell1_4();
System.out.println("CELL "+l+" "+c+" ZONE "+(l>7 ? c+12
: l<4 ? c+8
:c));
grid[l][c].addZone(zoneLine[ l>7 ? (l+8)
: c>3 && l>3 ? l+(c/4*4)
:l
]);
grid[l][c].addZone(zoneCol[l>7 ? c+12
: l<4 ? c+8
:c
]);
// grid[l][c].addZone(zoneRegion[l<10 ? (((l/2)*2)+(c/2))
// : l<16 ? ((l/2)*3)+(c/2)+1
// :
// ]);
}
}
}
return sudo;
}
@Override
public Ecran createEcran() {
return new EcranV3();
}
public static void main(String args[]){
new SudokuFactoryV3().createSudoku();
}
}
| UTF-8 | Java | 1,918 | java | SudokuFactoryV3.java | Java | [] | null | [] | package ste.sudoku.etape6.version3;
import ste.sudoku.etape6.cellules.Cell1_4;
import ste.sudoku.etape6.cellules.Zone1_4;
import ste.sudoku.etape6.fabrique.AbstractSudokuFactory;
import ste.sudoku.etape6.sudokuInterface.Ecran;
import ste.sudoku.etape6.sudokuInterface.Sudoku;
import ste.sudoku.etape6.sudokuInterface.Zone;
public class SudokuFactoryV3 extends AbstractSudokuFactory {
@Override
public Sudoku createSudoku() {
int size = 5*4;
SudokuV3 sudo = new SudokuV3();
Zone[] zoneLine = new Zone1_4[size];
for(int i = 0;i<size;i++){
zoneLine[i] = new Zone1_4();
sudo.setMapzone("ligne", i, zoneLine[i]);
}
Zone[] zoneCol = new Zone1_4[size];
for(int i = 0;i<size;i++){
zoneCol[i] = new Zone1_4();
sudo.setMapzone("colonne", i, zoneCol[i]);
}
Zone[] zoneRegion = new Zone1_4[size];
for(int i = 0;i<size;i++){
zoneRegion[i] = new Zone1_4();
sudo.setMapzone("region", i, zoneRegion[i]);
}
Cell1_4[][] grid = new Cell1_4[sudo.getLineSize()][sudo.getColumnSize()];
sudo.setGrid(grid);
for (int l = 0; l < sudo.getLineSize(); l++) {
for (int c = 0; c < sudo.getColumnSize(); c++) {
if(sudo.isValidPosition(l,c)){
grid[l][c]=new Cell1_4();
System.out.println("CELL "+l+" "+c+" ZONE "+(l>7 ? c+12
: l<4 ? c+8
:c));
grid[l][c].addZone(zoneLine[ l>7 ? (l+8)
: c>3 && l>3 ? l+(c/4*4)
:l
]);
grid[l][c].addZone(zoneCol[l>7 ? c+12
: l<4 ? c+8
:c
]);
// grid[l][c].addZone(zoneRegion[l<10 ? (((l/2)*2)+(c/2))
// : l<16 ? ((l/2)*3)+(c/2)+1
// :
// ]);
}
}
}
return sudo;
}
@Override
public Ecran createEcran() {
return new EcranV3();
}
public static void main(String args[]){
new SudokuFactoryV3().createSudoku();
}
}
| 1,918 | 0.556309 | 0.520334 | 72 | 25.638889 | 19.435295 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.638889 | false | false | 9 |
2878aa6d4e06f8744f13a20a4c36f9fe213bf593 | 21,157,008,957,880 | 1d092b0687a21af99cd81b0cbeb4d4c0ae09be28 | /src/main/java/com/swpu/uchain/demo/entity/Shop.java | ba2a578155da4df0e5f65a415265b5cc0dd7ab4e | [] | no_license | SWPUIOTYG/SchoolShop | https://github.com/SWPUIOTYG/SchoolShop | 08b8f13c96dce1d573a2d9bf4a39e86706d614e8 | 611f758acf972dddca907e81f4590d3b74616d61 | refs/heads/master | 2020-07-21T20:59:00.603000 | 2019-11-03T05:30:51 | 2019-11-03T05:30:51 | 206,972,878 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.swpu.uchain.demo.entity;
import java.io.Serializable;
import java.util.Date;
public class Shop implements Serializable {
private Integer shopId;
private Integer ownerId;
private Integer areaId;
private Integer shopCategoryId;
private String shopName;
private String shopDesc;
private String shopAddr;
private String phone;
private String shopImg;
private Date createTime;
private Date lastEditTime;
private Integer enableStatus;
private String advice;
private String ownerName;
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
private static final long serialVersionUID = 1L;
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getOwnerId() {
return ownerId;
}
public void setOwnerId(Integer ownerId) {
this.ownerId = ownerId;
}
public Integer getAreaId() {
return areaId;
}
public void setAreaId(Integer areaId) {
this.areaId = areaId;
}
public Integer getShopCategoryId() {
return shopCategoryId;
}
public void setShopCategoryId(Integer shopCategoryId) {
this.shopCategoryId = shopCategoryId;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName == null ? null : shopName.trim();
}
public String getShopDesc() {
return shopDesc;
}
public void setShopDesc(String shopDesc) {
this.shopDesc = shopDesc == null ? null : shopDesc.trim();
}
public String getShopAddr() {
return shopAddr;
}
public void setShopAddr(String shopAddr) {
this.shopAddr = shopAddr == null ? null : shopAddr.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getShopImg() {
return shopImg;
}
public void setShopImg(String shopImg) {
this.shopImg = shopImg == null ? null : shopImg.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastEditTime() {
return lastEditTime;
}
public void setLastEditTime(Date lastEditTime) {
this.lastEditTime = lastEditTime;
}
public Integer getEnableStatus() {
return enableStatus;
}
public void setEnableStatus(Integer enableStatus) {
this.enableStatus = enableStatus;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice == null ? null : advice.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", shopId=").append(shopId);
sb.append(", ownerId=").append(ownerId);
sb.append(", areaId=").append(areaId);
sb.append(", ownerName=").append(ownerName);
sb.append(", shopCategoryId=").append(shopCategoryId);
sb.append(", shopName=").append(shopName);
sb.append(", shopDesc=").append(shopDesc);
sb.append(", shopAddr=").append(shopAddr);
sb.append(", phone=").append(phone);
sb.append(", shopImg=").append(shopImg);
sb.append(", createTime=").append(createTime);
sb.append(", lastEditTime=").append(lastEditTime);
sb.append(", enableStatus=").append(enableStatus);
sb.append(", advice=").append(advice);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | UTF-8 | Java | 4,070 | java | Shop.java | Java | [] | null | [] | package com.swpu.uchain.demo.entity;
import java.io.Serializable;
import java.util.Date;
public class Shop implements Serializable {
private Integer shopId;
private Integer ownerId;
private Integer areaId;
private Integer shopCategoryId;
private String shopName;
private String shopDesc;
private String shopAddr;
private String phone;
private String shopImg;
private Date createTime;
private Date lastEditTime;
private Integer enableStatus;
private String advice;
private String ownerName;
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
private static final long serialVersionUID = 1L;
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getOwnerId() {
return ownerId;
}
public void setOwnerId(Integer ownerId) {
this.ownerId = ownerId;
}
public Integer getAreaId() {
return areaId;
}
public void setAreaId(Integer areaId) {
this.areaId = areaId;
}
public Integer getShopCategoryId() {
return shopCategoryId;
}
public void setShopCategoryId(Integer shopCategoryId) {
this.shopCategoryId = shopCategoryId;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName == null ? null : shopName.trim();
}
public String getShopDesc() {
return shopDesc;
}
public void setShopDesc(String shopDesc) {
this.shopDesc = shopDesc == null ? null : shopDesc.trim();
}
public String getShopAddr() {
return shopAddr;
}
public void setShopAddr(String shopAddr) {
this.shopAddr = shopAddr == null ? null : shopAddr.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getShopImg() {
return shopImg;
}
public void setShopImg(String shopImg) {
this.shopImg = shopImg == null ? null : shopImg.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastEditTime() {
return lastEditTime;
}
public void setLastEditTime(Date lastEditTime) {
this.lastEditTime = lastEditTime;
}
public Integer getEnableStatus() {
return enableStatus;
}
public void setEnableStatus(Integer enableStatus) {
this.enableStatus = enableStatus;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice == null ? null : advice.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", shopId=").append(shopId);
sb.append(", ownerId=").append(ownerId);
sb.append(", areaId=").append(areaId);
sb.append(", ownerName=").append(ownerName);
sb.append(", shopCategoryId=").append(shopCategoryId);
sb.append(", shopName=").append(shopName);
sb.append(", shopDesc=").append(shopDesc);
sb.append(", shopAddr=").append(shopAddr);
sb.append(", phone=").append(phone);
sb.append(", shopImg=").append(shopImg);
sb.append(", createTime=").append(createTime);
sb.append(", lastEditTime=").append(lastEditTime);
sb.append(", enableStatus=").append(enableStatus);
sb.append(", advice=").append(advice);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | 4,070 | 0.61769 | 0.617445 | 173 | 22.531792 | 20.402182 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473988 | false | false | 9 |
df49fa6114caf909590fb13a4e5179468df8e631 | 34,711,925,719,415 | f18412130662e9d25603eb77237c995c4e875621 | /src/App.java | 94a2973ae36efb6bd5dcb34aaf09555184edb6be | [] | no_license | RodrigoNOliveira/13-e-14-do-9-atividade-20 | https://github.com/RodrigoNOliveira/13-e-14-do-9-atividade-20 | 0bc0ef7f9d6b368bccc49727030ea068620b9523 | e9f0c505dd2190514e108779e6a178ff01f9e0e9 | refs/heads/master | 2023-08-25T03:45:01.736000 | 2021-10-31T21:02:12 | 2021-10-31T21:02:12 | 423,259,520 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.swing.JOptionPane;
class App {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Digite um número desejado (1 a 12)\n e receba o mês correspondente",
"Meses do ano", JOptionPane.INFORMATION_MESSAGE);
String x = JOptionPane.showInputDialog(null, "Digite o número desejado:", "Meses do ano",
JOptionPane.QUESTION_MESSAGE);
int y = Integer.parseInt(x);
if (y == 1) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Janeiro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 2) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Fevereiro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 3) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Março", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 4) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Abril", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 5) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Maio", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 6) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Junho", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 7) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Julho", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 8) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Agosto", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 9) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Setembro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 10) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Outubro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 11) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Novembro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 12) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Dezembro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(null, "Número invalido", "Meses do ano", JOptionPane.INFORMATION_MESSAGE);
}
}
} | UTF-8 | Java | 2,835 | java | App.java | Java | [] | null | [] | import javax.swing.JOptionPane;
class App {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Digite um número desejado (1 a 12)\n e receba o mês correspondente",
"Meses do ano", JOptionPane.INFORMATION_MESSAGE);
String x = JOptionPane.showInputDialog(null, "Digite o número desejado:", "Meses do ano",
JOptionPane.QUESTION_MESSAGE);
int y = Integer.parseInt(x);
if (y == 1) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Janeiro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 2) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Fevereiro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 3) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Março", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 4) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Abril", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 5) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Maio", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 6) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Junho", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 7) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Julho", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 8) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Agosto", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 9) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Setembro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 10) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Outubro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 11) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Novembro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else if (y == 12) {
JOptionPane.showMessageDialog(null, "Número digitado " + y + ": Dezembro", "Meses do ano",
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(null, "Número invalido", "Meses do ano", JOptionPane.INFORMATION_MESSAGE);
}
}
} | 2,835 | 0.566004 | 0.559617 | 56 | 49.339287 | 36.425697 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.107143 | false | false | 9 |
ce3f4bd09140ef8cbab7e485eeaca9c4de5cc90a | 34,016,141,030,590 | 85173ee61a7c273121f2b0de07137ad2a87e1814 | /backend/src/main/java/pl/polsl/mushrooms/application/services/MushroomClassService.java | c8ddb051c1adfe38c448f4d37806c5254bb07a82 | [] | no_license | pablito1410/mushrooms | https://github.com/pablito1410/mushrooms | d55fb9735355914f3baa078f6da071906f49dac8 | 676328dfcf57c48d79e6f9fb86f9eab459970c83 | refs/heads/master | 2020-05-23T12:07:39.608000 | 2017-09-29T13:28:49 | 2017-09-29T13:28:49 | 84,765,250 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.polsl.mushrooms.application.services;
import pl.polsl.mushrooms.application.commands.mushroom.clazz.CreateMushroomClassCommand;
import pl.polsl.mushrooms.application.commands.mushroom.clazz.DeleteMushroomClassCommand;
import pl.polsl.mushrooms.application.commands.mushroom.clazz.UpdateMushroomClassCommand;
import pl.polsl.mushrooms.infrastructure.dto.MushroomClassDto;
public interface MushroomClassService {
/**
* Adds the new mushroom class
* @param command
* @return If of created mushroom class
*/
long handle(CreateMushroomClassCommand command);
/**
* Updates the new mushroom class
* @param command
* @return Updated mushroom class
*/
MushroomClassDto handle(UpdateMushroomClassCommand command);
/**
* Deletes the mushroom class
* @param command
*/
void handle(DeleteMushroomClassCommand command);
}
| UTF-8 | Java | 904 | java | MushroomClassService.java | Java | [] | null | [] | package pl.polsl.mushrooms.application.services;
import pl.polsl.mushrooms.application.commands.mushroom.clazz.CreateMushroomClassCommand;
import pl.polsl.mushrooms.application.commands.mushroom.clazz.DeleteMushroomClassCommand;
import pl.polsl.mushrooms.application.commands.mushroom.clazz.UpdateMushroomClassCommand;
import pl.polsl.mushrooms.infrastructure.dto.MushroomClassDto;
public interface MushroomClassService {
/**
* Adds the new mushroom class
* @param command
* @return If of created mushroom class
*/
long handle(CreateMushroomClassCommand command);
/**
* Updates the new mushroom class
* @param command
* @return Updated mushroom class
*/
MushroomClassDto handle(UpdateMushroomClassCommand command);
/**
* Deletes the mushroom class
* @param command
*/
void handle(DeleteMushroomClassCommand command);
}
| 904 | 0.748894 | 0.748894 | 30 | 29.133333 | 28.239138 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 9 |
69c7144f1f83123b01f2abbaf0c393706f66d4b7 | 34,016,141,028,751 | adb69cddf7069dd5e653ef6d412876fce42cde5a | /src/main/java/fr/adaming/rest/BienImmobilierALouerRestController.java | 2f8c3c162de052b8cbbd19e3c7680d331e8a9671 | [] | no_license | Bellile/AppSystemeAgence | https://github.com/Bellile/AppSystemeAgence | eb3d016b88e46b2b8e394b8bb95725dafa3c234c | 6a4378468d46b29f7d1914f6f55c245f0b161c94 | refs/heads/master | 2020-03-28T01:18:33.623000 | 2018-09-12T14:16:45 | 2018-09-12T14:16:45 | 147,495,164 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.adaming.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import fr.adaming.dao.IBienImmobilierALouerDao;
import fr.adaming.model.BienImmobilierALouer;
import fr.adaming.service.IBienImmobilierALouerService;
@RestController
@RequestMapping("/wsBl")
public class BienImmobilierALouerRestController {
@Autowired
IBienImmobilierALouerService blService;
@RequestMapping(value="/liste", method=RequestMethod.GET, produces = "application/json")
public List<BienImmobilierALouer> getAllBL(){
return blService.getAll();
}
@RequestMapping(value="/recherche", method = RequestMethod.GET, produces = "application/json" )
public BienImmobilierALouer getBL(@RequestParam("pId") int id){
return blService.getById(id);
}
@RequestMapping(value="/ajout", method = RequestMethod.POST, produces = "application/json", consumes = "application/json" )
public BienImmobilierALouer addBL(@RequestBody BienImmobilierALouer bl){
System.out.println(bl.getLat());
return blService.add(bl);
}
@RequestMapping(value="/modif", method=RequestMethod.PUT, produces = "application/json", consumes = "application/json")
public BienImmobilierALouer updateBL(@RequestBody BienImmobilierALouer bl){
return blService.update(bl);
}
@RequestMapping(value="/suppr/{pId}", method = RequestMethod.DELETE)
public void deleteBL(@PathVariable("pId") int id){
blService.delete(id);
}
@RequestMapping(value="/listeLoyer", method=RequestMethod.GET, produces = "application/json")
public List<BienImmobilierALouer> getAllBLLoyer (@RequestParam("pLoyer")double loyer) {
return blService.getLocationByLoyer(loyer);
}
@RequestMapping(value="/listeRegion", method=RequestMethod.GET, produces = "application/json")
public List<BienImmobilierALouer> getAllBLRegion (@RequestParam("pRegion")String adresse) {
return blService.getLocationByRegion(adresse);
}
@RequestMapping(value="/modifDispo", method=RequestMethod.PUT, produces = "application/json", consumes = "application/json")
public BienImmobilierALouer updateBLDispo(@RequestBody BienImmobilierALouer bl){
return blService.updateDispo(bl);
}
@RequestMapping(value="/rechercheResp", method = RequestMethod.GET, produces = "application/json" )
public List<BienImmobilierALouer> getBLResp(@RequestParam("pId") int id){
return blService.getByResp(id);
}
}
| UTF-8 | Java | 2,829 | java | BienImmobilierALouerRestController.java | Java | [] | null | [] | package fr.adaming.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import fr.adaming.dao.IBienImmobilierALouerDao;
import fr.adaming.model.BienImmobilierALouer;
import fr.adaming.service.IBienImmobilierALouerService;
@RestController
@RequestMapping("/wsBl")
public class BienImmobilierALouerRestController {
@Autowired
IBienImmobilierALouerService blService;
@RequestMapping(value="/liste", method=RequestMethod.GET, produces = "application/json")
public List<BienImmobilierALouer> getAllBL(){
return blService.getAll();
}
@RequestMapping(value="/recherche", method = RequestMethod.GET, produces = "application/json" )
public BienImmobilierALouer getBL(@RequestParam("pId") int id){
return blService.getById(id);
}
@RequestMapping(value="/ajout", method = RequestMethod.POST, produces = "application/json", consumes = "application/json" )
public BienImmobilierALouer addBL(@RequestBody BienImmobilierALouer bl){
System.out.println(bl.getLat());
return blService.add(bl);
}
@RequestMapping(value="/modif", method=RequestMethod.PUT, produces = "application/json", consumes = "application/json")
public BienImmobilierALouer updateBL(@RequestBody BienImmobilierALouer bl){
return blService.update(bl);
}
@RequestMapping(value="/suppr/{pId}", method = RequestMethod.DELETE)
public void deleteBL(@PathVariable("pId") int id){
blService.delete(id);
}
@RequestMapping(value="/listeLoyer", method=RequestMethod.GET, produces = "application/json")
public List<BienImmobilierALouer> getAllBLLoyer (@RequestParam("pLoyer")double loyer) {
return blService.getLocationByLoyer(loyer);
}
@RequestMapping(value="/listeRegion", method=RequestMethod.GET, produces = "application/json")
public List<BienImmobilierALouer> getAllBLRegion (@RequestParam("pRegion")String adresse) {
return blService.getLocationByRegion(adresse);
}
@RequestMapping(value="/modifDispo", method=RequestMethod.PUT, produces = "application/json", consumes = "application/json")
public BienImmobilierALouer updateBLDispo(@RequestBody BienImmobilierALouer bl){
return blService.updateDispo(bl);
}
@RequestMapping(value="/rechercheResp", method = RequestMethod.GET, produces = "application/json" )
public List<BienImmobilierALouer> getBLResp(@RequestParam("pId") int id){
return blService.getByResp(id);
}
}
| 2,829 | 0.767409 | 0.767409 | 72 | 37.291668 | 36.326237 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.458333 | false | false | 9 |
bd5a205a38a977c77dd324fcbad25597eb056bed | 30,992,484,069,871 | ddec9165bbbf9d02817cf8377c9942f1a3ab6f6b | /LihtneLoendaja.java | 493c3e056ce1737130bfcf70f2b0ee9b5ff3b26d | [] | no_license | LompTeam/Test | https://github.com/LompTeam/Test | b2a505417417adaf32b2f850505982a4745592f4 | 21fdcfdd4b0e77788a43305858d846a628c0802d | refs/heads/master | 2021-01-09T05:55:17.202000 | 2017-02-03T14:37:28 | 2017-02-03T14:37:28 | 80,836,681 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class LihtneLoendaja implements Loendaja{
int kogus=0;
public void loenda(){
kogus++;
}
public int kogus(){
return kogus;
}
}
| UTF-8 | Java | 160 | java | LihtneLoendaja.java | Java | [] | null | [] | public class LihtneLoendaja implements Loendaja{
int kogus=0;
public void loenda(){
kogus++;
}
public int kogus(){
return kogus;
}
}
| 160 | 0.6125 | 0.60625 | 9 | 15.777778 | 13.668925 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 9 |
95b19ea72ad23b866c326d7f4e5f0c2ca7c3ea20 | 37,151,467,131,313 | b190b9cfdc5a1cbc383f8e127eaa231623269f0a | /rabbit-sender/src/main/java/com/rabbit/sender/services/impl/SenderServiceImpl.java | 22502a5b8d821440d2a47141b0b63460faddfa5b | [] | no_license | cbezmen/spring-rabbitmq | https://github.com/cbezmen/spring-rabbitmq | 3bb1f3886d13ee272e12b5dded158ab03806e5a3 | 4a57f3d6efdc0a3093788462e66caf9e8ef82099 | refs/heads/master | 2023-04-16T08:28:14.511000 | 2021-04-28T14:49:15 | 2021-04-28T14:49:15 | 104,852,362 | 3 | 1 | null | false | 2017-10-02T10:27:46 | 2017-09-26T07:40:50 | 2017-09-27T07:41:42 | 2017-10-02T10:27:46 | 9 | 1 | 1 | 0 | Java | null | null | package com.rabbit.sender.services.impl;
import com.rabbit.sender.models.Car;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author cbezmen
*/
@Service
@Slf4j
public class SenderServiceImpl {
AtomicInteger counter = new AtomicInteger();
@Autowired
private StreamBridge streamBridge;
@Scheduled(fixedDelay = 1000, initialDelay = 500)
public void sendCar() {
int id = counter.incrementAndGet();
Car car = new Car(id, "car-" + id);
log.info("sending {}", car);
streamBridge.send("carSender", car);
}
}
| UTF-8 | Java | 844 | java | SenderServiceImpl.java | Java | [
{
"context": "l.concurrent.atomic.AtomicInteger;\n\n/**\n * @author cbezmen\n */\n@Service\n@Slf4j\npublic class SenderServiceImp",
"end": 420,
"score": 0.999609649181366,
"start": 413,
"tag": "USERNAME",
"value": "cbezmen"
}
] | null | [] | package com.rabbit.sender.services.impl;
import com.rabbit.sender.models.Car;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author cbezmen
*/
@Service
@Slf4j
public class SenderServiceImpl {
AtomicInteger counter = new AtomicInteger();
@Autowired
private StreamBridge streamBridge;
@Scheduled(fixedDelay = 1000, initialDelay = 500)
public void sendCar() {
int id = counter.incrementAndGet();
Car car = new Car(id, "car-" + id);
log.info("sending {}", car);
streamBridge.send("carSender", car);
}
}
| 844 | 0.727488 | 0.71564 | 33 | 24.515152 | 21.841192 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 9 |
7a7da3021d30920d18922cd633c40ac164a1bd3c | 3,289,945,016,032 | bedfb2e68b2841f9bfa2fa37c7a26747ad323593 | /src/wtb/core/data/ErrorStatMapper.java | e4c7b906f3246b050d7764095afcb5255a179d5e | [] | no_license | SkyBadBoy/JiaNian | https://github.com/SkyBadBoy/JiaNian | 19d112b9fb7e7e2fb8a546dbdd813c52cfbb1ead | 031242ccae6d8274a51653f3f6e9d81e41a44a8e | refs/heads/master | 2021-08-16T17:37:03.473000 | 2017-11-20T05:57:57 | 2017-11-20T05:57:57 | 108,823,123 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package wtb.core.data;
import java.util.List;
import java.util.Map;
import wtb.core.model.ErrorStat;
public interface ErrorStatMapper {
public int addErrorStat(ErrorStat ErrorStat);
public int deleteErrorStat(Map<String , Object> map);
public int updateErrorStat(ErrorStat ErrorStat);
public int updateErrorStatByClassName(long ErrorStat);
}
| UTF-8 | Java | 353 | java | ErrorStatMapper.java | Java | [] | null | [] | package wtb.core.data;
import java.util.List;
import java.util.Map;
import wtb.core.model.ErrorStat;
public interface ErrorStatMapper {
public int addErrorStat(ErrorStat ErrorStat);
public int deleteErrorStat(Map<String , Object> map);
public int updateErrorStat(ErrorStat ErrorStat);
public int updateErrorStatByClassName(long ErrorStat);
}
| 353 | 0.796034 | 0.796034 | 15 | 22.533333 | 20.710276 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
590a16dc7904587efcd6c1e08358b055498c2f0e | 12,532,714,571,452 | 583a27f1318def73283dd1829323a2405dd0a99c | /gyrecyclerview/src/main/java/com/gan/gyrecyclerview/inter/IbaseAdapterHelper.java | 4ecb17eef1bac0b43a29bf75df801147ed44adb3 | [] | no_license | 971638267/RetrofitAndRxjava2forRecyclerview | https://github.com/971638267/RetrofitAndRxjava2forRecyclerview | 0b8307794eefd33e03dfa705c493dd55f528af40 | 31b78dea42d58d67bbdf491372ae19d769919929 | refs/heads/master | 2020-03-12T20:48:11.925000 | 2018-10-10T07:42:41 | 2018-10-10T07:42:41 | 130,814,003 | 1 | 0 | null | false | 2018-04-27T05:15:38 | 2018-04-24T07:27:10 | 2018-04-26T08:09:44 | 2018-04-27T05:15:37 | 2,460 | 0 | 0 | 0 | Java | false | null | package com.gan.gyrecyclerview.inter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.gan.gyrecyclerview.BaseRecyclerViewAdapter;
import java.util.List;
/**
* 文件描述
* 创建人:ganyf
* 创建时间:2018/7/30
*/
public interface IbaseAdapterHelper<T> {
List<T> getData();
void setOnItemClickListener(OnItemClickListener onItemClickListener);
interface OnItemClickListener {
void onItemClick(View view, RecyclerView.ViewHolder holder, int position);
boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position);
}
}
| UTF-8 | Java | 624 | java | IbaseAdapterHelper.java | Java | [
{
"context": "pter;\n\nimport java.util.List;\n\n/**\n * 文件描述\n * 创建人:ganyf\n * 创建时间:2018/7/30\n */\npublic interface IbaseAdapt",
"end": 217,
"score": 0.9997146725654602,
"start": 212,
"tag": "USERNAME",
"value": "ganyf"
}
] | null | [] | package com.gan.gyrecyclerview.inter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.gan.gyrecyclerview.BaseRecyclerViewAdapter;
import java.util.List;
/**
* 文件描述
* 创建人:ganyf
* 创建时间:2018/7/30
*/
public interface IbaseAdapterHelper<T> {
List<T> getData();
void setOnItemClickListener(OnItemClickListener onItemClickListener);
interface OnItemClickListener {
void onItemClick(View view, RecyclerView.ViewHolder holder, int position);
boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position);
}
}
| 624 | 0.755853 | 0.742475 | 25 | 22.92 | 26.970978 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52 | false | false | 9 |
954e9900f556833fcef157ef55a694b6d4086874 | 14,843,407,010,896 | 0d6ede39b298815bbbc18587285cdc96d69b9c32 | /src/edu/nyu/liangfang/leetcode/searchForARange.java | d49ae823be5334edc222b70119fc810f7807739d | [] | no_license | liangfang011/CodingExercise | https://github.com/liangfang011/CodingExercise | d2347ceb3b003b475782ab0ce67d4938aaec6e78 | 82f6a4cc6a673365ec753427e8b027c850fd8fbc | refs/heads/master | 2021-01-21T05:01:05.708000 | 2016-04-06T21:34:15 | 2016-04-06T21:34:15 | 17,072,241 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.nyu.liangfang.leetcode;
public class searchForARange {
// O(lgn) method - just found left and right boundary
public int[] searchRange_boundary(int[] nums, int target) {
int[] res = {-1, -1};
if (nums.length == 0) return res;
int low = 0, high = nums.length - 1;
while (low <= high) {
int pos = (low + high) / 2;
if (target <= nums[pos]) {
high = pos - 1;
} else {
low = pos + 1;
}
}
int start = low;
low = 0;
high = nums.length - 1;
while (low <= high) {
int pos = (low + high) / 2;
if (target >= nums[pos]) {
low = pos + 1;
} else {
high = pos - 1;
}
}
int end = high;
if (start <= end) { // Have to check first, because we might not find target in nums!
res[0] = start;
res[1] = end;
}
return res;
}
// O(lgn) method - too long
public int[] searchRange(int[] A, int target) {
int[] res = {-1, -1};
if (A == null || A.length == 0) {
return res;
}
int low = 0;
int high = A.length - 1;
int pos = 0;
// find a target, do not care where it is
while (low <= high) {
int mid = (low + high) / 2;
if (A[mid] < target) {
low = mid + 1;
} else if (A[mid] > target) {
high = mid - 1;
} else {
res[0] = mid;
res[1] = mid;
pos = mid;
break;
}
}
// if no such target
if (res[0] == -1) {
return res;
}
// find the right boundary
low = pos;
high = A.length - 1;
while (low <= high) { // to finally put high at right boundary, we need equals condition
int mid2 = (low + high) / 2;
if (A[mid2] == target) {
low = mid2 + 1;
} else { // since it's only possible that A[mid2] >= target, because we initialize low as pos
high = mid2 - 1;
}
}
res[1] = high;
// find the left boundary, same as right
low = 0;
high = pos;
while (low <= high) {
int mid3 = (low + high) / 2;
if (A[mid3] == target) {
high = mid3 - 1;
} else {
low = mid3 + 1;
}
}
res[0] = low;
return res;
}
// Actually it costs O(n) time because of a linear search after we find one target
public int[] searchRange_On(int[] A, int target) {
int[] result = {-1, -1};
compute(A, 0, A.length - 1, target, result);
return result;
}
private void compute(int[] A, int start, int end, int target, int[] result) {
if (start > end) {
return;
}
int mid = (start + end) / 2;
if (A[mid] < target) {
compute(A, mid + 1, end, target, result);
} else if (A[mid] > target) {
compute(A, start, mid - 1, target, result);
} else {
int i = mid;
int j = mid;
while (i >= start) {
if (A[i] == target)
i--;
else
break;
}
while (j <= end) {
if (A[j] == target)
j++;
else
break;
}
result[0] = i + 1;
result[1] = j - 1;
return;
}
}
}
| UTF-8 | Java | 3,745 | java | searchForARange.java | Java | [] | null | [] | package edu.nyu.liangfang.leetcode;
public class searchForARange {
// O(lgn) method - just found left and right boundary
public int[] searchRange_boundary(int[] nums, int target) {
int[] res = {-1, -1};
if (nums.length == 0) return res;
int low = 0, high = nums.length - 1;
while (low <= high) {
int pos = (low + high) / 2;
if (target <= nums[pos]) {
high = pos - 1;
} else {
low = pos + 1;
}
}
int start = low;
low = 0;
high = nums.length - 1;
while (low <= high) {
int pos = (low + high) / 2;
if (target >= nums[pos]) {
low = pos + 1;
} else {
high = pos - 1;
}
}
int end = high;
if (start <= end) { // Have to check first, because we might not find target in nums!
res[0] = start;
res[1] = end;
}
return res;
}
// O(lgn) method - too long
public int[] searchRange(int[] A, int target) {
int[] res = {-1, -1};
if (A == null || A.length == 0) {
return res;
}
int low = 0;
int high = A.length - 1;
int pos = 0;
// find a target, do not care where it is
while (low <= high) {
int mid = (low + high) / 2;
if (A[mid] < target) {
low = mid + 1;
} else if (A[mid] > target) {
high = mid - 1;
} else {
res[0] = mid;
res[1] = mid;
pos = mid;
break;
}
}
// if no such target
if (res[0] == -1) {
return res;
}
// find the right boundary
low = pos;
high = A.length - 1;
while (low <= high) { // to finally put high at right boundary, we need equals condition
int mid2 = (low + high) / 2;
if (A[mid2] == target) {
low = mid2 + 1;
} else { // since it's only possible that A[mid2] >= target, because we initialize low as pos
high = mid2 - 1;
}
}
res[1] = high;
// find the left boundary, same as right
low = 0;
high = pos;
while (low <= high) {
int mid3 = (low + high) / 2;
if (A[mid3] == target) {
high = mid3 - 1;
} else {
low = mid3 + 1;
}
}
res[0] = low;
return res;
}
// Actually it costs O(n) time because of a linear search after we find one target
public int[] searchRange_On(int[] A, int target) {
int[] result = {-1, -1};
compute(A, 0, A.length - 1, target, result);
return result;
}
private void compute(int[] A, int start, int end, int target, int[] result) {
if (start > end) {
return;
}
int mid = (start + end) / 2;
if (A[mid] < target) {
compute(A, mid + 1, end, target, result);
} else if (A[mid] > target) {
compute(A, start, mid - 1, target, result);
} else {
int i = mid;
int j = mid;
while (i >= start) {
if (A[i] == target)
i--;
else
break;
}
while (j <= end) {
if (A[j] == target)
j++;
else
break;
}
result[0] = i + 1;
result[1] = j - 1;
return;
}
}
}
| 3,745 | 0.390654 | 0.375167 | 136 | 26.536764 | 19.738701 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.654412 | false | false | 9 |
9e38be7c587b127cc6f647eb65a3f90286504c1a | 23,630,910,093,914 | a15d3a2fe49e6fa6ed53f5933e178eb9eb773a56 | /src/main/java/com/wsh/asset/comms/AssetReceiveParams.java | 0d96d7a0c4f47381117c06cf323d6ce894a4810d | [] | no_license | future-chen01/asset | https://github.com/future-chen01/asset | 6bc764f3e44abcf3579e17f30e61cfc19d4be114 | 129318fc97f01571bb7fea989a94408b8a3e4e89 | refs/heads/master | 2020-04-11T22:20:33.921000 | 2018-12-06T09:41:48 | 2018-12-06T09:41:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wsh.asset.comms;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Getter
@Setter
@ToString
public class AssetReceiveParams extends Params{
/*
*出库领用表表
* */
//领用id
private Integer[] receiveId;
//领用单号
private String receiveNumber;
//领用人id
private Integer receiveUserid;
//领用人姓名
private String receiveUsername;
//领用资产id
private Integer receiveAssetid;
//领用人部门id
private Integer receiveDepartmentid;
//领用后存放地
private String receiveStorageplace;
//领用时间
@DateTimeFormat(pattern = "yyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyy-MM-dd HH:mm:ss")
private Date receiveEnabledate;
//领用操作人
private Integer receiveOperator;
//备注
private String receiveRemark;
}
| UTF-8 | Java | 1,071 | java | AssetReceiveParams.java | Java | [] | null | [] | package com.wsh.asset.comms;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Getter
@Setter
@ToString
public class AssetReceiveParams extends Params{
/*
*出库领用表表
* */
//领用id
private Integer[] receiveId;
//领用单号
private String receiveNumber;
//领用人id
private Integer receiveUserid;
//领用人姓名
private String receiveUsername;
//领用资产id
private Integer receiveAssetid;
//领用人部门id
private Integer receiveDepartmentid;
//领用后存放地
private String receiveStorageplace;
//领用时间
@DateTimeFormat(pattern = "yyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyy-MM-dd HH:mm:ss")
private Date receiveEnabledate;
//领用操作人
private Integer receiveOperator;
//备注
private String receiveRemark;
}
| 1,071 | 0.682329 | 0.681307 | 40 | 22.475 | 17.230768 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false | 9 |
157e5d7251645021b452b2cef6056dead9a0d013 | 6,743,098,687,854 | ef1b72abf5554c94661c495a0bf0a6aded89e37c | /src/net/minecraft/src/cla.java | 20c0a65a6219aa34aab5f32a8902ef3b920ec547 | [] | no_license | JimmyZJX/MC1.8_source | https://github.com/JimmyZJX/MC1.8_source | ad459b12d0d01db28942b9af87c86393011fd626 | 25f56c7884a320cbf183b23010cccecb5689d707 | refs/heads/master | 2016-09-10T04:26:40.951000 | 2014-11-29T06:22:02 | 2014-11-29T06:22:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.minecraft.src;
/* 1: */ public class cla
/* 2: */ {
/* 3: */ protected final ckn a;
/* 4: */ protected final World b;
/* 5: */ protected int c;
/* 6: */ protected int d;
/* 7: */ protected int e;
/* 8: */ public cop[] f;
/* 9: */
/* 10: */ public cla(World paramaqu, int paramInt, ckn paramckn, coq paramcoq)
/* 11: */ {
/* 12: 20 */ this.a = paramckn;
/* 13: 21 */ this.b = paramaqu;
/* 14: */
/* 15: 23 */ a(paramInt);
/* 16: 24 */ a(paramcoq);
/* 17: */ }
/* 18: */
/* 19: */ protected void a(coq paramcoq)
/* 20: */ {
/* 21: 28 */ int i = this.d * this.c * this.e;
/* 22: 29 */ this.f = new cop[i];
/* 23: */
/* 24: 31 */ int j = 0;
/* 25: 32 */ for (int k = 0; k < this.d; k++) {
/* 26: 33 */ for (int m = 0; m < this.c; m++) {
/* 27: 34 */ for (int n = 0; n < this.e; n++)
/* 28: */ {
/* 29: 35 */ int i1 = (n * this.c + m) * this.d + k;
/* 30: 36 */ BlockPosition localdt = new BlockPosition(k * 16, m * 16, n * 16);
/* 31: 37 */ this.f[i1] = paramcoq.a(this.b, this.a, localdt, j++);
/* 32: */ }
/* 33: */ }
/* 34: */ }
/* 35: */ }
/* 36: */
/* 37: */ public void a()
/* 38: */ {
/* 39: 44 */ for (cop localcop : this.f) {
/* 40: 45 */ localcop.a();
/* 41: */ }
/* 42: */ }
/* 43: */
/* 44: */ protected void a(int paramInt)
/* 45: */ {
/* 46: 50 */ int i = paramInt * 2 + 1;
/* 47: 51 */ this.d = i;
/* 48: 52 */ this.c = 16;
/* 49: 53 */ this.e = i;
/* 50: */ }
/* 51: */
/* 52: */ public void a(double paramDouble1, double paramDouble2)
/* 53: */ {
/* 54: 57 */ int i = MathUtils.floor(paramDouble1) - 8;
/* 55: 58 */ int j = MathUtils.floor(paramDouble2) - 8;
/* 56: */
/* 57: 60 */ int k = this.d * 16;
/* 58: 62 */ for (int m = 0; m < this.d; m++)
/* 59: */ {
/* 60: 63 */ int n = a(i, k, m);
/* 61: 65 */ for (int i1 = 0; i1 < this.e; i1++)
/* 62: */ {
/* 63: 66 */ int i2 = a(j, k, i1);
/* 64: 68 */ for (int i3 = 0; i3 < this.c; i3++)
/* 65: */ {
/* 66: 69 */ int i4 = i3 * 16;
/* 67: */
/* 68: 71 */ cop localcop = this.f[((i1 * this.c + i3) * this.d + m)];
/* 69: 72 */ BlockPosition localdt = new BlockPosition(n, i4, i2);
/* 70: 74 */ if (!localdt.equals(localcop.j())) {
/* 71: 75 */ localcop.a(localdt);
/* 72: */ }
/* 73: */ }
/* 74: */ }
/* 75: */ }
/* 76: */ }
/* 77: */
/* 78: */ private int a(int paramInt1, int paramInt2, int paramInt3)
/* 79: */ {
/* 80: 84 */ int i = paramInt3 * 16;
/* 81: 85 */ int j = i - paramInt1 + paramInt2 / 2;
/* 82: 86 */ if (j < 0) {
/* 83: 87 */ j -= paramInt2 - 1;
/* 84: */ }
/* 85: 91 */ return i - j / paramInt2 * paramInt2;
/* 86: */ }
/* 87: */
/* 88: */ public void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
/* 89: */ {
/* 90: 95 */ int i = MathUtils.intFloorDiv(paramInt1, 16);
/* 91: 96 */ int j = MathUtils.intFloorDiv(paramInt2, 16);
/* 92: 97 */ int k = MathUtils.intFloorDiv(paramInt3, 16);
/* 93: 98 */ int m = MathUtils.intFloorDiv(paramInt4, 16);
/* 94: 99 */ int n = MathUtils.intFloorDiv(paramInt5, 16);
/* 95:100 */ int i1 = MathUtils.intFloorDiv(paramInt6, 16);
/* 96:102 */ for (int i2 = i; i2 <= m; i2++)
/* 97: */ {
/* 98:103 */ int i3 = i2 % this.d;
/* 99:104 */ if (i3 < 0) {
/* 100:105 */ i3 += this.d;
/* 101: */ }
/* 102:107 */ for (int i4 = j; i4 <= n; i4++)
/* 103: */ {
/* 104:108 */ int i5 = i4 % this.c;
/* 105:109 */ if (i5 < 0) {
/* 106:110 */ i5 += this.c;
/* 107: */ }
/* 108:112 */ for (int i6 = k; i6 <= i1; i6++)
/* 109: */ {
/* 110:113 */ int i7 = i6 % this.e;
/* 111:114 */ if (i7 < 0) {
/* 112:115 */ i7 += this.e;
/* 113: */ }
/* 114:118 */ int i8 = (i7 * this.c + i5) * this.d + i3;
/* 115:119 */ cop localcop = this.f[i8];
/* 116:120 */ localcop.a(true);
/* 117: */ }
/* 118: */ }
/* 119: */ }
/* 120: */ }
/* 121: */
/* 122: */ protected cop a(BlockPosition paramdt)
/* 123: */ {
/* 124:128 */ int i = MathUtils.intFloorDiv(paramdt.getX(), 16);
/* 125:129 */ int j = MathUtils.intFloorDiv(paramdt.getY(), 16);
/* 126:130 */ int k = MathUtils.intFloorDiv(paramdt.getZ(), 16);
/* 127:132 */ if ((j < 0) || (j >= this.c)) {
/* 128:133 */ return null;
/* 129: */ }
/* 130:136 */ i %= this.d;
/* 131:137 */ if (i < 0) {
/* 132:138 */ i += this.d;
/* 133: */ }
/* 134:140 */ k %= this.e;
/* 135:141 */ if (k < 0) {
/* 136:142 */ k += this.e;
/* 137: */ }
/* 138:144 */ int m = (k * this.c + j) * this.d + i;
/* 139:145 */ return this.f[m];
/* 140: */ }
/* 141: */ }
/* Location: C:\Minecraft1.7.5\.minecraft\versions\1.8\1.8.jar
* Qualified Name: cla
* JD-Core Version: 0.7.0.1
*/ | UTF-8 | Java | 5,624 | java | cla.java | Java | [] | null | [] | package net.minecraft.src;
/* 1: */ public class cla
/* 2: */ {
/* 3: */ protected final ckn a;
/* 4: */ protected final World b;
/* 5: */ protected int c;
/* 6: */ protected int d;
/* 7: */ protected int e;
/* 8: */ public cop[] f;
/* 9: */
/* 10: */ public cla(World paramaqu, int paramInt, ckn paramckn, coq paramcoq)
/* 11: */ {
/* 12: 20 */ this.a = paramckn;
/* 13: 21 */ this.b = paramaqu;
/* 14: */
/* 15: 23 */ a(paramInt);
/* 16: 24 */ a(paramcoq);
/* 17: */ }
/* 18: */
/* 19: */ protected void a(coq paramcoq)
/* 20: */ {
/* 21: 28 */ int i = this.d * this.c * this.e;
/* 22: 29 */ this.f = new cop[i];
/* 23: */
/* 24: 31 */ int j = 0;
/* 25: 32 */ for (int k = 0; k < this.d; k++) {
/* 26: 33 */ for (int m = 0; m < this.c; m++) {
/* 27: 34 */ for (int n = 0; n < this.e; n++)
/* 28: */ {
/* 29: 35 */ int i1 = (n * this.c + m) * this.d + k;
/* 30: 36 */ BlockPosition localdt = new BlockPosition(k * 16, m * 16, n * 16);
/* 31: 37 */ this.f[i1] = paramcoq.a(this.b, this.a, localdt, j++);
/* 32: */ }
/* 33: */ }
/* 34: */ }
/* 35: */ }
/* 36: */
/* 37: */ public void a()
/* 38: */ {
/* 39: 44 */ for (cop localcop : this.f) {
/* 40: 45 */ localcop.a();
/* 41: */ }
/* 42: */ }
/* 43: */
/* 44: */ protected void a(int paramInt)
/* 45: */ {
/* 46: 50 */ int i = paramInt * 2 + 1;
/* 47: 51 */ this.d = i;
/* 48: 52 */ this.c = 16;
/* 49: 53 */ this.e = i;
/* 50: */ }
/* 51: */
/* 52: */ public void a(double paramDouble1, double paramDouble2)
/* 53: */ {
/* 54: 57 */ int i = MathUtils.floor(paramDouble1) - 8;
/* 55: 58 */ int j = MathUtils.floor(paramDouble2) - 8;
/* 56: */
/* 57: 60 */ int k = this.d * 16;
/* 58: 62 */ for (int m = 0; m < this.d; m++)
/* 59: */ {
/* 60: 63 */ int n = a(i, k, m);
/* 61: 65 */ for (int i1 = 0; i1 < this.e; i1++)
/* 62: */ {
/* 63: 66 */ int i2 = a(j, k, i1);
/* 64: 68 */ for (int i3 = 0; i3 < this.c; i3++)
/* 65: */ {
/* 66: 69 */ int i4 = i3 * 16;
/* 67: */
/* 68: 71 */ cop localcop = this.f[((i1 * this.c + i3) * this.d + m)];
/* 69: 72 */ BlockPosition localdt = new BlockPosition(n, i4, i2);
/* 70: 74 */ if (!localdt.equals(localcop.j())) {
/* 71: 75 */ localcop.a(localdt);
/* 72: */ }
/* 73: */ }
/* 74: */ }
/* 75: */ }
/* 76: */ }
/* 77: */
/* 78: */ private int a(int paramInt1, int paramInt2, int paramInt3)
/* 79: */ {
/* 80: 84 */ int i = paramInt3 * 16;
/* 81: 85 */ int j = i - paramInt1 + paramInt2 / 2;
/* 82: 86 */ if (j < 0) {
/* 83: 87 */ j -= paramInt2 - 1;
/* 84: */ }
/* 85: 91 */ return i - j / paramInt2 * paramInt2;
/* 86: */ }
/* 87: */
/* 88: */ public void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
/* 89: */ {
/* 90: 95 */ int i = MathUtils.intFloorDiv(paramInt1, 16);
/* 91: 96 */ int j = MathUtils.intFloorDiv(paramInt2, 16);
/* 92: 97 */ int k = MathUtils.intFloorDiv(paramInt3, 16);
/* 93: 98 */ int m = MathUtils.intFloorDiv(paramInt4, 16);
/* 94: 99 */ int n = MathUtils.intFloorDiv(paramInt5, 16);
/* 95:100 */ int i1 = MathUtils.intFloorDiv(paramInt6, 16);
/* 96:102 */ for (int i2 = i; i2 <= m; i2++)
/* 97: */ {
/* 98:103 */ int i3 = i2 % this.d;
/* 99:104 */ if (i3 < 0) {
/* 100:105 */ i3 += this.d;
/* 101: */ }
/* 102:107 */ for (int i4 = j; i4 <= n; i4++)
/* 103: */ {
/* 104:108 */ int i5 = i4 % this.c;
/* 105:109 */ if (i5 < 0) {
/* 106:110 */ i5 += this.c;
/* 107: */ }
/* 108:112 */ for (int i6 = k; i6 <= i1; i6++)
/* 109: */ {
/* 110:113 */ int i7 = i6 % this.e;
/* 111:114 */ if (i7 < 0) {
/* 112:115 */ i7 += this.e;
/* 113: */ }
/* 114:118 */ int i8 = (i7 * this.c + i5) * this.d + i3;
/* 115:119 */ cop localcop = this.f[i8];
/* 116:120 */ localcop.a(true);
/* 117: */ }
/* 118: */ }
/* 119: */ }
/* 120: */ }
/* 121: */
/* 122: */ protected cop a(BlockPosition paramdt)
/* 123: */ {
/* 124:128 */ int i = MathUtils.intFloorDiv(paramdt.getX(), 16);
/* 125:129 */ int j = MathUtils.intFloorDiv(paramdt.getY(), 16);
/* 126:130 */ int k = MathUtils.intFloorDiv(paramdt.getZ(), 16);
/* 127:132 */ if ((j < 0) || (j >= this.c)) {
/* 128:133 */ return null;
/* 129: */ }
/* 130:136 */ i %= this.d;
/* 131:137 */ if (i < 0) {
/* 132:138 */ i += this.d;
/* 133: */ }
/* 134:140 */ k %= this.e;
/* 135:141 */ if (k < 0) {
/* 136:142 */ k += this.e;
/* 137: */ }
/* 138:144 */ int m = (k * this.c + j) * this.d + i;
/* 139:145 */ return this.f[m];
/* 140: */ }
/* 141: */ }
/* Location: C:\Minecraft1.7.5\.minecraft\versions\1.8\1.8.jar
* Qualified Name: cla
* JD-Core Version: 0.7.0.1
*/ | 5,624 | 0.392781 | 0.282895 | 152 | 35.039474 | 20.544521 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.730263 | false | false | 9 |
a25cd81f9cb7997d7309172319a289b52c443a7a | 29,429,115,948,233 | 3f6965b5bbcebd048f79067d6717e73ab3dbd3a2 | /customer/src/main/java/com/tpt/budgetbucket/customer/server/service/CustomerServiceImpl.java | 56a703234905c607e1218149160a182b07f35398 | [] | no_license | Tripti87/SpringBoot-Maven-Exp | https://github.com/Tripti87/SpringBoot-Maven-Exp | 992c1e0edc4a31cba7e697fca7eaae017a00b712 | 87356c49c97bae76d25e0dd35f820b5a7eea31c5 | refs/heads/master | 2020-03-22T02:18:18.689000 | 2018-07-18T12:34:05 | 2018-07-18T12:34:05 | 139,362,511 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tpt.budgetbucket.customer.server.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tpt.budgetbucket.customer.server.Repository.CustomerRepo;
import com.tpt.budgetbucket.customer.server.Repository.CustomerRepository;
import com.tpt.budgetbucket.customer.server.domain.Address;
import com.tpt.budgetbucket.customer.server.domain.Customer;
/**
* Created by gupta on 23.06.2018.
*/
@Service
public class CustomerServiceImpl implements CustomerService {
@Autowired
CustomerRepository customerRepository;
@Override
public List<Customer> getCustomerByName(String customerId){
List<Customer> customers = new ArrayList<>();
customers.add(getDummyCustomer());
return customers;
}
private Customer getDummyCustomer() {
Customer customer = new Customer();
customer.setCustomerId("1");
customer.setFirstName("Tripti");
customer.setLastName("Gupta");
customer.setEmail("gupta@gmail.com");
customer.setPhone("123");
customer.setStatus("Starter");
Address address = new Address();
address.setCountry("India");
address.setCity("Delhi");
customer.setAddress(address);
return customer;
}
@Override
public CustomerRepo getCustomerById(String customerId){
if (customerId.equals("1") || customerId.equals("abc")){
throw new NullPointerException();
}
//return getDummyCustomer();
return customerRepository.getCustomer();
}
@Override
public String postCustomer(Customer customer) {
if (customer != null){
return "Success";
}
return "fail";
}
}
| UTF-8 | Java | 1,642 | java | CustomerServiceImpl.java | Java | [
{
"context": "ustomer.server.domain.Customer;\n\n/**\n * Created by gupta on 23.06.2018.\n */\n\n@Service\npublic class Custome",
"end": 507,
"score": 0.9996739625930786,
"start": 502,
"tag": "USERNAME",
"value": "gupta"
},
{
"context": "omer.setCustomerId(\"1\");\n\t\tcustomer.setFi... | null | [] | package com.tpt.budgetbucket.customer.server.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tpt.budgetbucket.customer.server.Repository.CustomerRepo;
import com.tpt.budgetbucket.customer.server.Repository.CustomerRepository;
import com.tpt.budgetbucket.customer.server.domain.Address;
import com.tpt.budgetbucket.customer.server.domain.Customer;
/**
* Created by gupta on 23.06.2018.
*/
@Service
public class CustomerServiceImpl implements CustomerService {
@Autowired
CustomerRepository customerRepository;
@Override
public List<Customer> getCustomerByName(String customerId){
List<Customer> customers = new ArrayList<>();
customers.add(getDummyCustomer());
return customers;
}
private Customer getDummyCustomer() {
Customer customer = new Customer();
customer.setCustomerId("1");
customer.setFirstName("Tripti");
customer.setLastName("Gupta");
customer.setEmail("<EMAIL>");
customer.setPhone("123");
customer.setStatus("Starter");
Address address = new Address();
address.setCountry("India");
address.setCity("Delhi");
customer.setAddress(address);
return customer;
}
@Override
public CustomerRepo getCustomerById(String customerId){
if (customerId.equals("1") || customerId.equals("abc")){
throw new NullPointerException();
}
//return getDummyCustomer();
return customerRepository.getCustomer();
}
@Override
public String postCustomer(Customer customer) {
if (customer != null){
return "Success";
}
return "fail";
}
}
| 1,634 | 0.760658 | 0.752741 | 66 | 23.878788 | 21.730104 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.439394 | false | false | 9 |
d0b9c97dff9c50ccc28217a6419bcc7e3144dec6 | 17,858,474,058,270 | 46b96ed34c481bf21cee1b89f5c1ba2d46ea9632 | /src/main/java/com/leetcode/LongestPalindrome.java | 95302e1f5d0a829b5c74ec08571b7f61a8cc9c80 | [] | no_license | linkToHeart/LearningCode | https://github.com/linkToHeart/LearningCode | 1c6cbd3ae02b2e96b3fb8d66462f8dd00b260a4e | cbcf1a3feef397071e3098799eb73c9d33d5b5f0 | refs/heads/master | 2018-11-19T20:50:35.827000 | 2018-09-03T14:57:27 | 2018-09-03T14:57:27 | 119,248,376 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.leetcode;
import java.util.ArrayList;
import java.util.List;
/**
* 5. Longest Palindromic Substring
* 思路:两个指针,第一个指针指向第j个,第二个指针指向第j+1个,判断第j+1个字符是否等于第i个字符,
* 不管相不相等都要先存在List<Character>里面,但是如果遍历到相等的字符,则需要更新length长度和findEqual
* 是否有【相等字符标志位】,如果检查【相等字符标志位】是true,并且长度超过之前的存的长度,则更新长度temp和字符refult
*/
public class LongestPalindrome {
public static void main(String[] args) {
System.out.println(longestPalindrome("babad"));
}
public static String longestPalindrome(String s) {
int len = s.length();
int temp = 0;
String result = "";
if(s.length() == 1){
return s;
}
for (int j=0; j<len-1; j++){
boolean findEqual = false;
List<Character> chaList = new ArrayList<Character>();
chaList.add(s.charAt(j));
int length = 0;
for(int i=j+1; i<len; i++){
chaList.add(s.charAt(i));
if (chaList.get(0) == s.charAt(i)){
findEqual = true;
length = chaList.size();
}
}
if (findEqual && length > temp){
temp = length;
StringBuffer str = new StringBuffer();
for (Character cha: chaList){
str.append(cha);
}
result = str.toString().substring(0, temp);
}
}
return result;
}
}
| UTF-8 | Java | 1,713 | java | LongestPalindrome.java | Java | [] | null | [] | package com.leetcode;
import java.util.ArrayList;
import java.util.List;
/**
* 5. Longest Palindromic Substring
* 思路:两个指针,第一个指针指向第j个,第二个指针指向第j+1个,判断第j+1个字符是否等于第i个字符,
* 不管相不相等都要先存在List<Character>里面,但是如果遍历到相等的字符,则需要更新length长度和findEqual
* 是否有【相等字符标志位】,如果检查【相等字符标志位】是true,并且长度超过之前的存的长度,则更新长度temp和字符refult
*/
public class LongestPalindrome {
public static void main(String[] args) {
System.out.println(longestPalindrome("babad"));
}
public static String longestPalindrome(String s) {
int len = s.length();
int temp = 0;
String result = "";
if(s.length() == 1){
return s;
}
for (int j=0; j<len-1; j++){
boolean findEqual = false;
List<Character> chaList = new ArrayList<Character>();
chaList.add(s.charAt(j));
int length = 0;
for(int i=j+1; i<len; i++){
chaList.add(s.charAt(i));
if (chaList.get(0) == s.charAt(i)){
findEqual = true;
length = chaList.size();
}
}
if (findEqual && length > temp){
temp = length;
StringBuffer str = new StringBuffer();
for (Character cha: chaList){
str.append(cha);
}
result = str.toString().substring(0, temp);
}
}
return result;
}
}
| 1,713 | 0.522992 | 0.515443 | 48 | 29.354166 | 19.628305 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520833 | false | false | 9 |
b4943de67dc783aa9af4bcf5fb36ebcaa85c08f4 | 21,526,376,147,216 | b4f1b2b57d7a9027e7f71c9264638de9c10ec57e | /app/src/main/java/com/praxello/tailorsmart/adapter/WishlistFabricAdapter.java | cab76365868bb216443206a750f851c6124a0cd5 | [] | no_license | rockstarsantosh1994/TailorSmart | https://github.com/rockstarsantosh1994/TailorSmart | 48b276d77a2b2297d34eeddcf194e7d7f170c7d7 | 605d44c5dcc2fa13693454b1c6788b1314d68f29 | refs/heads/master | 2023-03-08T19:37:30.944000 | 2021-02-22T06:46:47 | 2021-02-22T06:46:47 | 290,277,398 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.praxello.tailorsmart.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.recyclerview.widget.RecyclerView;
import com.praxello.tailorsmart.App;
import com.praxello.tailorsmart.FullScreenImageActivity;
import com.praxello.tailorsmart.GlideApp;
import com.praxello.tailorsmart.R;
import com.praxello.tailorsmart.WishListActivity;
import com.praxello.tailorsmart.WishListFabricListActivity;
import com.praxello.tailorsmart.model.Fabric;
import com.praxello.tailorsmart.utils.Utils;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
public class WishlistFabricAdapter extends RecyclerView.Adapter<WishlistFabricAdapter.RecyclerViewHolder> {
private Context mContext;
private ArrayList<Fabric> list;
App app;
private final String selectedCurrency;
private final String selectedCurrencyMultiplier;
public WishlistFabricAdapter(Context mContext, ArrayList<Fabric> list) {
this.mContext = mContext;
this.list = list;
app = (App) mContext.getApplicationContext();
selectedCurrency = app.getPreferences().getSelectedCurrency();
selectedCurrencyMultiplier = app.getPreferences().getSelectedCurrencyMultiplier();
for (int i = 0; i < list.size(); i++) {
double price = Double.parseDouble(list.get(i).getMappedFabricPrice()) * Double.parseDouble(selectedCurrencyMultiplier);
list.get(i).setFabricCalculatedPrice(String.valueOf(price));
}
}
@Override
public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_fabric, parent, false);
return new RecyclerViewHolder(view);
}
@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
Fabric obj = list.get(position);
holder.tvFabricName.setText(obj.getFabricTitle());
holder.tvDetails.setText(obj.getFabricDetails());
if (Double.parseDouble(obj.getFabricCalculatedPrice()) == 0) {
holder.tvPrice.setVisibility(View.GONE);
} else {
holder.tvPrice.setText(selectedCurrency + " " + Utils.format2Dec(Double.parseDouble(obj.getFabricCalculatedPrice())));
holder.tvPrice.setVisibility(View.VISIBLE);
}
holder.cbSelect.setVisibility(View.GONE);
holder.ivDelete.setVisibility(View.VISIBLE);
GlideApp.with(mContext).load("http://103.127.146.25/~tailors/Tailorsmart/mobileimages/fabric/"
+ obj.getSkuNo() + ".jpg").into(holder.ivFabric);
holder.ivFabric.setOnClickListener(view -> {
mContext.startActivity(new Intent(mContext, FullScreenImageActivity.class)
.putExtra("title", obj.getFabricTitle())
.putExtra("urlPhotoClick", "http://103.127.146.25/~tailors/Tailorsmart/mobileimages/fabric/"
+ obj.getSkuNo() + ".jpg"));
});
if (((WishListFabricListActivity) mContext).isShowDeleteBtn) {
holder.ivDelete.setVisibility(View.VISIBLE);
} else {
holder.ivDelete.setVisibility(View.GONE);
}
holder.ivDelete.setOnClickListener(view -> {
if (list.size() == 1) {
Utils.showDialog(mContext, "Product must have at least one frabric added", false, (dialog, which) -> dialog.dismiss());
return;
}
list.remove(list.get(holder.getAdapterPosition()));
notifyItemRemoved(holder.getAdapterPosition());
((WishListFabricListActivity) mContext).product.setFabricList(list);
app.getPreferences().updateWishlist(((WishListFabricListActivity) mContext).product);
((WishListFabricListActivity) mContext).toolbarTitle.setText("Fabrics(" + list.size() + ")");
if (WishListActivity.activity != null && !WishListActivity.activity.isFinishing()) {
WishListActivity.activity.loadWishlistData();
}
});
}
@Override
public int getItemCount() {
return list.size();
}
public ArrayList<Fabric> getList() {
return list;
}
class RecyclerViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.ivFabric)
ImageView ivFabric;
@BindView(R.id.tvFabricName)
TextView tvFabricName;
@BindView(R.id.tvDetails)
TextView tvDetails;
@BindView(R.id.tvPrice)
TextView tvPrice;
@BindView(R.id.cbSelect)
AppCompatCheckBox cbSelect;
@BindView(R.id.ivDelete)
ImageView ivDelete;
RecyclerViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
} | UTF-8 | Java | 5,037 | java | WishlistFabricAdapter.java | Java | [
{
"context": "LE);\n GlideApp.with(mContext).load(\"http://103.127.146.25/~tailors/Tailorsmart/mobileimages/fabric/\"\n ",
"end": 2742,
"score": 0.9857664704322815,
"start": 2728,
"tag": "IP_ADDRESS",
"value": "103.127.146.25"
},
{
"context": " .putExtra(\"u... | null | [] | package com.praxello.tailorsmart.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.recyclerview.widget.RecyclerView;
import com.praxello.tailorsmart.App;
import com.praxello.tailorsmart.FullScreenImageActivity;
import com.praxello.tailorsmart.GlideApp;
import com.praxello.tailorsmart.R;
import com.praxello.tailorsmart.WishListActivity;
import com.praxello.tailorsmart.WishListFabricListActivity;
import com.praxello.tailorsmart.model.Fabric;
import com.praxello.tailorsmart.utils.Utils;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
public class WishlistFabricAdapter extends RecyclerView.Adapter<WishlistFabricAdapter.RecyclerViewHolder> {
private Context mContext;
private ArrayList<Fabric> list;
App app;
private final String selectedCurrency;
private final String selectedCurrencyMultiplier;
public WishlistFabricAdapter(Context mContext, ArrayList<Fabric> list) {
this.mContext = mContext;
this.list = list;
app = (App) mContext.getApplicationContext();
selectedCurrency = app.getPreferences().getSelectedCurrency();
selectedCurrencyMultiplier = app.getPreferences().getSelectedCurrencyMultiplier();
for (int i = 0; i < list.size(); i++) {
double price = Double.parseDouble(list.get(i).getMappedFabricPrice()) * Double.parseDouble(selectedCurrencyMultiplier);
list.get(i).setFabricCalculatedPrice(String.valueOf(price));
}
}
@Override
public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_fabric, parent, false);
return new RecyclerViewHolder(view);
}
@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
Fabric obj = list.get(position);
holder.tvFabricName.setText(obj.getFabricTitle());
holder.tvDetails.setText(obj.getFabricDetails());
if (Double.parseDouble(obj.getFabricCalculatedPrice()) == 0) {
holder.tvPrice.setVisibility(View.GONE);
} else {
holder.tvPrice.setText(selectedCurrency + " " + Utils.format2Dec(Double.parseDouble(obj.getFabricCalculatedPrice())));
holder.tvPrice.setVisibility(View.VISIBLE);
}
holder.cbSelect.setVisibility(View.GONE);
holder.ivDelete.setVisibility(View.VISIBLE);
GlideApp.with(mContext).load("http://172.16.17.32/~tailors/Tailorsmart/mobileimages/fabric/"
+ obj.getSkuNo() + ".jpg").into(holder.ivFabric);
holder.ivFabric.setOnClickListener(view -> {
mContext.startActivity(new Intent(mContext, FullScreenImageActivity.class)
.putExtra("title", obj.getFabricTitle())
.putExtra("urlPhotoClick", "http://172.16.17.32/~tailors/Tailorsmart/mobileimages/fabric/"
+ obj.getSkuNo() + ".jpg"));
});
if (((WishListFabricListActivity) mContext).isShowDeleteBtn) {
holder.ivDelete.setVisibility(View.VISIBLE);
} else {
holder.ivDelete.setVisibility(View.GONE);
}
holder.ivDelete.setOnClickListener(view -> {
if (list.size() == 1) {
Utils.showDialog(mContext, "Product must have at least one frabric added", false, (dialog, which) -> dialog.dismiss());
return;
}
list.remove(list.get(holder.getAdapterPosition()));
notifyItemRemoved(holder.getAdapterPosition());
((WishListFabricListActivity) mContext).product.setFabricList(list);
app.getPreferences().updateWishlist(((WishListFabricListActivity) mContext).product);
((WishListFabricListActivity) mContext).toolbarTitle.setText("Fabrics(" + list.size() + ")");
if (WishListActivity.activity != null && !WishListActivity.activity.isFinishing()) {
WishListActivity.activity.loadWishlistData();
}
});
}
@Override
public int getItemCount() {
return list.size();
}
public ArrayList<Fabric> getList() {
return list;
}
class RecyclerViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.ivFabric)
ImageView ivFabric;
@BindView(R.id.tvFabricName)
TextView tvFabricName;
@BindView(R.id.tvDetails)
TextView tvDetails;
@BindView(R.id.tvPrice)
TextView tvPrice;
@BindView(R.id.cbSelect)
AppCompatCheckBox cbSelect;
@BindView(R.id.ivDelete)
ImageView ivDelete;
RecyclerViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
} | 5,033 | 0.678777 | 0.673615 | 123 | 39.959351 | 31.101826 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 13 |
d131a1dd15c9e2dbf1f61632e36e4e78e1857114 | 26,010,322,006,418 | 26e933a2bff20cc628ef4f88a9e5c11b8d272e2e | /src/main/groovy/org/ajoberstar/gradle/git/tasks/GitTag.java | 39fd52ed8d1ee5438bd5e061aa0581ab22930a0e | [
"Apache-2.0"
] | permissive | aadamovich/gradle-git | https://github.com/aadamovich/gradle-git | 2b5ab2e7064b20b7e81c5fab7a853b75f9d54381 | 24da0986f1ca6a297f32b6f5055eeb1f4d87850d | refs/heads/master | 2021-01-17T20:05:02.902000 | 2013-09-29T17:14:24 | 2013-09-29T17:14:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ajoberstar.gradle.git.tasks;
import groovy.lang.Closure;
import org.ajoberstar.gradle.util.ObjectUtil;
import org.eclipse.jgit.api.TagCommand;
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidTagNameException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.lib.PersonIdent;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import org.gradle.util.ConfigureUtil;
/**
* Task to tag a commit in a Git repository.
* @since 0.2.0
*/
public class GitTag extends GitBase {
private Object tagName = null;
private Object message = null;
private boolean sign = false;
private boolean force = false;
private PersonIdent tagger = null;
/**
* Tags the HEAD.
*/
@TaskAction
public void tag() {
TagCommand cmd = getGit().tag();
cmd.setName(getTagName());
cmd.setMessage(getMessage());
cmd.setSigned(getSign());
cmd.setForceUpdate(getForce());
if (tagger != null) {
cmd.setTagger(getTagger());
}
try {
cmd.call();
} catch (ConcurrentRefUpdateException e) {
throw new GradleException("Another process is accessing or updating the ref.", e);
} catch (InvalidTagNameException e) {
throw new GradleException("Invalid tag name: " + getTagName(), e);
} catch (NoHeadException e) {
throw new GradleException("Cannot tag without a HEAD revision.", e);
} catch (GitAPIException e) {
throw new GradleException("Problem with tag.", e);
}
}
/**
* Gets the tag message to use.
* @return the tag message to use
*/
@Input
@Optional
public String getMessage() {
return ObjectUtil.unpackString(message);
}
/**
* Sets the tag message to use.
* @param message the tag message
*/
public void setMessage(Object message) {
this.message = message;
}
/**
* Gets the tag name to use.
* @return the tag name to use
*/
@Input
public String getTagName() {
return ObjectUtil.unpackString(tagName);
}
/**
* Sets the tag name to use.
* @param tagName the tag name
*/
public void setTagName(Object tagName) {
this.tagName = tagName;
}
/**
* Gets whether or not the tag will be signed with
* the tagger's default key.
*
* This defaults to false.
* @return {@code true} if the tag will be signed,
* {@code false} otherwise
*/
@Input
public boolean getSign() {
return sign;
}
/**
* Sets whether or not the tag will be signed
* by the tagger's default key.
* @param sign {@code true} if the tag should
* be signed, {@code false} otherwise
*/
public void setSign(boolean sign) {
this.sign = sign;
}
/**
* Gets whether or not the tag will be created/updated even
* if a tag of that name already exists.
*
* This defaults to false.
* @return {@code true} if the tag will be forced,
* {@code false} otherwise
*/
@Input
public boolean getForce() {
return force;
}
/**
* Sets whether or not the tag will be created/updated
* even if a tag of that name already exists.
* @param force {@code true} if the tag will be forced,
* {@code false} otherwise
*/
public void setForce(boolean force) {
this.force = force;
}
/**
* Gets the tagger.
* @return the tagger
*/
@Input
@Optional
public PersonIdent getTagger() {
return tagger;
}
/**
* Sets the tagger.
* @param tagger the tagger
*/
public void setTagger(PersonIdent tagger) {
this.tagger = tagger;
}
/**
* Configures the tagger.
* A {@code PersonIdent} is passed to the closure.
* @param config the configuration closure
*/
@SuppressWarnings("rawtypes")
public void tagger(Closure config) {
if (tagger == null) {
this.tagger = new PersonIdent(getGit().getRepository());
}
ConfigureUtil.configure(config, tagger);
}
}
| UTF-8 | Java | 4,528 | java | GitTag.java | Java | [] | null | [] | /*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ajoberstar.gradle.git.tasks;
import groovy.lang.Closure;
import org.ajoberstar.gradle.util.ObjectUtil;
import org.eclipse.jgit.api.TagCommand;
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidTagNameException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.lib.PersonIdent;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import org.gradle.util.ConfigureUtil;
/**
* Task to tag a commit in a Git repository.
* @since 0.2.0
*/
public class GitTag extends GitBase {
private Object tagName = null;
private Object message = null;
private boolean sign = false;
private boolean force = false;
private PersonIdent tagger = null;
/**
* Tags the HEAD.
*/
@TaskAction
public void tag() {
TagCommand cmd = getGit().tag();
cmd.setName(getTagName());
cmd.setMessage(getMessage());
cmd.setSigned(getSign());
cmd.setForceUpdate(getForce());
if (tagger != null) {
cmd.setTagger(getTagger());
}
try {
cmd.call();
} catch (ConcurrentRefUpdateException e) {
throw new GradleException("Another process is accessing or updating the ref.", e);
} catch (InvalidTagNameException e) {
throw new GradleException("Invalid tag name: " + getTagName(), e);
} catch (NoHeadException e) {
throw new GradleException("Cannot tag without a HEAD revision.", e);
} catch (GitAPIException e) {
throw new GradleException("Problem with tag.", e);
}
}
/**
* Gets the tag message to use.
* @return the tag message to use
*/
@Input
@Optional
public String getMessage() {
return ObjectUtil.unpackString(message);
}
/**
* Sets the tag message to use.
* @param message the tag message
*/
public void setMessage(Object message) {
this.message = message;
}
/**
* Gets the tag name to use.
* @return the tag name to use
*/
@Input
public String getTagName() {
return ObjectUtil.unpackString(tagName);
}
/**
* Sets the tag name to use.
* @param tagName the tag name
*/
public void setTagName(Object tagName) {
this.tagName = tagName;
}
/**
* Gets whether or not the tag will be signed with
* the tagger's default key.
*
* This defaults to false.
* @return {@code true} if the tag will be signed,
* {@code false} otherwise
*/
@Input
public boolean getSign() {
return sign;
}
/**
* Sets whether or not the tag will be signed
* by the tagger's default key.
* @param sign {@code true} if the tag should
* be signed, {@code false} otherwise
*/
public void setSign(boolean sign) {
this.sign = sign;
}
/**
* Gets whether or not the tag will be created/updated even
* if a tag of that name already exists.
*
* This defaults to false.
* @return {@code true} if the tag will be forced,
* {@code false} otherwise
*/
@Input
public boolean getForce() {
return force;
}
/**
* Sets whether or not the tag will be created/updated
* even if a tag of that name already exists.
* @param force {@code true} if the tag will be forced,
* {@code false} otherwise
*/
public void setForce(boolean force) {
this.force = force;
}
/**
* Gets the tagger.
* @return the tagger
*/
@Input
@Optional
public PersonIdent getTagger() {
return tagger;
}
/**
* Sets the tagger.
* @param tagger the tagger
*/
public void setTagger(PersonIdent tagger) {
this.tagger = tagger;
}
/**
* Configures the tagger.
* A {@code PersonIdent} is passed to the closure.
* @param config the configuration closure
*/
@SuppressWarnings("rawtypes")
public void tagger(Closure config) {
if (tagger == null) {
this.tagger = new PersonIdent(getGit().getRepository());
}
ConfigureUtil.configure(config, tagger);
}
}
| 4,528 | 0.694125 | 0.690813 | 182 | 23.879122 | 20.628761 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 13 |
57034e1b71dfe1f71858f95f2db00a13af1d292e | 9,792,525,436,729 | 42bd9c612248f342c4a3dbdba1c3416e3f7aa290 | /src/main/java/com/file/meger/MergeRunnable.java | 10b0e5c6a8a07779f6ffdfbb6db8951a0f30646c | [] | no_license | yujimoyouran/filehandler | https://github.com/yujimoyouran/filehandler | 0bf06b8cc4d0bf632801f7326d2145cee9bb83dd | aed641bbbb0ca122d7dddd4f572c0c746f535b03 | refs/heads/master | 2016-09-13T10:13:22.531000 | 2016-05-05T15:42:53 | 2016-05-05T15:42:53 | 58,141,659 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.file.meger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
public class MergeRunnable implements Runnable {
long startPos;
String mergeFileName;
File partFile;
public MergeRunnable(long startPos, String mergeFileName, File partFile) {
this.startPos = startPos;
this.mergeFileName = mergeFileName;
this.partFile = partFile;
}
public void run() {
RandomAccessFile rFile;
try {
rFile = new RandomAccessFile(mergeFileName, "rw");
rFile.seek(startPos);
FileInputStream fs = new FileInputStream(partFile);
byte[] b = new byte[fs.available()];
fs.read(b);
fs.close();
rFile.write(b);
rFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 778 | java | MergeRunnable.java | Java | [] | null | [] | package com.file.meger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
public class MergeRunnable implements Runnable {
long startPos;
String mergeFileName;
File partFile;
public MergeRunnable(long startPos, String mergeFileName, File partFile) {
this.startPos = startPos;
this.mergeFileName = mergeFileName;
this.partFile = partFile;
}
public void run() {
RandomAccessFile rFile;
try {
rFile = new RandomAccessFile(mergeFileName, "rw");
rFile.seek(startPos);
FileInputStream fs = new FileInputStream(partFile);
byte[] b = new byte[fs.available()];
fs.read(b);
fs.close();
rFile.write(b);
rFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 778 | 0.715938 | 0.715938 | 34 | 21.882353 | 17.510946 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.117647 | false | false | 13 |
a68bf6ce5cd3053da7442b6700cf50797bf176df | 20,641,612,852,090 | 5b7b7ac935757f9ba4f4207decfce2c969c7721d | /Polestar/src/main/java/com/polestar/reports/ExtentReport.java | df0fdbae15953d8b1770be4b3a65a8584d694ba5 | [] | no_license | AbhijitBiradar/Polestar | https://github.com/AbhijitBiradar/Polestar | 163998d90c3419df77916b0be81d3ff2b2ed34e0 | 8ec2173be49d19213dff23ab99dd4d0ab3bb1bf3 | refs/heads/master | 2022-11-22T18:26:14.643000 | 2020-07-19T08:29:25 | 2020-07-19T08:29:25 | 254,250,250 | 0 | 0 | null | false | 2022-11-16T00:46:28 | 2020-04-09T02:20:28 | 2020-07-19T08:29:49 | 2022-11-16T00:46:26 | 132 | 0 | 0 | 7 | Java | false | false | /**
*
*/
package com.polestar.reports;
/**
* @author Sony
*
*/
public class ExtentReport {
}
| UTF-8 | Java | 101 | java | ExtentReport.java | Java | [
{
"context": "\n */\npackage com.polestar.reports;\n\n/**\n * @author Sony\n *\n */\npublic class ExtentReport {\n\n}\n",
"end": 62,
"score": 0.9972817897796631,
"start": 58,
"tag": "NAME",
"value": "Sony"
}
] | null | [] | /**
*
*/
package com.polestar.reports;
/**
* @author Sony
*
*/
public class ExtentReport {
}
| 101 | 0.574257 | 0.574257 | 12 | 7.416667 | 9.936954 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | false | false | 13 |
886afb1a65f1a6d1b70a394181a76910096a207e | 10,522,669,930,965 | 47ffbd5fca242bdb50e9c31bd618fe50fbdf8d2a | /src/main/java/com/tiy/ToDoTrackerController.java | b2e3662d2bbf7eaf260152d74dccc7af8ae2a64a | [] | no_license | TheAngelSilver/ToDoSpring | https://github.com/TheAngelSilver/ToDoSpring | a348c356a31846579186fd934997ccc1959d490d | 023f01059fc77464c17f4d5fe7790e14d8c4b885 | refs/heads/master | 2016-09-12T14:21:57.082000 | 2016-05-19T12:37:58 | 2016-05-19T12:37:58 | 59,122,092 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tiy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Silve on 5/17/2016.
*/
@Controller
public class ToDoTrackerController {
@Autowired
ToDoRepository todos;
@RequestMapping(path = "/", method = RequestMethod.GET)
public String home(Model model) {
Iterable<ToDo> allToDos = todos.findAll();
List<ToDo> toDoList = new ArrayList<ToDo>();
for (ToDo toDo : allToDos) {
toDoList.add(toDo);
}
model.addAttribute("todos", toDoList);
return "home";
}
@RequestMapping(path = "/add-todo", method = RequestMethod.POST)
public String addToDo(String todoName, boolean is_done) {
ToDo toDo = new ToDo(todoName, is_done);
todos.save(toDo); // saves to repo
return "redirect:/";
}
@RequestMapping(path = "/searchByName", method = RequestMethod.GET)
public String queryToDosByName(Model model, String search) {
System.out.println("Searching by ..." + search);
List<ToDo> toDoList = todos.findByNameStartsWith(search);
model.addAttribute("todos", toDoList);
return "home";
}
@RequestMapping(path = "/searchByBoolean", method = RequestMethod.GET)
public String queryToDosByBoolean(Model model, String search) {
System.out.println("Searching by ..." + search);
// List<ToDo> toDoList = todos.findByNameStartsWith(search);
List<ToDo> toDoList = todos.findByNameStartsWith(search);
model.addAttribute("todos", toDoList);
return "home";
}
@RequestMapping(path = "/delete", method = RequestMethod.GET)
public String deleteToDo(Model model, Integer toDoID) {
if (toDoID != null) {
todos.delete(toDoID);
}
return "redirect:/";
}
@RequestMapping(path = "/modify", method = RequestMethod.GET)
public String modify(Model model, Integer toDoID) {
if (toDoID != null) {
ToDo toDo = todos.findOne(toDoID);
toDo.is_done = ! toDo.is_done;
todos.save(toDo);
}
return "redirect:/";
}
}
| UTF-8 | Java | 2,402 | java | ToDoTrackerController.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Silve on 5/17/2016.\n */\n@Controller\npublic class ToDoTr",
"end": 369,
"score": 0.9930053949356079,
"start": 364,
"tag": "NAME",
"value": "Silve"
}
] | null | [] | package com.tiy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Silve on 5/17/2016.
*/
@Controller
public class ToDoTrackerController {
@Autowired
ToDoRepository todos;
@RequestMapping(path = "/", method = RequestMethod.GET)
public String home(Model model) {
Iterable<ToDo> allToDos = todos.findAll();
List<ToDo> toDoList = new ArrayList<ToDo>();
for (ToDo toDo : allToDos) {
toDoList.add(toDo);
}
model.addAttribute("todos", toDoList);
return "home";
}
@RequestMapping(path = "/add-todo", method = RequestMethod.POST)
public String addToDo(String todoName, boolean is_done) {
ToDo toDo = new ToDo(todoName, is_done);
todos.save(toDo); // saves to repo
return "redirect:/";
}
@RequestMapping(path = "/searchByName", method = RequestMethod.GET)
public String queryToDosByName(Model model, String search) {
System.out.println("Searching by ..." + search);
List<ToDo> toDoList = todos.findByNameStartsWith(search);
model.addAttribute("todos", toDoList);
return "home";
}
@RequestMapping(path = "/searchByBoolean", method = RequestMethod.GET)
public String queryToDosByBoolean(Model model, String search) {
System.out.println("Searching by ..." + search);
// List<ToDo> toDoList = todos.findByNameStartsWith(search);
List<ToDo> toDoList = todos.findByNameStartsWith(search);
model.addAttribute("todos", toDoList);
return "home";
}
@RequestMapping(path = "/delete", method = RequestMethod.GET)
public String deleteToDo(Model model, Integer toDoID) {
if (toDoID != null) {
todos.delete(toDoID);
}
return "redirect:/";
}
@RequestMapping(path = "/modify", method = RequestMethod.GET)
public String modify(Model model, Integer toDoID) {
if (toDoID != null) {
ToDo toDo = todos.findOne(toDoID);
toDo.is_done = ! toDo.is_done;
todos.save(toDo);
}
return "redirect:/";
}
}
| 2,402 | 0.646961 | 0.644047 | 75 | 31.026667 | 24.152832 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.626667 | false | false | 13 |
76ac7e303b53e12fd442e96e6cbf84f36db0e652 | 28,673,201,706,598 | 9f8342008d77213a6b35a5b2882aa850b9b2881a | /src/main/java/ServerModel.java | a8d04be612cbefcb511414afdbdddb6c513d3614 | [] | no_license | minoo-farsiabi/SecondProject | https://github.com/minoo-farsiabi/SecondProject | 1df2eb8d3abec4240aee60a91f62116f3860c4d4 | 2a56d4ba94cdb3bb0de5c879b477e1318f2e906a | refs/heads/master | 2021-01-17T22:12:09.566000 | 2016-06-01T06:03:55 | 2016-06-01T06:03:55 | 59,941,700 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.List;
/**
* Created by m.farsiabi on 5/28/2016.
*/
public class ServerModel {
private int clientPort;
private List<Deposit> deposits;
private String outLog;
public ServerModel(int clientPort, List<Deposit> deposits, String outLog) {
this.clientPort = clientPort;
this.deposits = deposits;
this.outLog = outLog;
}
public int getClientPort() {
return clientPort;
}
public Deposit getDepositById(String id) {
for (Deposit deposit : deposits) {
if (deposit.getId().equals(id)) {
return deposit;
}
}
return null;
}
public String getOutLog() {
return outLog;
}
public void saveOutLog(String line) {
System.err.println(line);
try {
RandomAccessFile outLogFile = new RandomAccessFile(ServerParser.serverModel.getOutLog(), "rw");
outLogFile.seek(outLogFile.length());
outLogFile.write(line.getBytes());
outLogFile.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,317 | java | ServerModel.java | Java | [
{
"context": "essFile;\nimport java.util.List;\n\n/**\n * Created by m.farsiabi on 5/28/2016.\n */\npublic class ServerModel {\n ",
"end": 151,
"score": 0.9884796142578125,
"start": 141,
"tag": "USERNAME",
"value": "m.farsiabi"
}
] | null | [] | import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.List;
/**
* Created by m.farsiabi on 5/28/2016.
*/
public class ServerModel {
private int clientPort;
private List<Deposit> deposits;
private String outLog;
public ServerModel(int clientPort, List<Deposit> deposits, String outLog) {
this.clientPort = clientPort;
this.deposits = deposits;
this.outLog = outLog;
}
public int getClientPort() {
return clientPort;
}
public Deposit getDepositById(String id) {
for (Deposit deposit : deposits) {
if (deposit.getId().equals(id)) {
return deposit;
}
}
return null;
}
public String getOutLog() {
return outLog;
}
public void saveOutLog(String line) {
System.err.println(line);
try {
RandomAccessFile outLogFile = new RandomAccessFile(ServerParser.serverModel.getOutLog(), "rw");
outLogFile.seek(outLogFile.length());
outLogFile.write(line.getBytes());
outLogFile.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 1,317 | 0.602126 | 0.596811 | 51 | 24.82353 | 20.867186 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 13 |
f2d8e8970d5542d02a1eb31df8d88c340440a4ad | 30,975,304,205,334 | ca6e3580e2fcf552d0e2835a7b451695d527c0e0 | /kodilla-rps/src/main/java/com/kodilla/rps/ConfigurationRPSSL.java | b53def703915a2f19fd20a175c8ab3bd75a3f0d9 | [] | no_license | RafalWKot/Rafal-Kot-kodilla-java | https://github.com/RafalWKot/Rafal-Kot-kodilla-java | c3e8e0077b62cbf568e464abff2e1184483f825e | 9caba89ef4788800ce9d0fb938106ff1b669fb37 | refs/heads/master | 2020-03-14T05:41:45.155000 | 2018-10-02T20:15:23 | 2018-10-02T20:15:23 | 131,469,680 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kodilla.rps;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ConfigurationRPSSL implements Configuration {
@Override
public List<Move> getPossibleMoves() {
List<Move> possibleMoves = new ArrayList<>();
possibleMoves.add(new Move("Kamień", Arrays.asList("Nożyce","Jaszczurka"), Arrays.asList("Papier","Spock")));
possibleMoves.add(new Move("Papier", Arrays.asList("Kamień","Spock"), Arrays.asList("Nożyce","Jaszczurka")));
possibleMoves.add(new Move("Nożyce", Arrays.asList("Papier","Jaszczurka"), Arrays.asList("Kamień","Spock")));
possibleMoves.add(new Move("Spock", Arrays.asList("Nożyce","Kamień"), Arrays.asList("Papier","Jaszczurka")));
possibleMoves.add(new Move("Jaszczurka", Arrays.asList("Papier","Spock"), Arrays.asList("Kamień","Nożyce")));
return possibleMoves;
}
@Override
public String getGameName() {
return "Papier - Kamień - Nożyce - Spock - Jaszczurka";
}
@Override
public String getDescription() {
return "Wybrałeś Papier - Kamień - Nożyce - Spock - Jaszczurka. \n" +
"Oto krótkie zasady. \n" +
"Gra składa się z kolejnych tur. W każdej turze ty i komputer wybieracie: papier, kamień, nożyce, spocka lub jaszczurkę \n" +
"Gracz, który wybrał silniejszy symbol, otrzymuje jeden punkt. \n" +
"W przypadku wybrania dwóch takich samych symboli następuje remis – punktu brak. \n" +
"Oto hierarchia symboli: \n" +
"nożyce są silniejsze od papieru, ponieważ go tną, \n" +
"kamień jest silniejszy od nożyc, ponieważ je tępi, \n" +
"papier jest silniejszy od kamienia, ponieważ go owija, \n" +
"kamień zgniata jaszczurkę, \n" +
"jaszczurka truje Spocka, \n" +
"Spock niszczy nożyce, \n" +
"nożyce dekapitują jaszczurkę, \n" +
"jaszczurka zjada papier, \n" +
"papier obala Spocka, \n" +
"Spock dezintegruje kamień. \n" +
"Gracz, który pierwszy uzyska umówioną wcześniej ilość punktów, wygrywa partię. \n" +
"No to zaczynamy! Powodzenia! \n";
}
}
| UTF-8 | Java | 2,347 | java | ConfigurationRPSSL.java | Java | [
{
"context": "aż go owija, \\n\" +\n \"kamień zgniata jaszczurkę, \\n\" +\n \"jaszczurka truje Spocka,",
"end": 1836,
"score": 0.8549525737762451,
"start": 1827,
"tag": "NAME",
"value": "jaszczurk"
},
{
"context": "kamień zgniata jaszczurkę, \\n\" +\n ... | null | [] | package com.kodilla.rps;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ConfigurationRPSSL implements Configuration {
@Override
public List<Move> getPossibleMoves() {
List<Move> possibleMoves = new ArrayList<>();
possibleMoves.add(new Move("Kamień", Arrays.asList("Nożyce","Jaszczurka"), Arrays.asList("Papier","Spock")));
possibleMoves.add(new Move("Papier", Arrays.asList("Kamień","Spock"), Arrays.asList("Nożyce","Jaszczurka")));
possibleMoves.add(new Move("Nożyce", Arrays.asList("Papier","Jaszczurka"), Arrays.asList("Kamień","Spock")));
possibleMoves.add(new Move("Spock", Arrays.asList("Nożyce","Kamień"), Arrays.asList("Papier","Jaszczurka")));
possibleMoves.add(new Move("Jaszczurka", Arrays.asList("Papier","Spock"), Arrays.asList("Kamień","Nożyce")));
return possibleMoves;
}
@Override
public String getGameName() {
return "Papier - Kamień - Nożyce - Spock - Jaszczurka";
}
@Override
public String getDescription() {
return "Wybrałeś Papier - Kamień - Nożyce - Spock - Jaszczurka. \n" +
"Oto krótkie zasady. \n" +
"Gra składa się z kolejnych tur. W każdej turze ty i komputer wybieracie: papier, kamień, nożyce, spocka lub jaszczurkę \n" +
"Gracz, który wybrał silniejszy symbol, otrzymuje jeden punkt. \n" +
"W przypadku wybrania dwóch takich samych symboli następuje remis – punktu brak. \n" +
"Oto hierarchia symboli: \n" +
"nożyce są silniejsze od papieru, ponieważ go tną, \n" +
"kamień jest silniejszy od nożyc, ponieważ je tępi, \n" +
"papier jest silniejszy od kamienia, ponieważ go owija, \n" +
"kamień zgniata jaszczurkę, \n" +
"jaszczurka truje Spocka, \n" +
"Spock niszczy nożyce, \n" +
"nożyce dekapitują jaszczurkę, \n" +
"jaszczurka zjada papier, \n" +
"papier obala Spocka, \n" +
"Spock dezintegruje kamień. \n" +
"Gracz, który pierwszy uzyska umówioną wcześniej ilość punktów, wygrywa partię. \n" +
"No to zaczynamy! Powodzenia! \n";
}
}
| 2,347 | 0.612031 | 0.612031 | 45 | 49.977779 | 38.460651 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.155556 | false | false | 13 |
2ab0f1a2590820a8ef58b13454bf01fdfdb7188f | 11,708,080,868,214 | c58777d539d15251f675b979cce834280349e458 | /src/com/steazzalini/clangformatter/style/DefaultStyleSheetGenerator.java | 96fbfee445414e96f0d7a80bbc7073980a962160 | [
"Apache-2.0"
] | permissive | steazzalini/clang-formatter | https://github.com/steazzalini/clang-formatter | e7482e60e4d9e17a429886352f6618e797e71816 | 0a5bfba6daf189aa2be9c1c333c70fade283e637 | HEAD | 2016-08-05T23:27:15.339000 | 2015-01-25T14:31:18 | 2015-01-25T14:31:18 | 29,336,942 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* clang-formatter
*
* Copyright (C) 2015 Stefano Azzalini <steazzalini>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.steazzalini.clangformatter.style;
import com.steazzalini.clangformatter.commandline.CommandLineHelper;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.ArrayList;
public class DefaultStyleSheetGenerator implements StyleSheetGenerator {
protected CommandLineHelper commandLineHelper;
public DefaultStyleSheetGenerator(CommandLineHelper commandLineHelper) {
this.commandLineHelper = commandLineHelper;
}
@Override
public String generate(File clangFormatExecutable,
Style style) throws Exception {
if(Style.Empty == style) {
return "";
}
ArrayList<String> arguments = new ArrayList<String>();
arguments.add("-dump-config");
arguments.add("-style=" + style.toString());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
commandLineHelper.execute(
clangFormatExecutable.getAbsolutePath(),
arguments,
null,
outputStream,
null);
return outputStream.toString();
}
}
| UTF-8 | Java | 1,777 | java | DefaultStyleSheetGenerator.java | Java | [
{
"context": "/*\n * clang-formatter\n *\n * Copyright (C) 2015 Stefano Azzalini <steazzalini>\n *\n * Licensed under the Apache Lic",
"end": 63,
"score": 0.9998629689216614,
"start": 47,
"tag": "NAME",
"value": "Stefano Azzalini"
},
{
"context": "matter\n *\n * Copyright (C) 2015 St... | null | [] | /*
* clang-formatter
*
* Copyright (C) 2015 <NAME> <steazzalini>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.steazzalini.clangformatter.style;
import com.steazzalini.clangformatter.commandline.CommandLineHelper;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.ArrayList;
public class DefaultStyleSheetGenerator implements StyleSheetGenerator {
protected CommandLineHelper commandLineHelper;
public DefaultStyleSheetGenerator(CommandLineHelper commandLineHelper) {
this.commandLineHelper = commandLineHelper;
}
@Override
public String generate(File clangFormatExecutable,
Style style) throws Exception {
if(Style.Empty == style) {
return "";
}
ArrayList<String> arguments = new ArrayList<String>();
arguments.add("-dump-config");
arguments.add("-style=" + style.toString());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
commandLineHelper.execute(
clangFormatExecutable.getAbsolutePath(),
arguments,
null,
outputStream,
null);
return outputStream.toString();
}
}
| 1,767 | 0.688801 | 0.684299 | 59 | 29.118645 | 26.619787 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.40678 | false | false | 13 |
5420d81351a85f822c68a6bb6a248ee85b82368b | 16,733,192,587,949 | 02fa0be0686dc633c342c48e2ff1ed0467a77eac | /src/test/java/com/itextpdf/tool/xml/examples/css/page_break/after/div/After_div01.java | bac9d8cb76a368ba03fddb90756ee502b43e03da | [] | no_license | sureone/xmlworker | https://github.com/sureone/xmlworker | 9ad045d81a625a19a379565527aa79ea3a403095 | f04c2ff6a3628bdd550d57493e767867d862fb5c | refs/heads/master | 2021-01-21T08:58:07.147000 | 2015-02-12T09:50:19 | 2015-02-12T09:50:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.itextpdf.tool.xml.examples.css.page_break.after.div;
import com.itextpdf.tool.xml.examples.SampleTest;
public class After_div01 extends SampleTest {
protected String getTestName() {
return "after_div01";
}
}
| UTF-8 | Java | 248 | java | After_div01.java | Java | [] | null | [] | package com.itextpdf.tool.xml.examples.css.page_break.after.div;
import com.itextpdf.tool.xml.examples.SampleTest;
public class After_div01 extends SampleTest {
protected String getTestName() {
return "after_div01";
}
}
| 248 | 0.705645 | 0.689516 | 9 | 25.555555 | 23.252771 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
ac582c2369b1c31a204a2bb9055cdbc4c0ee7bf5 | 17,867,063,968,734 | 883bbebd546b3f92be3f886e64f9e0e573e4a495 | /src/com/nonfamous/tang/web/admin/AdminPayAction.java | 15d7083a5e4028387ee236bb5960154c7b3a535d | [] | no_license | fred521/5iyaya | https://github.com/fred521/5iyaya | 0c73c6e0c51014b7c64b91243adfa619c8fb1f33 | bcce17f88dc1bbef763d902c239838fdf2c9826e | refs/heads/master | 2021-01-17T08:28:27.631000 | 2014-12-14T21:09:28 | 2014-12-14T21:09:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nonfamous.tang.web.admin;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import com.nonfamous.commom.form.DefaultFormFactory;
import com.nonfamous.commom.form.Form;
import com.nonfamous.commom.util.StringUtils;
import com.nonfamous.commom.util.web.RequestValueParse;
import com.nonfamous.commom.util.web.cookyjar.Cookyjar;
import com.nonfamous.tang.dao.query.TradePayQuery;
import com.nonfamous.tang.domain.result.PayResult;
import com.nonfamous.tang.domain.trade.TradePay;
import com.nonfamous.tang.service.home.TradePayService;
import com.nonfamous.tang.web.common.Constants;
/**
* <p>
* 后台支付管理
* </p>
*
* @author:daodao
* @version $Id: AdminPayAction.java,v 1.1 2008/07/11 00:47:07 fred Exp $
*/
public class AdminPayAction extends MultiActionController {
private DefaultFormFactory formFactory;
private TradePayService tradePayService;
/**
* 支付列表
*
* @param request
* @param response
* @param query
* @return
* @throws Exception
*/
public ModelAndView pay_list(HttpServletRequest request,
HttpServletResponse response) throws Exception {
Form form = formFactory.getForm("searchPay", request);
request.setAttribute("form", form);
ModelAndView mv = new ModelAndView("admin/adminTrade/tradePayList");
RequestValueParse rvp = new RequestValueParse(request);
// 当前页
String currentPage = rvp.getParameter("currentPage").getString();
TradePayQuery query = new TradePayQuery();
// 设置query的值
formFactory.formCopy(form, query);
if (StringUtils.isNotBlank(currentPage)) {
query.setCurrentPage(Integer.valueOf(currentPage));
}
query = tradePayService.queryTradePayList(query);
mv.addObject("search", query);
return mv;
}
/**
* 修改支付状态
*
* @param request
* @param response
* @return
* @throws Exception
*/
public ModelAndView do_pay_status(HttpServletRequest request,
HttpServletResponse response) throws Exception {
RequestValueParse rvp = new RequestValueParse(request);
Cookyjar cookyjar = rvp.getCookyjar();
String operator = cookyjar.get(Constants.AdminUserId_Cookie);
String payId = rvp.getParameter("payId").getString();
ModelAndView mv = new ModelAndView(
"forward:admin/admin_pay/pay_list.htm");
PayResult result = tradePayService.changePayStatus(new Long(payId),
TradePay.PAY_STATUS_SUCCESS, operator,"INNER","0");//内部调整
if (!result.isSuccess()) {
mv.addObject("errorMessage", result.getErrorMessage());
}
return mv;
}
/**
* 修改转账状态
*
* @param request
* @param response
* @return
* @throws Exception
*/
public ModelAndView do_trans_status(HttpServletRequest request,
HttpServletResponse response) throws Exception {
RequestValueParse rvp = new RequestValueParse(request);
Cookyjar cookyjar = rvp.getCookyjar();
String operator = cookyjar.get(Constants.AdminUserId_Cookie);
String payId = rvp.getParameter("payId").getString();
ModelAndView mv = new ModelAndView(
"forward:admin/admin_pay/pay_list.htm");
PayResult result = tradePayService.changeTransStatus(new Long(payId),
TradePay.TRANS_STATUS_SUCCESS, operator);
if (!result.isSuccess()) {
mv.addObject("errorMessage", result.getErrorMessage());
}
return mv;
}
public void setFormFactory(DefaultFormFactory formFactory) {
this.formFactory = formFactory;
}
public void setTradePayService(TradePayService tradePayService) {
this.tradePayService = tradePayService;
}
}
| GB18030 | Java | 3,659 | java | AdminPayAction.java | Java | [
{
"context": "nts;\n\n/**\n * <p>\n * 后台支付管理\n * </p>\n * \n * @author:daodao\n * @version $Id: AdminPayAction.java,v 1.1 2008/0",
"end": 821,
"score": 0.9984647631645203,
"start": 815,
"tag": "USERNAME",
"value": "daodao"
}
] | null | [] | package com.nonfamous.tang.web.admin;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import com.nonfamous.commom.form.DefaultFormFactory;
import com.nonfamous.commom.form.Form;
import com.nonfamous.commom.util.StringUtils;
import com.nonfamous.commom.util.web.RequestValueParse;
import com.nonfamous.commom.util.web.cookyjar.Cookyjar;
import com.nonfamous.tang.dao.query.TradePayQuery;
import com.nonfamous.tang.domain.result.PayResult;
import com.nonfamous.tang.domain.trade.TradePay;
import com.nonfamous.tang.service.home.TradePayService;
import com.nonfamous.tang.web.common.Constants;
/**
* <p>
* 后台支付管理
* </p>
*
* @author:daodao
* @version $Id: AdminPayAction.java,v 1.1 2008/07/11 00:47:07 fred Exp $
*/
public class AdminPayAction extends MultiActionController {
private DefaultFormFactory formFactory;
private TradePayService tradePayService;
/**
* 支付列表
*
* @param request
* @param response
* @param query
* @return
* @throws Exception
*/
public ModelAndView pay_list(HttpServletRequest request,
HttpServletResponse response) throws Exception {
Form form = formFactory.getForm("searchPay", request);
request.setAttribute("form", form);
ModelAndView mv = new ModelAndView("admin/adminTrade/tradePayList");
RequestValueParse rvp = new RequestValueParse(request);
// 当前页
String currentPage = rvp.getParameter("currentPage").getString();
TradePayQuery query = new TradePayQuery();
// 设置query的值
formFactory.formCopy(form, query);
if (StringUtils.isNotBlank(currentPage)) {
query.setCurrentPage(Integer.valueOf(currentPage));
}
query = tradePayService.queryTradePayList(query);
mv.addObject("search", query);
return mv;
}
/**
* 修改支付状态
*
* @param request
* @param response
* @return
* @throws Exception
*/
public ModelAndView do_pay_status(HttpServletRequest request,
HttpServletResponse response) throws Exception {
RequestValueParse rvp = new RequestValueParse(request);
Cookyjar cookyjar = rvp.getCookyjar();
String operator = cookyjar.get(Constants.AdminUserId_Cookie);
String payId = rvp.getParameter("payId").getString();
ModelAndView mv = new ModelAndView(
"forward:admin/admin_pay/pay_list.htm");
PayResult result = tradePayService.changePayStatus(new Long(payId),
TradePay.PAY_STATUS_SUCCESS, operator,"INNER","0");//内部调整
if (!result.isSuccess()) {
mv.addObject("errorMessage", result.getErrorMessage());
}
return mv;
}
/**
* 修改转账状态
*
* @param request
* @param response
* @return
* @throws Exception
*/
public ModelAndView do_trans_status(HttpServletRequest request,
HttpServletResponse response) throws Exception {
RequestValueParse rvp = new RequestValueParse(request);
Cookyjar cookyjar = rvp.getCookyjar();
String operator = cookyjar.get(Constants.AdminUserId_Cookie);
String payId = rvp.getParameter("payId").getString();
ModelAndView mv = new ModelAndView(
"forward:admin/admin_pay/pay_list.htm");
PayResult result = tradePayService.changeTransStatus(new Long(payId),
TradePay.TRANS_STATUS_SUCCESS, operator);
if (!result.isSuccess()) {
mv.addObject("errorMessage", result.getErrorMessage());
}
return mv;
}
public void setFormFactory(DefaultFormFactory formFactory) {
this.formFactory = formFactory;
}
public void setTradePayService(TradePayService tradePayService) {
this.tradePayService = tradePayService;
}
}
| 3,659 | 0.752574 | 0.747843 | 120 | 28.941668 | 23.968485 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.675 | false | false | 13 |
1c6c115c15ca1278f2c6a0f93810b92e1d3291b0 | 31,413,390,803,792 | 19e980cadeb5bb147d5ae4f1616668437b7aaff1 | /LAUSTooPrj/LAUSWeb/Source/gov/dol/bls/dfsms/laus/lausone/datainput/frontend/struts/UploadFileForm.java | 52011bb3eb9c79a959cdca7348fe64e1fcec7348 | [] | no_license | vjjy001/LausToo | https://github.com/vjjy001/LausToo | 7e5952189145fa286e3e44780f37cbf8478ab6a7 | 1bf42dc28534c9c633ffb29c6c22c21a194e0cac | refs/heads/master | 2016-09-06T12:53:50.751000 | 2015-03-06T19:55:13 | 2015-03-06T19:55:13 | 31,785,418 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gov.dol.bls.dfsms.laus.lausone.datainput.frontend.struts;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.upload.FormFile;
import gov.dol.bls.dfsms.laus.lausone.input.InputConstants;
import gov.dol.bls.dfsms.laus.lausone.input.InputRequestTO;
import gov.dol.bls.dfsms.laus.lausone.input.ao.InputAO;
import gov.dol.bls.dfsms.laus.lausone.input.bean.FileUploadDO;
/**
* gov.dol.bls.dfsms.laus.frontend.form.UploadFileForm.java Created on: Oct 7, 2011
* @author beshir_a DOL/BLS Copyright notice
* @version : $Id$ <br>
* Modified<br>
* Name Date Comments<br>
* -------------------------------------------------<br>
*/
public class UploadFileForm extends ActionForm
{
/**
*
*/
private static final long serialVersionUID = 1L;
/** upload property */
private FormFile oUploadFile;
/** pageID property */
private int oPageID;
private int oPerPage = FileUploadDO.DEFAULT_PAGE_SIZE;
private int[] oConfirm;
private boolean oConfirmSave;
private boolean oShowTitle;
private boolean oPrintAll;
private int oFilter;
private int oSort = FileUploadDO.SORT_TYPE_DEFAULT;
private int oError;
/**
* Method validate
* @param varMapping
* @param varRequest
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping varMapping, HttpServletRequest varRequest)
{
ActionErrors errors = null;
InputAO anAO = new InputAO();
InputRequestTO aRequestTO = UploadFileAction.getUploadRequestDO(this, varRequest);
if(aRequestTO == null || aRequestTO.getUSerID() == null)
{
oError = InputConstants.ERROR_INVALID_REQUEST;
return (new ActionErrors());
}
oError = anAO.allowFunctionality(aRequestTO);
if(oError != InputConstants.ERROR_OK)
{
errors = new ActionErrors();
if(oError == InputConstants.ERROR_FINALIZE_STATUS)
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.finalizationStatus"));
}
else if(oError == InputConstants.ERROR_VIEW_ONLY)
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.viewOnly"));
}
else if(oError == InputConstants.ERROR_DATABASE_ERROR)
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.databaseError"));
}
else
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.lbdatabaseError"));
}
return (errors);
}
if(oUploadFile == null || oUploadFile.getFileSize() <= 0)
{
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.required"));
}
else if(oUploadFile.getContentType().equals("text/plain") == false)
{
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.type"));
}
else if(oUploadFile.getFileName() != null)
{
if(aRequestTO == null || aRequestTO.getUSerID() == null || aRequestTO.getPeriod() == null)
varMapping.findForward(UploadFileAction.FORWARD_NAME_SYSTEM_ERROR);
String[] fileNameArr = oUploadFile.getFileName().split("[.]");
String ext = fileNameArr[fileNameArr.length - 1];
if(!"txt".equalsIgnoreCase(ext))
{
if(anAO.fileNameError(aRequestTO) == false)
{
varMapping.findForward(UploadFileAction.FORWARD_NAME_SYSTEM_ERROR);
}
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.type"));
}
else if(oUploadFile.getFileSize() <= 0)
{
if(anAO.emptyFileError(aRequestTO) == false)
{
varMapping.findForward(UploadFileAction.FORWARD_NAME_SYSTEM_ERROR);
}
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.empty"));
}
}
return (errors);
}
/**
* @return FormFile
*/
public FormFile getUploadFile()
{
return oUploadFile;
}
/**
* @param varUploadFile
*/
public void setUploadFile(FormFile varUploadFile)
{
oUploadFile = varUploadFile;
}
/**
* @return int
*/
public int getPerPage()
{
return oPerPage;
}
/**
* @param varPerPage
*/
public void setPerPage(int varPerPage)
{
oPerPage = varPerPage;
}
/**
* @return int
*/
public int getPageID()
{
return oPageID;
}
/**
* @param varPageID
*/
public void setPageID(int varPageID)
{
oPageID = varPageID;
}
/**
* @return int[]
*/
public int[] getConfirm()
{
return oConfirm;
}
/**
* @param confirm
*/
public void setConfirm(int[] confirm)
{
oConfirm = confirm;
}
/**
* @return boolean
*/
public boolean isConfirmSave()
{
return oConfirmSave;
}
/**
* @param varConfirmSave
*/
public void setConfirmSave(boolean varConfirmSave)
{
oConfirmSave = varConfirmSave;
}
/**
* @return int
*/
public int getFilter()
{
return oFilter;
}
/**
* @param varFilter
*/
public void setFilter(int varFilter)
{
oFilter = varFilter;
}
/**
* @return int
*/
public int getSort()
{
return oSort;
}
/**
* @param varSort
*/
public void setSort(int varSort)
{
oSort = varSort;
}
/**
* @return boolean
*/
public boolean isShowTitle()
{
return oShowTitle;
}
/**
* @param varShowTitle
*/
public void setShowTitle(boolean varShowTitle)
{
oShowTitle = varShowTitle;
}
/**
* @return boolean
*/
public boolean isPrintAll()
{
return oPrintAll;
}
/**
* @param varPrintAll
*/
public void setPrintAll(boolean varPrintAll)
{
oPrintAll = varPrintAll;
}
/**
* @return int
*/
public int getError()
{
return oError;
}
/**
* @param varError
*/
public void setError(int varError)
{
oError = varError;
}
public String toString()
{
return ("UploadFileForm:: File : " + oUploadFile + " PageID : " + oPageID + " ConfirmSaved : " + oConfirmSave + " Confirm : " + (oConfirm != null ? oConfirm.length : -1) + " PerPage : " + oPerPage + " Filter :"
+ oFilter + " Sort : " + oSort + " PrintAll : " + oPrintAll + " Error : " + oError);
}
} | UTF-8 | Java | 6,517 | java | UploadFileForm.java | Java | [
{
"context": "dFileForm.java Created on: Oct 7, 2011\r\n * @author beshir_a DOL/BLS Copyright notice\r\n * @version : $Id$ <br>",
"end": 705,
"score": 0.8737386465072632,
"start": 697,
"tag": "NAME",
"value": "beshir_a"
}
] | null | [] | package gov.dol.bls.dfsms.laus.lausone.datainput.frontend.struts;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.upload.FormFile;
import gov.dol.bls.dfsms.laus.lausone.input.InputConstants;
import gov.dol.bls.dfsms.laus.lausone.input.InputRequestTO;
import gov.dol.bls.dfsms.laus.lausone.input.ao.InputAO;
import gov.dol.bls.dfsms.laus.lausone.input.bean.FileUploadDO;
/**
* gov.dol.bls.dfsms.laus.frontend.form.UploadFileForm.java Created on: Oct 7, 2011
* @author beshir_a DOL/BLS Copyright notice
* @version : $Id$ <br>
* Modified<br>
* Name Date Comments<br>
* -------------------------------------------------<br>
*/
public class UploadFileForm extends ActionForm
{
/**
*
*/
private static final long serialVersionUID = 1L;
/** upload property */
private FormFile oUploadFile;
/** pageID property */
private int oPageID;
private int oPerPage = FileUploadDO.DEFAULT_PAGE_SIZE;
private int[] oConfirm;
private boolean oConfirmSave;
private boolean oShowTitle;
private boolean oPrintAll;
private int oFilter;
private int oSort = FileUploadDO.SORT_TYPE_DEFAULT;
private int oError;
/**
* Method validate
* @param varMapping
* @param varRequest
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping varMapping, HttpServletRequest varRequest)
{
ActionErrors errors = null;
InputAO anAO = new InputAO();
InputRequestTO aRequestTO = UploadFileAction.getUploadRequestDO(this, varRequest);
if(aRequestTO == null || aRequestTO.getUSerID() == null)
{
oError = InputConstants.ERROR_INVALID_REQUEST;
return (new ActionErrors());
}
oError = anAO.allowFunctionality(aRequestTO);
if(oError != InputConstants.ERROR_OK)
{
errors = new ActionErrors();
if(oError == InputConstants.ERROR_FINALIZE_STATUS)
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.finalizationStatus"));
}
else if(oError == InputConstants.ERROR_VIEW_ONLY)
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.viewOnly"));
}
else if(oError == InputConstants.ERROR_DATABASE_ERROR)
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.databaseError"));
}
else
{
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.lbdatabaseError"));
}
return (errors);
}
if(oUploadFile == null || oUploadFile.getFileSize() <= 0)
{
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.required"));
}
else if(oUploadFile.getContentType().equals("text/plain") == false)
{
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.type"));
}
else if(oUploadFile.getFileName() != null)
{
if(aRequestTO == null || aRequestTO.getUSerID() == null || aRequestTO.getPeriod() == null)
varMapping.findForward(UploadFileAction.FORWARD_NAME_SYSTEM_ERROR);
String[] fileNameArr = oUploadFile.getFileName().split("[.]");
String ext = fileNameArr[fileNameArr.length - 1];
if(!"txt".equalsIgnoreCase(ext))
{
if(anAO.fileNameError(aRequestTO) == false)
{
varMapping.findForward(UploadFileAction.FORWARD_NAME_SYSTEM_ERROR);
}
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.type"));
}
else if(oUploadFile.getFileSize() <= 0)
{
if(anAO.emptyFileError(aRequestTO) == false)
{
varMapping.findForward(UploadFileAction.FORWARD_NAME_SYSTEM_ERROR);
}
errors = new ActionErrors();
errors.add("uploadFile", new ActionMessage("uploadFile.error.uploadFile.empty"));
}
}
return (errors);
}
/**
* @return FormFile
*/
public FormFile getUploadFile()
{
return oUploadFile;
}
/**
* @param varUploadFile
*/
public void setUploadFile(FormFile varUploadFile)
{
oUploadFile = varUploadFile;
}
/**
* @return int
*/
public int getPerPage()
{
return oPerPage;
}
/**
* @param varPerPage
*/
public void setPerPage(int varPerPage)
{
oPerPage = varPerPage;
}
/**
* @return int
*/
public int getPageID()
{
return oPageID;
}
/**
* @param varPageID
*/
public void setPageID(int varPageID)
{
oPageID = varPageID;
}
/**
* @return int[]
*/
public int[] getConfirm()
{
return oConfirm;
}
/**
* @param confirm
*/
public void setConfirm(int[] confirm)
{
oConfirm = confirm;
}
/**
* @return boolean
*/
public boolean isConfirmSave()
{
return oConfirmSave;
}
/**
* @param varConfirmSave
*/
public void setConfirmSave(boolean varConfirmSave)
{
oConfirmSave = varConfirmSave;
}
/**
* @return int
*/
public int getFilter()
{
return oFilter;
}
/**
* @param varFilter
*/
public void setFilter(int varFilter)
{
oFilter = varFilter;
}
/**
* @return int
*/
public int getSort()
{
return oSort;
}
/**
* @param varSort
*/
public void setSort(int varSort)
{
oSort = varSort;
}
/**
* @return boolean
*/
public boolean isShowTitle()
{
return oShowTitle;
}
/**
* @param varShowTitle
*/
public void setShowTitle(boolean varShowTitle)
{
oShowTitle = varShowTitle;
}
/**
* @return boolean
*/
public boolean isPrintAll()
{
return oPrintAll;
}
/**
* @param varPrintAll
*/
public void setPrintAll(boolean varPrintAll)
{
oPrintAll = varPrintAll;
}
/**
* @return int
*/
public int getError()
{
return oError;
}
/**
* @param varError
*/
public void setError(int varError)
{
oError = varError;
}
public String toString()
{
return ("UploadFileForm:: File : " + oUploadFile + " PageID : " + oPageID + " ConfirmSaved : " + oConfirmSave + " Confirm : " + (oConfirm != null ? oConfirm.length : -1) + " PerPage : " + oPerPage + " Filter :"
+ oFilter + " Sort : " + oSort + " PrintAll : " + oPrintAll + " Error : " + oError);
}
} | 6,517 | 0.631579 | 0.630045 | 292 | 20.325342 | 26.040937 | 213 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.414384 | false | false | 13 |
95aa601c0e2884f212cf05b5aaa0323c818173f3 | 32,676,111,189,805 | e5d546a9574c9043cf8b5e160c1bd125faf5b827 | /sparrow-datatable/src/test/java/gov/usgs/cida/datatable/utils/AnalyzerTest.java | 343d796186374783cd60c42da5019aba022d33db | [] | no_license | USGS-CIDA/sparrow-dss | https://github.com/USGS-CIDA/sparrow-dss | acda318d1ef242b58ab52a590907c7d7542e8e75 | 68e71bc7e6de05c20ed003091672b1ec152fd5cd | refs/heads/master | 2020-05-21T22:15:35.447000 | 2017-02-03T19:38:16 | 2017-02-03T19:38:16 | 17,598,655 | 2 | 10 | null | false | 2017-05-25T13:23:47 | 2014-03-10T16:00:00 | 2016-11-15T03:18:09 | 2017-05-25T13:23:46 | 243,920 | 1 | 9 | 0 | Java | null | null | package gov.usgs.cida.datatable.utils;
import gov.usgs.cida.datatable.utils.DataFileDescriptor;
import gov.usgs.cida.datatable.utils.Analyzer;
import java.io.File;
import java.io.IOException;
import org.junit.Ignore;
import org.junit.Test;
@Ignore
public class AnalyzerTest {
// public void testAnalyze() throws IOException {
//// File file= new File(".");
//// System.out.println(file.getAbsolutePath());
// File file= new File("src/gov/usgswim/sparrow/test/loader/standardTestFile.txt");
// assertTrue(file.exists());
// DataFileDescriptor analysisResult = Analyzer.analyze(file);
// System.out.println(analysisResult);
// }
@Test
public void testAnalyzeSedimentFiles() throws IOException {
File baseDir = new File("C:\\Documents and Settings\\ilinkuo\\Desktop\\Decision_support_files_sediment\\sparrow_ds_sediment");
for (DataFileDescriptor analysis: Analyzer.analyzeDirectory(baseDir)) {
System.out.println(analysis);
}
}
/*
public void testInferTypes() {
fail("Not yet implemented");
}
public void testGatherStats() {
fail("Not yet implemented");
}
public void testInferType() {
fail("Not yet implemented");
}
public void testAnalyzeDelimiter() {
fail("Not yet implemented");
}
*/
}
| UTF-8 | Java | 1,283 | java | AnalyzerTest.java | Java | [] | null | [] | package gov.usgs.cida.datatable.utils;
import gov.usgs.cida.datatable.utils.DataFileDescriptor;
import gov.usgs.cida.datatable.utils.Analyzer;
import java.io.File;
import java.io.IOException;
import org.junit.Ignore;
import org.junit.Test;
@Ignore
public class AnalyzerTest {
// public void testAnalyze() throws IOException {
//// File file= new File(".");
//// System.out.println(file.getAbsolutePath());
// File file= new File("src/gov/usgswim/sparrow/test/loader/standardTestFile.txt");
// assertTrue(file.exists());
// DataFileDescriptor analysisResult = Analyzer.analyze(file);
// System.out.println(analysisResult);
// }
@Test
public void testAnalyzeSedimentFiles() throws IOException {
File baseDir = new File("C:\\Documents and Settings\\ilinkuo\\Desktop\\Decision_support_files_sediment\\sparrow_ds_sediment");
for (DataFileDescriptor analysis: Analyzer.analyzeDirectory(baseDir)) {
System.out.println(analysis);
}
}
/*
public void testInferTypes() {
fail("Not yet implemented");
}
public void testGatherStats() {
fail("Not yet implemented");
}
public void testInferType() {
fail("Not yet implemented");
}
public void testAnalyzeDelimiter() {
fail("Not yet implemented");
}
*/
}
| 1,283 | 0.70304 | 0.70304 | 48 | 24.729166 | 26.553986 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.270833 | false | false | 13 |
dbb73e6a24e1705a9d4d55066c050195745db9d3 | 16,097,537,443,162 | 72f2a006f8b4ead07679cd6a76d3a858fe436634 | /easy-mock-core/src/main/java/com/github/lzj960515/mock/util/MockUtil.java | 4ee7f99adb3cf9034cb5af6bb36600c44943056c | [
"Apache-2.0"
] | permissive | lzj960515/easy-mock | https://github.com/lzj960515/easy-mock | 4738dc3f57cd4ab186e5d4eb28cce410888e8cc4 | 7c0549cd08f94a5a6adb7b1bfe22b5156fa0ff54 | refs/heads/main | 2023-05-09T12:11:17.832000 | 2021-05-14T03:09:43 | 2021-05-14T03:09:43 | 367,224,189 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.lzj960515.mock.util;
import com.github.lzj960515.mock.annotation.Address;
import com.github.lzj960515.mock.annotation.Age;
import com.github.lzj960515.mock.annotation.Avatar;
import com.github.lzj960515.mock.annotation.Chinese;
import com.github.lzj960515.mock.annotation.Date;
import com.github.lzj960515.mock.annotation.DateTime;
import com.github.lzj960515.mock.annotation.Disease;
import com.github.lzj960515.mock.annotation.Entity;
import com.github.lzj960515.mock.annotation.Gender;
import com.github.lzj960515.mock.annotation.Hospital;
import com.github.lzj960515.mock.annotation.IdNumber;
import com.github.lzj960515.mock.annotation.Medicine;
import com.github.lzj960515.mock.annotation.Name;
import com.github.lzj960515.mock.annotation.Number;
import com.github.lzj960515.mock.annotation.Phone;
import com.github.lzj960515.mock.annotation.Price;
import com.github.lzj960515.mock.annotation.Symptoms;
import com.github.lzj960515.mock.annotation.University;
import com.github.lzj960515.mock.core.AddressMock;
import com.github.lzj960515.mock.core.AgeMock;
import com.github.lzj960515.mock.core.AvatarMock;
import com.github.lzj960515.mock.core.DateMock;
import com.github.lzj960515.mock.core.DateTimeMock;
import com.github.lzj960515.mock.core.DefaultMock;
import com.github.lzj960515.mock.core.DiseaseMock;
import com.github.lzj960515.mock.core.GenderMock;
import com.github.lzj960515.mock.core.HospitalMock;
import com.github.lzj960515.mock.core.IdNumberMock;
import com.github.lzj960515.mock.core.MedicineMock;
import com.github.lzj960515.mock.core.Mock;
import com.github.lzj960515.mock.core.NameMock;
import com.github.lzj960515.mock.core.NumberMock;
import com.github.lzj960515.mock.core.PhoneMock;
import com.github.lzj960515.mock.core.PriceMock;
import com.github.lzj960515.mock.core.ChineseMock;
import com.github.lzj960515.mock.core.SymptomsMock;
import com.github.lzj960515.mock.core.UniversityMock;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ReflectionUtils;
import java.lang.annotation.Annotation;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* mock util
*
* @author Zijian Liao
* @since 0.0.1
*/
@Slf4j
public class MockUtil {
private static Map<String, Mock> MOCK_MAP = new HashMap<>();
private static DefaultMock DEFAULT_MOCK = new DefaultMock();
static {
MOCK_MAP.put(Name.class.getSimpleName(), new NameMock());
MOCK_MAP.put(Age.class.getSimpleName(), new AgeMock());
MOCK_MAP.put(Number.class.getSimpleName(), new NumberMock());
MOCK_MAP.put(Gender.class.getSimpleName(), new GenderMock());
MOCK_MAP.put(Address.class.getSimpleName(), new AddressMock());
MOCK_MAP.put(Avatar.class.getSimpleName(), new AvatarMock());
MOCK_MAP.put(Date.class.getSimpleName(), new DateMock());
MOCK_MAP.put(DateTime.class.getSimpleName(), new DateTimeMock());
MOCK_MAP.put(Disease.class.getSimpleName(), new DiseaseMock());
MOCK_MAP.put(Hospital.class.getSimpleName(), new HospitalMock());
MOCK_MAP.put(IdNumber.class.getSimpleName(), new IdNumberMock());
MOCK_MAP.put(Medicine.class.getSimpleName(), new MedicineMock());
MOCK_MAP.put(Phone.class.getSimpleName(), new PhoneMock());
MOCK_MAP.put(Price.class.getSimpleName(), new PriceMock());
MOCK_MAP.put(Symptoms.class.getSimpleName(), new SymptomsMock());
MOCK_MAP.put(University.class.getSimpleName(), new UniversityMock());
MOCK_MAP.put(Chinese.class.getSimpleName(), new ChineseMock());
}
private static Random random = new Random();
public static <T> T mock(Class<T> clazz){
return doMock(clazz);
}
public static <T> T doMock(Class<T> clazz){
T obj;
try {
obj = clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e);
}
ReflectionUtils.doWithFields(clazz, field -> {
if (Modifier.isStatic(field.getModifiers())) {
return;
}
field.setAccessible(true);
Type genericType = field.getGenericType();
Class<?> type = field.getType();
// 判断是否为简单类型
if(!BeanUtils.isSimpleProperty(type)){
if (Collection.class.isAssignableFrom(type)) {
int size = random.nextInt(10);
Collection<Object> result;
if (List.class.isAssignableFrom(type)) {
result = new ArrayList<>(size);
} else {
result = new HashSet<>(size);
}
Type actualType = ((ParameterizedType) genericType).getActualTypeArguments()[0];
for (int index = 0; index < size; index++) {
result.add(doMock((Class<T>) actualType));
}
field.set(obj, result);
return;
}
}
Annotation[] annotations = field.getDeclaredAnnotations();
for (Annotation annotation : annotations) {
if(annotation instanceof Entity){
field.set(obj, doMock(field.getType()));
return;
}
Mock mock = MOCK_MAP.get(annotation.annotationType().getSimpleName());
if(mock != null){
Object mockData = mock.getMockData(annotation);
try{
field.set(obj, mockData);
}catch (IllegalArgumentException e){
// 尝试转成String设置,依旧不行则不再处理异常
field.set(obj, String.valueOf(mockData));
}
return;
}
}
field.set(obj, DEFAULT_MOCK.getMockData(null));
});
return obj;
}
}
| UTF-8 | Java | 6,332 | java | MockUtil.java | Java | [
{
"context": "package com.github.lzj960515.mock.util;\n\nimport com.github.lzj960515.moc",
"end": 22,
"score": 0.5613384246826172,
"start": 21,
"tag": "USERNAME",
"value": "j"
},
{
"context": "om.github.lzj960515.mock.util;\n\nimport com.github.lzj960515.mock.annotation.Address;\nimp... | null | [] | package com.github.lzj960515.mock.util;
import com.github.lzj960515.mock.annotation.Address;
import com.github.lzj960515.mock.annotation.Age;
import com.github.lzj960515.mock.annotation.Avatar;
import com.github.lzj960515.mock.annotation.Chinese;
import com.github.lzj960515.mock.annotation.Date;
import com.github.lzj960515.mock.annotation.DateTime;
import com.github.lzj960515.mock.annotation.Disease;
import com.github.lzj960515.mock.annotation.Entity;
import com.github.lzj960515.mock.annotation.Gender;
import com.github.lzj960515.mock.annotation.Hospital;
import com.github.lzj960515.mock.annotation.IdNumber;
import com.github.lzj960515.mock.annotation.Medicine;
import com.github.lzj960515.mock.annotation.Name;
import com.github.lzj960515.mock.annotation.Number;
import com.github.lzj960515.mock.annotation.Phone;
import com.github.lzj960515.mock.annotation.Price;
import com.github.lzj960515.mock.annotation.Symptoms;
import com.github.lzj960515.mock.annotation.University;
import com.github.lzj960515.mock.core.AddressMock;
import com.github.lzj960515.mock.core.AgeMock;
import com.github.lzj960515.mock.core.AvatarMock;
import com.github.lzj960515.mock.core.DateMock;
import com.github.lzj960515.mock.core.DateTimeMock;
import com.github.lzj960515.mock.core.DefaultMock;
import com.github.lzj960515.mock.core.DiseaseMock;
import com.github.lzj960515.mock.core.GenderMock;
import com.github.lzj960515.mock.core.HospitalMock;
import com.github.lzj960515.mock.core.IdNumberMock;
import com.github.lzj960515.mock.core.MedicineMock;
import com.github.lzj960515.mock.core.Mock;
import com.github.lzj960515.mock.core.NameMock;
import com.github.lzj960515.mock.core.NumberMock;
import com.github.lzj960515.mock.core.PhoneMock;
import com.github.lzj960515.mock.core.PriceMock;
import com.github.lzj960515.mock.core.ChineseMock;
import com.github.lzj960515.mock.core.SymptomsMock;
import com.github.lzj960515.mock.core.UniversityMock;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ReflectionUtils;
import java.lang.annotation.Annotation;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* mock util
*
* @author <NAME>
* @since 0.0.1
*/
@Slf4j
public class MockUtil {
private static Map<String, Mock> MOCK_MAP = new HashMap<>();
private static DefaultMock DEFAULT_MOCK = new DefaultMock();
static {
MOCK_MAP.put(Name.class.getSimpleName(), new NameMock());
MOCK_MAP.put(Age.class.getSimpleName(), new AgeMock());
MOCK_MAP.put(Number.class.getSimpleName(), new NumberMock());
MOCK_MAP.put(Gender.class.getSimpleName(), new GenderMock());
MOCK_MAP.put(Address.class.getSimpleName(), new AddressMock());
MOCK_MAP.put(Avatar.class.getSimpleName(), new AvatarMock());
MOCK_MAP.put(Date.class.getSimpleName(), new DateMock());
MOCK_MAP.put(DateTime.class.getSimpleName(), new DateTimeMock());
MOCK_MAP.put(Disease.class.getSimpleName(), new DiseaseMock());
MOCK_MAP.put(Hospital.class.getSimpleName(), new HospitalMock());
MOCK_MAP.put(IdNumber.class.getSimpleName(), new IdNumberMock());
MOCK_MAP.put(Medicine.class.getSimpleName(), new MedicineMock());
MOCK_MAP.put(Phone.class.getSimpleName(), new PhoneMock());
MOCK_MAP.put(Price.class.getSimpleName(), new PriceMock());
MOCK_MAP.put(Symptoms.class.getSimpleName(), new SymptomsMock());
MOCK_MAP.put(University.class.getSimpleName(), new UniversityMock());
MOCK_MAP.put(Chinese.class.getSimpleName(), new ChineseMock());
}
private static Random random = new Random();
public static <T> T mock(Class<T> clazz){
return doMock(clazz);
}
public static <T> T doMock(Class<T> clazz){
T obj;
try {
obj = clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e);
}
ReflectionUtils.doWithFields(clazz, field -> {
if (Modifier.isStatic(field.getModifiers())) {
return;
}
field.setAccessible(true);
Type genericType = field.getGenericType();
Class<?> type = field.getType();
// 判断是否为简单类型
if(!BeanUtils.isSimpleProperty(type)){
if (Collection.class.isAssignableFrom(type)) {
int size = random.nextInt(10);
Collection<Object> result;
if (List.class.isAssignableFrom(type)) {
result = new ArrayList<>(size);
} else {
result = new HashSet<>(size);
}
Type actualType = ((ParameterizedType) genericType).getActualTypeArguments()[0];
for (int index = 0; index < size; index++) {
result.add(doMock((Class<T>) actualType));
}
field.set(obj, result);
return;
}
}
Annotation[] annotations = field.getDeclaredAnnotations();
for (Annotation annotation : annotations) {
if(annotation instanceof Entity){
field.set(obj, doMock(field.getType()));
return;
}
Mock mock = MOCK_MAP.get(annotation.annotationType().getSimpleName());
if(mock != null){
Object mockData = mock.getMockData(annotation);
try{
field.set(obj, mockData);
}catch (IllegalArgumentException e){
// 尝试转成String设置,依旧不行则不再处理异常
field.set(obj, String.valueOf(mockData));
}
return;
}
}
field.set(obj, DEFAULT_MOCK.getMockData(null));
});
return obj;
}
}
| 6,327 | 0.65626 | 0.61835 | 151 | 40.57616 | 22.448303 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.847682 | false | false | 13 |
2243ade0adb0e25fe81fad193b609551705033cf | 1,408,749,288,863 | 8048ac684432b1327dad865f0bbab7507b227025 | /src/FTPS/StockDB.java | a031c3a5d006ea4ced8128540b9dc69972af8899 | [] | no_license | CaptainGlac1er/swen262teamE | https://github.com/CaptainGlac1er/swen262teamE | f8c41d97ef31238cd0bec61a7f6c6cb33d14d545 | 040e4d2cd182cc046fb2c156f3d8a6926ff7b719 | refs/heads/master | 2022-07-07T05:32:13.599000 | 2016-04-11T20:49:15 | 2016-04-11T20:49:15 | 51,884,125 | 0 | 0 | null | false | 2020-03-11T03:59:29 | 2016-02-17T01:24:53 | 2017-03-28T19:28:13 | 2020-03-11T03:59:21 | 574 | 0 | 0 | 2 | Java | false | false | package FTPS;
import javax.swing.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
/**
* Created by Josh on 3/31/2016.
*/
public class StockDB implements Runnable
{
private ArrayList<StockChild> AllStocks = new ArrayList<>();
private static StockDB DBInstance;
private StockDB()
{
//method to load initial stock information
getAllStocks();
}
public static StockDB getInstance()
{
//if database has been created
if (DBInstance != null)
//return instance of database
return DBInstance;
//create database
DBInstance = new StockDB();
//return database
return DBInstance;
}
private void getAllStocks() {
StockChild tempStock;
//create string for file path to equities file
String filepath = null;
try {
filepath = (new File(FTPS.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath())).getParent() + "\\equities.csv";
} catch (URISyntaxException e) {
e.printStackTrace();
}
try
{
String currentLine;
//open reader
BufferedReader br = new BufferedReader(new FileReader(filepath));
//while file has more line
while ((currentLine = br.readLine()) != null)
{
//split lines into array
String[] info = currentLine.split("\"");
//create new stock and store in stock array
try
{
tempStock = new StockChild(info[3], info[1], info[7], Double.parseDouble(info[5]), 0);
AllStocks.add(tempStock);
}
catch (NumberFormatException ex)
{
System.out.println("Stock not created: " + info[3] + " " + ex );
}
}
}
catch (NumberFormatException | IOException e)
{
System.out.println("File read error: " + e);
}
}
public ArrayList<StockChild> getStocks()
{
//get current instance of stock database
return AllStocks;
}
@Override
public void run()
{
double updatedWorth;
String abbrList = null;
System.out.println("Running update thread");
try
{
//for all stocks
for ( StockChild child : AllStocks )
{
//if first stock
if (abbrList == null)
{
//set string to stock abbr
abbrList = child.getStockAbbr().trim();
}
else
{
//append to string of abbr
abbrList += "+" + child.getStockAbbr().trim();
}
}
URL yahoo = new URL("http://finance.yahoo.com/d/quotes.csv?s="+ abbrList + "&f=l1");
HttpURLConnection con = (HttpURLConnection) yahoo.openConnection();
// Set the HTTP Request type method to GET (Default: GET)
con.setRequestMethod("GET");
con.setConnectTimeout(100000);
con.setReadTimeout(100000);
// Created a BufferedReader to read the contents of the request.
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
//for all stocks
for ( StockChild child : AllStocks )
{
//read next line
inputLine = in.readLine();
//store new price
updatedWorth = parseInput(inputLine);
//if price existed and converted then store in stock
if (updatedWorth != 0)
child.setWorth(updatedWorth);
}
// MAKE SURE TO CLOSE YOUR CONNECTION!
in.close();
}
catch ( IOException ex)
{
System.out.println("Stock update thread error" + ex);
}
System.out.println("Update complete.");
}
public void start()
{
Thread stockT;
//print message to screen and begin running thread
System.out.println("*** Starting stock thread. ***");
stockT = new Thread( this, "StockDB Thread");
stockT.start();
}
private double parseInput(String inFullline)
{
double newWorth = 0;
try
{
//convert string to double and store
newWorth = Double.parseDouble(inFullline);
}
catch(NumberFormatException e)
{
System.out.println("Error converting new worth" + e);
}
return newWorth;
}
} | UTF-8 | Java | 5,079 | java | StockDB.java | Java | [
{
"context": "\nimport java.util.ArrayList;\r\n\r\n/**\r\n * Created by Josh on 3/31/2016.\r\n */\r\npublic class StockDB implemen",
"end": 208,
"score": 0.9976962804794312,
"start": 204,
"tag": "NAME",
"value": "Josh"
}
] | null | [] | package FTPS;
import javax.swing.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
/**
* Created by Josh on 3/31/2016.
*/
public class StockDB implements Runnable
{
private ArrayList<StockChild> AllStocks = new ArrayList<>();
private static StockDB DBInstance;
private StockDB()
{
//method to load initial stock information
getAllStocks();
}
public static StockDB getInstance()
{
//if database has been created
if (DBInstance != null)
//return instance of database
return DBInstance;
//create database
DBInstance = new StockDB();
//return database
return DBInstance;
}
private void getAllStocks() {
StockChild tempStock;
//create string for file path to equities file
String filepath = null;
try {
filepath = (new File(FTPS.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath())).getParent() + "\\equities.csv";
} catch (URISyntaxException e) {
e.printStackTrace();
}
try
{
String currentLine;
//open reader
BufferedReader br = new BufferedReader(new FileReader(filepath));
//while file has more line
while ((currentLine = br.readLine()) != null)
{
//split lines into array
String[] info = currentLine.split("\"");
//create new stock and store in stock array
try
{
tempStock = new StockChild(info[3], info[1], info[7], Double.parseDouble(info[5]), 0);
AllStocks.add(tempStock);
}
catch (NumberFormatException ex)
{
System.out.println("Stock not created: " + info[3] + " " + ex );
}
}
}
catch (NumberFormatException | IOException e)
{
System.out.println("File read error: " + e);
}
}
public ArrayList<StockChild> getStocks()
{
//get current instance of stock database
return AllStocks;
}
@Override
public void run()
{
double updatedWorth;
String abbrList = null;
System.out.println("Running update thread");
try
{
//for all stocks
for ( StockChild child : AllStocks )
{
//if first stock
if (abbrList == null)
{
//set string to stock abbr
abbrList = child.getStockAbbr().trim();
}
else
{
//append to string of abbr
abbrList += "+" + child.getStockAbbr().trim();
}
}
URL yahoo = new URL("http://finance.yahoo.com/d/quotes.csv?s="+ abbrList + "&f=l1");
HttpURLConnection con = (HttpURLConnection) yahoo.openConnection();
// Set the HTTP Request type method to GET (Default: GET)
con.setRequestMethod("GET");
con.setConnectTimeout(100000);
con.setReadTimeout(100000);
// Created a BufferedReader to read the contents of the request.
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
//for all stocks
for ( StockChild child : AllStocks )
{
//read next line
inputLine = in.readLine();
//store new price
updatedWorth = parseInput(inputLine);
//if price existed and converted then store in stock
if (updatedWorth != 0)
child.setWorth(updatedWorth);
}
// MAKE SURE TO CLOSE YOUR CONNECTION!
in.close();
}
catch ( IOException ex)
{
System.out.println("Stock update thread error" + ex);
}
System.out.println("Update complete.");
}
public void start()
{
Thread stockT;
//print message to screen and begin running thread
System.out.println("*** Starting stock thread. ***");
stockT = new Thread( this, "StockDB Thread");
stockT.start();
}
private double parseInput(String inFullline)
{
double newWorth = 0;
try
{
//convert string to double and store
newWorth = Double.parseDouble(inFullline);
}
catch(NumberFormatException e)
{
System.out.println("Error converting new worth" + e);
}
return newWorth;
}
} | 5,079 | 0.502264 | 0.496751 | 182 | 25.917582 | 24.49173 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.313187 | false | false | 13 |
d5c9a32dbf3898a9a6067aaa719f818101eecc44 | 9,431,748,216,415 | 8b725864868f1aab2b46817ec0190cb46629d34f | /ellipse.java | 27507feeb2162e3a3aa94d9a3c97b2b2de2bd462 | [] | no_license | rajshreeee/jogl-midpoint-algorithm | https://github.com/rajshreeee/jogl-midpoint-algorithm | ac1309e329e4a850e45fea6bd012d4e3b1e843ea | 34e370f88600cf69def06dad85332a98b9651adb | refs/heads/master | 2020-03-22T22:52:57.885000 | 2018-07-13T00:09:20 | 2018-07-13T00:09:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package rrassi2;
import java.awt.Frame;
import java.util.Scanner;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.glu.GLU;
/**
* @author rajshree--- to make home
*
*/
public class ellipse implements GLEventListener{
/**
* @param args
*/
int pntX1 = 70, pntY1=50, rx = 50 ,ry=50;
private GLU glu;
public static void main(String[] args) {
// TODO Auto-generated method stub
GLProfile glp = GLProfile.get(GLProfile.GL2);
GLCapabilities cap = new GLCapabilities(glp);
GLCanvas canvas = new GLCanvas(cap);
Frame frame = new Frame("Assignment1");
frame.setSize(1200, 800);
frame.add(canvas);
frame.setVisible(true);
ellipse l = new ellipse();
canvas.addGLEventListener(l);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}});
}
public void display(GLAutoDrawable drawable) {
// TODO Auto-generated method stub
GL2 gl = drawable.getGL().getGL2();
gl.glClear (GL2.GL_COLOR_BUFFER_BIT);
//gl.glColor3f (0.0f, 0.0f, 0.0f);
gl.glPointSize(1.0f);
midPointCircleAlgo(gl);
gl.glFlush ();
}
public void dispose(GLAutoDrawable arg0) {
// TODO Auto-generated method stub
}
public void init(GLAutoDrawable gld) {
// TODO Auto-generated method stub
GL2 gl = gld.getGL().getGL2();
glu = new GLU();
gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glPointSize(4.0f);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
void plot(GL2 gl,int x, int y)
{
gl.glBegin(GL2.GL_POINTS);
gl.glVertex2i(x+pntX1, y+pntY1);
gl.glEnd();
}
void midPointCircleAlgo(GL2 gl)
{
int x = 0;
int y = ry;
float decision = ry^2-rx^2*ry+((rx^2)/4);
plot(gl, x, y);
while(! ((2*(ry^2)*x )> (2*(rx^2)*y)))
{
if (decision < 0)
{
x++;
decision += (2*(ry^2)*x)+ry^2 ;
}
else
{
y--;
x++;
decision +=(2*(ry^2)*x)-(2*(ry^2)*y)+ry^2;
}
plot(gl,x, y);
plot(gl, -x, y);
plot (gl, x,-y);
plot (gl, -x, -y);
}
region2(gl, x,y, rx, ry);
}
private void region2(GL2 gl, int x, int y, int rx2, int ry2) {
// TODO Auto-generated method stub
double decision2 = (((ry*ry)*((x+0.5)*(x+0.5)))-((rx*rx)*(ry*ry))+((rx*rx)*((y-1)*(y-1))));//don't keep r^2, do r*r else bigrinxa
plot(gl, x, y);
while(y> 0)
{
if (decision2 > 0)
{
y--;
decision2 = decision2 -(2*(rx*rx)*y)+rx*rx ;
}
else
{
y--;
x++;
decision2 = decision2 + (2*(ry*ry)*x)-(2*(rx*rx)*y)+rx*rx;
}
plot(gl,x, y);
plot(gl, -x, y);
plot (gl, x,-y);
plot (gl, -x, -y);
}
}
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3,
int arg4) {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 3,289 | java | ellipse.java | Java | [
{
"context": "\nimport com.jogamp.opengl.glu.GLU;\n\n/**\n * @author rajshree--- to make home\n *\n */\npublic class ellipse imple",
"end": 486,
"score": 0.9995498657226562,
"start": 478,
"tag": "USERNAME",
"value": "rajshree"
}
] | null | [] | /**
*
*/
package rrassi2;
import java.awt.Frame;
import java.util.Scanner;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.glu.GLU;
/**
* @author rajshree--- to make home
*
*/
public class ellipse implements GLEventListener{
/**
* @param args
*/
int pntX1 = 70, pntY1=50, rx = 50 ,ry=50;
private GLU glu;
public static void main(String[] args) {
// TODO Auto-generated method stub
GLProfile glp = GLProfile.get(GLProfile.GL2);
GLCapabilities cap = new GLCapabilities(glp);
GLCanvas canvas = new GLCanvas(cap);
Frame frame = new Frame("Assignment1");
frame.setSize(1200, 800);
frame.add(canvas);
frame.setVisible(true);
ellipse l = new ellipse();
canvas.addGLEventListener(l);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}});
}
public void display(GLAutoDrawable drawable) {
// TODO Auto-generated method stub
GL2 gl = drawable.getGL().getGL2();
gl.glClear (GL2.GL_COLOR_BUFFER_BIT);
//gl.glColor3f (0.0f, 0.0f, 0.0f);
gl.glPointSize(1.0f);
midPointCircleAlgo(gl);
gl.glFlush ();
}
public void dispose(GLAutoDrawable arg0) {
// TODO Auto-generated method stub
}
public void init(GLAutoDrawable gld) {
// TODO Auto-generated method stub
GL2 gl = gld.getGL().getGL2();
glu = new GLU();
gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glPointSize(4.0f);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
void plot(GL2 gl,int x, int y)
{
gl.glBegin(GL2.GL_POINTS);
gl.glVertex2i(x+pntX1, y+pntY1);
gl.glEnd();
}
void midPointCircleAlgo(GL2 gl)
{
int x = 0;
int y = ry;
float decision = ry^2-rx^2*ry+((rx^2)/4);
plot(gl, x, y);
while(! ((2*(ry^2)*x )> (2*(rx^2)*y)))
{
if (decision < 0)
{
x++;
decision += (2*(ry^2)*x)+ry^2 ;
}
else
{
y--;
x++;
decision +=(2*(ry^2)*x)-(2*(ry^2)*y)+ry^2;
}
plot(gl,x, y);
plot(gl, -x, y);
plot (gl, x,-y);
plot (gl, -x, -y);
}
region2(gl, x,y, rx, ry);
}
private void region2(GL2 gl, int x, int y, int rx2, int ry2) {
// TODO Auto-generated method stub
double decision2 = (((ry*ry)*((x+0.5)*(x+0.5)))-((rx*rx)*(ry*ry))+((rx*rx)*((y-1)*(y-1))));//don't keep r^2, do r*r else bigrinxa
plot(gl, x, y);
while(y> 0)
{
if (decision2 > 0)
{
y--;
decision2 = decision2 -(2*(rx*rx)*y)+rx*rx ;
}
else
{
y--;
x++;
decision2 = decision2 + (2*(ry*ry)*x)-(2*(rx*rx)*y)+rx*rx;
}
plot(gl,x, y);
plot(gl, -x, y);
plot (gl, x,-y);
plot (gl, -x, -y);
}
}
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3,
int arg4) {
// TODO Auto-generated method stub
}
}
| 3,289 | 0.595318 | 0.558528 | 187 | 16.566845 | 18.871067 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.229947 | false | false | 13 |
26c27966277f44d29a48fce45a51080d82f7578e | 9,431,748,213,191 | 8ee5839738cfc7db9116cec458aee91496ea04d1 | /event_api/src/main/java/com/dots/event_api/service/UserService.java | ccec8570472c70f10089fb481494c33c179de475 | [] | no_license | KimMinJeong/event | https://github.com/KimMinJeong/event | faf4309a7e4a2a69e13e3e096d9a8fd3ffc8a8ec | 51236f6bde0021f40d94aa56a56dfd996977841f | refs/heads/master | 2023-04-04T07:10:51.359000 | 2021-04-05T07:06:42 | 2021-04-05T07:06:42 | 326,436,154 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dots.event_api.service;
import com.dots.event_api.dao.domain.TbUser;
import com.dots.event_api.dao.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public TbUser register(String userName, String phoneNo, String email, String seminarYn, String nowTime) {
TbUser user = new TbUser();
user.setUserName(userName);
user.setPhoneNo(phoneNo);
user.setEmail(email);
user.setSeminarYn(seminarYn);
user.setRegDt(nowTime);
user.setUpdDt(nowTime);
userRepository.save(user);
return user;
}
public List<TbUser> findAll() {
List<TbUser> users = new ArrayList<>();
userRepository.findAll().forEach(e -> users.add(e));
return users;
}
public Optional<TbUser> findByUserSn(Long userSn) {
Optional<TbUser> user = userRepository.findByUserSn(userSn);
return user;
}
public List<TbUser> findByUserNameAndPhoneNo(String userName, String phoneNo) {
List<TbUser> user = userRepository.findAllByUserNameAndPhoneNo(userName, phoneNo);
return user;
}
}
| UTF-8 | Java | 1,372 | java | UserService.java | Java | [
{
"context": "userRepository;\n\n public TbUser register(String userName, String phoneNo, String email, String seminarYn, ",
"end": 466,
"score": 0.5979241132736206,
"start": 458,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "ser user = new TbUser();\n user.setUse... | null | [] | package com.dots.event_api.service;
import com.dots.event_api.dao.domain.TbUser;
import com.dots.event_api.dao.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public TbUser register(String userName, String phoneNo, String email, String seminarYn, String nowTime) {
TbUser user = new TbUser();
user.setUserName(userName);
user.setPhoneNo(phoneNo);
user.setEmail(email);
user.setSeminarYn(seminarYn);
user.setRegDt(nowTime);
user.setUpdDt(nowTime);
userRepository.save(user);
return user;
}
public List<TbUser> findAll() {
List<TbUser> users = new ArrayList<>();
userRepository.findAll().forEach(e -> users.add(e));
return users;
}
public Optional<TbUser> findByUserSn(Long userSn) {
Optional<TbUser> user = userRepository.findByUserSn(userSn);
return user;
}
public List<TbUser> findByUserNameAndPhoneNo(String userName, String phoneNo) {
List<TbUser> user = userRepository.findAllByUserNameAndPhoneNo(userName, phoneNo);
return user;
}
}
| 1,372 | 0.695335 | 0.695335 | 50 | 26.440001 | 26.0823 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62 | false | false | 13 |
eb46f39f8aad43bc90aadb6cc40ed7ce5051bc99 | 22,780,506,588,300 | ef92512919d36a5c0e80e7c62568d0f92a84771e | /src/test/KmeansTest.java | d489f4c2de7a0e7965b8b93b72f3fec2c092bb54 | [] | no_license | alu0101038490/Kmeans | https://github.com/alu0101038490/Kmeans | 708b3f5c0f8831d72b93cf4093f42ce959e7bcfd | 9671d5b73052874a155056d2ca5b59c899f4856c | refs/heads/master | 2020-05-07T08:13:34.413000 | 2019-04-16T15:29:06 | 2019-04-16T15:29:06 | 180,316,347 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import kmeans.Kmeans;
class KmeansTest {
@Test
void test() throws IOException {
Kmeans kmeans = new Kmeans("src/kmeans/res/prob1.txt");
assertEquals(kmeans.getDimensiones(), 3);
assertEquals(kmeans.getNumeroPuntos(), 15);
}
}
| UTF-8 | Java | 372 | java | KmeansTest.java | Java | [] | null | [] | package test;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import kmeans.Kmeans;
class KmeansTest {
@Test
void test() throws IOException {
Kmeans kmeans = new Kmeans("src/kmeans/res/prob1.txt");
assertEquals(kmeans.getDimensiones(), 3);
assertEquals(kmeans.getNumeroPuntos(), 15);
}
}
| 372 | 0.733871 | 0.723118 | 21 | 16.714285 | 19.036663 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
3ac7b9c65f48e9e894e4ba22d5d2f2b7b8d4a422 | 16,338,055,595,419 | c868eb4a53bca53a2993d88a01886f7739c87d04 | /Practica2ChatRMI/src/main/java/es/ubu/lsi/server/ChatServer.java | 944d922a8a7557338b2180fdbc5b90db0effec63 | [] | no_license | asl0044/Practica2ChatRMI | https://github.com/asl0044/Practica2ChatRMI | a9af6397234b290bd144c84690e196b8a56daf7e | f1ef527d2373c109f89a89f57845da036440d364 | refs/heads/master | 2016-09-14T07:34:50.546000 | 2016-05-19T18:32:36 | 2016-05-19T18:32:36 | 58,145,365 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package es.ubu.lsi.server;
import java.rmi.Remote;
import java.rmi.RemoteException;
import es.ubu.lsi.client.ChatClient;
import es.ubu.lsi.common.ChatMessage;
/**
* Chat server.
*
* @author Raúl Marticorena
* @author Joaquin P. Seco
*
*/
public interface ChatServer extends Remote {
/**
* Registers a new client.
*
* @param client client
* @return client id
* @throws RemoteException remote error
*/
public abstract int checkIn(ChatClient client) throws RemoteException;
/**
* Unregisters a new client.
*
* @param client current client
* @throws RemoteException remote error
*/
public abstract void logout(ChatClient client) throws RemoteException;
/**
* Sends a private message to a user.
*
* @param tonickname string
* @param msg message
* @throws RemoteException remote error
*/
public abstract void privatemsg(String tonickname, ChatMessage msg) throws RemoteException;
/**
* Publishs a received message.
*
* @param msg message
* @throws RemoteException remote error
*/
public abstract void publish(ChatMessage msg) throws RemoteException;
/**
* Orders of shutdown server.
*
* @param client current client sending the message
* @throws RemoteException remote error
*/
public abstract void shutdown(ChatClient client) throws RemoteException;
} | UTF-8 | Java | 1,345 | java | ChatServer.java | Java | [
{
"context": "n.ChatMessage;\n\n/**\n * Chat server.\n * \n * @author Raúl Marticorena\n * @author Joaquin P. Seco\n *\n */\npublic interfac",
"end": 213,
"score": 0.9998803734779358,
"start": 197,
"tag": "NAME",
"value": "Raúl Marticorena"
},
{
"context": "server.\n * \n * @author R... | null | [] | package es.ubu.lsi.server;
import java.rmi.Remote;
import java.rmi.RemoteException;
import es.ubu.lsi.client.ChatClient;
import es.ubu.lsi.common.ChatMessage;
/**
* Chat server.
*
* @author <NAME>
* @author <NAME>
*
*/
public interface ChatServer extends Remote {
/**
* Registers a new client.
*
* @param client client
* @return client id
* @throws RemoteException remote error
*/
public abstract int checkIn(ChatClient client) throws RemoteException;
/**
* Unregisters a new client.
*
* @param client current client
* @throws RemoteException remote error
*/
public abstract void logout(ChatClient client) throws RemoteException;
/**
* Sends a private message to a user.
*
* @param tonickname string
* @param msg message
* @throws RemoteException remote error
*/
public abstract void privatemsg(String tonickname, ChatMessage msg) throws RemoteException;
/**
* Publishs a received message.
*
* @param msg message
* @throws RemoteException remote error
*/
public abstract void publish(ChatMessage msg) throws RemoteException;
/**
* Orders of shutdown server.
*
* @param client current client sending the message
* @throws RemoteException remote error
*/
public abstract void shutdown(ChatClient client) throws RemoteException;
} | 1,325 | 0.714286 | 0.714286 | 63 | 20.349207 | 22.134623 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.920635 | false | false | 13 |
e86574f914058798c81c76df4c58b26a5d05502c | 9,397,388,467,419 | fb5590cfaa589102c0a367447a040aa12cba30cc | /src/main/java/com/moemao/tgksz/base/icon/service/IconService.java | 8c571e6b1adee08056f78aa7e2ec604246cfc32f | [] | no_license | yanwuv4yue/TGKSZ_COMMON | https://github.com/yanwuv4yue/TGKSZ_COMMON | 1486e1da93ea5eb940810058e3c6c1e85343edd6 | 4487ebb698a4859f6a814b5fa8e6e059a6a0d5f3 | refs/heads/master | 2018-09-20T04:31:49.652000 | 2018-09-19T15:28:15 | 2018-09-19T15:28:15 | 134,806,632 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.moemao.tgksz.base.icon.service;
import com.moemao.tgksz.base.icon.entity.Icon;
import com.moemao.tgksz.base.icon.entity.IconReq;
import com.moemao.tgksz.common.entity.Layui;
import com.moemao.tgksz.common.entity.PageEvt;
import java.util.List;
public interface IconService
{
/**
* 查询图标列表
* @param iconReq
* @return
*/
Layui<Icon> queryIconLay(IconReq iconReq, PageEvt pageEvt);
/**
* 查询图标列表
* @param iconReq
* @return
*/
List<Icon> queryIconList(IconReq iconReq, PageEvt pageEvt);
/**
* 查询所有图标列表
* @return
*/
List<Icon> queryAllIconList();
/**
* 根据ID查询图标
* @param id
* @return
*/
Icon queryIconById(String id);
/**
* 新增图标
* @param icon
* @return
*/
int addIcon(Icon icon);
/**
* 修改图标
* @param icon
* @return
*/
int updateIcon(Icon icon);
/**
* 删除图标
* @param ids
* @return
*/
int delete(List<String> ids);
}
| UTF-8 | Java | 1,095 | java | IconService.java | Java | [] | null | [] | package com.moemao.tgksz.base.icon.service;
import com.moemao.tgksz.base.icon.entity.Icon;
import com.moemao.tgksz.base.icon.entity.IconReq;
import com.moemao.tgksz.common.entity.Layui;
import com.moemao.tgksz.common.entity.PageEvt;
import java.util.List;
public interface IconService
{
/**
* 查询图标列表
* @param iconReq
* @return
*/
Layui<Icon> queryIconLay(IconReq iconReq, PageEvt pageEvt);
/**
* 查询图标列表
* @param iconReq
* @return
*/
List<Icon> queryIconList(IconReq iconReq, PageEvt pageEvt);
/**
* 查询所有图标列表
* @return
*/
List<Icon> queryAllIconList();
/**
* 根据ID查询图标
* @param id
* @return
*/
Icon queryIconById(String id);
/**
* 新增图标
* @param icon
* @return
*/
int addIcon(Icon icon);
/**
* 修改图标
* @param icon
* @return
*/
int updateIcon(Icon icon);
/**
* 删除图标
* @param ids
* @return
*/
int delete(List<String> ids);
}
| 1,095 | 0.571148 | 0.571148 | 59 | 16.271187 | 15.579028 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.254237 | false | false | 13 |
67596ca8c3e804feb72b20973264a0ce3eb24d95 | 15,857,019,293,165 | 05846131b1cf3856cf05f0740f90a27a9f5d8791 | /src/test/ImagePanelTest.java | b39dfb5d0feb8d0df999ea0996e502f55ef6c8a4 | [] | no_license | xavier-maisse/Java_project_L3I | https://github.com/xavier-maisse/Java_project_L3I | 3aaa5af54a640a7bfb8e85492477a5d2051ea531 | 2510f7898861624d21b002417c8bbc006f79bfc4 | refs/heads/master | 2022-12-21T10:21:10.743000 | 2020-04-06T09:03:56 | 2020-04-06T09:03:56 | 210,834,208 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package test;
import static org.junit.jupiter.api.Assertions.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import org.junit.jupiter.api.Test;
import jeu.ImagePanel;
/**
* @author AbdRahim
*
*/
class ImagePanelTest {
/**
* Test method for {@link jeu.ImagePanel#ImagePanel(java.awt.Image)}.
*/
@Test
void testImagePanel() {
try {
JFrame frame = new JFrame("fondEcran");
BufferedImage myImage;
myImage = ImageIO.read(new File("src/jeu/images/bg.png"));
ImagePanel i = new ImagePanel(myImage);
System.out.println("Image bg.png récupérée avec succès");
} catch (IOException e1) {
System.out.println("Echec de la récupération de l'image bg.png");
}
}
}
| ISO-8859-1 | Java | 808 | java | ImagePanelTest.java | Java | [
{
"context": ".api.Test;\n\nimport jeu.ImagePanel;\n\n/**\n * @author AbdRahim\n *\n */\nclass ImagePanelTest {\n\n\t/**\n\t * Test meth",
"end": 306,
"score": 0.7438262104988098,
"start": 298,
"tag": "USERNAME",
"value": "AbdRahim"
}
] | null | [] | /**
*
*/
package test;
import static org.junit.jupiter.api.Assertions.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import org.junit.jupiter.api.Test;
import jeu.ImagePanel;
/**
* @author AbdRahim
*
*/
class ImagePanelTest {
/**
* Test method for {@link jeu.ImagePanel#ImagePanel(java.awt.Image)}.
*/
@Test
void testImagePanel() {
try {
JFrame frame = new JFrame("fondEcran");
BufferedImage myImage;
myImage = ImageIO.read(new File("src/jeu/images/bg.png"));
ImagePanel i = new ImagePanel(myImage);
System.out.println("Image bg.png récupérée avec succès");
} catch (IOException e1) {
System.out.println("Echec de la récupération de l'image bg.png");
}
}
}
| 808 | 0.698254 | 0.697007 | 41 | 18.560976 | 20.60671 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.097561 | false | false | 13 |
a9b0ae60275217e2b162a6255d4a0799dac8102a | 15,092,515,117,551 | 34a56351280d8c6f4989f60ca01c8c53fd18420a | /Camera/src/com/android/camera/ui/SettingSublistLayout.java | c411c06b387d7e6b6c96ed907d9d997171aa274c | [
"Apache-2.0"
] | permissive | 865394064/camera | https://github.com/865394064/camera | fb40b64157bcbbacc91b6713ad603a04172799af | 6f1be83158e27d00eeca3eaeee82a2e42d86c7a5 | refs/heads/master | 2020-07-08T14:56:03.159000 | 2019-08-27T08:23:32 | 2019-08-27T08:23:32 | 203,706,575 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.camera.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import com.android.camera.Log;
import com.android.camera.R;
import com.android.camera.SettingUtils;
import com.mediatek.camera.setting.preference.ListPreference;
//import com.mediatek.common.featureoption.FeatureOption;
// A popup window that shows one camera setting. The title is the name of the
// setting (ex: white-balance). The entries are the supported values (ex:
// daylight, incandescent, etc).
public class SettingSublistLayout extends RotateLayout implements AdapterView.OnItemClickListener {
private static final String TAG = "SettingSublistLayout";
private ListPreference mPreference;
private Listener mListener;
private MyAdapter mAdapter;
private LayoutInflater mInflater;
private ViewGroup mSettingList;
public interface Listener {
void onSettingChanged(boolean changed);
}
public SettingSublistLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mInflater = LayoutInflater.from(context);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSettingList = (ViewGroup) findViewById(R.id.settingList);
}
private class MyAdapter extends BaseAdapter {
private int mSelectedIndex;
public MyAdapter() {
}
@Override
public int getCount() {
return mPreference.getEntries().length;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.setting_sublist_item, null);
holder = new ViewHolder();
holder.mImageView = (ImageView) convertView.findViewById(R.id.image);
holder.mTextView = (TextView) convertView.findViewById(R.id.title);
holder.mRadioButton = (RadioButton) convertView.findViewById(R.id.radio);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
int iconId = mPreference.getIconId(position);
if (mPreference.getIconId(position) == ListPreference.UNKNOWN) {
holder.mImageView.setVisibility(View.GONE);
} else {
holder.mImageView.setVisibility(View.VISIBLE);
holder.mImageView.setImageResource(iconId);
}
holder.mTextView.setText(mPreference.getEntries()[position]);
holder.mRadioButton.setChecked(position == mSelectedIndex);
// SettingUtils.setEnabledState(convertView,
// mPreference.isEnabled(position));
return convertView;
}
public void setSelectedIndex(int index) {
mSelectedIndex = index;
}
public int getSelectedIndex() {
return mSelectedIndex;
}
}
private class ViewHolder {
ImageView mImageView;
TextView mTextView;
RadioButton mRadioButton;
}
public void initialize(ListPreference preference) {
mPreference = preference;
mAdapter = new MyAdapter();
((AbsListView) mSettingList).setAdapter(mAdapter);
((AbsListView) mSettingList).setOnItemClickListener(this);
reloadPreference();
}
// The value of the preference may have changed. Update the UI.
public void reloadPreference() {
String value = mPreference.getOverrideValue();
if (value == null) {
mPreference.reloadValue();
value = mPreference.getValue();
}
int index = mPreference.findIndexOfValue(value);
if (index != -1) {
mAdapter.setSelectedIndex(index);
((AbsListView) mSettingList).setSelection(index);
} else {
Log.e(TAG, "Invalid preference value.");
mPreference.print();
}
Log.i(TAG, "reloadPreference() mPreference=" + mPreference + ", index=" + index);
}
public void setSettingChangedListener(Listener listener) {
mListener = listener;// should be rechecked
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int index, long id) {
Log.d(TAG, "onItemClick(" + index + ", " + id + ") oldIndex=" + mAdapter.getSelectedIndex());
boolean realChanged = index != mAdapter.getSelectedIndex();
if (realChanged) {
mPreference.setValueIndex(index);
}
if (mListener != null) {
mListener.onSettingChanged(realChanged);
}
}
}
| UTF-8 | Java | 5,935 | java | SettingSublistLayout.java | Java | [] | null | [] | /*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.camera.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import com.android.camera.Log;
import com.android.camera.R;
import com.android.camera.SettingUtils;
import com.mediatek.camera.setting.preference.ListPreference;
//import com.mediatek.common.featureoption.FeatureOption;
// A popup window that shows one camera setting. The title is the name of the
// setting (ex: white-balance). The entries are the supported values (ex:
// daylight, incandescent, etc).
public class SettingSublistLayout extends RotateLayout implements AdapterView.OnItemClickListener {
private static final String TAG = "SettingSublistLayout";
private ListPreference mPreference;
private Listener mListener;
private MyAdapter mAdapter;
private LayoutInflater mInflater;
private ViewGroup mSettingList;
public interface Listener {
void onSettingChanged(boolean changed);
}
public SettingSublistLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mInflater = LayoutInflater.from(context);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSettingList = (ViewGroup) findViewById(R.id.settingList);
}
private class MyAdapter extends BaseAdapter {
private int mSelectedIndex;
public MyAdapter() {
}
@Override
public int getCount() {
return mPreference.getEntries().length;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.setting_sublist_item, null);
holder = new ViewHolder();
holder.mImageView = (ImageView) convertView.findViewById(R.id.image);
holder.mTextView = (TextView) convertView.findViewById(R.id.title);
holder.mRadioButton = (RadioButton) convertView.findViewById(R.id.radio);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
int iconId = mPreference.getIconId(position);
if (mPreference.getIconId(position) == ListPreference.UNKNOWN) {
holder.mImageView.setVisibility(View.GONE);
} else {
holder.mImageView.setVisibility(View.VISIBLE);
holder.mImageView.setImageResource(iconId);
}
holder.mTextView.setText(mPreference.getEntries()[position]);
holder.mRadioButton.setChecked(position == mSelectedIndex);
// SettingUtils.setEnabledState(convertView,
// mPreference.isEnabled(position));
return convertView;
}
public void setSelectedIndex(int index) {
mSelectedIndex = index;
}
public int getSelectedIndex() {
return mSelectedIndex;
}
}
private class ViewHolder {
ImageView mImageView;
TextView mTextView;
RadioButton mRadioButton;
}
public void initialize(ListPreference preference) {
mPreference = preference;
mAdapter = new MyAdapter();
((AbsListView) mSettingList).setAdapter(mAdapter);
((AbsListView) mSettingList).setOnItemClickListener(this);
reloadPreference();
}
// The value of the preference may have changed. Update the UI.
public void reloadPreference() {
String value = mPreference.getOverrideValue();
if (value == null) {
mPreference.reloadValue();
value = mPreference.getValue();
}
int index = mPreference.findIndexOfValue(value);
if (index != -1) {
mAdapter.setSelectedIndex(index);
((AbsListView) mSettingList).setSelection(index);
} else {
Log.e(TAG, "Invalid preference value.");
mPreference.print();
}
Log.i(TAG, "reloadPreference() mPreference=" + mPreference + ", index=" + index);
}
public void setSettingChangedListener(Listener listener) {
mListener = listener;// should be rechecked
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int index, long id) {
Log.d(TAG, "onItemClick(" + index + ", " + id + ") oldIndex=" + mAdapter.getSelectedIndex());
boolean realChanged = index != mAdapter.getSelectedIndex();
if (realChanged) {
mPreference.setValueIndex(index);
}
if (mListener != null) {
mListener.onSettingChanged(realChanged);
}
}
}
| 5,935 | 0.640944 | 0.639427 | 169 | 34.118343 | 24.946764 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.550296 | false | false | 13 |
da3c034ec6623e0874b829b674f3bcbd000acfc6 | 31,610,959,354,826 | ff55de432fb899289a6a486274d6052ca62e5e6b | /akado-driver-observe/src/main/java/fr/ird/akado/observe/ObserveDataBaseInspector.java | 9c6c9661d9353509ea78a8963977f9347100896c | [] | no_license | OB7-IRD/akado2 | https://github.com/OB7-IRD/akado2 | 5701fd3c8a39afbb442535b9dafbfb75c3025795 | 8cd7070c2df615bef9a39910ffafe8f405789b1d | refs/heads/main | 2023-05-27T13:03:20.207000 | 2023-05-24T14:08:20 | 2023-05-24T14:08:20 | 616,488,688 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2014 Observatoire thonier, IRD
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.ird.akado.observe;
import fr.ird.akado.core.DataBaseInspector;
import fr.ird.akado.core.Inspector;
import fr.ird.akado.core.common.AAProperties;
import fr.ird.akado.core.common.AkadoException;
import fr.ird.akado.core.selector.TemporalSelector;
import fr.ird.akado.core.spatial.GISHandler;
import fr.ird.akado.observe.inspector.activity.ObserveActivityInspector;
import fr.ird.akado.observe.inspector.activity.PositionInEEZInspector;
import fr.ird.akado.observe.inspector.activity.PositionInspector;
import fr.ird.akado.observe.inspector.anapo.ObserveAnapoActivityInspector;
import fr.ird.akado.observe.inspector.anapo.ObserveAnapoActivityListInspector;
import fr.ird.akado.observe.inspector.metatrip.ObserveTripListInspector;
import fr.ird.akado.observe.inspector.sample.ObserveSampleInspector;
import fr.ird.akado.observe.inspector.trip.ObserveTripInspector;
import fr.ird.akado.observe.inspector.well.ObserveWellInspector;
import fr.ird.akado.observe.result.InfoResult;
import fr.ird.akado.observe.result.ObserveMessage;
import fr.ird.akado.observe.result.Results;
import fr.ird.akado.observe.result.object.Resume;
import fr.ird.akado.observe.selector.FlagSelector;
import fr.ird.akado.observe.selector.VesselSelector;
import fr.ird.akado.observe.task.ActivityTask;
import fr.ird.akado.observe.task.AnapoTask;
import fr.ird.akado.observe.task.ObserveDataBaseInspectorTask;
import fr.ird.akado.observe.task.SampleTask;
import fr.ird.akado.observe.task.TripTask;
import fr.ird.akado.observe.task.WellTask;
import fr.ird.driver.anapo.common.exception.ANAPODriverException;
import fr.ird.driver.anapo.service.ANAPOService;
import fr.ird.driver.observe.business.ObserveVersion;
import fr.ird.driver.observe.business.data.ps.common.Trip;
import fr.ird.driver.observe.service.ObserveService;
import io.ultreia.java4all.util.Version;
import io.ultreia.java4all.util.sql.conf.JdbcConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import static fr.ird.akado.core.common.AAProperties.KEY_DATE_FORMAT_XLS;
import static fr.ird.akado.core.common.AAProperties.KEY_SHP_COUNTRIES_PATH;
import static fr.ird.akado.core.common.AAProperties.KEY_SHP_HARBOUR_PATH;
import static fr.ird.akado.core.common.AAProperties.KEY_SHP_OCEAN_PATH;
import static fr.ird.akado.core.common.AAProperties.KEY_STANDARD_DIRECTORY;
import static fr.ird.common.DateTimeUtils.DATE_FORMATTER;
import static fr.ird.common.DateTimeUtils.convertDate;
/**
* Created on 25/03/2023.
*
* @author Tony Chemit - dev@tchemit.fr
* @since 1.0.0
*/
public class ObserveDataBaseInspector extends DataBaseInspector {
private static final Logger log = LogManager.getLogger(ObserveDataBaseInspector.class);
private static final String JDBC_ACCESS_DRIVER = "com.hxtt.sql.access.AccessDriver";
private final List<FlagSelector> flagSelectors;
private final List<VesselSelector> vesselSelectors;
Resume r = new Resume();
private String exportDirectoryPath;
public static TemporalSelector getTemporalSelector() {
return temporalSelector;
}
public ObserveDataBaseInspector(JdbcConfiguration configuration, Path baseDirectory) throws Exception {
DateTime currentDateTime = DateTime.now();
if (AAProperties.isResultsEnabled()) {
exportDirectoryPath = baseDirectory.resolve("_akado_result_" + currentDateTime.getYear() + currentDateTime.getMonthOfYear() + currentDateTime.getDayOfMonth() + "_" + currentDateTime.getHourOfDay() + currentDateTime.getMinuteOfHour()).toString();
if (!(new File(exportDirectoryPath)).exists()) {
Files.createDirectories(new File(exportDirectoryPath).toPath());
}
log.info("The results will be write in the directory " + exportDirectoryPath);
}
log.debug("CONFIGURATION PROPERTIES " + CONFIGURATION_PROPERTIES);
loadProperties();
prepare();
setResults(new Results());
getAkadoMessages().setBundleProperties(ObserveMessage.AKADO_OBSERVE_BUNDLE_PROPERTIES);
flagSelectors = new ArrayList<>();
vesselSelectors = new ArrayList<>();
if (AAProperties.VESSEL_SELECTED != null && !"".equals(AAProperties.VESSEL_SELECTED)) {
log.info("Vessel selection : " + AAProperties.VESSEL_SELECTED);
String[] codeList = AAProperties.VESSEL_SELECTED.split("\\s*\\|\\s*");
for (String code : codeList) {
addVesselConstraint(code);
}
}
boolean anapoConfigurationEnabled = AAProperties.ANAPO_DB_URL != null && !"".equals(AAProperties.ANAPO_DB_URL);
boolean anapoEnabled = AAProperties.isAnapoInspectorEnabled();
ObserveService.getService().init(configuration);
ObserveService.getService().open();
if (anapoEnabled) {
if (!anapoConfigurationEnabled) {
throw new ANAPODriverException("The connection to ANAPO database has failed. The database isn't set correctly.");
}
ANAPOService.getService().init(AAProperties.PROTOCOL_JDBC_ACCESS + AAProperties.ANAPO_DB_URL, JDBC_ACCESS_DRIVER, AAProperties.ANAPO_USER, AAProperties.ANAPO_PASSWORD);
}
r.setDatabaseName(configuration.getJdbcConnectionUrl());
List<Inspector<?>> inspectors = new LinkedList<>();
if (AAProperties.isTripInspectorEnabled()) {
inspectors.addAll(ObserveTripInspector.loadInspectors());
inspectors.addAll(ObserveTripListInspector.loadInspectors());
}
if (AAProperties.isActivityInspectorEnabled()) {
List<ObserveActivityInspector> activityInspectors = ObserveActivityInspector.loadInspectors();
if (!AAProperties.isPositionInspectorEnabled()) {
// Remove PositionInspector
activityInspectors.removeIf(i -> i instanceof PositionInspector);
// Remove PositionInEEZInspector
activityInspectors.removeIf(i -> i instanceof PositionInEEZInspector);
}
inspectors.addAll(activityInspectors);
}
if (anapoEnabled) {
inspectors.addAll(ObserveAnapoActivityInspector.loadInspectors());
inspectors.addAll(ObserveAnapoActivityListInspector.loadInspectors());
}
if (AAProperties.isSampleInspectorEnabled()) {
inspectors.addAll(ObserveSampleInspector.loadInspectors());
}
if (AAProperties.isWellInspectorEnabled()) {
inspectors.addAll(ObserveWellInspector.loadInspectors());
}
log.info("Found {} inspector(s) to apply.", inspectors.size());
setInspectors(inspectors);
}
@Override
public void info() {
r.setTripCount((int) ObserveService.getService().getDaoSupplier().getPsCommonTripDao().count());
r.setFirstDateOfTrip(convertDate(ObserveService.getService().getDaoSupplier().getPsCommonTripDao().firstLandingDate()));
r.setLastDateOfTrip(convertDate(ObserveService.getService().getDaoSupplier().getPsCommonTripDao().lastLandingDate()));
r.setActivityCount((int) ObserveService.getService().getDaoSupplier().getPsLogbookActivityDao().count());
r.setFirstDateOfActivity(convertDate(ObserveService.getService().getDaoSupplier().getPsLogbookRouteDao().firstDate()));
r.setLastDateOfActivity(convertDate(ObserveService.getService().getDaoSupplier().getPsLogbookRouteDao().lastDate()));
r.setSampleCount((int) ObserveService.getService().getDaoSupplier().getPsLogbookSampleDao().count());
r.setWellCount((int) ObserveService.getService().getDaoSupplier().getPsLogbookWellDao().count());
InfoResult info = new InfoResult(r, MessageDescriptions.I0001_DATABASE_INFO);
List<Object> infos = new ArrayList<>();
infos.add(r.getTripCount());
infos.add(DATE_FORMATTER.print(r.getFirstDateOfTrip()));
infos.add(DATE_FORMATTER.print(r.getLastDateOfTrip()));
infos.add(r.getActivityCount());
infos.add(DATE_FORMATTER.print(r.getFirstDateOfActivity()));
infos.add(DATE_FORMATTER.print(r.getLastDateOfActivity()));
infos.add(r.getSampleCount());
infos.add(r.getWellCount());
info.setMessageParameters(infos);
getAkadoMessages().add(info.getMessage());
log.info(r);
}
@Override
public Results getResults() {
return (Results) super.getResults();
}
@Override
public void validate() throws Exception {
Version observeVersion = ObserveService.getService().getDaoSupplier().getVersionDao().getVersionNumber();
if (!observeVersion.equals(ObserveVersion.VERSION_OBSERVE_COMPATIBILITY)) {
ObserveMessage message = new ObserveMessage(MessageDescriptions.E0002_DATABASE_NOT_COMPATIBLE, List.of(observeVersion, ObserveVersion.VERSION_OBSERVE_COMPATIBILITY));
throw new AkadoException(message.getContent());
}
List<Trip> tripList = getTripsToValidate();
List<ObserveDataBaseInspectorTask<?>> tasks = new ArrayList<>();
if (AAProperties.isAkadoInspectorEnabled()) {
if (AAProperties.isTripInspectorEnabled()) {
tasks.add(new TripTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
if (AAProperties.isActivityInspectorEnabled()) {
tasks.add(new ActivityTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
if (AAProperties.isWellInspectorEnabled()) {
tasks.add(new WellTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
if (AAProperties.isSampleInspectorEnabled()) {
tasks.add(new SampleTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
}
if (AAProperties.isAnapoInspectorEnabled()) {
tasks.add(new AnapoTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
// ExecutorService exec = Executors.newFixedThreadPool(AAProperties.NB_PROC);
for (ObserveDataBaseInspectorTask<?> task : tasks) {
task.run();
// exec.submit(task);
}
// exec.shutdown();
// boolean done = exec.awaitTermination(120, TimeUnit.MINUTES);
// if (!done) {
// log.error("Executor service not done after 2 hours...");
// }
}
private List<Trip> getTripsToValidate() {
return ObserveService.getService().getDaoSupplier().getPsCommonTripDao().findTrips(
vesselSelectors.stream().map(VesselSelector::get).collect(Collectors.toList()),
flagSelectors.stream().map(FlagSelector::get).collect(Collectors.toList()),
getTemporalSelector().getStart() == null ? null : getTemporalSelector().getStart().toDate(),
getTemporalSelector().getEnd() == null ? null : getTemporalSelector().getEnd().toDate()
);
}
public void addFlagConstraint(String flag) {
flagSelectors.add(new FlagSelector(flag));
}
public void addVesselConstraint(String code) {
vesselSelectors.add(new VesselSelector(code));
}
private void prepare() throws Exception {
if (!GISHandler.getService().exists()) {
loadProperties();
GISHandler.getService().init(
AAProperties.STANDARD_DIRECTORY,
AAProperties.SHP_COUNTRIES_PATH,
AAProperties.SHP_OCEAN_PATH,
AAProperties.SHP_HARBOUR_PATH,
AAProperties.SHP_EEZ_PATH
);
GISHandler.getService().create();
}
}
private void loadProperties() {
if (AAProperties.STANDARD_DIRECTORY == null && CONFIGURATION_PROPERTIES != null) {
AAProperties.STANDARD_DIRECTORY = DataBaseInspector.CONFIGURATION_PROPERTIES.getProperty(KEY_STANDARD_DIRECTORY);
AAProperties.SHP_COUNTRIES_PATH = CONFIGURATION_PROPERTIES.getProperty(KEY_SHP_COUNTRIES_PATH);
AAProperties.SHP_OCEAN_PATH = CONFIGURATION_PROPERTIES.getProperty(KEY_SHP_OCEAN_PATH);
AAProperties.SHP_HARBOUR_PATH = CONFIGURATION_PROPERTIES.getProperty(KEY_SHP_HARBOUR_PATH);
AAProperties.SHP_EEZ_PATH = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_SHP_EEZ_PATH);
AAProperties.DATE_FORMAT_XLS = CONFIGURATION_PROPERTIES.getProperty(KEY_DATE_FORMAT_XLS);
AAProperties.SAMPLE_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_SAMPLE_INSPECTOR);
AAProperties.WELL_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_WELL_INSPECTOR);
AAProperties.TRIP_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_TRIP_INSPECTOR);
AAProperties.POSITION_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_POSITION_INSPECTOR);
AAProperties.ACTIVITY_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ACTIVITY_INSPECTOR);
AAProperties.WARNING_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_WARNING_INSPECTOR);
AAProperties.ANAPO_DB_URL = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ANAPO_DB_PATH);
AAProperties.ANAPO_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ANAPO_INSPECTOR);
AAProperties.ANAPO_VMS_COUNTRY = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ANAPO_VMS_COUNTRY);
AAProperties.AKADO_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_AKADO_INSPECTOR);
}
}
@Override
public void close() {
ObserveService.getService().close();
}
}
| UTF-8 | Java | 14,686 | java | ObserveDataBaseInspector.java | Java | [
{
"context": "/*\n * Copyright (C) 2014 Observatoire thonier, IRD\n *\n * This program is free software: you can",
"end": 45,
"score": 0.9798436164855957,
"start": 25,
"tag": "NAME",
"value": "Observatoire thonier"
},
{
"context": "Date;\n\n/**\n * Created on 25/03/2023.\n *\n * @aut... | null | [] | /*
* Copyright (C) 2014 <NAME>, IRD
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.ird.akado.observe;
import fr.ird.akado.core.DataBaseInspector;
import fr.ird.akado.core.Inspector;
import fr.ird.akado.core.common.AAProperties;
import fr.ird.akado.core.common.AkadoException;
import fr.ird.akado.core.selector.TemporalSelector;
import fr.ird.akado.core.spatial.GISHandler;
import fr.ird.akado.observe.inspector.activity.ObserveActivityInspector;
import fr.ird.akado.observe.inspector.activity.PositionInEEZInspector;
import fr.ird.akado.observe.inspector.activity.PositionInspector;
import fr.ird.akado.observe.inspector.anapo.ObserveAnapoActivityInspector;
import fr.ird.akado.observe.inspector.anapo.ObserveAnapoActivityListInspector;
import fr.ird.akado.observe.inspector.metatrip.ObserveTripListInspector;
import fr.ird.akado.observe.inspector.sample.ObserveSampleInspector;
import fr.ird.akado.observe.inspector.trip.ObserveTripInspector;
import fr.ird.akado.observe.inspector.well.ObserveWellInspector;
import fr.ird.akado.observe.result.InfoResult;
import fr.ird.akado.observe.result.ObserveMessage;
import fr.ird.akado.observe.result.Results;
import fr.ird.akado.observe.result.object.Resume;
import fr.ird.akado.observe.selector.FlagSelector;
import fr.ird.akado.observe.selector.VesselSelector;
import fr.ird.akado.observe.task.ActivityTask;
import fr.ird.akado.observe.task.AnapoTask;
import fr.ird.akado.observe.task.ObserveDataBaseInspectorTask;
import fr.ird.akado.observe.task.SampleTask;
import fr.ird.akado.observe.task.TripTask;
import fr.ird.akado.observe.task.WellTask;
import fr.ird.driver.anapo.common.exception.ANAPODriverException;
import fr.ird.driver.anapo.service.ANAPOService;
import fr.ird.driver.observe.business.ObserveVersion;
import fr.ird.driver.observe.business.data.ps.common.Trip;
import fr.ird.driver.observe.service.ObserveService;
import io.ultreia.java4all.util.Version;
import io.ultreia.java4all.util.sql.conf.JdbcConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import static fr.ird.akado.core.common.AAProperties.KEY_DATE_FORMAT_XLS;
import static fr.ird.akado.core.common.AAProperties.KEY_SHP_COUNTRIES_PATH;
import static fr.ird.akado.core.common.AAProperties.KEY_SHP_HARBOUR_PATH;
import static fr.ird.akado.core.common.AAProperties.KEY_SHP_OCEAN_PATH;
import static fr.ird.akado.core.common.AAProperties.KEY_STANDARD_DIRECTORY;
import static fr.ird.common.DateTimeUtils.DATE_FORMATTER;
import static fr.ird.common.DateTimeUtils.convertDate;
/**
* Created on 25/03/2023.
*
* @author <NAME> - <EMAIL>
* @since 1.0.0
*/
public class ObserveDataBaseInspector extends DataBaseInspector {
private static final Logger log = LogManager.getLogger(ObserveDataBaseInspector.class);
private static final String JDBC_ACCESS_DRIVER = "com.hxtt.sql.access.AccessDriver";
private final List<FlagSelector> flagSelectors;
private final List<VesselSelector> vesselSelectors;
Resume r = new Resume();
private String exportDirectoryPath;
public static TemporalSelector getTemporalSelector() {
return temporalSelector;
}
public ObserveDataBaseInspector(JdbcConfiguration configuration, Path baseDirectory) throws Exception {
DateTime currentDateTime = DateTime.now();
if (AAProperties.isResultsEnabled()) {
exportDirectoryPath = baseDirectory.resolve("_akado_result_" + currentDateTime.getYear() + currentDateTime.getMonthOfYear() + currentDateTime.getDayOfMonth() + "_" + currentDateTime.getHourOfDay() + currentDateTime.getMinuteOfHour()).toString();
if (!(new File(exportDirectoryPath)).exists()) {
Files.createDirectories(new File(exportDirectoryPath).toPath());
}
log.info("The results will be write in the directory " + exportDirectoryPath);
}
log.debug("CONFIGURATION PROPERTIES " + CONFIGURATION_PROPERTIES);
loadProperties();
prepare();
setResults(new Results());
getAkadoMessages().setBundleProperties(ObserveMessage.AKADO_OBSERVE_BUNDLE_PROPERTIES);
flagSelectors = new ArrayList<>();
vesselSelectors = new ArrayList<>();
if (AAProperties.VESSEL_SELECTED != null && !"".equals(AAProperties.VESSEL_SELECTED)) {
log.info("Vessel selection : " + AAProperties.VESSEL_SELECTED);
String[] codeList = AAProperties.VESSEL_SELECTED.split("\\s*\\|\\s*");
for (String code : codeList) {
addVesselConstraint(code);
}
}
boolean anapoConfigurationEnabled = AAProperties.ANAPO_DB_URL != null && !"".equals(AAProperties.ANAPO_DB_URL);
boolean anapoEnabled = AAProperties.isAnapoInspectorEnabled();
ObserveService.getService().init(configuration);
ObserveService.getService().open();
if (anapoEnabled) {
if (!anapoConfigurationEnabled) {
throw new ANAPODriverException("The connection to ANAPO database has failed. The database isn't set correctly.");
}
ANAPOService.getService().init(AAProperties.PROTOCOL_JDBC_ACCESS + AAProperties.ANAPO_DB_URL, JDBC_ACCESS_DRIVER, AAProperties.ANAPO_USER, AAProperties.ANAPO_PASSWORD);
}
r.setDatabaseName(configuration.getJdbcConnectionUrl());
List<Inspector<?>> inspectors = new LinkedList<>();
if (AAProperties.isTripInspectorEnabled()) {
inspectors.addAll(ObserveTripInspector.loadInspectors());
inspectors.addAll(ObserveTripListInspector.loadInspectors());
}
if (AAProperties.isActivityInspectorEnabled()) {
List<ObserveActivityInspector> activityInspectors = ObserveActivityInspector.loadInspectors();
if (!AAProperties.isPositionInspectorEnabled()) {
// Remove PositionInspector
activityInspectors.removeIf(i -> i instanceof PositionInspector);
// Remove PositionInEEZInspector
activityInspectors.removeIf(i -> i instanceof PositionInEEZInspector);
}
inspectors.addAll(activityInspectors);
}
if (anapoEnabled) {
inspectors.addAll(ObserveAnapoActivityInspector.loadInspectors());
inspectors.addAll(ObserveAnapoActivityListInspector.loadInspectors());
}
if (AAProperties.isSampleInspectorEnabled()) {
inspectors.addAll(ObserveSampleInspector.loadInspectors());
}
if (AAProperties.isWellInspectorEnabled()) {
inspectors.addAll(ObserveWellInspector.loadInspectors());
}
log.info("Found {} inspector(s) to apply.", inspectors.size());
setInspectors(inspectors);
}
@Override
public void info() {
r.setTripCount((int) ObserveService.getService().getDaoSupplier().getPsCommonTripDao().count());
r.setFirstDateOfTrip(convertDate(ObserveService.getService().getDaoSupplier().getPsCommonTripDao().firstLandingDate()));
r.setLastDateOfTrip(convertDate(ObserveService.getService().getDaoSupplier().getPsCommonTripDao().lastLandingDate()));
r.setActivityCount((int) ObserveService.getService().getDaoSupplier().getPsLogbookActivityDao().count());
r.setFirstDateOfActivity(convertDate(ObserveService.getService().getDaoSupplier().getPsLogbookRouteDao().firstDate()));
r.setLastDateOfActivity(convertDate(ObserveService.getService().getDaoSupplier().getPsLogbookRouteDao().lastDate()));
r.setSampleCount((int) ObserveService.getService().getDaoSupplier().getPsLogbookSampleDao().count());
r.setWellCount((int) ObserveService.getService().getDaoSupplier().getPsLogbookWellDao().count());
InfoResult info = new InfoResult(r, MessageDescriptions.I0001_DATABASE_INFO);
List<Object> infos = new ArrayList<>();
infos.add(r.getTripCount());
infos.add(DATE_FORMATTER.print(r.getFirstDateOfTrip()));
infos.add(DATE_FORMATTER.print(r.getLastDateOfTrip()));
infos.add(r.getActivityCount());
infos.add(DATE_FORMATTER.print(r.getFirstDateOfActivity()));
infos.add(DATE_FORMATTER.print(r.getLastDateOfActivity()));
infos.add(r.getSampleCount());
infos.add(r.getWellCount());
info.setMessageParameters(infos);
getAkadoMessages().add(info.getMessage());
log.info(r);
}
@Override
public Results getResults() {
return (Results) super.getResults();
}
@Override
public void validate() throws Exception {
Version observeVersion = ObserveService.getService().getDaoSupplier().getVersionDao().getVersionNumber();
if (!observeVersion.equals(ObserveVersion.VERSION_OBSERVE_COMPATIBILITY)) {
ObserveMessage message = new ObserveMessage(MessageDescriptions.E0002_DATABASE_NOT_COMPATIBLE, List.of(observeVersion, ObserveVersion.VERSION_OBSERVE_COMPATIBILITY));
throw new AkadoException(message.getContent());
}
List<Trip> tripList = getTripsToValidate();
List<ObserveDataBaseInspectorTask<?>> tasks = new ArrayList<>();
if (AAProperties.isAkadoInspectorEnabled()) {
if (AAProperties.isTripInspectorEnabled()) {
tasks.add(new TripTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
if (AAProperties.isActivityInspectorEnabled()) {
tasks.add(new ActivityTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
if (AAProperties.isWellInspectorEnabled()) {
tasks.add(new WellTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
if (AAProperties.isSampleInspectorEnabled()) {
tasks.add(new SampleTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
}
if (AAProperties.isAnapoInspectorEnabled()) {
tasks.add(new AnapoTask(exportDirectoryPath, tripList, getInspectors(), getResults()));
}
// ExecutorService exec = Executors.newFixedThreadPool(AAProperties.NB_PROC);
for (ObserveDataBaseInspectorTask<?> task : tasks) {
task.run();
// exec.submit(task);
}
// exec.shutdown();
// boolean done = exec.awaitTermination(120, TimeUnit.MINUTES);
// if (!done) {
// log.error("Executor service not done after 2 hours...");
// }
}
private List<Trip> getTripsToValidate() {
return ObserveService.getService().getDaoSupplier().getPsCommonTripDao().findTrips(
vesselSelectors.stream().map(VesselSelector::get).collect(Collectors.toList()),
flagSelectors.stream().map(FlagSelector::get).collect(Collectors.toList()),
getTemporalSelector().getStart() == null ? null : getTemporalSelector().getStart().toDate(),
getTemporalSelector().getEnd() == null ? null : getTemporalSelector().getEnd().toDate()
);
}
public void addFlagConstraint(String flag) {
flagSelectors.add(new FlagSelector(flag));
}
public void addVesselConstraint(String code) {
vesselSelectors.add(new VesselSelector(code));
}
private void prepare() throws Exception {
if (!GISHandler.getService().exists()) {
loadProperties();
GISHandler.getService().init(
AAProperties.STANDARD_DIRECTORY,
AAProperties.SHP_COUNTRIES_PATH,
AAProperties.SHP_OCEAN_PATH,
AAProperties.SHP_HARBOUR_PATH,
AAProperties.SHP_EEZ_PATH
);
GISHandler.getService().create();
}
}
private void loadProperties() {
if (AAProperties.STANDARD_DIRECTORY == null && CONFIGURATION_PROPERTIES != null) {
AAProperties.STANDARD_DIRECTORY = DataBaseInspector.CONFIGURATION_PROPERTIES.getProperty(KEY_STANDARD_DIRECTORY);
AAProperties.SHP_COUNTRIES_PATH = CONFIGURATION_PROPERTIES.getProperty(KEY_SHP_COUNTRIES_PATH);
AAProperties.SHP_OCEAN_PATH = CONFIGURATION_PROPERTIES.getProperty(KEY_SHP_OCEAN_PATH);
AAProperties.SHP_HARBOUR_PATH = CONFIGURATION_PROPERTIES.getProperty(KEY_SHP_HARBOUR_PATH);
AAProperties.SHP_EEZ_PATH = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_SHP_EEZ_PATH);
AAProperties.DATE_FORMAT_XLS = CONFIGURATION_PROPERTIES.getProperty(KEY_DATE_FORMAT_XLS);
AAProperties.SAMPLE_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_SAMPLE_INSPECTOR);
AAProperties.WELL_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_WELL_INSPECTOR);
AAProperties.TRIP_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_TRIP_INSPECTOR);
AAProperties.POSITION_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_POSITION_INSPECTOR);
AAProperties.ACTIVITY_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ACTIVITY_INSPECTOR);
AAProperties.WARNING_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_WARNING_INSPECTOR);
AAProperties.ANAPO_DB_URL = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ANAPO_DB_PATH);
AAProperties.ANAPO_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ANAPO_INSPECTOR);
AAProperties.ANAPO_VMS_COUNTRY = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_ANAPO_VMS_COUNTRY);
AAProperties.AKADO_INSPECTOR = CONFIGURATION_PROPERTIES.getProperty(AAProperties.KEY_AKADO_INSPECTOR);
}
}
@Override
public void close() {
ObserveService.getService().close();
}
}
| 14,660 | 0.70843 | 0.706251 | 286 | 50.349651 | 38.493076 | 257 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.671329 | false | false | 13 |
5ec689453d29d057f6b61c97ffed1685eeddeb3b | 2,731,599,234,472 | a1c11a7dd53beff8b0cec40aaa26834837a277f5 | /src/main/java/ak/hyperdimensionalbag/capabilities/BagDataCapabilityProvider.java | d08d7f18d29a97b743015d12e5d23eb63bf24659 | [
"MIT"
] | permissive | aksource/HyperDimensionalBag | https://github.com/aksource/HyperDimensionalBag | efddd5077a28633e184861c1f5a8f8ab5b957fe5 | d951ebe3b15a426021d1702604f8d4316c836b5e | refs/heads/master | 2022-09-14T23:32:35.148000 | 2022-09-08T12:40:51 | 2022-09-08T12:40:51 | 17,110,863 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ak.hyperdimensionalbag.capabilities;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Created by A.K. on 2021/12/18.
*/
public class BagDataCapabilityProvider implements ICapabilitySerializable<CompoundTag> {
private final BagData bagData = new BagData();
private final LazyOptional<IBagData> optional = LazyOptional.of(() -> bagData);
private final Capability<IBagData> capability = BagData.CAPABILITY;
@Nonnull
@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
if (cap == capability) return optional.cast();
return LazyOptional.empty();
}
@Override
public CompoundTag serializeNBT() {
return bagData.serializeNBT();
}
@Override
public void deserializeNBT(CompoundTag nbt) {
bagData.deserializeNBT(nbt);
}
}
| UTF-8 | Java | 1,103 | java | BagDataCapabilityProvider.java | Java | [
{
"context": "port javax.annotation.Nullable;\n\n/**\n * Created by A.K. on 2021/12/18.\n */\npublic class BagDataCapability",
"end": 392,
"score": 0.9997284412384033,
"start": 389,
"tag": "NAME",
"value": "A.K"
}
] | null | [] | package ak.hyperdimensionalbag.capabilities;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Created by A.K. on 2021/12/18.
*/
public class BagDataCapabilityProvider implements ICapabilitySerializable<CompoundTag> {
private final BagData bagData = new BagData();
private final LazyOptional<IBagData> optional = LazyOptional.of(() -> bagData);
private final Capability<IBagData> capability = BagData.CAPABILITY;
@Nonnull
@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
if (cap == capability) return optional.cast();
return LazyOptional.empty();
}
@Override
public CompoundTag serializeNBT() {
return bagData.serializeNBT();
}
@Override
public void deserializeNBT(CompoundTag nbt) {
bagData.deserializeNBT(nbt);
}
}
| 1,103 | 0.773345 | 0.766092 | 35 | 30.514286 | 27.634731 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457143 | false | false | 13 |
e7d382b324d256a3fff451dd2425d511ec7df190 | 14,860,586,891,592 | 57ee988f58e7dbdeffcbe1ce58b566f71452bcd0 | /kf5sdkModule/src/main/java/com/kf5/sdk/system/utils/LogUtil.java | f431e4161ad26eda7e419758c99acb90bee6d025 | [] | no_license | AndroidLwk/android_unlimited | https://github.com/AndroidLwk/android_unlimited | 52d0e75533f80a8eacb75d368b28f0cf88b1dedc | 67fb33539f75d47cebcaf6cbc5718991a3e5db87 | refs/heads/master | 2022-10-17T10:36:10.593000 | 2020-06-08T01:36:17 | 2020-06-08T01:36:17 | 270,985,317 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kf5.sdk.system.utils;
import android.text.TextUtils;
import android.util.Log;
/**
* author:chosen
* date:2017/3/8 15:49
* email:812219713@qq.com
*/
public class LogUtil {
private static final boolean canPrint = true;
public static void printf(String msg) {
if (canPrint) {
printf(msg, null);
}
}
private static int LOG_MAXLENGTH = 2000;
public static void printf(String msg, Exception e) {
try {
if (canPrint && !TextUtils.isEmpty(msg)) {
// Log.i(Utils.KF5_TAG, msg, e);
int strLength = msg.length();
int start = 0;
int end = LOG_MAXLENGTH;
for (int i = 0; i < 100; i++) {
//剩下的文本还是大于规定长度则继续重复截取并输出
if (strLength > end) {
Log.i(Utils.KF5_TAG + i, msg.substring(start, end),e);
start = end;
end = end + LOG_MAXLENGTH;
} else {
Log.i(Utils.KF5_TAG, msg.substring(start, strLength),e);
break;
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
// printf("这里好像有异常",e1);
}
}
}
| UTF-8 | Java | 1,378 | java | LogUtil.java | Java | [
{
"context": "xtUtils;\nimport android.util.Log;\n\n\n/**\n * author:chosen\n * date:2017/3/8 15:49\n * email:812219713@qq.com\n",
"end": 113,
"score": 0.999249279499054,
"start": 107,
"tag": "USERNAME",
"value": "chosen"
},
{
"context": "\n * author:chosen\n * date:2017/3/8 15:49\n ... | null | [] | package com.kf5.sdk.system.utils;
import android.text.TextUtils;
import android.util.Log;
/**
* author:chosen
* date:2017/3/8 15:49
* email:<EMAIL>
*/
public class LogUtil {
private static final boolean canPrint = true;
public static void printf(String msg) {
if (canPrint) {
printf(msg, null);
}
}
private static int LOG_MAXLENGTH = 2000;
public static void printf(String msg, Exception e) {
try {
if (canPrint && !TextUtils.isEmpty(msg)) {
// Log.i(Utils.KF5_TAG, msg, e);
int strLength = msg.length();
int start = 0;
int end = LOG_MAXLENGTH;
for (int i = 0; i < 100; i++) {
//剩下的文本还是大于规定长度则继续重复截取并输出
if (strLength > end) {
Log.i(Utils.KF5_TAG + i, msg.substring(start, end),e);
start = end;
end = end + LOG_MAXLENGTH;
} else {
Log.i(Utils.KF5_TAG, msg.substring(start, strLength),e);
break;
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
// printf("这里好像有异常",e1);
}
}
}
| 1,369 | 0.463581 | 0.437026 | 51 | 24.843138 | 20.709354 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false | 13 |
b3aee6ad9219be369dfa9893e674aa75dce10bed | 30,623,116,822,436 | cfafb4b7bd0701244d9fe05796f998fdc40ee347 | /Test157.java | 34fd20be592090f47603f29e4a456ab61bb69ec7 | [] | no_license | lshlsh1/JavaStudy | https://github.com/lshlsh1/JavaStudy | e5ea774acbbe3a53d9446ffa515b115a1ca7daaf | 02caa80e28524cec92a29f9a08cb70092b47c2ef | refs/heads/master | 2020-04-23T01:45:48.885000 | 2019-03-15T08:52:58 | 2019-03-15T08:52:58 | 170,823,785 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*========================================
■■■ 컬렉션 (Collection) ■■■ ☆☆
- Vector
========================================*/
// 벡터 자료구조 객체 선언 및 생성 시 사용자 정의 클래스 활용
// → 자료형
import java.util.Vector;
// 사용자 정의 클래스 설계 → 자료형처럼 활용
class MyData
{
//주요 속성 구성 → 주요 변수 선언(멤버 변수)
private String name; //-- 이름
private int age; //-- 연령
//getter / setter 구성
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setAge(int age)
{
this.age = age;
}
public int getAge()
{
return age;
}
//생성자(인자 없는 생성자)
public MyData()
{
name = "";
age =0;
}
//생성자(인자 2개인 생성자)
public MyData(String name, int age)
{
this.name = name;
this.age = age;
}
}
public class Test157
{
public static void main(String[] args)
{
//벡터 자료구조 인스턴스 생성
Vector<MyData> v = new Vector<MyData>();
// 벡터 자료구조 v 예
// 이지혜 16세 / 이기승 24세 / 조현우 86세
// 담아내기
// ①
/*
MyData st1 = new MyData();
st1.setName("이지혜");
st1.setAge(16);
v.add(st1);
MyData st2 = new MyData();
st2.setName("이기승");
st2.setAge(24);
v.add(st2);
MyData st3 = new MyData();
st3.setName("조현우");
st3.setAge(86);
v.add(st3);
*/
// ②
/*
MyData st1 = new MyData("이지혜", 16);
v.add(st1);
MyData st2 = new MyData("이기승", 24);
v.add(st2);
MyData st3 = new MyData("조현우", 36);
v.add(st3);
*/
// ③
v.add(new MyData("이지혜", 16));
v.add(new MyData("이기승", 17));
v.add(new MyData("조현우", 86));
//벡터 자료구조v에 담긴 내용(요소) 전체 출력하기
//실행 예)
//이름 : 이지혜, 나이 : 16세
//이름 : 이기승, 나이 : 24세
//이름 : 조현우, 나이 : 86세
// ①
for (MyData obj : v)
{
System.out.printf("이름 : %s, 나이 : %d\n", obj.getName(), obj.getAge());
}
// ②
for (int i=0 ; i<v.size() ; i++ )
{
//System.out.printf("이름: %s, 나이 : %d\n",v.get(i).getName() , v.get(i).getAge() );
System.out.printf("이름: %s, 나이 : %d\n",v.elementAt(i).getName() , v.elementAt(i).getAge() );
}System.out.println();
// ③
for (Object temp : v)
{
System.out.printf("이름 : %s, 나이 : %d\n", ((MyData)temp).getName(), ((MyData)temp).getAge()); // 상속, 업캐스팅,다운캐스팅
}
}
} | UHC | Java | 2,718 | java | Test157.java | Java | [
{
"context": " new Vector<MyData>();\r\n\t\t\r\n\t\t// 벡터 자료구조 v 예\r\n\t\t// 이지혜 16세 / 이기승 24세 / 조현우 86세\r\n\t\t// 담아내기\r\n\r\n\t\t// ① \r\n\t\t",
"end": 944,
"score": 0.9359974265098572,
"start": 941,
"tag": "NAME",
"value": "이지혜"
},
{
"context": "r<MyData>();\r\n\t\t\r\n\t\t// 벡터 자... | null | [] | /*========================================
■■■ 컬렉션 (Collection) ■■■ ☆☆
- Vector
========================================*/
// 벡터 자료구조 객체 선언 및 생성 시 사용자 정의 클래스 활용
// → 자료형
import java.util.Vector;
// 사용자 정의 클래스 설계 → 자료형처럼 활용
class MyData
{
//주요 속성 구성 → 주요 변수 선언(멤버 변수)
private String name; //-- 이름
private int age; //-- 연령
//getter / setter 구성
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setAge(int age)
{
this.age = age;
}
public int getAge()
{
return age;
}
//생성자(인자 없는 생성자)
public MyData()
{
name = "";
age =0;
}
//생성자(인자 2개인 생성자)
public MyData(String name, int age)
{
this.name = name;
this.age = age;
}
}
public class Test157
{
public static void main(String[] args)
{
//벡터 자료구조 인스턴스 생성
Vector<MyData> v = new Vector<MyData>();
// 벡터 자료구조 v 예
// 이지혜 16세 / 이기승 24세 / 조현우 86세
// 담아내기
// ①
/*
MyData st1 = new MyData();
st1.setName("이지혜");
st1.setAge(16);
v.add(st1);
MyData st2 = new MyData();
st2.setName("이기승");
st2.setAge(24);
v.add(st2);
MyData st3 = new MyData();
st3.setName("조현우");
st3.setAge(86);
v.add(st3);
*/
// ②
/*
MyData st1 = new MyData("이지혜", 16);
v.add(st1);
MyData st2 = new MyData("이기승", 24);
v.add(st2);
MyData st3 = new MyData("조현우", 36);
v.add(st3);
*/
// ③
v.add(new MyData("이지혜", 16));
v.add(new MyData("이기승", 17));
v.add(new MyData("조현우", 86));
//벡터 자료구조v에 담긴 내용(요소) 전체 출력하기
//실행 예)
//이름 : 이지혜, 나이 : 16세
//이름 : 이기승, 나이 : 24세
//이름 : 조현우, 나이 : 86세
// ①
for (MyData obj : v)
{
System.out.printf("이름 : %s, 나이 : %d\n", obj.getName(), obj.getAge());
}
// ②
for (int i=0 ; i<v.size() ; i++ )
{
//System.out.printf("이름: %s, 나이 : %d\n",v.get(i).getName() , v.get(i).getAge() );
System.out.printf("이름: %s, 나이 : %d\n",v.elementAt(i).getName() , v.elementAt(i).getAge() );
}System.out.println();
// ③
for (Object temp : v)
{
System.out.printf("이름 : %s, 나이 : %d\n", ((MyData)temp).getName(), ((MyData)temp).getAge()); // 상속, 업캐스팅,다운캐스팅
}
}
} | 2,718 | 0.495528 | 0.468694 | 126 | 15.761905 | 18.468088 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.865079 | false | false | 13 |
dfb4bb45c43e7cfd5ec44998e27844741abbe8ac | 15,891,379,007,218 | 549889c63bc2a8f9296c270c5c019c5e09c5e534 | /01Search_Conexao/src/Modelos/.svn/text-base/CodigobarrasItemPK.java.svn-base | e903330c2fa1beebb8511e5ce826331777d006ec | [] | no_license | fvasc/APP_01Search | https://github.com/fvasc/APP_01Search | 73e6b4403b056e25e822382532ca369d4c16688e | f2b7de080b6e2adbfd37575dc6a63d287523cc0a | refs/heads/master | 2021-01-10T11:06:42.670000 | 2016-03-27T22:40:04 | 2016-03-27T22:40:04 | 54,850,212 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Modelos;
import java.io.Serializable;
public class CodigobarrasItemPK implements Serializable {
private static final long serialVersionUID = 1L;
private String idCodigobarras;
private int idItem;
public String getIdCodigobarras() {
return idCodigobarras;
}
public void setIdCodigobarras(String idCodigobarras) {
this.idCodigobarras = idCodigobarras;
}
public int getIdItem() {
return idItem;
}
public void setIdItem(int idItem) {
this.idItem = idItem;
}
}
| UTF-8 | Java | 492 | CodigobarrasItemPK.java.svn-base | Java | [] | null | [] | package Modelos;
import java.io.Serializable;
public class CodigobarrasItemPK implements Serializable {
private static final long serialVersionUID = 1L;
private String idCodigobarras;
private int idItem;
public String getIdCodigobarras() {
return idCodigobarras;
}
public void setIdCodigobarras(String idCodigobarras) {
this.idCodigobarras = idCodigobarras;
}
public int getIdItem() {
return idItem;
}
public void setIdItem(int idItem) {
this.idItem = idItem;
}
}
| 492 | 0.760163 | 0.75813 | 28 | 16.571428 | 18.42248 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 | |
a36af191444c4b39c41be2cf82a3702a13ff2d25 | 14,800,457,371,369 | f034118e58afbb4a5f0189543d20ee48b72fe05e | /src/generate/map/MapGenerator.java | 38cabbeb7719ad6626b1d3e93ac942a67985f89b | [] | no_license | blueKingCrab/roguelike | https://github.com/blueKingCrab/roguelike | 847f00a61b14c1b05785c177fe269050a7f710dc | 35c81c802c7d97b636190c3502154b0a7c0de1cc | refs/heads/main | 2023-06-17T18:44:33.060000 | 2021-07-18T23:00:35 | 2021-07-18T23:00:35 | 385,905,721 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package src.generate.map;
import src.rooms.Room;
import src.generate.room.RoomGenerator;
public class MapGenerator {
private final int MAX_ROOMS = 10;
private final int LENGTH = 8;
private final int WIDTH = 8;
private RoomGenerator generateRoom = new RoomGenerator();
public MapGenerator() {}
public void fillMap(Room[][] rooms, int level) {
int randStartX = (int)Math.floor(Math.random()*(LENGTH));
int randStartY = (int)Math.floor(Math.random()*(WIDTH));
int randX;
int randY;
int tempX;
int tempY;
int rand;
int currentRoomCount = 0;
int randomRoomCount = 0;
int[][] randomRoomLoc = new int[1][2];
rooms[randStartX][randStartY] = new Room(randStartX, randStartY);
rooms[randStartX][randStartY].startRoom();
//System.out.println("Starting Point: [" + randStartX + "," + randStartY + "]");
tempX = randStartX - 1;
if(tempX >= 0) {
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randStartY;
randomRoomCount++;
}
tempY = randStartY - 1;
if(tempY >= 0) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randStartX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
tempX = randStartX + 1;
if(tempX <= 7) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randStartY;
randomRoomCount++;
}
tempY = randStartY + 1;
if(tempY <= 7) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randStartX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
//System.out.println("Starting Points: " + Arrays.deepToString(randomRoomLoc));
while(currentRoomCount < MAX_ROOMS * level) {
rand = (int)Math.floor(Math.random()*(randomRoomLoc.length));
randX = randomRoomLoc[rand][0];
tempX = randX;
randY = randomRoomLoc[rand][1];
tempY = randY;
if(rooms[tempX][randY] == null) {
rooms[tempX][tempY] = new Room(tempX, randY, false);
currentRoomCount++;
}
//System.out.println(currentRoomCount + " Selected Room: [" + tempX + "," + tempY +"]");
randomRoomLoc = this.removeRandomRoom(randomRoomLoc, rand);
tempX = randX - 1;
if(tempX >= 0 && rooms[tempX][randY] == null && !this.alreadyContainsRoom(randomRoomLoc, tempX, randY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randY;
randomRoomCount++;
}
tempY = randY - 1;
if(tempY >= 0 && rooms[randX][tempY] == null && !this.alreadyContainsRoom(randomRoomLoc, randX, tempY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
tempX = randX + 1;
if(tempX <= 7 && rooms[tempX][randY] == null && !this.alreadyContainsRoom(randomRoomLoc, tempX, randY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randY;
randomRoomCount++;
}
tempY = randY + 1;
if(tempY <= 7 && rooms[randX][tempY] == null && !this.alreadyContainsRoom(randomRoomLoc, randX, tempY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
//System.out.println(currentRoomCount + " Room List: " + Arrays.deepToString(randomRoomLoc));
}
for(int i = 0; i < LENGTH; i++) {
for(int j = 0; j < WIDTH; j++) {
if(rooms[i][j] == null) {
rooms[i][j] = new Room(i, j, true);
//System.out.print("[" + i + "," + j + "]");
} else {
//System.out.print("[ROM]");
}
}
//System.out.println();
}
}
private int[][] growRandomRooms(int[][] smallList) {
int[][] newList = new int[smallList.length+1][2];
for(int i = 0; i < smallList.length; i++) {
newList[i][0] = smallList[i][0];
newList[i][1] = smallList[i][1];
}
return newList;
}
private int[][] removeRandomRoom(int[][] oldList, int index) {
int[][] newList = new int[oldList.length-1][2];
for(int i = 0, k = 0; i < oldList.length; i++) {
if(i != index) {
newList[k][0] = oldList[i][0];
newList[k][1] = oldList[i][1];
k++;
}
}
return newList;
}
private boolean alreadyContainsRoom(int[][] list, int x, int y) {
for(int i = 0; i < list.length; i++) {
if(list[i][0] == x && list[i][1] == y) {
return true;
}
}
return false;
}
public void fillWalls(Room[][] rooms) {
boolean north = false;
boolean east = false;
boolean south = false;
boolean west = false;
for(int i = 0; i < 8; i++) {
for(int j = 0; j < 8; j++) {
if(!rooms[i][j].isEmpty()) {
if(i == 0 || rooms[i-1][j].isEmpty()) {
north = true;
}
if(j == 7 || rooms[i][j+1].isEmpty()) {
east = true;
}
if(i == 7 || rooms[i+1][j].isEmpty()) {
south = true;
}
if(j == 0 || rooms[i][j-1].isEmpty()) {
west = true;
}
if(north || east || south || west) {
rooms[i][j].setCells(generateRoom.fillWalls(rooms[i][j].getCells(), north, east, south, west));
}
}
north = false;
east = false;
south = false;
west = false;
}
}
}
} | UTF-8 | Java | 6,729 | java | MapGenerator.java | Java | [] | null | [] | package src.generate.map;
import src.rooms.Room;
import src.generate.room.RoomGenerator;
public class MapGenerator {
private final int MAX_ROOMS = 10;
private final int LENGTH = 8;
private final int WIDTH = 8;
private RoomGenerator generateRoom = new RoomGenerator();
public MapGenerator() {}
public void fillMap(Room[][] rooms, int level) {
int randStartX = (int)Math.floor(Math.random()*(LENGTH));
int randStartY = (int)Math.floor(Math.random()*(WIDTH));
int randX;
int randY;
int tempX;
int tempY;
int rand;
int currentRoomCount = 0;
int randomRoomCount = 0;
int[][] randomRoomLoc = new int[1][2];
rooms[randStartX][randStartY] = new Room(randStartX, randStartY);
rooms[randStartX][randStartY].startRoom();
//System.out.println("Starting Point: [" + randStartX + "," + randStartY + "]");
tempX = randStartX - 1;
if(tempX >= 0) {
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randStartY;
randomRoomCount++;
}
tempY = randStartY - 1;
if(tempY >= 0) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randStartX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
tempX = randStartX + 1;
if(tempX <= 7) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randStartY;
randomRoomCount++;
}
tempY = randStartY + 1;
if(tempY <= 7) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randStartX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
//System.out.println("Starting Points: " + Arrays.deepToString(randomRoomLoc));
while(currentRoomCount < MAX_ROOMS * level) {
rand = (int)Math.floor(Math.random()*(randomRoomLoc.length));
randX = randomRoomLoc[rand][0];
tempX = randX;
randY = randomRoomLoc[rand][1];
tempY = randY;
if(rooms[tempX][randY] == null) {
rooms[tempX][tempY] = new Room(tempX, randY, false);
currentRoomCount++;
}
//System.out.println(currentRoomCount + " Selected Room: [" + tempX + "," + tempY +"]");
randomRoomLoc = this.removeRandomRoom(randomRoomLoc, rand);
tempX = randX - 1;
if(tempX >= 0 && rooms[tempX][randY] == null && !this.alreadyContainsRoom(randomRoomLoc, tempX, randY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randY;
randomRoomCount++;
}
tempY = randY - 1;
if(tempY >= 0 && rooms[randX][tempY] == null && !this.alreadyContainsRoom(randomRoomLoc, randX, tempY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
tempX = randX + 1;
if(tempX <= 7 && rooms[tempX][randY] == null && !this.alreadyContainsRoom(randomRoomLoc, tempX, randY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = tempX;
randomRoomLoc[randomRoomLoc.length-1][1] = randY;
randomRoomCount++;
}
tempY = randY + 1;
if(tempY <= 7 && rooms[randX][tempY] == null && !this.alreadyContainsRoom(randomRoomLoc, randX, tempY)) {
randomRoomLoc = this.growRandomRooms(randomRoomLoc);
randomRoomLoc[randomRoomLoc.length-1][0] = randX;
randomRoomLoc[randomRoomLoc.length-1][1] = tempY;
randomRoomCount++;
}
//System.out.println(currentRoomCount + " Room List: " + Arrays.deepToString(randomRoomLoc));
}
for(int i = 0; i < LENGTH; i++) {
for(int j = 0; j < WIDTH; j++) {
if(rooms[i][j] == null) {
rooms[i][j] = new Room(i, j, true);
//System.out.print("[" + i + "," + j + "]");
} else {
//System.out.print("[ROM]");
}
}
//System.out.println();
}
}
private int[][] growRandomRooms(int[][] smallList) {
int[][] newList = new int[smallList.length+1][2];
for(int i = 0; i < smallList.length; i++) {
newList[i][0] = smallList[i][0];
newList[i][1] = smallList[i][1];
}
return newList;
}
private int[][] removeRandomRoom(int[][] oldList, int index) {
int[][] newList = new int[oldList.length-1][2];
for(int i = 0, k = 0; i < oldList.length; i++) {
if(i != index) {
newList[k][0] = oldList[i][0];
newList[k][1] = oldList[i][1];
k++;
}
}
return newList;
}
private boolean alreadyContainsRoom(int[][] list, int x, int y) {
for(int i = 0; i < list.length; i++) {
if(list[i][0] == x && list[i][1] == y) {
return true;
}
}
return false;
}
public void fillWalls(Room[][] rooms) {
boolean north = false;
boolean east = false;
boolean south = false;
boolean west = false;
for(int i = 0; i < 8; i++) {
for(int j = 0; j < 8; j++) {
if(!rooms[i][j].isEmpty()) {
if(i == 0 || rooms[i-1][j].isEmpty()) {
north = true;
}
if(j == 7 || rooms[i][j+1].isEmpty()) {
east = true;
}
if(i == 7 || rooms[i+1][j].isEmpty()) {
south = true;
}
if(j == 0 || rooms[i][j-1].isEmpty()) {
west = true;
}
if(north || east || south || west) {
rooms[i][j].setCells(generateRoom.fillWalls(rooms[i][j].getCells(), north, east, south, west));
}
}
north = false;
east = false;
south = false;
west = false;
}
}
}
} | 6,729 | 0.511963 | 0.498588 | 211 | 30.895735 | 25.955824 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.720379 | false | false | 13 |
4b48262850f406dba93c94eb0446028d76dd1010 | 8,400,956,038,302 | da523930b0a3e54568f77f88770ee9f67ba5ebab | /lib/src/main/java/cn/jake/share/frdialog/image/CommonImageLoader.java | 44f716ed12b7defd93795825c758fb0853560765 | [] | no_license | wuxujun/FRDialog | https://github.com/wuxujun/FRDialog | f30bb28851a40fa0024b43fe87de94b05fd9384d | ead3bb14f2d681e1bc0a3e44595f3c1b44385722 | refs/heads/master | 2020-09-09T13:02:24.486000 | 2019-06-13T09:49:45 | 2019-06-13T09:49:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.jake.share.frdialog.image;
import android.widget.ImageView;
/**
* Created by jack
* Date:2018/7/19 下午4:03
* Desc:
*/
public abstract class CommonImageLoader {
private String mImagePath;
public CommonImageLoader(String imagePath) {
mImagePath = imagePath;
}
public abstract void loadImageView(ImageView imageView, String imagePath);
public String getImagePath() {
return mImagePath;
}
}
| UTF-8 | Java | 455 | java | CommonImageLoader.java | Java | [
{
"context": "mport android.widget.ImageView;\n\n/**\n * Created by jack\n * Date:2018/7/19 下午4:03\n * Desc:\n */\npublic abst",
"end": 95,
"score": 0.8326669335365295,
"start": 91,
"tag": "NAME",
"value": "jack"
}
] | null | [] | package cn.jake.share.frdialog.image;
import android.widget.ImageView;
/**
* Created by jack
* Date:2018/7/19 下午4:03
* Desc:
*/
public abstract class CommonImageLoader {
private String mImagePath;
public CommonImageLoader(String imagePath) {
mImagePath = imagePath;
}
public abstract void loadImageView(ImageView imageView, String imagePath);
public String getImagePath() {
return mImagePath;
}
}
| 455 | 0.697987 | 0.675615 | 23 | 18.434782 | 20.185717 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.304348 | false | false | 13 |
a82365e1a450c0da84f4dcf6d05e03991df1091f | 146,028,900,837 | f164c4eb45b5b98d7030ccca305e010ae5021417 | /app/src/main/java/asako/clase/rutas/UI/FragmentoPuntos.java | 5873db243815df660fdf267c97f133b0ecd8c0df | [] | no_license | andresako/aRutas | https://github.com/andresako/aRutas | 7ff6d3bade4c46dd92ed1a109545a7da6b08905a | 1f837e7d21d292430bef7139d39bb73197f5c1d8 | refs/heads/master | 2021-01-01T05:29:17.468000 | 2016-05-19T09:38:56 | 2016-05-19T09:38:56 | 57,226,768 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package asako.clase.rutas.UI;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import asako.clase.rutas.Clases.Punto;
import asako.clase.rutas.R;
import asako.clase.rutas.Tools.AdaptadorPunto;
import asako.clase.rutas.Tools.MiConfig;
public class FragmentoPuntos extends Fragment {
private LinearLayoutManager linearLayout;
private FloatingActionButton fabPunto;
private MiConfig datos;
public FragmentoPuntos() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragmento_puntos, container, false);
setHasOptionsMenu(true);
PantallaInicio pa = (PantallaInicio) getActivity();
datos = pa.datos;
RecyclerView reciclador = (RecyclerView) view.findViewById(R.id.reciclador);
linearLayout = new LinearLayoutManager(getActivity());
reciclador.setLayoutManager(linearLayout);
fabPunto = (FloatingActionButton) view.findViewById(R.id.addPunto);
fabPunto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Punto ctPnt = new Punto();
Bundle args = new Bundle();
args.putParcelable("punto", ctPnt);
Fragment fg = new FragmentoPunto();
fg.setArguments(args);
FragmentTransaction fT = getActivity().getSupportFragmentManager().beginTransaction();
fT.replace(R.id.contenedor_principal, fg, "puntoActivo");
fT.addToBackStack(null);
fT.commit();
}
});
AdaptadorPunto adaptador = new AdaptadorPunto(datos.getListaPuntos(), getFragmentManager(), true);
reciclador.setAdapter(adaptador);
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
super.onCreateOptionsMenu(menu, inflater);
}
}
| UTF-8 | Java | 2,403 | java | FragmentoPuntos.java | Java | [] | null | [] | package asako.clase.rutas.UI;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import asako.clase.rutas.Clases.Punto;
import asako.clase.rutas.R;
import asako.clase.rutas.Tools.AdaptadorPunto;
import asako.clase.rutas.Tools.MiConfig;
public class FragmentoPuntos extends Fragment {
private LinearLayoutManager linearLayout;
private FloatingActionButton fabPunto;
private MiConfig datos;
public FragmentoPuntos() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragmento_puntos, container, false);
setHasOptionsMenu(true);
PantallaInicio pa = (PantallaInicio) getActivity();
datos = pa.datos;
RecyclerView reciclador = (RecyclerView) view.findViewById(R.id.reciclador);
linearLayout = new LinearLayoutManager(getActivity());
reciclador.setLayoutManager(linearLayout);
fabPunto = (FloatingActionButton) view.findViewById(R.id.addPunto);
fabPunto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Punto ctPnt = new Punto();
Bundle args = new Bundle();
args.putParcelable("punto", ctPnt);
Fragment fg = new FragmentoPunto();
fg.setArguments(args);
FragmentTransaction fT = getActivity().getSupportFragmentManager().beginTransaction();
fT.replace(R.id.contenedor_principal, fg, "puntoActivo");
fT.addToBackStack(null);
fT.commit();
}
});
AdaptadorPunto adaptador = new AdaptadorPunto(datos.getListaPuntos(), getFragmentManager(), true);
reciclador.setAdapter(adaptador);
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
super.onCreateOptionsMenu(menu, inflater);
}
}
| 2,403 | 0.691635 | 0.689971 | 72 | 32.375 | 27.481022 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.736111 | false | false | 13 |
fe34f441ac66fc2a7ea1ea550df912475dd73dcc | 19,954,418,070,940 | 6f672fb72caedccb841ee23f53e32aceeaf1895e | /Shopping/offerup_source/src/com/offerup/android/dto/Follow.java | 5fabaf2a5bb07625ae1127bdb64b1948a470ed92 | [] | no_license | cha63506/CompSecurity | https://github.com/cha63506/CompSecurity | 5c69743f660b9899146ed3cf21eceabe3d5f4280 | eee7e74f4088b9c02dd711c061fc04fb1e4e2654 | refs/heads/master | 2018-03-23T04:15:18.480000 | 2015-12-19T01:29:58 | 2015-12-19T01:29:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.offerup.android.dto;
// Referenced classes of package com.offerup.android.dto:
// FollowPerson
public class Follow
{
String created;
FollowPerson follows;
long id;
int notification_preference;
public Follow()
{
}
public String getCreated()
{
return created;
}
public FollowPerson getFollows()
{
return follows;
}
public long getId()
{
return id;
}
public int getNotification_preference()
{
return notification_preference;
}
public void setCreated(String s)
{
created = s;
}
public void setFollows(FollowPerson followperson)
{
follows = followperson;
}
public void setId(long l)
{
id = l;
}
public void setNotification_preference(int i)
{
notification_preference = i;
}
public String toString()
{
return (new StringBuilder("Follow [follows=")).append(follows).append(", id=").append(id).append(", notification_preference=").append(notification_preference).append(", created=").append(created).append("]").toString();
}
}
| UTF-8 | Java | 1,340 | java | Follow.java | Java | [
{
"context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus",
"end": 61,
"score": 0.9996644258499146,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null | [] | // Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.offerup.android.dto;
// Referenced classes of package com.offerup.android.dto:
// FollowPerson
public class Follow
{
String created;
FollowPerson follows;
long id;
int notification_preference;
public Follow()
{
}
public String getCreated()
{
return created;
}
public FollowPerson getFollows()
{
return follows;
}
public long getId()
{
return id;
}
public int getNotification_preference()
{
return notification_preference;
}
public void setCreated(String s)
{
created = s;
}
public void setFollows(FollowPerson followperson)
{
follows = followperson;
}
public void setId(long l)
{
id = l;
}
public void setNotification_preference(int i)
{
notification_preference = i;
}
public String toString()
{
return (new StringBuilder("Follow [follows=")).append(follows).append(", id=").append(id).append(", notification_preference=").append(notification_preference).append(", created=").append(created).append("]").toString();
}
}
| 1,330 | 0.621642 | 0.616418 | 67 | 19 | 30.89607 | 227 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.253731 | false | false | 13 |
9436a3f1ea4845f5494a1219e10526c3ddf147c4 | 18,124,762,053,817 | 2cda52fe285dc1cc72e568289b68fe0a1eb97a3b | /Mofi/DataBaseOperation/app/src/main/java/com/example/cravrr/databaseoperation/SQLiteDataBaseHandeler.java | 04de5a90726fe8c2eee66c126a228abd14e578f1 | [] | no_license | rajnishrajput/repo3 | https://github.com/rajnishrajput/repo3 | e0d300adf8a9ff0373b910992d981eaf32f1043e | e9336e2433f20c36e99b482fdc6e3ebba6e11a77 | refs/heads/master | 2021-08-23T14:50:57.843000 | 2017-12-05T09:01:25 | 2017-12-05T09:01:25 | 113,155,562 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.cravrr.databaseoperation;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Cravrr on 11/16/2017.
*/
public class SQLiteDataBaseHandeler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION=1;
private static final String DATABASE_NAME="Employdb";
private static final String TABLE_NAME="Employee";
private static final String FName="Fname";
private static final String LName="Lname";
private static final String Job="Job";
private static final String Salary="Salary";
public SQLiteDataBaseHandeler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
}
| UTF-8 | Java | 934 | java | SQLiteDataBaseHandeler.java | Java | [
{
"context": "tabase.sqlite.SQLiteOpenHelper;\n\n/**\n * Created by Cravrr on 11/16/2017.\n */\n\npublic class SQLiteDataBaseHa",
"end": 200,
"score": 0.9996080994606018,
"start": 194,
"tag": "USERNAME",
"value": "Cravrr"
}
] | null | [] | package com.example.cravrr.databaseoperation;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Cravrr on 11/16/2017.
*/
public class SQLiteDataBaseHandeler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION=1;
private static final String DATABASE_NAME="Employdb";
private static final String TABLE_NAME="Employee";
private static final String FName="Fname";
private static final String LName="Lname";
private static final String Job="Job";
private static final String Salary="Salary";
public SQLiteDataBaseHandeler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
}
| 934 | 0.739829 | 0.729122 | 34 | 26.470589 | 24.839764 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
0462700da610b8fee7a0da226d7f200ab4bfecc4 | 18,124,762,051,094 | 918dcc478125ac99e71f064d2fa62fbc54075545 | /src/main/java/steps/SearchSteps.java | 028db9429de4a9863a71f194acd915e54e2cab66 | [] | no_license | julkimart/selenium_final | https://github.com/julkimart/selenium_final | 592571e9ff5fe4bc6964f01af33fdf225d6cfddc | 9aeb6fae18f438bfcd797644ef335d6605b1da1e | refs/heads/master | 2020-03-21T08:33:30.560000 | 2018-06-22T21:49:11 | 2018-06-22T21:49:11 | 138,350,792 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package steps;
import pages.SearchPage;
import ru.yandex.qatools.allure.annotations.Step;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class SearchSteps {
@Step("заголовок страницы - Все фильтры")
public void stepTitleSearch(String expectedTitle) {
String actualTitle = new SearchPage().titleSearch.getText();
assertTrue(String.format("Заголовок равен [%s]. Ожидалось - [%s]",
actualTitle, expectedTitle), actualTitle.contains(expectedTitle));
}
@Step("поле {0} заполняется значением {1}")
public void stepFillField(String field, String value) {
new SearchPage().fillField(field, value);
}
@Step("заполняются поля")
public void stepFillFields(HashMap<String, String> fields) {
fields.forEach(this::stepFillField);
}
@Step("поле {0} заполнено значением {1}")
public void stepCheckFillField(String field, String value) {
String actual = new SearchPage().getFillField(field);
assertTrue(String.format("Значение поля [%s] равно [%s]. Ожидалось - [%s]", field, actual, value),
actual.equals(value));
}
@Step("выбран бренд в расширенном поиске - {0}")
public void stepChooseLabel(String labelItem) {
new SearchPage().chooseLabel(labelItem);
}
@Step("выполнено нажатие на кнопку - Показать подходящие")
public void stepApplyButton() {
new SearchPage().applyButton.click();
}
@Step("выполнена проверка по количеству найденных товаров - {0}")
public void stepCheckCountProducts(int expectedValue) {
int actualValue = new SearchPage().getSizeFoundedProducts();
assertEquals(actualValue, expectedValue, 0);
}
//вид товаров - список
@Step("выполнен выбор отображения товаров - список")
public void stepListView() {
new SearchPage().listView.click();
}
String expectedElement;
//первый элемент в списке запомнен
@Step("первый элемент в списке запомнен")
public void stepRememberExpectedElement() {
expectedElement = new SearchPage().getFirstElement();
}
@Step("в поисковую строку ввести запомненное значение")
public void stepFillFieldSearch() {
new SearchPage().fillFieldSearch(expectedElement);
}
@Step("выполнено нажатие на кнопку - Поиск")
public void stepSearchButton() {
new SearchPage().searchButton.click();
}
@Step("появился новый элемент после нового поиска")
public void stepWaitElementFromNewSearch() {
new SearchPage().waitElementFromNewSearch();
}
@Step("выполнена проверка: запомненный элемент равен новому найденному")
public void stepCheckElements() {
String actualElement = new SearchPage().elementFromNewSearch.getText();
assertTrue(String.format("Элемент равен [%s]. Ожидалось - [%s]",
actualElement, expectedElement), actualElement.contains(expectedElement));
}
//открыть первые найденные наушники после поиска
@Step("открыть первый новый найденный элемент среди наушников")
public void stepNewElementFromBeats() {
new SearchPage().newElementFromBeats();
}
}
| UTF-8 | Java | 3,882 | java | SearchSteps.java | Java | [] | null | [] | package steps;
import pages.SearchPage;
import ru.yandex.qatools.allure.annotations.Step;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class SearchSteps {
@Step("заголовок страницы - Все фильтры")
public void stepTitleSearch(String expectedTitle) {
String actualTitle = new SearchPage().titleSearch.getText();
assertTrue(String.format("Заголовок равен [%s]. Ожидалось - [%s]",
actualTitle, expectedTitle), actualTitle.contains(expectedTitle));
}
@Step("поле {0} заполняется значением {1}")
public void stepFillField(String field, String value) {
new SearchPage().fillField(field, value);
}
@Step("заполняются поля")
public void stepFillFields(HashMap<String, String> fields) {
fields.forEach(this::stepFillField);
}
@Step("поле {0} заполнено значением {1}")
public void stepCheckFillField(String field, String value) {
String actual = new SearchPage().getFillField(field);
assertTrue(String.format("Значение поля [%s] равно [%s]. Ожидалось - [%s]", field, actual, value),
actual.equals(value));
}
@Step("выбран бренд в расширенном поиске - {0}")
public void stepChooseLabel(String labelItem) {
new SearchPage().chooseLabel(labelItem);
}
@Step("выполнено нажатие на кнопку - Показать подходящие")
public void stepApplyButton() {
new SearchPage().applyButton.click();
}
@Step("выполнена проверка по количеству найденных товаров - {0}")
public void stepCheckCountProducts(int expectedValue) {
int actualValue = new SearchPage().getSizeFoundedProducts();
assertEquals(actualValue, expectedValue, 0);
}
//вид товаров - список
@Step("выполнен выбор отображения товаров - список")
public void stepListView() {
new SearchPage().listView.click();
}
String expectedElement;
//первый элемент в списке запомнен
@Step("первый элемент в списке запомнен")
public void stepRememberExpectedElement() {
expectedElement = new SearchPage().getFirstElement();
}
@Step("в поисковую строку ввести запомненное значение")
public void stepFillFieldSearch() {
new SearchPage().fillFieldSearch(expectedElement);
}
@Step("выполнено нажатие на кнопку - Поиск")
public void stepSearchButton() {
new SearchPage().searchButton.click();
}
@Step("появился новый элемент после нового поиска")
public void stepWaitElementFromNewSearch() {
new SearchPage().waitElementFromNewSearch();
}
@Step("выполнена проверка: запомненный элемент равен новому найденному")
public void stepCheckElements() {
String actualElement = new SearchPage().elementFromNewSearch.getText();
assertTrue(String.format("Элемент равен [%s]. Ожидалось - [%s]",
actualElement, expectedElement), actualElement.contains(expectedElement));
}
//открыть первые найденные наушники после поиска
@Step("открыть первый новый найденный элемент среди наушников")
public void stepNewElementFromBeats() {
new SearchPage().newElementFromBeats();
}
}
| 3,882 | 0.6834 | 0.681244 | 102 | 30.82353 | 27.655588 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.401961 | false | false | 13 |
7275c4abd019bb63eb373aee09ed5c7b2196d4b0 | 32,143,535,260,486 | f9959087f747f627ef4cbad168d04f86445fccd4 | /src/main/java/com/emc/ecs/nfsclient/nfs/NfsLookupResponse.java | 07901415ea9c6300f00721895b3629d18108394c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | EMCECS/nfs-client-java | https://github.com/EMCECS/nfs-client-java | 6409e5ff60f6828a82a9ec22de2a1e8f4399b869 | 8d157a625e50d05155a46600ffb06527be3fa6ed | refs/heads/master | 2022-10-31T03:30:37.003000 | 2022-07-15T16:29:34 | 2022-07-15T16:29:34 | 63,360,372 | 66 | 35 | Apache-2.0 | false | 2022-10-25T11:56:46 | 2016-07-14T18:31:56 | 2022-09-24T07:06:13 | 2022-07-15T16:29:34 | 2,329 | 51 | 31 | 14 | Java | false | false | /**
* Copyright 2016-2018 Dell Inc. or its subsidiaries. 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://www.apache.org/licenses/LICENSE-2.0.txt
*
* 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.emc.ecs.nfsclient.nfs;
import com.emc.ecs.nfsclient.rpc.RpcException;
import com.emc.ecs.nfsclient.rpc.Xdr;
/**
* The response, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
*
* <p>
* Procedure LOOKUP searches a directory for a specific name and returns the
* file handle for the corresponding file system object.
* </p>
*
* @author seibed
*/
public class NfsLookupResponse extends NfsResponseBase {
/**
* The post-operation attributes for the directory.
*/
private NfsGetAttributes _directoryAttributes;
/**
* Creates the response, as specified by RFC 1813
* (https://tools.ietf.org/html/rfc1813).
*
* <p>
* Procedure LOOKUP searches a directory for a specific name and returns the
* file handle for the corresponding file system object.
* </p>
*
* @param nfsVersion
* The NFS version number. This is ignored for now, as only NFSv3
* is supported, but is included to allow future support for
* other versions.
*/
public NfsLookupResponse(int nfsVersion) {
super();
}
/*
* (non-Javadoc)
*
* @see com.emc.ecs.nfsclient.nfs.NfsResponseBase#unmarshalling(com.emc.ecs.
* nfsclient.rpc.Xdr)
*/
public void unmarshalling(Xdr xdr) throws RpcException {
super.unmarshalling(xdr);
if (stateIsOk()) {
unmarshallingFileHandle(xdr, true);
unmarshallingAttributes(xdr);
}
_directoryAttributes = makeNfsGetAttributes(xdr);
}
/**
* @return The post-operation attributes for the directory.
*/
public NfsGetAttributes getDirectoryAttributes() {
return _directoryAttributes;
}
}
| UTF-8 | Java | 2,366 | java | NfsLookupResponse.java | Java | [
{
"context": "ponding file system object.\n * </p>\n * \n * @author seibed\n */\npublic class NfsLookupResponse extends NfsRes",
"end": 976,
"score": 0.9996165633201599,
"start": 970,
"tag": "USERNAME",
"value": "seibed"
}
] | null | [] | /**
* Copyright 2016-2018 Dell Inc. or its subsidiaries. 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://www.apache.org/licenses/LICENSE-2.0.txt
*
* 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.emc.ecs.nfsclient.nfs;
import com.emc.ecs.nfsclient.rpc.RpcException;
import com.emc.ecs.nfsclient.rpc.Xdr;
/**
* The response, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
*
* <p>
* Procedure LOOKUP searches a directory for a specific name and returns the
* file handle for the corresponding file system object.
* </p>
*
* @author seibed
*/
public class NfsLookupResponse extends NfsResponseBase {
/**
* The post-operation attributes for the directory.
*/
private NfsGetAttributes _directoryAttributes;
/**
* Creates the response, as specified by RFC 1813
* (https://tools.ietf.org/html/rfc1813).
*
* <p>
* Procedure LOOKUP searches a directory for a specific name and returns the
* file handle for the corresponding file system object.
* </p>
*
* @param nfsVersion
* The NFS version number. This is ignored for now, as only NFSv3
* is supported, but is included to allow future support for
* other versions.
*/
public NfsLookupResponse(int nfsVersion) {
super();
}
/*
* (non-Javadoc)
*
* @see com.emc.ecs.nfsclient.nfs.NfsResponseBase#unmarshalling(com.emc.ecs.
* nfsclient.rpc.Xdr)
*/
public void unmarshalling(Xdr xdr) throws RpcException {
super.unmarshalling(xdr);
if (stateIsOk()) {
unmarshallingFileHandle(xdr, true);
unmarshallingAttributes(xdr);
}
_directoryAttributes = makeNfsGetAttributes(xdr);
}
/**
* @return The post-operation attributes for the directory.
*/
public NfsGetAttributes getDirectoryAttributes() {
return _directoryAttributes;
}
}
| 2,366 | 0.662299 | 0.650042 | 77 | 29.727272 | 27.566513 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.233766 | false | false | 13 |
c41bcbbf48660dd2ad554f4006f161076b05eb71 | 18,915,035,994,246 | c8e934b6f99222a10e067a3fab34f39f10f8ea7e | /com/google/android/android/common/server/converter/MapPack.java | 14fdb0aa2a4ae1278d28597a0fea9b02a4672f18 | [] | no_license | ZPERO/Secret-Dungeon-Finder-Tool | https://github.com/ZPERO/Secret-Dungeon-Finder-Tool | 19efef8ebe044d48215cdaeaac6384cf44ee35b9 | c3c97e320a81b9073dbb5b99f200e99d8f4b26cc | refs/heads/master | 2020-12-19T08:54:26.313000 | 2020-01-22T23:00:08 | 2020-01-22T23:00:08 | 235,683,952 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.google.android.android.common.server.converter;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.android.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.android.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.android.common.server.response.FastJsonResponse.FieldConverter;
import com.google.android.gms.common.server.converter.zaa;
public final class MapPack
extends AbstractSafeParcelable
{
public static final Parcelable.Creator<zaa> CREATOR = new VerticalProgressBar.SavedState.1();
private final int zale;
private final StringToIntConverter zapk;
MapPack(int paramInt, StringToIntConverter paramStringToIntConverter)
{
zale = paramInt;
zapk = paramStringToIntConverter;
}
private MapPack(StringToIntConverter paramStringToIntConverter)
{
zale = 1;
zapk = paramStringToIntConverter;
}
public static MapPack getSize(FastJsonResponse.FieldConverter paramFieldConverter)
{
if ((paramFieldConverter instanceof StringToIntConverter)) {
return new MapPack((StringToIntConverter)paramFieldConverter);
}
throw new IllegalArgumentException("Unsupported safe parcelable field converter class.");
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
int i = SafeParcelWriter.beginObjectHeader(paramParcel);
SafeParcelWriter.writeInt(paramParcel, 1, zale);
SafeParcelWriter.writeParcelable(paramParcel, 2, zapk, paramInt, false);
SafeParcelWriter.finishObjectHeader(paramParcel, i);
}
public final FastJsonResponse.FieldConverter zaci()
{
StringToIntConverter localStringToIntConverter = zapk;
if (localStringToIntConverter != null) {
return localStringToIntConverter;
}
throw new IllegalStateException("There was no converter wrapped in this ConverterWrapper.");
}
}
| UTF-8 | Java | 1,908 | java | MapPack.java | Java | [] | null | [] | package com.google.android.android.common.server.converter;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.android.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.android.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.android.common.server.response.FastJsonResponse.FieldConverter;
import com.google.android.gms.common.server.converter.zaa;
public final class MapPack
extends AbstractSafeParcelable
{
public static final Parcelable.Creator<zaa> CREATOR = new VerticalProgressBar.SavedState.1();
private final int zale;
private final StringToIntConverter zapk;
MapPack(int paramInt, StringToIntConverter paramStringToIntConverter)
{
zale = paramInt;
zapk = paramStringToIntConverter;
}
private MapPack(StringToIntConverter paramStringToIntConverter)
{
zale = 1;
zapk = paramStringToIntConverter;
}
public static MapPack getSize(FastJsonResponse.FieldConverter paramFieldConverter)
{
if ((paramFieldConverter instanceof StringToIntConverter)) {
return new MapPack((StringToIntConverter)paramFieldConverter);
}
throw new IllegalArgumentException("Unsupported safe parcelable field converter class.");
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
int i = SafeParcelWriter.beginObjectHeader(paramParcel);
SafeParcelWriter.writeInt(paramParcel, 1, zale);
SafeParcelWriter.writeParcelable(paramParcel, 2, zapk, paramInt, false);
SafeParcelWriter.finishObjectHeader(paramParcel, i);
}
public final FastJsonResponse.FieldConverter zaci()
{
StringToIntConverter localStringToIntConverter = zapk;
if (localStringToIntConverter != null) {
return localStringToIntConverter;
}
throw new IllegalStateException("There was no converter wrapped in this ConverterWrapper.");
}
}
| 1,908 | 0.784591 | 0.782495 | 53 | 35 | 31.860546 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.603774 | false | false | 13 |
4e6b2ed8a9aaf9fafd6e36fe8fe3d7fde30c7013 | 20,950,850,519,179 | f4941ef4518dccd12bd9821262da3c0648ce8167 | /java/cfbam/src/net.sourceforge.msscf.cfbam/net/sourceforge/msscf/cfbam/CFBam/ICFBamISOLanguageTable.java | 54b5561ef08ef18968355e82104bede2331ebd5c | [
"Apache-2.0"
] | permissive | msobkow/net-sourceforge-MSSCodeFactory-CFBam-2-10 | https://github.com/msobkow/net-sourceforge-MSSCodeFactory-CFBam-2-10 | 7eba60dfd78fbb60bc4de2f662a55d9ec49b5171 | 15b0494ef78251f03dd69bc37ce8dc0862295215 | refs/heads/master | 2019-05-08T10:17:53.989000 | 2019-05-01T00:52:54 | 2019-05-01T00:52:54 | 56,207,766 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Description: Java 11 DbIO interface for ISOLanguage.
/*
* net.sourceforge.MssCF.CFBam
*
* Copyright (c) 2018-2019 Mark Stephen Sobkow
*
* 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.
*
* Manufactured by MSS Code Factory 2.9.10102
*/
package net.sourceforge.msscf.cfbam.CFBam;
import java.lang.reflect.*;
import java.net.*;
import java.rmi.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import net.sourceforge.msscf.cflib.CFLib.*;
import net.sourceforge.msscf.cfsecurity.CFSecurity.*;
import net.sourceforge.msscf.cfinternet.CFInternet.*;
import net.sourceforge.msscf.cfsecurity.CFSecurityObj.*;
import net.sourceforge.msscf.cfinternet.CFInternetObj.*;
import net.sourceforge.msscf.cfbam.CFBamObj.*;
/*
* CFBamISOLanguageTable database interface for ISOLanguage
*/
public interface ICFBamISOLanguageTable
extends ICFSecurityISOLanguageTable,
ICFInternetISOLanguageTable
{
/**
* Create the instance in the database, and update the specified buffer
* with the assigned primary key.
*
* @param Authorization The session authorization information.
*
* @param Buff The buffer to be created.
*/
void createISOLanguage( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageBuff Buff );
/**
* Update the instance in the database, and update the specified buffer
* with any calculated changes imposed by the associated stored procedure.
*
* @param Authorization The session authorization information.
*
* @param Buff The buffer to be updated.
*/
void updateISOLanguage( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageBuff Buff );
/**
* Delete the instance from the database.
*
* @param Authorization The session authorization information.
*
* @param Buff The buffer to be deleted.
*/
void deleteISOLanguage( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageBuff Buff );
/**
* Delete the ISOLanguage instance identified by the primary key attributes.
*
* @param Authorization The session authorization information.
*
* @param argISOLanguageId The ISOLanguage key attribute of the instance generating the id.
*/
void deleteISOLanguageByIdIdx( CFSecurityAuthorization Authorization,
short argISOLanguageId );
/**
* Delete the ISOLanguage instance identified by the primary key.
*
* @param Authorization The session authorization information.
*
* @param argKey The primary key identifying the instance to be deleted.
*/
void deleteISOLanguageByIdIdx( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey argKey );
/**
* Delete the ISOLanguage instances identified by the key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6392Code The ISOLanguage key attribute of the instance generating the id.
*/
void deleteISOLanguageByCode3Idx( CFSecurityAuthorization Authorization,
String argISO6392Code );
/**
* Delete the ISOLanguage instances identified by the key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argKey The key identifying the instances to be deleted.
*/
void deleteISOLanguageByCode3Idx( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageByCode3IdxKey argKey );
/**
* Delete the ISOLanguage instances identified by the key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6391Code The ISOLanguage key attribute of the instance generating the id.
*/
void deleteISOLanguageByCode2Idx( CFSecurityAuthorization Authorization,
String argISO6391Code );
/**
* Delete the ISOLanguage instances identified by the key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argKey The key identifying the instances to be deleted.
*/
void deleteISOLanguageByCode2Idx( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageByCode2IdxKey argKey );
/**
* Read the derived ISOLanguage buffer instance by primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be read.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff readDerived( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Lock the derived ISOLanguage buffer instance by primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be locked.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff lockDerived( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Read all ISOLanguage instances.
*
* @param Authorization The session authorization information.
*
* @return An array of derived buffer instances, potentially with 0 elements in the set.
*/
CFSecurityISOLanguageBuff[] readAllDerived( CFSecurityAuthorization Authorization );
/**
* Read the derived ISOLanguage buffer instance identified by the unique key IdIdx.
*
* @param Authorization The session authorization information.
*
* @param argISOLanguageId The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff readDerivedByIdIdx( CFSecurityAuthorization Authorization,
short ISOLanguageId );
/**
* Read the derived ISOLanguage buffer instance identified by the unique key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6392Code The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff readDerivedByCode3Idx( CFSecurityAuthorization Authorization,
String ISO6392Code );
/**
* Read an array of the derived ISOLanguage buffer instances identified by the duplicate key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6391Code The ISOLanguage key attribute of the instance generating the id.
*
* @return An array of derived buffer instances for the specified key, potentially with 0 elements in the set.
*/
CFSecurityISOLanguageBuff[] readDerivedByCode2Idx( CFSecurityAuthorization Authorization,
String ISO6391Code );
/**
* Read the specific ISOLanguage buffer instance identified by the primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be locked.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff readBuff( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Lock the specific ISOLanguage buffer instance identified by the primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be locked.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff lockBuff( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Read all the specific ISOLanguage buffer instances.
*
* @param Authorization The session authorization information.
*
* @return All the specific ISOLanguage instances in the database accessible for the Authorization.
*/
CFSecurityISOLanguageBuff[] readAllBuff( CFSecurityAuthorization Authorization );
/**
* Read the specific ISOLanguage buffer instance identified by the unique key IdIdx.
*
* @param Authorization The session authorization information.
*
* @param argISOLanguageId The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff readBuffByIdIdx( CFSecurityAuthorization Authorization,
short ISOLanguageId );
/**
* Read the specific ISOLanguage buffer instance identified by the unique key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6392Code The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff readBuffByCode3Idx( CFSecurityAuthorization Authorization,
String ISO6392Code );
/**
* Read an array of the specific ISOLanguage buffer instances identified by the duplicate key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6391Code The ISOLanguage key attribute of the instance generating the id.
*
* @return An array of derived buffer instances for the specified key, potentially with 0 elements in the set.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff[] readBuffByCode2Idx( CFSecurityAuthorization Authorization,
String ISO6391Code );
/**
* Release any prepared statements allocated by this instance.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
void releasePreparedStatements();
}
| UTF-8 | Java | 10,472 | java | ICFBamISOLanguageTable.java | Java | [
{
"context": "rceforge.MssCF.CFBam\n *\n *\tCopyright (c) 2018-2019 Mark Stephen Sobkow\n *\t\n *\tLicensed under the Apache License, Version",
"end": 141,
"score": 0.9997720718383789,
"start": 122,
"tag": "NAME",
"value": "Mark Stephen Sobkow"
}
] | null | [] |
// Description: Java 11 DbIO interface for ISOLanguage.
/*
* net.sourceforge.MssCF.CFBam
*
* Copyright (c) 2018-2019 <NAME>
*
* 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.
*
* Manufactured by MSS Code Factory 2.9.10102
*/
package net.sourceforge.msscf.cfbam.CFBam;
import java.lang.reflect.*;
import java.net.*;
import java.rmi.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import net.sourceforge.msscf.cflib.CFLib.*;
import net.sourceforge.msscf.cfsecurity.CFSecurity.*;
import net.sourceforge.msscf.cfinternet.CFInternet.*;
import net.sourceforge.msscf.cfsecurity.CFSecurityObj.*;
import net.sourceforge.msscf.cfinternet.CFInternetObj.*;
import net.sourceforge.msscf.cfbam.CFBamObj.*;
/*
* CFBamISOLanguageTable database interface for ISOLanguage
*/
public interface ICFBamISOLanguageTable
extends ICFSecurityISOLanguageTable,
ICFInternetISOLanguageTable
{
/**
* Create the instance in the database, and update the specified buffer
* with the assigned primary key.
*
* @param Authorization The session authorization information.
*
* @param Buff The buffer to be created.
*/
void createISOLanguage( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageBuff Buff );
/**
* Update the instance in the database, and update the specified buffer
* with any calculated changes imposed by the associated stored procedure.
*
* @param Authorization The session authorization information.
*
* @param Buff The buffer to be updated.
*/
void updateISOLanguage( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageBuff Buff );
/**
* Delete the instance from the database.
*
* @param Authorization The session authorization information.
*
* @param Buff The buffer to be deleted.
*/
void deleteISOLanguage( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageBuff Buff );
/**
* Delete the ISOLanguage instance identified by the primary key attributes.
*
* @param Authorization The session authorization information.
*
* @param argISOLanguageId The ISOLanguage key attribute of the instance generating the id.
*/
void deleteISOLanguageByIdIdx( CFSecurityAuthorization Authorization,
short argISOLanguageId );
/**
* Delete the ISOLanguage instance identified by the primary key.
*
* @param Authorization The session authorization information.
*
* @param argKey The primary key identifying the instance to be deleted.
*/
void deleteISOLanguageByIdIdx( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey argKey );
/**
* Delete the ISOLanguage instances identified by the key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6392Code The ISOLanguage key attribute of the instance generating the id.
*/
void deleteISOLanguageByCode3Idx( CFSecurityAuthorization Authorization,
String argISO6392Code );
/**
* Delete the ISOLanguage instances identified by the key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argKey The key identifying the instances to be deleted.
*/
void deleteISOLanguageByCode3Idx( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageByCode3IdxKey argKey );
/**
* Delete the ISOLanguage instances identified by the key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6391Code The ISOLanguage key attribute of the instance generating the id.
*/
void deleteISOLanguageByCode2Idx( CFSecurityAuthorization Authorization,
String argISO6391Code );
/**
* Delete the ISOLanguage instances identified by the key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argKey The key identifying the instances to be deleted.
*/
void deleteISOLanguageByCode2Idx( CFSecurityAuthorization Authorization,
CFSecurityISOLanguageByCode2IdxKey argKey );
/**
* Read the derived ISOLanguage buffer instance by primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be read.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff readDerived( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Lock the derived ISOLanguage buffer instance by primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be locked.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff lockDerived( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Read all ISOLanguage instances.
*
* @param Authorization The session authorization information.
*
* @return An array of derived buffer instances, potentially with 0 elements in the set.
*/
CFSecurityISOLanguageBuff[] readAllDerived( CFSecurityAuthorization Authorization );
/**
* Read the derived ISOLanguage buffer instance identified by the unique key IdIdx.
*
* @param Authorization The session authorization information.
*
* @param argISOLanguageId The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff readDerivedByIdIdx( CFSecurityAuthorization Authorization,
short ISOLanguageId );
/**
* Read the derived ISOLanguage buffer instance identified by the unique key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6392Code The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*/
CFSecurityISOLanguageBuff readDerivedByCode3Idx( CFSecurityAuthorization Authorization,
String ISO6392Code );
/**
* Read an array of the derived ISOLanguage buffer instances identified by the duplicate key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6391Code The ISOLanguage key attribute of the instance generating the id.
*
* @return An array of derived buffer instances for the specified key, potentially with 0 elements in the set.
*/
CFSecurityISOLanguageBuff[] readDerivedByCode2Idx( CFSecurityAuthorization Authorization,
String ISO6391Code );
/**
* Read the specific ISOLanguage buffer instance identified by the primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be locked.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff readBuff( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Lock the specific ISOLanguage buffer instance identified by the primary key.
*
* @param Authorization The session authorization information.
*
* @param PKey The primary key of the ISOLanguage instance to be locked.
*
* @return The buffer instance for the specified primary key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff lockBuff( CFSecurityAuthorization Authorization,
CFSecurityISOLanguagePKey PKey );
/**
* Read all the specific ISOLanguage buffer instances.
*
* @param Authorization The session authorization information.
*
* @return All the specific ISOLanguage instances in the database accessible for the Authorization.
*/
CFSecurityISOLanguageBuff[] readAllBuff( CFSecurityAuthorization Authorization );
/**
* Read the specific ISOLanguage buffer instance identified by the unique key IdIdx.
*
* @param Authorization The session authorization information.
*
* @param argISOLanguageId The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff readBuffByIdIdx( CFSecurityAuthorization Authorization,
short ISOLanguageId );
/**
* Read the specific ISOLanguage buffer instance identified by the unique key Code3Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6392Code The ISOLanguage key attribute of the instance generating the id.
*
* @return The buffer instance for the specified key, or null if there is
* no such existing key value.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff readBuffByCode3Idx( CFSecurityAuthorization Authorization,
String ISO6392Code );
/**
* Read an array of the specific ISOLanguage buffer instances identified by the duplicate key Code2Idx.
*
* @param Authorization The session authorization information.
*
* @param argISO6391Code The ISOLanguage key attribute of the instance generating the id.
*
* @return An array of derived buffer instances for the specified key, potentially with 0 elements in the set.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
CFSecurityISOLanguageBuff[] readBuffByCode2Idx( CFSecurityAuthorization Authorization,
String ISO6391Code );
/**
* Release any prepared statements allocated by this instance.
*
* @throws CFLibNotSupportedException thrown by client-side implementations.
*/
void releasePreparedStatements();
}
| 10,459 | 0.766711 | 0.758117 | 300 | 33.903332 | 33.264606 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false | 13 |
d6fb14758e373d08395747b1801a7d7dcf151e54 | 24,618,752,544,094 | 58978f9da442ec0310117af80012c41cac712ea1 | /Solution.java | 3ca34b4d856d446f57c48e2ed82c9ba43f781ab7 | [] | no_license | nebukanezar/java_attendance | https://github.com/nebukanezar/java_attendance | bf0ed4cddea034164dc0db13abb538ecb31ee4e3 | d8ea7f2c5464ccffcb894c10aa3f20fa79571bb1 | refs/heads/master | 2021-01-10T07:06:20.046000 | 2016-03-08T09:56:09 | 2016-03-08T09:56:09 | 53,401,620 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
import java.io.*;
class Attendance{
void makeAttendance(String date,String employeefile){
File file = new File(employeefile);
BufferedReader reader=null;
Scanner sc = new Scanner(System.in);
try{
reader = new BufferedReader(new FileReader(file));
String text;
while ((text = reader.readLine()) != null) {
System.out.printf("%s:",text);
char c=sc.next().charAt(0);
String input="";
input = input + date + " " +text + " " +c+"\n";
this.writeAttendance(input,"employee_attendace.txt");
}
}catch(FileNotFoundException e){
System.out.println(e);
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
System.out.println("hoho");
}
System.out.println("Today's date is "+date);
}
private void writeAttendance(String write,String filename){
try{
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true));
out.write(write);
out.close();
}catch (IOException e){
System.out.println(e);
}
}
void singleAttendance(String write,String filename){
Scanner sc = new Scanner(System.in);
String employeeName,date,pORa;
System.out.printf("Enter employee name:");
employeeName = sc.nextLine();
System.out.printf("Enter date:");
date = sc.nextLine();
System.out.printf("Enter present(p) or absent(a)");
pORa=sc.nextLine();
System.out.println(employeeName+" "+date+" "+pORa);
String input=employeeName + " " + date + " " + pORa + "\n";
try{
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true));
out.write(input);
out.close();
}catch(IOException e){
System.out.println(e);
}
}
void markAbsent(String name,String date,String filename){
try{
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true));
String input = date + " " + name +" a";
out.write(input);
out.close();
}catch(IOException e){
System.out.println(e);
}
}
public ArrayList markUsers(String filename){
User user;
user = new User();
return (ArrayList)user.getUsersFromText(filename);
}
}
class User{
String username;
public ArrayList getUsersFromText(String fileName){
List<String> a1=new ArrayList<String>();
try{
File file = new File(fileName);
BufferedReader reader = null;
reader = new BufferedReader(new FileReader(file));
String text;
while((text=reader.readLine())!=null){
a1.add(text);
}
//System.out.print("farseee"+a1);
return (ArrayList)a1;
}catch(IOException e){
System.out.println(e);
}
return (ArrayList)a1;
}
}
class saveAttendance{
void saveText(List<String> a1){
System.out.println(a1);
}
}
public class Solution{
public static void main(String[] args){
Attendance present_attendace = new Attendance();
User user = new User();
present_attendace.makeAttendance("04-03-2016","employee.txt");
//present_attendace.makeAttendance("jhakkas","employee_attendace.txt");
//present_attendace.singleAttendance("google","yahoo");
//present_attendace.markAbsent("chetan","05-03-16","yahoo");
//ArrayList arr=user.getUsersFromText("employee.txt");
ArrayList arr2=present_attendace.markUsers("employee.txt");
System.out.println("jhakkas "+arr2);
}
}
| UTF-8 | Java | 3,198 | java | Solution.java | Java | [
{
"context": "yee.txt\");\n\t//present_attendace.makeAttendance(\"jhakkas\",\"employee_attendace.txt\");\n\t//present_attendace.",
"end": 2885,
"score": 0.7220104932785034,
"start": 2880,
"tag": "NAME",
"value": "akkas"
},
{
"context": "markUsers(\"employee.txt\");\n\t\n\tSystem.out.... | null | [] | import java.util.*;
import java.io.*;
class Attendance{
void makeAttendance(String date,String employeefile){
File file = new File(employeefile);
BufferedReader reader=null;
Scanner sc = new Scanner(System.in);
try{
reader = new BufferedReader(new FileReader(file));
String text;
while ((text = reader.readLine()) != null) {
System.out.printf("%s:",text);
char c=sc.next().charAt(0);
String input="";
input = input + date + " " +text + " " +c+"\n";
this.writeAttendance(input,"employee_attendace.txt");
}
}catch(FileNotFoundException e){
System.out.println(e);
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
System.out.println("hoho");
}
System.out.println("Today's date is "+date);
}
private void writeAttendance(String write,String filename){
try{
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true));
out.write(write);
out.close();
}catch (IOException e){
System.out.println(e);
}
}
void singleAttendance(String write,String filename){
Scanner sc = new Scanner(System.in);
String employeeName,date,pORa;
System.out.printf("Enter employee name:");
employeeName = sc.nextLine();
System.out.printf("Enter date:");
date = sc.nextLine();
System.out.printf("Enter present(p) or absent(a)");
pORa=sc.nextLine();
System.out.println(employeeName+" "+date+" "+pORa);
String input=employeeName + " " + date + " " + pORa + "\n";
try{
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true));
out.write(input);
out.close();
}catch(IOException e){
System.out.println(e);
}
}
void markAbsent(String name,String date,String filename){
try{
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true));
String input = date + " " + name +" a";
out.write(input);
out.close();
}catch(IOException e){
System.out.println(e);
}
}
public ArrayList markUsers(String filename){
User user;
user = new User();
return (ArrayList)user.getUsersFromText(filename);
}
}
class User{
String username;
public ArrayList getUsersFromText(String fileName){
List<String> a1=new ArrayList<String>();
try{
File file = new File(fileName);
BufferedReader reader = null;
reader = new BufferedReader(new FileReader(file));
String text;
while((text=reader.readLine())!=null){
a1.add(text);
}
//System.out.print("farseee"+a1);
return (ArrayList)a1;
}catch(IOException e){
System.out.println(e);
}
return (ArrayList)a1;
}
}
class saveAttendance{
void saveText(List<String> a1){
System.out.println(a1);
}
}
public class Solution{
public static void main(String[] args){
Attendance present_attendace = new Attendance();
User user = new User();
present_attendace.makeAttendance("04-03-2016","employee.txt");
//present_attendace.makeAttendance("jhakkas","employee_attendace.txt");
//present_attendace.singleAttendance("google","yahoo");
//present_attendace.markAbsent("chetan","05-03-16","yahoo");
//ArrayList arr=user.getUsersFromText("employee.txt");
ArrayList arr2=present_attendace.markUsers("employee.txt");
System.out.println("jhakkas "+arr2);
}
}
| 3,198 | 0.682301 | 0.674797 | 118 | 26.084745 | 20.63179 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.542373 | false | false | 13 |
ef0648fb9ac7276f1bd8f338a117c56f845d59a4 | 7,962,869,410,686 | 48fd50709d93f37509571a2a81bed4f1c96ca8d0 | /src/main/java/com/newstoday/common/core/exception/LoginException.java | b3432110399622c8c8ef02ee4a9e5751547120b0 | [] | no_license | zhangxuehuio/NewTodayServer | https://github.com/zhangxuehuio/NewTodayServer | 54b58b1c6d544c302c9182cf678db6344ec69113 | cfdd9c96b905eb75635bb6ddac38ab3bded92969 | refs/heads/master | 2020-02-22T09:03:27.580000 | 2017-08-29T02:46:40 | 2017-08-29T02:46:40 | 100,102,022 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.newstoday.common.core.exception;
import com.newstoday.common.core.exception.enums.ResultEnum;
/**
* Created by zhangxuehui on 2017/8/15.
*/
public class LoginException extends RuntimeException {
private Integer code;
public LoginException(ResultEnum resultEnum) {
super(resultEnum.getMsg());
this.code = resultEnum.getCode();
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
}
| UTF-8 | Java | 508 | java | LoginException.java | Java | [
{
"context": "ore.exception.enums.ResultEnum;\n\n/**\n * Created by zhangxuehui on 2017/8/15.\n */\npublic class LoginException ext",
"end": 137,
"score": 0.9989413619041443,
"start": 126,
"tag": "USERNAME",
"value": "zhangxuehui"
}
] | null | [] | package com.newstoday.common.core.exception;
import com.newstoday.common.core.exception.enums.ResultEnum;
/**
* Created by zhangxuehui on 2017/8/15.
*/
public class LoginException extends RuntimeException {
private Integer code;
public LoginException(ResultEnum resultEnum) {
super(resultEnum.getMsg());
this.code = resultEnum.getCode();
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
}
| 508 | 0.67126 | 0.65748 | 24 | 20.166666 | 20.190069 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.291667 | false | false | 13 |
6d545e683fae502bc1505e8c89e87905b3ad02f6 | 2,886,218,042,598 | 495dc5c0fd41f8801af8c04fc5daeded06d2a6af | /src/gestsaude/menu/MenuServico.java | 3fbb3c56c8f5efabb54eb638628ca66c3e84deb5 | [] | no_license | Grupo-EST/P2---tp1 | https://github.com/Grupo-EST/P2---tp1 | f668e37ab79aec5408ea18939ca86f8d80223676 | 5e8c3b2394602ed6d0f738f16ceabce69c4642a5 | refs/heads/master | 2022-06-19T15:10:46.938000 | 2020-05-08T20:27:26 | 2020-05-08T20:27:26 | 257,322,755 | 0 | 0 | null | true | 2020-04-20T15:24:04 | 2020-04-20T15:24:04 | 2020-04-20T15:20:06 | 2020-04-20T15:20:04 | 0 | 0 | 0 | 0 | null | false | false | package gestsaude.menu;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Vector;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import gestsaude.recurso.GEstSaude;
import gestsaude.recurso.Senha;
import gestsaude.recurso.Servico;
/** Janela de interação reservada a cada serviço
*
*/
//proxServico 0.1
public class MenuServico extends JDialog {
// dimensões dos botões
private static final Dimension tamanhoBt = new Dimension( 170, 30);
private Servico servico;
private Senha senha;
private GEstSaude gest;
// elementos gráficos usados na interface
private static final long serialVersionUID = 1L;
private JPanel menusPanel;
private CardLayout menusCard;
private JButton proxBt;
private JLabel senhaLbl, utenteLbl;
/** Construtor da janela de Serviço
* @param pos posição onde por a janela
* @param s qual o serviço associado à janela
* @param gest o sistema
*/
public MenuServico( Point pos, Servico s, GEstSaude gest ) {
setLocation( pos );
servico = s;
setupAspeto();
atualizarInfo();
this.gest = gest;
}
/** método que chama o próximo utente
* @return true se tem próximo utente
*/
private boolean proximoUtente() {
// TODO ver se há senhas em espera e usar a próxima
senha = servico.getProximaSenha();
if( senha == null )
return false;
// TODO subsituir o texto pela informação indicada
senhaLbl.setText( senha.getId() );
utenteLbl.setText( senha.getConsulta().getUtente().getNumSns() );
return true;
}
/** método chamado para rejeitar o utente */
private void rejeitarUtente() {
servico.rejeitaProximaSenha();
}
/** método chamado para confirmar a consulta */
private void confirmarConsulta() {
// TODO implementar este método (se necessário)
//Não achámos necessário implementar esta class
}
/** método chamado para finalizar a consulta */
private void finalizarConsulta( ) {
// TODO implementar este método (se necessário)
servico.terminaConsulta(senha);
if( !senha.existeProxServico() )
gest.removeConsulta(senha.getConsulta());
Servico proxServ = senha.proxServico();
if (proxServ != null)
senha.getConsulta().setServico(proxServ);
}
/** método chamado para encaminhar o utente para outros serviços */
private void encaminhar( ) {
Vector<String> serv = new Vector<String>();
// ciclo para pedir os vários serviços (pode ser mais que um)
do {
// criar uma lista visual, com todos os serviços introduzidos até agora
JList<String> lista = new JList<String>( serv );
// pedir ao utilizar o id do próximo serviço, apresentando os serviços já introduzidos
String res = JOptionPane.showInputDialog( this, lista, "Encaminhar para onde?", JOptionPane.PLAIN_MESSAGE );
// se não introduziu nada sai do ciclo
if( res == null || res.isEmpty() )
break;
// TODO ver qual o serviço associado ao id
Servico s = gest.getServico(res);
if( s == null )
JOptionPane.showMessageDialog(this, "Esse serviço não existe!" );
else {
serv.add( res );
// TODO associar o serviço à senha
senha.addListaServicos(s);
}
} while( true );
finalizarConsulta();
}
/** método chamado para listar as senhas em espera neste serviço */
private void listarSenhas() {
// ver quais as senhas em espera por este serviço
List<Senha> senhas = servico.getSenhasServico();
String infoSenhas[] = new String[ senhas.size() ];
int i=0;
for( Senha s : senhas ) {
// TODO substituir o texto pela informação indicada
infoSenhas[i++] = s.getId() + ": " + s.getConsulta().getUtente().getNome();
}
JList<String> list = new JList<String>( infoSenhas );
JScrollPane scroll = new JScrollPane( list );
JOptionPane.showMessageDialog( this, scroll, "Senhas no serviço", JOptionPane.PLAIN_MESSAGE );
}
/** Atualiza título, indicando quantos utentes estão em fila de espera */
public void atualizarInfo() {
// TODO indicar quantos utentes estão em fila de espera
int nUtentes = servico.getnSenhas();
// TODO Indicar o id do servico
setTitle( servico.getId() + " utentes: " + nUtentes );
proxBt.setEnabled( nUtentes > 0 ); // se houver em espera pode-se ativar o botão de próximo
}
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
/** método que define o aspeto desta janela
*/
private void setupAspeto() {
setLayout( new BorderLayout() );
setupInfoPanel();
JPanel menuChamada = setupMenuChamada();
JPanel menuConsulta = setupMenuConsulta();
menusCard = new CardLayout();
menusPanel = new JPanel( menusCard );
menusPanel.add( menuChamada );
menusPanel.add( menuConsulta );
add( menusPanel, BorderLayout.CENTER );
pack();
}
private void setupInfoPanel() {
JPanel info = new JPanel( );
info.setLayout( new BoxLayout( info, BoxLayout.Y_AXIS) );
senhaLbl = new JLabel( "---", JLabel.CENTER );
senhaLbl.setFont( new Font("Roman", Font.BOLD, 15) );
senhaLbl.setAlignmentX( JLabel.CENTER_ALIGNMENT);
info.add( senhaLbl );
utenteLbl = new JLabel( "---", JLabel.CENTER );
utenteLbl.setFont( new Font("Roman", Font.BOLD, 10) );
utenteLbl.setAlignmentX( JLabel.CENTER_ALIGNMENT);
info.add( utenteLbl );
JButton senhasBt = new JButton("Senhas");
senhasBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listarSenhas();
}
});
senhasBt.setAlignmentX( JLabel.CENTER_ALIGNMENT);
senhasBt.setMargin( new Insets(0,0,0,0));
info.add( senhasBt );
add( info, BorderLayout.NORTH );
}
private JPanel setupMenuChamada() {
JPanel menuChamada = new JPanel( new GridLayout(0,1) );
proxBt = new JButton("Chamar Utente");
JButton rejeitarBt = new JButton("Rejeitar Utente");
JButton consultaBt = new JButton("Confirmar consulta");
proxBt.setMinimumSize( tamanhoBt );
proxBt.setPreferredSize( tamanhoBt );
proxBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if( proximoUtente() ) {
atualizarInfo();
rejeitarBt.setEnabled( true );
consultaBt.setEnabled( true );
}
}
});
menuChamada.add( proxBt );
rejeitarBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
senhaLbl.setText( "---" );
utenteLbl.setText( "---" );
rejeitarUtente();
}
});
rejeitarBt.setEnabled( false );
menuChamada.add( rejeitarBt );
consultaBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmarConsulta();
rejeitarBt.setEnabled( false );
consultaBt.setEnabled( false );
menusCard.next( menusPanel );
}
});
consultaBt.setEnabled( false );
menuChamada.add( consultaBt );
return menuChamada;
}
private JPanel setupMenuConsulta() {
JPanel menuConsulta = new JPanel( new GridLayout(0,1) );
JButton finalizarBt = new JButton("Finalizar Consulta");
finalizarBt.setMinimumSize( tamanhoBt );
finalizarBt.setPreferredSize( tamanhoBt );
finalizarBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
finalizarConsulta( );
limpaInfo();
}
});
menuConsulta.add( finalizarBt );
JButton encaminharBt = new JButton("Encaminhar");
encaminharBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
encaminhar( );
limpaInfo();
}
});
menuConsulta.add( encaminharBt );
return menuConsulta;
}
private void limpaInfo() {
senhaLbl.setText( "---" );
utenteLbl.setText( "---" );
atualizarInfo();
menusCard.next( menusPanel );
}
}
| ISO-8859-1 | Java | 8,985 | java | MenuServico.java | Java | [] | null | [] | package gestsaude.menu;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Vector;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import gestsaude.recurso.GEstSaude;
import gestsaude.recurso.Senha;
import gestsaude.recurso.Servico;
/** Janela de interação reservada a cada serviço
*
*/
//proxServico 0.1
public class MenuServico extends JDialog {
// dimensões dos botões
private static final Dimension tamanhoBt = new Dimension( 170, 30);
private Servico servico;
private Senha senha;
private GEstSaude gest;
// elementos gráficos usados na interface
private static final long serialVersionUID = 1L;
private JPanel menusPanel;
private CardLayout menusCard;
private JButton proxBt;
private JLabel senhaLbl, utenteLbl;
/** Construtor da janela de Serviço
* @param pos posição onde por a janela
* @param s qual o serviço associado à janela
* @param gest o sistema
*/
public MenuServico( Point pos, Servico s, GEstSaude gest ) {
setLocation( pos );
servico = s;
setupAspeto();
atualizarInfo();
this.gest = gest;
}
/** método que chama o próximo utente
* @return true se tem próximo utente
*/
private boolean proximoUtente() {
// TODO ver se há senhas em espera e usar a próxima
senha = servico.getProximaSenha();
if( senha == null )
return false;
// TODO subsituir o texto pela informação indicada
senhaLbl.setText( senha.getId() );
utenteLbl.setText( senha.getConsulta().getUtente().getNumSns() );
return true;
}
/** método chamado para rejeitar o utente */
private void rejeitarUtente() {
servico.rejeitaProximaSenha();
}
/** método chamado para confirmar a consulta */
private void confirmarConsulta() {
// TODO implementar este método (se necessário)
//Não achámos necessário implementar esta class
}
/** método chamado para finalizar a consulta */
private void finalizarConsulta( ) {
// TODO implementar este método (se necessário)
servico.terminaConsulta(senha);
if( !senha.existeProxServico() )
gest.removeConsulta(senha.getConsulta());
Servico proxServ = senha.proxServico();
if (proxServ != null)
senha.getConsulta().setServico(proxServ);
}
/** método chamado para encaminhar o utente para outros serviços */
private void encaminhar( ) {
Vector<String> serv = new Vector<String>();
// ciclo para pedir os vários serviços (pode ser mais que um)
do {
// criar uma lista visual, com todos os serviços introduzidos até agora
JList<String> lista = new JList<String>( serv );
// pedir ao utilizar o id do próximo serviço, apresentando os serviços já introduzidos
String res = JOptionPane.showInputDialog( this, lista, "Encaminhar para onde?", JOptionPane.PLAIN_MESSAGE );
// se não introduziu nada sai do ciclo
if( res == null || res.isEmpty() )
break;
// TODO ver qual o serviço associado ao id
Servico s = gest.getServico(res);
if( s == null )
JOptionPane.showMessageDialog(this, "Esse serviço não existe!" );
else {
serv.add( res );
// TODO associar o serviço à senha
senha.addListaServicos(s);
}
} while( true );
finalizarConsulta();
}
/** método chamado para listar as senhas em espera neste serviço */
private void listarSenhas() {
// ver quais as senhas em espera por este serviço
List<Senha> senhas = servico.getSenhasServico();
String infoSenhas[] = new String[ senhas.size() ];
int i=0;
for( Senha s : senhas ) {
// TODO substituir o texto pela informação indicada
infoSenhas[i++] = s.getId() + ": " + s.getConsulta().getUtente().getNome();
}
JList<String> list = new JList<String>( infoSenhas );
JScrollPane scroll = new JScrollPane( list );
JOptionPane.showMessageDialog( this, scroll, "Senhas no serviço", JOptionPane.PLAIN_MESSAGE );
}
/** Atualiza título, indicando quantos utentes estão em fila de espera */
public void atualizarInfo() {
// TODO indicar quantos utentes estão em fila de espera
int nUtentes = servico.getnSenhas();
// TODO Indicar o id do servico
setTitle( servico.getId() + " utentes: " + nUtentes );
proxBt.setEnabled( nUtentes > 0 ); // se houver em espera pode-se ativar o botão de próximo
}
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
// métodos relacionados com a interface gráfica. Não deve ser necessário alterar nada nestes métodos
/** método que define o aspeto desta janela
*/
private void setupAspeto() {
setLayout( new BorderLayout() );
setupInfoPanel();
JPanel menuChamada = setupMenuChamada();
JPanel menuConsulta = setupMenuConsulta();
menusCard = new CardLayout();
menusPanel = new JPanel( menusCard );
menusPanel.add( menuChamada );
menusPanel.add( menuConsulta );
add( menusPanel, BorderLayout.CENTER );
pack();
}
private void setupInfoPanel() {
JPanel info = new JPanel( );
info.setLayout( new BoxLayout( info, BoxLayout.Y_AXIS) );
senhaLbl = new JLabel( "---", JLabel.CENTER );
senhaLbl.setFont( new Font("Roman", Font.BOLD, 15) );
senhaLbl.setAlignmentX( JLabel.CENTER_ALIGNMENT);
info.add( senhaLbl );
utenteLbl = new JLabel( "---", JLabel.CENTER );
utenteLbl.setFont( new Font("Roman", Font.BOLD, 10) );
utenteLbl.setAlignmentX( JLabel.CENTER_ALIGNMENT);
info.add( utenteLbl );
JButton senhasBt = new JButton("Senhas");
senhasBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
listarSenhas();
}
});
senhasBt.setAlignmentX( JLabel.CENTER_ALIGNMENT);
senhasBt.setMargin( new Insets(0,0,0,0));
info.add( senhasBt );
add( info, BorderLayout.NORTH );
}
private JPanel setupMenuChamada() {
JPanel menuChamada = new JPanel( new GridLayout(0,1) );
proxBt = new JButton("Chamar Utente");
JButton rejeitarBt = new JButton("Rejeitar Utente");
JButton consultaBt = new JButton("Confirmar consulta");
proxBt.setMinimumSize( tamanhoBt );
proxBt.setPreferredSize( tamanhoBt );
proxBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if( proximoUtente() ) {
atualizarInfo();
rejeitarBt.setEnabled( true );
consultaBt.setEnabled( true );
}
}
});
menuChamada.add( proxBt );
rejeitarBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
senhaLbl.setText( "---" );
utenteLbl.setText( "---" );
rejeitarUtente();
}
});
rejeitarBt.setEnabled( false );
menuChamada.add( rejeitarBt );
consultaBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmarConsulta();
rejeitarBt.setEnabled( false );
consultaBt.setEnabled( false );
menusCard.next( menusPanel );
}
});
consultaBt.setEnabled( false );
menuChamada.add( consultaBt );
return menuChamada;
}
private JPanel setupMenuConsulta() {
JPanel menuConsulta = new JPanel( new GridLayout(0,1) );
JButton finalizarBt = new JButton("Finalizar Consulta");
finalizarBt.setMinimumSize( tamanhoBt );
finalizarBt.setPreferredSize( tamanhoBt );
finalizarBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
finalizarConsulta( );
limpaInfo();
}
});
menuConsulta.add( finalizarBt );
JButton encaminharBt = new JButton("Encaminhar");
encaminharBt.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
encaminhar( );
limpaInfo();
}
});
menuConsulta.add( encaminharBt );
return menuConsulta;
}
private void limpaInfo() {
senhaLbl.setText( "---" );
utenteLbl.setText( "---" );
atualizarInfo();
menusCard.next( menusPanel );
}
}
| 8,985 | 0.689179 | 0.686706 | 284 | 29.330986 | 23.482754 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.316901 | false | false | 13 |
ee0485cf72e6df9fa597ca76957c561ede69b0a9 | 31,576,599,629,572 | 0253d7ab7bec5251e76710e3c3b4918751dc8838 | /SEFramework/src/test/java/com/projectname/scripts/DriverScriptTest.java | ad46f6151f8952154961a591e827fbfcf474a4cf | [] | no_license | NANITHRINATH/SeleniumAutomationScripts | https://github.com/NANITHRINATH/SeleniumAutomationScripts | 379c4eab0ba8ef06af424779a63fbbbc3e1e3c85 | 1a3342415ae6c8d063e97e2ff4b9c1bd4c0ae2e7 | refs/heads/master | 2016-09-05T15:46:37.771000 | 2014-04-23T12:52:37 | 2014-04-23T12:52:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.projectname.scripts;
import jxl.Sheet;
import jxl.write.Label;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.projectname.base.EmailReportUtil;
import com.projectname.base.Keywords;
import com.projectname.base.ReportUtil;
import com.projectname.utils.TestConstants;
import com.projectname.utils.TestUtil;
public class DriverScriptTest extends Keywords {
public static String keyword;
public static String stepDescription;
public static String result;
public static DriverScriptTest dstest;
static float totalTestCaseCount,runTestCaseCount=0,failedTestCases;
@BeforeClass
public void beforeClass() throws Exception{
initialize();
log.info("Initialized All Resources Files");
setTestClassName(DriverScriptTest.this.getClass().getName());
log.info("Creatng Driver Script Object");
dstest=new DriverScriptTest();
log.info("Creating Test Suite");
startTesting();
log.info("Creating Test Suite For Email Report");
emailStartTesting() ;
}
@Test
public void driverScript() throws Exception {
log.info("Creating Suite In Detailed Test Report");
ReportUtil.startSuite("Suite");
log.info("Creating Suite In Mailing Report");
EmailReportUtil.startSuite("Suite");
// test data colom and test results starting row
int colom=3,excelrow=1;
int sno=1;
log.info("Creating Excel Sheet For Test Results");
generateExcel(sno);
controlshet=controllerwb.getSheet("Suite");
totalTestCaseCount=controlshet.getRows()-1;
log.info("Total No.of Test Cases "+totalTestCaseCount);
log.info("Launching Browser");
openBrowser();
log.info("Loading Controller Work Book");
for (int i = 1; i < controlshet.getRows(); i++) {
log.info("Selecting Test Scenario From Controller File");
String tsrunmode=controlshet.getCell(2,i).getContents();
if (tsrunmode.equalsIgnoreCase("Y")) {
runTestCaseCount++;
log.info("Navigate To Test Scenario Sheet");
String tcaseid=controlshet.getCell(0,i).getContents();
Sheet tdsheet1=testdatawb.getSheet(tcaseid);
//control sheet
Sheet controlshet=controllerwb.getSheet(tcaseid);
String fileName=null;
log.info("Loading Test Data Work Book");
for (int j = 1; j < tdsheet1.getRows(); j++) {
String tcaserunmode=tdsheet1.getCell(2,j).getContents();
if (tcaserunmode.equalsIgnoreCase("y")) {
String testcaseid=tdsheet1.getCell(0,j).getContents();
String testdesc=tdsheet1.getCell(1,j).getContents();
fileName = "Suite1_TC"+(testcaseid)+"_TS"+tcaseid+"_"+keyword+j+".png";
stepDescription=testdesc;
keyword=testcaseid;
log.info("Passing Parameters Driver Script to ContolScript");
result=controlScript(j, colom, tcaseid,controlshet,testcaseid,stepDescription,keyword,fileName);
if (failcount>=1 || rptFailCnt>=1) {
result="Fail";
log.info("Test Scenario Result --"+ result);
if (failcount==0) {
failedTestCases+=rptFailCnt;
}else{
failedTestCases+=failcount;
}
mainReport(keyword,result,fileName);
createLabel(excelrow, testcaseid, testdesc, result);
rptFailCnt=0;
failcount=0;
}else{
result="Pass";
log.info("Test Scenario Result --"+ result);
mainReport(keyword,result,fileName);
createLabel(excelrow, testcaseid, testdesc, result);
}
}
excelrow++;
}
}
controlshet=controllerwb.getSheet("Suite");
}
float totalPassCount=runTestCaseCount-failedTestCases;
System.out.println("Total Run Test Case Count ---"+runTestCaseCount);
System.out.println("Total Failed Test Case Count--"+failedTestCases);
System.out.println("Total Passed Test Cases ----"+totalPassCount);
closeBrowser();
wwb.write();
wwb.close();
float passPercentage=(totalPassCount/runTestCaseCount)*100;
float failPercentage=(failedTestCases/runTestCaseCount)*100;
System.out.println(passPercentage);
System.out.println(failPercentage);
dstest.generateCsvFile(0,passPercentage,failPercentage);
generatePieChart();
}
@AfterSuite
public static void endScript() throws Exception{
ReportUtil.updateEndTime(TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"));
EmailReportUtil.updateEndTime(TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"));
mail();
}
} | UTF-8 | Java | 4,340 | java | DriverScriptTest.java | Java | [] | null | [] | package com.projectname.scripts;
import jxl.Sheet;
import jxl.write.Label;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.projectname.base.EmailReportUtil;
import com.projectname.base.Keywords;
import com.projectname.base.ReportUtil;
import com.projectname.utils.TestConstants;
import com.projectname.utils.TestUtil;
public class DriverScriptTest extends Keywords {
public static String keyword;
public static String stepDescription;
public static String result;
public static DriverScriptTest dstest;
static float totalTestCaseCount,runTestCaseCount=0,failedTestCases;
@BeforeClass
public void beforeClass() throws Exception{
initialize();
log.info("Initialized All Resources Files");
setTestClassName(DriverScriptTest.this.getClass().getName());
log.info("Creatng Driver Script Object");
dstest=new DriverScriptTest();
log.info("Creating Test Suite");
startTesting();
log.info("Creating Test Suite For Email Report");
emailStartTesting() ;
}
@Test
public void driverScript() throws Exception {
log.info("Creating Suite In Detailed Test Report");
ReportUtil.startSuite("Suite");
log.info("Creating Suite In Mailing Report");
EmailReportUtil.startSuite("Suite");
// test data colom and test results starting row
int colom=3,excelrow=1;
int sno=1;
log.info("Creating Excel Sheet For Test Results");
generateExcel(sno);
controlshet=controllerwb.getSheet("Suite");
totalTestCaseCount=controlshet.getRows()-1;
log.info("Total No.of Test Cases "+totalTestCaseCount);
log.info("Launching Browser");
openBrowser();
log.info("Loading Controller Work Book");
for (int i = 1; i < controlshet.getRows(); i++) {
log.info("Selecting Test Scenario From Controller File");
String tsrunmode=controlshet.getCell(2,i).getContents();
if (tsrunmode.equalsIgnoreCase("Y")) {
runTestCaseCount++;
log.info("Navigate To Test Scenario Sheet");
String tcaseid=controlshet.getCell(0,i).getContents();
Sheet tdsheet1=testdatawb.getSheet(tcaseid);
//control sheet
Sheet controlshet=controllerwb.getSheet(tcaseid);
String fileName=null;
log.info("Loading Test Data Work Book");
for (int j = 1; j < tdsheet1.getRows(); j++) {
String tcaserunmode=tdsheet1.getCell(2,j).getContents();
if (tcaserunmode.equalsIgnoreCase("y")) {
String testcaseid=tdsheet1.getCell(0,j).getContents();
String testdesc=tdsheet1.getCell(1,j).getContents();
fileName = "Suite1_TC"+(testcaseid)+"_TS"+tcaseid+"_"+keyword+j+".png";
stepDescription=testdesc;
keyword=testcaseid;
log.info("Passing Parameters Driver Script to ContolScript");
result=controlScript(j, colom, tcaseid,controlshet,testcaseid,stepDescription,keyword,fileName);
if (failcount>=1 || rptFailCnt>=1) {
result="Fail";
log.info("Test Scenario Result --"+ result);
if (failcount==0) {
failedTestCases+=rptFailCnt;
}else{
failedTestCases+=failcount;
}
mainReport(keyword,result,fileName);
createLabel(excelrow, testcaseid, testdesc, result);
rptFailCnt=0;
failcount=0;
}else{
result="Pass";
log.info("Test Scenario Result --"+ result);
mainReport(keyword,result,fileName);
createLabel(excelrow, testcaseid, testdesc, result);
}
}
excelrow++;
}
}
controlshet=controllerwb.getSheet("Suite");
}
float totalPassCount=runTestCaseCount-failedTestCases;
System.out.println("Total Run Test Case Count ---"+runTestCaseCount);
System.out.println("Total Failed Test Case Count--"+failedTestCases);
System.out.println("Total Passed Test Cases ----"+totalPassCount);
closeBrowser();
wwb.write();
wwb.close();
float passPercentage=(totalPassCount/runTestCaseCount)*100;
float failPercentage=(failedTestCases/runTestCaseCount)*100;
System.out.println(passPercentage);
System.out.println(failPercentage);
dstest.generateCsvFile(0,passPercentage,failPercentage);
generatePieChart();
}
@AfterSuite
public static void endScript() throws Exception{
ReportUtil.updateEndTime(TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"));
EmailReportUtil.updateEndTime(TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"));
mail();
}
} | 4,340 | 0.721659 | 0.714747 | 118 | 35.788136 | 21.167553 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.991525 | false | false | 13 |
0c7479d79c3642e5a0359667194f71a5b4684302 | 31,576,599,625,443 | 2ea49bfaa6bc1b9301b025c5b2ca6fde7e5bb9df | /contributions/Ekaus/java/I/O/2016-09-10.java | af7a2aeaabadae394adc0234323095322b87fb93 | [] | no_license | 0x8801/commit | https://github.com/0x8801/commit | 18f25a9449f162ee92945b42b93700e12fd4fd77 | e7692808585bc7e9726f61f7f6baf43dc83e28ac | refs/heads/master | 2021-10-13T08:04:48.200000 | 2016-12-20T01:59:47 | 2016-12-20T01:59:47 | 76,935,980 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | How to list all files in a directory that match a filename extension in Java
Reading and writing text files
Using buffered streams
The `Console` class | UTF-8 | Java | 150 | java | 2016-09-10.java | Java | [] | null | [] | How to list all files in a directory that match a filename extension in Java
Reading and writing text files
Using buffered streams
The `Console` class | 150 | 0.82 | 0.82 | 4 | 36.75 | 23.01494 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | false | false | 13 |
c4fa9f94d6dedfc1810c8d5f2ccca2301756f4cf | 8,658,654,133,061 | a4d0b8bc5f719f04bcd97634f407d058d69ff608 | /src/Main.java | 16beb68b6daf0986efb9a11637dc4173cde470b1 | [] | no_license | Falchio/JavaCore_Lesson2_Exception | https://github.com/Falchio/JavaCore_Lesson2_Exception | 70b5081657310a468520ca52e6b29014079274bf | 364b027f28bcef55fe5d41140e51605e98e6a58d | refs/heads/master | 2020-09-15T20:46:28.265000 | 2019-11-23T14:26:30 | 2019-11-23T14:26:30 | 223,554,073 | 0 | 0 | null | false | 2019-11-24T13:49:22 | 2019-11-23T08:07:58 | 2019-11-23T14:26:48 | 2019-11-24T13:46:51 | 8 | 0 | 0 | 1 | Java | false | false | import exceptions.MyArraySizeException;
public class Main {
static int arraySize = 4;
public static void main(String[] args) {
String[][] MyArray = {{"1", "2", "3", "1"},
{"1", "2", "3", "4"},
{"1", "2", "3", "4"},
{"1", "2", "3", "4"}};
int sum = 0;
try {
sum = sumArray(MyArray);
} catch (MyArraySizeException e) {
e.printStackTrace();
}
System.out.println("Результат сложения всех элементов массива: " + sum);
}
static int sumArray(String[][] MyArray) throws MyArraySizeException {
int sum = 0;
boolean dimension = true;
checkDimensionArray(MyArray);
for (int i = 0; i < MyArray.length; i++) {
for (int j = 0; j < MyArray[i].length; j++) {
sum = sum + Integer.parseInt(MyArray[i][j]);
}
}
return sum;
}
static void checkDimensionArray(String[][] MyArray) throws MyArraySizeException {
boolean dimension = true;
if (MyArray.length != arraySize) {
dimension = false;
} else {
for (int i = 0; i < MyArray.length; i++) {
if (MyArray[i].length != arraySize) {
dimension = false;
break;
}
}
}
if (!dimension) {
throw new MyArraySizeException("На вход подан массив неверной размерности. \n " +
"-->Для корректной работы программы необходим массив размерности: --> " + arraySize + "x" + arraySize);
}
}
}
| UTF-8 | Java | 1,769 | java | Main.java | Java | [] | null | [] | import exceptions.MyArraySizeException;
public class Main {
static int arraySize = 4;
public static void main(String[] args) {
String[][] MyArray = {{"1", "2", "3", "1"},
{"1", "2", "3", "4"},
{"1", "2", "3", "4"},
{"1", "2", "3", "4"}};
int sum = 0;
try {
sum = sumArray(MyArray);
} catch (MyArraySizeException e) {
e.printStackTrace();
}
System.out.println("Результат сложения всех элементов массива: " + sum);
}
static int sumArray(String[][] MyArray) throws MyArraySizeException {
int sum = 0;
boolean dimension = true;
checkDimensionArray(MyArray);
for (int i = 0; i < MyArray.length; i++) {
for (int j = 0; j < MyArray[i].length; j++) {
sum = sum + Integer.parseInt(MyArray[i][j]);
}
}
return sum;
}
static void checkDimensionArray(String[][] MyArray) throws MyArraySizeException {
boolean dimension = true;
if (MyArray.length != arraySize) {
dimension = false;
} else {
for (int i = 0; i < MyArray.length; i++) {
if (MyArray[i].length != arraySize) {
dimension = false;
break;
}
}
}
if (!dimension) {
throw new MyArraySizeException("На вход подан массив неверной размерности. \n " +
"-->Для корректной работы программы необходим массив размерности: --> " + arraySize + "x" + arraySize);
}
}
}
| 1,769 | 0.484775 | 0.471376 | 62 | 25.467741 | 26.847069 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.612903 | false | false | 13 |
cebf916cfe82182ee15d15005b37f01d0b6d76c9 | 4,226,247,842,355 | cda7055ec50f4431f47c6ac16a421e234a7d1280 | /src/model/Obra.java | 482da8f0543e124395c3b44ef77742496f569202 | [] | no_license | mativul/G2 | https://github.com/mativul/G2 | 36cd27e57cd037701aeabe2445ce70eac88d3635 | 869928d0f1ff5e2dfffad347f41726e06f4a67c2 | refs/heads/master | 2020-09-05T08:45:23.811000 | 2019-11-06T16:42:13 | 2019-11-06T16:42:13 | 220,046,842 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package model;
/**
*
* @author Usuario
*/
public class Obra {
public int getId_obra() {
return id_obra;
}
public void setId_obra(int id_obra) {
this.id_obra = id_obra;
}
public int getId_artista() {
return id_artista;
}
public void setId_artista(int id_artista) {
this.id_artista = id_artista;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public float getValuacion() {
return valuacion;
}
public void setValuacion(float valuacion) {
this.valuacion = valuacion;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public int getAlto() {
return alto;
}
public void setAlto(int alto) {
this.alto = alto;
}
public int getAncho() {
return ancho;
}
public void setAncho(int ancho) {
this.ancho = ancho;
}
public String getIngreso() {
return ingreso;
}
public void setIngreso(String ingreso) {
this.ingreso = ingreso;
}
public Obra() {
}
public Obra(int id_obra, int id_artista, String nombre, String genero, float valuacion, String descripcion, int alto, int ancho, String ingreso) {
this.id_obra = id_obra;
this.id_artista = id_artista;
this.nombre = nombre;
this.genero = genero;
this.valuacion = valuacion;
this.descripcion = descripcion;
this.alto = alto;
this.ancho = ancho;
this.ingreso = ingreso;
}
public Obra( int id_artista, String nombre, String genero, float valuacion, String descripcion, int alto, int ancho, String ingreso) {
this.id_artista = id_artista;
this.nombre = nombre;
this.genero = genero;
this.valuacion = valuacion;
this.descripcion = descripcion;
this.alto = alto;
this.ancho = ancho;
this.ingreso = ingreso;
}
public Obra(int id_obra,String nombreartista, String nombre, String genero, float valuacion, String descripcion, int alto, int ancho, String ingreso) {
this.id_obra = id_obra;
this.nombreartista = nombreartista;
this.nombre = nombre;
this.genero = genero;
this.valuacion = valuacion;
this.descripcion = descripcion;
this.alto = alto;
this.ancho = ancho;
this.ingreso = ingreso;
}
int id_obra;
int id_artista;
String nombre;
String nombreartista;
public String getNombreartista() {
return nombreartista;
}
public void setNombreartista(String nombreartista) {
this.nombreartista = nombreartista;
}
String genero;
float valuacion;
String descripcion;
int alto;
int ancho;
String ingreso;
}
| UTF-8 | Java | 3,472 | java | Obra.java | Java | [
{
"context": "ditor.\r\n */\r\npackage model;\r\n\r\n/**\r\n *\r\n * @author Usuario\r\n */\r\npublic class Obra {\r\n\r\n public int getId",
"end": 235,
"score": 0.5374478697776794,
"start": 228,
"tag": "USERNAME",
"value": "Usuario"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package model;
/**
*
* @author Usuario
*/
public class Obra {
public int getId_obra() {
return id_obra;
}
public void setId_obra(int id_obra) {
this.id_obra = id_obra;
}
public int getId_artista() {
return id_artista;
}
public void setId_artista(int id_artista) {
this.id_artista = id_artista;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public float getValuacion() {
return valuacion;
}
public void setValuacion(float valuacion) {
this.valuacion = valuacion;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public int getAlto() {
return alto;
}
public void setAlto(int alto) {
this.alto = alto;
}
public int getAncho() {
return ancho;
}
public void setAncho(int ancho) {
this.ancho = ancho;
}
public String getIngreso() {
return ingreso;
}
public void setIngreso(String ingreso) {
this.ingreso = ingreso;
}
public Obra() {
}
public Obra(int id_obra, int id_artista, String nombre, String genero, float valuacion, String descripcion, int alto, int ancho, String ingreso) {
this.id_obra = id_obra;
this.id_artista = id_artista;
this.nombre = nombre;
this.genero = genero;
this.valuacion = valuacion;
this.descripcion = descripcion;
this.alto = alto;
this.ancho = ancho;
this.ingreso = ingreso;
}
public Obra( int id_artista, String nombre, String genero, float valuacion, String descripcion, int alto, int ancho, String ingreso) {
this.id_artista = id_artista;
this.nombre = nombre;
this.genero = genero;
this.valuacion = valuacion;
this.descripcion = descripcion;
this.alto = alto;
this.ancho = ancho;
this.ingreso = ingreso;
}
public Obra(int id_obra,String nombreartista, String nombre, String genero, float valuacion, String descripcion, int alto, int ancho, String ingreso) {
this.id_obra = id_obra;
this.nombreartista = nombreartista;
this.nombre = nombre;
this.genero = genero;
this.valuacion = valuacion;
this.descripcion = descripcion;
this.alto = alto;
this.ancho = ancho;
this.ingreso = ingreso;
}
int id_obra;
int id_artista;
String nombre;
String nombreartista;
public String getNombreartista() {
return nombreartista;
}
public void setNombreartista(String nombreartista) {
this.nombreartista = nombreartista;
}
String genero;
float valuacion;
String descripcion;
int alto;
int ancho;
String ingreso;
}
| 3,472 | 0.575461 | 0.575461 | 146 | 21.780823 | 24.314856 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.568493 | false | false | 13 |
1d8a1390203a0eb6f97532a020e9846c5d317806 | 17,025,250,390,670 | 43159672c535080386b702a20b5c4899156e7e65 | /Pandora-0.0.7/pandora-implementation/src/main/java/fr/seedle/pandora/singleton/HibernateSingleton.java | 0a283251b4c4c0be9277914c9485760eef34042b | [] | no_license | AnaisT17/Pandora | https://github.com/AnaisT17/Pandora | 92d243fa222b626da3ef103b83ebd6b708abb1b2 | 404d7eaeeadbc2977d91518e28a5f4cf917d2719 | refs/heads/main | 2023-01-13T19:19:15.711000 | 2020-11-18T20:46:00 | 2020-11-18T20:46:00 | 314,024,991 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.seedle.pandora.singleton;
import java.io.File;
import java.io.Serializable;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import fr.seedle.pandora.hibernate.HibernateConfiguration;
/***
*
* @author eric
*
*/
public class HibernateSingleton implements Serializable {
/*
* serialVersionUID - long
*/
private static final long serialVersionUID = 5060277755980541156L;
/*
* Le singleton
*/
private static HibernateSingleton hibernateSingleton;
/*
* Hibernate session
*/
private SessionFactory factory;
/***
*
* @return le singleton
*/
public static HibernateSingleton getInstance() {
if (hibernateSingleton == null) {
hibernateSingleton = new HibernateSingleton();
}
return hibernateSingleton;
}
/***
* * Constructeur 2 avr. 2020 fr.seedle.insui.singleton insui-implementations 2
* avr. 2020
*/
public HibernateSingleton() {
final HibernateConfiguration hibernateConfiguration = new HibernateConfiguration();
// FIXME il faut définir un répertoire de configuration
final String theUserDir = "pandora.cfg.xml";
final Configuration configuration = hibernateConfiguration.getConfiguration(new File(theUserDir));
final StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
builder.applySettings(configuration.getProperties()).build();
final ServiceRegistry serviceRegistry = builder.build();
this.factory = configuration.buildSessionFactory(serviceRegistry);
}
/***
*
* 9 sept. 2019
*
* @return fr.seedle.insui.bean insui-implementations 9 sept. 2019
*/
public SessionFactory getFactory() {
return this.factory;
}
/***
* factory 10 oct. 2019 fr.seedle.insui.bean insui-implementations 10 oct. 2019
*
* @return the factory
*/
public void setFactory(SessionFactory factory) {
this.factory = factory;
}
}
| UTF-8 | Java | 1,992 | java | HibernateSingleton.java | Java | [
{
"context": "nate.HibernateConfiguration;\n\n/***\n * \n * @author eric\n *\n */\npublic class HibernateSingleton implements",
"end": 364,
"score": 0.936532199382782,
"start": 360,
"tag": "USERNAME",
"value": "eric"
}
] | null | [] | package fr.seedle.pandora.singleton;
import java.io.File;
import java.io.Serializable;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import fr.seedle.pandora.hibernate.HibernateConfiguration;
/***
*
* @author eric
*
*/
public class HibernateSingleton implements Serializable {
/*
* serialVersionUID - long
*/
private static final long serialVersionUID = 5060277755980541156L;
/*
* Le singleton
*/
private static HibernateSingleton hibernateSingleton;
/*
* Hibernate session
*/
private SessionFactory factory;
/***
*
* @return le singleton
*/
public static HibernateSingleton getInstance() {
if (hibernateSingleton == null) {
hibernateSingleton = new HibernateSingleton();
}
return hibernateSingleton;
}
/***
* * Constructeur 2 avr. 2020 fr.seedle.insui.singleton insui-implementations 2
* avr. 2020
*/
public HibernateSingleton() {
final HibernateConfiguration hibernateConfiguration = new HibernateConfiguration();
// FIXME il faut définir un répertoire de configuration
final String theUserDir = "pandora.cfg.xml";
final Configuration configuration = hibernateConfiguration.getConfiguration(new File(theUserDir));
final StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
builder.applySettings(configuration.getProperties()).build();
final ServiceRegistry serviceRegistry = builder.build();
this.factory = configuration.buildSessionFactory(serviceRegistry);
}
/***
*
* 9 sept. 2019
*
* @return fr.seedle.insui.bean insui-implementations 9 sept. 2019
*/
public SessionFactory getFactory() {
return this.factory;
}
/***
* factory 10 oct. 2019 fr.seedle.insui.bean insui-implementations 10 oct. 2019
*
* @return the factory
*/
public void setFactory(SessionFactory factory) {
this.factory = factory;
}
}
| 1,992 | 0.746734 | 0.721106 | 86 | 22.139534 | 26.399508 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.046512 | false | false | 13 |
a257388bb031f970a7ad121d50640c1cfbe94e9b | 26,396,869,004,366 | 95e17619a593adf852dc2a6a2e65b9877c7570c9 | /core/src/com/fearthebadger/studio/rotator/MainMenu.java | abd9bde0acad971aaf743baf92ce40bee50c86fe | [
"Apache-2.0"
] | permissive | FearTheBadger/rotate | https://github.com/FearTheBadger/rotate | 89b0a6143a25925f4c27fb97dd784728173c485d | c5e793e840b47792cfd922dc66da8f45702d94d9 | refs/heads/master | 2016-09-06T05:46:09.768000 | 2015-06-29T04:26:19 | 2015-06-29T04:26:19 | 37,689,345 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fearthebadger.studio.rotator;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.fearthebadger.studio.menus.Settings;
import com.fearthebadger.studio.utils.RotatorConstants;
public class MainMenu extends InputAdapter implements Screen {
private static final String TAG = "Rotator Main";
private MainRotator game;
private TextureAtlas atlas;
private Skin skin;
private Viewport viewport;
private Texture buttonUpTex, buttonDownTex, buttonOverTex;
private TextButton btnPlay, btnSettings, btnImages;
private TextButtonStyle tbs;
private BitmapFont font;
private Stage stage;
public MainMenu(final MainRotator game) {
create();
this.game = game;
Gdx.app.log(TAG, "Rotator game: " + this.game);
}
public void create() {
Gdx.app.setLogLevel(Application.LOG_DEBUG);
viewport = new FitViewport(RotatorConstants.worldWidth, RotatorConstants.worldHeight);
stage = new Stage(viewport);
Gdx.input.setInputProcessor(stage);
font = new BitmapFont(Gdx.files.internal("data/font.fnt"));
skin = new Skin();
atlas = new TextureAtlas(Gdx.files.internal("button.atlas"));
skin.addRegions(atlas);
Gdx.app.log(TAG, "Rotator Before map");
tbs = new TextButtonStyle();
tbs.font = font;
tbs.up = skin.getDrawable("myactor");
tbs.down = skin.getDrawable("myactorDown");
tbs.checked = skin.getDrawable("myactorDown");
tbs.over = skin.getDrawable("myactorOver");
skin.add("default", tbs);
btnPlay = new TextButton("PLAY", skin);
btnPlay.sizeBy(180.0f, 60.0f);
btnPlay.setPosition(Gdx.graphics.getWidth()/2 - Gdx.graphics.getWidth()/8 , Gdx.graphics.getHeight()/2);
stage.addActor(btnPlay);
btnSettings = new TextButton("SETS", skin);
btnSettings.sizeBy(30.0f, 60.0f);
btnSettings.setPosition(Gdx.graphics.getWidth()/2 + 60, (Gdx.graphics.getHeight()/2)-120);
stage.addActor(btnSettings);
btnImages = new TextButton("Images", skin);
btnImages.sizeBy(30.0f, 60.0f);
btnImages.setPosition(Gdx.graphics.getWidth()/2 - 120, (Gdx.graphics.getHeight()/2)-120);
stage.addActor(btnImages);
btnPlay.addListener( new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.app.log(TAG, "Rotator PLAY");
game.setScreen(new MainGame(game));
}
});
btnSettings.addListener( new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
Gdx.app.log(TAG, "Calling Settings");
game.setScreen(new Settings(game));
}
});
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(RotatorConstants.bgColor.r,
RotatorConstants.bgColor.g,
RotatorConstants.bgColor.b,
RotatorConstants.bgColor.a);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if (Gdx.input.isKeyPressed(Input.Keys.BACK)) {
Gdx.app.log(TAG, "Exiting");
Gdx.app.exit();
}
stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 60f));
stage.draw();
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, false);
}
@Override
public void dispose() {
buttonDownTex.dispose();
buttonOverTex.dispose();
buttonUpTex.dispose();
stage.dispose();
}
@Override
public void pause() {}
@Override
public void resume() {}
@Override
public void show() {
Gdx.input.setCatchBackKey(true);
}
@Override
public void hide() {}
} | UTF-8 | Java | 4,154 | java | MainMenu.java | Java | [] | null | [] | package com.fearthebadger.studio.rotator;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.fearthebadger.studio.menus.Settings;
import com.fearthebadger.studio.utils.RotatorConstants;
public class MainMenu extends InputAdapter implements Screen {
private static final String TAG = "Rotator Main";
private MainRotator game;
private TextureAtlas atlas;
private Skin skin;
private Viewport viewport;
private Texture buttonUpTex, buttonDownTex, buttonOverTex;
private TextButton btnPlay, btnSettings, btnImages;
private TextButtonStyle tbs;
private BitmapFont font;
private Stage stage;
public MainMenu(final MainRotator game) {
create();
this.game = game;
Gdx.app.log(TAG, "Rotator game: " + this.game);
}
public void create() {
Gdx.app.setLogLevel(Application.LOG_DEBUG);
viewport = new FitViewport(RotatorConstants.worldWidth, RotatorConstants.worldHeight);
stage = new Stage(viewport);
Gdx.input.setInputProcessor(stage);
font = new BitmapFont(Gdx.files.internal("data/font.fnt"));
skin = new Skin();
atlas = new TextureAtlas(Gdx.files.internal("button.atlas"));
skin.addRegions(atlas);
Gdx.app.log(TAG, "Rotator Before map");
tbs = new TextButtonStyle();
tbs.font = font;
tbs.up = skin.getDrawable("myactor");
tbs.down = skin.getDrawable("myactorDown");
tbs.checked = skin.getDrawable("myactorDown");
tbs.over = skin.getDrawable("myactorOver");
skin.add("default", tbs);
btnPlay = new TextButton("PLAY", skin);
btnPlay.sizeBy(180.0f, 60.0f);
btnPlay.setPosition(Gdx.graphics.getWidth()/2 - Gdx.graphics.getWidth()/8 , Gdx.graphics.getHeight()/2);
stage.addActor(btnPlay);
btnSettings = new TextButton("SETS", skin);
btnSettings.sizeBy(30.0f, 60.0f);
btnSettings.setPosition(Gdx.graphics.getWidth()/2 + 60, (Gdx.graphics.getHeight()/2)-120);
stage.addActor(btnSettings);
btnImages = new TextButton("Images", skin);
btnImages.sizeBy(30.0f, 60.0f);
btnImages.setPosition(Gdx.graphics.getWidth()/2 - 120, (Gdx.graphics.getHeight()/2)-120);
stage.addActor(btnImages);
btnPlay.addListener( new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.app.log(TAG, "Rotator PLAY");
game.setScreen(new MainGame(game));
}
});
btnSettings.addListener( new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
Gdx.app.log(TAG, "Calling Settings");
game.setScreen(new Settings(game));
}
});
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(RotatorConstants.bgColor.r,
RotatorConstants.bgColor.g,
RotatorConstants.bgColor.b,
RotatorConstants.bgColor.a);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if (Gdx.input.isKeyPressed(Input.Keys.BACK)) {
Gdx.app.log(TAG, "Exiting");
Gdx.app.exit();
}
stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 60f));
stage.draw();
}
@Override
public void resize(int width, int height) {
viewport.update(width, height, false);
}
@Override
public void dispose() {
buttonDownTex.dispose();
buttonOverTex.dispose();
buttonUpTex.dispose();
stage.dispose();
}
@Override
public void pause() {}
@Override
public void resume() {}
@Override
public void show() {
Gdx.input.setCatchBackKey(true);
}
@Override
public void hide() {}
} | 4,154 | 0.720029 | 0.707511 | 147 | 27.265306 | 22.91995 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.027211 | false | false | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.