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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35f769c96269eed4ac1afbe06652cee1996ec21e
| 33,689,723,536,119 |
368b1ceabf22c23cdd4e22afeef8b1b53d18abc7
|
/src/main/java/GorobetsDmitriy/Main.java
|
72b996b3d31659dc025e61a0bf497eb54b11eba3
|
[] |
no_license
|
GorobetsDima/SimpleConsoleCalculator
|
https://github.com/GorobetsDima/SimpleConsoleCalculator
|
f26397e6d2610cec3b29d2cc54888a46ecab3739
|
353bb5d93647e1257ba3c36a4f8e4c9a8e64bece
|
refs/heads/master
| 2021-01-10T16:42:23.564000 | 2015-10-26T18:44:06 | 2015-10-26T18:44:06 | 44,988,540 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package GorobetsDmitriy;
/**
* @author Gorobets Dmitriy
* <p>
* In class Main I create a instance of Calculator.class
* Before that I check whether a number is a double type or not
* And figure out how many arguments was entered
* which way to use for a calculation in the constructor
*/
public class Main {
public static void main(String[] args) {
if (args.length == 3) {
try {
if (Double.valueOf(args[0]) instanceof Double & Double.valueOf(args[2]) instanceof Double) {
Calculator calc = new Calculator();
calc.calculate(Double.valueOf(args[0]), args[1].charAt(0), Double.valueOf(args[2]));
}
} catch (Exception e) {
System.out.println("Здравствуй мой друг!");
System.out.println("");
System.out.println("Ты ввел не правильное число!");
System.out.println("");
System.out.println("Что бы я посчитал все верно, используй пожалуйста пробелы между аргументами: 15.4 + -7 или -8 х 3!");
System.out.println("Я поддержываю такие операции: + , - , / , х !");
System.out.println("Что ты хочешь сосчитать? :)");
}
} else {
System.out.println("Здравствуй мой друг!");
System.out.println("");
System.out.println("Выражение введено неправельно!Пример: 5 + 5");
System.out.println("");
System.out.println("Что бы я посчитал все верно, используй пожалуйста пробелы между аргументами: 15.4 + -7 или -8 х 3!");
System.out.println("Я поддержываю такие операции: + , - , / , х !");
System.out.println("Что ты хочешь сосчитать? :)");
}
}
}
|
UTF-8
|
Java
| 2,131 |
java
|
Main.java
|
Java
|
[
{
"context": "package GorobetsDmitriy;\n\n/**\n * @author Gorobets Dmitriy\n * <p>\n * In class Main I create ",
"end": 57,
"score": 0.9998000860214233,
"start": 41,
"tag": "NAME",
"value": "Gorobets Dmitriy"
}
] | null |
[] |
package GorobetsDmitriy;
/**
* @author <NAME>
* <p>
* In class Main I create a instance of Calculator.class
* Before that I check whether a number is a double type or not
* And figure out how many arguments was entered
* which way to use for a calculation in the constructor
*/
public class Main {
public static void main(String[] args) {
if (args.length == 3) {
try {
if (Double.valueOf(args[0]) instanceof Double & Double.valueOf(args[2]) instanceof Double) {
Calculator calc = new Calculator();
calc.calculate(Double.valueOf(args[0]), args[1].charAt(0), Double.valueOf(args[2]));
}
} catch (Exception e) {
System.out.println("Здравствуй мой друг!");
System.out.println("");
System.out.println("Ты ввел не правильное число!");
System.out.println("");
System.out.println("Что бы я посчитал все верно, используй пожалуйста пробелы между аргументами: 15.4 + -7 или -8 х 3!");
System.out.println("Я поддержываю такие операции: + , - , / , х !");
System.out.println("Что ты хочешь сосчитать? :)");
}
} else {
System.out.println("Здравствуй мой друг!");
System.out.println("");
System.out.println("Выражение введено неправельно!Пример: 5 + 5");
System.out.println("");
System.out.println("Что бы я посчитал все верно, используй пожалуйста пробелы между аргументами: 15.4 + -7 или -8 х 3!");
System.out.println("Я поддержываю такие операции: + , - , / , х !");
System.out.println("Что ты хочешь сосчитать? :)");
}
}
}
| 2,121 | 0.558191 | 0.546608 | 43 | 41.186047 | 36.399754 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.627907 | false | false |
0
|
9d8d246250546065de274986781f588f694ff811
| 36,764,920,097,652 |
ac1188b3e3afbaa18c3cd4cce8c7a1dc027104e9
|
/FLP/src/com/pom/Connectloginpage.java
|
3d53a28e45b7c9e43e8089fe2b2d9aee2420d162
|
[] |
no_license
|
SydAb/FLPprograms
|
https://github.com/SydAb/FLPprograms
|
aedd03c7fc7c34cb9cbf7536468052b85f24e6e0
|
7413333451c60bc1979ed33a93a2f7c87e275bdc
|
refs/heads/master
| 2020-06-15T07:11:34.065000 | 2019-07-04T12:20:44 | 2019-07-04T12:20:44 | 195,234,384 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pom;
import java.sql.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class Connectloginpage {
public static WebElement Username(WebDriver driver)
{
WebElement Elemnt = driver.findElement(By.id("LoginForm_username"));
return Elemnt;
}
public static WebElement password(WebDriver driver)
{
WebElement Elemnt = driver.findElement(By.id("LoginForm_password"));
return Elemnt;
}
public static WebElement signin(WebDriver driver)
{
WebElement signin = driver.findElement(By.name("yt0"));
return signin;
}
public static WebElement errormessage(WebDriver driver)
{
WebElement Ele = driver.findElement(By.xpath("//div[@class='errorMessage' and @id='LoginForm_password_em_']"));
return Ele;
}
}
|
UTF-8
|
Java
| 879 |
java
|
Connectloginpage.java
|
Java
|
[] | null |
[] |
package com.pom;
import java.sql.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class Connectloginpage {
public static WebElement Username(WebDriver driver)
{
WebElement Elemnt = driver.findElement(By.id("LoginForm_username"));
return Elemnt;
}
public static WebElement password(WebDriver driver)
{
WebElement Elemnt = driver.findElement(By.id("LoginForm_password"));
return Elemnt;
}
public static WebElement signin(WebDriver driver)
{
WebElement signin = driver.findElement(By.name("yt0"));
return signin;
}
public static WebElement errormessage(WebDriver driver)
{
WebElement Ele = driver.findElement(By.xpath("//div[@class='errorMessage' and @id='LoginForm_password_em_']"));
return Ele;
}
}
| 879 | 0.690557 | 0.68942 | 45 | 17.533333 | 25.671082 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.222222 | false | false |
0
|
907ffcbc74629cd892075631ae67531857d93c34
| 35,579,509,131,206 |
c7e149b8d1901525100f720b54a5e5ce3180d604
|
/src/main/java/me/earth/earthhack/impl/modules/combat/autocrystal/HelperLiquids.java
|
3646a38ba5393631b335aac1e68fb1c69b3cc528
|
[] |
no_license
|
Sxmurai/3arthh4ck-Future
|
https://github.com/Sxmurai/3arthh4ck-Future
|
f47ec6aa191135bccfc92d64b904e0e548daec87
|
3c0803b6c1fbba19cfc6a1490790c9bbd7f39fe9
|
refs/heads/main
| 2022-07-29T15:51:28.534000 | 2022-01-03T00:19:35 | 2022-01-03T00:19:35 | 443,893,777 | 13 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.earth.earthhack.impl.modules.combat.autocrystal;
import me.earth.earthhack.api.util.interfaces.Globals;
import me.earth.earthhack.impl.modules.combat.autocrystal.util.MineSlots;
import me.earth.earthhack.impl.modules.combat.autocrystal.util.PlaceData;
import me.earth.earthhack.impl.modules.combat.autocrystal.util.PositionData;
import me.earth.earthhack.impl.util.math.MathUtil;
import me.earth.earthhack.impl.util.math.rotation.RotationUtil;
import me.earth.earthhack.impl.util.minecraft.blocks.BlockUtil;
import me.earth.earthhack.impl.util.minecraft.blocks.mine.MineUtil;
import me.earth.earthhack.impl.util.minecraft.entity.EntityUtil;
import me.earth.earthhack.impl.util.text.ChatUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import java.util.List;
public class HelperLiquids implements Globals
{
public PlaceData calculate(HelperPlace placeHelper,
PlaceData placeData,
List<EntityPlayer> friends,
List<EntityPlayer> players,
float minDamage)
{
PlaceData newData = new PlaceData(minDamage);
newData.setTarget(placeData.getTarget());
for (PositionData data : placeData.getLiquid())
{
if (placeHelper.validate(data, friends) != null)
{
placeHelper.calcPositionData(newData, data, players);
}
}
return newData;
}
public EnumFacing getAbsorbFacing(BlockPos pos,
List<Entity> entities,
IBlockAccess access,
double placeRange)
{
for (EnumFacing facing : EnumFacing.VALUES)
{
if (facing == EnumFacing.DOWN)
{
continue;
}
BlockPos offset = pos.offset(facing);
if (BlockUtil.getDistanceSq(offset) >= MathUtil.square(placeRange))
{
continue;
}
if (access.getBlockState(offset).getMaterial().isReplaceable())
{
boolean found = false;
AxisAlignedBB bb = new AxisAlignedBB(offset);
for (Entity entity : entities)
{
if (entity == null
|| EntityUtil.isDead(entity)
|| !entity.preventEntitySpawning)
{
continue;
}
if (entity.getEntityBoundingBox().intersects(bb))
{
found = true;
break;
}
}
if (found)
{
continue;
}
return facing;
}
}
return null;
}
// TODO: make this utility method somewhere else, MineUtil maybe
public static MineSlots getSlots(boolean onGroundCheck)
{
int bestBlock = -1;
int bestTool = -1;
float maxSpeed = 0.0f;
for (int i = 8; i > -1; i--)
{
ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (stack.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock) stack.getItem()).getBlock();
int tool = MineUtil.findBestTool(BlockPos.ORIGIN,
block.getDefaultState());
float damage = MineUtil.getDamage(
block.getDefaultState(),
mc.player.inventory.getStackInSlot(tool),
BlockPos.ORIGIN,
!onGroundCheck
|| RotationUtil.getRotationPlayer().onGround);
if (damage > maxSpeed)
{
bestBlock = i;
bestTool = tool;
maxSpeed = damage;
}
}
}
return new MineSlots(bestBlock, bestTool, maxSpeed);
}
}
|
UTF-8
|
Java
| 4,456 |
java
|
HelperLiquids.java
|
Java
|
[] | null |
[] |
package me.earth.earthhack.impl.modules.combat.autocrystal;
import me.earth.earthhack.api.util.interfaces.Globals;
import me.earth.earthhack.impl.modules.combat.autocrystal.util.MineSlots;
import me.earth.earthhack.impl.modules.combat.autocrystal.util.PlaceData;
import me.earth.earthhack.impl.modules.combat.autocrystal.util.PositionData;
import me.earth.earthhack.impl.util.math.MathUtil;
import me.earth.earthhack.impl.util.math.rotation.RotationUtil;
import me.earth.earthhack.impl.util.minecraft.blocks.BlockUtil;
import me.earth.earthhack.impl.util.minecraft.blocks.mine.MineUtil;
import me.earth.earthhack.impl.util.minecraft.entity.EntityUtil;
import me.earth.earthhack.impl.util.text.ChatUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import java.util.List;
public class HelperLiquids implements Globals
{
public PlaceData calculate(HelperPlace placeHelper,
PlaceData placeData,
List<EntityPlayer> friends,
List<EntityPlayer> players,
float minDamage)
{
PlaceData newData = new PlaceData(minDamage);
newData.setTarget(placeData.getTarget());
for (PositionData data : placeData.getLiquid())
{
if (placeHelper.validate(data, friends) != null)
{
placeHelper.calcPositionData(newData, data, players);
}
}
return newData;
}
public EnumFacing getAbsorbFacing(BlockPos pos,
List<Entity> entities,
IBlockAccess access,
double placeRange)
{
for (EnumFacing facing : EnumFacing.VALUES)
{
if (facing == EnumFacing.DOWN)
{
continue;
}
BlockPos offset = pos.offset(facing);
if (BlockUtil.getDistanceSq(offset) >= MathUtil.square(placeRange))
{
continue;
}
if (access.getBlockState(offset).getMaterial().isReplaceable())
{
boolean found = false;
AxisAlignedBB bb = new AxisAlignedBB(offset);
for (Entity entity : entities)
{
if (entity == null
|| EntityUtil.isDead(entity)
|| !entity.preventEntitySpawning)
{
continue;
}
if (entity.getEntityBoundingBox().intersects(bb))
{
found = true;
break;
}
}
if (found)
{
continue;
}
return facing;
}
}
return null;
}
// TODO: make this utility method somewhere else, MineUtil maybe
public static MineSlots getSlots(boolean onGroundCheck)
{
int bestBlock = -1;
int bestTool = -1;
float maxSpeed = 0.0f;
for (int i = 8; i > -1; i--)
{
ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (stack.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock) stack.getItem()).getBlock();
int tool = MineUtil.findBestTool(BlockPos.ORIGIN,
block.getDefaultState());
float damage = MineUtil.getDamage(
block.getDefaultState(),
mc.player.inventory.getStackInSlot(tool),
BlockPos.ORIGIN,
!onGroundCheck
|| RotationUtil.getRotationPlayer().onGround);
if (damage > maxSpeed)
{
bestBlock = i;
bestTool = tool;
maxSpeed = damage;
}
}
}
return new MineSlots(bestBlock, bestTool, maxSpeed);
}
}
| 4,456 | 0.53658 | 0.535233 | 129 | 33.542637 | 23.594116 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55814 | false | false |
0
|
ca9c4b182daa8ce67bf76e921541fec9fb1e9ffd
| 37,082,747,672,990 |
623925f8cad42cd4bb613a84d9359dd39d3043e6
|
/app/src/main/java/edu/kit/psegruppe3/mensax/SearchableActivity.java
|
53da9d2f0f8b17a1aa15087f70f97d42a10f3d11
|
[] |
no_license
|
stefanomcl/MensaX
|
https://github.com/stefanomcl/MensaX
|
43d3961029eeafc511a9966c79eebefc0dc37573
|
d16ba1f737fbd1db9b3322699f859ae882144a73
|
refs/heads/master
| 2019-07-25T10:54:31.654000 | 2015-09-26T19:58:11 | 2015-09-26T19:58:11 | 37,688,184 | 0 | 0 | null | true | 2015-06-18T22:13:26 | 2015-06-18T22:13:25 | 2015-06-14T13:32:15 | 2015-06-16T21:55:49 | 0 | 0 | 0 | 0 | null | null | null |
package edu.kit.psegruppe3.mensax;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import edu.kit.psegruppe3.mensax.data.CanteenContract;
/**
* Activity that performs searches on the meal database and present results.
*
* @author MensaX-group
* @version 1.1
*/
public class SearchableActivity extends ActionBarActivity {
/**
* CODE to determine if the search request is a merge request.
*/
public static final int REQUEST_CODE = 1337;
/**
* The argument parameter of the searched meal.
*/
public static final String ARG_SELECT_MEAL = "selectMeal";
private SearchListAdapter mSearchListAdapter;
/**
* {@inheritDoc}
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchable);
ListView listView = (ListView) findViewById(R.id.search_listview);
mSearchListAdapter = new SearchListAdapter(this, null, 0);
listView.setAdapter(mSearchListAdapter);
final Intent intent = getIntent();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Cursor cursor = (Cursor) parent.getItemAtPosition(position);
if (cursor != null) {
int mealId = cursor.getInt(cursor.getColumnIndex(CanteenContract.MealEntry.COLUMN_MEAL_ID));
if (intent.hasExtra(ARG_SELECT_MEAL) && intent.getBooleanExtra(ARG_SELECT_MEAL, false)) {
Intent result = new Intent(SearchableActivity.this, DetailActivity.class)
.putExtra(DetailActivity.ARG_MEAL_ID, mealId);
setResult(Activity.RESULT_OK, result);
finish();
} else {
Intent result = new Intent(SearchableActivity.this, DetailActivity.class)
.putExtra(DetailActivity.ARG_MEAL_ID, mealId);
startActivity(result);
}
}
}
});
// Get the intent, verify the action and get the query
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
doMySearch(query);
}
if (listView.getCount() == 0) {
TextView emptyTextView = (TextView) findViewById(R.id.search_empty_textview);
emptyTextView.setVisibility(View.VISIBLE);
}
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
setResult(Activity.RESULT_CANCELED);
finish();
}
return super.onOptionsItemSelected(item);
}
/**
* Method that executes the search request.
* @param query the query of the search
*/
private void doMySearch(String query) {
Cursor cursor = query(query);
mSearchListAdapter.swapCursor(cursor);
}
private Cursor query(String query) {
Cursor cursor = getContentResolver().query(CanteenContract.MealEntry.CONTENT_URI, null,
CanteenContract.MealEntry.COLUMN_MEAL_NAME + " LIKE ?",
new String[]{"%" + query + "%"},
null);
if (cursor == null) {
return null;
} else if (!cursor.moveToFirst()) {
cursor.close();
return null;
}
return cursor;
}
}
|
UTF-8
|
Java
| 4,172 |
java
|
SearchableActivity.java
|
Java
|
[
{
"context": "e meal database and present results.\n *\n * @author MensaX-group\n * @version 1.1\n */\npublic class SearchableActivi",
"end": 597,
"score": 0.7984467148780823,
"start": 585,
"tag": "NAME",
"value": "MensaX-group"
}
] | null |
[] |
package edu.kit.psegruppe3.mensax;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import edu.kit.psegruppe3.mensax.data.CanteenContract;
/**
* Activity that performs searches on the meal database and present results.
*
* @author MensaX-group
* @version 1.1
*/
public class SearchableActivity extends ActionBarActivity {
/**
* CODE to determine if the search request is a merge request.
*/
public static final int REQUEST_CODE = 1337;
/**
* The argument parameter of the searched meal.
*/
public static final String ARG_SELECT_MEAL = "selectMeal";
private SearchListAdapter mSearchListAdapter;
/**
* {@inheritDoc}
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchable);
ListView listView = (ListView) findViewById(R.id.search_listview);
mSearchListAdapter = new SearchListAdapter(this, null, 0);
listView.setAdapter(mSearchListAdapter);
final Intent intent = getIntent();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Cursor cursor = (Cursor) parent.getItemAtPosition(position);
if (cursor != null) {
int mealId = cursor.getInt(cursor.getColumnIndex(CanteenContract.MealEntry.COLUMN_MEAL_ID));
if (intent.hasExtra(ARG_SELECT_MEAL) && intent.getBooleanExtra(ARG_SELECT_MEAL, false)) {
Intent result = new Intent(SearchableActivity.this, DetailActivity.class)
.putExtra(DetailActivity.ARG_MEAL_ID, mealId);
setResult(Activity.RESULT_OK, result);
finish();
} else {
Intent result = new Intent(SearchableActivity.this, DetailActivity.class)
.putExtra(DetailActivity.ARG_MEAL_ID, mealId);
startActivity(result);
}
}
}
});
// Get the intent, verify the action and get the query
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
doMySearch(query);
}
if (listView.getCount() == 0) {
TextView emptyTextView = (TextView) findViewById(R.id.search_empty_textview);
emptyTextView.setVisibility(View.VISIBLE);
}
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
setResult(Activity.RESULT_CANCELED);
finish();
}
return super.onOptionsItemSelected(item);
}
/**
* Method that executes the search request.
* @param query the query of the search
*/
private void doMySearch(String query) {
Cursor cursor = query(query);
mSearchListAdapter.swapCursor(cursor);
}
private Cursor query(String query) {
Cursor cursor = getContentResolver().query(CanteenContract.MealEntry.CONTENT_URI, null,
CanteenContract.MealEntry.COLUMN_MEAL_NAME + " LIKE ?",
new String[]{"%" + query + "%"},
null);
if (cursor == null) {
return null;
} else if (!cursor.moveToFirst()) {
cursor.close();
return null;
}
return cursor;
}
}
| 4,172 | 0.613615 | 0.610738 | 120 | 33.766666 | 27.765907 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.525 | false | false |
0
|
81560ae6d7b80ccec8b07beaf0ee7b569dc1534f
| 10,290,741,662,278 |
099bf4438e7b7e2b9e2a4c87e30c4cc69f1fd02c
|
/src/test/java/org/example/model/AuctionTest.java
|
16035e807253a315c3925e71cbabac90aaaaf51d
|
[] |
no_license
|
ankajain/auction-system
|
https://github.com/ankajain/auction-system
|
06d0034d1d2934e8b28165492f65215a3af0eb52
|
031f062f5c76573243209229219533b0eee79360
|
refs/heads/master
| 2023-01-21T21:45:08.338000 | 2020-11-23T05:24:15 | 2020-11-23T05:24:15 | 315,208,975 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.example.model;
import org.junit.Test;
public class AuctionTest {
@Test
public void createBid() {
}
}
|
UTF-8
|
Java
| 127 |
java
|
AuctionTest.java
|
Java
|
[] | null |
[] |
package org.example.model;
import org.junit.Test;
public class AuctionTest {
@Test
public void createBid() {
}
}
| 127 | 0.669291 | 0.669291 | 10 | 11.8 | 11.79661 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
0
|
592dc57ad221f91234b91fdf9670eecab1c2b8db
| 27,736,898,813,354 |
8f9ad73422da34bd059772457ab29ab51466e7ec
|
/src/be/ac/kuleuven/cs/drama/gui/EditFrameToolBarFactory.java
|
425135bf5586ac16fd34c4e962eb54ac853742e4
|
[] |
no_license
|
WillemDeGroef/drama
|
https://github.com/WillemDeGroef/drama
|
f91ca41fd1b77f287e0537a54250cbff69d3a4b9
|
c823de4bb9e73fd3d236b2395cbc5859609c1ee1
|
refs/heads/master
| 2023-02-04T21:58:15.178000 | 2023-01-23T09:32:09 | 2023-01-23T09:32:09 | 24,713,631 | 8 | 13 | null | false | 2022-09-29T15:00:23 | 2014-10-02T09:30:50 | 2019-12-14T10:14:42 | 2022-09-29T15:00:23 | 370 | 3 | 5 | 2 |
Java
| false | false |
/**
*
* CVS: $Header: /export/home0/cvsroot/socsg/DRAMA/Sources/be/ac/kuleuven/cs/drama/gui/EditFrameToolBarFactory.java,v 1.1.1.1 2001/09/07 09:41:37 dirkw Exp $
*
* (C) 2000
* Katholieke Universiteit Leuven
* Developed at Dept. Computer Science
*
*/
package be.ac.kuleuven.cs.drama.gui;
import javax.swing.JButton;
import javax.swing.JToolBar;
/**
* This class manages the creation of the toolbar of the edit frame.
*
* @version 0.2.0 09/04/2000
* @author Tom Schrijvers
*/
public class EditFrameToolBarFactory {
private final ActionManager _actionManager;
private JToolBar _toolBar;
/**
* Init a new EditFrameToolBarFactory
*/
public EditFrameToolBarFactory(ActionManager actionManager) {
_actionManager = actionManager;
}
/**
* returns the toolbar that is managed
*
* @return the managed toolbar
*/
public JToolBar getToolBar() {
if (_toolBar == null) {
createToolBar();
}
return _toolBar;
}
/*
* Create the toolbar. Call only once !
*/
private void createToolBar() {
_toolBar = new JToolBar();
addNewFile();
addOpenFile();
addSaveFile();
_toolBar.addSeparator();
addPrecompile();
addCompile();
addShowExecuteFrame();
_toolBar.addSeparator();
addStopPrecompilation();
}
private void addNewFile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getNewFileAction());
_toolBar.add(button);
}
private void addOpenFile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getOpenFileAction());
_toolBar.add(button);
}
private void addSaveFile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getSaveFileAction());
_toolBar.add(button);
}
private void addPrecompile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getPrecompileAction());
_toolBar.add(button);
}
private void addCompile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getCompileAction());
_toolBar.add(button);
}
private void addShowExecuteFrame() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getShowExecuteFrameAction());
_toolBar.add(button);
}
private void addStopPrecompilation() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getStopPrecompilationAction());
_toolBar.add(button);
}
}
|
UTF-8
|
Java
| 2,371 |
java
|
EditFrameToolBarFactory.java
|
Java
|
[
{
"context": "/09/07 09:41:37 dirkw Exp $\n *\n * (C) 2000\n * Katholieke Universiteit Leuven\n * Developed at Dept. Compute",
"end": 193,
"score": 0.6777283549308777,
"start": 187,
"tag": "NAME",
"value": "olieke"
},
{
"context": "7 dirkw Exp $\n *\n * (C) 2000\n * Katholieke Universiteit Leuven\n * Developed at Dept. Computer Science\n *\n */\npac",
"end": 213,
"score": 0.6102313995361328,
"start": 201,
"tag": "NAME",
"value": "iteit Leuven"
},
{
"context": " frame.\n *\n * @version 0.2.0 09/04/2000\n * @author Tom Schrijvers\n */\n\npublic class EditFrameToolBarFactory {\n\n\tpri",
"end": 486,
"score": 0.9993366599082947,
"start": 472,
"tag": "NAME",
"value": "Tom Schrijvers"
}
] | null |
[] |
/**
*
* CVS: $Header: /export/home0/cvsroot/socsg/DRAMA/Sources/be/ac/kuleuven/cs/drama/gui/EditFrameToolBarFactory.java,v 1.1.1.1 2001/09/07 09:41:37 dirkw Exp $
*
* (C) 2000
* Katholieke Univers<NAME>
* Developed at Dept. Computer Science
*
*/
package be.ac.kuleuven.cs.drama.gui;
import javax.swing.JButton;
import javax.swing.JToolBar;
/**
* This class manages the creation of the toolbar of the edit frame.
*
* @version 0.2.0 09/04/2000
* @author <NAME>
*/
public class EditFrameToolBarFactory {
private final ActionManager _actionManager;
private JToolBar _toolBar;
/**
* Init a new EditFrameToolBarFactory
*/
public EditFrameToolBarFactory(ActionManager actionManager) {
_actionManager = actionManager;
}
/**
* returns the toolbar that is managed
*
* @return the managed toolbar
*/
public JToolBar getToolBar() {
if (_toolBar == null) {
createToolBar();
}
return _toolBar;
}
/*
* Create the toolbar. Call only once !
*/
private void createToolBar() {
_toolBar = new JToolBar();
addNewFile();
addOpenFile();
addSaveFile();
_toolBar.addSeparator();
addPrecompile();
addCompile();
addShowExecuteFrame();
_toolBar.addSeparator();
addStopPrecompilation();
}
private void addNewFile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getNewFileAction());
_toolBar.add(button);
}
private void addOpenFile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getOpenFileAction());
_toolBar.add(button);
}
private void addSaveFile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getSaveFileAction());
_toolBar.add(button);
}
private void addPrecompile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getPrecompileAction());
_toolBar.add(button);
}
private void addCompile() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getCompileAction());
_toolBar.add(button);
}
private void addShowExecuteFrame() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getShowExecuteFrameAction());
_toolBar.add(button);
}
private void addStopPrecompilation() {
JButton button = new ToolBarButton();
button.setAction(_actionManager.getStopPrecompilationAction());
_toolBar.add(button);
}
}
| 2,357 | 0.714466 | 0.700127 | 105 | 21.580952 | 22.824289 | 157 | false | false | 0 | 0 | 0 | 0 | 93 | 0.039224 | 1.390476 | false | false |
0
|
c1d222778b86e2d2b02cb29a119d6816e3c61e0a
| 10,574,209,510,003 |
686cb81a2fed3a687a30ce563175d84789b57a96
|
/src/de/jeffclan/RandomMessage/JeffRandomMessagePlugin.java
|
4267c10405327a1eb0cf5641559defe8a1ac3b2c
|
[] |
no_license
|
JEFF-Media-GbR/Spigot-RandomMessage
|
https://github.com/JEFF-Media-GbR/Spigot-RandomMessage
|
0cd1b0c8b94155e2c48db46ce74fced8de65fa70
|
f1b6a49abb5455ea3dea805f61984393125f1e54
|
refs/heads/master
| 2020-04-05T16:38:10.739000 | 2018-11-10T22:15:21 | 2018-11-10T22:15:21 | 157,021,985 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.jeffclan.RandomMessage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.plugin.java.JavaPlugin;
public class JeffRandomMessagePlugin extends JavaPlugin {
private boolean usingMatchingConfig = true;
private int currentConfigVersion = 1;
private int currentMessage = 0;
private ArrayList<String[]> broadcasts;
@Override
public void onEnable() {
createConfig();
loadMessages();
getCommand("randommessage").setExecutor(new JeffRandomMessageCommandExecutor(this));
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
String[] message = getNextMessage();
if (message != null) {
broadcastMessage(message);
}
}
}, 0, getConfig().getLong("delay") * 20);
}
public String[] getNextMessage() {
if (broadcasts.size() == 0) {
return null;
}
if (currentMessage >= broadcasts.size()) {
currentMessage = 0;
if (getConfig().getBoolean("random-order")) {
Collections.shuffle(broadcasts);
}
}
currentMessage++;
return broadcasts.get(currentMessage - 1);
}
public void broadcastMessage(String[] text) {
for (String line : text) {
getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', line));
}
}
protected void loadMessages() {
broadcasts = new ArrayList<String[]>();
currentMessage = 0;
File messagesFolder = new File(
getDataFolder().getAbsolutePath() + File.separator + "messages" + File.separator);
File[] listOfMessageFiles = messagesFolder.listFiles();
Arrays.sort(listOfMessageFiles);
for (File file : listOfMessageFiles) {
if (file.isFile()) {
try {
broadcasts.add(JeffRandomMessageUtils.getStringArrayFile(file));
} catch (FileNotFoundException e) {
getLogger().warning("Could not load message file: " + file.getName());
// e.printStackTrace();
}
}
}
if (getConfig().getBoolean("random-order")) {
Collections.shuffle(broadcasts);
}
getLogger().info(String.format("%d messages loaded. Broadcasting started with %d seconds delay.",
broadcasts.size(), getConfig().getLong("delay")));
}
private void createConfig() {
this.saveDefaultConfig();
if (getConfig().getInt("config-version", 0) < 1) {
getLogger().warning("========================================================");
getLogger().warning("You are using a config file that has been generated");
getLogger().warning("prior to RandomMessage version 1.0.");
getLogger().warning("To allow everyone to use the new features, your config");
getLogger().warning("has been renamed to config.old.yml and a new one has");
getLogger().warning("been generated. Please examine the new config file to");
getLogger().warning("see the new possibilities and adjust your settings.");
getLogger().warning("========================================================");
File configFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.yml");
File oldConfigFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.old.yml");
if (oldConfigFile.getAbsoluteFile().exists()) {
oldConfigFile.getAbsoluteFile().delete();
}
configFile.getAbsoluteFile().renameTo(oldConfigFile.getAbsoluteFile());
saveDefaultConfig();
try {
getConfig().load(configFile.getAbsoluteFile());
} catch (IOException | InvalidConfigurationException e) {
getLogger().warning("Could not load freshly generated config file!");
e.printStackTrace();
}
} else if (getConfig().getInt("config-version", 0) != currentConfigVersion) {
getLogger().warning("========================================================");
getLogger().warning("YOU ARE USING AN OLD CONFIG FILE!");
getLogger().warning("This is not a problem, as RandomMessage will just use the");
getLogger().warning("default settings for unset values. However, if you want");
getLogger().warning("to configure the new options, please go to");
getLogger().warning("<missing link>");
getLogger().warning("and replace your config.yml with the new one. You can");
getLogger().warning("then insert your old changes into the new file.");
getLogger().warning("========================================================");
usingMatchingConfig = false;
}
File playerDataFolder = new File(getDataFolder().getPath() + File.separator + "messages");
if (!playerDataFolder.getAbsoluteFile().exists()) {
playerDataFolder.mkdir();
}
getConfig().addDefault("delay", 300);
getConfig().addDefault("check-for-updates", "true");
getConfig().addDefault("random-order", true);
}
}
|
UTF-8
|
Java
| 4,858 |
java
|
JeffRandomMessagePlugin.java
|
Java
|
[
{
"context": "package de.jeffclan.RandomMessage;\n\nimport java.io.File;\nimport java.",
"end": 19,
"score": 0.6721321940422058,
"start": 13,
"tag": "USERNAME",
"value": "ffclan"
}
] | null |
[] |
package de.jeffclan.RandomMessage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.plugin.java.JavaPlugin;
public class JeffRandomMessagePlugin extends JavaPlugin {
private boolean usingMatchingConfig = true;
private int currentConfigVersion = 1;
private int currentMessage = 0;
private ArrayList<String[]> broadcasts;
@Override
public void onEnable() {
createConfig();
loadMessages();
getCommand("randommessage").setExecutor(new JeffRandomMessageCommandExecutor(this));
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
String[] message = getNextMessage();
if (message != null) {
broadcastMessage(message);
}
}
}, 0, getConfig().getLong("delay") * 20);
}
public String[] getNextMessage() {
if (broadcasts.size() == 0) {
return null;
}
if (currentMessage >= broadcasts.size()) {
currentMessage = 0;
if (getConfig().getBoolean("random-order")) {
Collections.shuffle(broadcasts);
}
}
currentMessage++;
return broadcasts.get(currentMessage - 1);
}
public void broadcastMessage(String[] text) {
for (String line : text) {
getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', line));
}
}
protected void loadMessages() {
broadcasts = new ArrayList<String[]>();
currentMessage = 0;
File messagesFolder = new File(
getDataFolder().getAbsolutePath() + File.separator + "messages" + File.separator);
File[] listOfMessageFiles = messagesFolder.listFiles();
Arrays.sort(listOfMessageFiles);
for (File file : listOfMessageFiles) {
if (file.isFile()) {
try {
broadcasts.add(JeffRandomMessageUtils.getStringArrayFile(file));
} catch (FileNotFoundException e) {
getLogger().warning("Could not load message file: " + file.getName());
// e.printStackTrace();
}
}
}
if (getConfig().getBoolean("random-order")) {
Collections.shuffle(broadcasts);
}
getLogger().info(String.format("%d messages loaded. Broadcasting started with %d seconds delay.",
broadcasts.size(), getConfig().getLong("delay")));
}
private void createConfig() {
this.saveDefaultConfig();
if (getConfig().getInt("config-version", 0) < 1) {
getLogger().warning("========================================================");
getLogger().warning("You are using a config file that has been generated");
getLogger().warning("prior to RandomMessage version 1.0.");
getLogger().warning("To allow everyone to use the new features, your config");
getLogger().warning("has been renamed to config.old.yml and a new one has");
getLogger().warning("been generated. Please examine the new config file to");
getLogger().warning("see the new possibilities and adjust your settings.");
getLogger().warning("========================================================");
File configFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.yml");
File oldConfigFile = new File(getDataFolder().getAbsolutePath() + File.separator + "config.old.yml");
if (oldConfigFile.getAbsoluteFile().exists()) {
oldConfigFile.getAbsoluteFile().delete();
}
configFile.getAbsoluteFile().renameTo(oldConfigFile.getAbsoluteFile());
saveDefaultConfig();
try {
getConfig().load(configFile.getAbsoluteFile());
} catch (IOException | InvalidConfigurationException e) {
getLogger().warning("Could not load freshly generated config file!");
e.printStackTrace();
}
} else if (getConfig().getInt("config-version", 0) != currentConfigVersion) {
getLogger().warning("========================================================");
getLogger().warning("YOU ARE USING AN OLD CONFIG FILE!");
getLogger().warning("This is not a problem, as RandomMessage will just use the");
getLogger().warning("default settings for unset values. However, if you want");
getLogger().warning("to configure the new options, please go to");
getLogger().warning("<missing link>");
getLogger().warning("and replace your config.yml with the new one. You can");
getLogger().warning("then insert your old changes into the new file.");
getLogger().warning("========================================================");
usingMatchingConfig = false;
}
File playerDataFolder = new File(getDataFolder().getPath() + File.separator + "messages");
if (!playerDataFolder.getAbsoluteFile().exists()) {
playerDataFolder.mkdir();
}
getConfig().addDefault("delay", 300);
getConfig().addDefault("check-for-updates", "true");
getConfig().addDefault("random-order", true);
}
}
| 4,858 | 0.67394 | 0.67044 | 148 | 31.824324 | 29.750929 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.378378 | false | false |
0
|
754e1d33a86f15850a4d3102d12be2c3acd3e066
| 10,574,209,508,516 |
ada3d4eaf2cd1e4e12f0cc6f5d894e57d28cb779
|
/app/src/main/java/edu/etzion/koletzion/database/BitmapSerializer.java
|
0ea9dda439144338467a4798d37e181970071ceb
|
[] |
no_license
|
Fongeme/KolEtzion
|
https://github.com/Fongeme/KolEtzion
|
57edbce1397da53ab3835b3f7d20fa84a911210d
|
63b0df1dc13b63d4731fd061ed5626b8a3da5fa5
|
refs/heads/master
| 2020-04-28T22:51:35.119000 | 2019-04-08T20:57:41 | 2019-04-08T20:57:41 | 175,632,519 | 0 | 3 | null | false | 2019-04-07T20:15:39 | 2019-03-14T13:55:35 | 2019-04-07T20:15:25 | 2019-04-07T20:15:38 | 8,050 | 0 | 4 | 1 |
Java
| false | false |
package edu.etzion.koletzion.database;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.util.Base64;
import android.widget.ImageView;
import java.io.ByteArrayOutputStream;
public class BitmapSerializer {
public static Bitmap decodeStringToBitmap(String encodedBitmap) {
byte[] decodedBytes = Base64.decode(encodedBitmap, 0);
return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
}
public static String encodeBitmapToString(Bitmap bitmap) {
ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 20, byteArrayOS);
// float i = 50;
// for (int j = 1; j < 10; j++) {
// if (bitmap.getAllocationByteCount() == 700000) {
// bitmap.compress(Bitmap.CompressFormat.JPEG, (int) Math.ceil(i), byteArrayOS);
// System.out.println("equals");
// } else if (bitmap.getAllocationByteCount() > 700000) {
// bitmap.compress(Bitmap.CompressFormat.JPEG, (int) Math.ceil(i /= (2f * j)), byteArrayOS);
// System.out.println("large");
// } else if (bitmap.getAllocationByteCount() < 700000) {
// bitmap.compress(Bitmap.CompressFormat.JPEG, (int) Math.ceil(i *= (2f / j)), byteArrayOS);
// System.out.println("small");
// }
// System.out.println(bitmap.getAllocationByteCount());
// }
return Base64.encodeToString(byteArrayOS.toByteArray(), Base64.DEFAULT);
}
public static Bitmap getBitmapFromImageView(ImageView imageView) {
return ((BitmapDrawable) imageView.getDrawable()).getBitmap();
}
}
|
UTF-8
|
Java
| 1,589 |
java
|
BitmapSerializer.java
|
Java
|
[] | null |
[] |
package edu.etzion.koletzion.database;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.util.Base64;
import android.widget.ImageView;
import java.io.ByteArrayOutputStream;
public class BitmapSerializer {
public static Bitmap decodeStringToBitmap(String encodedBitmap) {
byte[] decodedBytes = Base64.decode(encodedBitmap, 0);
return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
}
public static String encodeBitmapToString(Bitmap bitmap) {
ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 20, byteArrayOS);
// float i = 50;
// for (int j = 1; j < 10; j++) {
// if (bitmap.getAllocationByteCount() == 700000) {
// bitmap.compress(Bitmap.CompressFormat.JPEG, (int) Math.ceil(i), byteArrayOS);
// System.out.println("equals");
// } else if (bitmap.getAllocationByteCount() > 700000) {
// bitmap.compress(Bitmap.CompressFormat.JPEG, (int) Math.ceil(i /= (2f * j)), byteArrayOS);
// System.out.println("large");
// } else if (bitmap.getAllocationByteCount() < 700000) {
// bitmap.compress(Bitmap.CompressFormat.JPEG, (int) Math.ceil(i *= (2f / j)), byteArrayOS);
// System.out.println("small");
// }
// System.out.println(bitmap.getAllocationByteCount());
// }
return Base64.encodeToString(byteArrayOS.toByteArray(), Base64.DEFAULT);
}
public static Bitmap getBitmapFromImageView(ImageView imageView) {
return ((BitmapDrawable) imageView.getDrawable()).getBitmap();
}
}
| 1,589 | 0.736312 | 0.713027 | 40 | 38.724998 | 28.528921 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.5 | false | false |
0
|
da104ed904ece45aec14e0f5ed4abc0fb60a8345
| 2,619,930,073,484 |
cc3180c344c299d627852947978a8211434c652b
|
/foundation-ui/src/main/java/com/brazoft/foundation/gwt/client/ui/StringColumn.java
|
21bb41261e0f5d7a446ff42c17c08768198005e2
|
[] |
no_license
|
chrisreichel/foundation
|
https://github.com/chrisreichel/foundation
|
5dd8203ee602a446b8343656fcaa3752251f6ca5
|
124e662ea768804ef29cee8bd91a97c7d8fc977f
|
refs/heads/master
| 2021-01-24T05:15:01.008000 | 2015-06-23T11:56:20 | 2015-06-23T11:56:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.brazoft.foundation.gwt.client.ui;
import com.brazoft.foundation.commons.format.api.Format;
import com.brazoft.foundation.gwt.client.ui.api.TextGridColumn;
import com.brazoft.foundation.gwt.client.util.JSArrays;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.jso.JSObject;
public final class StringColumn<J extends JSObject>
extends TextGridColumn<StringColumn<J>, J> {
private Format<String> format;
public StringColumn() {
super();
}
public StringColumn(Format<String> format) {
this.format = format;
}
public final String toString(J object) {
String value = object.get(this.getName());
if (this.format != null) {
value = this.format.format(value);
}
return value;
}
@Override
protected void doSort(JsArray<J> rows, String name, SortDirection direction) {
JSArrays.sort(rows, name, direction.direction());
}
}
|
UTF-8
|
Java
| 879 |
java
|
StringColumn.java
|
Java
|
[] | null |
[] |
package com.brazoft.foundation.gwt.client.ui;
import com.brazoft.foundation.commons.format.api.Format;
import com.brazoft.foundation.gwt.client.ui.api.TextGridColumn;
import com.brazoft.foundation.gwt.client.util.JSArrays;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.jso.JSObject;
public final class StringColumn<J extends JSObject>
extends TextGridColumn<StringColumn<J>, J> {
private Format<String> format;
public StringColumn() {
super();
}
public StringColumn(Format<String> format) {
this.format = format;
}
public final String toString(J object) {
String value = object.get(this.getName());
if (this.format != null) {
value = this.format.format(value);
}
return value;
}
@Override
protected void doSort(JsArray<J> rows, String name, SortDirection direction) {
JSArrays.sort(rows, name, direction.direction());
}
}
| 879 | 0.745165 | 0.745165 | 35 | 24.142857 | 23.177752 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false |
0
|
17440a3981df560997d42cdeb16179a59e1356ae
| 27,573,690,059,673 |
270aa8c88e387531b05cf20c60fdcfe7c6a6a8a3
|
/src/main/java/com/omexit/csvparser/exceptions/DateParseException.java
|
112dcb57bd784251236edf78c18b0420d5156082
|
[] |
no_license
|
OmexIT/csvparser
|
https://github.com/OmexIT/csvparser
|
cfa7a0daed71a2bab1ecb79b7f50f67057c4f639
|
921a929e14d8c24fc2455463614400c2943841a1
|
refs/heads/master
| 2021-07-25T22:43:14.916000 | 2019-12-09T09:33:55 | 2019-12-09T09:33:55 | 226,786,916 | 0 | 0 | null | false | 2020-10-13T18:04:36 | 2019-12-09T04:48:15 | 2019-12-09T09:34:36 | 2020-10-13T18:04:35 | 48 | 0 | 0 | 1 |
Java
| false | false |
package com.omexit.csvparser.exceptions;
public class DateParseException extends RuntimeException{
public DateParseException(String s, Throwable throwable) {
super(s, throwable);
}
}
|
UTF-8
|
Java
| 201 |
java
|
DateParseException.java
|
Java
|
[] | null |
[] |
package com.omexit.csvparser.exceptions;
public class DateParseException extends RuntimeException{
public DateParseException(String s, Throwable throwable) {
super(s, throwable);
}
}
| 201 | 0.751244 | 0.751244 | 8 | 24.125 | 24.61421 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
0
|
6acb184c3805e94a9695fce677974f589822488a
| 17,514,876,658,504 |
d5e0f9e7d08fda5d3eea859daa3edd72ce673f81
|
/ACADEMY/Day13/src/pckmain/Quiz01.java
|
1e4b95c098928bee89be92e410b8b9f919cea4ab
|
[] |
no_license
|
MarkChanwoongKim/Java-study
|
https://github.com/MarkChanwoongKim/Java-study
|
cc87fae39fa9847a40b631f3d4d00a041af2480e
|
e91cb43e3790808fc02535a69efb62b6a846e40e
|
refs/heads/master
| 2020-03-05T21:22:52.550000 | 2019-09-08T11:53:11 | 2019-09-08T11:53:11 | 85,906,554 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pckmain;
import pcksrc.Unit;
class Tank extends Unit {
int random;
Tank(int i) {
name = i + "번 탱크";
hp = 1000;
alive = true;
}
public void attack(Unit enemy) {
random = (int) (Math.random() * 10) + 1;
if (random < 2) {
enemy.hp -= 30;
System.out.println(this.name + "이(가) " + enemy.name + "을 30 데미지로 공격");
} else {
enemy.hp -= 10;
System.out.println(this.name + "이(가) " + enemy.name + "을 10 데미지로 공격");
}
if (enemy.hp < 0) {
enemy.alive = false;
}
return;
}
}
class Sniper extends Unit {
int random;
Sniper(int i) {
name = i + "번 저격수";
hp = 250;
alive = true;
}
public void attack(Unit enemy) {
random = (int) (Math.random() * 10) + 1;
if (random < 2) {
enemy.alive = false;
System.out.println(this.name + "이(가) " + enemy.name + "을 " + "해드샷!");
} else {
enemy.hp -= 30;
System.out.println(this.name + "이(가) " + enemy.name + "을 30 데미지로 공격");
}
if (enemy.hp < 0) {
enemy.alive = false;
}
return;
}
}
public class Quiz01 {
public static void main(String[] args) {
int i = 0;
String winner = "";
int random1, random2, winnerHp;
random1 = (int) (Math.random() * 10);
random2 = (int) (Math.random() * 10);
Unit u1 = new Unit();
Unit u2 = new Unit();
i++;
if (random1 < 5) {
u1 = new Tank(i);
} else {
u1 = new Sniper(i);
}
i++;
if (random2 < 5) {
u2 = new Tank(i);
} else {
u2 = new Sniper(i);
}
// //Unit u1 = Math.random() > 0.5 ? new Tank() : new Sniper();
// Unit u2 = Math.random() > 0.5 ? new Tank() : new Sniper();
while (true) {
u1.attack(u2);
if (!u2.alive) {
System.out.println(u2.name + " 사망!!!!!");
break;
}
u2.attack(u1);
if (!u1.alive) {
System.out.println(u1.name + " 사망!!!!!");
break;
}
}
if (u1.alive == true) {
winner = u1.name;
winnerHp = u1.hp;
} else {
winner = u2.name;
winnerHp = u2.hp;
}
System.out.println(u1.name + " 와(과) " + u2.name + " 중 " + winner + "가 hp:" + winnerHp + "남기고 승리");
}
}
|
UHC
|
Java
| 2,128 |
java
|
Quiz01.java
|
Java
|
[] | null |
[] |
package pckmain;
import pcksrc.Unit;
class Tank extends Unit {
int random;
Tank(int i) {
name = i + "번 탱크";
hp = 1000;
alive = true;
}
public void attack(Unit enemy) {
random = (int) (Math.random() * 10) + 1;
if (random < 2) {
enemy.hp -= 30;
System.out.println(this.name + "이(가) " + enemy.name + "을 30 데미지로 공격");
} else {
enemy.hp -= 10;
System.out.println(this.name + "이(가) " + enemy.name + "을 10 데미지로 공격");
}
if (enemy.hp < 0) {
enemy.alive = false;
}
return;
}
}
class Sniper extends Unit {
int random;
Sniper(int i) {
name = i + "번 저격수";
hp = 250;
alive = true;
}
public void attack(Unit enemy) {
random = (int) (Math.random() * 10) + 1;
if (random < 2) {
enemy.alive = false;
System.out.println(this.name + "이(가) " + enemy.name + "을 " + "해드샷!");
} else {
enemy.hp -= 30;
System.out.println(this.name + "이(가) " + enemy.name + "을 30 데미지로 공격");
}
if (enemy.hp < 0) {
enemy.alive = false;
}
return;
}
}
public class Quiz01 {
public static void main(String[] args) {
int i = 0;
String winner = "";
int random1, random2, winnerHp;
random1 = (int) (Math.random() * 10);
random2 = (int) (Math.random() * 10);
Unit u1 = new Unit();
Unit u2 = new Unit();
i++;
if (random1 < 5) {
u1 = new Tank(i);
} else {
u1 = new Sniper(i);
}
i++;
if (random2 < 5) {
u2 = new Tank(i);
} else {
u2 = new Sniper(i);
}
// //Unit u1 = Math.random() > 0.5 ? new Tank() : new Sniper();
// Unit u2 = Math.random() > 0.5 ? new Tank() : new Sniper();
while (true) {
u1.attack(u2);
if (!u2.alive) {
System.out.println(u2.name + " 사망!!!!!");
break;
}
u2.attack(u1);
if (!u1.alive) {
System.out.println(u1.name + " 사망!!!!!");
break;
}
}
if (u1.alive == true) {
winner = u1.name;
winnerHp = u1.hp;
} else {
winner = u2.name;
winnerHp = u2.hp;
}
System.out.println(u1.name + " 와(과) " + u2.name + " 중 " + winner + "가 hp:" + winnerHp + "남기고 승리");
}
}
| 2,128 | 0.530663 | 0.495549 | 107 | 17.897196 | 18.929745 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.280374 | false | false |
0
|
b508e492080b17325f171b2f334b3d67c82176ee
| 31,860,067,428,863 |
a0b047a38c82b2180b32c1d92736983f83bd886b
|
/src/main/java/be/kdg/se3/transportss/simulator/entity/RouteRoutingMessage.java
|
dcc6039cb7238db510ea675d1d7909e2b8335fb3
|
[] |
no_license
|
JorenVdV/SE3-Examenproject
|
https://github.com/JorenVdV/SE3-Examenproject
|
a8abd190e994ecd9c6d960bf7da449e9faf6412a
|
94dbbf3fb0011bdb6e88c211ab19ab6054027d55
|
refs/heads/master
| 2021-01-23T00:20:26.010000 | 2016-11-11T12:45:22 | 2016-11-11T12:45:22 | 85,717,956 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package be.kdg.se3.transportss.simulator.entity;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Data Transfer Object read by the RouteRoutingService
*
* Created by Joren Van de Vondel on 11/3/2016.
*/
@XmlRootElement
public class RouteRoutingMessage {
public enum Status {
UNDERWAY,
ARRIVED,
UNDELIVERABLE,
LOST
}
private int luggageID;
private int conveyorID;
private Status status;
public RouteRoutingMessage() {}
public RouteRoutingMessage(int luggageID, int conveyorID, Status status) {
this.luggageID = luggageID;
this.conveyorID = conveyorID;
this.status = status;
}
public void setLuggageID(int luggageID) {
this.luggageID = luggageID;
}
public void setConveyorID(int conveyorID) {
this.conveyorID = conveyorID;
}
public void setStatus(Status status) {
this.status = status;
}
public int getLuggageID() {
return luggageID;
}
public int getConveyorID() {
return conveyorID;
}
public Status getStatus() {
return status;
}
@Override
public String toString() {
return "RouteRoutingMessage{" +
"luggageID=" + luggageID +
", conveyorID=" + conveyorID +
", status=" + status +
'}';
}
}
|
UTF-8
|
Java
| 1,378 |
java
|
RouteRoutingMessage.java
|
Java
|
[
{
"context": "t read by the RouteRoutingService\n *\n * Created by Joren Van de Vondel on 11/3/2016.\n */\n@XmlRootElement\npublic class Ro",
"end": 196,
"score": 0.9996234774589539,
"start": 177,
"tag": "NAME",
"value": "Joren Van de Vondel"
}
] | null |
[] |
package be.kdg.se3.transportss.simulator.entity;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Data Transfer Object read by the RouteRoutingService
*
* Created by <NAME> on 11/3/2016.
*/
@XmlRootElement
public class RouteRoutingMessage {
public enum Status {
UNDERWAY,
ARRIVED,
UNDELIVERABLE,
LOST
}
private int luggageID;
private int conveyorID;
private Status status;
public RouteRoutingMessage() {}
public RouteRoutingMessage(int luggageID, int conveyorID, Status status) {
this.luggageID = luggageID;
this.conveyorID = conveyorID;
this.status = status;
}
public void setLuggageID(int luggageID) {
this.luggageID = luggageID;
}
public void setConveyorID(int conveyorID) {
this.conveyorID = conveyorID;
}
public void setStatus(Status status) {
this.status = status;
}
public int getLuggageID() {
return luggageID;
}
public int getConveyorID() {
return conveyorID;
}
public Status getStatus() {
return status;
}
@Override
public String toString() {
return "RouteRoutingMessage{" +
"luggageID=" + luggageID +
", conveyorID=" + conveyorID +
", status=" + status +
'}';
}
}
| 1,365 | 0.605951 | 0.600145 | 63 | 20.873016 | 18.289986 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.349206 | false | false |
0
|
8f411c8c27874e67b4e360ba89a6fc14c70a8c35
| 36,120,674,966,811 |
2f199145c8d483e016f4108df6aeeedbeedeb06e
|
/raft-core-service/src/main/java/top/datadriven/raft/core/service/pool/RaftThreadPool.java
|
7654bd0585e44e14342461e6c5ddbd8a2a77c6d4
|
[] |
no_license
|
jinhao11/raft-simple
|
https://github.com/jinhao11/raft-simple
|
6176bba0d6ef45aafbd97c92c2a4459e45c16b64
|
4e1d62e5d6402a33099287cff91fbe59a5fc69c5
|
refs/heads/master
| 2022-12-28T21:07:48.670000 | 2020-05-04T03:09:14 | 2020-05-04T03:09:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package top.datadriven.raft.core.service.pool;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.*;
/**
* @description:
* @author: jiayancheng
* @email: jiayancheng@foxmail.com
* @datetime: 2020/4/19 5:50 下午
* @version: 1.0.0
*/
public class RaftThreadPool {
/**
* 线程工厂,提供创建新线程的功能。
*/
private static final ThreadFactory THREAD_FACTORY = new ThreadFactoryBuilder()
.setNameFormat("raft-pool-%d").build();
/**
* 线程池
*/
private static final ExecutorService executorService = new ThreadPoolExecutor(
// 核心线程数,默认情况下核心线程会一直存活
8,
//线程池所能容纳的最大线程数。
12,
//非核心线程的闲置超时时间,超过这个时间就会被回收。
10,
TimeUnit.SECONDS,
//线程池中的任务队列.(超过核心线程的数量,被放到这里)
new LinkedBlockingDeque<>(1024),
//线程工厂,提供创建新线程的功能。
THREAD_FACTORY,
//当达到最大线程数,且队列已满情况下,执行拒绝策略:抛异常
new ThreadPoolExecutor.AbortPolicy());
/**
* 定义一个线程池,用于处理所有任务
*/
final static ListeningExecutorService listeningExecutorService
= MoreExecutors.listeningDecorator(executorService);
/**
* 执行任务
*/
public static void execute(Runnable runnable) {
executorService.execute(runnable);
}
/**
* 执行任务
*/
public static <T> ListenableFuture<T> execute(Callable<T> callable) {
return listeningExecutorService.submit(callable);
}
}
|
UTF-8
|
Java
| 2,017 |
java
|
RaftThreadPool.java
|
Java
|
[
{
"context": "il.concurrent.*;\n\n/**\n * @description:\n * @author: jiayancheng\n * @email: jiayancheng@foxmail.com\n * @datetime: ",
"end": 370,
"score": 0.9996227025985718,
"start": 359,
"tag": "USERNAME",
"value": "jiayancheng"
},
{
"context": "* @description:\n * @author: jiayancheng\n * @email: jiayancheng@foxmail.com\n * @datetime: 2020/4/19 5:50 下午\n * @version: 1.0.",
"end": 405,
"score": 0.9999287724494934,
"start": 382,
"tag": "EMAIL",
"value": "jiayancheng@foxmail.com"
}
] | null |
[] |
package top.datadriven.raft.core.service.pool;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.*;
/**
* @description:
* @author: jiayancheng
* @email: <EMAIL>
* @datetime: 2020/4/19 5:50 下午
* @version: 1.0.0
*/
public class RaftThreadPool {
/**
* 线程工厂,提供创建新线程的功能。
*/
private static final ThreadFactory THREAD_FACTORY = new ThreadFactoryBuilder()
.setNameFormat("raft-pool-%d").build();
/**
* 线程池
*/
private static final ExecutorService executorService = new ThreadPoolExecutor(
// 核心线程数,默认情况下核心线程会一直存活
8,
//线程池所能容纳的最大线程数。
12,
//非核心线程的闲置超时时间,超过这个时间就会被回收。
10,
TimeUnit.SECONDS,
//线程池中的任务队列.(超过核心线程的数量,被放到这里)
new LinkedBlockingDeque<>(1024),
//线程工厂,提供创建新线程的功能。
THREAD_FACTORY,
//当达到最大线程数,且队列已满情况下,执行拒绝策略:抛异常
new ThreadPoolExecutor.AbortPolicy());
/**
* 定义一个线程池,用于处理所有任务
*/
final static ListeningExecutorService listeningExecutorService
= MoreExecutors.listeningDecorator(executorService);
/**
* 执行任务
*/
public static void execute(Runnable runnable) {
executorService.execute(runnable);
}
/**
* 执行任务
*/
public static <T> ListenableFuture<T> execute(Callable<T> callable) {
return listeningExecutorService.submit(callable);
}
}
| 2,001 | 0.639138 | 0.625972 | 61 | 26.393442 | 23.297279 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.278689 | false | false |
0
|
68b4f96a48408216e102c9e33ea96390995a1453
| 29,807,073,087,979 |
caa4861222fac1a2d502b2b9c2dad5cc44620a77
|
/common/src/main/java/com/yumu/hexie/integration/workorder/resp/OrderDetail.java
|
26f5ef967fa837b67f46226cfa7dabcd07079619
|
[] |
no_license
|
linknabor/hexie
|
https://github.com/linknabor/hexie
|
4013e68719a255428a273c6f210ad9def3368e2c
|
1b99deddd9fa2f3da869ffeb7b0f2eed502eed5f
|
refs/heads/product
| 2023-08-31T04:08:40.293000 | 2023-08-09T07:09:33 | 2023-08-09T07:09:33 | 142,155,558 | 0 | 0 | null | false | 2023-09-12T05:30:08 | 2018-07-24T12:30:03 | 2023-01-31T17:02:40 | 2023-09-12T05:30:07 | 7,285 | 0 | 0 | 1 |
Java
| false | false |
package com.yumu.hexie.integration.workorder.resp;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yumu.hexie.common.util.DateUtil;
import com.yumu.hexie.integration.qiniu.util.QiniuUtil;
public class OrderDetail implements Serializable {
// private static final String IMG_PREVIEW_URL = "https://images.weserv.nl/?url=";
/**
*
*/
private static final long serialVersionUID = 2934790398357119234L;
@JsonProperty("order_id")
private String orderId;
@JsonProperty("workorder_status")
private String workOrderStatus;
@JsonProperty("workorder_status_cn")
private String workOrderStatusCn;
@JsonProperty("dist_type")
private String distType;
@JsonProperty("dist_type_cn")
private String distTypeCn;
@JsonProperty("workorder_source")
private String workOrderSource;
@JsonProperty("workorder_source_cn")
private String workOrderSourceCn;
@JsonProperty("workorder_type")
private String workOrderType;
@JsonProperty("workorder_type_cn")
private String workOrderTypeCn;
@JsonProperty("serve_address")
private String serveAddress;
private String content;
@JsonProperty("image_urls")
private String imageUrls;
@JsonProperty("finished_img_urls")
private String finishImageUrls;
@JsonProperty("sect_name")
private String sectName;
@JsonProperty("csp_name")
private String cspName;
@JsonProperty("corp_id")
private String corpid;
@JsonProperty("cust_name")
private String custName;
@JsonProperty("cust_contact")
private String custConcact;
@JsonProperty("cust_openid")
private String custOpenid;
@JsonProperty("create_date")
private String createDate;
@JsonProperty("create_time")
private String createTime;
private String assigner;
@JsonProperty("assigner_contact")
private String assignerContact;
@JsonProperty("assign_date")
private String assignDate;
@JsonProperty("assign_time")
private String assignTime;
private String acceptor;
@JsonProperty("acceptor_contact")
private String acceptorContact;
@JsonProperty("accept_date")
private String acceptDate;
@JsonProperty("accept_time")
private String acceptTime;
private String finisher;
@JsonProperty("finish_date")
private String finishDate;
@JsonProperty("finish_time")
private String finishTime;
@JsonProperty("payorder_id")
private String payOrderId;
@JsonProperty("order_amt")
private String orderAmt;
@JsonProperty("pay_method")
private String payMethod;
@JsonProperty("pay_method_cn")
private String payMethodCn;
@JsonIgnore
private QiniuUtil qiniuUtil;
private List<String> imgList; //实际图
private List<String> previewImgList; //预览图
private List<String> thumbnailImgList; //缩略图
private List<String> finishImgList; //完工实际图
private List<String> finishPreviewImgList; //完工预览图
private List<String> finishThumbnailImgList; //完工缩略图
public void initImages(QiniuUtil qiniuUtil) {
this.qiniuUtil = qiniuUtil;
if (!StringUtils.isEmpty(imageUrls)) {
String[]imgArr = imageUrls.split(",");
imgList = Arrays.asList(imgArr);
List<String> thumbnailList = new ArrayList<>(imgList.size());
List<String> previewList = new ArrayList<>(imgList.size());
imgList.forEach(img->{
thumbnailList.add(qiniuUtil.getThumbnailLink(img, "3", "0"));
previewList.add(qiniuUtil.getPreviewLink(img, "1", "0"));
});
setThumbnailImgList(thumbnailList);
setPreviewImgList(previewList);
}
if (!StringUtils.isEmpty(finishImageUrls)) {
String[]imgArr = finishImageUrls.split(",");
finishImgList = Arrays.asList(imgArr);
List<String> thumbnailList = new ArrayList<>(finishImgList.size());
List<String> previewList = new ArrayList<>(finishImgList.size());
finishImgList.forEach(img->{
thumbnailList.add(qiniuUtil.getThumbnailLink(img, "3", "0"));
previewList.add(qiniuUtil.getPreviewLink(img, "1", "0"));
});
setFinishThumbnailImgList(thumbnailList);
setFinishPreviewImgList(previewList);
}
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getWorkOrderStatus() {
return workOrderStatus;
}
public void setWorkOrderStatus(String workOrderStatus) {
this.workOrderStatus = workOrderStatus;
}
public String getDistType() {
return distType;
}
public void setDistType(String distType) {
this.distType = distType;
}
public String getWorkOrderSource() {
return workOrderSource;
}
public void setWorkOrderSource(String workOrderSource) {
this.workOrderSource = workOrderSource;
}
public String getWorkOrderType() {
return workOrderType;
}
public void setWorkOrderType(String workOrderType) {
this.workOrderType = workOrderType;
}
public String getServeAddress() {
return serveAddress;
}
public void setServeAddress(String serveAddress) {
this.serveAddress = serveAddress;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImageUrls() {
return imageUrls;
}
public void setImageUrls(String imageUrls) {
this.imageUrls = imageUrls;
}
public String getSectName() {
return sectName;
}
public void setSectName(String sectName) {
this.sectName = sectName;
}
public String getCspName() {
return cspName;
}
public void setCspName(String cspName) {
this.cspName = cspName;
}
public String getAcceptor() {
return acceptor;
}
public void setAcceptor(String acceptor) {
this.acceptor = acceptor;
}
public String getAcceptDate() {
return acceptDate;
}
public void setAcceptDate(String acceptDate) {
this.acceptDate = acceptDate;
}
public String getAcceptTime() {
return acceptTime;
}
public void setAcceptTime(String acceptTime) {
this.acceptTime = acceptTime;
}
public String getFinisher() {
return finisher;
}
public void setFinisher(String finisher) {
this.finisher = finisher;
}
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
public String getFinishTime() {
return finishTime;
}
public void setFinishTime(String finishTime) {
this.finishTime = finishTime;
}
public String getPayOrderId() {
return payOrderId;
}
public void setPayOrderId(String payOrderId) {
this.payOrderId = payOrderId;
}
public String getOrderAmt() {
return orderAmt;
}
public void setOrderAmt(String orderAmt) {
this.orderAmt = orderAmt;
}
public String getPayMethod() {
return payMethod;
}
public void setPayMethod(String payMethod) {
this.payMethod = payMethod;
}
public String getWorkOrderStatusCn() {
return workOrderStatusCn;
}
public void setWorkOrderStatusCn(String workOrderStatusCn) {
this.workOrderStatusCn = workOrderStatusCn;
}
public String getDistTypeCn() {
return distTypeCn;
}
public void setDistTypeCn(String distTypeCn) {
this.distTypeCn = distTypeCn;
}
public String getWorkOrderSourceCn() {
return workOrderSourceCn;
}
public void setWorkOrderSourceCn(String workOrderSourceCn) {
this.workOrderSourceCn = workOrderSourceCn;
}
public String getWorkOrderTypeCn() {
return workOrderTypeCn;
}
public void setWorkOrderTypeCn(String workOrderTypeCn) {
this.workOrderTypeCn = workOrderTypeCn;
}
public String getPayMethodCn() {
return payMethodCn;
}
public void setPayMethodCn(String payMethodCn) {
this.payMethodCn = payMethodCn;
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
public String getCustConcact() {
return custConcact;
}
public void setCustConcact(String custConcact) {
this.custConcact = custConcact;
}
public String getCustOpenid() {
return custOpenid;
}
public void setCustOpenid(String custOpenid) {
this.custOpenid = custOpenid;
}
public String getAssigner() {
return assigner;
}
public void setAssigner(String assigner) {
this.assigner = assigner;
}
public String getAssignerContact() {
return assignerContact;
}
public void setAssignerContact(String assignerContact) {
this.assignerContact = assignerContact;
}
public String getAssignDate() {
return assignDate;
}
public void setAssignDate(String assignDate) {
this.assignDate = assignDate;
}
public String getAssignTime() {
return assignTime;
}
public void setAssignTime(String assignTime) {
this.assignTime = assignTime;
}
public String getAcceptorContact() {
return acceptorContact;
}
public void setAcceptorContact(String acceptorContact) {
this.acceptorContact = acceptorContact;
}
public List<String> getThumbnailImgList() {
return thumbnailImgList;
}
public void setThumbnailImgList(List<String> thumbnailImgList) {
if (thumbnailImgList==null || thumbnailImgList.isEmpty()) {
return;
}
this.thumbnailImgList = thumbnailImgList;
}
public List<String> getPreviewImgList() {
return previewImgList;
}
public void setPreviewImgList(List<String> previewImgList) {
if (previewImgList==null || previewImgList.isEmpty()) {
return;
}
this.previewImgList = previewImgList;
}
public List<String> getImgList() {
return imgList;
}
public void setImgList(List<String> imgList) {
this.imgList = imgList;
}
public String getCreateDateStr() {
return DateUtil.formatFromDB(createDate, createTime);
}
public String getAssignDateStr() {
return DateUtil.formatFromDB(assignDate, assignTime);
}
public String getAcceptDateStr() {
return DateUtil.formatFromDB(acceptDate, acceptTime);
}
public String getFinishDateStr() {
return DateUtil.formatFromDB(finishDate, finishTime);
}
public String getFinishImageUrls() {
return finishImageUrls;
}
public void setFinishImageUrls(String finishImageUrls) {
this.finishImageUrls = finishImageUrls;
}
public List<String> getFinishImgList() {
return finishImgList;
}
public void setFinishImgList(List<String> finishImgList) {
this.finishImgList = finishImgList;
}
public List<String> getFinishPreviewImgList() {
return finishPreviewImgList;
}
public void setFinishPreviewImgList(List<String> finishPreviewImgList) {
this.finishPreviewImgList = finishPreviewImgList;
}
public List<String> getFinishThumbnailImgList() {
return finishThumbnailImgList;
}
public void setFinishThumbnailImgList(List<String> finishThumbnailImgList) {
this.finishThumbnailImgList = finishThumbnailImgList;
}
@Override
public String toString() {
return "OrderDetail [orderId=" + orderId + ", workOrderStatus=" + workOrderStatus + ", workOrderStatusCn="
+ workOrderStatusCn + ", distType=" + distType + ", distTypeCn=" + distTypeCn + ", workOrderSource="
+ workOrderSource + ", workOrderSourceCn=" + workOrderSourceCn + ", workOrderType=" + workOrderType
+ ", workOrderTypeCn=" + workOrderTypeCn + ", serveAddress=" + serveAddress + ", content=" + content
+ ", imageUrls=" + imageUrls + ", finishImageUrls=" + finishImageUrls + ", sectName=" + sectName
+ ", cspName=" + cspName + ", corpid=" + corpid + ", custName=" + custName + ", custConcact="
+ custConcact + ", custOpenid=" + custOpenid + ", createDate=" + createDate + ", createTime="
+ createTime + ", assigner=" + assigner + ", assignerContact=" + assignerContact + ", assignDate="
+ assignDate + ", assignTime=" + assignTime + ", acceptor=" + acceptor + ", acceptorContact="
+ acceptorContact + ", acceptDate=" + acceptDate + ", acceptTime=" + acceptTime + ", finisher="
+ finisher + ", finishDate=" + finishDate + ", finishTime=" + finishTime + ", payOrderId=" + payOrderId
+ ", orderAmt=" + orderAmt + ", payMethod=" + payMethod + ", payMethodCn=" + payMethodCn
+ ", qiniuUtil=" + qiniuUtil + ", imgList=" + imgList + ", previewImgList=" + previewImgList
+ ", thumbnailImgList=" + thumbnailImgList + ", finishImgList=" + finishImgList
+ ", finishPreviewImgList=" + finishPreviewImgList + ", finishThumbnailImgList="
+ finishThumbnailImgList + "]";
}
}
|
UTF-8
|
Java
| 12,291 |
java
|
OrderDetail.java
|
Java
|
[] | null |
[] |
package com.yumu.hexie.integration.workorder.resp;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yumu.hexie.common.util.DateUtil;
import com.yumu.hexie.integration.qiniu.util.QiniuUtil;
public class OrderDetail implements Serializable {
// private static final String IMG_PREVIEW_URL = "https://images.weserv.nl/?url=";
/**
*
*/
private static final long serialVersionUID = 2934790398357119234L;
@JsonProperty("order_id")
private String orderId;
@JsonProperty("workorder_status")
private String workOrderStatus;
@JsonProperty("workorder_status_cn")
private String workOrderStatusCn;
@JsonProperty("dist_type")
private String distType;
@JsonProperty("dist_type_cn")
private String distTypeCn;
@JsonProperty("workorder_source")
private String workOrderSource;
@JsonProperty("workorder_source_cn")
private String workOrderSourceCn;
@JsonProperty("workorder_type")
private String workOrderType;
@JsonProperty("workorder_type_cn")
private String workOrderTypeCn;
@JsonProperty("serve_address")
private String serveAddress;
private String content;
@JsonProperty("image_urls")
private String imageUrls;
@JsonProperty("finished_img_urls")
private String finishImageUrls;
@JsonProperty("sect_name")
private String sectName;
@JsonProperty("csp_name")
private String cspName;
@JsonProperty("corp_id")
private String corpid;
@JsonProperty("cust_name")
private String custName;
@JsonProperty("cust_contact")
private String custConcact;
@JsonProperty("cust_openid")
private String custOpenid;
@JsonProperty("create_date")
private String createDate;
@JsonProperty("create_time")
private String createTime;
private String assigner;
@JsonProperty("assigner_contact")
private String assignerContact;
@JsonProperty("assign_date")
private String assignDate;
@JsonProperty("assign_time")
private String assignTime;
private String acceptor;
@JsonProperty("acceptor_contact")
private String acceptorContact;
@JsonProperty("accept_date")
private String acceptDate;
@JsonProperty("accept_time")
private String acceptTime;
private String finisher;
@JsonProperty("finish_date")
private String finishDate;
@JsonProperty("finish_time")
private String finishTime;
@JsonProperty("payorder_id")
private String payOrderId;
@JsonProperty("order_amt")
private String orderAmt;
@JsonProperty("pay_method")
private String payMethod;
@JsonProperty("pay_method_cn")
private String payMethodCn;
@JsonIgnore
private QiniuUtil qiniuUtil;
private List<String> imgList; //实际图
private List<String> previewImgList; //预览图
private List<String> thumbnailImgList; //缩略图
private List<String> finishImgList; //完工实际图
private List<String> finishPreviewImgList; //完工预览图
private List<String> finishThumbnailImgList; //完工缩略图
public void initImages(QiniuUtil qiniuUtil) {
this.qiniuUtil = qiniuUtil;
if (!StringUtils.isEmpty(imageUrls)) {
String[]imgArr = imageUrls.split(",");
imgList = Arrays.asList(imgArr);
List<String> thumbnailList = new ArrayList<>(imgList.size());
List<String> previewList = new ArrayList<>(imgList.size());
imgList.forEach(img->{
thumbnailList.add(qiniuUtil.getThumbnailLink(img, "3", "0"));
previewList.add(qiniuUtil.getPreviewLink(img, "1", "0"));
});
setThumbnailImgList(thumbnailList);
setPreviewImgList(previewList);
}
if (!StringUtils.isEmpty(finishImageUrls)) {
String[]imgArr = finishImageUrls.split(",");
finishImgList = Arrays.asList(imgArr);
List<String> thumbnailList = new ArrayList<>(finishImgList.size());
List<String> previewList = new ArrayList<>(finishImgList.size());
finishImgList.forEach(img->{
thumbnailList.add(qiniuUtil.getThumbnailLink(img, "3", "0"));
previewList.add(qiniuUtil.getPreviewLink(img, "1", "0"));
});
setFinishThumbnailImgList(thumbnailList);
setFinishPreviewImgList(previewList);
}
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getWorkOrderStatus() {
return workOrderStatus;
}
public void setWorkOrderStatus(String workOrderStatus) {
this.workOrderStatus = workOrderStatus;
}
public String getDistType() {
return distType;
}
public void setDistType(String distType) {
this.distType = distType;
}
public String getWorkOrderSource() {
return workOrderSource;
}
public void setWorkOrderSource(String workOrderSource) {
this.workOrderSource = workOrderSource;
}
public String getWorkOrderType() {
return workOrderType;
}
public void setWorkOrderType(String workOrderType) {
this.workOrderType = workOrderType;
}
public String getServeAddress() {
return serveAddress;
}
public void setServeAddress(String serveAddress) {
this.serveAddress = serveAddress;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImageUrls() {
return imageUrls;
}
public void setImageUrls(String imageUrls) {
this.imageUrls = imageUrls;
}
public String getSectName() {
return sectName;
}
public void setSectName(String sectName) {
this.sectName = sectName;
}
public String getCspName() {
return cspName;
}
public void setCspName(String cspName) {
this.cspName = cspName;
}
public String getAcceptor() {
return acceptor;
}
public void setAcceptor(String acceptor) {
this.acceptor = acceptor;
}
public String getAcceptDate() {
return acceptDate;
}
public void setAcceptDate(String acceptDate) {
this.acceptDate = acceptDate;
}
public String getAcceptTime() {
return acceptTime;
}
public void setAcceptTime(String acceptTime) {
this.acceptTime = acceptTime;
}
public String getFinisher() {
return finisher;
}
public void setFinisher(String finisher) {
this.finisher = finisher;
}
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
public String getFinishTime() {
return finishTime;
}
public void setFinishTime(String finishTime) {
this.finishTime = finishTime;
}
public String getPayOrderId() {
return payOrderId;
}
public void setPayOrderId(String payOrderId) {
this.payOrderId = payOrderId;
}
public String getOrderAmt() {
return orderAmt;
}
public void setOrderAmt(String orderAmt) {
this.orderAmt = orderAmt;
}
public String getPayMethod() {
return payMethod;
}
public void setPayMethod(String payMethod) {
this.payMethod = payMethod;
}
public String getWorkOrderStatusCn() {
return workOrderStatusCn;
}
public void setWorkOrderStatusCn(String workOrderStatusCn) {
this.workOrderStatusCn = workOrderStatusCn;
}
public String getDistTypeCn() {
return distTypeCn;
}
public void setDistTypeCn(String distTypeCn) {
this.distTypeCn = distTypeCn;
}
public String getWorkOrderSourceCn() {
return workOrderSourceCn;
}
public void setWorkOrderSourceCn(String workOrderSourceCn) {
this.workOrderSourceCn = workOrderSourceCn;
}
public String getWorkOrderTypeCn() {
return workOrderTypeCn;
}
public void setWorkOrderTypeCn(String workOrderTypeCn) {
this.workOrderTypeCn = workOrderTypeCn;
}
public String getPayMethodCn() {
return payMethodCn;
}
public void setPayMethodCn(String payMethodCn) {
this.payMethodCn = payMethodCn;
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
public String getCustConcact() {
return custConcact;
}
public void setCustConcact(String custConcact) {
this.custConcact = custConcact;
}
public String getCustOpenid() {
return custOpenid;
}
public void setCustOpenid(String custOpenid) {
this.custOpenid = custOpenid;
}
public String getAssigner() {
return assigner;
}
public void setAssigner(String assigner) {
this.assigner = assigner;
}
public String getAssignerContact() {
return assignerContact;
}
public void setAssignerContact(String assignerContact) {
this.assignerContact = assignerContact;
}
public String getAssignDate() {
return assignDate;
}
public void setAssignDate(String assignDate) {
this.assignDate = assignDate;
}
public String getAssignTime() {
return assignTime;
}
public void setAssignTime(String assignTime) {
this.assignTime = assignTime;
}
public String getAcceptorContact() {
return acceptorContact;
}
public void setAcceptorContact(String acceptorContact) {
this.acceptorContact = acceptorContact;
}
public List<String> getThumbnailImgList() {
return thumbnailImgList;
}
public void setThumbnailImgList(List<String> thumbnailImgList) {
if (thumbnailImgList==null || thumbnailImgList.isEmpty()) {
return;
}
this.thumbnailImgList = thumbnailImgList;
}
public List<String> getPreviewImgList() {
return previewImgList;
}
public void setPreviewImgList(List<String> previewImgList) {
if (previewImgList==null || previewImgList.isEmpty()) {
return;
}
this.previewImgList = previewImgList;
}
public List<String> getImgList() {
return imgList;
}
public void setImgList(List<String> imgList) {
this.imgList = imgList;
}
public String getCreateDateStr() {
return DateUtil.formatFromDB(createDate, createTime);
}
public String getAssignDateStr() {
return DateUtil.formatFromDB(assignDate, assignTime);
}
public String getAcceptDateStr() {
return DateUtil.formatFromDB(acceptDate, acceptTime);
}
public String getFinishDateStr() {
return DateUtil.formatFromDB(finishDate, finishTime);
}
public String getFinishImageUrls() {
return finishImageUrls;
}
public void setFinishImageUrls(String finishImageUrls) {
this.finishImageUrls = finishImageUrls;
}
public List<String> getFinishImgList() {
return finishImgList;
}
public void setFinishImgList(List<String> finishImgList) {
this.finishImgList = finishImgList;
}
public List<String> getFinishPreviewImgList() {
return finishPreviewImgList;
}
public void setFinishPreviewImgList(List<String> finishPreviewImgList) {
this.finishPreviewImgList = finishPreviewImgList;
}
public List<String> getFinishThumbnailImgList() {
return finishThumbnailImgList;
}
public void setFinishThumbnailImgList(List<String> finishThumbnailImgList) {
this.finishThumbnailImgList = finishThumbnailImgList;
}
@Override
public String toString() {
return "OrderDetail [orderId=" + orderId + ", workOrderStatus=" + workOrderStatus + ", workOrderStatusCn="
+ workOrderStatusCn + ", distType=" + distType + ", distTypeCn=" + distTypeCn + ", workOrderSource="
+ workOrderSource + ", workOrderSourceCn=" + workOrderSourceCn + ", workOrderType=" + workOrderType
+ ", workOrderTypeCn=" + workOrderTypeCn + ", serveAddress=" + serveAddress + ", content=" + content
+ ", imageUrls=" + imageUrls + ", finishImageUrls=" + finishImageUrls + ", sectName=" + sectName
+ ", cspName=" + cspName + ", corpid=" + corpid + ", custName=" + custName + ", custConcact="
+ custConcact + ", custOpenid=" + custOpenid + ", createDate=" + createDate + ", createTime="
+ createTime + ", assigner=" + assigner + ", assignerContact=" + assignerContact + ", assignDate="
+ assignDate + ", assignTime=" + assignTime + ", acceptor=" + acceptor + ", acceptorContact="
+ acceptorContact + ", acceptDate=" + acceptDate + ", acceptTime=" + acceptTime + ", finisher="
+ finisher + ", finishDate=" + finishDate + ", finishTime=" + finishTime + ", payOrderId=" + payOrderId
+ ", orderAmt=" + orderAmt + ", payMethod=" + payMethod + ", payMethodCn=" + payMethodCn
+ ", qiniuUtil=" + qiniuUtil + ", imgList=" + imgList + ", previewImgList=" + previewImgList
+ ", thumbnailImgList=" + thumbnailImgList + ", finishImgList=" + finishImgList
+ ", finishPreviewImgList=" + finishPreviewImgList + ", finishThumbnailImgList="
+ finishThumbnailImgList + "]";
}
}
| 12,291 | 0.739688 | 0.737483 | 439 | 26.888382 | 22.957003 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.899772 | false | false |
0
|
7c820f3f33ac635fbbdca148480f038834294a2f
| 37,761,352,473,264 |
0064ca30934d96df5f21036783fa62aaba926561
|
/app/com/clicktable/service/impl/HistoricalTatServiceImpl.java
|
1ca6f6dbe16215c9cadde7884e802d6cfd67b89b
|
[] |
no_license
|
pbhakt/TestProjCTWeb
|
https://github.com/pbhakt/TestProjCTWeb
|
f2cc5139c7b06136cc14d9cc1408afb2b5149b56
|
5208f67c24c58007d38b3bee8e33e074f2bd9e54
|
refs/heads/master
| 2020-12-24T19:36:52.554000 | 2016-05-18T06:06:04 | 2016-05-18T06:06:04 | 59,023,437 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.clicktable.service.impl;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import play.Logger;
import com.clicktable.config.Neo4jConfig;
import com.clicktable.dao.intf.HistoricalTatDao;
import com.clicktable.model.HistoricalTat;
import com.clicktable.response.BaseResponse;
import com.clicktable.service.intf.AuthorizationService;
import com.clicktable.service.intf.HistoricalTatService;
/**
*
* @author p.singh
*
*/
@org.springframework.stereotype.Service
public class HistoricalTatServiceImpl implements HistoricalTatService {
@Autowired
HistoricalTatDao historicalTatDao;
@Autowired
Neo4jConfig neo4jConf;
//@Autowired
//HistoricalTatValidator historicalTatValidator;
@Autowired
AuthorizationService authorizationService;
/**
* {@inheritDoc}
*/
@Override
@Transactional
public BaseResponse addHistoricalTat(HistoricalTat historicalTat, String token)
{
//Transaction tx = neo4jConf.getGraphDatabaseService().beginTx();
Logger.debug("in service imlpl");
BaseResponse response=null;
/* String restaurantGuid = "";
restaurantGuid = historicalTat.getRestaurantGuid();
Logger.debug("rest guid is "+restaurantGuid);
historicalTat.setStatus(Constants.ACTIVE_STATUS);
UserInfoModel userInfo = authorizationService.getUserInfoByToken(token);
historicalTat.setInfoOnCreate(userInfo);
List<ValidationError> listOfErrorForHistoricalTat = new ArrayList<>();
listOfErrorForHistoricalTat = historicalTatValidator.validateHistoricalTatOnAdd(historicalTat);
try
{
Map<String,Object> params = new HashMap<String, Object>();
params.put(Constants.DEVICE_ID, historicalTat.getHistoricalTatId());
params.put(Constants.STATUS, Constants.ACTIVE_STATUS);
Logger.debug("finding historicalTat");
List<HistoricalTat> historicalTatList = historicalTatDao.findByFields(HistoricalTat.class, params);
Logger.debug("historicalTat list is "+historicalTatList);
if (listOfErrorForHistoricalTat.isEmpty())
{
if(historicalTatList.size()>0)
{
ValidationError error = new ValidationError(Constants.DEVICE_ID,UtilityMethods.getErrorMsg(ErrorCodes.DEVICE_ID_ALREADY_EXISTS),ErrorCodes.DEVICE_ID_ALREADY_EXISTS);
listOfErrorForHistoricalTat.add(error);
response = new ErrorResponse(ResponseCodes.DEVICE_ADDED_FAILURE,listOfErrorForHistoricalTat);
}
else
{
historicalTatDao.create(historicalTat);
Logger.debug("HistoricalTat created.guid is "+historicalTat.getGuid());
Long relId = historicalTatDao.addRestaurantHistoricalTat(historicalTat, restaurantGuid);
Logger.debug("relationship created. Id is --------"+relId+" guid is "+historicalTat.getGuid());
response = new PostResponse<HistoricalTat>(ResponseCodes.DEVICE_ADDED_SUCCESFULLY,historicalTat.getGuid());
}
}
else
{
response = new ErrorResponse(ResponseCodes.DEVICE_ADDED_FAILURE,listOfErrorForHistoricalTat);
}
Logger.debug("response is "+response);
}
catch(DeadlockDetectedException dde)
{
Logger.debug("deadlock occured"+dde.getMessage());
tx.close();
addHistoricalTat(historicalTat, token);
}
finally
{
Logger.debug("finally of add");
tx.success();
}*/
return response;
}
/**
* {@inheritDoc}
*/
@Override
@Transactional(readOnly =true)
public BaseResponse getHistoricalTats(Map<String, Object> params)
{
BaseResponse getResponse = null;
/*Transaction tx = neo4jConf.getGraphDatabaseService().beginTx();
try
{
Map<String, Object> qryParamMap = historicalTatValidator.validateFinderParams(params, HistoricalTat.class);
List<HistoricalTat> historicalTatList = historicalTatDao.findByFields(HistoricalTat.class, qryParamMap);
getResponse= new GetResponse<HistoricalTat>(ResponseCodes.DEVICE_RECORD_FETCH_SUCCESFULLY, historicalTatList);
}
catch(DeadlockDetectedException dde)
{
Logger.debug("deadlock in get "+dde.getMessage());
tx.close();
getHistoricalTats(params);
}
finally
{
Logger.debug("finally of get");
tx.success();
}*/
return getResponse;
}
@Override
public BaseResponse updateHistoricalTat(HistoricalTat historicalTat, String token)
{
BaseResponse response = null;
/* Transaction tx = neo4jConf.getGraphDatabaseService().beginTx();
try
{
UserInfoModel userInfo = authorizationService.getUserInfoByToken(token);
historicalTat.setUpdatedBy(userInfo.getGuid());
List<ValidationError> listOfError = new ArrayList<ValidationError>();
if (historicalTat.getGuid() == null)
listOfError.add(UtilityMethods.createError(Constants.GUID, ErrorCodes.DEVICE_GUID_REQUIRED));
else
{
///if role is admin then check for restaurant(admin can change details of his own restaurant)
if((userInfo.getRoleId() == Constants.ADMIN_ROLE_ID) && (!rest.getGuid().equals(userInfo.getRestGuid())))
{
listOfError.add(UtilityMethods.createError(Constants.REST_ID, ErrorCodes.NO_ACCESS_TO_UPDATE_DETAILS_OF_OTHER_REST));
response = new ErrorResponse(ResponseCodes.RESTAURANT_UPDATION_FAILURE,listOfError);
return response;
}
Logger.debug("finding historicalTat");
HistoricalTat oldHistoricalTat = historicalTatDao.findHistoricalTatByGuid( historicalTat.getGuid());
Logger.debug("old historicalTat is "+oldHistoricalTat);
if (oldHistoricalTat == null)
listOfError.add(UtilityMethods.createError(Constants.GUID, ErrorCodes.INVALID_DEVICE_GUID));
else
{
historicalTat.copyExistingValues(oldHistoricalTat);
listOfError.addAll(historicalTatValidator.validateHistoricalTatOnUpdate(historicalTat));
}
}
if (listOfError.isEmpty())
{
HistoricalTat newHistoricalTat = historicalTatDao.update(historicalTat);
response = new UpdateResponse<HistoricalTat>(ResponseCodes.DEVICE_UPDATED_SUCCESFULLY, newHistoricalTat.getGuid());
} else {
response = new ErrorResponse(ResponseCodes.DEVICE_UPDATION_FAILURE,listOfError);
}
}
catch(DeadlockDetectedException dde)
{
Logger.debug("deadlock in update "+dde.getMessage());
tx.close();
updateHistoricalTat(historicalTat, token);
}
finally
{
Logger.debug("finally of update");
tx.success();
}*/
return response;
}
/**
* Method to delete historicalTat
*/
@Override
@Transactional
public BaseResponse deleteHistoricalTat(String historicalTatGuid, String token)
{
BaseResponse response = null;
/* // UserInfoModel userInfo = authorizationService.getUserInfoByToken(token);
List<ValidationError> listOfError = new ArrayList<ValidationError>();
if ((historicalTatGuid == null) || historicalTatGuid.equals(""))
listOfError.add(UtilityMethods.createError(Constants.DEVICE_GUID, ErrorCodes.DEVICE_GUID_REQUIRED));
HistoricalTat historicalTat = historicalTatDao.findHistoricalTatByGuid(historicalTatGuid);
if (historicalTat == null)
listOfError.add(UtilityMethods.createError(Constants.DEVICE_GUID, ErrorCodes.INVALID_DEVICE_GUID));
//if user is not ct admin then check if server being created and logged in staff member both belongs to same restaurant
else if(!userInfo.getRoleId().equals(Constants.CT_ADMIN_ROLE_ID))
listOfError.addAll( validateStaffObject.validateStaffForRestaurant(historicalTat.getRestaurantGuid(), userInfo.getRestGuid()));
if (listOfError.isEmpty())
{
boolean deleted = historicalTatDao.deleteHistoricalTat(historicalTatGuid);
Logger.debug("query result"+deleted);
response = new UpdateResponse<Restaurant>(ResponseCodes.DEVICE_DELETED_SUCCESFULLY, historicalTatGuid);
}
else
{
response = new ErrorResponse(ResponseCodes.DEVICE_DELETED_FAILURE,listOfError);
}*/
return response;
}
}
|
UTF-8
|
Java
| 8,041 |
java
|
HistoricalTatServiceImpl.java
|
Java
|
[
{
"context": "ce.intf.HistoricalTatService;\n\n\n/**\n * \n * @author p.singh\n *\n */\n\n@org.springframework.stereotype.Service\np",
"end": 533,
"score": 0.9974533319473267,
"start": 526,
"tag": "USERNAME",
"value": "p.singh"
}
] | null |
[] |
package com.clicktable.service.impl;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import play.Logger;
import com.clicktable.config.Neo4jConfig;
import com.clicktable.dao.intf.HistoricalTatDao;
import com.clicktable.model.HistoricalTat;
import com.clicktable.response.BaseResponse;
import com.clicktable.service.intf.AuthorizationService;
import com.clicktable.service.intf.HistoricalTatService;
/**
*
* @author p.singh
*
*/
@org.springframework.stereotype.Service
public class HistoricalTatServiceImpl implements HistoricalTatService {
@Autowired
HistoricalTatDao historicalTatDao;
@Autowired
Neo4jConfig neo4jConf;
//@Autowired
//HistoricalTatValidator historicalTatValidator;
@Autowired
AuthorizationService authorizationService;
/**
* {@inheritDoc}
*/
@Override
@Transactional
public BaseResponse addHistoricalTat(HistoricalTat historicalTat, String token)
{
//Transaction tx = neo4jConf.getGraphDatabaseService().beginTx();
Logger.debug("in service imlpl");
BaseResponse response=null;
/* String restaurantGuid = "";
restaurantGuid = historicalTat.getRestaurantGuid();
Logger.debug("rest guid is "+restaurantGuid);
historicalTat.setStatus(Constants.ACTIVE_STATUS);
UserInfoModel userInfo = authorizationService.getUserInfoByToken(token);
historicalTat.setInfoOnCreate(userInfo);
List<ValidationError> listOfErrorForHistoricalTat = new ArrayList<>();
listOfErrorForHistoricalTat = historicalTatValidator.validateHistoricalTatOnAdd(historicalTat);
try
{
Map<String,Object> params = new HashMap<String, Object>();
params.put(Constants.DEVICE_ID, historicalTat.getHistoricalTatId());
params.put(Constants.STATUS, Constants.ACTIVE_STATUS);
Logger.debug("finding historicalTat");
List<HistoricalTat> historicalTatList = historicalTatDao.findByFields(HistoricalTat.class, params);
Logger.debug("historicalTat list is "+historicalTatList);
if (listOfErrorForHistoricalTat.isEmpty())
{
if(historicalTatList.size()>0)
{
ValidationError error = new ValidationError(Constants.DEVICE_ID,UtilityMethods.getErrorMsg(ErrorCodes.DEVICE_ID_ALREADY_EXISTS),ErrorCodes.DEVICE_ID_ALREADY_EXISTS);
listOfErrorForHistoricalTat.add(error);
response = new ErrorResponse(ResponseCodes.DEVICE_ADDED_FAILURE,listOfErrorForHistoricalTat);
}
else
{
historicalTatDao.create(historicalTat);
Logger.debug("HistoricalTat created.guid is "+historicalTat.getGuid());
Long relId = historicalTatDao.addRestaurantHistoricalTat(historicalTat, restaurantGuid);
Logger.debug("relationship created. Id is --------"+relId+" guid is "+historicalTat.getGuid());
response = new PostResponse<HistoricalTat>(ResponseCodes.DEVICE_ADDED_SUCCESFULLY,historicalTat.getGuid());
}
}
else
{
response = new ErrorResponse(ResponseCodes.DEVICE_ADDED_FAILURE,listOfErrorForHistoricalTat);
}
Logger.debug("response is "+response);
}
catch(DeadlockDetectedException dde)
{
Logger.debug("deadlock occured"+dde.getMessage());
tx.close();
addHistoricalTat(historicalTat, token);
}
finally
{
Logger.debug("finally of add");
tx.success();
}*/
return response;
}
/**
* {@inheritDoc}
*/
@Override
@Transactional(readOnly =true)
public BaseResponse getHistoricalTats(Map<String, Object> params)
{
BaseResponse getResponse = null;
/*Transaction tx = neo4jConf.getGraphDatabaseService().beginTx();
try
{
Map<String, Object> qryParamMap = historicalTatValidator.validateFinderParams(params, HistoricalTat.class);
List<HistoricalTat> historicalTatList = historicalTatDao.findByFields(HistoricalTat.class, qryParamMap);
getResponse= new GetResponse<HistoricalTat>(ResponseCodes.DEVICE_RECORD_FETCH_SUCCESFULLY, historicalTatList);
}
catch(DeadlockDetectedException dde)
{
Logger.debug("deadlock in get "+dde.getMessage());
tx.close();
getHistoricalTats(params);
}
finally
{
Logger.debug("finally of get");
tx.success();
}*/
return getResponse;
}
@Override
public BaseResponse updateHistoricalTat(HistoricalTat historicalTat, String token)
{
BaseResponse response = null;
/* Transaction tx = neo4jConf.getGraphDatabaseService().beginTx();
try
{
UserInfoModel userInfo = authorizationService.getUserInfoByToken(token);
historicalTat.setUpdatedBy(userInfo.getGuid());
List<ValidationError> listOfError = new ArrayList<ValidationError>();
if (historicalTat.getGuid() == null)
listOfError.add(UtilityMethods.createError(Constants.GUID, ErrorCodes.DEVICE_GUID_REQUIRED));
else
{
///if role is admin then check for restaurant(admin can change details of his own restaurant)
if((userInfo.getRoleId() == Constants.ADMIN_ROLE_ID) && (!rest.getGuid().equals(userInfo.getRestGuid())))
{
listOfError.add(UtilityMethods.createError(Constants.REST_ID, ErrorCodes.NO_ACCESS_TO_UPDATE_DETAILS_OF_OTHER_REST));
response = new ErrorResponse(ResponseCodes.RESTAURANT_UPDATION_FAILURE,listOfError);
return response;
}
Logger.debug("finding historicalTat");
HistoricalTat oldHistoricalTat = historicalTatDao.findHistoricalTatByGuid( historicalTat.getGuid());
Logger.debug("old historicalTat is "+oldHistoricalTat);
if (oldHistoricalTat == null)
listOfError.add(UtilityMethods.createError(Constants.GUID, ErrorCodes.INVALID_DEVICE_GUID));
else
{
historicalTat.copyExistingValues(oldHistoricalTat);
listOfError.addAll(historicalTatValidator.validateHistoricalTatOnUpdate(historicalTat));
}
}
if (listOfError.isEmpty())
{
HistoricalTat newHistoricalTat = historicalTatDao.update(historicalTat);
response = new UpdateResponse<HistoricalTat>(ResponseCodes.DEVICE_UPDATED_SUCCESFULLY, newHistoricalTat.getGuid());
} else {
response = new ErrorResponse(ResponseCodes.DEVICE_UPDATION_FAILURE,listOfError);
}
}
catch(DeadlockDetectedException dde)
{
Logger.debug("deadlock in update "+dde.getMessage());
tx.close();
updateHistoricalTat(historicalTat, token);
}
finally
{
Logger.debug("finally of update");
tx.success();
}*/
return response;
}
/**
* Method to delete historicalTat
*/
@Override
@Transactional
public BaseResponse deleteHistoricalTat(String historicalTatGuid, String token)
{
BaseResponse response = null;
/* // UserInfoModel userInfo = authorizationService.getUserInfoByToken(token);
List<ValidationError> listOfError = new ArrayList<ValidationError>();
if ((historicalTatGuid == null) || historicalTatGuid.equals(""))
listOfError.add(UtilityMethods.createError(Constants.DEVICE_GUID, ErrorCodes.DEVICE_GUID_REQUIRED));
HistoricalTat historicalTat = historicalTatDao.findHistoricalTatByGuid(historicalTatGuid);
if (historicalTat == null)
listOfError.add(UtilityMethods.createError(Constants.DEVICE_GUID, ErrorCodes.INVALID_DEVICE_GUID));
//if user is not ct admin then check if server being created and logged in staff member both belongs to same restaurant
else if(!userInfo.getRoleId().equals(Constants.CT_ADMIN_ROLE_ID))
listOfError.addAll( validateStaffObject.validateStaffForRestaurant(historicalTat.getRestaurantGuid(), userInfo.getRestGuid()));
if (listOfError.isEmpty())
{
boolean deleted = historicalTatDao.deleteHistoricalTat(historicalTatGuid);
Logger.debug("query result"+deleted);
response = new UpdateResponse<Restaurant>(ResponseCodes.DEVICE_DELETED_SUCCESFULLY, historicalTatGuid);
}
else
{
response = new ErrorResponse(ResponseCodes.DEVICE_DELETED_FAILURE,listOfError);
}*/
return response;
}
}
| 8,041 | 0.731874 | 0.731004 | 257 | 30.287937 | 35.49794 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.968872 | false | false |
0
|
5b4256324449ed567ba2ee199f4c57e5ab900485
| 36,661,840,846,253 |
e2ae84d5616af8f5b3f5de4ce39dca9f4efcc818
|
/src/library/audio/AudioData.java
|
8325669e1a69c65e74b27cec97363f89f2b79a66
|
[] |
no_license
|
JPeterson462/DigiTurtle-Engine
|
https://github.com/JPeterson462/DigiTurtle-Engine
|
f3b9fb5fbb3b4b72359db5c9f40600666728e53b
|
37421d737dcb99c6d5840894216bed5d4edbb5a7
|
refs/heads/master
| 2021-03-27T18:54:59.918000 | 2017-06-25T23:35:08 | 2017-06-25T23:35:08 | 91,149,565 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package library.audio;
public class AudioData {
public int channels, sampleRate;
public float audioLengthSeconds;
public int audioLengthSamples;
}
|
UTF-8
|
Java
| 169 |
java
|
AudioData.java
|
Java
|
[] | null |
[] |
package library.audio;
public class AudioData {
public int channels, sampleRate;
public float audioLengthSeconds;
public int audioLengthSamples;
}
| 169 | 0.721893 | 0.721893 | 11 | 13.363636 | 14.265488 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
0
|
34631d75be4d873b46ac61bba11b9924dde28546
| 24,893,630,465,729 |
4ef00378d9b8a249c7cfe963c4c79f555e2102db
|
/src/tests/DroneTest.java
|
d878b47e5040f4e80ce0849f13f027b2c779c6f5
|
[] |
no_license
|
YukiOnnaSenpai/DroneComebackTDD
|
https://github.com/YukiOnnaSenpai/DroneComebackTDD
|
ae6340f3aafbac8fefd7492eb1c6f3931bc69765
|
53b2e98c1304bdc8bc42961401d3e7d7c6fe2f80
|
refs/heads/master
| 2021-06-17T02:25:05.083000 | 2017-06-02T03:31:11 | 2017-06-02T03:31:11 | 92,495,989 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tests;
import static org.junit.Assert.*;
import org.junit.Test;
import drone.Cube;
import drone.Drone;
import drone.FlySpace;
public class DroneTest {
Drone drone;
FlySpace space;
Cube cube;
@Test
public void testStringMoveUp(){
Drone dron = new Drone(new int[] {0,2,0});
dron.moveUp();
assertNotNull(dron);
}
@Test
public void testStringMoveDown(){
Drone dron = new Drone(new int[] {0,2,0});
dron.moveDown();
assertNotNull(dron);
}
@Test
public void testStringMoveLeft(){
Drone dron = new Drone(new int[] {2,0,0});
dron.moveLeft();
assertNotNull(dron);
}
@Test
public void testStringMoveRight(){
Drone dron = new Drone(new int[] {2,0,0});
dron.moveRight();
assertNotNull(dron);
}
@Test
public void testStringMoveForth(){
Drone dron = new Drone(new int[] {0,0,2});
dron.moveForth();
assertNotNull(dron);
}
@Test
public void testStringMoveBack(){
Drone dron = new Drone(new int[] {0,0,2});
dron.moveBack();
assertNotNull(dron);
}
@Test
public void testingFlyingUp(){
Drone dron = new Drone(new int[] {30,0,30});
dron.moveUp();
assertNotNull(dron);
}
@Test
public void testingfirstMove(){
Drone dron = new Drone(new int[] {30,0,30});
Drone exp = new Drone(new int[] {30,10,30});
for(int i=0;i<10;i++){
dron.moveUp();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingSecondMove(){
Drone dron = new Drone(new int[] {30,10,30});
Drone exp = new Drone(new int[] {50,10,30});
for(int i=0;i<20;i++){
dron.moveRight();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingThirdMove(){
Drone dron = new Drone(new int[] {50,10,30});
Drone exp = new Drone(new int[] {50,30,30});
for(int i=0;i<20;i++){
dron.moveUp();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingFourthMove(){
Drone dron = new Drone(new int[] {50,30,30});
Drone exp = new Drone(new int[] {50,30,15});
for(int i=0;i<15;i++){
dron.moveForth();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingFifthMove(){
Drone dron = new Drone(new int[] {50,30,15});
Drone exp = new Drone(new int[] {40,30,15});
for(int i=0;i<15;i++){
dron.moveLeft();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingSixthMove(){
Drone dron = new Drone(new int[] {40,30,15});
Drone exp = new Drone(new int[] {40,30,10});
for(int i=0;i<5;i++){
dron.moveForth();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingSeventhMove(){
Drone dron = new Drone(new int[] {40,30,10});
Drone exp = new Drone(new int[] {22,30,10});
for(int i=0;i<18;i++){
dron.moveLeft();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingEigthMove(){
Drone dron = new Drone(new int[] {22,30,10});
Drone exp = new Drone(new int[] {22,50,10});
for(int i=0;i<20;i++){
dron.moveUp();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingNinthMove(){
Drone dron = new Drone(new int[] {22,50,10});
Drone exp = new Drone(new int[] {22,50,30});
for(int i=0;i<20;i++){
dron.moveBack();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingTenthMove(){
Drone dron = new Drone(new int[] {22,50,30});
Drone exp = new Drone(new int[] {0,50,30});
for(int i=0;i<22;i++){
dron.moveLeft();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingEleventhMove(){
Drone dron = new Drone(new int[] {22,50,30});
Drone exp = new Drone(new int[] {0,30,30});
for(int i=0;i<20;i++){
dron.moveDown();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
}
|
UTF-8
|
Java
| 4,401 |
java
|
DroneTest.java
|
Java
|
[] | null |
[] |
package tests;
import static org.junit.Assert.*;
import org.junit.Test;
import drone.Cube;
import drone.Drone;
import drone.FlySpace;
public class DroneTest {
Drone drone;
FlySpace space;
Cube cube;
@Test
public void testStringMoveUp(){
Drone dron = new Drone(new int[] {0,2,0});
dron.moveUp();
assertNotNull(dron);
}
@Test
public void testStringMoveDown(){
Drone dron = new Drone(new int[] {0,2,0});
dron.moveDown();
assertNotNull(dron);
}
@Test
public void testStringMoveLeft(){
Drone dron = new Drone(new int[] {2,0,0});
dron.moveLeft();
assertNotNull(dron);
}
@Test
public void testStringMoveRight(){
Drone dron = new Drone(new int[] {2,0,0});
dron.moveRight();
assertNotNull(dron);
}
@Test
public void testStringMoveForth(){
Drone dron = new Drone(new int[] {0,0,2});
dron.moveForth();
assertNotNull(dron);
}
@Test
public void testStringMoveBack(){
Drone dron = new Drone(new int[] {0,0,2});
dron.moveBack();
assertNotNull(dron);
}
@Test
public void testingFlyingUp(){
Drone dron = new Drone(new int[] {30,0,30});
dron.moveUp();
assertNotNull(dron);
}
@Test
public void testingfirstMove(){
Drone dron = new Drone(new int[] {30,0,30});
Drone exp = new Drone(new int[] {30,10,30});
for(int i=0;i<10;i++){
dron.moveUp();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingSecondMove(){
Drone dron = new Drone(new int[] {30,10,30});
Drone exp = new Drone(new int[] {50,10,30});
for(int i=0;i<20;i++){
dron.moveRight();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingThirdMove(){
Drone dron = new Drone(new int[] {50,10,30});
Drone exp = new Drone(new int[] {50,30,30});
for(int i=0;i<20;i++){
dron.moveUp();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingFourthMove(){
Drone dron = new Drone(new int[] {50,30,30});
Drone exp = new Drone(new int[] {50,30,15});
for(int i=0;i<15;i++){
dron.moveForth();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingFifthMove(){
Drone dron = new Drone(new int[] {50,30,15});
Drone exp = new Drone(new int[] {40,30,15});
for(int i=0;i<15;i++){
dron.moveLeft();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingSixthMove(){
Drone dron = new Drone(new int[] {40,30,15});
Drone exp = new Drone(new int[] {40,30,10});
for(int i=0;i<5;i++){
dron.moveForth();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingSeventhMove(){
Drone dron = new Drone(new int[] {40,30,10});
Drone exp = new Drone(new int[] {22,30,10});
for(int i=0;i<18;i++){
dron.moveLeft();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingEigthMove(){
Drone dron = new Drone(new int[] {22,30,10});
Drone exp = new Drone(new int[] {22,50,10});
for(int i=0;i<20;i++){
dron.moveUp();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingNinthMove(){
Drone dron = new Drone(new int[] {22,50,10});
Drone exp = new Drone(new int[] {22,50,30});
for(int i=0;i<20;i++){
dron.moveBack();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingTenthMove(){
Drone dron = new Drone(new int[] {22,50,30});
Drone exp = new Drone(new int[] {0,50,30});
for(int i=0;i<22;i++){
dron.moveLeft();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
@Test
public void testingEleventhMove(){
Drone dron = new Drone(new int[] {22,50,30});
Drone exp = new Drone(new int[] {0,30,30});
for(int i=0;i<20;i++){
dron.moveDown();
}
String expected = exp.toString();
assertEquals(expected, dron.getFormatedCoordinates());
}
}
| 4,401 | 0.628266 | 0.586458 | 175 | 23.148571 | 17.810774 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.56 | false | false |
0
|
a6af13b75777e9bbd090a0a0aef15a86c4d10f7c
| 36,833,639,537,657 |
f1d84296a8afee72dc1b80e182b16bf0267ff71e
|
/src/DomainModel/StructPreuCanvis.java
|
02581a02094367793b1d48119476866e2d7b8ecd
|
[] |
no_license
|
rodergas/RADA
|
https://github.com/rodergas/RADA
|
a3df9bbfab58cde7390ab8dc250f2b14979314a8
|
b5030e5e6456ec34509bee6962cbcdced20e2680
|
refs/heads/master
| 2020-12-29T03:35:44.699000 | 2017-01-20T17:32:23 | 2017-01-20T17:32:23 | 49,656,951 | 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 DomainModel;
import java.util.ArrayList;
/**
*
* @author MacBookProAlvaro
*/
public class StructPreuCanvis {
private float preu;
private ArrayList<String> canvis;
public StructPreuCanvis(){}
public StructPreuCanvis(float p, ArrayList<String> c){
preu = p;
canvis = c;
}
/**
* @return the preu
*/
public float getPreu() {
return preu;
}
/**
* @param preu the preu to set
*/
public void setPreu(float preu) {
this.preu = preu;
}
/**
* @return the canvis
*/
public ArrayList<String> getCanvis() {
return canvis;
}
/**
* @param canvis the canvis to set
*/
public void setCanvis(ArrayList<String> canvis) {
this.canvis = canvis;
}
}
|
UTF-8
|
Java
| 1,006 |
java
|
StructPreuCanvis.java
|
Java
|
[
{
"context": "l;\n\nimport java.util.ArrayList;\n\n/**\n *\n * @author MacBookProAlvaro\n */\npublic class StructPreuCanvis {\n private f",
"end": 270,
"score": 0.8039155602455139,
"start": 254,
"tag": "NAME",
"value": "MacBookProAlvaro"
}
] | 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 DomainModel;
import java.util.ArrayList;
/**
*
* @author MacBookProAlvaro
*/
public class StructPreuCanvis {
private float preu;
private ArrayList<String> canvis;
public StructPreuCanvis(){}
public StructPreuCanvis(float p, ArrayList<String> c){
preu = p;
canvis = c;
}
/**
* @return the preu
*/
public float getPreu() {
return preu;
}
/**
* @param preu the preu to set
*/
public void setPreu(float preu) {
this.preu = preu;
}
/**
* @return the canvis
*/
public ArrayList<String> getCanvis() {
return canvis;
}
/**
* @param canvis the canvis to set
*/
public void setCanvis(ArrayList<String> canvis) {
this.canvis = canvis;
}
}
| 1,006 | 0.583499 | 0.583499 | 54 | 17.629629 | 17.93331 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.259259 | false | false |
0
|
bfce1b775fbf38a1c2e505421b28c0cda8fe49a8
| 37,778,532,342,081 |
5617c164afdf62f54731e3375c3dfc93885f960d
|
/app/src/main/java/com/eaglesakura/andriders/ui/navigation/info/BuildInformationFragment.java
|
998e470b9941ba99b5dfc21f4e34195c7c691fcb
|
[
"MIT"
] |
permissive
|
kassy-kz/andriders-central-engine-v3
|
https://github.com/kassy-kz/andriders-central-engine-v3
|
6efcc5f93a7dc80072f2a3cea8299e63ee84c663
|
e580e1a187cf745ae5379b8e2154bbb92944869b
|
refs/heads/develop
| 2021-01-17T22:58:56.337000 | 2016-07-25T07:38:00 | 2016-07-25T07:38:00 | 51,561,274 | 0 | 0 | null | true | 2016-02-12T01:48:07 | 2016-02-12T01:48:07 | 2016-02-12T00:56:57 | 2016-02-12T01:35:50 | 249 | 0 | 0 | 0 | null | null | null |
package com.eaglesakura.andriders.ui.navigation.info;
import com.eaglesakura.andriders.BuildConfig;
import com.eaglesakura.andriders.R;
import com.eaglesakura.andriders.ui.base.AppBaseFragment;
import com.eaglesakura.andriders.ui.widget.AppKeyValueView;
import com.eaglesakura.andriders.v2.db.CentralServiceSettings;
import com.eaglesakura.andriders.v2.db.DebugSettings;
import com.eaglesakura.android.aquery.AQuery;
import com.eaglesakura.android.device.external.StorageInfo;
import com.eaglesakura.android.framework.delegate.fragment.SupportFragmentDelegate;
import com.eaglesakura.android.framework.ui.license.LicenseViewActivity;
import com.eaglesakura.android.framework.ui.progress.ProgressToken;
import com.eaglesakura.android.margarine.OnCheckedChanged;
import com.eaglesakura.android.margarine.OnClick;
import com.eaglesakura.android.util.PackageUtil;
import com.eaglesakura.material.widget.MaterialAlertDialog;
import com.eaglesakura.util.StringUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.CompoundButton;
import java.io.File;
import java.util.Date;
/**
* アプリのビルド時情報の表示を行う
*/
public class BuildInformationFragment extends AppBaseFragment {
@NonNull
DebugSettings mDebugSettings;
@NonNull
CentralServiceSettings mServiceSettings;
public BuildInformationFragment() {
mFragmentDelegate.setLayoutId(R.layout.fragment_information_build);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDebugSettings = getSettings().getDebugSettings();
mServiceSettings = getSettings().getCentralSettings();
}
@Override
public void onAfterViews(SupportFragmentDelegate self, int flags) {
super.onAfterViews(self, flags);
AQuery q = new AQuery(self.getView());
q.id(R.id.Information_App_Version).getView(AppKeyValueView.class).setValueText(BuildConfig.VERSION_NAME);
q.id(R.id.Information_App_BuildDate).getView(AppKeyValueView.class).setValueText(BuildConfig.BUILD_DATE);
q.id(R.id.Information_App_SDKVersion).getView(AppKeyValueView.class).setValueText(com.eaglesakura.andriders.sdk.BuildConfig.ACE_SDK_VERSION);
q.id(R.id.Information_App_Debug).checked(mDebugSettings.getDebugEnable());
if (mDebugSettings.getDebugEnable()) {
q.id(R.id.Information_DebugSettings).visible();
}
}
@OnClick(R.id.Information_Licenses)
void clickOssLicense() {
LicenseViewActivity.startContent(getActivity());
}
@OnCheckedChanged(R.id.Information_App_Debug)
void changedAppDebug(CompoundButton button, boolean enabled) {
(new AQuery(getView()))
.id(R.id.Information_DebugSettings).visibility(enabled ? View.VISIBLE : View.GONE);
if (enabled == mDebugSettings.getDebugEnable()) {
return;
}
mDebugSettings.setDebugEnable(enabled);
asyncCommitSettings();
if (enabled) {
MaterialAlertDialog dialog = new MaterialAlertDialog(getActivity());
dialog.setTitle(R.string.Common_Worning);
dialog.setMessage(R.string.Information_Debug_Enabled);
dialog.setPositiveButton(R.string.Common_OK, null);
dialog.show();
}
}
/**
* debug rendering
*/
@OnCheckedChanged(R.id.Debug_ACEs_DebugRendering)
void debugCheckAcesDebugRendering(CompoundButton button, boolean checked) {
mDebugSettings.setAcesRenderDebugInfo(checked);
asyncCommitSettings();
}
/**
* loc rendering
*/
@OnCheckedChanged(R.id.Debug_Location_Rendering)
void debugCheckLocationRendering(CompoundButton button, boolean checked) {
mDebugSettings.setRenderLocation(checked);
asyncCommitSettings();
}
/**
* データをフルバックアップする
*/
@OnClick(R.id.Debug_Data_Dump)
void debugClickDataDump() {
asyncUI(it -> {
try (ProgressToken token = pushProgress("pull")) {
File dst = new File(StorageInfo.getExternalStorageRoot(getActivity()), "/debug/" + StringUtil.toString(new Date()));
PackageUtil.dumpPackageDataDirectory(getActivity(), dst);
}
return this;
}).start();
}
}
|
UTF-8
|
Java
| 4,404 |
java
|
BuildInformationFragment.java
|
Java
|
[] | null |
[] |
package com.eaglesakura.andriders.ui.navigation.info;
import com.eaglesakura.andriders.BuildConfig;
import com.eaglesakura.andriders.R;
import com.eaglesakura.andriders.ui.base.AppBaseFragment;
import com.eaglesakura.andriders.ui.widget.AppKeyValueView;
import com.eaglesakura.andriders.v2.db.CentralServiceSettings;
import com.eaglesakura.andriders.v2.db.DebugSettings;
import com.eaglesakura.android.aquery.AQuery;
import com.eaglesakura.android.device.external.StorageInfo;
import com.eaglesakura.android.framework.delegate.fragment.SupportFragmentDelegate;
import com.eaglesakura.android.framework.ui.license.LicenseViewActivity;
import com.eaglesakura.android.framework.ui.progress.ProgressToken;
import com.eaglesakura.android.margarine.OnCheckedChanged;
import com.eaglesakura.android.margarine.OnClick;
import com.eaglesakura.android.util.PackageUtil;
import com.eaglesakura.material.widget.MaterialAlertDialog;
import com.eaglesakura.util.StringUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.CompoundButton;
import java.io.File;
import java.util.Date;
/**
* アプリのビルド時情報の表示を行う
*/
public class BuildInformationFragment extends AppBaseFragment {
@NonNull
DebugSettings mDebugSettings;
@NonNull
CentralServiceSettings mServiceSettings;
public BuildInformationFragment() {
mFragmentDelegate.setLayoutId(R.layout.fragment_information_build);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDebugSettings = getSettings().getDebugSettings();
mServiceSettings = getSettings().getCentralSettings();
}
@Override
public void onAfterViews(SupportFragmentDelegate self, int flags) {
super.onAfterViews(self, flags);
AQuery q = new AQuery(self.getView());
q.id(R.id.Information_App_Version).getView(AppKeyValueView.class).setValueText(BuildConfig.VERSION_NAME);
q.id(R.id.Information_App_BuildDate).getView(AppKeyValueView.class).setValueText(BuildConfig.BUILD_DATE);
q.id(R.id.Information_App_SDKVersion).getView(AppKeyValueView.class).setValueText(com.eaglesakura.andriders.sdk.BuildConfig.ACE_SDK_VERSION);
q.id(R.id.Information_App_Debug).checked(mDebugSettings.getDebugEnable());
if (mDebugSettings.getDebugEnable()) {
q.id(R.id.Information_DebugSettings).visible();
}
}
@OnClick(R.id.Information_Licenses)
void clickOssLicense() {
LicenseViewActivity.startContent(getActivity());
}
@OnCheckedChanged(R.id.Information_App_Debug)
void changedAppDebug(CompoundButton button, boolean enabled) {
(new AQuery(getView()))
.id(R.id.Information_DebugSettings).visibility(enabled ? View.VISIBLE : View.GONE);
if (enabled == mDebugSettings.getDebugEnable()) {
return;
}
mDebugSettings.setDebugEnable(enabled);
asyncCommitSettings();
if (enabled) {
MaterialAlertDialog dialog = new MaterialAlertDialog(getActivity());
dialog.setTitle(R.string.Common_Worning);
dialog.setMessage(R.string.Information_Debug_Enabled);
dialog.setPositiveButton(R.string.Common_OK, null);
dialog.show();
}
}
/**
* debug rendering
*/
@OnCheckedChanged(R.id.Debug_ACEs_DebugRendering)
void debugCheckAcesDebugRendering(CompoundButton button, boolean checked) {
mDebugSettings.setAcesRenderDebugInfo(checked);
asyncCommitSettings();
}
/**
* loc rendering
*/
@OnCheckedChanged(R.id.Debug_Location_Rendering)
void debugCheckLocationRendering(CompoundButton button, boolean checked) {
mDebugSettings.setRenderLocation(checked);
asyncCommitSettings();
}
/**
* データをフルバックアップする
*/
@OnClick(R.id.Debug_Data_Dump)
void debugClickDataDump() {
asyncUI(it -> {
try (ProgressToken token = pushProgress("pull")) {
File dst = new File(StorageInfo.getExternalStorageRoot(getActivity()), "/debug/" + StringUtil.toString(new Date()));
PackageUtil.dumpPackageDataDirectory(getActivity(), dst);
}
return this;
}).start();
}
}
| 4,404 | 0.713628 | 0.713168 | 124 | 34.032257 | 30.849253 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
0
|
62985f875ad283fab97cfc9bcb3aaf5db976ecc5
| 4,303,557,294,348 |
3182da6b19b8b0fcd674d751c9301a9b39e2a042
|
/src/main/java/me/strim/webstrim/Devices.java
|
bd48c439542922d377e42c1ca2742a1a040cac01
|
[] |
no_license
|
StrimTechnologies/webstrim
|
https://github.com/StrimTechnologies/webstrim
|
fc56e10d08e27c3edc3a4acb83acea9abb3be032
|
09b90b4e9caadf55f27544b220d0b770b53f7df7
|
refs/heads/master
| 2021-01-20T03:57:09.897000 | 2017-08-28T13:01:46 | 2017-08-28T13:01:46 | 101,377,477 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (C) 2017 strim.me
*
* 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
* (at your option) 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 me.strim.webstrim;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author mihai
*/
@Entity
@Table(name = "devices")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Devices.findAll", query = "SELECT d FROM Devices d")
, @NamedQuery(name = "Devices.findByDeviceId", query = "SELECT d FROM Devices d WHERE d.deviceId = :deviceId")
, @NamedQuery(name = "Devices.findByDeviceName", query = "SELECT d FROM Devices d WHERE d.deviceName = :deviceName")
, @NamedQuery(name = "Devices.findByModelId", query = "SELECT d FROM Devices d WHERE d.modelId = :modelId")
, @NamedQuery(name = "Devices.findByDeviceRating", query = "SELECT d FROM Devices d WHERE d.deviceRating = :deviceRating")
, @NamedQuery(name = "Devices.findByStatus", query = "SELECT d FROM Devices d WHERE d.status = :status")
, @NamedQuery(name = "Devices.findByBandwidth", query = "SELECT d FROM Devices d WHERE d.bandwidth = :bandwidth")
, @NamedQuery(name = "Devices.findByPrice", query = "SELECT d FROM Devices d WHERE d.price = :price")
, @NamedQuery(name = "Devices.findByDescription", query = "SELECT d FROM Devices d WHERE d.description = :description")
, @NamedQuery(name = "Devices.findByRoomInfo", query = "SELECT d FROM Devices d WHERE d.roomInfo = :roomInfo")
, @NamedQuery(name = "Devices.findByDateCreated", query = "SELECT d FROM Devices d WHERE d.dateCreated = :dateCreated")
, @NamedQuery(name = "Devices.findByDateUpdated", query = "SELECT d FROM Devices d WHERE d.dateUpdated = :dateUpdated")
, @NamedQuery(name = "Devices.findByUsername", query = "SELECT d FROM Devices d WHERE d.userId = (SELECT 'user_id' FROM Users u WHERE u.username= :username)")})
public class Devices implements Serializable {
@Column(name = "strim_status")
private Boolean strimStatus;
@Size(max = 2000)
@Column(name = "strim_metadata")
private String strimMetadata;
@Size(max = 200)
@Column(name = "strim_name")
private String strimName;
@Column(name = "strim_type")
private Integer strimType;
@Size(max = 200)
@Column(name = "strim_info")
private String strimInfo;
@Size(max = 200)
@Column(name = "strim_location")
private String strimLocation;
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "device_id")
private Integer deviceId;
@Size(max = 200)
@Column(name = "device_name")
private String deviceName;
@Size(max = 200)
@Column(name = "model_id")
private String modelId;
@Column(name = "device_rating")
private Integer deviceRating;
@Column(name = "status")
private Integer status;
@Column(name = "bandwidth")
private Integer bandwidth;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "price")
private Float price;
@Size(max = 2000)
@Column(name = "description")
private String description;
@Size(max = 200)
@Column(name = "room_info")
private String roomInfo;
@Column(name = "date_created", insertable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@Column(name = "date_updated", insertable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date dateUpdated;
@JoinColumn(name = "user_id", referencedColumnName = "user_id")
@ManyToOne
private Users userId;
@OneToMany(mappedBy = "deviceId")
private Collection<Senzors> senzorsCollection;
public Devices() {
}
public Devices(Integer deviceId) {
this.deviceId = deviceId;
}
public Integer getDeviceId() {
return deviceId;
}
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getModelId() {
return modelId;
}
public void setModelId(String modelId) {
this.modelId = modelId;
}
public Integer getDeviceRating() {
return deviceRating;
}
public void setDeviceRating(Integer deviceRating) {
this.deviceRating = deviceRating;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getBandwidth() {
return bandwidth;
}
public void setBandwidth(Integer bandwidth) {
this.bandwidth = bandwidth;
}
public Float getPrice() {
return price;
}
public void setPrice(Float price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getRoomInfo() {
return roomInfo;
}
public void setRoomInfo(String roomInfo) {
this.roomInfo = roomInfo;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Date getDateUpdated() {
return dateUpdated;
}
public void setDateUpdated(Date dateUpdated) {
this.dateUpdated = dateUpdated;
}
public Users getUserId() {
return userId;
}
public void setUserId(Users userId) {
this.userId = userId;
}
@XmlTransient
public Collection<Senzors> getSenzorsCollection() {
return senzorsCollection;
}
public void setSenzorsCollection(Collection<Senzors> senzorsCollection) {
this.senzorsCollection = senzorsCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (deviceId != null ? deviceId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Devices)) {
return false;
}
Devices other = (Devices) object;
if ((this.deviceId == null && other.deviceId != null) || (this.deviceId != null && !this.deviceId.equals(other.deviceId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "me.strim.webstrim.Devices[ deviceId=" + deviceId + " ]";
}
public String getStrimName() {
return strimName;
}
public void setStrimName(String strimName) {
this.strimName = strimName;
}
public Integer getStrimType() {
return strimType;
}
public void setStrimType(Integer strimType) {
this.strimType = strimType;
}
public String getStrimInfo() {
return strimInfo;
}
public void setStrimInfo(String strimInfo) {
this.strimInfo = strimInfo;
}
public String getStrimLocation() {
return strimLocation;
}
public void setStrimLocation(String strimLocation) {
this.strimLocation = strimLocation;
}
public String getStrimMetadata() {
return strimMetadata;
}
public void setStrimMetadata(String strimMetadata) {
this.strimMetadata = strimMetadata;
}
public Boolean getStrimStatus() {
return strimStatus;
}
public void setStrimStatus(Boolean strimStatus) {
this.strimStatus = strimStatus;
}
}
|
UTF-8
|
Java
| 9,033 |
java
|
Devices.java
|
Java
|
[
{
"context": "l.bind.annotation.XmlTransient;\n\n/**\n *\n * @author mihai\n */\n@Entity\n@Table(name = \"devices\")\n@XmlRootElem",
"end": 1459,
"score": 0.9300300478935242,
"start": 1454,
"tag": "USERNAME",
"value": "mihai"
}
] | null |
[] |
/*
* Copyright (C) 2017 strim.me
*
* 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
* (at your option) 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 me.strim.webstrim;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author mihai
*/
@Entity
@Table(name = "devices")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Devices.findAll", query = "SELECT d FROM Devices d")
, @NamedQuery(name = "Devices.findByDeviceId", query = "SELECT d FROM Devices d WHERE d.deviceId = :deviceId")
, @NamedQuery(name = "Devices.findByDeviceName", query = "SELECT d FROM Devices d WHERE d.deviceName = :deviceName")
, @NamedQuery(name = "Devices.findByModelId", query = "SELECT d FROM Devices d WHERE d.modelId = :modelId")
, @NamedQuery(name = "Devices.findByDeviceRating", query = "SELECT d FROM Devices d WHERE d.deviceRating = :deviceRating")
, @NamedQuery(name = "Devices.findByStatus", query = "SELECT d FROM Devices d WHERE d.status = :status")
, @NamedQuery(name = "Devices.findByBandwidth", query = "SELECT d FROM Devices d WHERE d.bandwidth = :bandwidth")
, @NamedQuery(name = "Devices.findByPrice", query = "SELECT d FROM Devices d WHERE d.price = :price")
, @NamedQuery(name = "Devices.findByDescription", query = "SELECT d FROM Devices d WHERE d.description = :description")
, @NamedQuery(name = "Devices.findByRoomInfo", query = "SELECT d FROM Devices d WHERE d.roomInfo = :roomInfo")
, @NamedQuery(name = "Devices.findByDateCreated", query = "SELECT d FROM Devices d WHERE d.dateCreated = :dateCreated")
, @NamedQuery(name = "Devices.findByDateUpdated", query = "SELECT d FROM Devices d WHERE d.dateUpdated = :dateUpdated")
, @NamedQuery(name = "Devices.findByUsername", query = "SELECT d FROM Devices d WHERE d.userId = (SELECT 'user_id' FROM Users u WHERE u.username= :username)")})
public class Devices implements Serializable {
@Column(name = "strim_status")
private Boolean strimStatus;
@Size(max = 2000)
@Column(name = "strim_metadata")
private String strimMetadata;
@Size(max = 200)
@Column(name = "strim_name")
private String strimName;
@Column(name = "strim_type")
private Integer strimType;
@Size(max = 200)
@Column(name = "strim_info")
private String strimInfo;
@Size(max = 200)
@Column(name = "strim_location")
private String strimLocation;
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "device_id")
private Integer deviceId;
@Size(max = 200)
@Column(name = "device_name")
private String deviceName;
@Size(max = 200)
@Column(name = "model_id")
private String modelId;
@Column(name = "device_rating")
private Integer deviceRating;
@Column(name = "status")
private Integer status;
@Column(name = "bandwidth")
private Integer bandwidth;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "price")
private Float price;
@Size(max = 2000)
@Column(name = "description")
private String description;
@Size(max = 200)
@Column(name = "room_info")
private String roomInfo;
@Column(name = "date_created", insertable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@Column(name = "date_updated", insertable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date dateUpdated;
@JoinColumn(name = "user_id", referencedColumnName = "user_id")
@ManyToOne
private Users userId;
@OneToMany(mappedBy = "deviceId")
private Collection<Senzors> senzorsCollection;
public Devices() {
}
public Devices(Integer deviceId) {
this.deviceId = deviceId;
}
public Integer getDeviceId() {
return deviceId;
}
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getModelId() {
return modelId;
}
public void setModelId(String modelId) {
this.modelId = modelId;
}
public Integer getDeviceRating() {
return deviceRating;
}
public void setDeviceRating(Integer deviceRating) {
this.deviceRating = deviceRating;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getBandwidth() {
return bandwidth;
}
public void setBandwidth(Integer bandwidth) {
this.bandwidth = bandwidth;
}
public Float getPrice() {
return price;
}
public void setPrice(Float price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getRoomInfo() {
return roomInfo;
}
public void setRoomInfo(String roomInfo) {
this.roomInfo = roomInfo;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Date getDateUpdated() {
return dateUpdated;
}
public void setDateUpdated(Date dateUpdated) {
this.dateUpdated = dateUpdated;
}
public Users getUserId() {
return userId;
}
public void setUserId(Users userId) {
this.userId = userId;
}
@XmlTransient
public Collection<Senzors> getSenzorsCollection() {
return senzorsCollection;
}
public void setSenzorsCollection(Collection<Senzors> senzorsCollection) {
this.senzorsCollection = senzorsCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (deviceId != null ? deviceId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Devices)) {
return false;
}
Devices other = (Devices) object;
if ((this.deviceId == null && other.deviceId != null) || (this.deviceId != null && !this.deviceId.equals(other.deviceId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "me.strim.webstrim.Devices[ deviceId=" + deviceId + " ]";
}
public String getStrimName() {
return strimName;
}
public void setStrimName(String strimName) {
this.strimName = strimName;
}
public Integer getStrimType() {
return strimType;
}
public void setStrimType(Integer strimType) {
this.strimType = strimType;
}
public String getStrimInfo() {
return strimInfo;
}
public void setStrimInfo(String strimInfo) {
this.strimInfo = strimInfo;
}
public String getStrimLocation() {
return strimLocation;
}
public void setStrimLocation(String strimLocation) {
this.strimLocation = strimLocation;
}
public String getStrimMetadata() {
return strimMetadata;
}
public void setStrimMetadata(String strimMetadata) {
this.strimMetadata = strimMetadata;
}
public Boolean getStrimStatus() {
return strimStatus;
}
public void setStrimStatus(Boolean strimStatus) {
this.strimStatus = strimStatus;
}
}
| 9,033 | 0.668549 | 0.664785 | 305 | 28.616394 | 28.436304 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.409836 | false | false |
0
|
7048889d34da9e1d586f636bbe62f25ef5a8438c
| 4,303,557,294,604 |
56981d0d471ede5ae9ee9a4cd7c269ee32e101bd
|
/DataStructures/workspace_old/algs4/src/algs13/ResizingArrayQueue.java
|
6ce694c9b996e4fcd08040ff09fc51b0ea768966
|
[] |
no_license
|
abelmarin/School-Work
|
https://github.com/abelmarin/School-Work
|
20c08f5003c44efc1d9ab33eee77225fd8cef953
|
14e8ada9ddbb46a54495b1295000b88d9dcf3feb
|
refs/heads/master
| 2021-12-02T00:25:08.131000 | 2021-11-22T19:19:51 | 2021-11-22T19:19:51 | 227,487,750 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Exercise 1.3.14 (Solution published at http://algs4.cs.princeton.edu/)
package algs13;
import stdlib.*;
import java.util.Iterator;
import java.util.NoSuchElementException;
/* ***********************************************************************
* Compilation: javac ResizingArrayQueue.java
* Execution: java ResizingArrayQueue < input.txt
* Data files: http://algs4.cs.princeton.edu/13stacks/tobe.txt
*
* Queue implementation with a resizing array.
*
* % java ResizingArrayQueue < tobe.txt
* to be or not to be (2 left on queue)
*
*************************************************************************/
public class ResizingArrayQueue<T> implements Iterable<T> {
private T[] q; // queue elements
private int N; // number of elements on queue
private int first; // index of first element of queue
private int last; // index of next available slot
// cast needed since no generic array creation in Java
@SuppressWarnings("unchecked")
public ResizingArrayQueue() {
this.q = (T[]) new Object[2];
this.N = 0;
this.first = 0;
this.last = 0;
}
public boolean isEmpty() { return N == 0; }
public int size() { return N; }
@SuppressWarnings("unchecked")
private void resize(int capacity) {
if (capacity <= N) throw new IllegalArgumentException ();
T[] temp = (T[]) new Object[capacity];
for (int i = 0; i < N; i++) temp[i] = q[(first + i) % q.length];
q = temp;
first = 0;
last = N;
}
public void enqueue(T item) {
if (N == q.length) resize(2*q.length); // double size of array if necessary
q[last] = item; // add item
last = (last + 1) % q.length;
N++;
}
// remove the least recently added item
public T dequeue() {
if (isEmpty()) throw new Error("Queue underflow");
T item = q[first];
q[first] = null; // to avoid loitering
N--;
first = (first + 1) % q.length;
if (N > 0 && N == q.length/4) resize(q.length/2); // shrink size of array if necessary
return item;
}
public Iterator<T> iterator() { return new ArrayIterator(); }
private class ArrayIterator implements Iterator<T> {
private int i = 0;
public boolean hasNext() { return i < N; }
public void remove() { throw new UnsupportedOperationException(); }
public T next() {
if (!hasNext()) throw new NoSuchElementException();
T item = q[(first + i) % q.length];
i++;
return item;
}
}
public String toString () {
if (isEmpty()) return "[]";
StringBuilder sb = new StringBuilder ("[");
Iterator<T> i = iterator();
sb.append (i.next ());
while (i.hasNext ()) {
sb.append (" ");
sb.append (i.next ());
}
sb.append ("]");
return sb.toString ();
}
private void check (String expected) {
if (N<0 || N>q.length) throw new Error ();
if (N==0 && q.length!=2) throw new Error ("Expected length 2, got " + q.length);
if (N!=0 && N<q.length/4) throw new Error ();
if (((first + N) % q.length) != last) throw new Error ();
for (int i=0; i<N; i++) {
if (q[(first + i) % q.length] == null) throw new Error ();
}
for (int i=N; i<q.length; i++) {
if (q[(first + i) % q.length] != null) throw new Error ();
}
if (expected != null) {
if (!expected.equals(this.toString ())) throw new Error ("Expected \"" + expected + "\", got \"" + this + "\"");
}
StdOut.println (this);
}
private void check (T iExpected, T iActual, String expected) {
if (!iExpected.equals (iActual)) throw new Error ("Expected \"" + iExpected + "\", got \"" + iActual + "\"");
check (expected);
}
public static void mainx (String args[]) {
ResizingArrayQueue<Integer> d1;
Integer k;
d1 = new ResizingArrayQueue<> ();
d1.enqueue (11); d1.check ("[11]");
d1.enqueue (12); d1.check ("[11 12]");
k = d1.dequeue(); d1.check (11, k, "[12]");
k = d1.dequeue(); d1.check (12, k, "[]");
d1 = new ResizingArrayQueue<> ();
for (int i = 10; i < 20; i++)
d1.enqueue (i);
d1.check ("[10 11 12 13 14 15 16 17 18 19]");
for (int i = 0; i < 10; i++) {
d1.dequeue (); d1.check (null);
}
try { d1.dequeue (); throw new Error ("Expected exception"); } catch (Error e) {}
}
// A test client
public static void main (String[] args) {
StdIn.fromString ("to be or not to - be - - that - - - is");
ResizingArrayQueue<String> q = new ResizingArrayQueue<>();
while (!StdIn.isEmpty()) {
String item = StdIn.readString();
if (!item.equals("-")) q.enqueue(item);
else StdOut.print(q.dequeue() + " ");
}
StdOut.println("(" + q.size() + " left on queue)");
}
}
|
UTF-8
|
Java
| 4,610 |
java
|
ResizingArrayQueue.java
|
Java
|
[] | null |
[] |
// Exercise 1.3.14 (Solution published at http://algs4.cs.princeton.edu/)
package algs13;
import stdlib.*;
import java.util.Iterator;
import java.util.NoSuchElementException;
/* ***********************************************************************
* Compilation: javac ResizingArrayQueue.java
* Execution: java ResizingArrayQueue < input.txt
* Data files: http://algs4.cs.princeton.edu/13stacks/tobe.txt
*
* Queue implementation with a resizing array.
*
* % java ResizingArrayQueue < tobe.txt
* to be or not to be (2 left on queue)
*
*************************************************************************/
public class ResizingArrayQueue<T> implements Iterable<T> {
private T[] q; // queue elements
private int N; // number of elements on queue
private int first; // index of first element of queue
private int last; // index of next available slot
// cast needed since no generic array creation in Java
@SuppressWarnings("unchecked")
public ResizingArrayQueue() {
this.q = (T[]) new Object[2];
this.N = 0;
this.first = 0;
this.last = 0;
}
public boolean isEmpty() { return N == 0; }
public int size() { return N; }
@SuppressWarnings("unchecked")
private void resize(int capacity) {
if (capacity <= N) throw new IllegalArgumentException ();
T[] temp = (T[]) new Object[capacity];
for (int i = 0; i < N; i++) temp[i] = q[(first + i) % q.length];
q = temp;
first = 0;
last = N;
}
public void enqueue(T item) {
if (N == q.length) resize(2*q.length); // double size of array if necessary
q[last] = item; // add item
last = (last + 1) % q.length;
N++;
}
// remove the least recently added item
public T dequeue() {
if (isEmpty()) throw new Error("Queue underflow");
T item = q[first];
q[first] = null; // to avoid loitering
N--;
first = (first + 1) % q.length;
if (N > 0 && N == q.length/4) resize(q.length/2); // shrink size of array if necessary
return item;
}
public Iterator<T> iterator() { return new ArrayIterator(); }
private class ArrayIterator implements Iterator<T> {
private int i = 0;
public boolean hasNext() { return i < N; }
public void remove() { throw new UnsupportedOperationException(); }
public T next() {
if (!hasNext()) throw new NoSuchElementException();
T item = q[(first + i) % q.length];
i++;
return item;
}
}
public String toString () {
if (isEmpty()) return "[]";
StringBuilder sb = new StringBuilder ("[");
Iterator<T> i = iterator();
sb.append (i.next ());
while (i.hasNext ()) {
sb.append (" ");
sb.append (i.next ());
}
sb.append ("]");
return sb.toString ();
}
private void check (String expected) {
if (N<0 || N>q.length) throw new Error ();
if (N==0 && q.length!=2) throw new Error ("Expected length 2, got " + q.length);
if (N!=0 && N<q.length/4) throw new Error ();
if (((first + N) % q.length) != last) throw new Error ();
for (int i=0; i<N; i++) {
if (q[(first + i) % q.length] == null) throw new Error ();
}
for (int i=N; i<q.length; i++) {
if (q[(first + i) % q.length] != null) throw new Error ();
}
if (expected != null) {
if (!expected.equals(this.toString ())) throw new Error ("Expected \"" + expected + "\", got \"" + this + "\"");
}
StdOut.println (this);
}
private void check (T iExpected, T iActual, String expected) {
if (!iExpected.equals (iActual)) throw new Error ("Expected \"" + iExpected + "\", got \"" + iActual + "\"");
check (expected);
}
public static void mainx (String args[]) {
ResizingArrayQueue<Integer> d1;
Integer k;
d1 = new ResizingArrayQueue<> ();
d1.enqueue (11); d1.check ("[11]");
d1.enqueue (12); d1.check ("[11 12]");
k = d1.dequeue(); d1.check (11, k, "[12]");
k = d1.dequeue(); d1.check (12, k, "[]");
d1 = new ResizingArrayQueue<> ();
for (int i = 10; i < 20; i++)
d1.enqueue (i);
d1.check ("[10 11 12 13 14 15 16 17 18 19]");
for (int i = 0; i < 10; i++) {
d1.dequeue (); d1.check (null);
}
try { d1.dequeue (); throw new Error ("Expected exception"); } catch (Error e) {}
}
// A test client
public static void main (String[] args) {
StdIn.fromString ("to be or not to - be - - that - - - is");
ResizingArrayQueue<String> q = new ResizingArrayQueue<>();
while (!StdIn.isEmpty()) {
String item = StdIn.readString();
if (!item.equals("-")) q.enqueue(item);
else StdOut.print(q.dequeue() + " ");
}
StdOut.println("(" + q.size() + " left on queue)");
}
}
| 4,610 | 0.575922 | 0.556182 | 142 | 31.464788 | 25.303415 | 115 | false | false | 29 | 0.006291 | 0 | 0 | 0 | 0 | 2.15493 | false | false |
0
|
f4d965117eea2a5ae958a168cd7af5fe7fe1b77e
| 12,678,743,486,021 |
a20834e9761122639860a8644cf027cd603c6c2c
|
/Runebind/src/com/ravine/runebind/dice/Die.java
|
faedad15a59f3af5c92777aa197165c4dc540a80
|
[
"MIT"
] |
permissive
|
bchalls/runebind
|
https://github.com/bchalls/runebind
|
7f59d34284c0461e90a377c36991a45284e0192a
|
e17e16f7f9a3901c392b12e1ea4407519e763916
|
refs/heads/master
| 2016-08-03T09:26:27.952000 | 2015-07-15T18:57:53 | 2015-07-15T18:57:53 | 12,301,465 | 1 | 1 | null | false | 2015-07-15T18:57:53 | 2013-08-22T16:03:06 | 2014-05-28T19:28:02 | 2015-07-15T18:57:53 | 17,148 | 2 | 0 | 1 |
Java
| null | null |
package com.ravine.runebind.dice;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import java.util.Random;
/**
* Created with IntelliJ IDEA.
* User: Brandon
* Date: 8/18/13
* Time: 1:48 PM
*/
public abstract class Die {
protected int numSides;
protected Texture image;
protected TextureRegion[] sideImage;
protected int x, y, curSide;
protected Random rand;
public abstract int roll();
public abstract void setNumSides(int numSides);
public void setCurSide(int side) {
curSide = side;
}
}
|
UTF-8
|
Java
| 592 |
java
|
Die.java
|
Java
|
[
{
"context": "ndom;\n\n/**\n * Created with IntelliJ IDEA.\n * User: Brandon\n * Date: 8/18/13\n * Time: 1:48 PM\n */\npublic abst",
"end": 207,
"score": 0.9950764179229736,
"start": 200,
"tag": "NAME",
"value": "Brandon"
}
] | null |
[] |
package com.ravine.runebind.dice;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import java.util.Random;
/**
* Created with IntelliJ IDEA.
* User: Brandon
* Date: 8/18/13
* Time: 1:48 PM
*/
public abstract class Die {
protected int numSides;
protected Texture image;
protected TextureRegion[] sideImage;
protected int x, y, curSide;
protected Random rand;
public abstract int roll();
public abstract void setNumSides(int numSides);
public void setCurSide(int side) {
curSide = side;
}
}
| 592 | 0.695946 | 0.680743 | 30 | 18.733334 | 16.540724 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
0
|
2c96829506a01898e083a88b47e9dd0109d98991
| 34,737,695,523,628 |
e6dfdef06192b376485f55a16722c89d3dd1c30c
|
/src/main/java/com/example/rest/Models/Platos.java
|
c8c5d7bb6be83fb746667e8307358243842e3e96
|
[] |
no_license
|
JaviKo500/git-spring-boot
|
https://github.com/JaviKo500/git-spring-boot
|
1bfb70f2811c8186358004f0603f38d07cab4a11
|
2c2c9b9ddaef66c19c87c4fb4b751e0458e21295
|
refs/heads/main
| 2023-01-24T04:03:13.059000 | 2020-12-12T02:00:11 | 2020-12-12T02:00:11 | 320,727,011 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.rest.Models;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "platos")
public class Platos implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "pla_id",unique = true)
@GeneratedValue(strategy = GenerationType.IDENTITY, generator = "platos")
private Integer pla_id;
@Column(name = "pla_nom")
private String pla_nom;
@Column(name = "pla_des")
private String pla_des;
@Column(name = "pla_precio")
private Double pla_precio;
@OneToOne
@JoinColumn(name = "cat_id_fk")
private Categorias cat_id_fk;
public Integer getPla_id() {
return pla_id;
}
public void setPla_id(Integer pla_id) {
this.pla_id = pla_id;
}
public String getPla_nom() {
return pla_nom;
}
public void setPla_nom(String pla_nom) {
this.pla_nom = pla_nom;
}
public String getPla_des() {
return pla_des;
}
public void setPla_des(String pla_des) {
this.pla_des = pla_des;
}
public Double getPla_precio() {
return pla_precio;
}
public void setPla_precio(Double pla_precio) {
this.pla_precio = pla_precio;
}
public Categorias getCat_id_fk() {
return cat_id_fk;
}
public void setCat_id_fk(Categorias cat_id_fk) {
this.cat_id_fk = cat_id_fk;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
|
UTF-8
|
Java
| 1,602 |
java
|
Platos.java
|
Java
|
[] | null |
[] |
package com.example.rest.Models;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "platos")
public class Platos implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "pla_id",unique = true)
@GeneratedValue(strategy = GenerationType.IDENTITY, generator = "platos")
private Integer pla_id;
@Column(name = "pla_nom")
private String pla_nom;
@Column(name = "pla_des")
private String pla_des;
@Column(name = "pla_precio")
private Double pla_precio;
@OneToOne
@JoinColumn(name = "cat_id_fk")
private Categorias cat_id_fk;
public Integer getPla_id() {
return pla_id;
}
public void setPla_id(Integer pla_id) {
this.pla_id = pla_id;
}
public String getPla_nom() {
return pla_nom;
}
public void setPla_nom(String pla_nom) {
this.pla_nom = pla_nom;
}
public String getPla_des() {
return pla_des;
}
public void setPla_des(String pla_des) {
this.pla_des = pla_des;
}
public Double getPla_precio() {
return pla_precio;
}
public void setPla_precio(Double pla_precio) {
this.pla_precio = pla_precio;
}
public Categorias getCat_id_fk() {
return cat_id_fk;
}
public void setCat_id_fk(Categorias cat_id_fk) {
this.cat_id_fk = cat_id_fk;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
| 1,602 | 0.715356 | 0.714732 | 84 | 18.071428 | 17.115704 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.107143 | false | false |
0
|
69daefe39bab91d7591058f0c2323aec87d5315d
| 8,134,668,122,285 |
5b692011fba286598c6f0adcaf0285d9ac8b585a
|
/hoaureport/hoaureport-configreport/src/main/java/com/hoau/hoaureport/module/configreport/server/service/impl/FleetAreaManageService.java
|
4f635e742f1349a69017af010ac8cb58cfc9a770
|
[] |
no_license
|
liuwenlin/hoaureport
|
https://github.com/liuwenlin/hoaureport
|
ca5f71aadf83179c57b8d97ebdfcd6810207204b
|
533cce02ce1ff34ada9d7d25cba34088aea8fa4b
|
refs/heads/master
| 2020-04-05T10:36:20.496000 | 2019-04-19T12:58:52 | 2019-04-19T12:58:52 | 156,503,217 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hoau.hoaureport.module.configreport.server.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.hoau.hbdp.framework.server.context.UserContext;
import com.hoau.hbdp.framework.shared.util.string.StringUtil;
import com.hoau.hoaureport.module.baseinfo.api.shared.domain.UserEntity;
import com.hoau.hoaureport.module.common.server.constants.ItfConifgConstant;
import com.hoau.hoaureport.module.configreport.server.dao.FleetAreaInfoMapper;
import com.hoau.hoaureport.module.configreport.server.service.IFleetAreaManageService;
import com.hoau.hoaureport.module.configreport.server.util.ExcelUtil;
import com.hoau.hoaureport.module.configreport.shared.domain.FleetAreaInfo;
import com.hoau.hoaureport.module.util.DateUtils;
/**
* 车队辖区管理服务实现类
* ClassName: FleetAreaManageService
* @author 文洁
* @date 2016年8月18日
* @version V1.0
*/
@Service
public class FleetAreaManageService implements IFleetAreaManageService{
private static final Logger log = LoggerFactory.getLogger(FleetAreaInfo.class);
@Resource
FleetAreaInfoMapper FleetAreaInfoMapper;
/**
* 查询车队辖区信息
*/
@Override
public List<FleetAreaInfo> queryFleetAreaInfo(FleetAreaInfo param,
int start, int limit) {
RowBounds rowBounds = new RowBounds(start,limit);
return FleetAreaInfoMapper.queryFleetAreaInfoByCondition(param, rowBounds);
}
/**
* 查询记录总数
*/
@Override
public Long queryFleetAreaCount(FleetAreaInfo param) {
return FleetAreaInfoMapper.queryFleetAreaCountByCondition(param);
}
/**
* 增加车队辖区
*/
@Transactional
@Override
public void addFleetAreaInfo(FleetAreaInfo record) {
UserEntity currUser = (UserEntity) UserContext.getCurrentUser();
//工号
String currUserCode = currUser.getEmpCode().substring(2);
record.setActive(ItfConifgConstant.HAR_ACTIVE_YES);
record.setEffectedTime(new Date());
record.setInvalidTime(DateUtils.strToDate("2999-1-1 00:00:00"));
record.setCreateTime(new Date());
record.setCreateUserCode(currUserCode);
record.setModifyTime(new Date());
record.setModifyUserCode(currUserCode);
FleetAreaInfoMapper.insertSelective(record);
}
/**
* 在原纪录上更新车队辖区信息
*/
@Transactional
@Override
public void updateFleetAreaInfo(FleetAreaInfo record) {
FleetAreaInfoMapper.updateByPrimaryKeySelective(record);
}
/**
* 原纪录作废,更新后的记录作为新数据插入
*/
@Transactional
@Override
public void repealAndAddFleetAreaInfo(FleetAreaInfo param) {
//原纪录作废,并取得修改者编号
String modifier = repealFleetAreaInfo(param);
//另外插入修改数据
param.setActive(ItfConifgConstant.HAR_ACTIVE_YES);
param.setEffectedTime(new Date());
param.setInvalidTime(DateUtils.strToDate("2999-1-1 00:00:00"));
param.setCreateTime(new Date());
param.setCreateUserCode(modifier);
param.setModifyTime(new Date());
param.setModifyUserCode(modifier);
addFleetAreaInfo(param);
}
/**
* 原记录作废,返回操作者编号
*/
@Override
public String repealFleetAreaInfo(FleetAreaInfo param) {
UserEntity currUser = (UserEntity) UserContext.getCurrentUser();
//工号
String currUserCode = currUser.getEmpCode().substring(2);
FleetAreaInfo oldInfo = new FleetAreaInfo();
oldInfo.setFleetAreaId(param.getFleetAreaId());
oldInfo.setActive(ItfConifgConstant.HAR_ACTIVE_NO);
oldInfo.setInvalidTime(new Date());
oldInfo.setModifyTime(new Date());
oldInfo.setModifyUserCode(currUserCode);
updateFleetAreaInfo(oldInfo);
return currUserCode;
}
/**
* 判断是否已存在
*/
@Override
public boolean isExist(FleetAreaInfo param) {
//设置判断为已存在的条件
FleetAreaInfo exitCondition = new FleetAreaInfo();
exitCondition.setAreaOperationUnitShortname(param.getAreaOperationUnitShortname());
//不考虑已作废记录
exitCondition.setActive(ItfConifgConstant.HAR_ACTIVE_YES);
List<FleetAreaInfo> fleetAreaInfos = this.queryFleetAreaInfo(exitCondition,0,10);
return fleetAreaInfos.size() > 0;
}
@Override
public Map<String, Object> bathImplFleetAreaInfo(String path)throws Exception {
//导入结果
Map<String,Object> retuMap =new HashMap<String, Object>();
//解析Excel
List<Map<String, String>> list = ExcelUtil.readToListByFile(path, 32, 2);
//把键值对 转换成 对象集合
List<FleetAreaInfo> fleetAreaInfos = new ArrayList<FleetAreaInfo>();
if(list.size() > 0){
Map<String, String> map = null;
for(int i = 0;i<list.size();i++){
map = list.get(i);
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(0+"")))){
retuMap.put("error", "第"+(++i)+"行,辖区作业单位简称不能为空!");
return retuMap;
}
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(3+"")))){
retuMap.put("error", "第"+(++i)+"行,所属事业部不能为空!");
return retuMap;
}
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(1+"")))){
retuMap.put("error", "第"+(++i)+"行,归属车队名称不能为空,为空项请用‘—’填充!");
return retuMap;
}
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(2+"")))){
retuMap.put("error", "第"+(++i)+"行,所属大区不能为空,为空项请用‘—’填充!");
return retuMap;
}
}
}
for (Map<String, String> map : list) {
FleetAreaInfo bean = new FleetAreaInfo();
try {
bean.setAreaOperationUnitShortname(StringUtil.trim(map.get(0+"")));
bean.setTheFleetShortName(StringUtil.trim(map.get(1+"")));
bean.setTheArea(StringUtil.trim(map.get(2+"")));
bean.setTheBusinessDepartment(StringUtil.trim(map.get(3+"")));
} catch (Exception e) {
bean = null;// 如果有异常就把pcbean设为null,这样每条信息都加进去了
log.error("批量导入模版数据异常,业务需要仅作提示", e);
} finally {
fleetAreaInfos.add(bean);
}
}
//设置增加条数,覆盖条数
Map<String, Long> countMap = new HashMap<String, Long>();
countMap.put("addSize", new Long(0));// 增加条数
countMap.put("coverSize", new Long(0));// 覆盖条数
Long beforAddSize=null;
Long beforCoverSize=null;
for (int i = 0; i < fleetAreaInfos.size(); i++) {
FleetAreaInfo info = fleetAreaInfos.get(i);
try {
if (info == null) {// 有异常
continue;
} else {
beforAddSize = countMap.get("addSize");
beforCoverSize = countMap.get("coverSize");
this.addOrUpdateFleetAreaInfo(info, countMap);
}
} catch (Exception e) {
log.error("批量导入模版数据更新操作异常,业务需要仅作提示", e);
countMap.put("addSize", beforAddSize);
countMap.put("coverSize", beforCoverSize);
}
}
retuMap.put("addSize", countMap.get("addSize"));
retuMap.put("coverSize", countMap.get("coverSize"));
retuMap.put("sumSize", fleetAreaInfos.size());
retuMap.put("error", "");
return retuMap;
}
/**
*
* @Description: 新增或覆盖车队辖区信息数据
* @param pcbean
* @param countMap
* @author 文洁
* @date 2016年11月02日
*/
@Override
public void addOrUpdateFleetAreaInfo(FleetAreaInfo info,
Map<String, Long> countMap) throws Exception {
UserEntity user = (UserEntity) (UserContext.getCurrentUser());
long addSize= countMap.get("addSize").longValue();
long coverSize= countMap.get("coverSize").longValue();
//查询历史有效信息
FleetAreaInfo queryParam = new FleetAreaInfo();
queryParam.setAreaOperationUnitShortname(info.getAreaOperationUnitShortname());
queryParam.setActive(ItfConifgConstant.HAR_ACTIVE_YES);//只判断有效信息
List<FleetAreaInfo> infoList = this.queryFleetAreaInfo(queryParam, 0, 1);
if(infoList.size() > 0){//已存在 就直接更新
//更新数据
FleetAreaInfo updateParam = new FleetAreaInfo();
updateParam.setImportTime(new Date());
updateParam.setTheFleetShortName(info.getTheFleetShortName());
updateParam.setTheArea(info.getTheArea());
updateParam.setTheBusinessDepartment(info.getTheBusinessDepartment());
updateParam.setModifyTime(new Date());
updateParam.setModifyUserCode(user.getEmpCode().substring(2));
updateParam.setFleetAreaId(infoList.get(0).getFleetAreaId());
this.updateFleetAreaInfo(updateParam);
//覆盖+1
coverSize++;
}else{
//插入数据
info.setImportTime(new Date());
this.addFleetAreaInfo(info);
//新增+1
addSize++;
}
countMap.put("addSize", addSize);
countMap.put("coverSize", coverSize);
}
@Transactional
@Override
public void repealAllFleetArea() {
FleetAreaInfoMapper.repealAllFleetArea();
}
}
|
UTF-8
|
Java
| 8,934 |
java
|
FleetAreaManageService.java
|
Java
|
[
{
"context": "\n * ClassName: FleetAreaManageService \n * @author 文洁\n * @date 2016年8月18日\n * @version V1.0\n */\n@Service",
"end": 1146,
"score": 0.9533958435058594,
"start": 1144,
"tag": "NAME",
"value": "文洁"
},
{
"context": "\t * @param pcbean\n\t * @param countMap\n\t * @author 文洁\n\t * @date 2016年11月02日\n\t */\n\t@Override\n\tpublic voi",
"end": 6739,
"score": 0.9971017241477966,
"start": 6737,
"tag": "NAME",
"value": "文洁"
}
] | null |
[] |
package com.hoau.hoaureport.module.configreport.server.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.hoau.hbdp.framework.server.context.UserContext;
import com.hoau.hbdp.framework.shared.util.string.StringUtil;
import com.hoau.hoaureport.module.baseinfo.api.shared.domain.UserEntity;
import com.hoau.hoaureport.module.common.server.constants.ItfConifgConstant;
import com.hoau.hoaureport.module.configreport.server.dao.FleetAreaInfoMapper;
import com.hoau.hoaureport.module.configreport.server.service.IFleetAreaManageService;
import com.hoau.hoaureport.module.configreport.server.util.ExcelUtil;
import com.hoau.hoaureport.module.configreport.shared.domain.FleetAreaInfo;
import com.hoau.hoaureport.module.util.DateUtils;
/**
* 车队辖区管理服务实现类
* ClassName: FleetAreaManageService
* @author 文洁
* @date 2016年8月18日
* @version V1.0
*/
@Service
public class FleetAreaManageService implements IFleetAreaManageService{
private static final Logger log = LoggerFactory.getLogger(FleetAreaInfo.class);
@Resource
FleetAreaInfoMapper FleetAreaInfoMapper;
/**
* 查询车队辖区信息
*/
@Override
public List<FleetAreaInfo> queryFleetAreaInfo(FleetAreaInfo param,
int start, int limit) {
RowBounds rowBounds = new RowBounds(start,limit);
return FleetAreaInfoMapper.queryFleetAreaInfoByCondition(param, rowBounds);
}
/**
* 查询记录总数
*/
@Override
public Long queryFleetAreaCount(FleetAreaInfo param) {
return FleetAreaInfoMapper.queryFleetAreaCountByCondition(param);
}
/**
* 增加车队辖区
*/
@Transactional
@Override
public void addFleetAreaInfo(FleetAreaInfo record) {
UserEntity currUser = (UserEntity) UserContext.getCurrentUser();
//工号
String currUserCode = currUser.getEmpCode().substring(2);
record.setActive(ItfConifgConstant.HAR_ACTIVE_YES);
record.setEffectedTime(new Date());
record.setInvalidTime(DateUtils.strToDate("2999-1-1 00:00:00"));
record.setCreateTime(new Date());
record.setCreateUserCode(currUserCode);
record.setModifyTime(new Date());
record.setModifyUserCode(currUserCode);
FleetAreaInfoMapper.insertSelective(record);
}
/**
* 在原纪录上更新车队辖区信息
*/
@Transactional
@Override
public void updateFleetAreaInfo(FleetAreaInfo record) {
FleetAreaInfoMapper.updateByPrimaryKeySelective(record);
}
/**
* 原纪录作废,更新后的记录作为新数据插入
*/
@Transactional
@Override
public void repealAndAddFleetAreaInfo(FleetAreaInfo param) {
//原纪录作废,并取得修改者编号
String modifier = repealFleetAreaInfo(param);
//另外插入修改数据
param.setActive(ItfConifgConstant.HAR_ACTIVE_YES);
param.setEffectedTime(new Date());
param.setInvalidTime(DateUtils.strToDate("2999-1-1 00:00:00"));
param.setCreateTime(new Date());
param.setCreateUserCode(modifier);
param.setModifyTime(new Date());
param.setModifyUserCode(modifier);
addFleetAreaInfo(param);
}
/**
* 原记录作废,返回操作者编号
*/
@Override
public String repealFleetAreaInfo(FleetAreaInfo param) {
UserEntity currUser = (UserEntity) UserContext.getCurrentUser();
//工号
String currUserCode = currUser.getEmpCode().substring(2);
FleetAreaInfo oldInfo = new FleetAreaInfo();
oldInfo.setFleetAreaId(param.getFleetAreaId());
oldInfo.setActive(ItfConifgConstant.HAR_ACTIVE_NO);
oldInfo.setInvalidTime(new Date());
oldInfo.setModifyTime(new Date());
oldInfo.setModifyUserCode(currUserCode);
updateFleetAreaInfo(oldInfo);
return currUserCode;
}
/**
* 判断是否已存在
*/
@Override
public boolean isExist(FleetAreaInfo param) {
//设置判断为已存在的条件
FleetAreaInfo exitCondition = new FleetAreaInfo();
exitCondition.setAreaOperationUnitShortname(param.getAreaOperationUnitShortname());
//不考虑已作废记录
exitCondition.setActive(ItfConifgConstant.HAR_ACTIVE_YES);
List<FleetAreaInfo> fleetAreaInfos = this.queryFleetAreaInfo(exitCondition,0,10);
return fleetAreaInfos.size() > 0;
}
@Override
public Map<String, Object> bathImplFleetAreaInfo(String path)throws Exception {
//导入结果
Map<String,Object> retuMap =new HashMap<String, Object>();
//解析Excel
List<Map<String, String>> list = ExcelUtil.readToListByFile(path, 32, 2);
//把键值对 转换成 对象集合
List<FleetAreaInfo> fleetAreaInfos = new ArrayList<FleetAreaInfo>();
if(list.size() > 0){
Map<String, String> map = null;
for(int i = 0;i<list.size();i++){
map = list.get(i);
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(0+"")))){
retuMap.put("error", "第"+(++i)+"行,辖区作业单位简称不能为空!");
return retuMap;
}
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(3+"")))){
retuMap.put("error", "第"+(++i)+"行,所属事业部不能为空!");
return retuMap;
}
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(1+"")))){
retuMap.put("error", "第"+(++i)+"行,归属车队名称不能为空,为空项请用‘—’填充!");
return retuMap;
}
if(!StringUtil.isNotEmpty(StringUtil.trim(map.get(2+"")))){
retuMap.put("error", "第"+(++i)+"行,所属大区不能为空,为空项请用‘—’填充!");
return retuMap;
}
}
}
for (Map<String, String> map : list) {
FleetAreaInfo bean = new FleetAreaInfo();
try {
bean.setAreaOperationUnitShortname(StringUtil.trim(map.get(0+"")));
bean.setTheFleetShortName(StringUtil.trim(map.get(1+"")));
bean.setTheArea(StringUtil.trim(map.get(2+"")));
bean.setTheBusinessDepartment(StringUtil.trim(map.get(3+"")));
} catch (Exception e) {
bean = null;// 如果有异常就把pcbean设为null,这样每条信息都加进去了
log.error("批量导入模版数据异常,业务需要仅作提示", e);
} finally {
fleetAreaInfos.add(bean);
}
}
//设置增加条数,覆盖条数
Map<String, Long> countMap = new HashMap<String, Long>();
countMap.put("addSize", new Long(0));// 增加条数
countMap.put("coverSize", new Long(0));// 覆盖条数
Long beforAddSize=null;
Long beforCoverSize=null;
for (int i = 0; i < fleetAreaInfos.size(); i++) {
FleetAreaInfo info = fleetAreaInfos.get(i);
try {
if (info == null) {// 有异常
continue;
} else {
beforAddSize = countMap.get("addSize");
beforCoverSize = countMap.get("coverSize");
this.addOrUpdateFleetAreaInfo(info, countMap);
}
} catch (Exception e) {
log.error("批量导入模版数据更新操作异常,业务需要仅作提示", e);
countMap.put("addSize", beforAddSize);
countMap.put("coverSize", beforCoverSize);
}
}
retuMap.put("addSize", countMap.get("addSize"));
retuMap.put("coverSize", countMap.get("coverSize"));
retuMap.put("sumSize", fleetAreaInfos.size());
retuMap.put("error", "");
return retuMap;
}
/**
*
* @Description: 新增或覆盖车队辖区信息数据
* @param pcbean
* @param countMap
* @author 文洁
* @date 2016年11月02日
*/
@Override
public void addOrUpdateFleetAreaInfo(FleetAreaInfo info,
Map<String, Long> countMap) throws Exception {
UserEntity user = (UserEntity) (UserContext.getCurrentUser());
long addSize= countMap.get("addSize").longValue();
long coverSize= countMap.get("coverSize").longValue();
//查询历史有效信息
FleetAreaInfo queryParam = new FleetAreaInfo();
queryParam.setAreaOperationUnitShortname(info.getAreaOperationUnitShortname());
queryParam.setActive(ItfConifgConstant.HAR_ACTIVE_YES);//只判断有效信息
List<FleetAreaInfo> infoList = this.queryFleetAreaInfo(queryParam, 0, 1);
if(infoList.size() > 0){//已存在 就直接更新
//更新数据
FleetAreaInfo updateParam = new FleetAreaInfo();
updateParam.setImportTime(new Date());
updateParam.setTheFleetShortName(info.getTheFleetShortName());
updateParam.setTheArea(info.getTheArea());
updateParam.setTheBusinessDepartment(info.getTheBusinessDepartment());
updateParam.setModifyTime(new Date());
updateParam.setModifyUserCode(user.getEmpCode().substring(2));
updateParam.setFleetAreaId(infoList.get(0).getFleetAreaId());
this.updateFleetAreaInfo(updateParam);
//覆盖+1
coverSize++;
}else{
//插入数据
info.setImportTime(new Date());
this.addFleetAreaInfo(info);
//新增+1
addSize++;
}
countMap.put("addSize", addSize);
countMap.put("coverSize", coverSize);
}
@Transactional
@Override
public void repealAllFleetArea() {
FleetAreaInfoMapper.repealAllFleetArea();
}
}
| 8,934 | 0.732069 | 0.723316 | 268 | 29.694031 | 24.507912 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.220149 | false | false |
0
|
50ac11830a682e5980527636b7f93de2c986e95d
| 30,236,569,765,007 |
cfd7fa4cc57a4b2d7f9c3bb91ea9d7117f1e60ec
|
/promotion/src/main/java/jpa/domain/SpecilPrice.java
|
264ce1f2daf4beda27f2d3dfb083f89945a48b17
|
[] |
no_license
|
fcfc20050545/OOExapmle
|
https://github.com/fcfc20050545/OOExapmle
|
055082e3b2b59b52477d051ffefb700dadf58675
|
4f0f982e5193189cb0821d212eaad816972bf149
|
refs/heads/master
| 2020-11-24T22:11:52.021000 | 2019-12-02T02:11:38 | 2019-12-02T02:11:38 | 228,360,550 | 1 | 0 | null | true | 2019-12-16T10:23:45 | 2019-12-16T10:23:45 | 2019-12-02T02:11:37 | 2019-12-02T02:11:35 | 535 | 0 | 0 | 0 | null | false | false |
package jpa.domain;
/**
* @Author: xiongchengwei
* @Date: 2019/10/24 上午9:57
*/
public class SpecilPrice extends Promotion {
}
|
UTF-8
|
Java
| 134 |
java
|
SpecilPrice.java
|
Java
|
[
{
"context": "package jpa.domain;\n\n/**\n * @Author: xiongchengwei\n * @Date: 2019/10/24 上午9:57\n */\npublic class Spec",
"end": 50,
"score": 0.9959158301353455,
"start": 37,
"tag": "USERNAME",
"value": "xiongchengwei"
}
] | null |
[] |
package jpa.domain;
/**
* @Author: xiongchengwei
* @Date: 2019/10/24 上午9:57
*/
public class SpecilPrice extends Promotion {
}
| 134 | 0.692308 | 0.607692 | 8 | 15.25 | 15.039532 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false |
0
|
84b0486a254c98e540bc99839a1150795df84c44
| 11,862,699,740,496 |
03d98df8cb745f6a109c54335f0c02e9558e2ce7
|
/src/ds/problems/test/MirrorImage.java
|
c49c0392423f74781dcd4caa02e945dedc545c5b
|
[] |
no_license
|
kmadhusudhan/ds-problems
|
https://github.com/kmadhusudhan/ds-problems
|
ceb9f9b7aa11ea92d31634a74b28c8cc67549c28
|
765c63354918b313ebaff1b5b75ca669e5717147
|
refs/heads/master
| 2023-02-05T21:03:27.699000 | 2020-12-17T15:19:27 | 2020-12-17T15:19:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ds.problems.test;
import ds.problems.trees.TreeNode;
public class MirrorImage {
public static void main(String[] args) {
MirrorImage mirrorImage = new MirrorImage();
// mirrorImage.isMirror()
}
boolean isMirror(TreeNode t1,TreeNode t2) {
if(t1 == null && t2 == null) return true;
if(t1 == null || t2 == null) return false;
if(t1.val == t2.val
&& isMirror(t1.left,t2.right)
&& isMirror(t1.right ,t2.left)) {
return true;
}
return false;
}
}
|
UTF-8
|
Java
| 571 |
java
|
MirrorImage.java
|
Java
|
[] | null |
[] |
package ds.problems.test;
import ds.problems.trees.TreeNode;
public class MirrorImage {
public static void main(String[] args) {
MirrorImage mirrorImage = new MirrorImage();
// mirrorImage.isMirror()
}
boolean isMirror(TreeNode t1,TreeNode t2) {
if(t1 == null && t2 == null) return true;
if(t1 == null || t2 == null) return false;
if(t1.val == t2.val
&& isMirror(t1.left,t2.right)
&& isMirror(t1.right ,t2.left)) {
return true;
}
return false;
}
}
| 571 | 0.553415 | 0.532399 | 21 | 26.142857 | 18.858585 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
0
|
95c4b54ea08f05160486558fe9fac3a916d98566
| 7,919,919,703,002 |
fb5d6659b80176aaae1d450553137ef00415119f
|
/Leetcodeproject20200526/leetcode/src/cn/test/main.java
|
a463df5fb7ea7b809080516c983e39a4d01c6f6a
|
[] |
no_license
|
theoneofc/IdeaProjects
|
https://github.com/theoneofc/IdeaProjects
|
a8271ce11944d08400f5f3a96aaca68b6ef779cb
|
db0c7b571178c09c02dc2e220b07cf2f3467f5c4
|
refs/heads/master
| 2022-09-21T17:28:50.831000 | 2020-06-02T15:18:01 | 2020-06-02T15:18:01 | 268,253,319 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.test;
/**
* 测试是否不同package可以各拥有一个主类(main()方法)
* 结果是的
*/
import cn.test.Solution;
public class main {
public static void main(String[] args) {
String s = "LEETCODEISHIRING";
int numRows = 3;
// Solution1 sol = new Solution1();
// String result = sol.convert(s, numRows);
Solution sol = new Solution();
String result = sol.convert(s, numRows);
// sol.setUi("Hello!");
// System.out.println(sol.getUi());
System.out.println(result);
}
}
|
UTF-8
|
Java
| 571 |
java
|
main.java
|
Java
|
[] | null |
[] |
package cn.test;
/**
* 测试是否不同package可以各拥有一个主类(main()方法)
* 结果是的
*/
import cn.test.Solution;
public class main {
public static void main(String[] args) {
String s = "LEETCODEISHIRING";
int numRows = 3;
// Solution1 sol = new Solution1();
// String result = sol.convert(s, numRows);
Solution sol = new Solution();
String result = sol.convert(s, numRows);
// sol.setUi("Hello!");
// System.out.println(sol.getUi());
System.out.println(result);
}
}
| 571 | 0.588571 | 0.582857 | 21 | 24 | 17.281975 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.619048 | false | false |
0
|
c17ae54ea28b821042174af9b526fca80b4edc0f
| 21,930,103,037,736 |
0036b4976b3b6f6847fad2bcf1b2e295bcae1164
|
/app/src/main/java/com/ang/acb/bakeit/ui/widget/RecipeWidgetProvider.java
|
b110182ccf473122ef273353235ec41317e2c37e
|
[] |
no_license
|
angela-aciobanitei/andu-baking-recipes
|
https://github.com/angela-aciobanitei/andu-baking-recipes
|
37090a525f58419ec53c26bb24f3b2cfb101a789
|
db8b39dc5ecf1907fd66601488400d01fb77e2cb
|
refs/heads/master
| 2020-07-01T16:15:10.876000 | 2020-02-03T14:56:34 | 2020-02-03T14:56:34 | 201,221,662 | 1 | 1 | null | false | 2020-02-03T14:56:35 | 2019-08-08T09:08:55 | 2020-02-03T13:53:23 | 2020-02-03T14:56:34 | 13,837 | 0 | 0 | 0 |
Java
| false | false |
package com.ang.acb.bakeit.ui.widget;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.RemoteViews;
import com.ang.acb.bakeit.R;
import com.ang.acb.bakeit.ui.recipelist.MainActivity;
/**
* The AppWidgetProvider class implementation. Defines the basic methods that allow
* you to programmatically interact with the App Widget, based on broadcast events.
* Through it, you will receive broadcasts when the App Widget is updated, enabled,
* disabled and deleted.
*
* See: https://developer.android.com/guide/topics/appwidgets#AppWidgetProvider
*/
public class RecipeWidgetProvider extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them.
updateRecipeWidget(context, appWidgetManager, appWidgetIds);
}
public static void updateRecipeWidget(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
for (int appWidgetId : appWidgetIds) {
// Set up the intent that starts the RecipeRemoteViewsService,
// which will provide the views for this collection.
Intent intent = new Intent(context, RecipeRemoteViewsService.class);
// Add the app widget ID to the intent extras.
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
// Instantiate the RemoteViews object for the app widget layout.
RemoteViews remoteViews = new RemoteViews(
context.getPackageName(), R.layout.widget_recipe);
// Set widget title.
remoteViews.setTextViewText(R.id.widget_ingredients_list_title,
PreferencesUtils.getWidgetTitle(context));
// Set up the RemoteViews object to use a RemoteViews adapter. This
// adapter connects to a RemoteViewsService through the specified
// intent. This is how we populate the data.
remoteViews.setRemoteAdapter(R.id.widget_ingredients_list_items, intent);
// Set the empty view which is displayed when the collection has no items.
// It should be a sibling of the collection view.
remoteViews.setEmptyView(R.id.widget_ingredients_list_items, R.id.empty_view);
// Create an pending intent to launch MainActivity.
PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId,
new Intent(context, MainActivity.class), 0);
// When using collections (ListView, StackView etc.) in widgets,
// it is very costly to set PendingIntents on the individual items,
// and is hence not permitted. Instead this method should be used
// to set a single PendingIntent template on the collection, and
// individual items can differentiate their on-click behavior using
// RemoteViews#setOnClickFillInIntent(int, Intent).
// See: https://developer.android.com/guide/topics/appwidgets#setting-up-the-pending-intent-template
remoteViews.setPendingIntentTemplate(
R.id.widget_ingredients_list_items, pendingIntent);
// Equivalent of calling View.setOnClickListener(android.view.View.OnClickListener)
// to launch the provided RemoteResponse.
remoteViews.setOnClickPendingIntent(
R.id.widget_recipe_container, pendingIntent);
// Tell the AppWidgetManager to perform an update on the current app widget.
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}
}
@Override
public void onEnabled(Context context) {
// Enter relevant functionality for when the first widget is created.
}
@Override
public void onDisabled(Context context) {
// Enter relevant functionality for when the last widget is disabled.
}
}
|
UTF-8
|
Java
| 4,271 |
java
|
RecipeWidgetProvider.java
|
Java
|
[] | null |
[] |
package com.ang.acb.bakeit.ui.widget;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.RemoteViews;
import com.ang.acb.bakeit.R;
import com.ang.acb.bakeit.ui.recipelist.MainActivity;
/**
* The AppWidgetProvider class implementation. Defines the basic methods that allow
* you to programmatically interact with the App Widget, based on broadcast events.
* Through it, you will receive broadcasts when the App Widget is updated, enabled,
* disabled and deleted.
*
* See: https://developer.android.com/guide/topics/appwidgets#AppWidgetProvider
*/
public class RecipeWidgetProvider extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them.
updateRecipeWidget(context, appWidgetManager, appWidgetIds);
}
public static void updateRecipeWidget(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
for (int appWidgetId : appWidgetIds) {
// Set up the intent that starts the RecipeRemoteViewsService,
// which will provide the views for this collection.
Intent intent = new Intent(context, RecipeRemoteViewsService.class);
// Add the app widget ID to the intent extras.
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
// Instantiate the RemoteViews object for the app widget layout.
RemoteViews remoteViews = new RemoteViews(
context.getPackageName(), R.layout.widget_recipe);
// Set widget title.
remoteViews.setTextViewText(R.id.widget_ingredients_list_title,
PreferencesUtils.getWidgetTitle(context));
// Set up the RemoteViews object to use a RemoteViews adapter. This
// adapter connects to a RemoteViewsService through the specified
// intent. This is how we populate the data.
remoteViews.setRemoteAdapter(R.id.widget_ingredients_list_items, intent);
// Set the empty view which is displayed when the collection has no items.
// It should be a sibling of the collection view.
remoteViews.setEmptyView(R.id.widget_ingredients_list_items, R.id.empty_view);
// Create an pending intent to launch MainActivity.
PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId,
new Intent(context, MainActivity.class), 0);
// When using collections (ListView, StackView etc.) in widgets,
// it is very costly to set PendingIntents on the individual items,
// and is hence not permitted. Instead this method should be used
// to set a single PendingIntent template on the collection, and
// individual items can differentiate their on-click behavior using
// RemoteViews#setOnClickFillInIntent(int, Intent).
// See: https://developer.android.com/guide/topics/appwidgets#setting-up-the-pending-intent-template
remoteViews.setPendingIntentTemplate(
R.id.widget_ingredients_list_items, pendingIntent);
// Equivalent of calling View.setOnClickListener(android.view.View.OnClickListener)
// to launch the provided RemoteResponse.
remoteViews.setOnClickPendingIntent(
R.id.widget_recipe_container, pendingIntent);
// Tell the AppWidgetManager to perform an update on the current app widget.
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}
}
@Override
public void onEnabled(Context context) {
// Enter relevant functionality for when the first widget is created.
}
@Override
public void onDisabled(Context context) {
// Enter relevant functionality for when the last widget is disabled.
}
}
| 4,271 | 0.68649 | 0.686256 | 91 | 45.934067 | 33.395336 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
0
|
6d9a4e136c5a364205983387836041fab0baa3d2
| 22,548,578,310,685 |
61b0d31b5369f0a05ebf4e44cc61a4ed76facd56
|
/src/main/java/main/Storage.java
|
18647883a7a40f94cea3639ea571cf22a7fa7cb4
|
[] |
no_license
|
flutman/ToDoList
|
https://github.com/flutman/ToDoList
|
8ff2bd6f9d757c501568d4a66814853832ed020c
|
29550e49b7e75318f67a6e0e451555c6fa3cd810
|
refs/heads/master
| 2022-12-26T10:31:30.589000 | 2020-10-13T17:09:40 | 2020-10-13T17:09:40 | 303,509,400 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main;
import main.model.Action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
public class Storage {
private static AtomicInteger currentId = new AtomicInteger();
private static Map<Integer, Action> actions = new ConcurrentHashMap<Integer, Action>();
public Storage() {
}
public static List<Action> getAllActions() {
ArrayList<Action> actionsList = new ArrayList<>();
actionsList.addAll(actions.values());
return actionsList;
}
public static int addAction(Action action) {
int id = currentId.incrementAndGet();
action.setId(id);
actions.put(id, action);
return id;
}
public static Action getAction(int actionId) {
if (actions.containsKey(actionId)) {
return actions.get(actionId);
}
return null;
}
public static void removeAction(int actionId) {
actions.remove(actionId);
}
public static void updateAction(Action action) {
actions.put(action.getId(), action);
}
}
|
UTF-8
|
Java
| 1,175 |
java
|
Storage.java
|
Java
|
[] | null |
[] |
package main;
import main.model.Action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
public class Storage {
private static AtomicInteger currentId = new AtomicInteger();
private static Map<Integer, Action> actions = new ConcurrentHashMap<Integer, Action>();
public Storage() {
}
public static List<Action> getAllActions() {
ArrayList<Action> actionsList = new ArrayList<>();
actionsList.addAll(actions.values());
return actionsList;
}
public static int addAction(Action action) {
int id = currentId.incrementAndGet();
action.setId(id);
actions.put(id, action);
return id;
}
public static Action getAction(int actionId) {
if (actions.containsKey(actionId)) {
return actions.get(actionId);
}
return null;
}
public static void removeAction(int actionId) {
actions.remove(actionId);
}
public static void updateAction(Action action) {
actions.put(action.getId(), action);
}
}
| 1,175 | 0.660426 | 0.660426 | 47 | 24 | 22.382553 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.510638 | false | false |
0
|
418bdf743773fe58fe9f0ac270832da80bb88362
| 30,236,569,769,511 |
fe208964e596702c6a1bc2854627ab9ae25eb47f
|
/src/main/java/drunkmafia/thaumicinfusion/common/container/InfusionContainer.java
|
0cee9330e7c0248d86f95ddbbb4cad2bc4b6d7fd
|
[] |
no_license
|
immortalcatz/ThaumicInfusion
|
https://github.com/immortalcatz/ThaumicInfusion
|
ddd430e983218231c66c3d31a2b0c568057164ca
|
d3a7d7fbc4fbeae31a2d9954617fbf232dd45259
|
refs/heads/master
| 2020-03-12T18:31:36.796000 | 2017-08-02T11:02:33 | 2017-08-02T11:02:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package drunkmafia.thaumicinfusion.common.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
public class InfusionContainer extends Container {
public InfusionContainer(InventoryPlayer inventoryPlayer) {
for (int y = 0; y < 3; ++y) {
for (int x = 0; x < 9; ++x) {
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 14 + x * 18, 145 + y * 18));
}
}
for (int x = 0; x < 9; ++x) {
addSlotToContainer(new Slot(inventoryPlayer, x, 14 + x * 18, 203));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
}
|
UTF-8
|
Java
| 798 |
java
|
InfusionContainer.java
|
Java
|
[
{
"context": "package drunkmafia.thaumicinfusion.common.container;\n\nimport net.min",
"end": 18,
"score": 0.9984521269798279,
"start": 8,
"tag": "USERNAME",
"value": "drunkmafia"
}
] | null |
[] |
package drunkmafia.thaumicinfusion.common.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
public class InfusionContainer extends Container {
public InfusionContainer(InventoryPlayer inventoryPlayer) {
for (int y = 0; y < 3; ++y) {
for (int x = 0; x < 9; ++x) {
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 14 + x * 18, 145 + y * 18));
}
}
for (int x = 0; x < 9; ++x) {
addSlotToContainer(new Slot(inventoryPlayer, x, 14 + x * 18, 203));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
}
| 798 | 0.625313 | 0.595238 | 27 | 28.555555 | 27.698553 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.740741 | false | false |
0
|
ebc4b7c6edbfcd06a4cc86346c72bc872efee64b
| 26,740,466,443,841 |
62f62a10180562d1948da75ba1afb6c4608c3b2f
|
/src/com/johnstonconsulting/ciscoruletool/xml/RuleSaver.java
|
55cbb265d1dc75d724768a052aeee951512f1652
|
[
"MIT"
] |
permissive
|
ajohnston9/ciscorule
|
https://github.com/ajohnston9/ciscorule
|
a35bb31fe8242ca4516fad1000dfb3e52e917d77
|
5863f91cef5e5425260ae2dc9e195122808112d0
|
refs/heads/master
| 2020-05-16T22:32:52.592000 | 2014-12-17T03:09:00 | 2014-12-17T03:09:00 | 21,920,834 | 17 | 1 | 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 com.johnstonconsulting.ciscoruletool.xml;
import com.johnstonconsulting.ciscoruletool.utils.Rule;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import nu.xom.Document;
import nu.xom.Element;
/**
*
* @author andrew
*/
public class RuleSaver {
private String mName;
private String mDesc;
private String mSeverity;
private ArrayList<Rule> mRules;
public RuleSaver(String name, String desc, String severity, ArrayList<Rule> rules) {
mName = name;
mDesc = desc;
mSeverity = severity;
mRules = rules;
}
public void saveToXML() throws IOException {
Element root = new Element("RuleDefinition");
Element name = new Element("Name");
name.appendChild(mName);
root.appendChild(name);
Element desc = new Element("Description");
desc.appendChild(mDesc);
root.appendChild(desc);
Element severity = new Element("Severity");
severity.appendChild(mSeverity);
root.appendChild(severity);
Element rules = new Element("Rules");
for (Rule r : mRules) {
Element rule = new Element("Rule");
Element setting = new Element("Parameter");
setting.appendChild(r.getParam());
rule.appendChild(setting);
Element param = new Element("Argument");
param.appendChild(r.getArg());
rule.appendChild(param);
rules.appendChild(rule);
}
root.appendChild(rules);
Document doc = new Document(root);
String docName = getDocName(mName);
FileWriter f = new FileWriter(docName);
PrintWriter p = new PrintWriter(f);
p.write(doc.toXML());
p.flush();
p.close();
}
private String getDocName(String name) {
String doc = name.toLowerCase().replace(" ", "-");
return doc + ".xml";
}
}
|
UTF-8
|
Java
| 2,272 |
java
|
RuleSaver.java
|
Java
|
[
{
"context": "ocument;\nimport nu.xom.Element;\n\n/**\n *\n * @author andrew\n */\npublic class RuleSaver {\n \n private Str",
"end": 497,
"score": 0.9341995716094971,
"start": 491,
"tag": "USERNAME",
"value": "andrew"
}
] | 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 com.johnstonconsulting.ciscoruletool.xml;
import com.johnstonconsulting.ciscoruletool.utils.Rule;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import nu.xom.Document;
import nu.xom.Element;
/**
*
* @author andrew
*/
public class RuleSaver {
private String mName;
private String mDesc;
private String mSeverity;
private ArrayList<Rule> mRules;
public RuleSaver(String name, String desc, String severity, ArrayList<Rule> rules) {
mName = name;
mDesc = desc;
mSeverity = severity;
mRules = rules;
}
public void saveToXML() throws IOException {
Element root = new Element("RuleDefinition");
Element name = new Element("Name");
name.appendChild(mName);
root.appendChild(name);
Element desc = new Element("Description");
desc.appendChild(mDesc);
root.appendChild(desc);
Element severity = new Element("Severity");
severity.appendChild(mSeverity);
root.appendChild(severity);
Element rules = new Element("Rules");
for (Rule r : mRules) {
Element rule = new Element("Rule");
Element setting = new Element("Parameter");
setting.appendChild(r.getParam());
rule.appendChild(setting);
Element param = new Element("Argument");
param.appendChild(r.getArg());
rule.appendChild(param);
rules.appendChild(rule);
}
root.appendChild(rules);
Document doc = new Document(root);
String docName = getDocName(mName);
FileWriter f = new FileWriter(docName);
PrintWriter p = new PrintWriter(f);
p.write(doc.toXML());
p.flush();
p.close();
}
private String getDocName(String name) {
String doc = name.toLowerCase().replace(" ", "-");
return doc + ".xml";
}
}
| 2,272 | 0.602113 | 0.602113 | 80 | 27.4 | 19.313597 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6625 | false | false |
0
|
5dd4caac988dae879a7b4a75fb1a860ce981cd06
| 33,483,565,071,649 |
38a312e26f56684162f5fa329a1e258d48a15b49
|
/src/command/Find.java
|
5ad1d58d4250c5049811670336fc2e82308572a4
|
[] |
no_license
|
Li-turtle/JShell
|
https://github.com/Li-turtle/JShell
|
ec1cf41acebb58bdc6f76d1007017f087a41d8c7
|
a2118771fb9cf506d8de2ba8ead0d73df16acb7e
|
refs/heads/main
| 2023-01-13T22:49:48.594000 | 2020-11-18T02:51:19 | 2020-11-18T02:51:19 | 313,803,848 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package command;
import exception.ArityMismatchException;
import exception.InvalidFormatException;
import fs.FileSystem;
import java.io.Serializable;
import util.ArgParser;
import util.IO;
import java.util.Set;
/**
* The class implement the function of command Find.
*
* @author Sihao Chen sihao.chen@mail.utoronto.ca
*/
public class Find implements Command, Serializable {
private FileSystem fs;
private String doc
= "NAME\n"
+ " find - search for files in a directory hierarchy\n\n"
+ "SYNOPSIS\n"
+ " find PATH ... -type [f|d] -name STRING\n\n"
+ "DESCRIPTION\n"
+ " Find files or directories under PATH(s) with the given name\n"
+ " STRING with a given option type for choosing regular files\n"
+ " or directories.\n";
private String erroMsg = "cannot find";
/**
* Init Find class with JShell's fileSystem.
*
* @param fs JShell's fileSystem
*/
public Find(FileSystem fs) {
this.fs = fs;
}
/**
* Get documentation of command find.
*
* @return the documentation
*/
@Override
public String getDoc() {
return doc;
}
private static String getName(String fullPath) {
// Assume the pathname is valid
String[] nameList = fullPath.split("/");
return nameList[nameList.length - 1];
}
private void checkArguments(String[] args) throws Exception {
int len = args.length;
if (len < 6) {
// Exception of invalid number of arguments
throw new ArityMismatchException(erroMsg);
}
if (!args[len - 4].equals("-type") || !args[len - 2].equals("-name")) {
// Exception of invalid argument format
throw new InvalidFormatException(erroMsg);
}
if (!ArgParser.isString(args[len - 1])) {
// Exception of name not a string
throw new InvalidFormatException(erroMsg);
}
if (!args[len - 3].equals("f") && !args[len - 3].equals("d")) {
// Exception of not valid type
throw new InvalidFormatException(erroMsg);
}
}
/**
* Execute find command.
*
* @param args Arguments that passed to the command
* @param io JShell's io
* @throws Exception if arguments are not valid
*/
@Override
public void exec(String[] args, IO io) throws Exception {
int len = args.length;
checkArguments(args);
String name = ArgParser.getContent(args[len - 1]);
for (int i = 1; i < len - 4; i++) {
try {
Set<String> files = fs.getDirectoryContentFullPath(args[i]);
for (String file : files) {
if (fs.isDirectory(file)) {
// Call exec() recursively
String[] subArgs = {"find", file, args[len - 4],
args[len - 3], args[len - 2], args[len - 1]};
exec(subArgs, io);
if (args[len - 3].equals("d") && getName(file).equals(name)) {
io.printLine(file);
}
} else if (fs.isRegularFile(file)
&& args[len - 3].equals("f") && getName(file).equals(name)) {
io.printLine(file);
}
}
} catch (Exception e) {
io.setErr();
io.printLine(args[i] + " is not a valid directory");
}
}
}
}
|
UTF-8
|
Java
| 3,200 |
java
|
Find.java
|
Java
|
[
{
"context": "lement the function of command Find.\n *\n * @author Sihao Chen sihao.chen@mail.utoronto.ca\n */\npublic class Find",
"end": 294,
"score": 0.9990537166595459,
"start": 284,
"tag": "NAME",
"value": "Sihao Chen"
},
{
"context": "function of command Find.\n *\n * @author Sihao Chen sihao.chen@mail.utoronto.ca\n */\npublic class Find implements Command, Seriali",
"end": 322,
"score": 0.9999313354492188,
"start": 295,
"tag": "EMAIL",
"value": "sihao.chen@mail.utoronto.ca"
}
] | null |
[] |
package command;
import exception.ArityMismatchException;
import exception.InvalidFormatException;
import fs.FileSystem;
import java.io.Serializable;
import util.ArgParser;
import util.IO;
import java.util.Set;
/**
* The class implement the function of command Find.
*
* @author <NAME> <EMAIL>
*/
public class Find implements Command, Serializable {
private FileSystem fs;
private String doc
= "NAME\n"
+ " find - search for files in a directory hierarchy\n\n"
+ "SYNOPSIS\n"
+ " find PATH ... -type [f|d] -name STRING\n\n"
+ "DESCRIPTION\n"
+ " Find files or directories under PATH(s) with the given name\n"
+ " STRING with a given option type for choosing regular files\n"
+ " or directories.\n";
private String erroMsg = "cannot find";
/**
* Init Find class with JShell's fileSystem.
*
* @param fs JShell's fileSystem
*/
public Find(FileSystem fs) {
this.fs = fs;
}
/**
* Get documentation of command find.
*
* @return the documentation
*/
@Override
public String getDoc() {
return doc;
}
private static String getName(String fullPath) {
// Assume the pathname is valid
String[] nameList = fullPath.split("/");
return nameList[nameList.length - 1];
}
private void checkArguments(String[] args) throws Exception {
int len = args.length;
if (len < 6) {
// Exception of invalid number of arguments
throw new ArityMismatchException(erroMsg);
}
if (!args[len - 4].equals("-type") || !args[len - 2].equals("-name")) {
// Exception of invalid argument format
throw new InvalidFormatException(erroMsg);
}
if (!ArgParser.isString(args[len - 1])) {
// Exception of name not a string
throw new InvalidFormatException(erroMsg);
}
if (!args[len - 3].equals("f") && !args[len - 3].equals("d")) {
// Exception of not valid type
throw new InvalidFormatException(erroMsg);
}
}
/**
* Execute find command.
*
* @param args Arguments that passed to the command
* @param io JShell's io
* @throws Exception if arguments are not valid
*/
@Override
public void exec(String[] args, IO io) throws Exception {
int len = args.length;
checkArguments(args);
String name = ArgParser.getContent(args[len - 1]);
for (int i = 1; i < len - 4; i++) {
try {
Set<String> files = fs.getDirectoryContentFullPath(args[i]);
for (String file : files) {
if (fs.isDirectory(file)) {
// Call exec() recursively
String[] subArgs = {"find", file, args[len - 4],
args[len - 3], args[len - 2], args[len - 1]};
exec(subArgs, io);
if (args[len - 3].equals("d") && getName(file).equals(name)) {
io.printLine(file);
}
} else if (fs.isRegularFile(file)
&& args[len - 3].equals("f") && getName(file).equals(name)) {
io.printLine(file);
}
}
} catch (Exception e) {
io.setErr();
io.printLine(args[i] + " is not a valid directory");
}
}
}
}
| 3,176 | 0.595625 | 0.590625 | 119 | 25.890757 | 22.421024 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.361345 | false | false |
0
|
f483253f8bfca972c67ec0cd00be5f458b4361aa
| 6,932,077,219,239 |
072a24cee3514c6b0d96d9d382eb54d61a5264e1
|
/src/com/amitumisee/myMdclActivity.java
|
1319f8c9eef92b31fc8d3b912e1af138ccb4610d
|
[] |
no_license
|
Mahabub-Alam-Salehi/Android_Application_name_of_DoctorBondhu
|
https://github.com/Mahabub-Alam-Salehi/Android_Application_name_of_DoctorBondhu
|
a98a111bbfb2ffaf7267113d491253fd6421fe4c
|
8e0d5acff3c6b7b96c99f2e6a06c71e665fbcb86
|
refs/heads/master
| 2020-03-11T21:14:28.997000 | 2018-04-19T18:58:00 | 2018-04-19T18:58:00 | 130,259,689 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.amitumisee;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class myMdclActivity extends Activity implements View.OnClickListener {
Button bt1,btn2;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mdcl_two_btn);
bt1=(Button) findViewById(R.id.button1);
btn2=(Button) findViewById(R.id.button2);
Typeface tf = Typeface.createFromAsset(getAssets(),"font/Banglafont.ttf");
bt1 = (Button)findViewById(R.id.button1);
bt1.setTypeface(tf);
bt1.setText("মানচিত্র ");
btn2 = (Button)findViewById(R.id.button2);
btn2.setTypeface(tf);
btn2.setText("অবস্থান");
bt1.setOnClickListener(this);
bt1.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId()) {
case R.id.button1:
Intent openstartingpoint1=new Intent(getApplicationContext(), map_layout.class);
startActivity(openstartingpoint1);
break;
case R.id.button2:
break;
}
}
}
|
UTF-8
|
Java
| 1,342 |
java
|
myMdclActivity.java
|
Java
|
[] | null |
[] |
package com.amitumisee;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class myMdclActivity extends Activity implements View.OnClickListener {
Button bt1,btn2;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mdcl_two_btn);
bt1=(Button) findViewById(R.id.button1);
btn2=(Button) findViewById(R.id.button2);
Typeface tf = Typeface.createFromAsset(getAssets(),"font/Banglafont.ttf");
bt1 = (Button)findViewById(R.id.button1);
bt1.setTypeface(tf);
bt1.setText("মানচিত্র ");
btn2 = (Button)findViewById(R.id.button2);
btn2.setTypeface(tf);
btn2.setText("অবস্থান");
bt1.setOnClickListener(this);
bt1.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId()) {
case R.id.button1:
Intent openstartingpoint1=new Intent(getApplicationContext(), map_layout.class);
startActivity(openstartingpoint1);
break;
case R.id.button2:
break;
}
}
}
| 1,342 | 0.686738 | 0.669969 | 55 | 22.854546 | 20.695559 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.618182 | false | false |
0
|
fc309ad4a4e9e6f37280a46b6195246bb75b1bbc
| 1,279,900,287,209 |
02bb88a734cb6891757d03cb1f46ddf868377f3d
|
/HostelWorld/src/hostel_world/action/LoginAction.java
|
59239718ad0409dacb613a3a23ad17c3a15c1d97
|
[] |
no_license
|
EEEEEEEEEEEEEEEEEEEIEEEEEEEEEEEEEEEEEE/J2EE
|
https://github.com/EEEEEEEEEEEEEEEEEEEIEEEEEEEEEEEEEEEEEE/J2EE
|
9fb761d9521c39fd9e1e694b87797bed5ffe098d
|
b8cc0b2fa348a2e1991b2686ec0f4549bf6ce3af
|
refs/heads/master
| 2020-06-12T06:26:02.785000 | 2017-03-19T14:42:48 | 2017-03-19T14:42:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hostel_world.action;
import java.util.Map;
import hostel_world.model.Hostel;
import hostel_world.model.HostelAccount;
import hostel_world.model.list.HostelList;
import hostel_world.service.*;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import hostel_world.model.Account;
import hostel_world.model.list.FilmList;
import hostel_world.model.User;
import com.opensymphony.xwork2.Action;
@Repository
public class LoginAction implements Action,SessionAware{
@Autowired
private UserService userService;
@Autowired
private PlanService planServiceBean;
@Autowired
private AccountService accountServiceBean;
@Autowired
private HostelService hostelService;
@Autowired
private HostelAccountService hostelAccountServiceBean;
private Map<String,Object> sessionMap;
private int identity;
private String name;
private String password;
private int sub;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
/**
* 登录成功
* 登录失败
*/
public String execute() throws Exception {
if(sub==0){
return "register";
}
if(sub==2){
return "hostelregister";
}
if(identity==1) {
User user = userService.login(name, password);
if (user == null) {
return "failure";
}
sessionMap.put("user", user);
Account account = accountServiceBean.getAccount(user.getId());
sessionMap.put("account", account);
boolean boo = accountServiceBean.isValid(user.getId());
if (!boo) {
return "invalid";
}
HostelList hostelList = new HostelList();
hostelList.setHostelList(hostelService.getPassedHostelPlan());
sessionMap.put("hostelList", hostelList);
FilmList filmList = new FilmList();
filmList.setFilmList(planServiceBean.getFilmList());
sessionMap.put("filmList", filmList);
return "success";
} else{
Hostel hostel = hostelService.login(name,password);
if (hostel == null) {
return "failure";
}
sessionMap.put("hostel", hostel);
HostelAccount account = hostelAccountServiceBean.getHostelAccount(hostel.getId());
sessionMap.put("hostelaccount", account);
return "hostel";
}
}
// public String test(){
// int a = 0;
// if(a == 0){
// return "fail";
// }
// else{
// return SUCCESS;
// }
// }
public void setSession(Map<String, Object> arg0) {
this.sessionMap=arg0;
}
public int getSub() {
return sub;
}
public void setSub(int sub) {
this.sub = sub;
}
public int getIdentity() {
return identity;
}
public void setIdentity(int identity) {
this.identity = identity;
}
}
|
UTF-8
|
Java
| 2,831 |
java
|
LoginAction.java
|
Java
|
[] | null |
[] |
package hostel_world.action;
import java.util.Map;
import hostel_world.model.Hostel;
import hostel_world.model.HostelAccount;
import hostel_world.model.list.HostelList;
import hostel_world.service.*;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import hostel_world.model.Account;
import hostel_world.model.list.FilmList;
import hostel_world.model.User;
import com.opensymphony.xwork2.Action;
@Repository
public class LoginAction implements Action,SessionAware{
@Autowired
private UserService userService;
@Autowired
private PlanService planServiceBean;
@Autowired
private AccountService accountServiceBean;
@Autowired
private HostelService hostelService;
@Autowired
private HostelAccountService hostelAccountServiceBean;
private Map<String,Object> sessionMap;
private int identity;
private String name;
private String password;
private int sub;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
/**
* 登录成功
* 登录失败
*/
public String execute() throws Exception {
if(sub==0){
return "register";
}
if(sub==2){
return "hostelregister";
}
if(identity==1) {
User user = userService.login(name, password);
if (user == null) {
return "failure";
}
sessionMap.put("user", user);
Account account = accountServiceBean.getAccount(user.getId());
sessionMap.put("account", account);
boolean boo = accountServiceBean.isValid(user.getId());
if (!boo) {
return "invalid";
}
HostelList hostelList = new HostelList();
hostelList.setHostelList(hostelService.getPassedHostelPlan());
sessionMap.put("hostelList", hostelList);
FilmList filmList = new FilmList();
filmList.setFilmList(planServiceBean.getFilmList());
sessionMap.put("filmList", filmList);
return "success";
} else{
Hostel hostel = hostelService.login(name,password);
if (hostel == null) {
return "failure";
}
sessionMap.put("hostel", hostel);
HostelAccount account = hostelAccountServiceBean.getHostelAccount(hostel.getId());
sessionMap.put("hostelaccount", account);
return "hostel";
}
}
// public String test(){
// int a = 0;
// if(a == 0){
// return "fail";
// }
// else{
// return SUCCESS;
// }
// }
public void setSession(Map<String, Object> arg0) {
this.sessionMap=arg0;
}
public int getSub() {
return sub;
}
public void setSub(int sub) {
this.sub = sub;
}
public int getIdentity() {
return identity;
}
public void setIdentity(int identity) {
this.identity = identity;
}
}
| 2,831 | 0.709769 | 0.706572 | 142 | 18.823944 | 18.790655 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.774648 | false | false |
0
|
6435a4a43995d63147290050567fa15c16b8f72b
| 12,489,764,954,871 |
40f9d63dc9bf5d11ebc8f893aad5349304da86d6
|
/OWLTools-Core/src/test/java/owltools/graph/OWLGraphShuntTest.java
|
c3a386f8c52d050755780702dbbf530e65e3fb10
|
[] |
no_license
|
markwilkinson/obo-owltools
|
https://github.com/markwilkinson/obo-owltools
|
faa6c6fe03b35cc1d99194b1ee8397f3ddbb63c4
|
e6d39949f17366091407ecee237e4cf992566127
|
refs/heads/master
| 2020-04-01T13:40:09.200000 | 2012-10-19T00:53:22 | 2012-10-19T00:53:22 | 19,771,293 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package owltools.graph;
import static junit.framework.Assert.*;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import owltools.OWLToolsTestBasics;
import owltools.graph.OWLGraphWrapper.ISynonym;
import owltools.graph.shunt.OWLShuntEdge;
import owltools.graph.shunt.OWLShuntGraph;
import owltools.graph.shunt.OWLShuntNode;
public class OWLGraphShuntTest extends OWLToolsTestBasics {
private static Logger LOG = Logger.getLogger(OWLGraphWrapper.class);
/*
* Testing the getSegmentShuntGraph and getSegmentShuntGraphJSON functions.
*/
@Test
public void testLineageShuntGraph() throws Exception{
OWLGraphWrapper wrapper = getOntologyWrapper("go.owl");
OWLObject c = wrapper.getOWLClass(OWLGraphWrapper.DEFAULT_IRI_PREFIX + "GO_0022008");
// Exists.
OWLShuntGraph g = wrapper.getLineageShuntGraph(c);
assertNotNull("have a shunt graph, not a complete failure apparently", g);
// Now let's go through and exhaust this subgraph...nodes.
assertEquals("node count okay", 11, g.nodes.size()); // remember: 10 above, self, 5 below
assertEquals("n01", g.hasNode(new OWLShuntNode("GO:0008150")), true);
assertEquals("n02", g.hasNode(new OWLShuntNode("GO:0032502")), true);
assertEquals("n03", g.hasNode(new OWLShuntNode("GO:0032501")), true);
assertEquals("n04", g.hasNode(new OWLShuntNode("GO:0048856")), true);
assertEquals("n05", g.hasNode(new OWLShuntNode("GO:0009987")), true);
assertEquals("n06", g.hasNode(new OWLShuntNode("GO:0007275")), true);
assertEquals("n07", g.hasNode(new OWLShuntNode("GO:0048869")), true);
assertEquals("n08", g.hasNode(new OWLShuntNode("GO:0048731")), true);
assertEquals("n09", g.hasNode(new OWLShuntNode("GO:0030154")), true);
assertEquals("n10", g.hasNode(new OWLShuntNode("GO:0007399")), true);
assertEquals("n11", g.hasNode(new OWLShuntNode("GO:0022008")), true);
// Now let's go through and exhaust this subgraph...part_of edges.
assertEquals("e01", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0008150", "part_of")), true);
assertEquals("e02", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0032502", "part_of")), true);
assertEquals("e03", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0032501", "part_of")), true);
assertEquals("e04", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0048856", "part_of")), true);
assertEquals("e05", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0007275", "part_of")), true);
assertEquals("e06", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0048731", "part_of")), true);
assertEquals("e17", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0007399", "part_of")), true);
// Now let's go through and exhaust this subgraph...is_a edges.
assertEquals("e08", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0008150", "is_a")), true);
assertEquals("e09", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0032502", "is_a")), true);
assertEquals("e10", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0009987", "is_a")), true);
assertEquals("e11", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0048869", "is_a")), true);
assertEquals("e12", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0030154", "is_a")), true);
//LOG.info("lineage: " + wrapper.getLineageShuntGraphJSON(c));
// Total on edges.
assertEquals("edge count okay", 12, g.edges.size());
}
/*
* Testing the getSegmentShuntGraph and getSegmentShuntGraphJSON functions.
*/
@Test
public void testSegmentShuntGraph() throws Exception{
OWLGraphWrapper wrapper = getOntologyWrapper("go.owl");
OWLObject c = wrapper.getOWLClass(OWLGraphWrapper.DEFAULT_IRI_PREFIX + "GO_0022008");
// Exists.
OWLShuntGraph g = wrapper.getSegmentShuntGraph(c);
assertNotNull("have a shunt graph, not a complete failure apparently", g);
// Now let's go through and exhaust this subgraph...nodes.
assertEquals("node count okay", g.nodes.size(), 16); // remember: 10 above, self, 5 below
assertEquals("n01", g.hasNode(new OWLShuntNode("GO:0008150")), true);
assertEquals("n02", g.hasNode(new OWLShuntNode("GO:0032502")), true);
assertEquals("n03", g.hasNode(new OWLShuntNode("GO:0032501")), true);
assertEquals("n04", g.hasNode(new OWLShuntNode("GO:0048856")), true);
assertEquals("n05", g.hasNode(new OWLShuntNode("GO:0009987")), true);
assertEquals("n06", g.hasNode(new OWLShuntNode("GO:0007275")), true);
assertEquals("n07", g.hasNode(new OWLShuntNode("GO:0048869")), true);
assertEquals("n08", g.hasNode(new OWLShuntNode("GO:0048731")), true);
assertEquals("n09", g.hasNode(new OWLShuntNode("GO:0030154")), true);
assertEquals("n10", g.hasNode(new OWLShuntNode("GO:0007399")), true);
assertEquals("n11", g.hasNode(new OWLShuntNode("GO:0022008")), true);
assertEquals("n12", g.hasNode(new OWLShuntNode("GO:0048699")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0042063")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0050768")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0050769")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0050767")), true);
// Now let's go through and exhaust this subgraph...edges.
assertEquals("edge count okay", g.edges.size(), 19);
assertEquals("e-05", g.hasEdge(new OWLShuntEdge("GO:0050767", "GO:0022008", "regulates")), true);
assertEquals("e-04", g.hasEdge(new OWLShuntEdge("GO:0050769", "GO:0022008", "positively_regulates")), true);
assertEquals("e-03", g.hasEdge(new OWLShuntEdge("GO:0050768", "GO:0022008", "negatively_regulates")), true);
assertEquals("e-02", g.hasEdge(new OWLShuntEdge("GO:0048699", "GO:0022008", "is_a")), true);
assertEquals("e-01", g.hasEdge(new OWLShuntEdge("GO:0042063", "GO:0022008", "is_a")), true);
assertEquals("e01", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0007399", "part_of")), true);
assertEquals("e02", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0030154", "is_a")), true);
assertEquals("e03", g.hasEdge(new OWLShuntEdge("GO:0007399", "GO:0048731", "is_a")), true);
assertEquals("e04", g.hasEdge(new OWLShuntEdge("GO:0030154", "GO:0048869", "is_a")), true);
assertEquals("e05", g.hasEdge(new OWLShuntEdge("GO:0048731", "GO:0007275", "part_of")), true);
assertEquals("e06", g.hasEdge(new OWLShuntEdge("GO:0048731", "GO:0048856", "is_a")), true);
assertEquals("e07", g.hasEdge(new OWLShuntEdge("GO:0007275", "GO:0032501", "is_a")), true);
assertEquals("e08", g.hasEdge(new OWLShuntEdge("GO:0007275", "GO:0032502", "is_a")), true);
assertEquals("e09", g.hasEdge(new OWLShuntEdge("GO:0048856", "GO:0032502", "is_a")), true);
assertEquals("e10", g.hasEdge(new OWLShuntEdge("GO:0048869", "GO:0032502", "is_a")), true);
assertEquals("e11", g.hasEdge(new OWLShuntEdge("GO:0048869", "GO:0009987", "is_a")), true);
assertEquals("e12", g.hasEdge(new OWLShuntEdge("GO:0032501", "GO:0008150", "is_a")), true);
assertEquals("e13", g.hasEdge(new OWLShuntEdge("GO:0032502", "GO:0008150", "is_a")), true);
assertEquals("e14", g.hasEdge(new OWLShuntEdge("GO:0009987", "GO:0008150", "is_a")), true);
}
// private OWLGraphWrapper getOBO2OWLOntologyWrapper(String file) throws OWLOntologyCreationException, FileNotFoundException, IOException{
// OBOFormatParser p = new OBOFormatParser();
// OBODoc obodoc = p.parse(new BufferedReader(new FileReader(getResource(file))));
// Obo2Owl bridge = new Obo2Owl();
// OWLOntology ontology = bridge.convert(obodoc);
// OWLGraphWrapper wrapper = new OWLGraphWrapper(ontology);
// return wrapper;
// }
private OWLGraphWrapper getOntologyWrapper(String file) throws OWLOntologyCreationException{
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(getResource(file));
return new OWLGraphWrapper(ontology);
}
}
|
UTF-8
|
Java
| 8,299 |
java
|
OWLGraphShuntTest.java
|
Java
|
[] | null |
[] |
package owltools.graph;
import static junit.framework.Assert.*;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.obolibrary.obo2owl.Obo2Owl;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.parser.OBOFormatParser;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import owltools.OWLToolsTestBasics;
import owltools.graph.OWLGraphWrapper.ISynonym;
import owltools.graph.shunt.OWLShuntEdge;
import owltools.graph.shunt.OWLShuntGraph;
import owltools.graph.shunt.OWLShuntNode;
public class OWLGraphShuntTest extends OWLToolsTestBasics {
private static Logger LOG = Logger.getLogger(OWLGraphWrapper.class);
/*
* Testing the getSegmentShuntGraph and getSegmentShuntGraphJSON functions.
*/
@Test
public void testLineageShuntGraph() throws Exception{
OWLGraphWrapper wrapper = getOntologyWrapper("go.owl");
OWLObject c = wrapper.getOWLClass(OWLGraphWrapper.DEFAULT_IRI_PREFIX + "GO_0022008");
// Exists.
OWLShuntGraph g = wrapper.getLineageShuntGraph(c);
assertNotNull("have a shunt graph, not a complete failure apparently", g);
// Now let's go through and exhaust this subgraph...nodes.
assertEquals("node count okay", 11, g.nodes.size()); // remember: 10 above, self, 5 below
assertEquals("n01", g.hasNode(new OWLShuntNode("GO:0008150")), true);
assertEquals("n02", g.hasNode(new OWLShuntNode("GO:0032502")), true);
assertEquals("n03", g.hasNode(new OWLShuntNode("GO:0032501")), true);
assertEquals("n04", g.hasNode(new OWLShuntNode("GO:0048856")), true);
assertEquals("n05", g.hasNode(new OWLShuntNode("GO:0009987")), true);
assertEquals("n06", g.hasNode(new OWLShuntNode("GO:0007275")), true);
assertEquals("n07", g.hasNode(new OWLShuntNode("GO:0048869")), true);
assertEquals("n08", g.hasNode(new OWLShuntNode("GO:0048731")), true);
assertEquals("n09", g.hasNode(new OWLShuntNode("GO:0030154")), true);
assertEquals("n10", g.hasNode(new OWLShuntNode("GO:0007399")), true);
assertEquals("n11", g.hasNode(new OWLShuntNode("GO:0022008")), true);
// Now let's go through and exhaust this subgraph...part_of edges.
assertEquals("e01", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0008150", "part_of")), true);
assertEquals("e02", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0032502", "part_of")), true);
assertEquals("e03", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0032501", "part_of")), true);
assertEquals("e04", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0048856", "part_of")), true);
assertEquals("e05", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0007275", "part_of")), true);
assertEquals("e06", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0048731", "part_of")), true);
assertEquals("e17", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0007399", "part_of")), true);
// Now let's go through and exhaust this subgraph...is_a edges.
assertEquals("e08", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0008150", "is_a")), true);
assertEquals("e09", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0032502", "is_a")), true);
assertEquals("e10", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0009987", "is_a")), true);
assertEquals("e11", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0048869", "is_a")), true);
assertEquals("e12", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0030154", "is_a")), true);
//LOG.info("lineage: " + wrapper.getLineageShuntGraphJSON(c));
// Total on edges.
assertEquals("edge count okay", 12, g.edges.size());
}
/*
* Testing the getSegmentShuntGraph and getSegmentShuntGraphJSON functions.
*/
@Test
public void testSegmentShuntGraph() throws Exception{
OWLGraphWrapper wrapper = getOntologyWrapper("go.owl");
OWLObject c = wrapper.getOWLClass(OWLGraphWrapper.DEFAULT_IRI_PREFIX + "GO_0022008");
// Exists.
OWLShuntGraph g = wrapper.getSegmentShuntGraph(c);
assertNotNull("have a shunt graph, not a complete failure apparently", g);
// Now let's go through and exhaust this subgraph...nodes.
assertEquals("node count okay", g.nodes.size(), 16); // remember: 10 above, self, 5 below
assertEquals("n01", g.hasNode(new OWLShuntNode("GO:0008150")), true);
assertEquals("n02", g.hasNode(new OWLShuntNode("GO:0032502")), true);
assertEquals("n03", g.hasNode(new OWLShuntNode("GO:0032501")), true);
assertEquals("n04", g.hasNode(new OWLShuntNode("GO:0048856")), true);
assertEquals("n05", g.hasNode(new OWLShuntNode("GO:0009987")), true);
assertEquals("n06", g.hasNode(new OWLShuntNode("GO:0007275")), true);
assertEquals("n07", g.hasNode(new OWLShuntNode("GO:0048869")), true);
assertEquals("n08", g.hasNode(new OWLShuntNode("GO:0048731")), true);
assertEquals("n09", g.hasNode(new OWLShuntNode("GO:0030154")), true);
assertEquals("n10", g.hasNode(new OWLShuntNode("GO:0007399")), true);
assertEquals("n11", g.hasNode(new OWLShuntNode("GO:0022008")), true);
assertEquals("n12", g.hasNode(new OWLShuntNode("GO:0048699")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0042063")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0050768")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0050769")), true);
assertEquals("n13", g.hasNode(new OWLShuntNode("GO:0050767")), true);
// Now let's go through and exhaust this subgraph...edges.
assertEquals("edge count okay", g.edges.size(), 19);
assertEquals("e-05", g.hasEdge(new OWLShuntEdge("GO:0050767", "GO:0022008", "regulates")), true);
assertEquals("e-04", g.hasEdge(new OWLShuntEdge("GO:0050769", "GO:0022008", "positively_regulates")), true);
assertEquals("e-03", g.hasEdge(new OWLShuntEdge("GO:0050768", "GO:0022008", "negatively_regulates")), true);
assertEquals("e-02", g.hasEdge(new OWLShuntEdge("GO:0048699", "GO:0022008", "is_a")), true);
assertEquals("e-01", g.hasEdge(new OWLShuntEdge("GO:0042063", "GO:0022008", "is_a")), true);
assertEquals("e01", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0007399", "part_of")), true);
assertEquals("e02", g.hasEdge(new OWLShuntEdge("GO:0022008", "GO:0030154", "is_a")), true);
assertEquals("e03", g.hasEdge(new OWLShuntEdge("GO:0007399", "GO:0048731", "is_a")), true);
assertEquals("e04", g.hasEdge(new OWLShuntEdge("GO:0030154", "GO:0048869", "is_a")), true);
assertEquals("e05", g.hasEdge(new OWLShuntEdge("GO:0048731", "GO:0007275", "part_of")), true);
assertEquals("e06", g.hasEdge(new OWLShuntEdge("GO:0048731", "GO:0048856", "is_a")), true);
assertEquals("e07", g.hasEdge(new OWLShuntEdge("GO:0007275", "GO:0032501", "is_a")), true);
assertEquals("e08", g.hasEdge(new OWLShuntEdge("GO:0007275", "GO:0032502", "is_a")), true);
assertEquals("e09", g.hasEdge(new OWLShuntEdge("GO:0048856", "GO:0032502", "is_a")), true);
assertEquals("e10", g.hasEdge(new OWLShuntEdge("GO:0048869", "GO:0032502", "is_a")), true);
assertEquals("e11", g.hasEdge(new OWLShuntEdge("GO:0048869", "GO:0009987", "is_a")), true);
assertEquals("e12", g.hasEdge(new OWLShuntEdge("GO:0032501", "GO:0008150", "is_a")), true);
assertEquals("e13", g.hasEdge(new OWLShuntEdge("GO:0032502", "GO:0008150", "is_a")), true);
assertEquals("e14", g.hasEdge(new OWLShuntEdge("GO:0009987", "GO:0008150", "is_a")), true);
}
// private OWLGraphWrapper getOBO2OWLOntologyWrapper(String file) throws OWLOntologyCreationException, FileNotFoundException, IOException{
// OBOFormatParser p = new OBOFormatParser();
// OBODoc obodoc = p.parse(new BufferedReader(new FileReader(getResource(file))));
// Obo2Owl bridge = new Obo2Owl();
// OWLOntology ontology = bridge.convert(obodoc);
// OWLGraphWrapper wrapper = new OWLGraphWrapper(ontology);
// return wrapper;
// }
private OWLGraphWrapper getOntologyWrapper(String file) throws OWLOntologyCreationException{
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(getResource(file));
return new OWLGraphWrapper(ontology);
}
}
| 8,299 | 0.72334 | 0.630196 | 151 | 53.960266 | 34.970165 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.357616 | false | false |
0
|
92f2c95780127166a691c42a3ba046bc835caab6
| 27,668,179,333,501 |
68f247546a5222403af98936e818898021722705
|
/app/src/main/java/com/aaronmeaney/busstopappprototype/BusPosition.java
|
dc7112a426a0a1e34adbbc2477084aa6679b1a1a
|
[] |
no_license
|
Reccy/college-bus_app_android_prototype
|
https://github.com/Reccy/college-bus_app_android_prototype
|
28ae355bb344f7a2733882ebf000c1536d2be7c6
|
8efb14db480245b5bb17285a9ce7a4b1f14d2625
|
refs/heads/master
| 2021-09-13T17:09:44.874000 | 2018-05-02T12:13:15 | 2018-05-02T12:13:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.aaronmeaney.busstopappprototype;
import com.google.gson.annotations.SerializedName;
public class BusPosition {
@SerializedName("latitude")
private double latitude;
@SerializedName("longitude")
private double longitude;
double getLatitude() {
return latitude;
}
double getLongitude() {
return longitude;
}
@Override
public String toString() {
return "Latitude: " + getLatitude() + ", Longitude: " + getLongitude();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BusPosition that = (BusPosition) o;
return Double.compare(that.latitude, latitude) == 0 && Double.compare(that.longitude, longitude) == 0;
}
@Override
public int hashCode() {
int result;
long temp;
temp = Double.doubleToLongBits(latitude);
result = (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(longitude);
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}
|
UTF-8
|
Java
| 1,143 |
java
|
BusPosition.java
|
Java
|
[] | null |
[] |
package com.aaronmeaney.busstopappprototype;
import com.google.gson.annotations.SerializedName;
public class BusPosition {
@SerializedName("latitude")
private double latitude;
@SerializedName("longitude")
private double longitude;
double getLatitude() {
return latitude;
}
double getLongitude() {
return longitude;
}
@Override
public String toString() {
return "Latitude: " + getLatitude() + ", Longitude: " + getLongitude();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BusPosition that = (BusPosition) o;
return Double.compare(that.latitude, latitude) == 0 && Double.compare(that.longitude, longitude) == 0;
}
@Override
public int hashCode() {
int result;
long temp;
temp = Double.doubleToLongBits(latitude);
result = (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(longitude);
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}
| 1,143 | 0.603675 | 0.596675 | 45 | 24.4 | 23.909458 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.511111 | false | false |
0
|
651638b7e37303ab5d7f3cde393ed6c59203275d
| 33,621,004,012,627 |
9e8d14710be77d3e06835f29c7225f580c0531cc
|
/src/modelo/LineaDePedido.java
|
88095e8859d4c7894a9bcfc5022ecad57f16d1cb
|
[] |
no_license
|
Adsandi/empresa
|
https://github.com/Adsandi/empresa
|
377855c8acfd99cd983c17e701cb56269a14e03f
|
2d190c116c312d2b2df0adec1923ee79c2b25915
|
refs/heads/master
| 2021-01-21T18:14:42.727000 | 2017-05-30T08:25:12 | 2017-05-30T08:25:12 | 92,026,884 | 0 | 0 | null | true | 2017-05-30T08:25:13 | 2017-05-22T07:54:59 | 2017-05-22T07:56:39 | 2017-05-30T08:25:13 | 8 | 0 | 0 | 0 |
Java
| null | null |
package modelo;
public class LineaDePedido {
private Articulo articulo;
private int numeroDeLinea;
private int cantidad;
public LineaDePedido(Articulo articulo, int numeroDeLinea, int cantidad) {
super();
this.articulo = articulo;
this.numeroDeLinea = numeroDeLinea;
this.cantidad = cantidad;
}
private Articulo getArticulo() {
return articulo;
}
private int getNumeroDeLinea() {
return numeroDeLinea;
}
private int getCantidad() {
return cantidad;
}
}
|
UTF-8
|
Java
| 485 |
java
|
LineaDePedido.java
|
Java
|
[] | null |
[] |
package modelo;
public class LineaDePedido {
private Articulo articulo;
private int numeroDeLinea;
private int cantidad;
public LineaDePedido(Articulo articulo, int numeroDeLinea, int cantidad) {
super();
this.articulo = articulo;
this.numeroDeLinea = numeroDeLinea;
this.cantidad = cantidad;
}
private Articulo getArticulo() {
return articulo;
}
private int getNumeroDeLinea() {
return numeroDeLinea;
}
private int getCantidad() {
return cantidad;
}
}
| 485 | 0.738144 | 0.738144 | 23 | 19.086956 | 16.774496 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.869565 | false | false |
0
|
ca08940df288d8197398d4a68b1c3058df6f3c8f
| 33,749,853,020,951 |
34168669191db69a93d5a92ebd83ecb2f08a1414
|
/hw16multiprocess/messageServer/src/main/java/com/alextim/messages/ShownUsersMessage.java
|
00b9eb56b890eeac33d0c2d81063333bd9b0e3ac
|
[] |
no_license
|
alextim1508/otusJava
|
https://github.com/alextim1508/otusJava
|
1c8827f38efe3227b64a50482cd5f1f16197a70f
|
b24bdd9dd51e81b4699b50c1bd1d8807a542bd86
|
refs/heads/master
| 2023-06-26T15:38:20.576000 | 2020-04-21T11:30:31 | 2020-04-21T11:30:31 | 181,898,192 | 0 | 0 | null | false | 2023-06-14T22:23:06 | 2019-04-17T13:31:57 | 2020-04-21T11:30:35 | 2023-06-14T22:23:06 | 142 | 0 | 0 | 3 |
Java
| false | false |
package com.alextim.messages;
import lombok.ToString;
@ToString(callSuper = true)
public class ShownUsersMessage extends Message {
public ShownUsersMessage(String waitingAnswerId) {
super(ShownUsersMessage.class, waitingAnswerId);
}
}
|
UTF-8
|
Java
| 254 |
java
|
ShownUsersMessage.java
|
Java
|
[] | null |
[] |
package com.alextim.messages;
import lombok.ToString;
@ToString(callSuper = true)
public class ShownUsersMessage extends Message {
public ShownUsersMessage(String waitingAnswerId) {
super(ShownUsersMessage.class, waitingAnswerId);
}
}
| 254 | 0.76378 | 0.76378 | 11 | 22.09091 | 21.55945 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
0
|
280a39b1d9891f9283e933e991271edd6f574597
| 35,888,746,747,030 |
b712b0c8fde600f7923ed99f2ba642be8c28416c
|
/app/src/main/java/id/or/tauhid/doadandzikir/YukulModel.java
|
019a50905ca6e931b433ee0b1ac71441e6460eec
|
[] |
no_license
|
saadabdurrazaq/doadzikirapp
|
https://github.com/saadabdurrazaq/doadzikirapp
|
e2d869434135c19b6b99bc5aeeaf0945b8fbb201
|
aa4e8ca3f4afd2978e965d96860fcdea34118d09
|
refs/heads/master
| 2023-04-03T12:13:55.859000 | 2021-04-05T10:40:50 | 2021-04-05T10:40:50 | 354,799,260 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package id.or.tauhid.doadandzikir;
/**
* Created by ravi on 16/11/17.
*/
public class YukulModel {
String name;
String nomor;
public YukulModel() {
}
public String getName() {
return name;
}
public String getNomor() { return nomor; }
}
|
UTF-8
|
Java
| 279 |
java
|
YukulModel.java
|
Java
|
[
{
"context": "kage id.or.tauhid.doadandzikir;\n\n/**\n * Created by ravi on 16/11/17.\n */\n\npublic class YukulModel {\n ",
"end": 55,
"score": 0.7704862356185913,
"start": 54,
"tag": "NAME",
"value": "r"
},
{
"context": "ge id.or.tauhid.doadandzikir;\n\n/**\n * Created by ravi on 16/11/17.\n */\n\npublic class YukulModel {\n S",
"end": 58,
"score": 0.8159106969833374,
"start": 55,
"tag": "USERNAME",
"value": "avi"
}
] | null |
[] |
package id.or.tauhid.doadandzikir;
/**
* Created by ravi on 16/11/17.
*/
public class YukulModel {
String name;
String nomor;
public YukulModel() {
}
public String getName() {
return name;
}
public String getNomor() { return nomor; }
}
| 279 | 0.602151 | 0.580645 | 19 | 13.684211 | 14.105066 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false |
0
|
d27582aaf82b4ab56c4680e77d27107d15efbda3
| 36,026,185,693,123 |
1b95a6ec4d51b955ed43e33366b034c576bd5fcf
|
/app-clinica/src/Presentacion/frmusuariologin.java
|
061ef47a1e896627a43a4a31ff59b84356ed0f37
|
[] |
no_license
|
Vladthat24/app-clinica
|
https://github.com/Vladthat24/app-clinica
|
20826a0e9fee9a85e413818f86cad99c37617945
|
2e24c6436511495588453b1aeea6ed10dd3a2f0e
|
refs/heads/master
| 2023-01-03T12:06:12.177000 | 2020-10-29T18:36:33 | 2020-10-29T18:36:33 | 286,623,866 | 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 Presentacion;
import Datos.vacceso;
import Datos.vtrabajador;
import Logica.facceso;
import Logica.ftrabajador;
import com.sun.glass.events.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author CARLOS
*/
public class frmusuariologin extends javax.swing.JFrame {
/**
* Creates new form frmusuariologin
*/
public frmusuariologin() {
initComponents();
this.setTitle(".:: Centro Medico - Maria Santisima ::.");
this.setLocationRelativeTo(null);
jScrollPane1.setVisible(false);
}
void ingresar() {
try {
DefaultTableModel modelo;
facceso func = new facceso();
vacceso dts = new vacceso();
dts.setLogin(txtusuario.getText());
dts.setPassword(txtpassword.getText());
modelo = func.login(dts.getLogin(), dts.getPassword());
tablalistado.setModel(modelo);
if (func.totalregistros > 0) {
this.dispose();
frminicio form = new frminicio();
form.toFront();
form.setVisible(true);
frminicio.lblidpersona.setText(tablalistado.getValueAt(0, 0).toString());
frminicio.lblacceso.setText(tablalistado.getValueAt(0, 2).toString());
if (!frminicio.lblacceso.getText().equals("Administrador")) {
frminicio.mnuconfiguraciones.setEnabled(false);
}
} else {
JOptionPane.showMessageDialog(rootPane, "Acceso Denegado", "Acceso al Sistema", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
txtusuario = new javax.swing.JTextField();
txtpassword = new javax.swing.JPasswordField();
jScrollPane1 = new javax.swing.JScrollPane();
tablalistado = new javax.swing.JTable();
btningresar = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jPanel6 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setIconImage(new ImageIcon(getClass().getResource("/Files/logomariasantisimaII.PNG")).getImage());
jPanel1.setBackground(new java.awt.Color(166, 226, 46));
jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
jPanel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jPanel2.setBackground(new java.awt.Color(166, 226, 46));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jPanel4.setBackground(new java.awt.Color(166, 226, 46));
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jPanel3.setBackground(new java.awt.Color(166, 226, 46));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
txtusuario.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "USUARIO:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N
txtpassword.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "CONTRASEÑA:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N
txtpassword.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txtpasswordKeyPressed(evt);
}
});
tablalistado.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tablalistado);
btningresar.setBackground(new java.awt.Color(153, 153, 153));
btningresar.setForeground(new java.awt.Color(255, 255, 255));
btningresar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/user.png"))); // NOI18N
btningresar.setText("Ingresar");
btningresar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btningresarActionPerformed(evt);
}
});
btningresar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
btningresarKeyPressed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btningresar)
.addGap(114, 114, 114))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(77, 77, 77)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtusuario, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpassword, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(145, 145, 145)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(86, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(txtusuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtpassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btningresar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/icono-soloII.png"))); // NOI18N
jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 204)));
jLabel2.setBackground(new java.awt.Color(162, 164, 163));
jLabel2.setFont(new java.awt.Font("Elephant", 1, 28)); // NOI18N
jLabel2.setForeground(new java.awt.Color(0, 0, 255));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("CENTRO MEDICO");
jLabel3.setBackground(new java.awt.Color(0, 0, 204));
jLabel3.setFont(new java.awt.Font("Century", 3, 26)); // NOI18N
jLabel3.setForeground(new java.awt.Color(0, 0, 204));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("Especialistas en Medicina");
jLabel4.setBackground(new java.awt.Color(162, 164, 163));
jLabel4.setFont(new java.awt.Font("Elephant", 1, 25)); // NOI18N
jLabel4.setForeground(new java.awt.Color(0, 0, 255));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("MARIA SANTISIMA");
jPanel5.setBackground(new java.awt.Color(0, 0, 204));
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 318, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 6, Short.MAX_VALUE)
);
jPanel6.setBackground(new java.awt.Color(0, 0, 204));
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 327, Short.MAX_VALUE)
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 7, Short.MAX_VALUE)
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(153, 153, 153)
.addComponent(jLabel1))
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(28, 28, 28))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(13, 13, 13))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btningresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btningresarActionPerformed
// TODO add your handling code here:
try {
DefaultTableModel modelo;
facceso func = new facceso();
vacceso dts = new vacceso();
dts.setLogin(txtusuario.getText());
dts.setPassword(txtpassword.getText());
modelo = func.login(dts.getLogin(), dts.getPassword());
tablalistado.setModel(modelo);
if (func.totalregistros > 0) {
this.dispose();
frminicio form = new frminicio();
form.toFront();
form.setVisible(true);
frminicio.lblidpersona.setText(tablalistado.getValueAt(0, 0).toString());
frminicio.lblacceso.setText(tablalistado.getValueAt(0, 2).toString());
if (!frminicio.lblacceso.getText().equals("Administrador")) {
frminicio.mnuconfiguraciones.setEnabled(false);
}
} else {
JOptionPane.showMessageDialog(rootPane, "Acceso Denegado", "Acceso al Sistema", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
}
}//GEN-LAST:event_btningresarActionPerformed
private void btningresarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btningresarKeyPressed
// TODO add your handling code here:
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
ingresar();
}
}//GEN-LAST:event_btningresarKeyPressed
private void txtpasswordKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtpasswordKeyPressed
// TODO add your handling code here:
if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
ingresar();
}
}//GEN-LAST:event_txtpasswordKeyPressed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new frmusuariologin().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btningresar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
public static javax.swing.JScrollPane jScrollPane1;
public static javax.swing.JTable tablalistado;
private javax.swing.JPasswordField txtpassword;
private javax.swing.JTextField txtusuario;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 21,385 |
java
|
frmusuariologin.java
|
Java
|
[
{
"context": ".swing.table.DefaultTableModel;\n\n/**\n *\n * @author CARLOS\n */\npublic class frmusuariologin extends javax.sw",
"end": 475,
"score": 0.991050660610199,
"start": 469,
"tag": "USERNAME",
"value": "CARLOS"
},
{
"context": "ents();\n this.setTitle(\".:: Centro Medico - Maria Santisima ::.\");\n this.setLocationRelativeTo(null);\n",
"end": 710,
"score": 0.9550091028213501,
"start": 695,
"tag": "NAME",
"value": "Maria Santisima"
},
{
"context": "xtusuario.getText());\n dts.setPassword(txtpassword.getText());\n\n modelo = func.login(dts.",
"end": 1052,
"score": 0.8180608153343201,
"start": 1041,
"tag": "PASSWORD",
"value": "txtpassword"
},
{
"context": ".SwingConstants.CENTER);\n jLabel4.setText(\"MARIA SANTISIMA\");\n\n jPanel5.setBackground(new java.awt.Co",
"end": 10203,
"score": 0.9998379349708557,
"start": 10188,
"tag": "NAME",
"value": "MARIA SANTISIMA"
},
{
"context": "xtusuario.getText());\n dts.setPassword(txtpassword.getText());\n\n modelo = func.login(dts.getLogin",
"end": 17335,
"score": 0.7288119196891785,
"start": 17316,
"tag": "PASSWORD",
"value": "txtpassword.getText"
}
] | 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 Presentacion;
import Datos.vacceso;
import Datos.vtrabajador;
import Logica.facceso;
import Logica.ftrabajador;
import com.sun.glass.events.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author CARLOS
*/
public class frmusuariologin extends javax.swing.JFrame {
/**
* Creates new form frmusuariologin
*/
public frmusuariologin() {
initComponents();
this.setTitle(".:: Centro Medico - <NAME> ::.");
this.setLocationRelativeTo(null);
jScrollPane1.setVisible(false);
}
void ingresar() {
try {
DefaultTableModel modelo;
facceso func = new facceso();
vacceso dts = new vacceso();
dts.setLogin(txtusuario.getText());
dts.setPassword(<PASSWORD>.getText());
modelo = func.login(dts.getLogin(), dts.getPassword());
tablalistado.setModel(modelo);
if (func.totalregistros > 0) {
this.dispose();
frminicio form = new frminicio();
form.toFront();
form.setVisible(true);
frminicio.lblidpersona.setText(tablalistado.getValueAt(0, 0).toString());
frminicio.lblacceso.setText(tablalistado.getValueAt(0, 2).toString());
if (!frminicio.lblacceso.getText().equals("Administrador")) {
frminicio.mnuconfiguraciones.setEnabled(false);
}
} else {
JOptionPane.showMessageDialog(rootPane, "Acceso Denegado", "Acceso al Sistema", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
txtusuario = new javax.swing.JTextField();
txtpassword = new javax.swing.JPasswordField();
jScrollPane1 = new javax.swing.JScrollPane();
tablalistado = new javax.swing.JTable();
btningresar = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jPanel6 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setIconImage(new ImageIcon(getClass().getResource("/Files/logomariasantisimaII.PNG")).getImage());
jPanel1.setBackground(new java.awt.Color(166, 226, 46));
jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
jPanel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jPanel2.setBackground(new java.awt.Color(166, 226, 46));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jPanel4.setBackground(new java.awt.Color(166, 226, 46));
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jPanel3.setBackground(new java.awt.Color(166, 226, 46));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
txtusuario.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "USUARIO:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N
txtpassword.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "CONTRASEÑA:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N
txtpassword.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txtpasswordKeyPressed(evt);
}
});
tablalistado.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tablalistado);
btningresar.setBackground(new java.awt.Color(153, 153, 153));
btningresar.setForeground(new java.awt.Color(255, 255, 255));
btningresar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/user.png"))); // NOI18N
btningresar.setText("Ingresar");
btningresar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btningresarActionPerformed(evt);
}
});
btningresar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
btningresarKeyPressed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btningresar)
.addGap(114, 114, 114))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(77, 77, 77)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtusuario, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpassword, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(145, 145, 145)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(86, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(txtusuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtpassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btningresar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/icono-soloII.png"))); // NOI18N
jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 204)));
jLabel2.setBackground(new java.awt.Color(162, 164, 163));
jLabel2.setFont(new java.awt.Font("Elephant", 1, 28)); // NOI18N
jLabel2.setForeground(new java.awt.Color(0, 0, 255));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("CENTRO MEDICO");
jLabel3.setBackground(new java.awt.Color(0, 0, 204));
jLabel3.setFont(new java.awt.Font("Century", 3, 26)); // NOI18N
jLabel3.setForeground(new java.awt.Color(0, 0, 204));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("Especialistas en Medicina");
jLabel4.setBackground(new java.awt.Color(162, 164, 163));
jLabel4.setFont(new java.awt.Font("Elephant", 1, 25)); // NOI18N
jLabel4.setForeground(new java.awt.Color(0, 0, 255));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("<NAME>");
jPanel5.setBackground(new java.awt.Color(0, 0, 204));
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 318, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 6, Short.MAX_VALUE)
);
jPanel6.setBackground(new java.awt.Color(0, 0, 204));
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 327, Short.MAX_VALUE)
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 7, Short.MAX_VALUE)
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(153, 153, 153)
.addComponent(jLabel1))
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(28, 28, 28))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(13, 13, 13))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btningresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btningresarActionPerformed
// TODO add your handling code here:
try {
DefaultTableModel modelo;
facceso func = new facceso();
vacceso dts = new vacceso();
dts.setLogin(txtusuario.getText());
dts.setPassword(<PASSWORD>());
modelo = func.login(dts.getLogin(), dts.getPassword());
tablalistado.setModel(modelo);
if (func.totalregistros > 0) {
this.dispose();
frminicio form = new frminicio();
form.toFront();
form.setVisible(true);
frminicio.lblidpersona.setText(tablalistado.getValueAt(0, 0).toString());
frminicio.lblacceso.setText(tablalistado.getValueAt(0, 2).toString());
if (!frminicio.lblacceso.getText().equals("Administrador")) {
frminicio.mnuconfiguraciones.setEnabled(false);
}
} else {
JOptionPane.showMessageDialog(rootPane, "Acceso Denegado", "Acceso al Sistema", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
}
}//GEN-LAST:event_btningresarActionPerformed
private void btningresarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btningresarKeyPressed
// TODO add your handling code here:
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
ingresar();
}
}//GEN-LAST:event_btningresarKeyPressed
private void txtpasswordKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtpasswordKeyPressed
// TODO add your handling code here:
if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
ingresar();
}
}//GEN-LAST:event_txtpasswordKeyPressed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmusuariologin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new frmusuariologin().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btningresar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
public static javax.swing.JScrollPane jScrollPane1;
public static javax.swing.JTable tablalistado;
private javax.swing.JPasswordField txtpassword;
private javax.swing.JTextField txtusuario;
// End of variables declaration//GEN-END:variables
}
| 21,357 | 0.657454 | 0.638842 | 419 | 50.035801 | 40.957935 | 247 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.854415 | false | false |
0
|
f31a8cb1cb82403d882ffa61cc9eb738f2bec908
| 36,026,185,693,727 |
3bc08d394d7b729cfc4da11727ea0980e0880a71
|
/design-pattern/src/main/java/test/Abstract.java
|
7016578a9d68b5e70b5dba6219b50db14460b1d4
|
[] |
no_license
|
mengfanwu/design-pattern
|
https://github.com/mengfanwu/design-pattern
|
434870e618d0d5886ba388b8f6e67f51ad2d6087
|
e8264bf89739358d08cdd4df89ef9428f1391f8e
|
refs/heads/master
| 2021-08-23T08:54:52.934000 | 2017-12-04T11:37:44 | 2017-12-04T11:37:44 | 113,035,032 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test;
/**
* Created by mengfw on 2017/8/24.
*/
public abstract class Abstract {
abstract void method();
}
|
UTF-8
|
Java
| 124 |
java
|
Abstract.java
|
Java
|
[
{
"context": "package test;\n\n/**\n * Created by mengfw on 2017/8/24.\n */\npublic abstract class Abstrac",
"end": 39,
"score": 0.9995502233505249,
"start": 33,
"tag": "USERNAME",
"value": "mengfw"
}
] | null |
[] |
package test;
/**
* Created by mengfw on 2017/8/24.
*/
public abstract class Abstract {
abstract void method();
}
| 124 | 0.645161 | 0.58871 | 8 | 14.5 | 14.150971 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
0
|
baae2afae4f7195acc6ccf3c311e159077c319e4
| 35,459,250,020,803 |
53dd36667ab9ae1813a80b5d09db8bc36de840a0
|
/src/JavaNetbeans_mysql_Conn/bookOperation.java
|
81289dfc4c7288d0952773076352fd8a399de4a1
|
[] |
no_license
|
Confidence-bassey/Library-management-system
|
https://github.com/Confidence-bassey/Library-management-system
|
590cd6cdebc487b078a5102bf50ef056fb22dace
|
4703ff364ac15aac5c6be5b43d1c65ffd12c887f
|
refs/heads/main
| 2023-08-21T17:31:55.892000 | 2021-10-19T11:59:57 | 2021-10-19T11:59:57 | 384,227,579 | 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 JavaNetbeans_mysql_Conn;
/**
*
* @author DELL
*/
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import java.sql.Statement;
import com.libmgr.dao.DbHelper;
public class bookOperation extends javax.swing.JFrame {
/**
* Creates new form bookOperation
*/
public bookOperation() {
initComponents();
bookDisplaybttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
DisplaybttnActionPerformed(evt);
}});
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
bookDisplaybttn = new javax.swing.JButton();
Exitbttn = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
Bookname = new javax.swing.JLabel();
Authorname = new javax.swing.JLabel();
Isbn = new javax.swing.JLabel();
pubDate = new javax.swing.JLabel();
Enterbkname = new javax.swing.JTextField();
EnterAuthor = new javax.swing.JTextField();
EnterISBN = new javax.swing.JTextField();
EnterpubDate = new javax.swing.JTextField();
Addbookbttn = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jTextField1 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
bookDisplaybttn.setText("DisplayBooks");
Exitbttn.setText("Exit");
Exitbttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ExitbttnActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(bookDisplaybttn, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(Exitbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(51, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(bookDisplaybttn, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(Exitbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(82, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
Bookname.setText("BookName:");
Authorname.setText("Author:");
Isbn.setText("ISBN:");
pubDate.setText("PubDate:");
EnterpubDate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
EnterpubDateActionPerformed(evt);
}
});
Addbookbttn.setText("AddBook");
Addbookbttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AddbookbttnActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Bookname, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
.addComponent(pubDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Isbn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Authorname, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(EnterISBN, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
.addComponent(EnterpubDate)
.addComponent(Addbookbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(EnterAuthor, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Enterbkname, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(54, Short.MAX_VALUE))))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Bookname)
.addComponent(Enterbkname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Authorname)
.addComponent(EnterAuthor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Isbn)
.addComponent(EnterISBN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pubDate)
.addComponent(EnterpubDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
.addComponent(Addbookbttn)
.addGap(26, 26, 26))
);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jTextField1.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
jTextField1.setText(" Welcome To Mr. Bassey's BookShop");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 591, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(27, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
// conn = DriverManager.getConnection("jdbc:mysql://localhost:3307/?" + "user=root&password=password");
private String CreateBookRecord(String bookName, String authorName, String Isbn, String pubdate){
try{
//jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
// Class.forName("com.mysql.jdbc.Driver");
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/connector1?ServerTimeZone=UTC", "root","BillonaireConfi1");
Statement state = connect.createStatement();
String query =
"INSERT INTO books(BookName,AuthorName,ISBN,pubDate)Values("+
"'"+bookName+"','"+authorName+"','"+Isbn+"','"+pubdate+"')";
int rows_affected = state.executeUpdate(query);
if(rows_affected<0){
System.out.println("Failed to add book");
return null;
}
} catch(Exception exception){
System.out.println( exception);
return null;
}
return null;
}
private void deleteBk(){
try {
/* String booksQuery = "delete from books where books.bookId = id";
var booksResultSet = DbHelper.executeQuery(booksQuery); */
//String id;
//id = JOptionPane.showInputDialog("Enter book Id");
//String bookName = this.Enterbkname.getText();
// String authorName = EnterAuthor.getText();
String Id = this.EnterISBN.getText();
// String pubdate = EnterpubDate.getText();
Id = JOptionPane.showInputDialog("Enter book Id");
// Id = "120-4567-89103";
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/connector1?ServerTimeZone=UTC", "root","BillonaireConfi1");
String booksQuery = "delete from books where bookId=?";
PreparedStatement state = connect.prepareStatement(booksQuery);
// String booksQuery = "delete from books where bookId = ?";
System.out.println("preparedStatement before binding = "+ state.toString());
// state.setString(1, bookName);
// state.setString(2,authorName);
state.setInt(1, Integer.parseInt(Id));
System.out.println("preparedStatement after binding = "+ state.toString());
// state.setString(4, pubdate);
int rows_affected = state.executeUpdate();
if(rows_affected<0){
JOptionPane.showMessageDialog(this,"Failed to delete book");
}else{
JOptionPane.showMessageDialog(this, "Deletion successful");
}
}catch(Exception exception){
System.out.println( exception);
}
}
public void Updatebook(){
try {
/* String booksQuery = "delete from books where books.bookId = id";
var booksResultSet = DbHelper.executeQuery(booksQuery); */
//String id;
//id = JOptionPane.showInputDialog("Enter book Id");
String bookName = this.Enterbkname.getText();
String authorName = EnterAuthor.getText();
String Isbn = this.EnterISBN.getText();
String pubdate = EnterpubDate.getText();
String Id = JOptionPane.showInputDialog("Enter book Id");
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/connector1?ServerTimeZone=UTC", "root","BillonaireConfi1");
// Connection connect =DBHelper.getConnection();
String booksUpdate = "update books set BookName = ?, AuthorName = ?, ISBN = ?, pubDate = ? where bookId =?";
PreparedStatement state = connect.prepareStatement(booksUpdate);
// System.out.println("preparedStatement before binding = "+ state.toString());
state.setInt(1, Integer.parseInt(Id));
state.setString(2, bookName);
state.setString(3,authorName);
state.setString(4, Isbn);
state.setString(5, pubdate);
int rows_affected = state.executeUpdate();
if(rows_affected<0){
JOptionPane.showMessageDialog(this,"Update Failed");
}else{
JOptionPane.showMessageDialog(this, "Book Update successful");
}
}catch(Exception exception){
System.out.println( exception);
}
}
public Vector<Vector<Object>> SearchBooks(String searchKey){
try{
Connection connect = DbHelper.getConnection("");
//"select * from books where BookName like ? or AuthorName like ? or ISBN = ? or pubDate like ? or bookId = ?";
String searchQuery = "select * from books where ISBN=? or BookName like ? or AuthorName like ?";
PreparedStatement statement = connect.prepareStatement(searchQuery);
//var booksResultSet = DbHelper.executeQuery(searchQuery);
statement.setString(1, searchKey);
statement.setString(2, "%"+searchKey+"%");
statement.setString(3,"%"+searchKey+"%");
System.out.println("Prepared Statement = "+statement.toString());
// ResultSet Qresult = statement.executeQuery();
ResultSet Qresult = statement.executeQuery();
Vector<Vector<Object>> searchResult = new Vector<Vector<Object>>();
while(Qresult.next()){
Vector rowVector = new Vector();
rowVector.add(Qresult.getInt("bookId"));
rowVector.add(Qresult.getString("BookName"));
rowVector.add(Qresult.getString("AuthorName"));
rowVector.add(Qresult.getString("ISBN"));
rowVector.add(Qresult.getString("puDate"));
searchResult.add(rowVector);
}
return searchResult;
}catch(Exception e){
System.out.println(e);
return new Vector<>();
}
}
private void ExitbttnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitbttnActionPerformed
// TODO add your handling code here:
String exit = this.Exitbttn.getActionCommand();
System.exit(0);
}//GEN-LAST:event_ExitbttnActionPerformed
private void AddbookbttnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbookbttnActionPerformed
// TODO add your handling code here: String addbook = this.Addbookbutton.getActionCommand();
String bookName = this.Enterbkname.getText();
String authorName = EnterAuthor.getText();
String Isbn = EnterISBN.getText();
String pubdate = EnterpubDate.getText();
CreateBookRecord(bookName,authorName,Isbn,pubdate);
JOptionPane.showMessageDialog(this,"Thank you!! "+ bookName+" has now been added to your store");
if(bookName.isBlank()){
JOptionPane.showMessageDialog(this,"Enter book name","Enter book name",0);
return;
}
}//GEN-LAST:event_AddbookbttnActionPerformed
private void EnterpubDateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EnterpubDateActionPerformed
// TODO add your handling code here:
JOptionPane.showMessageDialog(this, "enter in the format: yyyy-mm-dd");
Date Currentdate = new Date();
SimpleDateFormat DateForm = new SimpleDateFormat("yyyy-MM-dd");
String userEntry = EnterpubDate.getText();
//Developer1
// System.out.println(DateForm.format(Currentdate));
}//GEN-LAST:event_EnterpubDateActionPerformed
private void SearchLibbttnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
BooksWindow booksListWindow = new BooksWindow();
booksListWindow.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new bookOperation().setVisible(true);
}
});
}
private void DisplaybttnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
BooksWindow booksListWindow = new BooksWindow();
booksListWindow.setVisible(true);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Addbookbttn;
private javax.swing.JLabel Authorname;
private javax.swing.JLabel Bookname;
private javax.swing.JTextField EnterAuthor;
private javax.swing.JTextField EnterISBN;
private javax.swing.JTextField Enterbkname;
private javax.swing.JTextField EnterpubDate;
private javax.swing.JButton Exitbttn;
private javax.swing.JLabel Isbn;
private javax.swing.JButton bookDisplaybttn;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JTextField jTextField1;
private javax.swing.JLabel pubDate;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 26,194 |
java
|
bookOperation.java
|
Java
|
[
{
"context": "ackage JavaNetbeans_mysql_Conn;\n\n/**\n *\n * @author DELL\n */\nimport javax.swing.JFrame;\nimport javax.swing",
"end": 241,
"score": 0.9824217557907104,
"start": 237,
"tag": "NAME",
"value": "DELL"
},
{
"context": " Welcome To Mr. Bassey's BookShop\");\n\n javax.swing.GroupLayout jP",
"end": 11575,
"score": 0.9705225825309753,
"start": 11569,
"tag": "NAME",
"value": "Bassey"
},
{
"context": "c:mysql://localhost:3307/?\" + \"user=root&password=password\");\n\n \n private String CreateBookRecord(Stri",
"end": 15097,
"score": 0.9994763731956482,
"start": 15089,
"tag": "PASSWORD",
"value": "password"
}
] | 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 JavaNetbeans_mysql_Conn;
/**
*
* @author DELL
*/
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import java.sql.Statement;
import com.libmgr.dao.DbHelper;
public class bookOperation extends javax.swing.JFrame {
/**
* Creates new form bookOperation
*/
public bookOperation() {
initComponents();
bookDisplaybttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
DisplaybttnActionPerformed(evt);
}});
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
bookDisplaybttn = new javax.swing.JButton();
Exitbttn = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
Bookname = new javax.swing.JLabel();
Authorname = new javax.swing.JLabel();
Isbn = new javax.swing.JLabel();
pubDate = new javax.swing.JLabel();
Enterbkname = new javax.swing.JTextField();
EnterAuthor = new javax.swing.JTextField();
EnterISBN = new javax.swing.JTextField();
EnterpubDate = new javax.swing.JTextField();
Addbookbttn = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jTextField1 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
bookDisplaybttn.setText("DisplayBooks");
Exitbttn.setText("Exit");
Exitbttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ExitbttnActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(bookDisplaybttn, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(Exitbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(51, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(bookDisplaybttn, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(Exitbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(82, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 4));
Bookname.setText("BookName:");
Authorname.setText("Author:");
Isbn.setText("ISBN:");
pubDate.setText("PubDate:");
EnterpubDate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
EnterpubDateActionPerformed(evt);
}
});
Addbookbttn.setText("AddBook");
Addbookbttn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AddbookbttnActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Bookname, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
.addComponent(pubDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Isbn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Authorname, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(EnterISBN, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
.addComponent(EnterpubDate)
.addComponent(Addbookbttn, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(EnterAuthor, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Enterbkname, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(54, Short.MAX_VALUE))))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Bookname)
.addComponent(Enterbkname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Authorname)
.addComponent(EnterAuthor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Isbn)
.addComponent(EnterISBN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pubDate)
.addComponent(EnterpubDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
.addComponent(Addbookbttn)
.addGap(26, 26, 26))
);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jTextField1.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
jTextField1.setText(" Welcome To Mr. Bassey's BookShop");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 591, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(27, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
// conn = DriverManager.getConnection("jdbc:mysql://localhost:3307/?" + "user=root&password=<PASSWORD>");
private String CreateBookRecord(String bookName, String authorName, String Isbn, String pubdate){
try{
//jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
// Class.forName("com.mysql.jdbc.Driver");
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/connector1?ServerTimeZone=UTC", "root","BillonaireConfi1");
Statement state = connect.createStatement();
String query =
"INSERT INTO books(BookName,AuthorName,ISBN,pubDate)Values("+
"'"+bookName+"','"+authorName+"','"+Isbn+"','"+pubdate+"')";
int rows_affected = state.executeUpdate(query);
if(rows_affected<0){
System.out.println("Failed to add book");
return null;
}
} catch(Exception exception){
System.out.println( exception);
return null;
}
return null;
}
private void deleteBk(){
try {
/* String booksQuery = "delete from books where books.bookId = id";
var booksResultSet = DbHelper.executeQuery(booksQuery); */
//String id;
//id = JOptionPane.showInputDialog("Enter book Id");
//String bookName = this.Enterbkname.getText();
// String authorName = EnterAuthor.getText();
String Id = this.EnterISBN.getText();
// String pubdate = EnterpubDate.getText();
Id = JOptionPane.showInputDialog("Enter book Id");
// Id = "120-4567-89103";
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/connector1?ServerTimeZone=UTC", "root","BillonaireConfi1");
String booksQuery = "delete from books where bookId=?";
PreparedStatement state = connect.prepareStatement(booksQuery);
// String booksQuery = "delete from books where bookId = ?";
System.out.println("preparedStatement before binding = "+ state.toString());
// state.setString(1, bookName);
// state.setString(2,authorName);
state.setInt(1, Integer.parseInt(Id));
System.out.println("preparedStatement after binding = "+ state.toString());
// state.setString(4, pubdate);
int rows_affected = state.executeUpdate();
if(rows_affected<0){
JOptionPane.showMessageDialog(this,"Failed to delete book");
}else{
JOptionPane.showMessageDialog(this, "Deletion successful");
}
}catch(Exception exception){
System.out.println( exception);
}
}
public void Updatebook(){
try {
/* String booksQuery = "delete from books where books.bookId = id";
var booksResultSet = DbHelper.executeQuery(booksQuery); */
//String id;
//id = JOptionPane.showInputDialog("Enter book Id");
String bookName = this.Enterbkname.getText();
String authorName = EnterAuthor.getText();
String Isbn = this.EnterISBN.getText();
String pubdate = EnterpubDate.getText();
String Id = JOptionPane.showInputDialog("Enter book Id");
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/connector1?ServerTimeZone=UTC", "root","BillonaireConfi1");
// Connection connect =DBHelper.getConnection();
String booksUpdate = "update books set BookName = ?, AuthorName = ?, ISBN = ?, pubDate = ? where bookId =?";
PreparedStatement state = connect.prepareStatement(booksUpdate);
// System.out.println("preparedStatement before binding = "+ state.toString());
state.setInt(1, Integer.parseInt(Id));
state.setString(2, bookName);
state.setString(3,authorName);
state.setString(4, Isbn);
state.setString(5, pubdate);
int rows_affected = state.executeUpdate();
if(rows_affected<0){
JOptionPane.showMessageDialog(this,"Update Failed");
}else{
JOptionPane.showMessageDialog(this, "Book Update successful");
}
}catch(Exception exception){
System.out.println( exception);
}
}
public Vector<Vector<Object>> SearchBooks(String searchKey){
try{
Connection connect = DbHelper.getConnection("");
//"select * from books where BookName like ? or AuthorName like ? or ISBN = ? or pubDate like ? or bookId = ?";
String searchQuery = "select * from books where ISBN=? or BookName like ? or AuthorName like ?";
PreparedStatement statement = connect.prepareStatement(searchQuery);
//var booksResultSet = DbHelper.executeQuery(searchQuery);
statement.setString(1, searchKey);
statement.setString(2, "%"+searchKey+"%");
statement.setString(3,"%"+searchKey+"%");
System.out.println("Prepared Statement = "+statement.toString());
// ResultSet Qresult = statement.executeQuery();
ResultSet Qresult = statement.executeQuery();
Vector<Vector<Object>> searchResult = new Vector<Vector<Object>>();
while(Qresult.next()){
Vector rowVector = new Vector();
rowVector.add(Qresult.getInt("bookId"));
rowVector.add(Qresult.getString("BookName"));
rowVector.add(Qresult.getString("AuthorName"));
rowVector.add(Qresult.getString("ISBN"));
rowVector.add(Qresult.getString("puDate"));
searchResult.add(rowVector);
}
return searchResult;
}catch(Exception e){
System.out.println(e);
return new Vector<>();
}
}
private void ExitbttnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitbttnActionPerformed
// TODO add your handling code here:
String exit = this.Exitbttn.getActionCommand();
System.exit(0);
}//GEN-LAST:event_ExitbttnActionPerformed
private void AddbookbttnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbookbttnActionPerformed
// TODO add your handling code here: String addbook = this.Addbookbutton.getActionCommand();
String bookName = this.Enterbkname.getText();
String authorName = EnterAuthor.getText();
String Isbn = EnterISBN.getText();
String pubdate = EnterpubDate.getText();
CreateBookRecord(bookName,authorName,Isbn,pubdate);
JOptionPane.showMessageDialog(this,"Thank you!! "+ bookName+" has now been added to your store");
if(bookName.isBlank()){
JOptionPane.showMessageDialog(this,"Enter book name","Enter book name",0);
return;
}
}//GEN-LAST:event_AddbookbttnActionPerformed
private void EnterpubDateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EnterpubDateActionPerformed
// TODO add your handling code here:
JOptionPane.showMessageDialog(this, "enter in the format: yyyy-mm-dd");
Date Currentdate = new Date();
SimpleDateFormat DateForm = new SimpleDateFormat("yyyy-MM-dd");
String userEntry = EnterpubDate.getText();
//Developer1
// System.out.println(DateForm.format(Currentdate));
}//GEN-LAST:event_EnterpubDateActionPerformed
private void SearchLibbttnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
BooksWindow booksListWindow = new BooksWindow();
booksListWindow.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(bookOperation.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new bookOperation().setVisible(true);
}
});
}
private void DisplaybttnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
BooksWindow booksListWindow = new BooksWindow();
booksListWindow.setVisible(true);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Addbookbttn;
private javax.swing.JLabel Authorname;
private javax.swing.JLabel Bookname;
private javax.swing.JTextField EnterAuthor;
private javax.swing.JTextField EnterISBN;
private javax.swing.JTextField Enterbkname;
private javax.swing.JTextField EnterpubDate;
private javax.swing.JButton Exitbttn;
private javax.swing.JLabel Isbn;
private javax.swing.JButton bookDisplaybttn;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JTextField jTextField1;
private javax.swing.JLabel pubDate;
// End of variables declaration//GEN-END:variables
}
| 26,196 | 0.643163 | 0.632091 | 517 | 49.665379 | 39.398895 | 206 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777563 | false | false |
0
|
386c5caafa9c982d8e813155cbca7e456c8479de
| 36,962,488,557,532 |
9036865db25748b8b897c644acf16bf47e655093
|
/library/src/main/java/thecarisma/golympian/misc/ZeusMath.java
|
101ee89aeafc8e87c991f5bcea3737801edaf194
|
[
"MIT"
] |
permissive
|
Thecarisma/golympian
|
https://github.com/Thecarisma/golympian
|
0d610292be40492666967fa4b4c4b991cacce8d6
|
2cfbc7e392be1e1e2d9766ed99c2348515c277a2
|
refs/heads/master
| 2021-10-28T08:17:22.799000 | 2019-04-23T01:41:48 | 2019-04-23T01:41:48 | 115,069,084 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package thecarisma.golympian.misc;
import java.math.BigDecimal;
/**
* Created by Azeez Adewale on 11/26/2017.
* Copyright Great Innovation Group
* Licenced under tri Licence
* MIT LICENCE
* GNU LICENCE
* CDDL LICENCE
* on this day 11/26/2017 : 2:22 AM
*
* Class : ZeusMath
* Filename : ZeusMath.java
* Project : Olympus
* Package : com.gig.olympus.basic
* Computer Name : Thecarisma
*/
public class ZeusMath {
/**
*
* forcefully round float into given places
*
* @param d the float you wish to round
* @param decimalPlace the number of places you want it to round to
* @return return the rounded float
*/
public static float roundFloat(float d, int decimalPlace) {
BigDecimal bd = new BigDecimal(Float.toString(d));
bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
return bd.floatValue();
}
}
|
UTF-8
|
Java
| 917 |
java
|
ZeusMath.java
|
Java
|
[
{
"context": "\n\nimport java.math.BigDecimal;\n\n/**\n * Created by Azeez Adewale on 11/26/2017.\n * Copyright Great Innovation Gro",
"end": 98,
"score": 0.999882698059082,
"start": 85,
"tag": "NAME",
"value": "Azeez Adewale"
}
] | null |
[] |
package thecarisma.golympian.misc;
import java.math.BigDecimal;
/**
* Created by <NAME> on 11/26/2017.
* Copyright Great Innovation Group
* Licenced under tri Licence
* MIT LICENCE
* GNU LICENCE
* CDDL LICENCE
* on this day 11/26/2017 : 2:22 AM
*
* Class : ZeusMath
* Filename : ZeusMath.java
* Project : Olympus
* Package : com.gig.olympus.basic
* Computer Name : Thecarisma
*/
public class ZeusMath {
/**
*
* forcefully round float into given places
*
* @param d the float you wish to round
* @param decimalPlace the number of places you want it to round to
* @return return the rounded float
*/
public static float roundFloat(float d, int decimalPlace) {
BigDecimal bd = new BigDecimal(Float.toString(d));
bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
return bd.floatValue();
}
}
| 910 | 0.648855 | 0.628135 | 37 | 23.783783 | 20.271315 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.189189 | false | false |
0
|
6fa66e8570a305c267ec5ce6bee7e8af684faf89
| 38,414,187,506,665 |
447520f40e82a060368a0802a391697bc00be96f
|
/apks/malware/app49/source/com/google/android/gms/drive/internal/AddEventListenerRequest.java
|
1c8dfe3c3091248bb5dbe7992693e236a498e768
|
[
"Apache-2.0"
] |
permissive
|
iantal/AndroidPermissions
|
https://github.com/iantal/AndroidPermissions
|
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
|
d623b732734243590b5f004d167e542e2e2ae249
|
refs/heads/master
| 2023-07-19T01:29:26.689000 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 |
Apache-2.0
| false | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | 2019-09-30T19:01:44 | 2023-07-16T07:41:38 | 1,616,319 | 0 | 0 | 1 | null | false | false |
package com.google.android.gms.drive.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.drive.DriveId;
import com.google.android.gms.drive.events.ChangesAvailableOptions;
public class AddEventListenerRequest
implements SafeParcelable
{
public static final Parcelable.Creator<AddEventListenerRequest> CREATOR = new a();
final int a;
final DriveId b;
final int c;
final ChangesAvailableOptions d;
AddEventListenerRequest(int paramInt1, DriveId paramDriveId, int paramInt2, ChangesAvailableOptions paramChangesAvailableOptions)
{
this.a = paramInt1;
this.b = paramDriveId;
this.c = paramInt2;
this.d = paramChangesAvailableOptions;
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
a.a(this, paramParcel, paramInt);
}
}
|
UTF-8
|
Java
| 966 |
java
|
AddEventListenerRequest.java
|
Java
|
[] | null |
[] |
package com.google.android.gms.drive.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.drive.DriveId;
import com.google.android.gms.drive.events.ChangesAvailableOptions;
public class AddEventListenerRequest
implements SafeParcelable
{
public static final Parcelable.Creator<AddEventListenerRequest> CREATOR = new a();
final int a;
final DriveId b;
final int c;
final ChangesAvailableOptions d;
AddEventListenerRequest(int paramInt1, DriveId paramDriveId, int paramInt2, ChangesAvailableOptions paramChangesAvailableOptions)
{
this.a = paramInt1;
this.b = paramDriveId;
this.c = paramInt2;
this.d = paramChangesAvailableOptions;
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
a.a(this, paramParcel, paramInt);
}
}
| 966 | 0.766046 | 0.76087 | 35 | 26.6 | 28.712566 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657143 | false | false |
0
|
7c7ed2ffb5c4bc74a6b1ae8bef2d6cc43def0eac
| 3,959,959,912,077 |
8be660e1c65ad997616315fb1d585300b9ac0eef
|
/Java基础/myObject/src/com/zzw/test_04/gouzaoDemo.java
|
ace4a20afefe064d1c75a5a5c14858dff4f7b040
|
[] |
no_license
|
xxBei/JavaStudy
|
https://github.com/xxBei/JavaStudy
|
36db6fee727bc5a0abc50c55b83cc3dbc1e8d1be
|
6f5a7363934032d3d62cb44878975fafd51c5e5d
|
refs/heads/master
| 2022-12-27T00:32:38.042000 | 2019-05-27T15:22:34 | 2019-05-27T15:22:34 | 146,560,577 | 0 | 0 | null | false | 2022-12-16T04:49:02 | 2018-08-29T07:14:10 | 2019-05-27T15:24:17 | 2022-12-16T04:49:01 | 47,547 | 0 | 0 | 104 |
Java
| false | false |
package com.zzw.test_04;
public class gouzaoDemo {
public static void main(String[] args) {
//无参构造方法+setXxx()
Gouzao gz = new Gouzao();
gz.setBrand("华为");
gz.setColor("土豪金");
gz.setPrice(2999);
System.out.println("品牌:"+gz.getBrand()+",颜色:"+gz.getColor()+",价格:"+gz.getPrice());
System.out.println("-------------------------");
//有参构造方法
Gouzao gz1 = new Gouzao("OPPO","玫瑰金",3699);
System.out.println("品牌:"+gz1.getBrand()+",颜色"+gz1.getColor()+",价格:"+gz1.getPrice());
}
}
|
UTF-8
|
Java
| 623 |
java
|
gouzaoDemo.java
|
Java
|
[] | null |
[] |
package com.zzw.test_04;
public class gouzaoDemo {
public static void main(String[] args) {
//无参构造方法+setXxx()
Gouzao gz = new Gouzao();
gz.setBrand("华为");
gz.setColor("土豪金");
gz.setPrice(2999);
System.out.println("品牌:"+gz.getBrand()+",颜色:"+gz.getColor()+",价格:"+gz.getPrice());
System.out.println("-------------------------");
//有参构造方法
Gouzao gz1 = new Gouzao("OPPO","玫瑰金",3699);
System.out.println("品牌:"+gz1.getBrand()+",颜色"+gz1.getColor()+",价格:"+gz1.getPrice());
}
}
| 623 | 0.529517 | 0.504472 | 18 | 30.055555 | 27.136429 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
0
|
dab062828df0de1c8f5cdd96e17e2171bdbb9552
| 3,118,146,314,260 |
222bb43c6712cb8702bdee8554663222d3ce65d3
|
/src/com/tj/stl/service/IdChkService.java
|
b6cec3ef87a52d58403faf431bb0c04992374305
|
[] |
no_license
|
Eilhwan/stlproject
|
https://github.com/Eilhwan/stlproject
|
33ba0651ea2905464afadd9eeb17e3949b16b220
|
8ee20ab360c68ae3284b1f6b7463e36aec8d57a0
|
refs/heads/master
| 2023-01-28T16:46:38.205000 | 2020-12-08T02:37:46 | 2020-12-08T02:37:46 | 246,532,504 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tj.stl.service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tj.stl.dao.MemberDao;
public class IdChkService implements Service {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) {
String memberId = request.getParameter("memberId");
MemberDao dao = MemberDao.getInstance();
if (dao.memberIdcheck(memberId) == MemberDao.EXSIST_ON) {
request.setAttribute("resultmsg", "해당 아이디가 존재합니다.");
}else {
request.setAttribute("resultmsg", "회원가입 가능한 아이디입니다.");
}
}
}
|
UTF-8
|
Java
| 637 |
java
|
IdChkService.java
|
Java
|
[] | null |
[] |
package com.tj.stl.service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tj.stl.dao.MemberDao;
public class IdChkService implements Service {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) {
String memberId = request.getParameter("memberId");
MemberDao dao = MemberDao.getInstance();
if (dao.memberIdcheck(memberId) == MemberDao.EXSIST_ON) {
request.setAttribute("resultmsg", "해당 아이디가 존재합니다.");
}else {
request.setAttribute("resultmsg", "회원가입 가능한 아이디입니다.");
}
}
}
| 637 | 0.757216 | 0.757216 | 22 | 25.772728 | 25.512798 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.363636 | false | false |
0
|
d65eb83849c3d3d5eefbfc79803241048c99b3bb
| 4,844,723,147,054 |
6fb7c26655ff9a12dfd8eaaabe296279604234e5
|
/Compi2_Proyecto1/src/InterpreteCSJ/Sentencias/SenMsg.java
|
99b2c358c3e99f102bcf702b490a03332f3d70af
|
[] |
no_license
|
jerduar/Compi2_Proyecto1
|
https://github.com/jerduar/Compi2_Proyecto1
|
7c46c0b4524b7a4ae3efdb98ca9d819fa208ff06
|
02b7603b70747e6922e30fafb9bdd1f84dc84718
|
refs/heads/master
| 2021-04-26T13:55:23.583000 | 2018-03-10T04:46:34 | 2018-03-10T04:46:34 | 121,337,810 | 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 InterpreteCSJ.Sentencias;
import AST.Nodo;
import InterpreteCSJ.Expresiones.Auxiliar;
import InterpreteCSJ.Expresiones.Expresion;
import InterpreteCSJ.Expresiones.Result;
import InterpreteCSJ.Recolector.ManErr;
import InterpreteCSJ.Recolector.TablaSymCSJ;
import javax.swing.JOptionPane;
/**
*
* @author jerduar
*/
public class SenMsg extends Sentencia{
public SenMsg(Nodo sen) {
super(sen);
}
@Override
public Result Ejecutar(TablaSymCSJ t) {
Expresion e = new Expresion(this.sentencia,t);
Result respuesta = e.ResolverExpresion();
if(Auxiliar.esError(respuesta.getTipo())){
ManErr.InsertarError("", "Semántico", this.sentencia.getFila(), this.sentencia.getColumna(), "No se puedo encontrar evaluar la expresion");
//System.out.println("Es un error :(");
return Result.EjecucionError();
}else{
//System.out.println(respuesta.getValor());
JOptionPane.showMessageDialog(null, respuesta.getValor(), "INFORMACIÓN CJS", JOptionPane.INFORMATION_MESSAGE);
return Result.EjecucionError();
}
}
}
|
UTF-8
|
Java
| 1,386 |
java
|
SenMsg.java
|
Java
|
[
{
"context": "rt javax.swing.JOptionPane;\r\n\r\n/**\r\n *\r\n * @author jerduar\r\n */\r\npublic class SenMsg extends Sentencia{\r\n\r\n ",
"end": 525,
"score": 0.9464092254638672,
"start": 518,
"tag": "USERNAME",
"value": "jerduar"
}
] | 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 InterpreteCSJ.Sentencias;
import AST.Nodo;
import InterpreteCSJ.Expresiones.Auxiliar;
import InterpreteCSJ.Expresiones.Expresion;
import InterpreteCSJ.Expresiones.Result;
import InterpreteCSJ.Recolector.ManErr;
import InterpreteCSJ.Recolector.TablaSymCSJ;
import javax.swing.JOptionPane;
/**
*
* @author jerduar
*/
public class SenMsg extends Sentencia{
public SenMsg(Nodo sen) {
super(sen);
}
@Override
public Result Ejecutar(TablaSymCSJ t) {
Expresion e = new Expresion(this.sentencia,t);
Result respuesta = e.ResolverExpresion();
if(Auxiliar.esError(respuesta.getTipo())){
ManErr.InsertarError("", "Semántico", this.sentencia.getFila(), this.sentencia.getColumna(), "No se puedo encontrar evaluar la expresion");
//System.out.println("Es un error :(");
return Result.EjecucionError();
}else{
//System.out.println(respuesta.getValor());
JOptionPane.showMessageDialog(null, respuesta.getValor(), "INFORMACIÓN CJS", JOptionPane.INFORMATION_MESSAGE);
return Result.EjecucionError();
}
}
}
| 1,386 | 0.666907 | 0.666907 | 42 | 30.952381 | 31.625 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
0
|
2b2d4860021ee8f72b260b1ae27d1fd8d7f6cbb5
| 4,844,723,143,818 |
bb0fa1b99e4f5be75e8fc5c29f3968548a0de5f9
|
/Matrix1.java
|
a18e5c6a76af899630878e84ce0cb886449049ad
|
[] |
no_license
|
PrashantNarahatti/Apti
|
https://github.com/PrashantNarahatti/Apti
|
2884beac9b5c357a2d371a77516481486f1c8a4e
|
e50dffb2469ef657b1ef6c0231b2719503c8962b
|
refs/heads/main
| 2023-09-03T00:10:10.649000 | 2021-11-20T17:38:37 | 2021-11-20T17:38:37 | 427,632,429 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class Matrix1 {
public static void main(String[] args) {
for (int row =1;row <=5;row++) {
for(int col=1;col>5 ;col++) {
if(row + col>5 && row >=col)
System.out.print("*");
else
System.out.print("");
}
System.out.println();
}
}
}
|
UTF-8
|
Java
| 279 |
java
|
Matrix1.java
|
Java
|
[] | null |
[] |
class Matrix1 {
public static void main(String[] args) {
for (int row =1;row <=5;row++) {
for(int col=1;col>5 ;col++) {
if(row + col>5 && row >=col)
System.out.print("*");
else
System.out.print("");
}
System.out.println();
}
}
}
| 279 | 0.498208 | 0.476703 | 17 | 14.529411 | 14.180009 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.294118 | false | false |
0
|
b5e4f0dbb2bef939e0b3d1c6715476d12d446fae
| 8,976,481,708,527 |
53c3577f00bf78a57835b11f385672ed93dba7ff
|
/src/main/java/com/vicente/controleponto/api/models/enums/TipoPessoa.java
|
222da46960735a88dd1981a11e3376299df64039
|
[] |
no_license
|
vicente-psp/controle-ponto
|
https://github.com/vicente-psp/controle-ponto
|
5032e0efb25b8ae11395d61c8c4be98dccf6d6d3
|
1af961d9a435ce1ec27cdf78a5aa0f193fbbe849
|
refs/heads/master
| 2023-02-11T17:34:10.343000 | 2021-01-10T18:14:57 | 2021-01-10T18:14:57 | 254,951,244 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.vicente.controleponto.api.models.enums;
public enum TipoPessoa {
CONTRATADO("Contratado"), AUTONOMO("Autônomo");
private String descricao;
private TipoPessoa(String descricao) {
this.descricao = descricao;
}
public String toString() {
return this.descricao;
}
}
|
UTF-8
|
Java
| 295 |
java
|
TipoPessoa.java
|
Java
|
[] | null |
[] |
package com.vicente.controleponto.api.models.enums;
public enum TipoPessoa {
CONTRATADO("Contratado"), AUTONOMO("Autônomo");
private String descricao;
private TipoPessoa(String descricao) {
this.descricao = descricao;
}
public String toString() {
return this.descricao;
}
}
| 295 | 0.731293 | 0.731293 | 17 | 16.294117 | 17.696011 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.176471 | false | false |
0
|
3aa7f7d6ad89f3e9bb5a9fe12091c274303962c9
| 29,583,734,777,518 |
3df3b313625a1b45a299b9214b1cdb0bd66a317b
|
/s4_libros-back/src/main/java/co/edu/uniandes/csw/libros/persistence/CarroComprasPersistence.java
|
045305d104f731d23d4d42cb032b7adf1e5d84e4
|
[
"MIT"
] |
permissive
|
Uniandes-ISIS2603-backup/s4_LibrosEscolares_201910
|
https://github.com/Uniandes-ISIS2603-backup/s4_LibrosEscolares_201910
|
b3db9e6d00944ae7d7ff45d8596ab595b3b335bd
|
edc86b6b42da64a58874d3143954adff33cb4d4e
|
refs/heads/master
| 2020-04-18T18:40:41.989000 | 2019-05-23T14:01:24 | 2019-05-23T14:01:24 | null | 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 co.edu.uniandes.csw.libros.persistence;
import co.edu.uniandes.csw.libros.entities.CarroComprasEntity;
import java.util.Iterator;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
/**
*
* @author Andres Ramirez
*/
@Stateless
public class CarroComprasPersistence {
@PersistenceContext(unitName = "librosPU")
protected EntityManager em;
public CarroComprasEntity create(CarroComprasEntity carroComprasEntity) {
em.persist(carroComprasEntity);
return carroComprasEntity;
}
public CarroComprasEntity find(Long carroComprasId) {
return em.find(CarroComprasEntity.class, carroComprasId);
}
public CarroComprasEntity findPorUsuario(Long usuario) {
TypedQuery<CarroComprasEntity> query = em.createQuery("select u from CarroComprasEntity u", CarroComprasEntity.class);
List<CarroComprasEntity> lista=query.getResultList();
Iterator<CarroComprasEntity> iterador=lista.iterator();
CarroComprasEntity names = iterador.next();
while(iterador.hasNext()&&names.getDueno().getId()!=usuario)
{
names = iterador.next();
}
return names;
}
public List<CarroComprasEntity> findAll() {
TypedQuery<CarroComprasEntity> query = em.createQuery("select u from CarroComprasEntity u", CarroComprasEntity.class);
return query.getResultList();
}
public void delete(Long carroId) {
CarroComprasEntity carroCompras = em.find(CarroComprasEntity.class, carroId);
em.remove(carroCompras);
}
public CarroComprasEntity update(CarroComprasEntity entity) {
return em.merge(entity);
}
}
|
UTF-8
|
Java
| 2,065 |
java
|
CarroComprasPersistence.java
|
Java
|
[
{
"context": "vax.persistence.TypedQuery;\r\n\r\n/**\r\n *\r\n * @author Andres Ramirez\r\n */\r\n@Stateless\r\npublic class CarroComprasPersis",
"end": 547,
"score": 0.9998642802238464,
"start": 533,
"tag": "NAME",
"value": "Andres Ramirez"
}
] | 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 co.edu.uniandes.csw.libros.persistence;
import co.edu.uniandes.csw.libros.entities.CarroComprasEntity;
import java.util.Iterator;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
/**
*
* @author <NAME>
*/
@Stateless
public class CarroComprasPersistence {
@PersistenceContext(unitName = "librosPU")
protected EntityManager em;
public CarroComprasEntity create(CarroComprasEntity carroComprasEntity) {
em.persist(carroComprasEntity);
return carroComprasEntity;
}
public CarroComprasEntity find(Long carroComprasId) {
return em.find(CarroComprasEntity.class, carroComprasId);
}
public CarroComprasEntity findPorUsuario(Long usuario) {
TypedQuery<CarroComprasEntity> query = em.createQuery("select u from CarroComprasEntity u", CarroComprasEntity.class);
List<CarroComprasEntity> lista=query.getResultList();
Iterator<CarroComprasEntity> iterador=lista.iterator();
CarroComprasEntity names = iterador.next();
while(iterador.hasNext()&&names.getDueno().getId()!=usuario)
{
names = iterador.next();
}
return names;
}
public List<CarroComprasEntity> findAll() {
TypedQuery<CarroComprasEntity> query = em.createQuery("select u from CarroComprasEntity u", CarroComprasEntity.class);
return query.getResultList();
}
public void delete(Long carroId) {
CarroComprasEntity carroCompras = em.find(CarroComprasEntity.class, carroId);
em.remove(carroCompras);
}
public CarroComprasEntity update(CarroComprasEntity entity) {
return em.merge(entity);
}
}
| 2,057 | 0.690073 | 0.690073 | 66 | 29.287878 | 30.408714 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false |
0
|
30b5103e5a12067f847ea17ae81b5318fec57a77
| 26,328,149,526,172 |
83615e9f2d7a41912d99dc0deb507b04ddd371aa
|
/src/org/gxuwz/arithmatic/dataStructures/Demo07_查找/SeqSearch.java
|
9ae3013f15a6da733f5f8394a573a7cf15b54d6a
|
[] |
no_license
|
vovhh/MyProject_02_arithmatic
|
https://github.com/vovhh/MyProject_02_arithmatic
|
76f3b3e7afb0ce32f1c3ffd6628ff5d86a973a4c
|
e99ab8f09a6c89c4180bddf830d2b4f6896a25c6
|
refs/heads/master
| 2023-03-11T13:22:40.297000 | 2022-04-25T15:45:11 | 2022-04-25T15:45:11 | 272,213,755 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.gxuwz.arithmatic.dataStructures.Demo07_查找;
/**
* 线性查找
*/
public class SeqSearch {
public static int seq(int[] arr, int n) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] == n)
return i;
}
return -1;
}
public static void main(String[] args) {
int[] arr = {2, 9, 11, 67, 4, 8, 33};
int n = seq(arr, 4);
if (n == -1)
System.out.println("该数不存在!");
else
System.out.println("该数的下标为:" + n);
}
}
|
UTF-8
|
Java
| 570 |
java
|
SeqSearch.java
|
Java
|
[] | null |
[] |
package org.gxuwz.arithmatic.dataStructures.Demo07_查找;
/**
* 线性查找
*/
public class SeqSearch {
public static int seq(int[] arr, int n) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] == n)
return i;
}
return -1;
}
public static void main(String[] args) {
int[] arr = {2, 9, 11, 67, 4, 8, 33};
int n = seq(arr, 4);
if (n == -1)
System.out.println("该数不存在!");
else
System.out.println("该数的下标为:" + n);
}
}
| 570 | 0.466165 | 0.43609 | 23 | 22.130434 | 17.920851 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.73913 | false | false |
0
|
180e2e9643d3f631668695239e39b1aaa5a81852
| 26,328,149,525,718 |
4a7be333a07dd8256668e1bce77a52d02b62c2e9
|
/src/main/java/com/monopay/wallet/repository/MerchantRepository.java
|
fb17fa15a7aed67e4551f38f398ade5d45d49501
|
[] |
no_license
|
ahmadirfaan/monopay-wallet
|
https://github.com/ahmadirfaan/monopay-wallet
|
d206caee4b69f1e7e6a3dc5f7bb807ef32526937
|
247f5d5a1bb75cbb54507f79d76d648ee1e24e22
|
refs/heads/master
| 2022-05-26T03:02:50.831000 | 2022-03-28T08:22:27 | 2022-03-28T08:22:27 | 440,379,928 | 0 | 0 | null | true | 2021-12-21T03:36:37 | 2021-12-21T03:36:37 | 2021-11-08T12:28:19 | 2019-08-02T05:17:45 | 79 | 0 | 0 | 0 | null | false | false |
package com.monopay.wallet.repository;
import com.monopay.wallet.entity.Merchant;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface MerchantRepository extends MongoRepository<Merchant, String> {
}
|
UTF-8
|
Java
| 235 |
java
|
MerchantRepository.java
|
Java
|
[] | null |
[] |
package com.monopay.wallet.repository;
import com.monopay.wallet.entity.Merchant;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface MerchantRepository extends MongoRepository<Merchant, String> {
}
| 235 | 0.842553 | 0.842553 | 8 | 28.375 | 30.614285 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
0
|
8fc27ea99def13b725c8a140ede8bf59545f6acb
| 22,428,319,279,743 |
41c6a6f1960b67a4a229f9fcf88d50647318f6f6
|
/trunk/ztp-portal/src/sk/stuba/fiit/ztpPortal/admin/dayCare/DayCareProvider.java
|
e1ba39c8d55d3aa0df07dee44796eefdb37e9e89
|
[] |
no_license
|
BGCX262/ztp-portal-svn-to-git
|
https://github.com/BGCX262/ztp-portal-svn-to-git
|
14c8817d755df0f39924d25633863264e2631495
|
6712e00849a38c2822208d45f952fe7c75a17314
|
refs/heads/master
| 2020-05-19T07:48:17.485000 | 2015-08-23T06:47:28 | 2015-08-23T06:47:28 | 41,244,471 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sk.stuba.fiit.ztpPortal.admin.dayCare;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilterStateLocator;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import sk.stuba.fiit.ztpPortal.databaseController.DayCareController;
import sk.stuba.fiit.ztpPortal.databaseModel.County;
import sk.stuba.fiit.ztpPortal.databaseModel.DayCare;
import sk.stuba.fiit.ztpPortal.databaseModel.RegisteredUser;
public class DayCareProvider extends SortableDataProvider implements
IFilterStateLocator {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<DayCare> list = new DayCareController().getAllDayCares();
private DayCare filter = new DayCare();
private County preferredTown = null;
private boolean prefer;
private RegisteredUser livingOwner;
public DayCareProvider() {
setSort("creationDate", true);
}
public void setUserPreferredTownFilter(County town){
preferredTown = town;
}
public void setUserPreferTown(boolean prefer){
this.prefer = prefer;
}
public RegisteredUser getEventOwner() {
return livingOwner;
}
public void setEventOwner(RegisteredUser eventOwner) {
this.livingOwner = eventOwner;
}
public Iterator<DayCare> iterator(int first, int count) {
List<DayCare> newList = new ArrayList<DayCare>();
newList.addAll(list.subList(first, first + count));
final String sortColumn = this.getSort().getProperty();
final boolean ascending = this.getSort().isAscending();
Collections.sort(newList, new Comparator<Object>() {
public int compare(Object obj1, Object obj2) {
PropertyModel model1 = new PropertyModel(obj1, sortColumn);
PropertyModel model2 = new PropertyModel(obj2, sortColumn);
Object modelObject1 = model1.getObject();
Object modelObject2 = model2.getObject();
int compare = ((Comparable<Object>) modelObject1)
.compareTo(modelObject2);
if (!ascending)
compare *= -1;
return compare;
}
});
for (final DayCare living : list) {
// if ((filter.getCreateDate() != null)
// && !event.getCreateDate().contains(
// filter.getCreateDate())) {
// newList.remove(event);
// }
if ((filter.getShortDesc() != null)
&& !living.getShortDesc().toLowerCase().contains(
filter.getShortDesc().toLowerCase())) {
newList.remove(living);
}
if ((filter.getCreator() != null)
&& !living.getCreator().getName().toLowerCase().contains(
filter.getCreator().getName().toLowerCase())) {
newList.remove(living);
}
}
return newList.iterator();
}
public int size() {
return list.size();
}
public IModel model(final Object object) {
return new AbstractReadOnlyModel() {
/**
*
*/
private static final long serialVersionUID = 1L;
public Object getObject() {
return object;
}
};
}
public Object getFilterState() {
// TODO Auto-generated method stub
return filter;
}
public void setFilterState(Object arg0) {
filter = (DayCare) arg0;
}
}
|
UTF-8
|
Java
| 3,465 |
java
|
DayCareProvider.java
|
Java
|
[] | null |
[] |
package sk.stuba.fiit.ztpPortal.admin.dayCare;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilterStateLocator;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import sk.stuba.fiit.ztpPortal.databaseController.DayCareController;
import sk.stuba.fiit.ztpPortal.databaseModel.County;
import sk.stuba.fiit.ztpPortal.databaseModel.DayCare;
import sk.stuba.fiit.ztpPortal.databaseModel.RegisteredUser;
public class DayCareProvider extends SortableDataProvider implements
IFilterStateLocator {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<DayCare> list = new DayCareController().getAllDayCares();
private DayCare filter = new DayCare();
private County preferredTown = null;
private boolean prefer;
private RegisteredUser livingOwner;
public DayCareProvider() {
setSort("creationDate", true);
}
public void setUserPreferredTownFilter(County town){
preferredTown = town;
}
public void setUserPreferTown(boolean prefer){
this.prefer = prefer;
}
public RegisteredUser getEventOwner() {
return livingOwner;
}
public void setEventOwner(RegisteredUser eventOwner) {
this.livingOwner = eventOwner;
}
public Iterator<DayCare> iterator(int first, int count) {
List<DayCare> newList = new ArrayList<DayCare>();
newList.addAll(list.subList(first, first + count));
final String sortColumn = this.getSort().getProperty();
final boolean ascending = this.getSort().isAscending();
Collections.sort(newList, new Comparator<Object>() {
public int compare(Object obj1, Object obj2) {
PropertyModel model1 = new PropertyModel(obj1, sortColumn);
PropertyModel model2 = new PropertyModel(obj2, sortColumn);
Object modelObject1 = model1.getObject();
Object modelObject2 = model2.getObject();
int compare = ((Comparable<Object>) modelObject1)
.compareTo(modelObject2);
if (!ascending)
compare *= -1;
return compare;
}
});
for (final DayCare living : list) {
// if ((filter.getCreateDate() != null)
// && !event.getCreateDate().contains(
// filter.getCreateDate())) {
// newList.remove(event);
// }
if ((filter.getShortDesc() != null)
&& !living.getShortDesc().toLowerCase().contains(
filter.getShortDesc().toLowerCase())) {
newList.remove(living);
}
if ((filter.getCreator() != null)
&& !living.getCreator().getName().toLowerCase().contains(
filter.getCreator().getName().toLowerCase())) {
newList.remove(living);
}
}
return newList.iterator();
}
public int size() {
return list.size();
}
public IModel model(final Object object) {
return new AbstractReadOnlyModel() {
/**
*
*/
private static final long serialVersionUID = 1L;
public Object getObject() {
return object;
}
};
}
public Object getFilterState() {
// TODO Auto-generated method stub
return filter;
}
public void setFilterState(Object arg0) {
filter = (DayCare) arg0;
}
}
| 3,465 | 0.688023 | 0.683117 | 135 | 23.666666 | 23.055168 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.059259 | false | false |
0
|
c8df693270a0e2db0acf3386e01e28a46b2fdacd
| 5,205,500,431,876 |
d8bd18ae52e934685ffd76c46c03f1a29863743a
|
/opensams-dal/src/main/java/com/opensams/dal/po/Student.java
|
48d268e2c8f1f0df4f09bfc83bcc4060955fbe45
|
[] |
no_license
|
KevinLeung611/opensams
|
https://github.com/KevinLeung611/opensams
|
2074aad7fd9c7083a8ad7c0c5b62c0c7a270fadc
|
13070f7321df4ca1748084d15efc0ec1aba0774c
|
refs/heads/master
| 2020-05-20T02:08:26.045000 | 2019-05-26T04:39:27 | 2019-05-26T04:39:27 | 185,325,084 | 1 | 1 | null | false | 2020-10-13T13:08:34 | 2019-05-07T05:12:17 | 2019-05-26T04:40:46 | 2020-10-13T13:08:33 | 16,066 | 1 | 1 | 2 |
JavaScript
| false | false |
package com.opensams.dal.po;
import com.opensams.model.PageModel;
import lombok.Data;
import java.util.Date;
/**
* @author Kevin Leung
*/
@Data
public class Student extends PageModel {
private Integer id;
private String studentName;
private String studentCode;
private Date birthday;
private String sex;
private String mail;
private String localMail;
private String phone;
private String qq;
private String college;
private String major;
private String avatar;
private String loginName;
private String loginPwd;
private String description;
private Date createdAt;
private Date modifiedAt;
}
|
UTF-8
|
Java
| 682 |
java
|
Student.java
|
Java
|
[
{
"context": "mbok.Data;\n\nimport java.util.Date;\n\n/**\n * @author Kevin Leung\n */\n@Data\npublic class Student extends PageModel ",
"end": 138,
"score": 0.99982088804245,
"start": 127,
"tag": "NAME",
"value": "Kevin Leung"
}
] | null |
[] |
package com.opensams.dal.po;
import com.opensams.model.PageModel;
import lombok.Data;
import java.util.Date;
/**
* @author <NAME>
*/
@Data
public class Student extends PageModel {
private Integer id;
private String studentName;
private String studentCode;
private Date birthday;
private String sex;
private String mail;
private String localMail;
private String phone;
private String qq;
private String college;
private String major;
private String avatar;
private String loginName;
private String loginPwd;
private String description;
private Date createdAt;
private Date modifiedAt;
}
| 677 | 0.70088 | 0.70088 | 48 | 13.208333 | 13.685391 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false |
0
|
6882df996c70c95c8314c1bb36c43cc34bd592e8
| 11,098,195,514,744 |
a102e3b4c65a025eeabf26d5f958b1a816100db0
|
/BaseModel/src/com/wpi/cs509/teamA/exception/PwdIncorrectException.java
|
8c60327db5ad76b2d1ad4cc3952fe7c1eb1ab6fd
|
[] |
no_license
|
cuixiongyi/WPI-F2015-CS509-TeamA
|
https://github.com/cuixiongyi/WPI-F2015-CS509-TeamA
|
2f085e2b75d1c70099e54089280ccc90d54b7ea4
|
9480ef4b738b818c2b18d43b340fcb5e4051c67a
|
refs/heads/iteration3
| 2020-12-14T10:15:15.466000 | 2015-12-15T20:52:16 | 2015-12-15T20:52:16 | 42,678,446 | 3 | 2 | null | false | 2015-12-18T20:12:54 | 2015-09-17T19:53:04 | 2015-10-13T19:25:01 | 2015-12-18T20:12:54 | 9,219 | 0 | 0 | 3 |
Java
| null | null |
package com.wpi.cs509.teamA.exception;
public class PwdIncorrectException extends Exception {
public PwdIncorrectException() {
// TODO: this should feedback to the UI
System.out.println("Password incorrect, please try again~");
}
}
|
UTF-8
|
Java
| 239 |
java
|
PwdIncorrectException.java
|
Java
|
[] | null |
[] |
package com.wpi.cs509.teamA.exception;
public class PwdIncorrectException extends Exception {
public PwdIncorrectException() {
// TODO: this should feedback to the UI
System.out.println("Password incorrect, please try again~");
}
}
| 239 | 0.76569 | 0.753138 | 8 | 28.875 | 23.20796 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false |
0
|
8409e7559006b36d12eb1d470fc1cae81cb64510
| 8,083,128,482,233 |
6c749659ba3224854da227fdb9c06548fa6cc8ca
|
/src/dominio/Nota.java
|
211bd4db78098f0724134ebd73759eb8b00ffef9
|
[] |
no_license
|
faakit/Trabalho-Pratico-PROG-III
|
https://github.com/faakit/Trabalho-Pratico-PROG-III
|
e475a3e7c7eb425f46766e876afaadd9b9c82d92
|
6db604595680fcfceecf7a72d0bb2f7137db7770
|
refs/heads/master
| 2023-06-17T20:13:06.030000 | 2021-07-16T00:48:11 | 2021-07-16T00:48:11 | 298,406,418 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package src.dominio;
import java.io.Serializable;
import java.math.BigInteger;
public class Nota implements Serializable {
private static final long serialVersionUID = 1L;
private Estudante estudante;
private double notaDoAluno;
public Nota(Estudante estudante, double nota){
this.estudante = estudante;
this.notaDoAluno = nota;
}
public Estudante getEstudante() {
return this.estudante;
}
public double getNotaDoAluno() {
return this.notaDoAluno;
}
public BigInteger getMatricula(){
return this.estudante.verMatricula();
}
}
|
UTF-8
|
Java
| 622 |
java
|
Nota.java
|
Java
|
[] | null |
[] |
package src.dominio;
import java.io.Serializable;
import java.math.BigInteger;
public class Nota implements Serializable {
private static final long serialVersionUID = 1L;
private Estudante estudante;
private double notaDoAluno;
public Nota(Estudante estudante, double nota){
this.estudante = estudante;
this.notaDoAluno = nota;
}
public Estudante getEstudante() {
return this.estudante;
}
public double getNotaDoAluno() {
return this.notaDoAluno;
}
public BigInteger getMatricula(){
return this.estudante.verMatricula();
}
}
| 622 | 0.678457 | 0.676849 | 29 | 20.448277 | 17.839487 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413793 | false | false |
0
|
2eef95d9e82ecd9df52c4d187f35da889585345f
| 23,424,751,679,513 |
01056e07317bf3502321ea4cc06e97e9473054e1
|
/trfc-api/src/main/java/com/tianrui/api/intf/basicFile/measure/IBlacklistManageService.java
|
04f1f4d292dd310cd2a537c589ad446ed7958cc3
|
[] |
no_license
|
xiaochen9/trfc
|
https://github.com/xiaochen9/trfc
|
084839511529ef2f3674a752415dd3c54df999ed
|
38f33089edc4cde4c724668910f9b98daff4a9b9
|
refs/heads/master
| 2021-03-16T10:24:11.668000 | 2018-01-05T04:09:43 | 2018-01-05T04:09:43 | 115,378,363 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tianrui.api.intf.basicFile.measure;
import com.tianrui.api.req.basicFile.measure.BlacklistManageQuery;
import com.tianrui.api.req.basicFile.measure.BlacklistManageSave;
import com.tianrui.api.resp.basicFile.measure.BlacklistResp;
import com.tianrui.smartfactory.common.vo.PaginationVO;
import com.tianrui.smartfactory.common.vo.Result;
/**
* 车辆黑名单Service接口
* @author MaoZhenYu
* @param <HttpServletRequest>
* @classname IYardManageService.java
*/
public interface IBlacklistManageService {
/**
* 分页查询数据
* @param query
* @return
* @throws Exception
*/
PaginationVO<BlacklistResp> page(BlacklistManageQuery query) throws Exception;
/**
* 添加车辆黑名单展示信息
* @param query
* @return
* @throws Exception
*/
Result add(BlacklistManageSave save) throws Exception;
/**
* 删除车辆黑名单信息(物理删除)
* @param query
* @return
*/
Result del(BlacklistManageQuery query);
int deleteBlacklist(String id);
}
|
UTF-8
|
Java
| 1,013 |
java
|
IBlacklistManageService.java
|
Java
|
[
{
"context": "ommon.vo.Result;\n\n/**\n * 车辆黑名单Service接口\n * @author MaoZhenYu\n * @param <HttpServletRequest>\n * @classname IYar",
"end": 392,
"score": 0.9383354187011719,
"start": 383,
"tag": "NAME",
"value": "MaoZhenYu"
}
] | null |
[] |
package com.tianrui.api.intf.basicFile.measure;
import com.tianrui.api.req.basicFile.measure.BlacklistManageQuery;
import com.tianrui.api.req.basicFile.measure.BlacklistManageSave;
import com.tianrui.api.resp.basicFile.measure.BlacklistResp;
import com.tianrui.smartfactory.common.vo.PaginationVO;
import com.tianrui.smartfactory.common.vo.Result;
/**
* 车辆黑名单Service接口
* @author MaoZhenYu
* @param <HttpServletRequest>
* @classname IYardManageService.java
*/
public interface IBlacklistManageService {
/**
* 分页查询数据
* @param query
* @return
* @throws Exception
*/
PaginationVO<BlacklistResp> page(BlacklistManageQuery query) throws Exception;
/**
* 添加车辆黑名单展示信息
* @param query
* @return
* @throws Exception
*/
Result add(BlacklistManageSave save) throws Exception;
/**
* 删除车辆黑名单信息(物理删除)
* @param query
* @return
*/
Result del(BlacklistManageQuery query);
int deleteBlacklist(String id);
}
| 1,013 | 0.747604 | 0.747604 | 40 | 22.5 | 22.071474 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
0
|
9540b98a4b928a5c4ee56b0fe44803f9a1c8201f
| 21,869,973,496,800 |
435196c47097c51266e253c124a2da34a9442ee8
|
/retail-code/src/main/java/com/wisrc/code/webapp/controller/CodeCommonStatusAttrController.java
|
79a8c11066c150574cd6a73af4d1ec6171682478
|
[] |
no_license
|
hzwy23/wisrc
|
https://github.com/hzwy23/wisrc
|
87b6bb034375ddbd0f342556c20440f52b87effe
|
94e3403ae4d2f693bf2b10616517491350c2d617
|
refs/heads/master
| 2022-12-28T03:12:09.254000 | 2020-10-11T13:19:05 | 2020-10-11T13:19:05 | 297,698,891 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wisrc.code.webapp.controller;
import com.wisrc.code.webapp.service.CodeCommonStatusAttrService;
import com.wisrc.code.webapp.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Api(tags = "公共状态码表")
@RequestMapping(value = "/code")
public class CodeCommonStatusAttrController {
private final Logger logger = LoggerFactory.getLogger(CodeCommonStatusAttrController.class);
@Autowired
private CodeCommonStatusAttrService codeCommonStatusAttrService;
@ApiOperation(value = "查询所有信息", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr", method = RequestMethod.GET)
public Result findAll() {
return codeCommonStatusAttrService.findAll();
}
@ApiImplicitParams({
@ApiImplicitParam(name = "statusCd", value = "状态码", paramType = "query", dataType = "int", required = true),
@ApiImplicitParam(name = "statusDesc", value = "状态描述", paramType = "query", dataType = "String", required = true),
})
@ApiOperation(value = "新增", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr", method = RequestMethod.POST)
public Result insert(@RequestParam("statusCd") Integer statusCd, @RequestParam("statusDesc") String statusDesc) {
return codeCommonStatusAttrService.insert(statusCd, statusDesc);
}
@ApiImplicitParams({
@ApiImplicitParam(name = "statusCd", value = "状态码", paramType = "query", dataType = "int", required = true),
@ApiImplicitParam(name = "statusDesc", value = "状态描述", paramType = "query", dataType = "String", required = true),
})
@ApiOperation(value = "编辑", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr", method = RequestMethod.PUT)
public Result update(@RequestParam("statusCd") Integer statusCd, @RequestParam("statusDesc") String statusDesc) {
return codeCommonStatusAttrService.update(statusCd, statusDesc);
}
@ApiImplicitParams({
@ApiImplicitParam(name = "statusCd", value = "状态码", paramType = "path", dataType = "int", required = true),
})
@ApiOperation(value = "删除", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr/{statusCd}", method = RequestMethod.DELETE)
public Result delete(@PathVariable("statusCd") Integer statusCd) {
return codeCommonStatusAttrService.delete(statusCd);
}
}
|
UTF-8
|
Java
| 2,731 |
java
|
CodeCommonStatusAttrController.java
|
Java
|
[] | null |
[] |
package com.wisrc.code.webapp.controller;
import com.wisrc.code.webapp.service.CodeCommonStatusAttrService;
import com.wisrc.code.webapp.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Api(tags = "公共状态码表")
@RequestMapping(value = "/code")
public class CodeCommonStatusAttrController {
private final Logger logger = LoggerFactory.getLogger(CodeCommonStatusAttrController.class);
@Autowired
private CodeCommonStatusAttrService codeCommonStatusAttrService;
@ApiOperation(value = "查询所有信息", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr", method = RequestMethod.GET)
public Result findAll() {
return codeCommonStatusAttrService.findAll();
}
@ApiImplicitParams({
@ApiImplicitParam(name = "statusCd", value = "状态码", paramType = "query", dataType = "int", required = true),
@ApiImplicitParam(name = "statusDesc", value = "状态描述", paramType = "query", dataType = "String", required = true),
})
@ApiOperation(value = "新增", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr", method = RequestMethod.POST)
public Result insert(@RequestParam("statusCd") Integer statusCd, @RequestParam("statusDesc") String statusDesc) {
return codeCommonStatusAttrService.insert(statusCd, statusDesc);
}
@ApiImplicitParams({
@ApiImplicitParam(name = "statusCd", value = "状态码", paramType = "query", dataType = "int", required = true),
@ApiImplicitParam(name = "statusDesc", value = "状态描述", paramType = "query", dataType = "String", required = true),
})
@ApiOperation(value = "编辑", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr", method = RequestMethod.PUT)
public Result update(@RequestParam("statusCd") Integer statusCd, @RequestParam("statusDesc") String statusDesc) {
return codeCommonStatusAttrService.update(statusCd, statusDesc);
}
@ApiImplicitParams({
@ApiImplicitParam(name = "statusCd", value = "状态码", paramType = "path", dataType = "int", required = true),
})
@ApiOperation(value = "删除", notes = "")
@RequestMapping(value = "/codeCommonStatusAttr/{statusCd}", method = RequestMethod.DELETE)
public Result delete(@PathVariable("statusCd") Integer statusCd) {
return codeCommonStatusAttrService.delete(statusCd);
}
}
| 2,731 | 0.715145 | 0.714393 | 61 | 42.622952 | 38.91991 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.885246 | false | false |
0
|
3dcdb0266e54c8c81ad04b1428827ae6fd9a03df
| 30,709,016,191,381 |
7e2f4d95c0373fd928ec4216a2f781458153e588
|
/android-common/src/main/java/cn/guolf/android/common/exception/CrashHandler.java
|
94aeeca03169307db8be633b8eabaf01489e160e
|
[] |
no_license
|
guolf/guolf-android-common
|
https://github.com/guolf/guolf-android-common
|
b479f79a9953154c99c2379bc38743ca20d61afe
|
4527d3136502f57d27f6f60cb6113e9069ff93ed
|
refs/heads/master
| 2021-01-21T21:54:22.362000 | 2019-09-29T02:25:29 | 2019-09-29T02:25:29 | 42,783,600 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.guolf.android.common.exception;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.os.Looper;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Date;
import cn.guolf.android.common.util.AppUtils;
import cn.guolf.android.common.util.log.LogUtils;
/**
* Author:guolf on 9/19/15 15:41
* Email :guo@guolingfa.cn
*/
public class CrashHandler implements Thread.UncaughtExceptionHandler {
private static CrashHandler INSTANCE;
private Context mContext;
private Thread.UncaughtExceptionHandler mDefaultHandler;
private String logPath = Environment.getExternalStorageDirectory().getPath();
public static CrashHandler getInstance() {
if (INSTANCE == null) {
INSTANCE = new CrashHandler();
}
return INSTANCE;
}
@Override
public void uncaughtException(Thread thread, Throwable ex) {
LogUtils.e("app crash:" + ex.toString());
if (!handleException(ex) && mDefaultHandler != null) {
// 如果用户没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
try {
Thread.sleep(3000);
} catch (Exception ex2) {
} finally {
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
}
}
}
/**
* 自定义异常处理
*
* @param ex
*/
private boolean handleException(final Throwable ex) {
if (ex == null) {
return false;
}
new Thread() {
@Override
public void run() {
Looper.prepare();
Toast.makeText(mContext, "程序出现异常,即将关闭该页面,请联系我们,我们会尽快处理,给你带来的不便请原谅!", Toast.LENGTH_LONG).show();
saveExection(ex);
Looper.loop();
}
}.start();
return true;
}
public void init(Context ctx) {
mContext = ctx;
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
}
public String getPhoneInfo() {
StringBuilder result = new StringBuilder();
result.append("VersionCode=").append(AppUtils.getVerCode(mContext)).append('\n');
result.append("VersionName=").append(AppUtils.getVerName(mContext)).append('\n');
result.append("BOARD=").append(Build.BOARD).append('\n');
result.append("BRAND=").append(Build.BRAND).append('\n');
result.append("CPU_ABI=").append(Build.CPU_ABI).append('\n');
result.append("DEVICE=").append(Build.DEVICE).append('\n');
result.append("DISPLAY=").append(Build.DISPLAY).append('\n');
result.append("FINGERPRINT=").append(Build.FINGERPRINT).append('\n');
result.append("HOST=").append(Build.HOST).append('\n');
result.append("ID=").append(Build.ID).append('\n');
result.append("MANUFACTURER=").append(Build.MANUFACTURER).append('\n');
result.append("MODEL=").append(Build.MODEL).append('\n');
result.append("PRODUCT=").append(Build.PRODUCT).append('\n');
result.append("TAGS=").append(Build.TAGS).append('\n');
result.append("TIME=").append(Build.TIME).append('\n');
result.append("TYPE=").append(Build.TYPE).append('\n');
result.append("USER=").append(Build.USER).append('\n');
result.append("VERSION.CODENAME=").append(Build.VERSION.CODENAME).append('\n');
result.append("VERSION.INCREMENTAL=").append(Build.VERSION.INCREMENTAL).append('\n');
result.append("VERSION.RELEASE=").append(Build.VERSION.RELEASE).append('\n');
result.append("VERSION.SDK_INT=").append(Build.VERSION.SDK_INT).append('\n');
return result.toString();
}
/**
* 保存捕获的异常
*
* @param ex
*/
public void saveExection(Throwable ex) {
String msg = ex.getLocalizedMessage();
String fileName = "crash-" + new Date().getTime() + ".txt";
File file = new File(getLogPath() + "/log");
if (!file.exists()) {
file.mkdirs();
}
File file1 = new File(file, fileName);
try {
FileOutputStream fos = new FileOutputStream(file1, true);
fos.write(getPhoneInfo().getBytes());
LogUtils.e(getPhoneInfo());
fos.write(msg.getBytes());
for (int i = 0; i < ex.getStackTrace().length; i++) {
String detail = ex.getStackTrace()[i].toString();
LogUtils.e(detail);
fos.write(detail.getBytes());
}
fos.flush();
fos.close();
} catch (Exception e) {
LogUtils.e(e);
}
}
public String getLogPath() {
return logPath;
}
public void setLogPath(String logPath) {
this.logPath = logPath;
}
}
|
UTF-8
|
Java
| 5,098 |
java
|
CrashHandler.java
|
Java
|
[
{
"context": ".android.common.util.log.LogUtils;\n\n/**\n * Author:guolf on 9/19/15 15:41\n * Email :guo@guolingfa.cn\n */\np",
"end": 382,
"score": 0.9996474981307983,
"start": 377,
"tag": "USERNAME",
"value": "guolf"
},
{
"context": ";\n\n/**\n * Author:guolf on 9/19/15 15:41\n * Email :guo@guolingfa.cn\n */\npublic class CrashHandler implements Thread.U",
"end": 426,
"score": 0.9999280571937561,
"start": 410,
"tag": "EMAIL",
"value": "guo@guolingfa.cn"
}
] | null |
[] |
package cn.guolf.android.common.exception;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.os.Looper;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Date;
import cn.guolf.android.common.util.AppUtils;
import cn.guolf.android.common.util.log.LogUtils;
/**
* Author:guolf on 9/19/15 15:41
* Email :<EMAIL>
*/
public class CrashHandler implements Thread.UncaughtExceptionHandler {
private static CrashHandler INSTANCE;
private Context mContext;
private Thread.UncaughtExceptionHandler mDefaultHandler;
private String logPath = Environment.getExternalStorageDirectory().getPath();
public static CrashHandler getInstance() {
if (INSTANCE == null) {
INSTANCE = new CrashHandler();
}
return INSTANCE;
}
@Override
public void uncaughtException(Thread thread, Throwable ex) {
LogUtils.e("app crash:" + ex.toString());
if (!handleException(ex) && mDefaultHandler != null) {
// 如果用户没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
try {
Thread.sleep(3000);
} catch (Exception ex2) {
} finally {
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
}
}
}
/**
* 自定义异常处理
*
* @param ex
*/
private boolean handleException(final Throwable ex) {
if (ex == null) {
return false;
}
new Thread() {
@Override
public void run() {
Looper.prepare();
Toast.makeText(mContext, "程序出现异常,即将关闭该页面,请联系我们,我们会尽快处理,给你带来的不便请原谅!", Toast.LENGTH_LONG).show();
saveExection(ex);
Looper.loop();
}
}.start();
return true;
}
public void init(Context ctx) {
mContext = ctx;
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
}
public String getPhoneInfo() {
StringBuilder result = new StringBuilder();
result.append("VersionCode=").append(AppUtils.getVerCode(mContext)).append('\n');
result.append("VersionName=").append(AppUtils.getVerName(mContext)).append('\n');
result.append("BOARD=").append(Build.BOARD).append('\n');
result.append("BRAND=").append(Build.BRAND).append('\n');
result.append("CPU_ABI=").append(Build.CPU_ABI).append('\n');
result.append("DEVICE=").append(Build.DEVICE).append('\n');
result.append("DISPLAY=").append(Build.DISPLAY).append('\n');
result.append("FINGERPRINT=").append(Build.FINGERPRINT).append('\n');
result.append("HOST=").append(Build.HOST).append('\n');
result.append("ID=").append(Build.ID).append('\n');
result.append("MANUFACTURER=").append(Build.MANUFACTURER).append('\n');
result.append("MODEL=").append(Build.MODEL).append('\n');
result.append("PRODUCT=").append(Build.PRODUCT).append('\n');
result.append("TAGS=").append(Build.TAGS).append('\n');
result.append("TIME=").append(Build.TIME).append('\n');
result.append("TYPE=").append(Build.TYPE).append('\n');
result.append("USER=").append(Build.USER).append('\n');
result.append("VERSION.CODENAME=").append(Build.VERSION.CODENAME).append('\n');
result.append("VERSION.INCREMENTAL=").append(Build.VERSION.INCREMENTAL).append('\n');
result.append("VERSION.RELEASE=").append(Build.VERSION.RELEASE).append('\n');
result.append("VERSION.SDK_INT=").append(Build.VERSION.SDK_INT).append('\n');
return result.toString();
}
/**
* 保存捕获的异常
*
* @param ex
*/
public void saveExection(Throwable ex) {
String msg = ex.getLocalizedMessage();
String fileName = "crash-" + new Date().getTime() + ".txt";
File file = new File(getLogPath() + "/log");
if (!file.exists()) {
file.mkdirs();
}
File file1 = new File(file, fileName);
try {
FileOutputStream fos = new FileOutputStream(file1, true);
fos.write(getPhoneInfo().getBytes());
LogUtils.e(getPhoneInfo());
fos.write(msg.getBytes());
for (int i = 0; i < ex.getStackTrace().length; i++) {
String detail = ex.getStackTrace()[i].toString();
LogUtils.e(detail);
fos.write(detail.getBytes());
}
fos.flush();
fos.close();
} catch (Exception e) {
LogUtils.e(e);
}
}
public String getLogPath() {
return logPath;
}
public void setLogPath(String logPath) {
this.logPath = logPath;
}
}
| 5,089 | 0.590744 | 0.586904 | 150 | 31.986666 | 26.560619 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.56 | false | false |
0
|
c861db132054d7252fc10225318fbb34dbcacbef
| 8,263,517,106,426 |
7d2fae259c5ccbe5d399bddad5279ac513af5a35
|
/JavaJdbcLabAssignment/src/com/cg/mms/presentation/InsertMobile.java
|
24dd32bcb999edde47a3b9c5c08c53b206b43566
|
[] |
no_license
|
Surya0505/assignment_mobile
|
https://github.com/Surya0505/assignment_mobile
|
d166d0212e44a6f42134a2ba0af492be8be09839
|
03b27bb6998bcc6399199d4befed0bc90fb738f5
|
refs/heads/master
| 2020-04-17T04:23:39.894000 | 2019-01-17T13:33:18 | 2019-01-17T13:33:18 | 166,227,986 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cg.mms.presentation;
import java.util.Arrays;
import java.util.Scanner;
import com.cg.mms.exceptions.MMSException;
import com.cg.mms.model.Mobiles;
import com.cg.mms.service.MobileService;
import com.cg.mms.service.MobileServiceImpl;
public class InsertMobile {
public static void main(String[] args) {
MobileService service=new MobileServiceImpl();
Scanner scanner=new Scanner(System.in);
System.out.println("Enter mobile id");
Integer id=scanner.nextInt();
scanner.nextLine();
System.out.println("Enter name of the mobile");
String name=scanner.nextLine();
System.out.println("Enter price of the mobile");
Double price=scanner.nextDouble();
System.out.println("Enter quantity");
Integer quantity=scanner.nextInt();
if(quantity<=0)
{
System.out.println("Quantity should be greater than zero");
}else
{
Mobiles mobiles=new Mobiles();
mobiles.setMobileId(id);
mobiles.setName(name);
mobiles.setPrice(price);
mobiles.setQuantity(quantity);
try {
int result=service.insertMobileData(mobiles);
System.out.println(result+"inserted");
} catch (MMSException e) {
System.out.println(e.getMessage());
}
}
// try {
// service.createTable();
// } catch (MMSException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
|
UTF-8
|
Java
| 1,429 |
java
|
InsertMobile.java
|
Java
|
[] | null |
[] |
package com.cg.mms.presentation;
import java.util.Arrays;
import java.util.Scanner;
import com.cg.mms.exceptions.MMSException;
import com.cg.mms.model.Mobiles;
import com.cg.mms.service.MobileService;
import com.cg.mms.service.MobileServiceImpl;
public class InsertMobile {
public static void main(String[] args) {
MobileService service=new MobileServiceImpl();
Scanner scanner=new Scanner(System.in);
System.out.println("Enter mobile id");
Integer id=scanner.nextInt();
scanner.nextLine();
System.out.println("Enter name of the mobile");
String name=scanner.nextLine();
System.out.println("Enter price of the mobile");
Double price=scanner.nextDouble();
System.out.println("Enter quantity");
Integer quantity=scanner.nextInt();
if(quantity<=0)
{
System.out.println("Quantity should be greater than zero");
}else
{
Mobiles mobiles=new Mobiles();
mobiles.setMobileId(id);
mobiles.setName(name);
mobiles.setPrice(price);
mobiles.setQuantity(quantity);
try {
int result=service.insertMobileData(mobiles);
System.out.println(result+"inserted");
} catch (MMSException e) {
System.out.println(e.getMessage());
}
}
// try {
// service.createTable();
// } catch (MMSException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
| 1,429 | 0.662701 | 0.662001 | 64 | 20.328125 | 17.829973 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.984375 | false | false |
0
|
aad84c390294887e1753419bdb937d724a43fa2c
| 12,008,728,572,373 |
c6b5630f79d02db9afafd75944febea38b67e723
|
/src/main/java/com/bmwmms/factory/EntityManagerProvider.java
|
454e648226d7d6192ea7b51d5aec93a94bc86476
|
[] |
no_license
|
huberyWei/simple-service-webapp
|
https://github.com/huberyWei/simple-service-webapp
|
ca53a1b289bffd39c55275725253a6d21f35f98d
|
cfff3c42b1e2768e15c9fbf53a69a210e3f218cd
|
refs/heads/master
| 2021-01-10T23:48:18.953000 | 2016-10-13T10:09:04 | 2016-10-13T10:09:04 | 70,793,625 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bmwmms.factory;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class EntityManagerProvider {
private static final EntityManagerFactory factory =
Persistence.createEntityManagerFactory("simple-service-webapp");
@Produces
EntityManager createEntityManager() {
EntityManager entityManager = factory.createEntityManager();
return entityManager;
}
public void close(@Disposes EntityManager em) {
if(em.isOpen()) em.close();
}
public static EntityManagerFactory getFactory() {
return factory;
}
}
|
UTF-8
|
Java
| 704 |
java
|
EntityManagerProvider.java
|
Java
|
[] | null |
[] |
package com.bmwmms.factory;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class EntityManagerProvider {
private static final EntityManagerFactory factory =
Persistence.createEntityManagerFactory("simple-service-webapp");
@Produces
EntityManager createEntityManager() {
EntityManager entityManager = factory.createEntityManager();
return entityManager;
}
public void close(@Disposes EntityManager em) {
if(em.isOpen()) em.close();
}
public static EntityManagerFactory getFactory() {
return factory;
}
}
| 704 | 0.791193 | 0.791193 | 28 | 24.142857 | 21.622929 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.178571 | false | false |
0
|
9330ce04c1ae02e68e43c31e4b27bd4486e2d851
| 17,626,545,793,680 |
732182a102a07211f7c1106a1b8f409323e607e0
|
/serviced/externs/cfg/active/FindBackFreeTime.java
|
49d92bd6011a0fc5fc4c1292d13e704e9c7758ae
|
[] |
no_license
|
BanyLee/QYZ_Server
|
https://github.com/BanyLee/QYZ_Server
|
a67df7e7b4ec021d0aaa41cfc7f3bd8c7f1af3da
|
0eeb0eb70e9e9a1a06306ba4f08267af142957de
|
refs/heads/master
| 2021-09-13T22:32:27.563000 | 2018-05-05T09:20:55 | 2018-05-05T09:20:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cfg.active;
public final class FindBackFreeTime extends cfg.CfgObject {
public final static int TYPEID = 1366420535;
final public int getTypeId() { return TYPEID; }
public final java.util.List<cfg.common.DateTimeRange> time = new java.util.ArrayList<>();
public FindBackFreeTime(cfg.DataStream fs) {
for(int n = fs.getInt(); n-- > 0 ; ) {
this.time.add(new cfg.common.DateTimeRange(fs));
}
}
}
|
UTF-8
|
Java
| 413 |
java
|
FindBackFreeTime.java
|
Java
|
[] | null |
[] |
package cfg.active;
public final class FindBackFreeTime extends cfg.CfgObject {
public final static int TYPEID = 1366420535;
final public int getTypeId() { return TYPEID; }
public final java.util.List<cfg.common.DateTimeRange> time = new java.util.ArrayList<>();
public FindBackFreeTime(cfg.DataStream fs) {
for(int n = fs.getInt(); n-- > 0 ; ) {
this.time.add(new cfg.common.DateTimeRange(fs));
}
}
}
| 413 | 0.723971 | 0.697337 | 11 | 36.636364 | 26.537359 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.727273 | false | false |
0
|
9f991dc27e445766d43f48837db309bfebab148d
| 25,967,372,300,247 |
747360daddddf6d6be6ebd5efbaa867388bc225a
|
/chartlib/src/main/java/com/me/chartlib/view/PointView.java
|
22631db104af26e6c44b6ed4677eb5dd8910c672
|
[] |
no_license
|
dongwang8688/MEChartLib
|
https://github.com/dongwang8688/MEChartLib
|
778ca6a54833a9da504d6c61d59a20882a39fea9
|
5d482d75fc7b7b4f5c0000ff6648b2318b5d2b9f
|
refs/heads/master
| 2020-08-27T06:35:18.974000 | 2019-10-28T07:18:13 | 2019-10-28T07:18:13 | 217,271,862 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.me.chartlib.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import com.me.chartlib.R;
import com.me.chartlib.bean.PointsModel;
import com.me.chartlib.callback.PointViewDataCallBack;
import java.text.DecimalFormat;
import java.util.ArrayList;
/**
* <pre>
* author : me
* time : 2018/01/28
* desc : draw point at view
* version: 1.0
* </pre>
*/
public class PointView extends View implements PointViewDataCallBack {
private Paint mCirclePaint;//画圆的画笔
private Paint mLinePaint; //画直线的画笔;
private Paint mTextPaint;//写文字的画笔;
private Paint mPointPaint;//画点的画笔;
private int Viewwidth;//获取控件的宽
private int Viewheight;//获取空间的高
private int border;//设置边距
private int outradius;//外圆半径
private int medradius;//中间圆半径
private int inradius;//内圆半径
private Context mContext;
private int max_r = 5; //设置全局变量;
private double timesFlag = 1;
private double multipleFlag = 1;
private double one = 5;
private double two = 10;
private double three = 15;
private int pointWidth = 10;
//设置坐标原点为xyz的初始值;
private int x0;
private int y0;
private float textSize = getResources().getDimension(R.dimen.sp_8);
private float lineWidth = getResources().getDimension(R.dimen.dp_1);
private int textColor = Color.WHITE;
private int pointColor = Color.WHITE;
private int lineColor = Color.WHITE;
private String markTag = "m";
private boolean isSetColor = true;
private ArrayList<PointsModel> pointsModels = new ArrayList<>();
public PointView(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs);
}
public void init(AttributeSet attrs) {
//画圆的画笔
mCirclePaint = new Paint();
mCirclePaint.setAntiAlias(true);
mCirclePaint.setStyle(Paint.Style.STROKE);
//画直线的画笔
mLinePaint = new Paint();
mLinePaint.setAntiAlias(true);
mLinePaint.setStyle(Paint.Style.STROKE);
//写文字的画笔
mTextPaint = new Paint();
mTextPaint.setAntiAlias(true);
//画点的画笔(需要区别不同的服务,描出的点不一样)
mPointPaint = new Paint();
mPointPaint.setAntiAlias(true);
mPointPaint.setStrokeCap(Paint.Cap.ROUND);
border = (int) getResources().getDimension(R.dimen.activity_horizontal_margin);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
drawCircleAndLines(canvas);
initPointData(pointsModels, canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
Viewwidth = getMeasuredWidth();
Viewheight = getMeasuredHeight();
x0 = Viewwidth / 2;
y0 = Viewheight / 2;
}
//画圆坐标系
public void drawCircleAndLines(Canvas canvas) {
//自定义view到大控件边框的距离;
int innerspace = (int) getResources().getDimension(R.dimen.view_spacing);
//big circle radius;
inradius = (y0 - innerspace) / 3;
medradius = inradius * 2;
outradius = inradius * 3;
mCirclePaint.setColor(lineColor);
mCirclePaint.setStrokeWidth(lineWidth);
mLinePaint.setColor(lineColor);
mLinePaint.setStrokeWidth(lineWidth);
mTextPaint.setTextSize(textSize);
mTextPaint.setColor(textColor);
mPointPaint.setStrokeWidth(pointWidth);
mPointPaint.setColor(pointColor);
//画外圆
canvas.drawCircle(x0, y0, outradius, mCirclePaint);
//外圆精度
canvas.drawText(multipleFlag * three + markTag, x0 + outradius - 2 * innerspace,
y0 + 2 * innerspace, mTextPaint);
//画中间圆
canvas.drawCircle(x0, y0, medradius, mCirclePaint);
//中间圆精度
canvas.drawText(multipleFlag * two + markTag, x0 + medradius - 2 * innerspace,
y0 + 2 * innerspace, mTextPaint);
//画里面圆
canvas.drawCircle(x0, y0, inradius, mCirclePaint);
//里面圆精度
canvas.drawText(multipleFlag * one + markTag, x0 + inradius - 2 * innerspace,
y0 + 2 * innerspace, mTextPaint);
//画x
canvas.drawLine(x0 - outradius, y0,x0 + outradius, y0, mLinePaint);
//画y
canvas.drawLine(x0, y0 - outradius, x0, y0 + outradius, mLinePaint);
}
//画点
public void drawPoints(Canvas canvas, float x, float y) {
canvas.drawPoint(x, y, mPointPaint);
}
@Override
public void setPointViewData(ArrayList<PointsModel> pointsModel) {
this.pointsModels = pointsModel;
invalidate();
}
//坐标计算-画点将数据计算放到界面拿到数据的地方,view中只进行绘制操作
private void initPointData(ArrayList<PointsModel> pointsModel, Canvas canvas) {
if (pointsModel.size() > 0) {
for (int i = 0; i < pointsModel.size(); i++) {
PointsModel point = pointsModel.get(i);
if(isSetColor){
mPointPaint.setColor(pointColor);
}else {
if (1 == point.getService_type()) {
mPointPaint.setColor(Color.GREEN);
} else if (2 == point.getService_type()) {
mPointPaint.setColor(getResources().getColor(R.color.brown_f5a623));
} else {
mPointPaint.setColor(Color.RED);
}
}
//保证点可以落在圆内;
int Viewrads = (int) (0.9 * outradius);//outradius0.95
//如果半径值大于10000则数据无效,画点时应剔除
if(point.caculatR > 10000)
break;
//如果计算的半径值大于最大半径,更新值
if (max_r < point.caculatR) {
calculateDial(point.caculatR);
max_r = (int) point.caculatR;
//在屏幕上的半径
int viewx = (int) ((int) (timesFlag * point.enu[0] * Viewrads / max_r + x0));
int viewy = (int) ((int) (timesFlag * point.enu[1] * Viewrads / max_r + y0));
if (point.getIsShowFlag()) {
drawPoints(canvas, viewx, viewy);
}
} else {
//在屏幕上的半径
int viewx = (int) ((int) (timesFlag * point.enu[0] * Viewrads / max_r + x0));
int viewy = (int) ((int) (timesFlag * point.enu[1] * Viewrads / max_r + y0));
if (point.getIsShowFlag()) {
drawPoints(canvas, viewx, viewy);
}
}
}
}
}
// 计算动态变化的圆环半径
private void calculateDial(double maxR){
one = Math.ceil(maxR / 3 / 1000000);
two = one * 2;
three = one * 3;
}
//放大比例
public void setZoomOut() {
//显示少点
timesFlag = Double.parseDouble(new DecimalFormat("#.00").format(timesFlag * 2));
multipleFlag = multipleFlag / 2;
invalidate();
}
//缩小比例
public void setZoomIn() {
//有更多的点
multipleFlag = multipleFlag * 2;
timesFlag = Double.parseDouble(new DecimalFormat("#.00").format(timesFlag / 2));
invalidate();
}
public void setPointWidth(int pointWidth) {
this.pointWidth = pointWidth;
}
public void setTextSize(float textSize) {
this.textSize = textSize;
}
public void setLineWidth(float lineWidth) {
this.lineWidth = lineWidth;
}
public void setTextColor(int textColor) {
this.textColor = textColor;
}
public void setPointColor(int pointColor) {
this.pointColor = pointColor;
}
public void setLineColor(int lineColor) {
this.lineColor = lineColor;
}
public void setMarkTag(String markTag) {
this.markTag = markTag;
}
public void setSetColor(boolean setColor) {
isSetColor = setColor;
}
}
|
UTF-8
|
Java
| 8,602 |
java
|
PointView.java
|
Java
|
[
{
"context": "java.util.ArrayList;\n\n/**\n * <pre>\n * author : me\n * time : 2018/01/28\n * desc : draw p",
"end": 433,
"score": 0.9973225593566895,
"start": 431,
"tag": "USERNAME",
"value": "me"
}
] | null |
[] |
package com.me.chartlib.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import com.me.chartlib.R;
import com.me.chartlib.bean.PointsModel;
import com.me.chartlib.callback.PointViewDataCallBack;
import java.text.DecimalFormat;
import java.util.ArrayList;
/**
* <pre>
* author : me
* time : 2018/01/28
* desc : draw point at view
* version: 1.0
* </pre>
*/
public class PointView extends View implements PointViewDataCallBack {
private Paint mCirclePaint;//画圆的画笔
private Paint mLinePaint; //画直线的画笔;
private Paint mTextPaint;//写文字的画笔;
private Paint mPointPaint;//画点的画笔;
private int Viewwidth;//获取控件的宽
private int Viewheight;//获取空间的高
private int border;//设置边距
private int outradius;//外圆半径
private int medradius;//中间圆半径
private int inradius;//内圆半径
private Context mContext;
private int max_r = 5; //设置全局变量;
private double timesFlag = 1;
private double multipleFlag = 1;
private double one = 5;
private double two = 10;
private double three = 15;
private int pointWidth = 10;
//设置坐标原点为xyz的初始值;
private int x0;
private int y0;
private float textSize = getResources().getDimension(R.dimen.sp_8);
private float lineWidth = getResources().getDimension(R.dimen.dp_1);
private int textColor = Color.WHITE;
private int pointColor = Color.WHITE;
private int lineColor = Color.WHITE;
private String markTag = "m";
private boolean isSetColor = true;
private ArrayList<PointsModel> pointsModels = new ArrayList<>();
public PointView(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs);
}
public void init(AttributeSet attrs) {
//画圆的画笔
mCirclePaint = new Paint();
mCirclePaint.setAntiAlias(true);
mCirclePaint.setStyle(Paint.Style.STROKE);
//画直线的画笔
mLinePaint = new Paint();
mLinePaint.setAntiAlias(true);
mLinePaint.setStyle(Paint.Style.STROKE);
//写文字的画笔
mTextPaint = new Paint();
mTextPaint.setAntiAlias(true);
//画点的画笔(需要区别不同的服务,描出的点不一样)
mPointPaint = new Paint();
mPointPaint.setAntiAlias(true);
mPointPaint.setStrokeCap(Paint.Cap.ROUND);
border = (int) getResources().getDimension(R.dimen.activity_horizontal_margin);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
drawCircleAndLines(canvas);
initPointData(pointsModels, canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
Viewwidth = getMeasuredWidth();
Viewheight = getMeasuredHeight();
x0 = Viewwidth / 2;
y0 = Viewheight / 2;
}
//画圆坐标系
public void drawCircleAndLines(Canvas canvas) {
//自定义view到大控件边框的距离;
int innerspace = (int) getResources().getDimension(R.dimen.view_spacing);
//big circle radius;
inradius = (y0 - innerspace) / 3;
medradius = inradius * 2;
outradius = inradius * 3;
mCirclePaint.setColor(lineColor);
mCirclePaint.setStrokeWidth(lineWidth);
mLinePaint.setColor(lineColor);
mLinePaint.setStrokeWidth(lineWidth);
mTextPaint.setTextSize(textSize);
mTextPaint.setColor(textColor);
mPointPaint.setStrokeWidth(pointWidth);
mPointPaint.setColor(pointColor);
//画外圆
canvas.drawCircle(x0, y0, outradius, mCirclePaint);
//外圆精度
canvas.drawText(multipleFlag * three + markTag, x0 + outradius - 2 * innerspace,
y0 + 2 * innerspace, mTextPaint);
//画中间圆
canvas.drawCircle(x0, y0, medradius, mCirclePaint);
//中间圆精度
canvas.drawText(multipleFlag * two + markTag, x0 + medradius - 2 * innerspace,
y0 + 2 * innerspace, mTextPaint);
//画里面圆
canvas.drawCircle(x0, y0, inradius, mCirclePaint);
//里面圆精度
canvas.drawText(multipleFlag * one + markTag, x0 + inradius - 2 * innerspace,
y0 + 2 * innerspace, mTextPaint);
//画x
canvas.drawLine(x0 - outradius, y0,x0 + outradius, y0, mLinePaint);
//画y
canvas.drawLine(x0, y0 - outradius, x0, y0 + outradius, mLinePaint);
}
//画点
public void drawPoints(Canvas canvas, float x, float y) {
canvas.drawPoint(x, y, mPointPaint);
}
@Override
public void setPointViewData(ArrayList<PointsModel> pointsModel) {
this.pointsModels = pointsModel;
invalidate();
}
//坐标计算-画点将数据计算放到界面拿到数据的地方,view中只进行绘制操作
private void initPointData(ArrayList<PointsModel> pointsModel, Canvas canvas) {
if (pointsModel.size() > 0) {
for (int i = 0; i < pointsModel.size(); i++) {
PointsModel point = pointsModel.get(i);
if(isSetColor){
mPointPaint.setColor(pointColor);
}else {
if (1 == point.getService_type()) {
mPointPaint.setColor(Color.GREEN);
} else if (2 == point.getService_type()) {
mPointPaint.setColor(getResources().getColor(R.color.brown_f5a623));
} else {
mPointPaint.setColor(Color.RED);
}
}
//保证点可以落在圆内;
int Viewrads = (int) (0.9 * outradius);//outradius0.95
//如果半径值大于10000则数据无效,画点时应剔除
if(point.caculatR > 10000)
break;
//如果计算的半径值大于最大半径,更新值
if (max_r < point.caculatR) {
calculateDial(point.caculatR);
max_r = (int) point.caculatR;
//在屏幕上的半径
int viewx = (int) ((int) (timesFlag * point.enu[0] * Viewrads / max_r + x0));
int viewy = (int) ((int) (timesFlag * point.enu[1] * Viewrads / max_r + y0));
if (point.getIsShowFlag()) {
drawPoints(canvas, viewx, viewy);
}
} else {
//在屏幕上的半径
int viewx = (int) ((int) (timesFlag * point.enu[0] * Viewrads / max_r + x0));
int viewy = (int) ((int) (timesFlag * point.enu[1] * Viewrads / max_r + y0));
if (point.getIsShowFlag()) {
drawPoints(canvas, viewx, viewy);
}
}
}
}
}
// 计算动态变化的圆环半径
private void calculateDial(double maxR){
one = Math.ceil(maxR / 3 / 1000000);
two = one * 2;
three = one * 3;
}
//放大比例
public void setZoomOut() {
//显示少点
timesFlag = Double.parseDouble(new DecimalFormat("#.00").format(timesFlag * 2));
multipleFlag = multipleFlag / 2;
invalidate();
}
//缩小比例
public void setZoomIn() {
//有更多的点
multipleFlag = multipleFlag * 2;
timesFlag = Double.parseDouble(new DecimalFormat("#.00").format(timesFlag / 2));
invalidate();
}
public void setPointWidth(int pointWidth) {
this.pointWidth = pointWidth;
}
public void setTextSize(float textSize) {
this.textSize = textSize;
}
public void setLineWidth(float lineWidth) {
this.lineWidth = lineWidth;
}
public void setTextColor(int textColor) {
this.textColor = textColor;
}
public void setPointColor(int pointColor) {
this.pointColor = pointColor;
}
public void setLineColor(int lineColor) {
this.lineColor = lineColor;
}
public void setMarkTag(String markTag) {
this.markTag = markTag;
}
public void setSetColor(boolean setColor) {
isSetColor = setColor;
}
}
| 8,602 | 0.588447 | 0.575155 | 253 | 30.818182 | 23.624838 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.644269 | false | false |
0
|
c0fb37c8000273f3ee53adcafa67fa55d856e140
| 25,967,372,300,884 |
1c7f46e0a1b97e4e53183ea102dff4be688b28fd
|
/src/com/example/YuCeClient/ui/mine/ti_xian/TiXianItemView.java
|
ab5fe70cd3d30399f815f38c50f425940477f315
|
[] |
no_license
|
angrykobe/yuce
|
https://github.com/angrykobe/yuce
|
a99db685da89033e60138e67a0206d8b964087bc
|
870ca5154ffbaabc21ca7fff091132d67a1c8047
|
refs/heads/master
| 2021-08-26T09:44:30.726000 | 2016-04-17T03:32:03 | 2016-04-17T03:32:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.YuCeClient.ui.mine.ti_xian;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.YuCeClient.R;
/**
* Created by xiaoyu on 15-12-20.
*/
public class TiXianItemView extends FrameLayout {
private ImageView selectImageView;
private TextView cardAddress;
private TextView nameAndCardNum;
public TiXianModel tiXianModel;
private TiXianItemViewListener listener;
public interface TiXianItemViewListener{
public void onClickView(TiXianItemView itemView);
}
public TiXianItemView(Context context) {
super(context);
init(context);
}
public TiXianItemView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public TiXianItemView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
inflater.inflate(R.layout.tixian_item_view, this, true);
selectImageView = (ImageView) findViewById(R.id.selectImageView);
cardAddress = (TextView) findViewById(R.id.cardAddress);
nameAndCardNum = (TextView) findViewById(R.id.nameAndCardNum);
setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if(listener != null){
listener.onClickView(TiXianItemView.this);
}
}
});
}
public void setChoose(boolean choose){
selectImageView.setSelected(choose);
}
public void setData(TiXianModel tiXianModel,TiXianItemViewListener listener) {
this.tiXianModel = tiXianModel;
this.listener = listener;
if (tiXianModel == null) {
return;
}
selectImageView.setSelected(false);
cardAddress.setText(tiXianModel.cardaddress);
nameAndCardNum.setText(tiXianModel.realname + " " + tiXianModel.cardnum);
}
}
|
UTF-8
|
Java
| 1,985 |
java
|
TiXianItemView.java
|
Java
|
[
{
"context": "mport com.example.YuCeClient.R;\n\n/**\n * Created by xiaoyu on 15-12-20.\n */\npublic class TiXianItemView exte",
"end": 335,
"score": 0.9995489716529846,
"start": 329,
"tag": "USERNAME",
"value": "xiaoyu"
}
] | null |
[] |
package com.example.YuCeClient.ui.mine.ti_xian;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.YuCeClient.R;
/**
* Created by xiaoyu on 15-12-20.
*/
public class TiXianItemView extends FrameLayout {
private ImageView selectImageView;
private TextView cardAddress;
private TextView nameAndCardNum;
public TiXianModel tiXianModel;
private TiXianItemViewListener listener;
public interface TiXianItemViewListener{
public void onClickView(TiXianItemView itemView);
}
public TiXianItemView(Context context) {
super(context);
init(context);
}
public TiXianItemView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public TiXianItemView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
inflater.inflate(R.layout.tixian_item_view, this, true);
selectImageView = (ImageView) findViewById(R.id.selectImageView);
cardAddress = (TextView) findViewById(R.id.cardAddress);
nameAndCardNum = (TextView) findViewById(R.id.nameAndCardNum);
setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if(listener != null){
listener.onClickView(TiXianItemView.this);
}
}
});
}
public void setChoose(boolean choose){
selectImageView.setSelected(choose);
}
public void setData(TiXianModel tiXianModel,TiXianItemViewListener listener) {
this.tiXianModel = tiXianModel;
this.listener = listener;
if (tiXianModel == null) {
return;
}
selectImageView.setSelected(false);
cardAddress.setText(tiXianModel.cardaddress);
nameAndCardNum.setText(tiXianModel.realname + " " + tiXianModel.cardnum);
}
}
| 1,985 | 0.765743 | 0.76272 | 75 | 25.466667 | 22.409719 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.76 | false | false |
0
|
4fea808cd910f315a346a7db803047dba93aea99
| 27,479,200,785,612 |
5172974deb064500192a7a170eb578a100c2216c
|
/src/lesson18/ex1/CodeStorage.java
|
346ecf450c13b45eabfad71bd5b50803ba4df348
|
[] |
no_license
|
sofeeGud/java-core-grom
|
https://github.com/sofeeGud/java-core-grom
|
707ecf023a6a6f3db0c3dfdf8d47153b3c08a171
|
7b2f379e2175db9e8226b7000dd206b86cf0563d
|
refs/heads/master
| 2020-06-16T17:02:54.509000 | 2020-01-02T16:56:50 | 2020-01-02T16:56:50 | 195,293,508 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lesson18.ex1;
public class CodeStorage extends Storage{
}
|
UTF-8
|
Java
| 69 |
java
|
CodeStorage.java
|
Java
|
[] | null |
[] |
package lesson18.ex1;
public class CodeStorage extends Storage{
}
| 69 | 0.782609 | 0.73913 | 6 | 10.5 | 15.607157 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false |
0
|
4c5274681892d32e0bda30b851d94ac04b1a8234
| 27,401,891,405,883 |
471ada586c0f44cd56441a7bd4e55b1894a4f219
|
/src/java/info/woody/so/bean/RoleToPrivilegeBean.java
|
21ffe8bc81b2b6efb3ca0cff17cd7f5e3a814001
|
[] |
no_license
|
rcom10002/samb
|
https://github.com/rcom10002/samb
|
b43bee8675bb2481a1b2b61976052a31ec628e5d
|
83614682ae298a6d08243d26636c959dabe8c985
|
refs/heads/master
| 2021-01-25T06:00:42.134000 | 2015-02-27T00:05:18 | 2015-02-27T00:05:18 | 28,866,675 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package info.woody.so.bean;
public class RoleToPrivilegeBean extends BaseBean {
private int roleId ;
private int privilegeId ;
private int _privilegeId;
public int getRoleId() {
return roleId;
}
public int getPrivilegeId() {
return privilegeId;
}
public int get_privilegeId() {
return _privilegeId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public void setPrivilegeId(int privilegeId) {
this.privilegeId = privilegeId;
}
public void set_privilegeId(int _privilegeId) {
this._privilegeId = _privilegeId;
}
}
|
UTF-8
|
Java
| 561 |
java
|
RoleToPrivilegeBean.java
|
Java
|
[] | null |
[] |
package info.woody.so.bean;
public class RoleToPrivilegeBean extends BaseBean {
private int roleId ;
private int privilegeId ;
private int _privilegeId;
public int getRoleId() {
return roleId;
}
public int getPrivilegeId() {
return privilegeId;
}
public int get_privilegeId() {
return _privilegeId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public void setPrivilegeId(int privilegeId) {
this.privilegeId = privilegeId;
}
public void set_privilegeId(int _privilegeId) {
this._privilegeId = _privilegeId;
}
}
| 561 | 0.72549 | 0.72549 | 27 | 19.814816 | 16.110813 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.37037 | false | false |
0
|
4073ccea1f81fbf3ab7d4a7db1be2fc9f763e28b
| 35,862,976,925,321 |
c426f7b90138151ffeb50a0d2c0d631abeb466b6
|
/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/layer/relation/RelationEvent.java
|
2578b9d9caabbf051cce9b86d68012b9d242cdc2
|
[
"Apache-2.0"
] |
permissive
|
inception-project/inception
|
https://github.com/inception-project/inception
|
7a06b8cd1f8e6a7eb44ee69e842590cf2989df5f
|
ec95327e195ca461dd90c2761237f92a879a1e61
|
refs/heads/main
| 2023-09-02T07:52:53.578000 | 2023-09-02T07:44:11 | 2023-09-02T07:44:11 | 127,004,420 | 511 | 141 |
Apache-2.0
| false | 2023-09-13T19:09:49 | 2018-03-27T15:04:00 | 2023-09-12T12:46:44 | 2023-09-13T19:09:49 | 111,239 | 514 | 141 | 282 |
Java
| false | false |
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* 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 de.tudarmstadt.ukp.inception.annotation.layer.relation;
import org.apache.uima.cas.text.AnnotationFS;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.inception.annotation.events.AnnotationEvent;
import de.tudarmstadt.ukp.inception.rendering.model.Range;
public abstract class RelationEvent
extends AnnotationEvent
{
private static final long serialVersionUID = -8621413642390759892L;
private final AnnotationFS relation;
private final AnnotationFS targetAnno;
private final AnnotationFS sourceAnno;
public RelationEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer, AnnotationFS aRelationFS, AnnotationFS aTargetAnnotation,
AnnotationFS aSourceAnnotation)
{
super(aSource, aDocument, aDocumentOwner, aLayer);
relation = aRelationFS;
targetAnno = aTargetAnnotation;
sourceAnno = aSourceAnnotation;
}
public AnnotationFS getAnnotation()
{
return relation;
}
public AnnotationFS getTargetAnnotation()
{
return targetAnno;
}
public AnnotationFS getSourceAnnotation()
{
return sourceAnno;
}
@Override
public Range getAffectedRange()
{
return new Range( //
Math.min(sourceAnno.getBegin(), targetAnno.getBegin()),
Math.min(sourceAnno.getEnd(), targetAnno.getEnd()));
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append(getClass().getSimpleName());
builder.append(" [");
if (getDocument() != null) {
builder.append("docID=");
builder.append(getDocument());
builder.append(", docOwner=");
builder.append(getDocumentOwner());
builder.append(", ");
}
builder.append("relation=[");
builder.append(targetAnno.getBegin());
builder.append("-");
builder.append(targetAnno.getEnd());
builder.append("](");
builder.append(targetAnno.getCoveredText());
builder.append(") <-[");
builder.append(sourceAnno.getBegin());
builder.append("-");
builder.append(sourceAnno.getEnd());
builder.append("](");
builder.append(sourceAnno.getCoveredText());
builder.append(")]");
return builder.toString();
}
}
|
UTF-8
|
Java
| 3,319 |
java
|
RelationEvent.java
|
Java
|
[] | null |
[] |
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* 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 de.tudarmstadt.ukp.inception.annotation.layer.relation;
import org.apache.uima.cas.text.AnnotationFS;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.inception.annotation.events.AnnotationEvent;
import de.tudarmstadt.ukp.inception.rendering.model.Range;
public abstract class RelationEvent
extends AnnotationEvent
{
private static final long serialVersionUID = -8621413642390759892L;
private final AnnotationFS relation;
private final AnnotationFS targetAnno;
private final AnnotationFS sourceAnno;
public RelationEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer, AnnotationFS aRelationFS, AnnotationFS aTargetAnnotation,
AnnotationFS aSourceAnnotation)
{
super(aSource, aDocument, aDocumentOwner, aLayer);
relation = aRelationFS;
targetAnno = aTargetAnnotation;
sourceAnno = aSourceAnnotation;
}
public AnnotationFS getAnnotation()
{
return relation;
}
public AnnotationFS getTargetAnnotation()
{
return targetAnno;
}
public AnnotationFS getSourceAnnotation()
{
return sourceAnno;
}
@Override
public Range getAffectedRange()
{
return new Range( //
Math.min(sourceAnno.getBegin(), targetAnno.getBegin()),
Math.min(sourceAnno.getEnd(), targetAnno.getEnd()));
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append(getClass().getSimpleName());
builder.append(" [");
if (getDocument() != null) {
builder.append("docID=");
builder.append(getDocument());
builder.append(", docOwner=");
builder.append(getDocumentOwner());
builder.append(", ");
}
builder.append("relation=[");
builder.append(targetAnno.getBegin());
builder.append("-");
builder.append(targetAnno.getEnd());
builder.append("](");
builder.append(targetAnno.getCoveredText());
builder.append(") <-[");
builder.append(sourceAnno.getBegin());
builder.append("-");
builder.append(sourceAnno.getEnd());
builder.append("](");
builder.append(sourceAnno.getCoveredText());
builder.append(")]");
return builder.toString();
}
}
| 3,319 | 0.678927 | 0.671993 | 99 | 32.505051 | 24.867071 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.59596 | false | false |
0
|
cd1bb38871859d93f0a1c8e72004d36e3ccd3f53
| 30,099,130,823,574 |
4d0445782b13c20ce7aeaee06ed3aaecf56526be
|
/src/main/java/com/synerzip/TravelTimeApplication.java
|
1c71f5360a174003c70d6c6e6631c25ae7a5fcb7
|
[] |
no_license
|
sujithsudhakaran/TravelTime
|
https://github.com/sujithsudhakaran/TravelTime
|
4bab248c0663117240a6b94bd6174753f7578a84
|
b2cfdb8a50bec9d2f5b54f9168da6faa9b57dfd0
|
refs/heads/master
| 2021-01-22T16:54:15.177000 | 2016-07-19T12:30:35 | 2016-07-19T12:33:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.synerzip;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.client.RestTemplate;
import com.synerzip.infra.security.ApplicationSecurity;
@SpringBootApplication
@Configuration
@PropertySource("classpath:supplier.properties")
public class TravelTimeApplication {
@Bean
public WebSecurityConfigurerAdapter webSecurityConfigurerAdapter(){
return new ApplicationSecurity();
}
@Bean
public RestTemplate provideRestTemplate(){
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(TravelTimeApplication.class, args);
}
}
|
UTF-8
|
Java
| 973 |
java
|
TravelTimeApplication.java
|
Java
|
[] | null |
[] |
package com.synerzip;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.client.RestTemplate;
import com.synerzip.infra.security.ApplicationSecurity;
@SpringBootApplication
@Configuration
@PropertySource("classpath:supplier.properties")
public class TravelTimeApplication {
@Bean
public WebSecurityConfigurerAdapter webSecurityConfigurerAdapter(){
return new ApplicationSecurity();
}
@Bean
public RestTemplate provideRestTemplate(){
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(TravelTimeApplication.class, args);
}
}
| 973 | 0.830421 | 0.830421 | 30 | 31.433332 | 27.333353 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false |
0
|
c66c6dfa668d368c644e4536609deef49ec14f66
| 1,821,066,169,508 |
bb72793720470b58d67addf4025b323189e24cc7
|
/src/test/java/com/courses/db/dao/testNG/StudentDaoTestNG.java
|
a47213d04e199ceb7d7cd5f0751f2926d6f1e493
|
[] |
no_license
|
KazeiSergei/db-access
|
https://github.com/KazeiSergei/db-access
|
28330dd3ec14b6eb2bca6630cabb1f7f09888768
|
534ed9d757285bd55625c45a4a18cb1d21edfdf2
|
refs/heads/master
| 2021-01-19T12:07:23.034000 | 2016-10-11T06:01:05 | 2016-10-11T06:01:05 | 70,182,496 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.courses.db.dao.testNG;
import com.courses.db.dao.MarkDao;
import com.courses.db.dao.StudentDao;
import com.courses.db.dao.SubjectDao;
import com.courses.db.dto.Mark;
import com.courses.db.dto.Student;
import com.courses.db.dto.Subject;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.List;
public class StudentDaoTestNG {
private static StudentDao studentDao;
private static MarkDao markDao;
private static SubjectDao subjectDao;
@BeforeClass
public static void beforeClass() {
studentDao = new StudentDao();
subjectDao = new SubjectDao();
markDao = new MarkDao();
}
@AfterClass
public static void afterClass() {
studentDao.close();
markDao.close();
subjectDao.close();
}
@BeforeMethod
public void setUp() throws Exception {
studentDao.insertStudent(new Student("Test_Name_1", "Test_Name_1.1"));
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
studentDao.insertStudent(new Student("Test_Name_2", "Test_Name_2.2"));
studentDao.insertStudent(new Student("Test_Name_3", "Test_Name_3.3"));
subjectDao.insertSubject(new Subject("Test_1"));
Subject subject = subjectDao.getAllSudject().stream().filter(x -> "Test_1".equals(x.getName())).findFirst().get();
int subject_id = subject.getId();
markDao.insertMark(new Mark(student_id1, subject_id, 8));
}
@AfterMethod
public void tearDown() throws Exception {
List<Mark> marks = markDao.getAllMark();
for (Mark m : marks) {
markDao.delateMark(m.getId());
}
List<Subject> subjects = subjectDao.getAllSudject();
for (Subject s : subjects) {
subjectDao.delateSubject(s.getId());
}
List<Student> students = studentDao.getAll();
for (Student s : students) {
studentDao.delateStudent(s.getId());
}
}
@Test
public void testGetAll() throws Exception {
List<Student> students = studentDao.getAll();
Assert.assertEquals(3, students.size());
}
@Test
public void testGetStudentById() throws Exception {
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
Assert.assertEquals("Test_Name_1", studentDao.getStudentById(student_id1).getFirstName());
Assert.assertEquals( "Test_Name_1.1", studentDao.getStudentById(student_id1).getSecondName());
student = studentDao.getAll().stream().filter(x -> "Test_Name_2".equals(x.getFirstName())).findFirst().get();
int student_id2 = student.getId();
Assert.assertEquals("Test_Name_2", studentDao.getStudentById(student_id2).getFirstName());
Assert.assertEquals("Test_Name_2.2", studentDao.getStudentById(student_id2).getSecondName() );
student = studentDao.getAll().stream().filter(x -> "Test_Name_3".equals(x.getFirstName())).findFirst().get();
int student_id3 = student.getId();
Assert.assertEquals("Test_Name_3", studentDao.getStudentById(student_id3).getFirstName() );
Assert.assertEquals("Test_Name_3.3", studentDao.getStudentById(student_id3).getSecondName());
}
@Test
public void testGetStudentWithMark() throws Exception {
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
List<Student> students = studentDao.getStudentWithMark(student_id1);
for (Student s : students) {
Assert.assertEquals("Test_Name_1", s.getFirstName());
Assert.assertEquals( "Test_Name_1.1", s.getSecondName());
Assert.assertEquals( 8, s.getMark());
Assert.assertEquals("Test_1", s.getSubject());
}
}
@Test
public void testUpdateStudent() throws Exception {
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
student = new Student("Test1111", "Test2222");
studentDao.updateStudent(student, student_id1);
Assert.assertEquals( "Test1111", studentDao.getStudentById(student_id1).getFirstName());
Assert.assertEquals( "Test2222", studentDao.getStudentById(student_id1).getSecondName());
}
}
|
UTF-8
|
Java
| 4,884 |
java
|
StudentDaoTestNG.java
|
Java
|
[] | null |
[] |
package com.courses.db.dao.testNG;
import com.courses.db.dao.MarkDao;
import com.courses.db.dao.StudentDao;
import com.courses.db.dao.SubjectDao;
import com.courses.db.dto.Mark;
import com.courses.db.dto.Student;
import com.courses.db.dto.Subject;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.List;
public class StudentDaoTestNG {
private static StudentDao studentDao;
private static MarkDao markDao;
private static SubjectDao subjectDao;
@BeforeClass
public static void beforeClass() {
studentDao = new StudentDao();
subjectDao = new SubjectDao();
markDao = new MarkDao();
}
@AfterClass
public static void afterClass() {
studentDao.close();
markDao.close();
subjectDao.close();
}
@BeforeMethod
public void setUp() throws Exception {
studentDao.insertStudent(new Student("Test_Name_1", "Test_Name_1.1"));
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
studentDao.insertStudent(new Student("Test_Name_2", "Test_Name_2.2"));
studentDao.insertStudent(new Student("Test_Name_3", "Test_Name_3.3"));
subjectDao.insertSubject(new Subject("Test_1"));
Subject subject = subjectDao.getAllSudject().stream().filter(x -> "Test_1".equals(x.getName())).findFirst().get();
int subject_id = subject.getId();
markDao.insertMark(new Mark(student_id1, subject_id, 8));
}
@AfterMethod
public void tearDown() throws Exception {
List<Mark> marks = markDao.getAllMark();
for (Mark m : marks) {
markDao.delateMark(m.getId());
}
List<Subject> subjects = subjectDao.getAllSudject();
for (Subject s : subjects) {
subjectDao.delateSubject(s.getId());
}
List<Student> students = studentDao.getAll();
for (Student s : students) {
studentDao.delateStudent(s.getId());
}
}
@Test
public void testGetAll() throws Exception {
List<Student> students = studentDao.getAll();
Assert.assertEquals(3, students.size());
}
@Test
public void testGetStudentById() throws Exception {
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
Assert.assertEquals("Test_Name_1", studentDao.getStudentById(student_id1).getFirstName());
Assert.assertEquals( "Test_Name_1.1", studentDao.getStudentById(student_id1).getSecondName());
student = studentDao.getAll().stream().filter(x -> "Test_Name_2".equals(x.getFirstName())).findFirst().get();
int student_id2 = student.getId();
Assert.assertEquals("Test_Name_2", studentDao.getStudentById(student_id2).getFirstName());
Assert.assertEquals("Test_Name_2.2", studentDao.getStudentById(student_id2).getSecondName() );
student = studentDao.getAll().stream().filter(x -> "Test_Name_3".equals(x.getFirstName())).findFirst().get();
int student_id3 = student.getId();
Assert.assertEquals("Test_Name_3", studentDao.getStudentById(student_id3).getFirstName() );
Assert.assertEquals("Test_Name_3.3", studentDao.getStudentById(student_id3).getSecondName());
}
@Test
public void testGetStudentWithMark() throws Exception {
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
List<Student> students = studentDao.getStudentWithMark(student_id1);
for (Student s : students) {
Assert.assertEquals("Test_Name_1", s.getFirstName());
Assert.assertEquals( "Test_Name_1.1", s.getSecondName());
Assert.assertEquals( 8, s.getMark());
Assert.assertEquals("Test_1", s.getSubject());
}
}
@Test
public void testUpdateStudent() throws Exception {
Student student = studentDao.getAll().stream().filter(x -> "Test_Name_1".equals(x.getFirstName())).findFirst().get();
int student_id1 = student.getId();
student = new Student("Test1111", "Test2222");
studentDao.updateStudent(student, student_id1);
Assert.assertEquals( "Test1111", studentDao.getStudentById(student_id1).getFirstName());
Assert.assertEquals( "Test2222", studentDao.getStudentById(student_id1).getSecondName());
}
}
| 4,884 | 0.644349 | 0.630835 | 122 | 38.032787 | 34.544086 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.696721 | false | false |
0
|
b3934eb599e915d8977e935c8974b2ab908dd63c
| 7,816,840,533,882 |
b6023aa48d0edd1adf76a20b650471c001689321
|
/app/src/main/java/ainullov/kamil/com/weatherforecastusingretrofit/MainActivity.java
|
918ba8ab382ab28d88dc1a6892b8001a81c1e919
|
[] |
no_license
|
xixsuse/WeatherForecastAppWithWidgetUsingRetrofit2
|
https://github.com/xixsuse/WeatherForecastAppWithWidgetUsingRetrofit2
|
2879107f8ca3b53ca577a7c9c0034f59530ad866
|
64144fc64540276fdc9a3345098c692c2501a0b5
|
refs/heads/master
| 2020-03-27T15:18:54.986000 | 2018-08-25T11:32:12 | 2018-08-25T11:32:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ainullov.kamil.com.weatherforecastusingretrofit;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.gson.reflect.TypeToken;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import ainullov.kamil.com.weatherforecastusingretrofit.adapter.ItemInWeatherAdapter;
import ainullov.kamil.com.weatherforecastusingretrofit.adapter.WeatherAdapter;
import ainullov.kamil.com.weatherforecastusingretrofit.pojo.WeatherDay;
import ainullov.kamil.com.weatherforecastusingretrofit.pojo.WeatherForecast;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
// KEY - 9a829d5b59156cffd5ae083d9eb0a0d5
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
String TAG = "WEATHER";
String etInstanceState = "";
TextView tvTemp;
TextView tvDesc;
TextView tvWind;
TextView tvPressure;
TextView tvHumidity;
ImageView ivIcon;
EditText etPutCity;
Button btnGet;
WeatherAPI.ApiInterface api;
List<ItemInWeatherAdapter> itemInAdapterList;
WeatherAdapter adapter;
RecyclerView recyclerView;
SharedPreferences shref;
final String key = "Key";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvTemp = (TextView) findViewById(R.id.tvTemp);
tvDesc = (TextView) findViewById(R.id.tvDesc);
tvWind = (TextView) findViewById(R.id.tvWind);
tvPressure = (TextView) findViewById(R.id.tvPressure);
tvHumidity = (TextView) findViewById(R.id.tvHumidity);
etPutCity = (EditText) findViewById(R.id.etPutCity);
ivIcon = (ImageView) findViewById(R.id.ivIcon);
btnGet = (Button) findViewById(R.id.btnGet);
btnGet.setOnClickListener(this);
api = WeatherAPI.getClient().create(WeatherAPI.ApiInterface.class);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
itemInAdapterList = new ArrayList<>();
adapter = new WeatherAdapter(this, itemInAdapterList);
recyclerView.setAdapter(adapter);
load();
}
public void getWeather() {
String units = "metric";
String cityName = etPutCity.getText().toString();
String key = WeatherAPI.KEY;
Log.d(TAG, "Начало вызова");
Call<WeatherDay> callToday = api.getToday(cityName, units, key);
callToday.enqueue(new Callback<WeatherDay>() {
@Override
public void onResponse(Call<WeatherDay> call, Response<WeatherDay> response) {
Log.e(TAG, "onResponse");
Log.d(TAG, response.toString());
WeatherDay data = response.body();
if (response.isSuccessful()) {
tvTemp.setText((int) data.main.temp + "°");
tvDesc.setText(data.weather.get(0).description);
tvWind.setText((int) data.wind.speed + " m/s");
tvPressure.setText((int) data.main.pressure + " hpa");
tvHumidity.setText(data.main.humidity + " %");
// Работа Glide и Picasso
Glide.with(MainActivity.this).load(data.getIconUrl()).into(ivIcon);
// Picasso.with(MainActivity.this).load(data.getIconUrl()).into(ivImage);
}
}
@Override
public void onFailure(Call<WeatherDay> call, Throwable t) {
Log.e(TAG, "onFailure");
}
});
Call<WeatherForecast> callForecast = api.getForecast(cityName, units, key);
callForecast.enqueue(new Callback<WeatherForecast>() {
@Override
public void onResponse(Call<WeatherForecast> call, Response<WeatherForecast> response) {
Log.e(TAG, "onResponse");
WeatherForecast data = response.body();
if (response.isSuccessful()) {
SimpleDateFormat formatDayOfWeek = new SimpleDateFormat("E,MM.dd,HH:mm", Locale.ENGLISH);
for (int i = 0; i < data.getItems().size(); i++) {
// Параметры для айтема в адаптере
String dayOfWeeki = formatDayOfWeek.format(data.getItems().get(i).dt * 1000);
String desci = data.getItems().get(i).weather.get(0).description;
int tempi = (int) data.getItems().get(i).main.temp;
String iconi = data.getItems().get(i).getIconUrl();
itemInAdapterList.add(new ItemInWeatherAdapter(dayOfWeeki, desci, iconi, tempi));
}
adapter.notifyDataSetChanged();
}
}
@Override
public void onFailure(Call<WeatherForecast> call, Throwable t) {
Log.e(TAG, "onFailure");
}
});
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnGet:
itemInAdapterList.clear();
getWeather();
}
}
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("etCityName", etPutCity.getText().toString());
}
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
etInstanceState = savedInstanceState.getString("etCityName");
etPutCity.setText(etInstanceState);
if (!etInstanceState.isEmpty()) {
itemInAdapterList.clear();
getWeather();
}
}
@Override
protected void onPause() {
super.onPause();
save();
}
public void load() {
shref = getPreferences(MODE_PRIVATE);
//Если впервые запускаем
boolean hasVisited = shref.getBoolean("hasVisited", false);
if (!hasVisited) {
SharedPreferences.Editor e = shref.edit();
e.putBoolean("hasVisited", true);
e.commit();
} else {
etInstanceState = shref.getString(key, etInstanceState);
etPutCity.setText(etInstanceState);
}
itemInAdapterList.clear();
getWeather();
}
public void save() {
shref = getPreferences(MODE_PRIVATE);
SharedPreferences.Editor editor;
editor = shref.edit();
editor.remove(key).commit();
editor.putString(key, etPutCity.getText().toString());
editor.commit();
}
}
|
UTF-8
|
Java
| 7,189 |
java
|
MainActivity.java
|
Java
|
[
{
"context": "t2.Callback;\nimport retrofit2.Response;\n\n// KEY - 9a829d5b59156cffd5ae083d9eb0a0d5\n\npublic class MainActivity extends AppCompatActiv",
"end": 1075,
"score": 0.9997736811637878,
"start": 1043,
"tag": "KEY",
"value": "9a829d5b59156cffd5ae083d9eb0a0d5"
}
] | null |
[] |
package ainullov.kamil.com.weatherforecastusingretrofit;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.gson.reflect.TypeToken;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import ainullov.kamil.com.weatherforecastusingretrofit.adapter.ItemInWeatherAdapter;
import ainullov.kamil.com.weatherforecastusingretrofit.adapter.WeatherAdapter;
import ainullov.kamil.com.weatherforecastusingretrofit.pojo.WeatherDay;
import ainullov.kamil.com.weatherforecastusingretrofit.pojo.WeatherForecast;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
// KEY - 9a829d5b59156cffd5ae083d9eb0a0d5
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
String TAG = "WEATHER";
String etInstanceState = "";
TextView tvTemp;
TextView tvDesc;
TextView tvWind;
TextView tvPressure;
TextView tvHumidity;
ImageView ivIcon;
EditText etPutCity;
Button btnGet;
WeatherAPI.ApiInterface api;
List<ItemInWeatherAdapter> itemInAdapterList;
WeatherAdapter adapter;
RecyclerView recyclerView;
SharedPreferences shref;
final String key = "Key";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvTemp = (TextView) findViewById(R.id.tvTemp);
tvDesc = (TextView) findViewById(R.id.tvDesc);
tvWind = (TextView) findViewById(R.id.tvWind);
tvPressure = (TextView) findViewById(R.id.tvPressure);
tvHumidity = (TextView) findViewById(R.id.tvHumidity);
etPutCity = (EditText) findViewById(R.id.etPutCity);
ivIcon = (ImageView) findViewById(R.id.ivIcon);
btnGet = (Button) findViewById(R.id.btnGet);
btnGet.setOnClickListener(this);
api = WeatherAPI.getClient().create(WeatherAPI.ApiInterface.class);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
itemInAdapterList = new ArrayList<>();
adapter = new WeatherAdapter(this, itemInAdapterList);
recyclerView.setAdapter(adapter);
load();
}
public void getWeather() {
String units = "metric";
String cityName = etPutCity.getText().toString();
String key = WeatherAPI.KEY;
Log.d(TAG, "Начало вызова");
Call<WeatherDay> callToday = api.getToday(cityName, units, key);
callToday.enqueue(new Callback<WeatherDay>() {
@Override
public void onResponse(Call<WeatherDay> call, Response<WeatherDay> response) {
Log.e(TAG, "onResponse");
Log.d(TAG, response.toString());
WeatherDay data = response.body();
if (response.isSuccessful()) {
tvTemp.setText((int) data.main.temp + "°");
tvDesc.setText(data.weather.get(0).description);
tvWind.setText((int) data.wind.speed + " m/s");
tvPressure.setText((int) data.main.pressure + " hpa");
tvHumidity.setText(data.main.humidity + " %");
// Работа Glide и Picasso
Glide.with(MainActivity.this).load(data.getIconUrl()).into(ivIcon);
// Picasso.with(MainActivity.this).load(data.getIconUrl()).into(ivImage);
}
}
@Override
public void onFailure(Call<WeatherDay> call, Throwable t) {
Log.e(TAG, "onFailure");
}
});
Call<WeatherForecast> callForecast = api.getForecast(cityName, units, key);
callForecast.enqueue(new Callback<WeatherForecast>() {
@Override
public void onResponse(Call<WeatherForecast> call, Response<WeatherForecast> response) {
Log.e(TAG, "onResponse");
WeatherForecast data = response.body();
if (response.isSuccessful()) {
SimpleDateFormat formatDayOfWeek = new SimpleDateFormat("E,MM.dd,HH:mm", Locale.ENGLISH);
for (int i = 0; i < data.getItems().size(); i++) {
// Параметры для айтема в адаптере
String dayOfWeeki = formatDayOfWeek.format(data.getItems().get(i).dt * 1000);
String desci = data.getItems().get(i).weather.get(0).description;
int tempi = (int) data.getItems().get(i).main.temp;
String iconi = data.getItems().get(i).getIconUrl();
itemInAdapterList.add(new ItemInWeatherAdapter(dayOfWeeki, desci, iconi, tempi));
}
adapter.notifyDataSetChanged();
}
}
@Override
public void onFailure(Call<WeatherForecast> call, Throwable t) {
Log.e(TAG, "onFailure");
}
});
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnGet:
itemInAdapterList.clear();
getWeather();
}
}
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("etCityName", etPutCity.getText().toString());
}
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
etInstanceState = savedInstanceState.getString("etCityName");
etPutCity.setText(etInstanceState);
if (!etInstanceState.isEmpty()) {
itemInAdapterList.clear();
getWeather();
}
}
@Override
protected void onPause() {
super.onPause();
save();
}
public void load() {
shref = getPreferences(MODE_PRIVATE);
//Если впервые запускаем
boolean hasVisited = shref.getBoolean("hasVisited", false);
if (!hasVisited) {
SharedPreferences.Editor e = shref.edit();
e.putBoolean("hasVisited", true);
e.commit();
} else {
etInstanceState = shref.getString(key, etInstanceState);
etPutCity.setText(etInstanceState);
}
itemInAdapterList.clear();
getWeather();
}
public void save() {
shref = getPreferences(MODE_PRIVATE);
SharedPreferences.Editor editor;
editor = shref.edit();
editor.remove(key).commit();
editor.putString(key, etPutCity.getText().toString());
editor.commit();
}
}
| 7,189 | 0.625948 | 0.621595 | 206 | 33.572815 | 26.873165 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.68932 | false | false |
0
|
88811b0fb4d7c8509e7d1f081bb3fa5042af67ec
| 3,951,369,930,409 |
8081292f9327ddea911193c215d75fab2346e0d8
|
/spring-boot-app/web/src/test/java/com/com/example/ApplicationTest2.java
|
35b1462a3b6b2f50d96cd0cdebfe43d00996cada
|
[] |
no_license
|
rockleeprc/springboot
|
https://github.com/rockleeprc/springboot
|
e13bdc1f8403c806a20b7e2331ba5361bb2ababe
|
fc820394a39a27636032a7f02938f4935ec7d56f
|
refs/heads/master
| 2022-07-11T08:40:58.052000 | 2021-12-22T10:26:25 | 2021-12-22T10:26:25 | 149,254,615 | 0 | 1 | null | false | 2022-06-21T03:28:51 | 2018-09-18T08:31:29 | 2021-12-22T10:26:35 | 2022-06-21T03:28:51 | 34,459 | 0 | 0 | 14 |
Java
| false | false |
package com.com.example;
import com.example.SpringBootAppApplication;
import com.example.config.PropertyConfig;
import com.example.service.UserService;
import com.example.web.UserController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MockMvcBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* 测试service
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringBootAppApplication.class)
public class ApplicationTest2 {
@Autowired
private UserService userService;
@Autowired
private PropertyConfig config;
@Test
public void property() {
System.out.println(config);
}
@Test
public void testInfo() throws Exception {
System.out.println(userService);
}
@Test
public void contextLoads() throws Exception {
}
}
|
UTF-8
|
Java
| 1,873 |
java
|
ApplicationTest2.java
|
Java
|
[] | null |
[] |
package com.com.example;
import com.example.SpringBootAppApplication;
import com.example.config.PropertyConfig;
import com.example.service.UserService;
import com.example.web.UserController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MockMvcBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* 测试service
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringBootAppApplication.class)
public class ApplicationTest2 {
@Autowired
private UserService userService;
@Autowired
private PropertyConfig config;
@Test
public void property() {
System.out.println(config);
}
@Test
public void testInfo() throws Exception {
System.out.println(userService);
}
@Test
public void contextLoads() throws Exception {
}
}
| 1,873 | 0.812199 | 0.811129 | 57 | 31.807018 | 26.391413 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.491228 | false | false |
0
|
01b8eef4fc2b737cce05b0f85ddf59b8a4538ad2
| 27,857,157,947,980 |
cfd359610e1dd438c61be3d8a374d70a9a5950da
|
/src/main/java/com/mysite/util/hibernate/CustomProductIdGenerator.java
|
7dc740a165dd87e3e166a40a3b26e02bccd314cc
|
[] |
no_license
|
igorsvee/eShop
|
https://github.com/igorsvee/eShop
|
f8cd82d9331237d153759150acf682e9cbbc2bcf
|
69fd6bc022aee58069b2255a0a4e8338108439a3
|
refs/heads/master
| 2016-09-25T16:45:11.941000 | 2016-06-19T20:50:07 | 2016-06-19T20:50:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Made by Igor Svystkov.
* Copyright (c) 2014.
*/
package com.mysite.util.hibernate;
import com.mysite.domain.entity.Product;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.IdentityGenerator;
import java.io.Serializable;
public class CustomProductIdGenerator extends IdentityGenerator {
@Override
public Serializable generate(SessionImplementor s, Object obj) {
Product product = (Product) obj;
Long productNumber = product.getProductNumber();
if (productNumber == null) {
return super.generate(s, obj);
}
return productNumber;
}
// @Override
// public Serializable generate(SessionImplementor session, Object object) {
//// return super.generate(session, object);
// Serializable id = session.getEntityPersister(null, object)
// .getClassMetadata().getIdentifier(object, session);
// return id != null ? id : super.generate(session, object);
// }
}
|
UTF-8
|
Java
| 1,004 |
java
|
CustomProductIdGenerator.java
|
Java
|
[
{
"context": "/*\n * Made by Igor Svystkov.\n * Copyright (c) 2014.\n */\n\npackage com.mysite.u",
"end": 27,
"score": 0.9998120665550232,
"start": 14,
"tag": "NAME",
"value": "Igor Svystkov"
}
] | null |
[] |
/*
* Made by <NAME>.
* Copyright (c) 2014.
*/
package com.mysite.util.hibernate;
import com.mysite.domain.entity.Product;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.IdentityGenerator;
import java.io.Serializable;
public class CustomProductIdGenerator extends IdentityGenerator {
@Override
public Serializable generate(SessionImplementor s, Object obj) {
Product product = (Product) obj;
Long productNumber = product.getProductNumber();
if (productNumber == null) {
return super.generate(s, obj);
}
return productNumber;
}
// @Override
// public Serializable generate(SessionImplementor session, Object object) {
//// return super.generate(session, object);
// Serializable id = session.getEntityPersister(null, object)
// .getClassMetadata().getIdentifier(object, session);
// return id != null ? id : super.generate(session, object);
// }
}
| 997 | 0.678287 | 0.674303 | 33 | 29.424242 | 25.43206 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575758 | false | false |
0
|
691f42da7c184ce19488033db03d6363ba95f471
| 27,857,157,949,946 |
e08543b8d3c1aea552e39d73e84e88276a3ccedf
|
/src/main/java/club/simplecreate/cache/ReplyCache.java
|
e2954418306a1fdfdfe46c73df0ead42efe55dde
|
[] |
no_license
|
wanghui19980519/GradurationDesign
|
https://github.com/wanghui19980519/GradurationDesign
|
6b91a95538027c6bcd1cd9205bc828a97b1d9970
|
4f9efc234d103ff74b7d51d3381c754dc5cf21f3
|
refs/heads/master
| 2023-05-28T08:08:04.993000 | 2020-06-04T08:46:16 | 2020-06-04T08:46:16 | 259,831,831 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package club.simplecreate.cache;
import club.simplecreate.pojo.Reply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@Component
public class ReplyCache {
@Autowired
private RedisTemplate redisTemplate;
@SuppressWarnings("unchecked")
public void insertReply(Reply reply){
//将该回复加入对应评论 list中,因为回复不可删,所以直接存入回复对象,而不是存入id
redisTemplate.opsForList().leftPush("COMMENT_REPLIES:"+reply.getCommentId(),reply);
//回复没有通知
}
}
|
UTF-8
|
Java
| 666 |
java
|
ReplyCache.java
|
Java
|
[] | null |
[] |
package club.simplecreate.cache;
import club.simplecreate.pojo.Reply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@Component
public class ReplyCache {
@Autowired
private RedisTemplate redisTemplate;
@SuppressWarnings("unchecked")
public void insertReply(Reply reply){
//将该回复加入对应评论 list中,因为回复不可删,所以直接存入回复对象,而不是存入id
redisTemplate.opsForList().leftPush("COMMENT_REPLIES:"+reply.getCommentId(),reply);
//回复没有通知
}
}
| 666 | 0.765411 | 0.765411 | 19 | 29.736841 | 24.757439 | 91 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false |
0
|
87e72ea823cf9aa89ed025364edd81bc59cdfcf7
| 26,207,890,452,265 |
45ee323087a2a4ed4be322faf5c2f79068bdc0fc
|
/app/src/main/java/com/redoc/idu/framework/view/article/ArticleActivity.java
|
86d5e985cdce91c2348e869f20be4dd0b1434695
|
[] |
no_license
|
LiMengliang/IDu
|
https://github.com/LiMengliang/IDu
|
367ec0b9713974589eee5728ae70ddcd6c9c6e73
|
a94fda9c440e27cf43a5e5a7f1fdf66af62e7058
|
refs/heads/master
| 2021-01-19T01:12:57.852000 | 2017-04-22T14:33:02 | 2017-04-22T14:33:02 | 62,938,201 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.redoc.idu.framework.view.article;
import android.content.Intent;
import android.net.http.SslError;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.redoc.idu.IDuApplication;
import com.redoc.idu.R;
import com.redoc.idu.framework.contract.article.IArticleContract;
import com.redoc.idu.framework.presenter.article.IArticleLoader;
import com.redoc.idu.framework.presenter.article.TextArticlePresenter;
import com.redoc.idu.framework.view.video.VideoActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Article activity.
*/
public class ArticleActivity extends AppCompatActivity implements IArticleContract.IArticleView {
@BindView(R.id.web_view)
WebView mWebView;
private IArticleContract.IArticlePresenter mArticlePresenter;
/**
* {@inheritDoc}
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
ButterKnife.bind(this);
Bundle bundle = getIntent().getExtras();
IArticleLoader articleLoader = bundle.getParcelable("ArticleLoader");
setPresenter(new TextArticlePresenter(this, articleLoader));
updateArticle(mArticlePresenter);
}
/**
* {@inheritDoc}
*/
@OnClick(R.id.back_button)
public void onClick()
{
this.finish();
mArticlePresenter.onDetached();
}
/**
* {@inheritDoc}
*/
@Override
public void updateArticle(IArticleContract.IArticlePresenter presenter) {
this.mWebView.getSettings().setSupportZoom(false);
this.mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setDomStorageEnabled(true);
mWebView.setWebViewClient(new WebViewClient(){
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){
handler.proceed();
}
/**
* {@inheritDoc}
*/
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(IDuApplication.Context, VideoActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("VideoUrl", url);
IDuApplication.Context.startActivity(intent);
return true;
}
});
mWebView.loadDataWithBaseURL("about:blank", (String)(presenter.getData()), "text/html", "utf-8", null);
}
/**
* {@inheritDoc}
*/
@Override
public void setPresenter(IArticleContract.IArticlePresenter presenter) {
mArticlePresenter = presenter;
}
/**
* {@inheritDoc}
*/
@Override
public IArticleContract.IArticlePresenter getPresenter() {
return mArticlePresenter;
}
}
|
UTF-8
|
Java
| 3,254 |
java
|
ArticleActivity.java
|
Java
|
[] | null |
[] |
package com.redoc.idu.framework.view.article;
import android.content.Intent;
import android.net.http.SslError;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.redoc.idu.IDuApplication;
import com.redoc.idu.R;
import com.redoc.idu.framework.contract.article.IArticleContract;
import com.redoc.idu.framework.presenter.article.IArticleLoader;
import com.redoc.idu.framework.presenter.article.TextArticlePresenter;
import com.redoc.idu.framework.view.video.VideoActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Article activity.
*/
public class ArticleActivity extends AppCompatActivity implements IArticleContract.IArticleView {
@BindView(R.id.web_view)
WebView mWebView;
private IArticleContract.IArticlePresenter mArticlePresenter;
/**
* {@inheritDoc}
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
ButterKnife.bind(this);
Bundle bundle = getIntent().getExtras();
IArticleLoader articleLoader = bundle.getParcelable("ArticleLoader");
setPresenter(new TextArticlePresenter(this, articleLoader));
updateArticle(mArticlePresenter);
}
/**
* {@inheritDoc}
*/
@OnClick(R.id.back_button)
public void onClick()
{
this.finish();
mArticlePresenter.onDetached();
}
/**
* {@inheritDoc}
*/
@Override
public void updateArticle(IArticleContract.IArticlePresenter presenter) {
this.mWebView.getSettings().setSupportZoom(false);
this.mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setDomStorageEnabled(true);
mWebView.setWebViewClient(new WebViewClient(){
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){
handler.proceed();
}
/**
* {@inheritDoc}
*/
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(IDuApplication.Context, VideoActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("VideoUrl", url);
IDuApplication.Context.startActivity(intent);
return true;
}
});
mWebView.loadDataWithBaseURL("about:blank", (String)(presenter.getData()), "text/html", "utf-8", null);
}
/**
* {@inheritDoc}
*/
@Override
public void setPresenter(IArticleContract.IArticlePresenter presenter) {
mArticlePresenter = presenter;
}
/**
* {@inheritDoc}
*/
@Override
public IArticleContract.IArticlePresenter getPresenter() {
return mArticlePresenter;
}
}
| 3,254 | 0.683159 | 0.682545 | 101 | 31.217821 | 27.213715 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534653 | false | false |
0
|
2891ca4a4b7d28832846b6d232965c64c2cdca79
| 28,166,395,558,057 |
c6dc2c7cfc3a2c0de56edc84d367d082dfbdfee8
|
/src/java/pojo/VehicleStock.java
|
71ace6c62f686a6188281ab8dc44bc1dd39e79f6
|
[] |
no_license
|
nashgimhana/Amila-EnterPrises
|
https://github.com/nashgimhana/Amila-EnterPrises
|
f06c23b9c2c2482cc7dd63c8779fb94c6f8ae9fe
|
da47ecb8fb5f34198267f41fbfd5eae32ac57c53
|
refs/heads/master
| 2020-03-17T18:24:17.121000 | 2018-06-14T15:33:09 | 2018-06-14T15:33:09 | 133,821,002 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pojo;
// Generated Jun 13, 2018 3:21:00 AM by Hibernate Tools 4.3.1
/**
* VehicleStock generated by hbm2java
*/
public class VehicleStock implements java.io.Serializable {
private Integer id;
private Product product;
private Vehicle vehicle;
private Double currentStock;
public VehicleStock() {
}
public VehicleStock(Product product, Vehicle vehicle) {
this.product = product;
this.vehicle = vehicle;
}
public VehicleStock(Product product, Vehicle vehicle, Double currentStock) {
this.product = product;
this.vehicle = vehicle;
this.currentStock = currentStock;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Product getProduct() {
return this.product;
}
public void setProduct(Product product) {
this.product = product;
}
public Vehicle getVehicle() {
return this.vehicle;
}
public void setVehicle(Vehicle vehicle) {
this.vehicle = vehicle;
}
public Double getCurrentStock() {
return this.currentStock;
}
public void setCurrentStock(Double currentStock) {
this.currentStock = currentStock;
}
}
|
UTF-8
|
Java
| 1,307 |
java
|
VehicleStock.java
|
Java
|
[] | null |
[] |
package pojo;
// Generated Jun 13, 2018 3:21:00 AM by Hibernate Tools 4.3.1
/**
* VehicleStock generated by hbm2java
*/
public class VehicleStock implements java.io.Serializable {
private Integer id;
private Product product;
private Vehicle vehicle;
private Double currentStock;
public VehicleStock() {
}
public VehicleStock(Product product, Vehicle vehicle) {
this.product = product;
this.vehicle = vehicle;
}
public VehicleStock(Product product, Vehicle vehicle, Double currentStock) {
this.product = product;
this.vehicle = vehicle;
this.currentStock = currentStock;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Product getProduct() {
return this.product;
}
public void setProduct(Product product) {
this.product = product;
}
public Vehicle getVehicle() {
return this.vehicle;
}
public void setVehicle(Vehicle vehicle) {
this.vehicle = vehicle;
}
public Double getCurrentStock() {
return this.currentStock;
}
public void setCurrentStock(Double currentStock) {
this.currentStock = currentStock;
}
}
| 1,307 | 0.6228 | 0.611324 | 63 | 19.714285 | 19.425421 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365079 | false | false |
0
|
937c051445365f7009170f4002db11faf34a22fc
| 14,860,586,852,339 |
3825472e38dc46d055bc5d9e7201851d44156d57
|
/src/main/java/br/com/estoque/service/ItemService.java
|
20ce99a275b7124e440eb48883d4cbcbf4837ecf
|
[] |
no_license
|
FernandoAndradeSilva/GerenciamentoEstoque
|
https://github.com/FernandoAndradeSilva/GerenciamentoEstoque
|
60544341e2278576a66568c9903c956c17e8e1fd
|
37e16077aacf4708c740716ca6f9c68c392a882e
|
refs/heads/master
| 2021-07-12T01:57:58.312000 | 2019-07-23T16:45:52 | 2019-07-23T16:45:52 | 142,336,569 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.estoque.service;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import br.com.estoque.dao.EstoqueDAO;
import br.com.estoque.dao.ItemDAO;
import br.com.estoque.model.Estoque;
import br.com.estoque.model.Item;
import br.com.estoque.model.Unidade;
import br.com.estoque.model.Usuario;
import br.com.estoque.util.Transacional;
public class ItemService implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private ItemDAO itemDAO;
@Inject
private EstoqueDAO estoqueDAO;
@Inject
private UnidadeService unidadeService;
@Transacional
public void salvar(Item item) {
item.setDescricao(item.getDescricao().toUpperCase());
if(item.getEspecificacao() != "") {
item.setEspecificacao(item.getEspecificacao().toUpperCase());
}
if(item.getId()== null) {
item.setCriacao(new Date());
} else {
item.setModificacao(new Date());
}
Item itemSalvo;
itemSalvo = itemDAO.salvar(item);
// CRIA os ETOQUES DE TODAS AS UNIDADES
if(itemSalvo != null && itemSalvo.getModificacao() == null) {
List<Unidade> unidades = unidadeService.listAll();
for(Unidade unidade : unidades) {
Estoque estoque = new Estoque();
estoque.setUnidade(unidade);
estoque.setItem(itemSalvo);
estoqueDAO.salvar(estoque);
}
}
}
@Transacional
public void excluir(Item item) {
itemDAO.excluir(item);
}
public List<Item> listAll() {
return itemDAO.listAll();
}
public Item porId(Long id) {
return itemDAO.porId(id);
}
public List<Item> listAll(String tipo) {
return itemDAO.listAll(tipo);
}
public boolean verificaCodigoCadastrado(String codigo) {
return itemDAO.verificaCodigoCadastrado(codigo);
}
public Usuario retornaUsuarioDaSessao() {
return (Usuario) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("usuario");
}
public List<Item> listAll(Long idUsuario) {
return itemDAO.listAll(idUsuario);
}
public List<Item> listAll(Long idUsuario, String tipoItemNavegacao) {
return itemDAO.listAll(idUsuario , tipoItemNavegacao);
}
//
// public List<Object> listAllHash(Long id) {
// return itemDAO.listAllHash(id);
// }
//
//
// public List<Object> listAllHash(Long id, String tipoItemNavegacao) {
// return itemDAO.listAllHash(id , tipoItemNavegacao);
// }
}
|
UTF-8
|
Java
| 2,482 |
java
|
ItemService.java
|
Java
|
[] | null |
[] |
package br.com.estoque.service;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import br.com.estoque.dao.EstoqueDAO;
import br.com.estoque.dao.ItemDAO;
import br.com.estoque.model.Estoque;
import br.com.estoque.model.Item;
import br.com.estoque.model.Unidade;
import br.com.estoque.model.Usuario;
import br.com.estoque.util.Transacional;
public class ItemService implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private ItemDAO itemDAO;
@Inject
private EstoqueDAO estoqueDAO;
@Inject
private UnidadeService unidadeService;
@Transacional
public void salvar(Item item) {
item.setDescricao(item.getDescricao().toUpperCase());
if(item.getEspecificacao() != "") {
item.setEspecificacao(item.getEspecificacao().toUpperCase());
}
if(item.getId()== null) {
item.setCriacao(new Date());
} else {
item.setModificacao(new Date());
}
Item itemSalvo;
itemSalvo = itemDAO.salvar(item);
// CRIA os ETOQUES DE TODAS AS UNIDADES
if(itemSalvo != null && itemSalvo.getModificacao() == null) {
List<Unidade> unidades = unidadeService.listAll();
for(Unidade unidade : unidades) {
Estoque estoque = new Estoque();
estoque.setUnidade(unidade);
estoque.setItem(itemSalvo);
estoqueDAO.salvar(estoque);
}
}
}
@Transacional
public void excluir(Item item) {
itemDAO.excluir(item);
}
public List<Item> listAll() {
return itemDAO.listAll();
}
public Item porId(Long id) {
return itemDAO.porId(id);
}
public List<Item> listAll(String tipo) {
return itemDAO.listAll(tipo);
}
public boolean verificaCodigoCadastrado(String codigo) {
return itemDAO.verificaCodigoCadastrado(codigo);
}
public Usuario retornaUsuarioDaSessao() {
return (Usuario) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("usuario");
}
public List<Item> listAll(Long idUsuario) {
return itemDAO.listAll(idUsuario);
}
public List<Item> listAll(Long idUsuario, String tipoItemNavegacao) {
return itemDAO.listAll(idUsuario , tipoItemNavegacao);
}
//
// public List<Object> listAllHash(Long id) {
// return itemDAO.listAllHash(id);
// }
//
//
// public List<Object> listAllHash(Long id, String tipoItemNavegacao) {
// return itemDAO.listAllHash(id , tipoItemNavegacao);
// }
}
| 2,482 | 0.706285 | 0.705882 | 115 | 20.582609 | 22.215147 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.078261 | false | false |
0
|
2ff5f96e54bd8e6ef6707010f6b04d31fea30834
| 1,992,864,848,506 |
35733fc906b942a8ca76e16fe51b32f1eb42a11e
|
/Issotoria/src/org/sncoding/issotoria/systems/items/ItemHelper.java
|
0775831862d2d4eb38c66355d52fedd53bd5bb33
|
[] |
no_license
|
SnCodingCorporation/Issotoria
|
https://github.com/SnCodingCorporation/Issotoria
|
9bbb6a8d8700e2d53c2a09a44d1c9eeab77c78cc
|
e4ff0f79a3cee1887db98cc191b97dd39a69c4cf
|
refs/heads/master
| 2016-08-12T12:31:27.482000 | 2015-07-07T21:13:35 | 2015-07-07T21:13:35 | 36,268,233 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.sncoding.issotoria.systems.items;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.sncoding.issotoria.Issotoria;
import org.sncoding.issotoria.utils.Debug;
public class ItemHelper{
public static String getStringFromPosition(int position)
{
try
{
if(Issotoria.plugin.lists.loreAffixes.get(position) != null)
{
for (Entry<?, ?> entry : Issotoria.plugin.lists.loreAffixes.get(position).entrySet()) {
//Le Nom
String key = (String) entry.getKey();
return key;
}
}
}
catch(IndexOutOfBoundsException e)
{
Debug.send(Debug.ITEM, "" + ChatColor.RED + "ItemHelper Error: Position = " + position + " Size of the table = " + Issotoria.plugin.lists.loreAffixes.size());
}
return null;
}
public static int[] getIntTableFromPosition(int position)
{
try{
if(Issotoria.plugin.lists.loreAffixes.get(position) != null)
{
for (Entry<?, ?> entry : Issotoria.plugin.lists.loreAffixes.get(position).entrySet()) {
//Le Tableau
String value = (String) entry.getValue().toString().replace("[", "").replace("]", "");
String[] args = value.replace(",", " ").split(" ");
//Creation Tableau
int[] temp = new int[args.length];
for(int i = 0; i < args.length; i++)
temp[i] = Integer.valueOf(args[i]);
return temp;
}
}
}
catch(IndexOutOfBoundsException e)
{
Debug.send(Debug.ITEM, "" + ChatColor.RED + "ItemHelper Error: Position = " + position + " Size of the table = " + Issotoria.plugin.lists.loreAffixes.size());
}
return null;
}
public static int[] getIntTableFromString(String name) {
if(name != null){
Debug.send(Debug.ITEM, "itemhelper.name = " + name);
for(int i = 0; i < Issotoria.plugin.lists.loreAffixes.size(); i++) {
for (Entry<?, ?> entry : Issotoria.plugin.lists.loreAffixes.get(i).entrySet()) {
//Le Nom
String key = (String) entry.getKey();
Debug.send(Debug.ITEM, "itemhelper.getkey = " + key);
//Le tableau
if(key.equalsIgnoreCase(name)) {
String value = (String) entry.getValue().toString().replace("[", "").replace("]", "");
Debug.send(Debug.ITEM, "itemhelper.value = " + value);
String[] args = value.replace(",", " ").split(" ");
int[] temp = new int[args.length];
for(int z = 0; z < args.length; z++)
temp[z] = Integer.valueOf(args[z]);
return temp;
}
}
}
}
return null;
}
}
|
UTF-8
|
Java
| 2,438 |
java
|
ItemHelper.java
|
Java
|
[] | null |
[] |
package org.sncoding.issotoria.systems.items;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import org.sncoding.issotoria.Issotoria;
import org.sncoding.issotoria.utils.Debug;
public class ItemHelper{
public static String getStringFromPosition(int position)
{
try
{
if(Issotoria.plugin.lists.loreAffixes.get(position) != null)
{
for (Entry<?, ?> entry : Issotoria.plugin.lists.loreAffixes.get(position).entrySet()) {
//Le Nom
String key = (String) entry.getKey();
return key;
}
}
}
catch(IndexOutOfBoundsException e)
{
Debug.send(Debug.ITEM, "" + ChatColor.RED + "ItemHelper Error: Position = " + position + " Size of the table = " + Issotoria.plugin.lists.loreAffixes.size());
}
return null;
}
public static int[] getIntTableFromPosition(int position)
{
try{
if(Issotoria.plugin.lists.loreAffixes.get(position) != null)
{
for (Entry<?, ?> entry : Issotoria.plugin.lists.loreAffixes.get(position).entrySet()) {
//Le Tableau
String value = (String) entry.getValue().toString().replace("[", "").replace("]", "");
String[] args = value.replace(",", " ").split(" ");
//Creation Tableau
int[] temp = new int[args.length];
for(int i = 0; i < args.length; i++)
temp[i] = Integer.valueOf(args[i]);
return temp;
}
}
}
catch(IndexOutOfBoundsException e)
{
Debug.send(Debug.ITEM, "" + ChatColor.RED + "ItemHelper Error: Position = " + position + " Size of the table = " + Issotoria.plugin.lists.loreAffixes.size());
}
return null;
}
public static int[] getIntTableFromString(String name) {
if(name != null){
Debug.send(Debug.ITEM, "itemhelper.name = " + name);
for(int i = 0; i < Issotoria.plugin.lists.loreAffixes.size(); i++) {
for (Entry<?, ?> entry : Issotoria.plugin.lists.loreAffixes.get(i).entrySet()) {
//Le Nom
String key = (String) entry.getKey();
Debug.send(Debug.ITEM, "itemhelper.getkey = " + key);
//Le tableau
if(key.equalsIgnoreCase(name)) {
String value = (String) entry.getValue().toString().replace("[", "").replace("]", "");
Debug.send(Debug.ITEM, "itemhelper.value = " + value);
String[] args = value.replace(",", " ").split(" ");
int[] temp = new int[args.length];
for(int z = 0; z < args.length; z++)
temp[z] = Integer.valueOf(args[z]);
return temp;
}
}
}
}
return null;
}
}
| 2,438 | 0.625513 | 0.624282 | 86 | 27.360466 | 33.365807 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.22093 | false | false |
0
|
188a77bb6763b511c0eccf5dfe12f3271eb87442
| 21,680,994,920,142 |
41b6cbab6e5109b7174a259242fa663ed3e61363
|
/site-dianping/src/main/java/com/edmi/site/dianping/entity/DianpingSubCategorySubRegionPage.java
|
59c0ef9b256b6ba57da4459745de1998e50a669f
|
[] |
no_license
|
keshi-eddc/REHGQA5REASERHY
|
https://github.com/keshi-eddc/REHGQA5REASERHY
|
8e6c71713e5c676813da45680eb170927a6838e9
|
48b97ee01d37856befd3c81118f1fcef97d392d4
|
refs/heads/master
| 2020-03-29T18:39:35.502000 | 2018-09-19T03:41:33 | 2018-09-19T03:41:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.edmi.site.dianping.entity;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
import fun.jerry.entity.Model;
import fun.jerry.entity.annotation.ColumnMapping;
import fun.jerry.entity.annotation.FieldInsertExclude;
import fun.jerry.entity.annotation.FieldUpdateExclude;
import fun.jerry.entity.annotation.LogicalPrimaryKey;
import fun.jerry.entity.annotation.TableMapping;
@TableMapping("Dianping_SubCategory_SubRegion_Page")
public class DianpingSubCategorySubRegionPage extends Model {
private static final long serialVersionUID = -2778523730542207946L;
@LogicalPrimaryKey
@ColumnMapping("url")
private String url;
@ColumnMapping("sub_category_id")
private String subCategoryId;
@ColumnMapping("sub_category")
private String subCategory;
@ColumnMapping("category_id")
private String categoryId;
@ColumnMapping("category")
private String category;
@ColumnMapping("primary_category_id")
private String primaryCategoryId;
@ColumnMapping("primary_category")
private String primaryCategory;
@ColumnMapping("sub_region_id")
private String subRegionId;
@ColumnMapping("sub_region")
private String subRegion;
@ColumnMapping("region_id")
private String regionId;
@ColumnMapping("region")
private String region;
@ColumnMapping("city_id")
private String cityId;
@ColumnMapping("city_cnname")
private String cityCnname;
@ColumnMapping("city_enname")
private String cityEnname;
@ColumnMapping("shop_total_page")
private Integer shopTotalPage;
@LogicalPrimaryKey
@ColumnMapping("page")
private Integer page;
@LogicalPrimaryKey
@ColumnMapping("version")
private String version = Version.version;
@ColumnMapping("status")
private Integer status = 0;
@FieldInsertExclude
@ColumnMapping("update_time")
private String updateTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
@ColumnMapping("insert_time")
@FieldUpdateExclude
private String insertTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getSubCategoryId() {
return subCategoryId;
}
public void setSubCategoryId(String subCategoryId) {
this.subCategoryId = subCategoryId;
}
public String getSubCategory() {
return subCategory;
}
public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getPrimaryCategoryId() {
return primaryCategoryId;
}
public void setPrimaryCategoryId(String primaryCategoryId) {
this.primaryCategoryId = primaryCategoryId;
}
public String getPrimaryCategory() {
return primaryCategory;
}
public void setPrimaryCategory(String primaryCategory) {
this.primaryCategory = primaryCategory;
}
public String getSubRegionId() {
return subRegionId;
}
public void setSubRegionId(String subRegionId) {
this.subRegionId = subRegionId;
}
public String getSubRegion() {
return subRegion;
}
public void setSubRegion(String subRegion) {
this.subRegion = subRegion;
}
public String getRegionId() {
return regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
public String getCityCnname() {
return cityCnname;
}
public void setCityCnname(String cityCnname) {
this.cityCnname = cityCnname;
}
public String getCityEnname() {
return cityEnname;
}
public void setCityEnname(String cityEnname) {
this.cityEnname = cityEnname;
}
public Integer getShopTotalPage() {
return shopTotalPage;
}
public void setShopTotalPage(Integer shopTotalPage) {
this.shopTotalPage = shopTotalPage;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getInsertTime() {
return insertTime;
}
public void setInsertTime(String insertTime) {
this.insertTime = insertTime;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
|
UTF-8
|
Java
| 5,053 |
java
|
DianpingSubCategorySubRegionPage.java
|
Java
|
[] | null |
[] |
package com.edmi.site.dianping.entity;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
import fun.jerry.entity.Model;
import fun.jerry.entity.annotation.ColumnMapping;
import fun.jerry.entity.annotation.FieldInsertExclude;
import fun.jerry.entity.annotation.FieldUpdateExclude;
import fun.jerry.entity.annotation.LogicalPrimaryKey;
import fun.jerry.entity.annotation.TableMapping;
@TableMapping("Dianping_SubCategory_SubRegion_Page")
public class DianpingSubCategorySubRegionPage extends Model {
private static final long serialVersionUID = -2778523730542207946L;
@LogicalPrimaryKey
@ColumnMapping("url")
private String url;
@ColumnMapping("sub_category_id")
private String subCategoryId;
@ColumnMapping("sub_category")
private String subCategory;
@ColumnMapping("category_id")
private String categoryId;
@ColumnMapping("category")
private String category;
@ColumnMapping("primary_category_id")
private String primaryCategoryId;
@ColumnMapping("primary_category")
private String primaryCategory;
@ColumnMapping("sub_region_id")
private String subRegionId;
@ColumnMapping("sub_region")
private String subRegion;
@ColumnMapping("region_id")
private String regionId;
@ColumnMapping("region")
private String region;
@ColumnMapping("city_id")
private String cityId;
@ColumnMapping("city_cnname")
private String cityCnname;
@ColumnMapping("city_enname")
private String cityEnname;
@ColumnMapping("shop_total_page")
private Integer shopTotalPage;
@LogicalPrimaryKey
@ColumnMapping("page")
private Integer page;
@LogicalPrimaryKey
@ColumnMapping("version")
private String version = Version.version;
@ColumnMapping("status")
private Integer status = 0;
@FieldInsertExclude
@ColumnMapping("update_time")
private String updateTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
@ColumnMapping("insert_time")
@FieldUpdateExclude
private String insertTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getSubCategoryId() {
return subCategoryId;
}
public void setSubCategoryId(String subCategoryId) {
this.subCategoryId = subCategoryId;
}
public String getSubCategory() {
return subCategory;
}
public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getPrimaryCategoryId() {
return primaryCategoryId;
}
public void setPrimaryCategoryId(String primaryCategoryId) {
this.primaryCategoryId = primaryCategoryId;
}
public String getPrimaryCategory() {
return primaryCategory;
}
public void setPrimaryCategory(String primaryCategory) {
this.primaryCategory = primaryCategory;
}
public String getSubRegionId() {
return subRegionId;
}
public void setSubRegionId(String subRegionId) {
this.subRegionId = subRegionId;
}
public String getSubRegion() {
return subRegion;
}
public void setSubRegion(String subRegion) {
this.subRegion = subRegion;
}
public String getRegionId() {
return regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
public String getCityCnname() {
return cityCnname;
}
public void setCityCnname(String cityCnname) {
this.cityCnname = cityCnname;
}
public String getCityEnname() {
return cityEnname;
}
public void setCityEnname(String cityEnname) {
this.cityEnname = cityEnname;
}
public Integer getShopTotalPage() {
return shopTotalPage;
}
public void setShopTotalPage(Integer shopTotalPage) {
this.shopTotalPage = shopTotalPage;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getInsertTime() {
return insertTime;
}
public void setInsertTime(String insertTime) {
this.insertTime = insertTime;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
| 5,053 | 0.711854 | 0.707698 | 244 | 18.709017 | 18.425119 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.221311 | false | false |
0
|
16e51899d7e2ae197a515d53047f2d498085bee1
| 14,448,270,011,924 |
2962a55195c6f5fde119455dbec5e20bf6cca1bc
|
/src/main/java/com/jberry/elevatorsimulator/domain/Floor.java
|
a6d49b8eae41e4310526b2141b87b2755dcb2e72
|
[] |
no_license
|
JBerry-Chi/ElevatorAlgoSimulator
|
https://github.com/JBerry-Chi/ElevatorAlgoSimulator
|
3fa2a3bf6bcefa84dec5fa2ca774f6125c654413
|
23c7e00ec18efdf6ec28c793633819835e13bfac
|
refs/heads/master
| 2021-07-20T00:43:54.138000 | 2017-10-24T18:45:19 | 2017-10-24T18:45:19 | null | 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 com.jberry.elevatorsimulator.domain;
import java.util.ArrayList;
/**
*
* @author johnberry
*/
public class Floor{
private final int floorID;
private ArrayList<Person> peopleWaitingOnFloor;
private ArrayList<Person> completedPassengers;
private ArrayList<Elevator> availableElevators;
public Floor(int floorIDIn, int elevatorCount, ArrayList<Person>peopleIn){
floorID = floorIDIn;
peopleWaitingOnFloor = peopleIn;
completedPassengers = new ArrayList<Person>();
}
public void sendRequest(){
/* Person testPerson = peopleWaitingOnFloor.get(0);
testPerson.sendRequest(); */
}
public void addPerson(Person personIn){
peopleWaitingOnFloor.add(personIn);
}
public int getNumberofPeopleWaiting(){
return peopleWaitingOnFloor.size();
}
public ArrayList<Person> getPeopleWaiting(){
return peopleWaitingOnFloor;
}
public void addCompletedPersons(Person p){
completedPassengers.add(p);
}
public int getFloorID(){
return floorID;
}
}
|
UTF-8
|
Java
| 1,285 |
java
|
Floor.java
|
Java
|
[
{
"context": "in;\n\nimport java.util.ArrayList;\n/**\n *\n * @author johnberry\n */\npublic class Floor{\n \n private final in",
"end": 286,
"score": 0.9989614486694336,
"start": 277,
"tag": "USERNAME",
"value": "johnberry"
}
] | 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 com.jberry.elevatorsimulator.domain;
import java.util.ArrayList;
/**
*
* @author johnberry
*/
public class Floor{
private final int floorID;
private ArrayList<Person> peopleWaitingOnFloor;
private ArrayList<Person> completedPassengers;
private ArrayList<Elevator> availableElevators;
public Floor(int floorIDIn, int elevatorCount, ArrayList<Person>peopleIn){
floorID = floorIDIn;
peopleWaitingOnFloor = peopleIn;
completedPassengers = new ArrayList<Person>();
}
public void sendRequest(){
/* Person testPerson = peopleWaitingOnFloor.get(0);
testPerson.sendRequest(); */
}
public void addPerson(Person personIn){
peopleWaitingOnFloor.add(personIn);
}
public int getNumberofPeopleWaiting(){
return peopleWaitingOnFloor.size();
}
public ArrayList<Person> getPeopleWaiting(){
return peopleWaitingOnFloor;
}
public void addCompletedPersons(Person p){
completedPassengers.add(p);
}
public int getFloorID(){
return floorID;
}
}
| 1,285 | 0.68716 | 0.686381 | 45 | 27.555555 | 21.97934 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
0
|
df2baef11172bacb3db100471f0091f329819880
| 5,214,090,313,844 |
518354a5bca917ce6329edd37dec5126e9c039bc
|
/app/src/main/java/com/syncinfo/coffeetown/uc/OfferingListUC.java
|
0a8d6815e9eec5b258e16dc845c5c7c679f339a0
|
[] |
no_license
|
mmpereira2github/Coffeetown
|
https://github.com/mmpereira2github/Coffeetown
|
5a92d5d5d0d97f4e7db1dd4e4e2bd4fe3c618d8e
|
106d73e8e83230abca05d1c4955c22d1ad01c9c6
|
refs/heads/master
| 2020-06-06T05:42:45.655000 | 2019-06-19T03:41:11 | 2019-06-19T03:41:11 | 192,652,473 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.syncinfo.coffeetown.uc;
import com.syncinfo.coffeetown.model.Model;
import com.syncinfo.coffeetown.model.Offering;
import com.syncinfo.mvc.uc.impl.FilterBasedListUC;
/**
* Created by mmartins on 2018-02-26.
*/
public class OfferingListUC extends FilterBasedListUC<Offering> {
private final ChoiceMode choiceMode;
public OfferingListUC() {
this(ChoiceMode.SINGLE_SELECTION);
}
public OfferingListUC(ChoiceMode choiceMode) {
super(result -> Model.getInstance().getOfferingDAO().getAll(result));
this.choiceMode = choiceMode;
}
@Override
public ChoiceMode getChoiceMode() { return this.choiceMode; }
}
|
UTF-8
|
Java
| 673 |
java
|
OfferingListUC.java
|
Java
|
[
{
"context": ".mvc.uc.impl.FilterBasedListUC;\n\n/**\n * Created by mmartins on 2018-02-26.\n */\n\npublic class OfferingListUC e",
"end": 206,
"score": 0.9995144009590149,
"start": 198,
"tag": "USERNAME",
"value": "mmartins"
}
] | null |
[] |
package com.syncinfo.coffeetown.uc;
import com.syncinfo.coffeetown.model.Model;
import com.syncinfo.coffeetown.model.Offering;
import com.syncinfo.mvc.uc.impl.FilterBasedListUC;
/**
* Created by mmartins on 2018-02-26.
*/
public class OfferingListUC extends FilterBasedListUC<Offering> {
private final ChoiceMode choiceMode;
public OfferingListUC() {
this(ChoiceMode.SINGLE_SELECTION);
}
public OfferingListUC(ChoiceMode choiceMode) {
super(result -> Model.getInstance().getOfferingDAO().getAll(result));
this.choiceMode = choiceMode;
}
@Override
public ChoiceMode getChoiceMode() { return this.choiceMode; }
}
| 673 | 0.726597 | 0.71471 | 27 | 23.925926 | 24.565748 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
0
|
ea2007c0c9958ea293d23b070a0f9ca72c6bb31c
| 25,563,645,356,475 |
64b7364526419b23fc8c9a370d9f0bcbbf8565a6
|
/app/src/main/java/com/orange/mall/app/utils/MiscUtils.java
|
2fce40ba8ddacbe465cec0989b808cb0be01a46c
|
[] |
no_license
|
orange2019/OrangeMall
|
https://github.com/orange2019/OrangeMall
|
652d025b8b2f1b4a299fdb46a544e9275cea2d3c
|
77e3419216949a707a8dcaa239f3025b37f9f835
|
refs/heads/master
| 2020-04-13T14:16:24.944000 | 2019-01-04T03:36:06 | 2019-01-04T03:36:06 | 162,941,941 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.orange.mall.app.utils;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
import android.widget.Toast;
import com.orange.mall.app.Application;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.UUID;
public class MiscUtils {
private final static char[] hexArray = "0123456789ABCDEF".toCharArray();
/**
* 生成uuid字符串
*
* @return uuid 字符串
*/
public static String generateUUID() {
MessageDigest salt = null;
try {
salt = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
salt.update(UUID.randomUUID().toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String digest = MiscUtils.bytesToHex(salt.digest());
return digest;
}
/**
* bytes => 十六进制字符串
*
* @param bytes
* @return
*/
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
/**
* 安装apk
*
* @param apkPath
* @param activity
*/
public static void installApk(String apkPath, Activity activity) {
chmod777(apkPath);
Intent intent = new Intent(Intent.ACTION_VIEW);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(activity, "com.orange.wallet.fileprovider", new File(apkPath));
// List<ResolveInfo> resInfoList = activity.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
// for (ResolveInfo resolveInfo : resInfoList) {
// String packageName = resolveInfo.activityInfo.packageName;
// activity.grantUriPermission(packageName, contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
// }
intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(new File(apkPath)), "application/vnd.android.package-archive");
}
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
}
/**
* 提升读写权限
* @param filePath 文件路径
* @return
* @throws IOException
*/
public static void chmod777(String filePath) {
String command = "chmod " + "777" + " " + filePath;
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(command);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 显示 message tip 提示
* @param message
*/
public static void showMessageTip (String message) {
Toast.makeText(Application.getAppContext(), message, Toast.LENGTH_SHORT).show();
}
}
|
UTF-8
|
Java
| 3,330 |
java
|
MiscUtils.java
|
Java
|
[] | null |
[] |
package com.orange.mall.app.utils;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
import android.widget.Toast;
import com.orange.mall.app.Application;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.UUID;
public class MiscUtils {
private final static char[] hexArray = "0123456789ABCDEF".toCharArray();
/**
* 生成uuid字符串
*
* @return uuid 字符串
*/
public static String generateUUID() {
MessageDigest salt = null;
try {
salt = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
salt.update(UUID.randomUUID().toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String digest = MiscUtils.bytesToHex(salt.digest());
return digest;
}
/**
* bytes => 十六进制字符串
*
* @param bytes
* @return
*/
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
/**
* 安装apk
*
* @param apkPath
* @param activity
*/
public static void installApk(String apkPath, Activity activity) {
chmod777(apkPath);
Intent intent = new Intent(Intent.ACTION_VIEW);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(activity, "com.orange.wallet.fileprovider", new File(apkPath));
// List<ResolveInfo> resInfoList = activity.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
// for (ResolveInfo resolveInfo : resInfoList) {
// String packageName = resolveInfo.activityInfo.packageName;
// activity.grantUriPermission(packageName, contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
// }
intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(new File(apkPath)), "application/vnd.android.package-archive");
}
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
}
/**
* 提升读写权限
* @param filePath 文件路径
* @return
* @throws IOException
*/
public static void chmod777(String filePath) {
String command = "chmod " + "777" + " " + filePath;
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(command);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 显示 message tip 提示
* @param message
*/
public static void showMessageTip (String message) {
Toast.makeText(Application.getAppContext(), message, Toast.LENGTH_SHORT).show();
}
}
| 3,330 | 0.677479 | 0.667381 | 121 | 26.008265 | 27.835258 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.487603 | false | false |
0
|
68a158075ade554a06b40af29f2d40a6b0658749
| 2,482,491,099,075 |
bd5def26e5abcffcbc5e5d1c05078c0f6a03d463
|
/src/java/antdp/dtos/RegistrationDTO.java
|
6c73234845502af274918197a49ecc149c9f62d9
|
[] |
no_license
|
kythi2000/CarRental
|
https://github.com/kythi2000/CarRental
|
08dbd5b1a33d723c181370fae13564799aef4da3
|
4066a181b9aca3fee8b7cd5b0d356f85a29bb7fe
|
refs/heads/master
| 2023-04-20T04:44:09.081000 | 2021-05-05T10:01:31 | 2021-05-05T10:01:31 | 364,532,373 | 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 antdp.dtos;
import java.io.Serializable;
import java.sql.Date;
/**
*
* @author HP 840 G2
*/
public class RegistrationDTO implements Serializable {
private String email, password, fullname, phone, address, status;
private boolean role;
private Date dateOfCreate;
private int verifyCode;
public RegistrationDTO(String email, String password, String fullname, String phone, String address, int verifyCode) {
this.email = email;
this.password = password;
this.fullname = fullname;
this.phone = phone;
this.address = address;
this.verifyCode = verifyCode;
}
public RegistrationDTO(String email, String password, String fullname, String phone, String address, String status, boolean role, int verifyCode) {
this.email = email;
this.password = password;
this.fullname = fullname;
this.phone = phone;
this.address = address;
this.status = status;
this.role = role;
this.verifyCode = verifyCode;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFullname() {
return fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public boolean isRole() {
return role;
}
public void setRole(boolean role) {
this.role = role;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getDateOfCreate() {
return dateOfCreate;
}
public void setDateOfCreate(Date dateOfCreate) {
this.dateOfCreate = dateOfCreate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(int verifyCode) {
this.verifyCode = verifyCode;
}
}
|
UTF-8
|
Java
| 2,572 |
java
|
RegistrationDTO.java
|
Java
|
[
{
"context": "alizable;\nimport java.sql.Date;\n\n/**\n *\n * @author HP 840 G2\n */\npublic class RegistrationDTO implements Seria",
"end": 285,
"score": 0.9489124417304993,
"start": 276,
"tag": "USERNAME",
"value": "HP 840 G2"
},
{
"context": " this.email = email;\n this.password = password;\n this.fullname = fullname;\n this.p",
"end": 685,
"score": 0.7955434322357178,
"start": 677,
"tag": "PASSWORD",
"value": "password"
},
{
"context": " this.email = email;\n this.password = password;\n this.fullname = fullname;\n this.p",
"end": 1038,
"score": 0.8934727907180786,
"start": 1030,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "assword(String password) {\n this.password = password;\n }\n\n public String getFullname() {\n ",
"end": 1516,
"score": 0.87125563621521,
"start": 1508,
"tag": "PASSWORD",
"value": "password"
}
] | 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 antdp.dtos;
import java.io.Serializable;
import java.sql.Date;
/**
*
* @author HP 840 G2
*/
public class RegistrationDTO implements Serializable {
private String email, password, fullname, phone, address, status;
private boolean role;
private Date dateOfCreate;
private int verifyCode;
public RegistrationDTO(String email, String password, String fullname, String phone, String address, int verifyCode) {
this.email = email;
this.password = <PASSWORD>;
this.fullname = fullname;
this.phone = phone;
this.address = address;
this.verifyCode = verifyCode;
}
public RegistrationDTO(String email, String password, String fullname, String phone, String address, String status, boolean role, int verifyCode) {
this.email = email;
this.password = <PASSWORD>;
this.fullname = fullname;
this.phone = phone;
this.address = address;
this.status = status;
this.role = role;
this.verifyCode = verifyCode;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = <PASSWORD>;
}
public String getFullname() {
return fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public boolean isRole() {
return role;
}
public void setRole(boolean role) {
this.role = role;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getDateOfCreate() {
return dateOfCreate;
}
public void setDateOfCreate(Date dateOfCreate) {
this.dateOfCreate = dateOfCreate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(int verifyCode) {
this.verifyCode = verifyCode;
}
}
| 2,578 | 0.625972 | 0.624417 | 114 | 21.561403 | 23.356142 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517544 | false | false |
0
|
23c21977b5b02868f179f6b9cf2b962749e4143d
| 17,798,344,489,541 |
fcb71a21ced710a6c8c7c6d364d11d91d1d4d680
|
/Kolekcje/Collections/src/main/java/sda/ToDoListDemo1/Priorities.java
|
628abcd1e83ce424c694f89b5017edaa9ea5a832
|
[] |
no_license
|
WoronowiczGIT/SimpleDemos
|
https://github.com/WoronowiczGIT/SimpleDemos
|
44454a9a8f27d6ba6816c993116476c412a2582d
|
785b5adb3568519c578c412ced8862411ff503e9
|
refs/heads/master
| 2022-12-04T15:14:06.723000 | 2019-09-01T18:20:01 | 2019-09-01T18:20:01 | 177,569,071 | 0 | 0 | null | false | 2022-11-24T10:18:36 | 2019-03-25T11:00:04 | 2019-09-01T18:20:13 | 2022-11-24T10:18:33 | 918 | 0 | 0 | 31 |
Java
| false | false |
package sda.ToDoListDemo1;
public enum Priorities {
LOW,MID,HIGH;
}
|
UTF-8
|
Java
| 73 |
java
|
Priorities.java
|
Java
|
[] | null |
[] |
package sda.ToDoListDemo1;
public enum Priorities {
LOW,MID,HIGH;
}
| 73 | 0.726027 | 0.712329 | 5 | 13.6 | 11.110355 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
0
|
878ab09f3e9349be27481476543c477d5c5170a6
| 18,545,668,806,552 |
ba45dfc9c2c8853ecf3d5cdfce25fb17aff1ca96
|
/src/main/java/run/yuyang/db/recovery/LogManger.java
|
78211541ffb56817fad74e67633244436db7517c
|
[] |
no_license
|
CNYuYang/BusTub
|
https://github.com/CNYuYang/BusTub
|
f7661c89a934de05f62056355d71ed74f564bbca
|
bbc4e49a2206a2adefb40fd2e7895f1750606ec2
|
refs/heads/master
| 2023-01-19T21:29:10.947000 | 2020-11-25T03:15:01 | 2020-11-25T03:15:01 | 262,071,931 | 32 | 2 | null | false | 2020-11-25T03:15:02 | 2020-05-07T14:23:20 | 2020-11-24T07:53:12 | 2020-11-25T03:15:01 | 61 | 13 | 1 | 1 |
Java
| false | false |
package run.yuyang.db.recovery;
/**
* @author YuYang
*/
public class LogManger {
/**
* 设置enable_logging = true
* 启动一个单独的线程以定期执行刷新到磁盘操作
* 超时或日志缓冲区已满或缓冲时可以触发刷新
* 池管理器要强制刷新(仅在刷新的页面具有
* 比持久LSN更大的LSN)
*
* 这个线程永远运行直到系统关闭/ StopFlushThread
*/
public void runFlushThread() {}
/**
* 停止并加入刷新线程,设置enable_logging = false
*/
public void stopFlushThread() {}
}
|
GB18030
|
Java
| 608 |
java
|
LogManger.java
|
Java
|
[
{
"context": "package run.yuyang.db.recovery;\n\n/**\n * @author YuYang\n */\npublic class LogManger {\n\n /**\n * 设置en",
"end": 54,
"score": 0.9997475147247314,
"start": 48,
"tag": "NAME",
"value": "YuYang"
}
] | null |
[] |
package run.yuyang.db.recovery;
/**
* @author YuYang
*/
public class LogManger {
/**
* 设置enable_logging = true
* 启动一个单独的线程以定期执行刷新到磁盘操作
* 超时或日志缓冲区已满或缓冲时可以触发刷新
* 池管理器要强制刷新(仅在刷新的页面具有
* 比持久LSN更大的LSN)
*
* 这个线程永远运行直到系统关闭/ StopFlushThread
*/
public void runFlushThread() {}
/**
* 停止并加入刷新线程,设置enable_logging = false
*/
public void stopFlushThread() {}
}
| 608 | 0.610048 | 0.610048 | 24 | 16.416666 | 14.059151 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | false | false |
0
|
898952cb729f9ea1e924cb31e5212b71a0f22d52
| 29,214,367,580,203 |
8ba9a0a87f7aa19bf0296b4861c03f6e1e2e4b19
|
/src/main/java/dolla/command/RemoveBillCommand.java
|
e19f97030941f0de39970945c338868d1d53a162
|
[] |
no_license
|
AY1920S1-CS2113T-F11-2/main
|
https://github.com/AY1920S1-CS2113T-F11-2/main
|
d029e619a9eb5f678e78cf73ae0e2eea638b9d16
|
0c12bdcc8216f66bea46f63347bfd51460914497
|
refs/heads/master
| 2020-07-23T04:17:57.213000 | 2019-11-11T15:49:17 | 2019-11-11T15:49:17 | 207,443,876 | 0 | 3 | null | true | 2019-11-11T15:49:18 | 2019-09-10T02:04:57 | 2019-11-11T15:36:00 | 2019-11-11T15:49:18 | 10,836 | 0 | 4 | 31 |
Java
| false | false |
package dolla.command;
import dolla.model.DollaData;
import dolla.ui.DebtUi;
public class RemoveBillCommand extends Command {
protected int billNum;
public RemoveBillCommand(int billNum) {
this.billNum = billNum;
}
@Override
public void execute(DollaData dollaData) {
dollaData.removeFromRecordList("bill", billNum - 1);
DebtUi.printRemoveBillMessage();
}
@Override
public String getCommandInfo() {
return "bill " + billNum;
}
}
|
UTF-8
|
Java
| 503 |
java
|
RemoveBillCommand.java
|
Java
|
[] | null |
[] |
package dolla.command;
import dolla.model.DollaData;
import dolla.ui.DebtUi;
public class RemoveBillCommand extends Command {
protected int billNum;
public RemoveBillCommand(int billNum) {
this.billNum = billNum;
}
@Override
public void execute(DollaData dollaData) {
dollaData.removeFromRecordList("bill", billNum - 1);
DebtUi.printRemoveBillMessage();
}
@Override
public String getCommandInfo() {
return "bill " + billNum;
}
}
| 503 | 0.671968 | 0.66998 | 24 | 19.958334 | 18.483053 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
0
|
4772274ca1031cfd8c56c2ff177dc5cd3cf1a016
| 17,059,610,129,531 |
92570aed4924bd276be8ff23f3c1f9b2900f2393
|
/src/cs3500/music/model/MusicModel.java
|
7d05b0f93c2de0c65eb9ebd5c01f5ac2f811fb7d
|
[] |
no_license
|
blasphemetheus/Assignment7
|
https://github.com/blasphemetheus/Assignment7
|
f6a40f3bd383b26393c7a9cd248d7f4462bc12df
|
091ddf4385031f88f98a57b4e044d18eec362f81
|
refs/heads/master
| 2021-01-23T08:21:49.417000 | 2017-04-12T23:08:52 | 2017-04-12T23:08:52 | 86,509,248 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cs3500.music.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Stack;
import cs3500.music.util.*;
/**
* Represents the model for an instance of the Music Editor.
*/
public final class MusicModel implements ModelOperations {
// To hold our notes
private List<Note> storedNotes;
// to hold the instrument
private Instrument instrument;
// to hold the tempo
private int tempo;
// Helps figure out the length of this model
//private int currentLength;
// rip hashtable/map method of storing notes
// Stores stuff for save and retrieve
Stack<List<Note>> stackTrack;
/**
* Constructs a MusicModel (storing the default Meter and Track).
*/
public MusicModel() {
this.storedNotes = new ArrayList<>();
this.stackTrack = new Stack<List<Note>>();
this.instrument = Instrument.SINE;
this.tempo = 10000;
}
@Override
public void edit(Note input, Note output) {
for (Note note : storedNotes) {
if (note.equals(input)) {
note = new Note(output.getPitch(), output.getOctave(), output.getDur());
} else {
throw new IllegalArgumentException("Note: " + input + "does not exist in this model");
}
}
}
@Override
public List<Note> getNotes() {
return this.storedNotes;
}
@Override
public void changeInstrument(Instrument instrument) {
Objects.requireNonNull(instrument);
this.instrument = instrument;
}
@Override
public int numBeats() {
List<Integer> noteEndings = new ArrayList<>();
for (Note note : storedNotes) {
noteEndings.add(note.getDur().getEndBeat());
}
if (noteEndings.isEmpty()) {
return 0;
}
int last = Collections.max(noteEndings);
return last;
}
@Override
public Note getLowestNote() throws IllegalArgumentException {
Note lowest = null;
for (Note note : storedNotes) {
if (lowest == null) {
lowest = note;
} else {
if (note.isLower(lowest)) {
lowest = note;
}
}
}
if (lowest == null) {
throw new IllegalArgumentException("there are no lowest notes - there are no notes");
}
return lowest;
}
@Override
public Note getHighestNote() throws IllegalArgumentException {
Note highest = null;
for (Note note : storedNotes) {
if (highest == null) {
highest = note;
} else {
if (note.isHigher(highest)) {
highest = note;
}
}
}
if (highest == null) {
throw new IllegalArgumentException("there are no highest notes - there are no notes");
}
return highest;
}
@Override
public void overwriteWith(ModelOperations thatTrack) {
Objects.requireNonNull(thatTrack);
Objects.requireNonNull(thatTrack.getNotes());
this.storedNotes = thatTrack.getNotes();
this.instrument = thatTrack.getInstrument();
this.tempo = thatTrack.getTempo();
}
@Override
public void startEditor() {
this.overwriteWith(new MusicModel());
}
@Override
public void save() {
stackTrack.push(this.storedNotes);
}
@Override
public void retrieve() throws IllegalStateException {
if (stackTrack.isEmpty()) {
throw new IllegalStateException("No Track to Retrieve");
}
this.storedNotes = this.stackTrack.pop();
}
@Override
public void setTempo(int microsecondsPerBeat) {
if (microsecondsPerBeat <= 0) {
throw new IllegalArgumentException("Invalid Tempo (in microseconds per beat: "
+ microsecondsPerBeat);
}
this.tempo = microsecondsPerBeat;
}
@Override
public int getTempo() {
return this.tempo;
}
@Override
public void addNote(Note note) throws IllegalArgumentException {
Objects.requireNonNull(note);
Duration noteDur = note.getDur();
if (this.storedNotes.isEmpty()) {
this.storedNotes.add(note);
} else {
boolean contains = true;
for (int i = 0; i < this.storedNotes.size(); i++) {
if (this.storedNotes.get(i).equals(note)) {
contains = false;
}
}
if (contains) {
this.storedNotes.add(note);
} else {
throw new IllegalArgumentException("Note already exists");
}
}
}
@Override
public void removeNote(Note note) throws IllegalArgumentException {
Objects.requireNonNull(note);
if (storedNotes.contains(note)) {
for (Note currentNote : storedNotes) {
if (currentNote.equals(note)) {
storedNotes.remove(note);
break;
// after it removes the intended note is stops searching
}
}
} else {
throw new IllegalArgumentException("Note:" + note + "does not exist");
}
}
@Override
public void removeAllOf(Pitch pitch, Octave octave) {
Objects.requireNonNull(pitch);
Objects.requireNonNull(octave);
List<Note> notesToDestroy = new ArrayList<>();
for (Note note : storedNotes) {
if (note.getPitch() == pitch && note.getOctave() == octave) {
storedNotes.remove(note);
}
}
}
@Override
public void mergeWith(ModelOperations thatTrack) {
Objects.requireNonNull(thatTrack);
this.storedNotes.addAll(thatTrack.getNotes());
}
@Override
public void combineConsecutively(ModelOperations thatTrack) {
Objects.requireNonNull(thatTrack);
int last = this.numBeats();
for (Note note : storedNotes) {
Duration d = note.getDur();
d.setStartBeat(last + d.getStartBeat());
storedNotes.add(note);
}
}
@Override
public List<Note> getAllPlayingAtBeat(int beat) {
List<Note> output = new ArrayList<>();
for (Note note : storedNotes) {
Duration dur = note.getDur();
if (dur.getStartBeat() <= beat && dur.getEndBeat() >= beat) {
output.add(note);
}
}
return output;
}
@Override
public List<Note> getAllStartingAtBeat(int beat) {
List<Note> startingAt = this.getAllPlayingAtBeat(beat);
for (Note note : storedNotes) {
Duration dur = note.getDur();
if (dur.getStartBeat() == beat) {
startingAt.add(note);
}
}
return startingAt;
}
@Override
public boolean isEmpty() {
return this.storedNotes.isEmpty();
}
@Override
public Instrument getInstrument() {
return this.instrument;
}
/**
* Returns a map of Integer to list of notes representing the stored notes.
* @return a map of list of notes
*/
public Map<Integer, List<Note>> getMap() {
return null;
}
/**
* The builder class for my MusicModel.
*/
public static final class Builder implements CompositionBuilder<ModelOperations> {
List<Note> listOfNotes;
int tempo;
public Builder() {
listOfNotes = new ArrayList<>();
tempo = -1;
}
/**
* Constructs an actual composition, given the notes that have been added.
*
* @return The new composition
*/
@Override
public ModelOperations build() {
ModelOperations model = new MusicModel();
if (tempo == -1) {
throw new IllegalArgumentException("Didn't setTempo silly, so it's set at dummy value -1");
}
model.setTempo(this.tempo);
for (Note note : listOfNotes) {
model.addNote(note);
}
return model;
}
/**
* Sets the tempo of the piece.
*
* @param tempo The speed, in microseconds per beat
* @return This builder
*/
@Override
public CompositionBuilder<ModelOperations> setTempo(int tempo) {
this.tempo = tempo;
return this;
}
/**
* Adds a new note to the piece.
*
* @param start The start time of the note, in beats
* @param end The end time of the note, in beats
* @param instrument The instrument number (to be interpreted by MIDI)
* @param pitch The pitch (in the range [0, 127], where 60 represents C4, the middle-C on a
* piano)
* @param volume The volume (in the range [0, 127])
*/
@Override
public CompositionBuilder<ModelOperations> addNote(int start, int end, int instrument,
int pitch, int volume) {
if (pitch > 140) {
throw new IllegalArgumentException("This pitch is too high to store in model: " + pitch);
}
if (pitch < 21) {
throw new IllegalArgumentException("This pitch is too low to store in model: " + pitch);
}
if (pitch > 127) {
throw new IllegalArgumentException("Documentation LIED: FAKE NEWS: pitch int is > 127: "
+ pitch);
}
Duration dur = new Duration(start, end - start);
Note note = new Note(Pitch.computePitch(pitch), Octave.computeOctave(pitch), dur);
this.listOfNotes.add(note);
return this;
}
// G$A10 IS THE ABSOLUTE HIGHEST NOTE THAT OUR MODEL CAN STORE
// G$A10 = 140
// G10 = 139
// F$G10 = 138
// F10 = 137
// E10 = 136
// D$E10 = 135
// D10 = 134
// C$D10 = 133
// C10 = 132
// G$A9 = 128
// G9 IS THE ABSOLUTE HIGHEST NOTE THAT WILL EVER BE PASSED TO OUR MODEL VIA TXT
// G9 = 127
// F$G9 = 126
// F9 = 125
// E9 = 124
// D$E9 = 123
// D9 = 122
// C$D9 = 121
// C9 = 120
// C8 = 108
// C7 = 96
// C6 = 84
// ...
// C5 = 72
// B5 = 71
// A$B5 = 70
// A5 = 69
// G$A4 = 68
// G4 = 67
// F$G4 = 66
// F4 = 65
// E4 = 64
// D$E4 = 63
// D4 = 62
// C$D4 = 61
// C4 = 60
// B4 = 59
// A$B4 = 58
// A4 = 57
// ...
// C3 = 48
// C2 = 36
// C1 = 24
// B1 = 23
// A$B1 = 22
// A1 = 21
// A1 IS THE ABSOLUTE LOWEST NOTE THAT IS POSSIBLE TO WRITE INTO THE MODEL
}
}
|
UTF-8
|
Java
| 9,956 |
java
|
MusicModel.java
|
Java
|
[] | null |
[] |
package cs3500.music.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Stack;
import cs3500.music.util.*;
/**
* Represents the model for an instance of the Music Editor.
*/
public final class MusicModel implements ModelOperations {
// To hold our notes
private List<Note> storedNotes;
// to hold the instrument
private Instrument instrument;
// to hold the tempo
private int tempo;
// Helps figure out the length of this model
//private int currentLength;
// rip hashtable/map method of storing notes
// Stores stuff for save and retrieve
Stack<List<Note>> stackTrack;
/**
* Constructs a MusicModel (storing the default Meter and Track).
*/
public MusicModel() {
this.storedNotes = new ArrayList<>();
this.stackTrack = new Stack<List<Note>>();
this.instrument = Instrument.SINE;
this.tempo = 10000;
}
@Override
public void edit(Note input, Note output) {
for (Note note : storedNotes) {
if (note.equals(input)) {
note = new Note(output.getPitch(), output.getOctave(), output.getDur());
} else {
throw new IllegalArgumentException("Note: " + input + "does not exist in this model");
}
}
}
@Override
public List<Note> getNotes() {
return this.storedNotes;
}
@Override
public void changeInstrument(Instrument instrument) {
Objects.requireNonNull(instrument);
this.instrument = instrument;
}
@Override
public int numBeats() {
List<Integer> noteEndings = new ArrayList<>();
for (Note note : storedNotes) {
noteEndings.add(note.getDur().getEndBeat());
}
if (noteEndings.isEmpty()) {
return 0;
}
int last = Collections.max(noteEndings);
return last;
}
@Override
public Note getLowestNote() throws IllegalArgumentException {
Note lowest = null;
for (Note note : storedNotes) {
if (lowest == null) {
lowest = note;
} else {
if (note.isLower(lowest)) {
lowest = note;
}
}
}
if (lowest == null) {
throw new IllegalArgumentException("there are no lowest notes - there are no notes");
}
return lowest;
}
@Override
public Note getHighestNote() throws IllegalArgumentException {
Note highest = null;
for (Note note : storedNotes) {
if (highest == null) {
highest = note;
} else {
if (note.isHigher(highest)) {
highest = note;
}
}
}
if (highest == null) {
throw new IllegalArgumentException("there are no highest notes - there are no notes");
}
return highest;
}
@Override
public void overwriteWith(ModelOperations thatTrack) {
Objects.requireNonNull(thatTrack);
Objects.requireNonNull(thatTrack.getNotes());
this.storedNotes = thatTrack.getNotes();
this.instrument = thatTrack.getInstrument();
this.tempo = thatTrack.getTempo();
}
@Override
public void startEditor() {
this.overwriteWith(new MusicModel());
}
@Override
public void save() {
stackTrack.push(this.storedNotes);
}
@Override
public void retrieve() throws IllegalStateException {
if (stackTrack.isEmpty()) {
throw new IllegalStateException("No Track to Retrieve");
}
this.storedNotes = this.stackTrack.pop();
}
@Override
public void setTempo(int microsecondsPerBeat) {
if (microsecondsPerBeat <= 0) {
throw new IllegalArgumentException("Invalid Tempo (in microseconds per beat: "
+ microsecondsPerBeat);
}
this.tempo = microsecondsPerBeat;
}
@Override
public int getTempo() {
return this.tempo;
}
@Override
public void addNote(Note note) throws IllegalArgumentException {
Objects.requireNonNull(note);
Duration noteDur = note.getDur();
if (this.storedNotes.isEmpty()) {
this.storedNotes.add(note);
} else {
boolean contains = true;
for (int i = 0; i < this.storedNotes.size(); i++) {
if (this.storedNotes.get(i).equals(note)) {
contains = false;
}
}
if (contains) {
this.storedNotes.add(note);
} else {
throw new IllegalArgumentException("Note already exists");
}
}
}
@Override
public void removeNote(Note note) throws IllegalArgumentException {
Objects.requireNonNull(note);
if (storedNotes.contains(note)) {
for (Note currentNote : storedNotes) {
if (currentNote.equals(note)) {
storedNotes.remove(note);
break;
// after it removes the intended note is stops searching
}
}
} else {
throw new IllegalArgumentException("Note:" + note + "does not exist");
}
}
@Override
public void removeAllOf(Pitch pitch, Octave octave) {
Objects.requireNonNull(pitch);
Objects.requireNonNull(octave);
List<Note> notesToDestroy = new ArrayList<>();
for (Note note : storedNotes) {
if (note.getPitch() == pitch && note.getOctave() == octave) {
storedNotes.remove(note);
}
}
}
@Override
public void mergeWith(ModelOperations thatTrack) {
Objects.requireNonNull(thatTrack);
this.storedNotes.addAll(thatTrack.getNotes());
}
@Override
public void combineConsecutively(ModelOperations thatTrack) {
Objects.requireNonNull(thatTrack);
int last = this.numBeats();
for (Note note : storedNotes) {
Duration d = note.getDur();
d.setStartBeat(last + d.getStartBeat());
storedNotes.add(note);
}
}
@Override
public List<Note> getAllPlayingAtBeat(int beat) {
List<Note> output = new ArrayList<>();
for (Note note : storedNotes) {
Duration dur = note.getDur();
if (dur.getStartBeat() <= beat && dur.getEndBeat() >= beat) {
output.add(note);
}
}
return output;
}
@Override
public List<Note> getAllStartingAtBeat(int beat) {
List<Note> startingAt = this.getAllPlayingAtBeat(beat);
for (Note note : storedNotes) {
Duration dur = note.getDur();
if (dur.getStartBeat() == beat) {
startingAt.add(note);
}
}
return startingAt;
}
@Override
public boolean isEmpty() {
return this.storedNotes.isEmpty();
}
@Override
public Instrument getInstrument() {
return this.instrument;
}
/**
* Returns a map of Integer to list of notes representing the stored notes.
* @return a map of list of notes
*/
public Map<Integer, List<Note>> getMap() {
return null;
}
/**
* The builder class for my MusicModel.
*/
public static final class Builder implements CompositionBuilder<ModelOperations> {
List<Note> listOfNotes;
int tempo;
public Builder() {
listOfNotes = new ArrayList<>();
tempo = -1;
}
/**
* Constructs an actual composition, given the notes that have been added.
*
* @return The new composition
*/
@Override
public ModelOperations build() {
ModelOperations model = new MusicModel();
if (tempo == -1) {
throw new IllegalArgumentException("Didn't setTempo silly, so it's set at dummy value -1");
}
model.setTempo(this.tempo);
for (Note note : listOfNotes) {
model.addNote(note);
}
return model;
}
/**
* Sets the tempo of the piece.
*
* @param tempo The speed, in microseconds per beat
* @return This builder
*/
@Override
public CompositionBuilder<ModelOperations> setTempo(int tempo) {
this.tempo = tempo;
return this;
}
/**
* Adds a new note to the piece.
*
* @param start The start time of the note, in beats
* @param end The end time of the note, in beats
* @param instrument The instrument number (to be interpreted by MIDI)
* @param pitch The pitch (in the range [0, 127], where 60 represents C4, the middle-C on a
* piano)
* @param volume The volume (in the range [0, 127])
*/
@Override
public CompositionBuilder<ModelOperations> addNote(int start, int end, int instrument,
int pitch, int volume) {
if (pitch > 140) {
throw new IllegalArgumentException("This pitch is too high to store in model: " + pitch);
}
if (pitch < 21) {
throw new IllegalArgumentException("This pitch is too low to store in model: " + pitch);
}
if (pitch > 127) {
throw new IllegalArgumentException("Documentation LIED: FAKE NEWS: pitch int is > 127: "
+ pitch);
}
Duration dur = new Duration(start, end - start);
Note note = new Note(Pitch.computePitch(pitch), Octave.computeOctave(pitch), dur);
this.listOfNotes.add(note);
return this;
}
// G$A10 IS THE ABSOLUTE HIGHEST NOTE THAT OUR MODEL CAN STORE
// G$A10 = 140
// G10 = 139
// F$G10 = 138
// F10 = 137
// E10 = 136
// D$E10 = 135
// D10 = 134
// C$D10 = 133
// C10 = 132
// G$A9 = 128
// G9 IS THE ABSOLUTE HIGHEST NOTE THAT WILL EVER BE PASSED TO OUR MODEL VIA TXT
// G9 = 127
// F$G9 = 126
// F9 = 125
// E9 = 124
// D$E9 = 123
// D9 = 122
// C$D9 = 121
// C9 = 120
// C8 = 108
// C7 = 96
// C6 = 84
// ...
// C5 = 72
// B5 = 71
// A$B5 = 70
// A5 = 69
// G$A4 = 68
// G4 = 67
// F$G4 = 66
// F4 = 65
// E4 = 64
// D$E4 = 63
// D4 = 62
// C$D4 = 61
// C4 = 60
// B4 = 59
// A$B4 = 58
// A4 = 57
// ...
// C3 = 48
// C2 = 36
// C1 = 24
// B1 = 23
// A$B1 = 22
// A1 = 21
// A1 IS THE ABSOLUTE LOWEST NOTE THAT IS POSSIBLE TO WRITE INTO THE MODEL
}
}
| 9,956 | 0.59763 | 0.57734 | 430 | 22.153488 | 22.749897 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.286047 | false | false |
0
|
214e468abb9424189622def91bfc7417f78d7aae
| 3,444,563,792,894 |
e3990e8c3b1e0b8824a0a19bf9d12e48441def7a
|
/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java
|
2d29618ec14d9c86d8bbe6389b2b541c5bec288f
|
[
"Apache-2.0"
] |
permissive
|
ebean-orm/ebean
|
https://github.com/ebean-orm/ebean
|
13c9c465f597dd2cf8b3e54e4b300543017c9dee
|
bfe94786de3c3b5859aaef5afb3a7572e62275c4
|
refs/heads/master
| 2023-08-22T12:57:34.271000 | 2023-08-22T11:43:41 | 2023-08-22T11:43:41 | 5,793,895 | 1,199 | 224 |
Apache-2.0
| false | 2023-09-11T14:05:26 | 2012-09-13T11:49:56 | 2023-09-05T12:53:16 | 2023-09-11T14:04:39 | 33,292 | 1,404 | 253 | 70 |
Java
| false | false |
package io.ebean.xtest.config;
import io.ebean.Database;
import io.ebean.DatabaseFactory;
import io.ebean.Transaction;
import io.ebean.annotation.Platform;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.dbplatform.DbIdentity;
import io.ebean.config.dbplatform.IdType;
import io.ebean.platform.h2.H2Platform;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.EBasicVer;
import org.tests.model.draftable.BasicDraftableBean;
import static org.assertj.core.api.Assertions.assertThat;
public class PlatformNoGeneratedKeysTest {
static Database server = testH2Server();
@AfterAll
public static void shutdown() {
server.shutdown();
}
@Test
public void global_serverConfig_setDisableLazyLoading() {
EBasicVer b0 = new EBasicVer("basic");
b0.setDescription("some description");
server.save(b0);
EBasicVer found = server.find(EBasicVer.class)
.select("name")
.setId(b0.getId())
.findOne();
assertThat(found.getName()).isEqualTo("basic");
assertThat(found.getDescription()).isNull();
}
@Test
public void insertBatch_expect_noIdValuesFetched() {
EBasicVer b0 = new EBasicVer("a");
EBasicVer b1 = new EBasicVer("b");
EBasicVer b2 = new EBasicVer("c");
try (Transaction transaction = server.beginTransaction()) {
transaction.setBatchMode(true);
server.save(b0);
server.save(b1);
server.save(b2);
transaction.commit();
}
assertThat(b0.getId()).isNull();
assertThat(b1.getId()).isNull();
assertThat(b2.getId()).isNull();
}
@Test
public void insertNoBatch_expect_selectIdentity() {
EBasicVer b0 = new EBasicVer("one");
server.save(b0);
assertThat(b0.getId()).isNotNull();
BasicDraftableBean d0 = new BasicDraftableBean("done");
server.save(d0);
assertThat(d0.getId()).isNotNull();
server.publish(BasicDraftableBean.class, d0.getId());
BasicDraftableBean one = server.find(BasicDraftableBean.class, d0.getId());
assertThat(one.getName()).isEqualTo("done");
assertThat(one.isDraft()).isFalse();
}
private static Database testH2Server() {
DatabaseConfig config = new DatabaseConfig();
config.setName("h2_noGeneratedKeys");
OtherH2Platform platform = new OtherH2Platform();
DbIdentity dbIdentity = platform.dbIdentity();
dbIdentity.setIdType(IdType.IDENTITY);
dbIdentity.setSupportsIdentity(true);
dbIdentity.setSupportsGetGeneratedKeys(false);
dbIdentity.setSupportsSequence(false);
dbIdentity.setSelectLastInsertedIdTemplate("select identity() --{table}");
config.setDatabasePlatform(platform);
config.getDataSourceConfig().setUsername("sa");
config.getDataSourceConfig().setPassword("");
config.getDataSourceConfig().setUrl("jdbc:h2:mem:withPCQuery;MODE=LEGACY");
config.getDataSourceConfig().setDriver("org.h2.Driver");
config.setDisableLazyLoading(true);
config.setDisableL2Cache(true);
config.setDefaultServer(false);
config.setRegister(false);
config.setDdlGenerate(true);
config.setDdlRun(true);
config.addClass(EBasicVer.class);
config.addClass(BasicDraftableBean.class);
config.loadFromProperties(); // trigger auto config for H2 1.x
return DatabaseFactory.create(config);
}
public static class OtherH2Platform extends H2Platform {
public OtherH2Platform() {
super();
this.platform = Platform.GENERIC;
}
}
}
|
UTF-8
|
Java
| 3,497 |
java
|
PlatformNoGeneratedKeysTest.java
|
Java
|
[] | null |
[] |
package io.ebean.xtest.config;
import io.ebean.Database;
import io.ebean.DatabaseFactory;
import io.ebean.Transaction;
import io.ebean.annotation.Platform;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.dbplatform.DbIdentity;
import io.ebean.config.dbplatform.IdType;
import io.ebean.platform.h2.H2Platform;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.EBasicVer;
import org.tests.model.draftable.BasicDraftableBean;
import static org.assertj.core.api.Assertions.assertThat;
public class PlatformNoGeneratedKeysTest {
static Database server = testH2Server();
@AfterAll
public static void shutdown() {
server.shutdown();
}
@Test
public void global_serverConfig_setDisableLazyLoading() {
EBasicVer b0 = new EBasicVer("basic");
b0.setDescription("some description");
server.save(b0);
EBasicVer found = server.find(EBasicVer.class)
.select("name")
.setId(b0.getId())
.findOne();
assertThat(found.getName()).isEqualTo("basic");
assertThat(found.getDescription()).isNull();
}
@Test
public void insertBatch_expect_noIdValuesFetched() {
EBasicVer b0 = new EBasicVer("a");
EBasicVer b1 = new EBasicVer("b");
EBasicVer b2 = new EBasicVer("c");
try (Transaction transaction = server.beginTransaction()) {
transaction.setBatchMode(true);
server.save(b0);
server.save(b1);
server.save(b2);
transaction.commit();
}
assertThat(b0.getId()).isNull();
assertThat(b1.getId()).isNull();
assertThat(b2.getId()).isNull();
}
@Test
public void insertNoBatch_expect_selectIdentity() {
EBasicVer b0 = new EBasicVer("one");
server.save(b0);
assertThat(b0.getId()).isNotNull();
BasicDraftableBean d0 = new BasicDraftableBean("done");
server.save(d0);
assertThat(d0.getId()).isNotNull();
server.publish(BasicDraftableBean.class, d0.getId());
BasicDraftableBean one = server.find(BasicDraftableBean.class, d0.getId());
assertThat(one.getName()).isEqualTo("done");
assertThat(one.isDraft()).isFalse();
}
private static Database testH2Server() {
DatabaseConfig config = new DatabaseConfig();
config.setName("h2_noGeneratedKeys");
OtherH2Platform platform = new OtherH2Platform();
DbIdentity dbIdentity = platform.dbIdentity();
dbIdentity.setIdType(IdType.IDENTITY);
dbIdentity.setSupportsIdentity(true);
dbIdentity.setSupportsGetGeneratedKeys(false);
dbIdentity.setSupportsSequence(false);
dbIdentity.setSelectLastInsertedIdTemplate("select identity() --{table}");
config.setDatabasePlatform(platform);
config.getDataSourceConfig().setUsername("sa");
config.getDataSourceConfig().setPassword("");
config.getDataSourceConfig().setUrl("jdbc:h2:mem:withPCQuery;MODE=LEGACY");
config.getDataSourceConfig().setDriver("org.h2.Driver");
config.setDisableLazyLoading(true);
config.setDisableL2Cache(true);
config.setDefaultServer(false);
config.setRegister(false);
config.setDdlGenerate(true);
config.setDdlRun(true);
config.addClass(EBasicVer.class);
config.addClass(BasicDraftableBean.class);
config.loadFromProperties(); // trigger auto config for H2 1.x
return DatabaseFactory.create(config);
}
public static class OtherH2Platform extends H2Platform {
public OtherH2Platform() {
super();
this.platform = Platform.GENERIC;
}
}
}
| 3,497 | 0.715184 | 0.70489 | 128 | 26.320313 | 21.965504 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false |
0
|
948cb353fc40b9ab9069a13b70619c0bf5199ff2
| 15,444,702,424,260 |
8fa38855d5a9494a35988049a6d0924763bc4c3a
|
/src/cards/DarkTransfusion.java
|
601e3a87aaaef8e51eb682ae68958b4a8d8fc8c7
|
[] |
no_license
|
Ferrerothorn/Meme-TCG
|
https://github.com/Ferrerothorn/Meme-TCG
|
fcf77ed1c81616eda99bd3a470a0c8431d90a2db
|
7ed54547c67b5b982075aeb9e8a0bc247b07c38e
|
refs/heads/master
| 2021-06-17T23:59:26.281000 | 2021-02-25T16:38:15 | 2021-02-25T16:38:15 | 180,624,729 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cards;
import java.util.Collections;
import extraData.Card;
import extraData.CorruptedBlood;
import game.Player;
public class DarkTransfusion extends Card {
public DarkTransfusion() {
this.name = "Dark Transfusion";
this.setType("Spell");
this.setColor("Black");
this.setPriority(4);
}
@Override
public void onentry(Player self, Player opponent) {
opponent.getDeck().add(new CorruptedBlood());
Collections.shuffle(opponent.getDeck());
}
@Override
public void graveAbility(Player self, Player opponent) {
}
}
|
UTF-8
|
Java
| 542 |
java
|
DarkTransfusion.java
|
Java
|
[
{
"context": "ard {\n\n\tpublic DarkTransfusion() {\n\t\tthis.name = \"Dark Transfusion\";\n\t\tthis.setType(\"Spell\");\n\t\tthis.setColor(",
"end": 222,
"score": 0.7072352170944214,
"start": 212,
"tag": "NAME",
"value": "Dark Trans"
}
] | null |
[] |
package cards;
import java.util.Collections;
import extraData.Card;
import extraData.CorruptedBlood;
import game.Player;
public class DarkTransfusion extends Card {
public DarkTransfusion() {
this.name = "<NAME>fusion";
this.setType("Spell");
this.setColor("Black");
this.setPriority(4);
}
@Override
public void onentry(Player self, Player opponent) {
opponent.getDeck().add(new CorruptedBlood());
Collections.shuffle(opponent.getDeck());
}
@Override
public void graveAbility(Player self, Player opponent) {
}
}
| 538 | 0.741697 | 0.739852 | 27 | 19.074074 | 17.819935 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.222222 | false | false |
0
|
1803e724c962582505eba00c243d57b198b1caa4
| 27,041,114,147,155 |
5621fa4fb8259e5c2231070d49b1180060ce3ff2
|
/Algorithm/src/Baekjoon/bj_1655.java
|
742025faa7992361cc43ea69f76a007a1eb47e71
|
[] |
no_license
|
maeng24/algorithm_practice
|
https://github.com/maeng24/algorithm_practice
|
d00161af8017614cdc46af68f4fddd01bc07e2b0
|
f38f270c9704c324fb279edc9d13205374325eaf
|
refs/heads/master
| 2023-04-02T09:09:41.002000 | 2021-04-03T08:01:03 | 2021-04-03T08:01:03 | 280,338,290 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Baekjoon;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Collections;
import java.util.PriorityQueue;
public class bj_1655 {
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
PriorityQueue<Integer> minheap=new PriorityQueue<>(Collections.reverseOrder());
PriorityQueue<Integer> maxheap=new PriorityQueue<>();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
int num=Integer.parseInt(br.readLine());
for(int i=0;i<num;i++){
if(i%2==0){
maxheap.add(Integer.parseInt(br.readLine()));
}else{
minheap.add(Integer.parseInt(br.readLine()));
}
//최소힙과 최대힙의 앞 순서 숫자 swap 해주기
if(!minheap.isEmpty()&&!maxheap.isEmpty()&&maxheap.peek()<minheap.peek()){
int tmp=minheap.poll();
minheap.add(maxheap.poll());
maxheap.add(tmp);
}
//짝수일 경우에는 작은 수를 말한다.
if(maxheap.size()>minheap.size()){
bw.write(maxheap.peek()+"\n");
}else{
bw.write(minheap.peek()+"\n");
}
}
bw.flush();
}
}
|
UTF-8
|
Java
| 1,317 |
java
|
bj_1655.java
|
Java
|
[] | null |
[] |
package Baekjoon;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Collections;
import java.util.PriorityQueue;
public class bj_1655 {
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
PriorityQueue<Integer> minheap=new PriorityQueue<>(Collections.reverseOrder());
PriorityQueue<Integer> maxheap=new PriorityQueue<>();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
int num=Integer.parseInt(br.readLine());
for(int i=0;i<num;i++){
if(i%2==0){
maxheap.add(Integer.parseInt(br.readLine()));
}else{
minheap.add(Integer.parseInt(br.readLine()));
}
//최소힙과 최대힙의 앞 순서 숫자 swap 해주기
if(!minheap.isEmpty()&&!maxheap.isEmpty()&&maxheap.peek()<minheap.peek()){
int tmp=minheap.poll();
minheap.add(maxheap.poll());
maxheap.add(tmp);
}
//짝수일 경우에는 작은 수를 말한다.
if(maxheap.size()>minheap.size()){
bw.write(maxheap.peek()+"\n");
}else{
bw.write(minheap.peek()+"\n");
}
}
bw.flush();
}
}
| 1,317 | 0.699284 | 0.693715 | 46 | 26.326086 | 23.428017 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.434783 | false | false |
0
|
148b8fb34295c211319322cc501c3937bd3a17e5
| 32,109,175,554,126 |
dbd9077db61aaddf0b2e8696e8a6cf1f6b9fac45
|
/grupo10-tic1-server/src/main/java/uy/edu/um/tic1/entities/cart/PurchaseItem.java
|
d2cceb1ac861fb69fe0e5fb47a92e55d17ec1d57
|
[] |
no_license
|
DuckyCB/TIC2020
|
https://github.com/DuckyCB/TIC2020
|
923b737ea8ed99920c598b6a62e019030502930c
|
01920b5fb1b72cfb35d778be36965df2de2efd88
|
refs/heads/master
| 2023-01-13T13:54:58.835000 | 2020-11-24T20:20:02 | 2020-11-24T20:20:02 | 288,592,318 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uy.edu.um.tic1.entities.cart;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import uy.edu.um.tic1.entities.SizeAndColor;
import uy.edu.um.tic1.entities.Store;
import uy.edu.um.tic1.entities.products.Product;
import uy.edu.um.tic1.entitites.cart.PurchaseItemDTO;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PurchaseItem {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ManyToOne
@JoinColumn(name = "product",
foreignKey = @ForeignKey(name = "fk_purchase_item_product")
)
@NotNull(message = "Product may not be null")
private Product product;
@ManyToOne
@JoinColumn(name = "sizeAndColor",
foreignKey = @ForeignKey(name = "fk_purchase_item_size_color")
)
@NotNull(message = "Size and color may not be null")
private SizeAndColor sizeAndColor;
private Double price;
private Integer quantity;
public PurchaseItemDTO toDTO(){
return PurchaseItemDTO.builder()
.id(this.id)
.price(this.price)
.product(this.product.toDTO())
.quantity(this.quantity)
.sizeAndColor(this.sizeAndColor.toDTO())
.build();
}
}
|
UTF-8
|
Java
| 1,407 |
java
|
PurchaseItem.java
|
Java
|
[] | null |
[] |
package uy.edu.um.tic1.entities.cart;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import uy.edu.um.tic1.entities.SizeAndColor;
import uy.edu.um.tic1.entities.Store;
import uy.edu.um.tic1.entities.products.Product;
import uy.edu.um.tic1.entitites.cart.PurchaseItemDTO;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PurchaseItem {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ManyToOne
@JoinColumn(name = "product",
foreignKey = @ForeignKey(name = "fk_purchase_item_product")
)
@NotNull(message = "Product may not be null")
private Product product;
@ManyToOne
@JoinColumn(name = "sizeAndColor",
foreignKey = @ForeignKey(name = "fk_purchase_item_size_color")
)
@NotNull(message = "Size and color may not be null")
private SizeAndColor sizeAndColor;
private Double price;
private Integer quantity;
public PurchaseItemDTO toDTO(){
return PurchaseItemDTO.builder()
.id(this.id)
.price(this.price)
.product(this.product.toDTO())
.quantity(this.quantity)
.sizeAndColor(this.sizeAndColor.toDTO())
.build();
}
}
| 1,407 | 0.673063 | 0.66951 | 57 | 23.68421 | 20.156544 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
0
|
61c8db56fcd3cb02db3cf00b193082852f3a9196
| 10,161,892,680,466 |
2a738d44ec4ee6b891cf8216d9362108e3213cf9
|
/EPM/src/functionallibraries/EPM_LoginPage.java
|
b55c7392a1a9ef471be230a12ab56d2b436cd3c3
|
[] |
no_license
|
ramachandr003/epm_test
|
https://github.com/ramachandr003/epm_test
|
60dee5506383646f1b014fe3ee1b2d27337d09c0
|
ba1d152ed894668ce2b796375b95cdb8d8ba13b7
|
refs/heads/master
| 2016-09-05T13:34:50.949000 | 2014-07-14T16:22:40 | 2014-07-14T16:22:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package functionallibraries;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import supportlibraries.*;
import com.cognizant.framework.*;
/**
* EPM LoginPage class
*
* @author Ramesh
*/
public class EPM_LoginPage extends MasterPage
{
EPM_HomePage homePage = new EPM_HomePage(scriptHelper);
//Object Locator Values
public String txtUserName = "ctl00_ContentMain_ctl00_Login1_UserName";
public String txtPassWord= "ctl00_ContentMain_ctl00_Login1_Password";
public String btnLogin = "ctl00_ContentMain_ctl00_Login1_LoginButton";
public String linkForgetPwd = "ctl00_ContentMain_ctl00_lnkForget";
//LSU Environment Login fields
public String txtFirstName = "ctl00_ContentMain_ctl00_txtFirstName";
public String txtLastName= "ctl00_ContentMain_ctl00_txtLastName";
public String txtSSN = "ctl00_ContentMain_ctl00_txtSSN4";
public String btnLoginLSU = "ctl00_ContentMain_ctl00_LoginButton";
/**
* Constructor to initialize the page
*
* @param scriptHelper
* The {@link ScriptHelper} object passed from the
* {@link TestScript}
* @param driver
* The {@link WebDriver} object passed from the
* {@link TestScript}
*/
public EPM_LoginPage(ScriptHelper scriptHelper)
{
super(scriptHelper);
}
@Override
protected void initializeUIMap()
{
}
public void verifyLoginPage() throws Exception{
try{
if(getLoginFieldsCount() == 3){
verifyLoginPageWith3TextFields();
}else{
verifyLoginPageWith2TextFields();
}
}catch(Exception e){
report.updateTestLog("Error occured.", getCurrentMethodName(this.getClass().getName()) + " : " + e.getMessage(), Status.FAIL);
}
}
public int getLoginFieldsCount(){
try{
return driver.findElements(By.xpath("//input[@type='text']")).size();
}catch(Exception e){
//Dont want to fail the test. Assuming most of the times we are testing with UserID and Password login
//so Return 2 in case of any exception
return 2;
}
}
public void loginEPM() throws Exception{
try{
if(getLoginFieldsCount() == 3){
String firstName = dataTable.getData("General_Data", "FirstName");
String lastName = dataTable.getData("General_Data", "LastName");
String ssn4digits = dataTable.getData("General_Data", "SSN");
verifyLoginPageWith3TextFields();
typeOnElement(txtFirstName, firstName);
typeOnElement(txtLastName, lastName);
typeOnElement(txtSSN, ssn4digits);
clickElement(btnLoginLSU);
report.updateTestLog("Login with FirstName '"+ firstName +"', LastName '"+ lastName +"', SSN '"+ ssn4digits +"' fields and Submit login.", "Login fields are entered and Login Submitted.", Status.DONE);
homePage.verifyLoginFuncAndHome();
}else{
String userName = dataTable.getData("General_Data", "UserName");
String passWord = dataTable.getData("General_Data", "Password");
verifyLoginPageWith2TextFields();
enterUserName(userName);
enterPassword(passWord);
clickLoginButton();
homePage.verifyLoginFuncAndHome();
}
}catch(Exception e){
report.updateTestLog("Error occured. LOGIN FAIL", getCurrentMethodName(this.getClass().getName()) + " : " + e.getMessage(), Status.FAIL);
exitTestOnFail();
}
}
public void verifyLoginPageWith3TextFields() throws Exception{
if(validateElementPresence("First name",txtFirstName) != null && validateElementPresence("Last Name", txtLastName) != null && validateElementPresence("SSN", txtSSN) != null){
report.updateTestLog("Verify First & Last Name, SSN Fields displayed in login Page", "EPM Login page is displayed with First & Last Name, SSN Fields", Status.PASS);
}else{
report.updateTestLog("Verify First & Last Name, SSN Fields displayed in Login Page", "EPM Login page is NOT displayed..", Status.FAIL);
}
}
public void verifyLoginPageWith2TextFields() throws Exception{
if(validateElementPresence("User Name EditBox",txtUserName) != null && validateElementPresence("Password EditBox", txtPassWord) != null){
report.updateTestLog("Verify UserName and Password Fields displayed in login Page", "EPM Login page is displayed with Username and Password fields", Status.PASS);
}else{
report.updateTestLog("Verify UserName and Password Fields displayed in Login Page", "EPM Login page is NOT displayed..", Status.FAIL);
}
}
public void enterUserName(String textToBeTyped) throws Exception{
try{
typeOnElement(txtUserName, textToBeTyped);
report.updateTestLog("Enter UserName", " ' "+ textToBeTyped + " ' " + " is entered in the UserName text field", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "enterUserName" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
public void enterPassword(String textToBeTyped) throws Exception{
try{
typeOnElement(txtPassWord, textToBeTyped);
report.updateTestLog("Enter Password", " ' "+ textToBeTyped + " ' " + " is entered in the Password text field", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "enterPassword" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
public void clickLoginButton() throws Exception {
try{
clickElement(btnLogin);
report.updateTestLog("Click Login Button", "Login Button is clicked", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "clickLoginButton" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
public void clickForgetPwdLink() throws Exception {
try{
clickElement(linkForgetPwd);
report.updateTestLog("Click Forget password Link", "Forget password Link is clicked", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "clickForgetPwdLink" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
}
|
UTF-8
|
Java
| 6,288 |
java
|
EPM_LoginPage.java
|
Java
|
[
{
"context": "*;\r\n\r\n/**\r\n * EPM LoginPage class\r\n * \r\n * @author Ramesh\r\n */\r\npublic class EPM_LoginPage extends MasterPa",
"end": 297,
"score": 0.9795477390289307,
"start": 291,
"tag": "NAME",
"value": "Ramesh"
},
{
"context": "0_Login1_UserName\";\r\n\tpublic String txtPassWord= \"ctl00_ContentMain_ctl00_Login1_Password\";\r\n\tpublic String btnLogin = \"ctl00_ContentMain_c",
"end": 585,
"score": 0.9891905188560486,
"start": 546,
"tag": "PASSWORD",
"value": "ctl00_ContentMain_ctl00_Login1_Password"
},
{
"context": "ing userName = dataTable.getData(\"General_Data\", \"UserName\");\r\n\t\t\t\tString passWord = dataTable.getData(\"Gene",
"end": 2993,
"score": 0.8946221470832825,
"start": 2985,
"tag": "USERNAME",
"value": "UserName"
},
{
"context": "ing passWord = dataTable.getData(\"General_Data\", \"Password\");\r\n\t\t\t\tverifyLoginPageWith2TextFields();\r\n\t\t\t\ten",
"end": 3063,
"score": 0.814495861530304,
"start": 3055,
"tag": "PASSWORD",
"value": "Password"
}
] | null |
[] |
package functionallibraries;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import supportlibraries.*;
import com.cognizant.framework.*;
/**
* EPM LoginPage class
*
* @author Ramesh
*/
public class EPM_LoginPage extends MasterPage
{
EPM_HomePage homePage = new EPM_HomePage(scriptHelper);
//Object Locator Values
public String txtUserName = "ctl00_ContentMain_ctl00_Login1_UserName";
public String txtPassWord= "<PASSWORD>";
public String btnLogin = "ctl00_ContentMain_ctl00_Login1_LoginButton";
public String linkForgetPwd = "ctl00_ContentMain_ctl00_lnkForget";
//LSU Environment Login fields
public String txtFirstName = "ctl00_ContentMain_ctl00_txtFirstName";
public String txtLastName= "ctl00_ContentMain_ctl00_txtLastName";
public String txtSSN = "ctl00_ContentMain_ctl00_txtSSN4";
public String btnLoginLSU = "ctl00_ContentMain_ctl00_LoginButton";
/**
* Constructor to initialize the page
*
* @param scriptHelper
* The {@link ScriptHelper} object passed from the
* {@link TestScript}
* @param driver
* The {@link WebDriver} object passed from the
* {@link TestScript}
*/
public EPM_LoginPage(ScriptHelper scriptHelper)
{
super(scriptHelper);
}
@Override
protected void initializeUIMap()
{
}
public void verifyLoginPage() throws Exception{
try{
if(getLoginFieldsCount() == 3){
verifyLoginPageWith3TextFields();
}else{
verifyLoginPageWith2TextFields();
}
}catch(Exception e){
report.updateTestLog("Error occured.", getCurrentMethodName(this.getClass().getName()) + " : " + e.getMessage(), Status.FAIL);
}
}
public int getLoginFieldsCount(){
try{
return driver.findElements(By.xpath("//input[@type='text']")).size();
}catch(Exception e){
//Dont want to fail the test. Assuming most of the times we are testing with UserID and Password login
//so Return 2 in case of any exception
return 2;
}
}
public void loginEPM() throws Exception{
try{
if(getLoginFieldsCount() == 3){
String firstName = dataTable.getData("General_Data", "FirstName");
String lastName = dataTable.getData("General_Data", "LastName");
String ssn4digits = dataTable.getData("General_Data", "SSN");
verifyLoginPageWith3TextFields();
typeOnElement(txtFirstName, firstName);
typeOnElement(txtLastName, lastName);
typeOnElement(txtSSN, ssn4digits);
clickElement(btnLoginLSU);
report.updateTestLog("Login with FirstName '"+ firstName +"', LastName '"+ lastName +"', SSN '"+ ssn4digits +"' fields and Submit login.", "Login fields are entered and Login Submitted.", Status.DONE);
homePage.verifyLoginFuncAndHome();
}else{
String userName = dataTable.getData("General_Data", "UserName");
String passWord = dataTable.getData("General_Data", "<PASSWORD>");
verifyLoginPageWith2TextFields();
enterUserName(userName);
enterPassword(passWord);
clickLoginButton();
homePage.verifyLoginFuncAndHome();
}
}catch(Exception e){
report.updateTestLog("Error occured. LOGIN FAIL", getCurrentMethodName(this.getClass().getName()) + " : " + e.getMessage(), Status.FAIL);
exitTestOnFail();
}
}
public void verifyLoginPageWith3TextFields() throws Exception{
if(validateElementPresence("First name",txtFirstName) != null && validateElementPresence("Last Name", txtLastName) != null && validateElementPresence("SSN", txtSSN) != null){
report.updateTestLog("Verify First & Last Name, SSN Fields displayed in login Page", "EPM Login page is displayed with First & Last Name, SSN Fields", Status.PASS);
}else{
report.updateTestLog("Verify First & Last Name, SSN Fields displayed in Login Page", "EPM Login page is NOT displayed..", Status.FAIL);
}
}
public void verifyLoginPageWith2TextFields() throws Exception{
if(validateElementPresence("User Name EditBox",txtUserName) != null && validateElementPresence("Password EditBox", txtPassWord) != null){
report.updateTestLog("Verify UserName and Password Fields displayed in login Page", "EPM Login page is displayed with Username and Password fields", Status.PASS);
}else{
report.updateTestLog("Verify UserName and Password Fields displayed in Login Page", "EPM Login page is NOT displayed..", Status.FAIL);
}
}
public void enterUserName(String textToBeTyped) throws Exception{
try{
typeOnElement(txtUserName, textToBeTyped);
report.updateTestLog("Enter UserName", " ' "+ textToBeTyped + " ' " + " is entered in the UserName text field", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "enterUserName" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
public void enterPassword(String textToBeTyped) throws Exception{
try{
typeOnElement(txtPassWord, textToBeTyped);
report.updateTestLog("Enter Password", " ' "+ textToBeTyped + " ' " + " is entered in the Password text field", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "enterPassword" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
public void clickLoginButton() throws Exception {
try{
clickElement(btnLogin);
report.updateTestLog("Click Login Button", "Login Button is clicked", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "clickLoginButton" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
public void clickForgetPwdLink() throws Exception {
try{
clickElement(linkForgetPwd);
report.updateTestLog("Click Forget password Link", "Forget password Link is clicked", Status.DONE);
}catch(Exception e){
report.updateTestLog("Error occured.", this.getClass().getName() + "." + "clickForgetPwdLink" + " : " + e.getMessage(), Status.FAIL);
e.printStackTrace();
throw e;
}
}
}
| 6,261 | 0.688295 | 0.680503 | 167 | 35.664669 | 42.661823 | 205 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.682635 | false | false |
0
|
5998497cc87b480ec7db2fd60e384330b12c9296
| 1,202,590,863,709 |
04249663d32af64a21896c91dbcae827e221134e
|
/src/main/java/com/buykop/console/entity/InvokeLog.java
|
e553cc490f95a4b9bf1d05bcf6d6c6116b51d6f7
|
[
"Apache-2.0"
] |
permissive
|
fangziming-ff/buykop
|
https://github.com/fangziming-ff/buykop
|
302247243606c039625cecdff351e3769d986ee4
|
5c6a9c2afd793d00bc6923d3d84b19afd6d242aa
|
refs/heads/main
| 2023-03-15T22:02:06.275000 | 2021-03-08T02:54:42 | 2021-03-08T02:54:42 | 345,501,593 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.buykop.console.entity;
import java.util.Date;
import com.buykop.framework.annotation.CodeValue;
import com.buykop.framework.annotation.Column;
import com.buykop.framework.annotation.FK;
import com.buykop.framework.annotation.Index;
import com.buykop.framework.annotation.IndexList;
import com.buykop.framework.annotation.Mongo;
import com.buykop.framework.annotation.PK;
import com.buykop.framework.annotation.per.MemberId;
import com.buykop.framework.annotation.per.UserId;
import com.buykop.framework.annotation.util.DBLen;
import com.buykop.framework.scan.ServerConfig;
import com.buykop.framework.util.type.BaseChartEntity;
import com.buykop.console.util.Constants;
/**
* 链路跟踪
*
* @author GIF
*
*/
@Mongo(code = "M_INVOKE_LOG", display = "链路跟踪", sys = Constants.current_sys, defaultOrderByField = "!invokeTime", retainDays = 0, redisEntity = false, transaction = false)
@IndexList(value = { @Index(fields = "!invokeTime", name = "invokeTime", unique = false, prompt = "", seq = 0) })
public class InvokeLog extends BaseChartEntity {
/**
*
*/
private static final long serialVersionUID = -6937231398484165256L;
@PK
@Column(dbLen = DBLen.idLen, displayName = "", isNotNull = false, label = "")
protected String id;//
@Column(dbLen = DBLen.idLen, displayName = "业务id", isNotNull = false, label = "")
protected String busiId;//
@Column(dbLen = DBLen.len256, displayName = "业务类名", isNotNull = false, label = "", fieldType = 2)
protected String className;//
@Column(dbLen = DBLen.len64, displayName = "入口方法", isNotNull = false, label = "", fieldType = 2)
protected String method;//
@Column(dbLen = DBLen.len64, displayName = "操作类型", isNotNull = false, label = "")
protected String actionType;//
@Column(dbLen = DBLen.len512, displayName = "备注", isNotNull = false, label = "", fieldType = 2)
protected String remark;//
@Column(dbLen = DBLen.len512, displayName = "参数", isNotNull = false, label = "", fieldType = 2)
protected String param;//
@Column(dbLen = DBLen.len512, displayName = "返回结果", isNotNull = false, label = "", fieldType = 2)
protected String result;//
@Column(dbLen = DBLen.dateLen, displayName = "调用时间", isNotNull = false, label = "")
protected Date invokeTime;
@Column(dbLen = DBLen.len4, displayName = "执行时间(毫秒)", isNotNull = false, label = "")
protected Long execTime;
@CodeValue(codeType = "3")
@Column(dbLen = DBLen.len4, displayName = "是否成功", isNotNull = false, label = "", defaultValue = "1")
protected Integer success;
@UserId
@Column(dbLen = DBLen.idLen, displayName = "调用人", label = "")
private String invokeUserId;
@MemberId
@Column(dbLen = DBLen.idLen, displayName = "调用机构", label = "")
private String invokeMemberId;
@Column(dbLen = DBLen.idLen, displayName = "访问令牌", label = "")
private String token;
@Column(dbLen = DBLen.len512, displayName = "事件", isNotNull = false, label = "", fieldType = 2)
protected String event;//
@FK(table = ServerConfig.class)
@Column(dbLen = DBLen.idLen, displayName = "服务", label = "")
private String serverId;
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getServerId() {
return serverId;
}
public void setServerId(String serverId) {
this.serverId = serverId;
}
public Integer getSuccess() {
return success;
}
public void setSuccess(Integer success) {
this.success = success;
}
public Long getExecTime() {
return execTime;
}
public void setExecTime(Long execTime) {
this.execTime = execTime;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBusiId() {
return busiId;
}
public void setBusiId(String busiId) {
this.busiId = busiId;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getActionType() {
return actionType;
}
public void setActionType(String actionType) {
this.actionType = actionType;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getInvokeTime() {
return invokeTime;
}
public void setInvokeTime(Date invokeTime) {
this.invokeTime = invokeTime;
}
public String getInvokeUserId() {
return invokeUserId;
}
public void setInvokeUserId(String invokeUserId) {
this.invokeUserId = invokeUserId;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public String getInvokeMemberId() {
return invokeMemberId;
}
public void setInvokeMemberId(String invokeMemberId) {
this.invokeMemberId = invokeMemberId;
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
@Override
public String getChartDateDisplay() {
// TODO Auto-generated method stub
return "记录时间";
}
}
|
UTF-8
|
Java
| 5,313 |
java
|
InvokeLog.java
|
Java
|
[
{
"context": "onsole.util.Constants;\n\n/**\n * 链路跟踪\n * \n * @author GIF\n *\n */\n@Mongo(code = \"M_INVOKE_LOG\", display = \"链路",
"end": 715,
"score": 0.661422610282898,
"start": 712,
"tag": "NAME",
"value": "GIF"
}
] | null |
[] |
package com.buykop.console.entity;
import java.util.Date;
import com.buykop.framework.annotation.CodeValue;
import com.buykop.framework.annotation.Column;
import com.buykop.framework.annotation.FK;
import com.buykop.framework.annotation.Index;
import com.buykop.framework.annotation.IndexList;
import com.buykop.framework.annotation.Mongo;
import com.buykop.framework.annotation.PK;
import com.buykop.framework.annotation.per.MemberId;
import com.buykop.framework.annotation.per.UserId;
import com.buykop.framework.annotation.util.DBLen;
import com.buykop.framework.scan.ServerConfig;
import com.buykop.framework.util.type.BaseChartEntity;
import com.buykop.console.util.Constants;
/**
* 链路跟踪
*
* @author GIF
*
*/
@Mongo(code = "M_INVOKE_LOG", display = "链路跟踪", sys = Constants.current_sys, defaultOrderByField = "!invokeTime", retainDays = 0, redisEntity = false, transaction = false)
@IndexList(value = { @Index(fields = "!invokeTime", name = "invokeTime", unique = false, prompt = "", seq = 0) })
public class InvokeLog extends BaseChartEntity {
/**
*
*/
private static final long serialVersionUID = -6937231398484165256L;
@PK
@Column(dbLen = DBLen.idLen, displayName = "", isNotNull = false, label = "")
protected String id;//
@Column(dbLen = DBLen.idLen, displayName = "业务id", isNotNull = false, label = "")
protected String busiId;//
@Column(dbLen = DBLen.len256, displayName = "业务类名", isNotNull = false, label = "", fieldType = 2)
protected String className;//
@Column(dbLen = DBLen.len64, displayName = "入口方法", isNotNull = false, label = "", fieldType = 2)
protected String method;//
@Column(dbLen = DBLen.len64, displayName = "操作类型", isNotNull = false, label = "")
protected String actionType;//
@Column(dbLen = DBLen.len512, displayName = "备注", isNotNull = false, label = "", fieldType = 2)
protected String remark;//
@Column(dbLen = DBLen.len512, displayName = "参数", isNotNull = false, label = "", fieldType = 2)
protected String param;//
@Column(dbLen = DBLen.len512, displayName = "返回结果", isNotNull = false, label = "", fieldType = 2)
protected String result;//
@Column(dbLen = DBLen.dateLen, displayName = "调用时间", isNotNull = false, label = "")
protected Date invokeTime;
@Column(dbLen = DBLen.len4, displayName = "执行时间(毫秒)", isNotNull = false, label = "")
protected Long execTime;
@CodeValue(codeType = "3")
@Column(dbLen = DBLen.len4, displayName = "是否成功", isNotNull = false, label = "", defaultValue = "1")
protected Integer success;
@UserId
@Column(dbLen = DBLen.idLen, displayName = "调用人", label = "")
private String invokeUserId;
@MemberId
@Column(dbLen = DBLen.idLen, displayName = "调用机构", label = "")
private String invokeMemberId;
@Column(dbLen = DBLen.idLen, displayName = "访问令牌", label = "")
private String token;
@Column(dbLen = DBLen.len512, displayName = "事件", isNotNull = false, label = "", fieldType = 2)
protected String event;//
@FK(table = ServerConfig.class)
@Column(dbLen = DBLen.idLen, displayName = "服务", label = "")
private String serverId;
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getServerId() {
return serverId;
}
public void setServerId(String serverId) {
this.serverId = serverId;
}
public Integer getSuccess() {
return success;
}
public void setSuccess(Integer success) {
this.success = success;
}
public Long getExecTime() {
return execTime;
}
public void setExecTime(Long execTime) {
this.execTime = execTime;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBusiId() {
return busiId;
}
public void setBusiId(String busiId) {
this.busiId = busiId;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getActionType() {
return actionType;
}
public void setActionType(String actionType) {
this.actionType = actionType;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getInvokeTime() {
return invokeTime;
}
public void setInvokeTime(Date invokeTime) {
this.invokeTime = invokeTime;
}
public String getInvokeUserId() {
return invokeUserId;
}
public void setInvokeUserId(String invokeUserId) {
this.invokeUserId = invokeUserId;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public String getInvokeMemberId() {
return invokeMemberId;
}
public void setInvokeMemberId(String invokeMemberId) {
this.invokeMemberId = invokeMemberId;
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
@Override
public String getChartDateDisplay() {
// TODO Auto-generated method stub
return "记录时间";
}
}
| 5,313 | 0.707152 | 0.697513 | 224 | 22.15625 | 26.797981 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.366071 | false | false |
0
|
cbe886485b755dff45ecca05cdc7c88499816db8
| 33,595,234,207,188 |
60abe6fcff03427de6424d43668f3a36a58e543f
|
/jyshop-coupon/src/main/java/com/qyy/jyshop/coupon/service/CouponService.java
|
9dcd12b8c203edf37aab4b5d9ae7403929b7a832
|
[] |
no_license
|
git4wuwenping/jyshop
|
https://github.com/git4wuwenping/jyshop
|
dc987b6416b0fb594cb3d248ca1d88fd28a0ce53
|
9ce36394cdcb0514bd49cebddf3a464f6e32b4f6
|
refs/heads/master
| 2020-03-28T14:22:28.619000 | 2018-09-14T13:43:16 | 2018-09-14T13:43:16 | 148,481,972 | 2 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.qyy.jyshop.coupon.service;
import java.util.Map;
import com.qyy.jyshop.pojo.PageAjax;
public interface CouponService {
PageAjax<Map<String, Object>> getCouponList(Integer pageNo, Integer pageSize);
Map<String, Object> couponDetail(Long cpnId,Integer pageNo, Integer pageSize);
}
|
UTF-8
|
Java
| 311 |
java
|
CouponService.java
|
Java
|
[] | null |
[] |
package com.qyy.jyshop.coupon.service;
import java.util.Map;
import com.qyy.jyshop.pojo.PageAjax;
public interface CouponService {
PageAjax<Map<String, Object>> getCouponList(Integer pageNo, Integer pageSize);
Map<String, Object> couponDetail(Long cpnId,Integer pageNo, Integer pageSize);
}
| 311 | 0.755627 | 0.755627 | 15 | 19.733334 | 28.081944 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
0
|
5d7f20feca454b7035f54b95556dc89fb7457bf4
| 20,143,396,662,580 |
8e54730483a113a0cb760025893a306c67352e15
|
/Shiro Project/src/main/java/com/mmall/filter/LoginFilter.java
|
f256f8f97705cd2455fef34de880cbb308387c0f
|
[] |
no_license
|
LSYlsy123/RBAC
|
https://github.com/LSYlsy123/RBAC
|
faa2feee48ada98a475d765ea9216ebb6453437a
|
0c5fa841ce57950dfa86e502171e1c46d43bba74
|
refs/heads/master
| 2020-03-21T05:15:58.422000 | 2018-06-21T11:44:38 | 2018-06-21T11:44:38 | 138,152,435 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mmall.filter;
import com.mmall.common.RequestHolder;
import com.mmall.model.SysUser;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 校验用户是否登录
*/
@Slf4j
public class LoginFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest req=(HttpServletRequest)servletRequest;
HttpServletResponse resp=(HttpServletResponse)servletResponse;
//取出用户登录的信息,如为空则未登录,跳转到登录页面
SysUser sysUser=(SysUser)req.getSession().getAttribute("user");
if (sysUser==null){
String path="/signin.jsp";
resp.sendRedirect(path);
return;
}
//如果有值,加入到requestHolder里
RequestHolder.add(sysUser);
RequestHolder.add(req);
filterChain.doFilter(servletRequest,servletResponse);
return;
}
@Override
public void destroy() {
}
}
|
UTF-8
|
Java
| 1,320 |
java
|
LoginFilter.java
|
Java
|
[] | null |
[] |
package com.mmall.filter;
import com.mmall.common.RequestHolder;
import com.mmall.model.SysUser;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 校验用户是否登录
*/
@Slf4j
public class LoginFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest req=(HttpServletRequest)servletRequest;
HttpServletResponse resp=(HttpServletResponse)servletResponse;
//取出用户登录的信息,如为空则未登录,跳转到登录页面
SysUser sysUser=(SysUser)req.getSession().getAttribute("user");
if (sysUser==null){
String path="/signin.jsp";
resp.sendRedirect(path);
return;
}
//如果有值,加入到requestHolder里
RequestHolder.add(sysUser);
RequestHolder.add(req);
filterChain.doFilter(servletRequest,servletResponse);
return;
}
@Override
public void destroy() {
}
}
| 1,320 | 0.704693 | 0.702265 | 49 | 24.224489 | 28.287348 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44898 | false | false |
0
|
cf09f500a8e460f14fad32d7688a01c13fa6d82b
| 33,277,406,626,132 |
51a13dfa4e7c4f90a3a81ff78b1bca27acba1d05
|
/exam2/src/com/barber/model/Time.java
|
a3a4273207f83fc2b609722ca55bdf942029ab6a
|
[] |
no_license
|
tinyplan/DataStructure
|
https://github.com/tinyplan/DataStructure
|
c81f6e55f6809ce5e3094c0858bd0c43d065e97b
|
73cdadeb95c6baddb82ae5ba69f1bf3ff7b66f19
|
refs/heads/master
| 2020-08-28T00:01:56.981000 | 2019-10-25T12:25:45 | 2019-10-25T12:25:45 | 210,102,763 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.barber.model;
/**
* 时间类
* 以s(秒)为单位
*/
public class Time implements Comparable<Time>{
private int hour;
private int minute;
private int second;
public Time(int second) {
this.format(second);
}
public Time(String date){
String[] src = date.split(":");
this.hour = Integer.parseInt(src[0]);
this.minute = Integer.parseInt(src[1]);
this.second = Integer.parseInt(src[2]);
}
public Time(Time time){
this(time.transform());
}
/**
* 转换方法
* 从hh:mm:ss->s
*/
public int transform() {
return this.hour * 3600 + this.minute * 60 + this.second;
}
public void format(int second){
this.hour = second / 3600;
this.minute = (second % 3600) / 60;
this.second = second % 60;
}
/**
* 计算时间差
* @param t
* @return
*/
public Time interval(Time t) {
return new Time(Math.abs(this.transform() - t.transform()));
}
public void passTime(int second){
this.format(this.transform()+second);
}
@Override
public String toString() {
return this.hour + ":" + this.minute + ":" + this.second;
}
@Override
public int compareTo(Time time) {
return Integer.compare(this.transform(), time.transform());
}
}
|
UTF-8
|
Java
| 1,375 |
java
|
Time.java
|
Java
|
[] | null |
[] |
package com.barber.model;
/**
* 时间类
* 以s(秒)为单位
*/
public class Time implements Comparable<Time>{
private int hour;
private int minute;
private int second;
public Time(int second) {
this.format(second);
}
public Time(String date){
String[] src = date.split(":");
this.hour = Integer.parseInt(src[0]);
this.minute = Integer.parseInt(src[1]);
this.second = Integer.parseInt(src[2]);
}
public Time(Time time){
this(time.transform());
}
/**
* 转换方法
* 从hh:mm:ss->s
*/
public int transform() {
return this.hour * 3600 + this.minute * 60 + this.second;
}
public void format(int second){
this.hour = second / 3600;
this.minute = (second % 3600) / 60;
this.second = second % 60;
}
/**
* 计算时间差
* @param t
* @return
*/
public Time interval(Time t) {
return new Time(Math.abs(this.transform() - t.transform()));
}
public void passTime(int second){
this.format(this.transform()+second);
}
@Override
public String toString() {
return this.hour + ":" + this.minute + ":" + this.second;
}
@Override
public int compareTo(Time time) {
return Integer.compare(this.transform(), time.transform());
}
}
| 1,375 | 0.554145 | 0.538462 | 63 | 20.253969 | 19.127781 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.301587 | false | false |
0
|
7b5cd04d80898b3ffd6e961f27625d72fb8dc21e
| 26,079,041,456,416 |
374603f0c9a75ed9431deda91751509b39298ff5
|
/fw-cloud-mq/fw-cloud-mq-kafka/src/main/java/com/yisu/mq/kafka/sender/FwSender.java
|
9f64f644e5a00f628dd4c8cd93f4d21b64e9a6c0
|
[
"Apache-2.0"
] |
permissive
|
moccanism/fw-spring-cloud
|
https://github.com/moccanism/fw-spring-cloud
|
64923ba1f17b1a024410ee480e7b20e405c248bc
|
14b0b6bd8638ab6cdef9f93455da27ad0e3ade41
|
refs/heads/master
| 2023-03-05T22:10:20.451000 | 2022-01-14T13:54:34 | 2022-01-14T13:54:34 | 250,770,764 | 0 | 0 |
Apache-2.0
| true | 2020-03-28T10:55:13 | 2020-03-28T10:55:12 | 2020-03-28T04:47:06 | 2020-03-27T10:21:05 | 1,234 | 0 | 0 | 0 | null | false | false |
package com.yisu.mq.kafka.sender;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
/**
* @author xuyisu
* @description 发送方
* @date 2019/12/18
*/
@Component
@Slf4j
public class FwSender {
@Autowired
private KafkaTemplate<String,Object> kafkaTemplate;
public boolean send(){
String message="Hello World:"+ DateUtil.now();
log.info("FwSender:"+message);
//第一个参数是topic,第二个参数是内容
kafkaTemplate.send("fwcloud",message);
return true;
}
}
|
UTF-8
|
Java
| 717 |
java
|
FwSender.java
|
Java
|
[
{
"context": "ingframework.stereotype.Component;\n\n/**\n * @author xuyisu\n * @description 发送方\n * @date 2019/12/18\n */\n@Comp",
"end": 293,
"score": 0.999702513217926,
"start": 287,
"tag": "USERNAME",
"value": "xuyisu"
}
] | null |
[] |
package com.yisu.mq.kafka.sender;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
/**
* @author xuyisu
* @description 发送方
* @date 2019/12/18
*/
@Component
@Slf4j
public class FwSender {
@Autowired
private KafkaTemplate<String,Object> kafkaTemplate;
public boolean send(){
String message="Hello World:"+ DateUtil.now();
log.info("FwSender:"+message);
//第一个参数是topic,第二个参数是内容
kafkaTemplate.send("fwcloud",message);
return true;
}
}
| 717 | 0.715125 | 0.698972 | 28 | 23.321428 | 19.355791 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false |
0
|
27ca1625c34b83c3337b811c820b0d29eb7a64b2
| 27,590,869,944,125 |
a3125acc581d6e0ac5e7de8f49b50e8726e043f9
|
/app/src/main/java/com/happylich/bridge/game/wlan/wifihotspot/autofind/WifiBroadcastThread.java
|
efd9655ed49ae038cc998480a71a89caeec7bd2d
|
[] |
no_license
|
happylich/bridge
|
https://github.com/happylich/bridge
|
eb22f4673ed699994d35feda0454e60135ff9835
|
4f6ab2b70b052f3425a71a06a121d4baceb27f10
|
refs/heads/master
| 2018-09-24T05:27:50.951000 | 2018-06-06T16:30:31 | 2018-06-06T16:30:31 | 110,396,613 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.happylich.bridge.game.wlan.wifihotspot.autofind;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.util.Log;
import android.view.SurfaceHolder;
import com.happylich.bridge.game.main.Game;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
/**
* Created by lich on 2018/5/16.
*/
public class WifiBroadcastThread extends Thread {
private Game game;
private WifiInfo mWifiInfo;
private WifiManager.MulticastLock mMulticastLock;
private String ip;
private String message;
private static int BROADCAST_PORT = 8003;
private static String BROADCAST_IP = "255.255.255.255";
InetAddress mInetAddress = null;
MulticastSocket mMulticastSocket = null;
DatagramPacket mDatagramPacket = null;
byte[] data = new byte[1024];
// 游戏线程运行开关
private boolean running = false;
private final static int DELAY_TIME = 200;
private boolean isPaused = false;
/**
* 线程构造函数
*/
public WifiBroadcastThread(WifiManager mWifiManager) {
// 自动获得本机IP地址
if (mWifiManager.isWifiEnabled()) {
Log.v(this.getClass().getName(), "Wifi启用了");
mWifiInfo = mWifiManager.getConnectionInfo();
ip = getIpString(mWifiInfo.getIpAddress());
}
Log.v(this.getClass().getName(), "Wifi没有启用");
}
/**
* IP转换函数
* @param i
* @return
*/
public String getIpString(int i) {
return (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF) + "." + ((i >> 24) & 0xFF);
}
/**
* 设置游戏类
* @param game
*/
public void setGame(Game game) {
this.game = game;
}
/**
* 线程运行标志设置函数(设置为false后停止线程)
* @param state
*/
public void setRunning (boolean state) {
running = state;
}
public void setMulticastLock (WifiManager.MulticastLock mMulticastLock) {
this.mMulticastLock = mMulticastLock;
}
/**
* 线程更新函数
*/
public void run() {
// 这里是广播IP
// 视情况的不同,这个类还可能广播
// 1. 房间的情况
// 0. 未满员:可以点击加入
// 1. 满员:不可以加入了
// 2. 游戏中:游戏已经开始
// 2. 心跳检测
// 1. 依次向连接的客户端发起连接请求
while(running) {
if (!isPaused) {
mMulticastLock.acquire();
try {
// 先加入,后发送原则
mMulticastSocket = new MulticastSocket(BROADCAST_PORT);
mInetAddress = InetAddress.getByName(BROADCAST_IP);
// mMulticastSocket.joinGroup(mInetAddress);
message = ip + " " + String.valueOf(game.getGameState());
data = message.getBytes("utf-8");
mDatagramPacket = new DatagramPacket(data, data.length, mInetAddress, BROADCAST_PORT);
mMulticastSocket.send(mDatagramPacket);
Thread.sleep(DELAY_TIME);
} catch (Exception e) {
e.printStackTrace();
} finally {
mMulticastSocket.close();
mMulticastLock.release();
}
}
}
}
}
|
UTF-8
|
Java
| 3,661 |
java
|
WifiBroadcastThread.java
|
Java
|
[
{
"context": "mport java.net.MulticastSocket;\n\n/**\n * Created by lich on 2018/5/16.\n */\n\npublic class WifiBroadcast",
"end": 504,
"score": 0.9861974716186523,
"start": 504,
"tag": "USERNAME",
"value": ""
},
{
"context": "port java.net.MulticastSocket;\n\n/**\n * Created by lich on 2018/5/16.\n */\n\npublic class WifiBroadcastThre",
"end": 509,
"score": 0.9706078171730042,
"start": 505,
"tag": "USERNAME",
"value": "lich"
},
{
"context": "= 8003;\n private static String BROADCAST_IP = \"255.255.255.255\";\n\n InetAddress mInetAddress = null;\n M",
"end": 843,
"score": 0.9997617602348328,
"start": 828,
"tag": "IP_ADDRESS",
"value": "255.255.255.255"
}
] | null |
[] |
package com.happylich.bridge.game.wlan.wifihotspot.autofind;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.util.Log;
import android.view.SurfaceHolder;
import com.happylich.bridge.game.main.Game;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
/**
* Created by lich on 2018/5/16.
*/
public class WifiBroadcastThread extends Thread {
private Game game;
private WifiInfo mWifiInfo;
private WifiManager.MulticastLock mMulticastLock;
private String ip;
private String message;
private static int BROADCAST_PORT = 8003;
private static String BROADCAST_IP = "255.255.255.255";
InetAddress mInetAddress = null;
MulticastSocket mMulticastSocket = null;
DatagramPacket mDatagramPacket = null;
byte[] data = new byte[1024];
// 游戏线程运行开关
private boolean running = false;
private final static int DELAY_TIME = 200;
private boolean isPaused = false;
/**
* 线程构造函数
*/
public WifiBroadcastThread(WifiManager mWifiManager) {
// 自动获得本机IP地址
if (mWifiManager.isWifiEnabled()) {
Log.v(this.getClass().getName(), "Wifi启用了");
mWifiInfo = mWifiManager.getConnectionInfo();
ip = getIpString(mWifiInfo.getIpAddress());
}
Log.v(this.getClass().getName(), "Wifi没有启用");
}
/**
* IP转换函数
* @param i
* @return
*/
public String getIpString(int i) {
return (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF) + "." + ((i >> 24) & 0xFF);
}
/**
* 设置游戏类
* @param game
*/
public void setGame(Game game) {
this.game = game;
}
/**
* 线程运行标志设置函数(设置为false后停止线程)
* @param state
*/
public void setRunning (boolean state) {
running = state;
}
public void setMulticastLock (WifiManager.MulticastLock mMulticastLock) {
this.mMulticastLock = mMulticastLock;
}
/**
* 线程更新函数
*/
public void run() {
// 这里是广播IP
// 视情况的不同,这个类还可能广播
// 1. 房间的情况
// 0. 未满员:可以点击加入
// 1. 满员:不可以加入了
// 2. 游戏中:游戏已经开始
// 2. 心跳检测
// 1. 依次向连接的客户端发起连接请求
while(running) {
if (!isPaused) {
mMulticastLock.acquire();
try {
// 先加入,后发送原则
mMulticastSocket = new MulticastSocket(BROADCAST_PORT);
mInetAddress = InetAddress.getByName(BROADCAST_IP);
// mMulticastSocket.joinGroup(mInetAddress);
message = ip + " " + String.valueOf(game.getGameState());
data = message.getBytes("utf-8");
mDatagramPacket = new DatagramPacket(data, data.length, mInetAddress, BROADCAST_PORT);
mMulticastSocket.send(mDatagramPacket);
Thread.sleep(DELAY_TIME);
} catch (Exception e) {
e.printStackTrace();
} finally {
mMulticastSocket.close();
mMulticastLock.release();
}
}
}
}
}
| 3,661 | 0.575542 | 0.561888 | 121 | 26.842976 | 22.28627 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.438017 | false | false |
0
|
2fcdab268d294ea1a32c3fe30986a606b61fdd7f
| 5,574,867,555,299 |
4c03af53e4bf38961923b167bcc3fd5fb4d4a789
|
/core/spoofax.compiler/src/main/java/mb/spoofax/compiler/util/GradleProjectInfo.java
|
2cf6de3cfc86b1f7be3274e19b8ff779eaac83e4
|
[
"Apache-2.0"
] |
permissive
|
metaborg/spoofax-pie
|
https://github.com/metaborg/spoofax-pie
|
a367b679bd21d7f89841f4ef3e984e5c1653d5af
|
98f49ef75fcd4d957a65c9220e4dc4c01d354b01
|
refs/heads/develop
| 2023-07-27T06:08:28.446000 | 2023-07-16T14:46:02 | 2023-07-16T14:46:02 | 102,472,170 | 10 | 16 |
Apache-2.0
| false | 2023-02-06T17:30:58 | 2017-09-05T11:19:03 | 2023-01-25T08:02:43 | 2023-02-06T17:30:56 | 10,529 | 7 | 10 | 30 |
Java
| false | false |
package mb.spoofax.compiler.util;
import org.immutables.value.Value;
@Value.Immutable
public interface GradleProjectInfo {
public static GradleProjectInfo of(GradleProject project, String packageId) {
return ImmutableGradleProjectInfo.of(project, packageId);
}
class Builder extends ImmutableGradleProjectInfo.Builder {}
static Builder builder() {
return new Builder();
}
@Value.Parameter GradleProject project();
@Value.Parameter String packageId();
@Value.Default default String packagePath() {
return Conversion.packageIdToPath(packageId());
}
}
|
UTF-8
|
Java
| 617 |
java
|
GradleProjectInfo.java
|
Java
|
[] | null |
[] |
package mb.spoofax.compiler.util;
import org.immutables.value.Value;
@Value.Immutable
public interface GradleProjectInfo {
public static GradleProjectInfo of(GradleProject project, String packageId) {
return ImmutableGradleProjectInfo.of(project, packageId);
}
class Builder extends ImmutableGradleProjectInfo.Builder {}
static Builder builder() {
return new Builder();
}
@Value.Parameter GradleProject project();
@Value.Parameter String packageId();
@Value.Default default String packagePath() {
return Conversion.packageIdToPath(packageId());
}
}
| 617 | 0.722853 | 0.722853 | 25 | 23.68 | 24.820507 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.36 | false | false |
0
|
9318db3013d7814d977653ec27321a49e8b5aa0c
| 4,501,125,765,936 |
61b28fa1eb3d79eb39b88869820508838e27754b
|
/ex5/src/errors/FilterNumberException.java
|
a6005183a803d715173848f5095ffd680f6f041d
|
[] |
no_license
|
h3shiri/OOP
|
https://github.com/h3shiri/OOP
|
8c135dc905263b4aefb61413257f415b293cac5d
|
e59ea954757426e72d22cbb86e5874d381094bae
|
refs/heads/master
| 2021-01-19T00:00:36.499000 | 2016-06-15T15:40:21 | 2016-06-15T15:40:21 | 52,727,623 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package errors;
public class FilterNumberException extends TypeOneError {
/**
* Constructor setting the error message.
* @param lineNumber - the appropriate error message past from inheriting class.
*/
public FilterNumberException(int lineNumber){
super(lineNumber);
}
}
|
UTF-8
|
Java
| 307 |
java
|
FilterNumberException.java
|
Java
|
[] | null |
[] |
package errors;
public class FilterNumberException extends TypeOneError {
/**
* Constructor setting the error message.
* @param lineNumber - the appropriate error message past from inheriting class.
*/
public FilterNumberException(int lineNumber){
super(lineNumber);
}
}
| 307 | 0.703583 | 0.703583 | 11 | 26.90909 | 26.613239 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false |
0
|
d8dbf555551ff109073dd2ad4f5ee8d726e95144
| 7,610,682,113,568 |
fd54a3feb514b3b1916ad310af0765a65deed63b
|
/demo2.java
|
427e23410cc6eb7a74d0ed6daee658db5d576dbe
|
[] |
no_license
|
sandipi/DemoRepoGit
|
https://github.com/sandipi/DemoRepoGit
|
44d8ad9e60b29ce193166615b64820412b30242a
|
b7471da7a3cdec4fd81e98c5737813b3ed6f095b
|
refs/heads/master
| 2020-03-25T14:12:36.849000 | 2018-08-13T04:48:32 | 2018-08-13T04:48:32 | 143,855,667 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
second code copy of demo1.java
|
UTF-8
|
Java
| 32 |
java
|
demo2.java
|
Java
|
[] | null |
[] |
second code copy of demo1.java
| 32 | 0.78125 | 0.75 | 1 | 30 | 0 | 30 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | false | false |
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.