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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
941126fafa8482594584da67aa8bfe32d3aaab65
| 2,001,454,784,715 |
597d4a32e8dde919afcf5aecd1eebd7adcbfe1d2
|
/modules/identity/api/src/main/java/org/wso2/carbon/identity/account/spi/ReadWriteLinkedAccountStore.java
|
29c10b7ce4df85b329723c733736ac16d1dde5f1
|
[] |
no_license
|
bsenduran/carbon-kernel
|
https://github.com/bsenduran/carbon-kernel
|
13b2d55371abc9b6c222c9730d2b0e8cdebd3db9
|
1c224573d9e095e58af140f47e17e112bb736af7
|
refs/heads/master
| 2021-01-14T11:20:38.129000 | 2015-12-10T14:35:43 | 2015-12-10T14:35:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.identity.account.spi;
import org.wso2.carbon.identity.account.AccountException;
import org.wso2.carbon.identity.commons.EntryIdentifier;
/**
* Keep the track of related accounts across identity stores.
*/
public interface ReadWriteLinkedAccountStore extends ReadOnlyLinkedAccountStore {
/**
* @param entryIdentifier
* @param linkedEntryIdentifier
* @throws AccountException
*/
public void link(EntryIdentifier entryIdentifier, EntryIdentifier linkedEntryIdentifier) throws AccountException;
/**
* @param entryIdentifier
* @param linkedEntryIdentifier
* @throws AccountException
*/
public void unlink(EntryIdentifier entryIdentifier, EntryIdentifier linkedEntryIdentifier) throws AccountException;
}
|
UTF-8
|
Java
| 1,432 |
java
|
ReadWriteLinkedAccountStore.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.identity.account.spi;
import org.wso2.carbon.identity.account.AccountException;
import org.wso2.carbon.identity.commons.EntryIdentifier;
/**
* Keep the track of related accounts across identity stores.
*/
public interface ReadWriteLinkedAccountStore extends ReadOnlyLinkedAccountStore {
/**
* @param entryIdentifier
* @param linkedEntryIdentifier
* @throws AccountException
*/
public void link(EntryIdentifier entryIdentifier, EntryIdentifier linkedEntryIdentifier) throws AccountException;
/**
* @param entryIdentifier
* @param linkedEntryIdentifier
* @throws AccountException
*/
public void unlink(EntryIdentifier entryIdentifier, EntryIdentifier linkedEntryIdentifier) throws AccountException;
}
| 1,432 | 0.747905 | 0.738827 | 39 | 35.717949 | 33.477852 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
3
|
5ac1b93353eca2029ac915c8f8e98de1c5e3253e
| 11,785,390,309,301 |
09b44f4903823d54248d2d5b4a0c5513ec389341
|
/finalBot/Lumberjack.java
|
89a2a46c6cae0bf9b51fab0c3624e5f6bebe2fab
|
[] |
no_license
|
npfoss/team008
|
https://github.com/npfoss/team008
|
9fa8194647d7505a8787f3fe206ea75c84bd9f02
|
709f3618e3fa49ec78eb93512aa33185e30342eb
|
refs/heads/master
| 2021-01-19T01:06:19.039000 | 2017-07-31T01:09:42 | 2017-07-31T01:09:42 | 76,813,015 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package team008.finalBot;
import battlecode.common.*;
public class Lumberjack extends Bot {
float DAMAGE_THEM_MOD;
float TREE_DAMAGE_MOD;
public Lumberjack(RobotController r) throws GameActionException{
super(r);
myRandomDirection = Util.randomDirection();
debug = false;
DAMAGE_THEM_MOD = 2f; // tested and determined to be better than 2.5
TREE_DAMAGE_MOD = .2f;
}
public static boolean attacked = false;
public static boolean moved = false;
public static int treesWithinRange;
public static Direction myRandomDirection;
// public TreeInfo closestNeutralWithUnit;
static MapLocation clearAroundLoc;
public Message[] messagesToTry = {Message.DISTRESS_SIGNALS, Message.TREES_WITH_UNITS, Message.CLEAR_TREES_PLEASE, Message.ENEMY_TREES, Message.ENEMY_ARCHONS};
public int[] howFarToGoForMessage = { 15, 10, 15, 10, 10};
// public boolean[] checkEnemiesToRemove = { true, false, false, true};
public void takeTurn() throws Exception{
treesWithinRange = rc.senseNearbyTrees(here, 2, Team.NEUTRAL).length;
attacked = false;
moved = false;
if(rc.getRoundNum() % 23 == 0){
myRandomDirection = Util.randomDirection();
}
// closestNeutralWithUnit = Util.closestTree(nearbyNeutralTrees, rc.getLocation(), true, 50, true);
// if(debug && closestNeutralWithUnit != null) rc.setIndicatorLine(here, closestNeutralWithUnit.getLocation(), 0, 0, 255);
if(nearbyEnemyRobots.length > 0) {
//Notify allies of enemies
if ((rc.getRoundNum() + rc.getID()) % 5 == 0 || target == null) {
notifyFriendsOfEnemies(nearbyEnemyRobots);
}
}
if(nearbyEnemyRobots.length > 0 // pickier micro condition because LJs suck at fighting
&& (nearbyEnemyRobots[0].type == RobotType.GARDENER
|| nearbyEnemyRobots[0].type == RobotType.ARCHON
|| nearbyEnemyRobots[0].type == RobotType.LUMBERJACK && here.distanceTo(nearbyEnemyRobots[0].location) < 6
|| nearbyEnemyRobots[0].type == RobotType.SCOUT && here.distanceTo(nearbyEnemyRobots[0].location) < 5
|| nearbyEnemyRobots[0].type == RobotType.SOLDIER && here.distanceTo(nearbyEnemyRobots[0].location) < 4
|| nearbyEnemyRobots[0].type == RobotType.TANK && here.distanceTo(nearbyEnemyRobots[0].location) < 5)){
doMicro();
} else {
updateTarget(1);
}
if(target != null && !moved && treesWithinRange == 0){
if(clearAroundLoc == null
|| here.distanceTo(clearAroundLoc) > 5
|| nearbyNeutralTrees.length > 0 && clearAroundLoc.distanceTo(nearbyNeutralTrees[0].location) > 6 + nearbyNeutralTrees[0].radius) {
goTo(target);
moved = true;
}
// else go for trees will take care of movement
}
// int start = Clock.getBytecodeNum();
goForTrees(); // moves towards them and chops
// if(debug) System.out.println(" going for trees took " + (Clock.getBytecodeNum() - start));
if (!moved) { // no trees around // just random ish
MapLocation[] enemyArchonLocs = rc.getInitialArchonLocations(enemy);
if ((((roundNum + rc.getID()) / 20) % (enemyArchonLocs.length + 1)) == 0) {
tryMoveDirection(myRandomDirection, true, true);
} else {
tryMoveDirection(
here.directionTo(
enemyArchonLocs[(((roundNum + rc.getID()) / 20) % (enemyArchonLocs.length + 1)) -1]),
true, true);
}
moved = true;
}
if(debug && target != null) { rc.setIndicatorLine(here, target, (us == Team.A ? 255: 0), (us == Team.A ? 0: 255), 0); };
}
public void updateTarget(int howDesperate) throws GameActionException {
/*if(target != null && roundNum + rc.getID() % 10 == 0 && !Message.DISTRESS_SIGNALS.containsLocation(target) && !Message.ENEMY_ARCHONS.containsLocation(target) ){
//if(debug)System.out.println("changing");
target = null;
}*/
// target = (closestNeutralWithUnit == null ? null : closestNeutralWithUnit.getLocation());
target = null;
MapLocation targetD;
for(int i = 0; i < messagesToTry.length; i++){
//System.out.println("loops " + i);
targetD = messagesToTry[i].getClosestLocation(here);
if (targetD != null && here.distanceTo(targetD) < howFarToGoForMessage[i]*howDesperate && (target == null || (here.distanceTo(targetD) < here.distanceTo(target) && here.distanceTo(targetD) < 7))) {
//if(debug)System.out.println("targetD = " + targetD);
target = targetD;
if (messagesToTry[i] == Message.CLEAR_TREES_PLEASE ){//&& treesWithinRange == 0){
clearAroundLoc = target;
}
}
}
if (clearAroundLoc != null && here.distanceTo(clearAroundLoc) < 5
&& (Util.numBodiesTouchingRadius(nearbyNeutralTrees, clearAroundLoc, 5, 18) == 0) &&
Message.CLEAR_TREES_PLEASE.removeLocation(clearAroundLoc)) {
target = null;
clearAroundLoc = null;
}
if (target != null && rc.getLocation().distanceTo(target) < 3) {
if (nearbyEnemyRobots.length == 0 &&
Message.ENEMY_ARCHONS.removeLocation(target)) {
//if(debug)System.out.println("thinking about removing");
target = null;
} else if (nearbyEnemyTrees.length == 0 &&
Message.ENEMY_TREES.removeLocation(target)) {
target = null;
} else if (here.distanceTo(target) < 1.5 &&
Message.TREES_WITH_UNITS.removeLocation(target)) {
target = null;
} else if (nearbyEnemyRobots.length == 0 &&
Message.DISTRESS_SIGNALS.removeLocation(target)) {
target = null;
}
}
// may have to be less strict
if(target == null && howDesperate == 1) {
updateTarget(2);
} else if(target == null && howDesperate == 2){
updateTarget(10);
}
}
public float DIST_TO_ME_MOD = .3f;
public float DIST_TO_CA_MOD = 1f;
public float CONTAINS_UNIT_MOD = 10f;
public float IN_THE_WAY_MOD = 1f;
public float ENEMY_TREE_MOD = 3f;
public float HEALTH_PCT_MOD = 2f;
public float scoreTree(TreeInfo tree){
return -DIST_TO_ME_MOD * rc.getLocation().distanceTo(tree.getLocation())
-DIST_TO_CA_MOD * (clearAroundLoc != null? clearAroundLoc.distanceTo(tree.getLocation()) : 0)
+ (tree.containedRobot == null ? 0 : CONTAINS_UNIT_MOD )
-IN_THE_WAY_MOD * (target == null? 0 : rc.getLocation().distanceTo(tree.getLocation()) + tree.getLocation().distanceTo(target) - rc.getLocation().distanceTo(target))
+ (tree.getTeam() == enemy? ENEMY_TREE_MOD : 0)
-HEALTH_PCT_MOD * (tree.health / tree.maxHealth)
;
}
public int WHEN_TO_STOP_SCORING_TREES_AND_MOVE = 5000;
public void goForTrees() throws GameActionException {
// int s = Clock.getBytecodeNum();
// System.out.println("getting closest " + nearbyNeutralTrees.length + " neutral took " + (Clock.getBytecodeNum() - s));
// if(debug) rc.setIndicatorDot(rc.getLocation(), 0, 255,0);
// System.out.println("TSA pre-check");
if(moved && attacked) return;
// System.out.println("TSA post-check" + Clock.getBytecodesLeft());
TreeInfo moveTo = null;
TreeInfo attackMe = null;
float bestMoveScore = -99999f;
float bestAttackScore = -999999f;
float score;
for(int i = 0; i < nearbyTrees.length && Clock.getBytecodesLeft() > WHEN_TO_STOP_SCORING_TREES_AND_MOVE; i++){
// if(debug) System.out.print("loopy");
if(nearbyTrees[i].getTeam() == us) continue;
score = scoreTree(nearbyTrees[i]);
// if(debug) System.out.println("loc: " + nearbyTrees[i].location.x + " " + nearbyTrees[i].location.y + " score: " + score);
if(!moved && score > bestMoveScore){
bestMoveScore = score;
moveTo = nearbyTrees[i];
}
if(!attacked && score > bestAttackScore && rc.getLocation().distanceTo(nearbyTrees[i].location) < GameConstants.LUMBERJACK_STRIKE_RADIUS + nearbyTrees[i].radius){
bestAttackScore = score;
attackMe = nearbyTrees[i];
}
}
if(debug){
if(attackMe != null){
rc.setIndicatorLine(rc.getLocation(), attackMe.location, 255, 255, 255);
rc.setIndicatorDot(attackMe.location, 255, 255, 255);
}
if(moveTo != null) rc.setIndicatorLine(rc.getLocation(), moveTo.location, 0, 0, 0);
}
if(attackMe != null){
if(attackMe.health > 5 && Util.numBodiesTouchingRadius(nearbyAlliedRobots, rc.getLocation(), GameConstants.LUMBERJACK_STRIKE_RADIUS) == 0
&& Util.numBodiesTouchingRadius(nearbyNeutralTrees, rc.getLocation(), GameConstants.LUMBERJACK_STRIKE_RADIUS, 5)
+ Util.numBodiesTouchingRadius(nearbyEnemyTrees, rc.getLocation(), GameConstants.LUMBERJACK_STRIKE_RADIUS, 5) > 2){
rc.strike();
attacked = true;
} else {
rc.chop(attackMe.ID);
attacked = true;
}
}
if(moveTo != null){
if(moveTo == attackMe){
tryMoveDirection(here.directionTo(moveTo.location), false, false);
if(debug) rc.setIndicatorDot(here.add(calculatedMove), 0, 0, 255);
if(calculatedMove != null && here.distanceTo(moveTo.getLocation()) + TOLERANCE > here.add(calculatedMove).distanceTo(moveTo.getLocation())){
rc.move(calculatedMove, type.strideRadius);
}
} else if(treesWithinRange == 0){
goTo(moveTo.location);
}
moved = true;
}
}
public void doMicro() throws GameActionException {
if(debug) rc.setIndicatorDot(here, 255, 0 , 0);
calculatedMove = null;
tryMoveDirection(here.directionTo(nearbyEnemyRobots[0].location), false, true);
if(calculatedMove != null && here.add(calculatedMove, type.strideRadius).distanceTo(nearbyEnemyRobots[0].location) < here.distanceTo(nearbyEnemyRobots[0].location)){
rc.move(calculatedMove, type.strideRadius);
moved = true;
}
if(evalForAttacking(rc.getLocation()) > 0) {
rc.strike();
attacked = true;
}
if(calculatedMove != null && !moved){
rc.move(calculatedMove, type.strideRadius);
moved = true;
}
if(!attacked && evalForAttacking(rc.getLocation()) > 0) {
rc.strike();
attacked = true;
}
}
/* public void doLumberjackMicro() throws Exception{
// gets called when there are enemies that can be seen
// don't worry about chopping trees here, that's checked for after. only enemies
if (debug) { System.out.println("whee micro"); }
// TODO: add kamikaze function: if about to die anyways, just go for best place to attack for final stand
float attackScoreHere = evalForAttacking(here);
float bestMoveScore = evaluateLocation(here) + (attackScoreHere < 0 ? 0 : MOVE_ATTACK_MOD * attackScoreHere) + IMPATIENCE_MOD * turnsWithoutMovingOrAttacking;
// there should be a way to remove the attack bit here such that
// a better location won't be disregarded since we can attack
// here and then move there
if (debug) { System.out.println("here score " + bestMoveScore); }
MapLocation bestLoc = here;
float bestLocAttackScore = -999;
MapLocation currLoc;
float score, attackScore;
int startTheta = 0; // if we want to start at something nonzero then change the hardcoded zeroes below
int currentTheta = 0;
int dtheta = 36;
int numLocsEvaled = 0;
float stridedist = RobotType.LUMBERJACK.strideRadius;
int startBytecode = Clock.getBytecodeNum();
while (Clock.getBytecodeNum() + (Clock.getBytecodeNum() - startBytecode)/((numLocsEvaled < 2 ? 1 : numLocsEvaled)) < WHEN_TO_STOP_MICRO){
// stop when the average time it takes to eval puts us over the WHEN_TO_STOP_MICRO threshold
currLoc = here.add(Util.radians(currentTheta), stridedist);
if (rc.canMove(currLoc)) {
if (debug) { rc.setIndicatorDot(currLoc, 0, 0, (int)(1.0*currentTheta / 360 * 255)); }
attackScore = evalForAttacking(currLoc);
score = evaluateLocation(currLoc) + (attackScoreHere < 0 ? 0 : MOVE_ATTACK_MOD * attackScoreHere);
// if you're not going to attack anyways, it doesn't matter how bad it is
if (debug) { System.out.println(currentTheta + " " + currLoc.x + " " + currLoc.y + " score " + score); }
if (score > bestMoveScore) {
bestLoc = currLoc;
bestLocAttackScore = attackScore;
bestMoveScore = score;
}
numLocsEvaled += 1;
}
currentTheta += dtheta;
if (currentTheta >= 360){
// tried every point around a circle, now try closer
// TODO: make the test points more evenly distributed inside (see circle-packing on wikipedia)
stridedist /= 2;
currentTheta = 0;
dtheta = dtheta * 5 / 3; // it'll get more dense as it gets closer so adjust a little for that
if (stridedist < .187) { // probably silly to keep checking
if (debug) { System.out.print("I've tried everything dammit"); }
break;
}
}
}
if (debug) { System.out.println("tried " + numLocsEvaled + " locs and finished at theta " + currentTheta + " and radius " + stridedist); }
if ( attackScoreHere > bestLocAttackScore && attackScoreHere > 0){
// attack first, then move
if (debug) {rc.setIndicatorDot(here, 255,0,0); }//red dot == SMASH
rc.strike();
rc.move(bestLoc);
} else if (bestLocAttackScore > 0){
// move first, then attack
rc.move(bestLoc);
if (debug) { rc.setIndicatorDot(bestLoc, 255, 0, 0); }//red dot == SMASH
rc.strike();
} else if (bestLoc != here){
// just move
rc.move(bestLoc);
}
}
public float evaluateLocation(MapLocation loc){
// 'scores' the location in terms of possible damage accrued (bullets and otherwise) and forward progress,
// but NOT attacking damage
// TODO: take into account other strategery like defending our trees/units, swarming or not, etc
float distToNearestEnemy = (loc == here ? here.distanceTo(nearbyEnemyRobots[0].getLocation()) : Util.distToClosestBody(nearbyEnemyRobots, loc));
/*if (distToNearestEnemy < GameConstants.LUMBERJACK_STRIKE_RADIUS + RobotType.LUMBERJACK.strideRadius + 1){
distToNearestEnemy = 0; // close enough to hit already
}*//*
return KNOWN_DAMAGE_MOD * knownDamageToLoc(loc)
+ HYPOTHETICAL_DAMAGE_MOD * hypotheticalDamageToSpot(loc)
+ PROXIMITY_MOD * distToNearestEnemy
+ (target != null ? PROGRESS_MOD * here.distanceTo(target) - loc.distanceTo(target) : 0)
+ (gardenerLoc != null ? GARDENER_PROXIMITY_MOD * (loc.distanceTo(gardenerLoc) < 3.6 ? 3.6f - loc.distanceTo(gardenerLoc) : 0) : 0 )
// translation: if too close to gardener I'm defending, it's bad. (3.6 isn't random, it's sqrt(3)*3/2)
;
}*/
public float evalForAttacking(MapLocation loc){
// how good it is to attack from this spot
// score <= 0 means it's better not to attack
float damageToThem = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyEnemyRobots, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
float damageToUs = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyAlliedRobots, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
float damageToEnemyTrees = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyEnemyTrees, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
float damageToAlliedTrees = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyAlliedTrees, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
return DAMAGE_THEM_MOD * damageToThem - damageToUs + TREE_DAMAGE_MOD * (damageToEnemyTrees - damageToAlliedTrees);
}
public static void goTo(MapLocation dest) throws GameActionException {
// this method makes us not try to bug if we can chop the thing in the way
if(debug) System.out.println("goin' to " + dest.toString());
Direction dir = here.directionTo(dest);
MapLocation directlyInFront = here.add(dir, type.strideRadius*2);
MapLocation left = here.add(dir.rotateLeftDegrees(30), type.strideRadius*2);
MapLocation right = here.add(dir.rotateRightDegrees(30), type.strideRadius*2);
TreeInfo treeInTheWay = rc.senseTreeAtLocation(directlyInFront);
if(treeInTheWay == null)
treeInTheWay = rc.senseTreeAtLocation(left);
if(treeInTheWay == null)
treeInTheWay = rc.senseTreeAtLocation(right);
if(treeInTheWay != null) {
if(treeInTheWay.team != us){
tryMoveDirection(here.directionTo(dest), true, false);
moved = true;
}
} else {
RobotInfo botInTheWay = rc.senseRobotAtLocation(directlyInFront);
if(botInTheWay == null)
botInTheWay = rc.senseRobotAtLocation(left);
if(botInTheWay == null)
botInTheWay = rc.senseRobotAtLocation(right);
if(botInTheWay != null){
if(botInTheWay.team != us){
tryMoveDirection(here.directionTo(dest), true, false);
moved = true;
}
}
}
if(!moved){
// if(clearAroundLoc != null && here.distanceTo(clearAroundLoc) < 10)
// bugState = BugState.DIRECT;
Bot.goTo(dest);
moved = true;
}
}
}
|
UTF-8
|
Java
| 19,171 |
java
|
Lumberjack.java
|
Java
|
[] | null |
[] |
package team008.finalBot;
import battlecode.common.*;
public class Lumberjack extends Bot {
float DAMAGE_THEM_MOD;
float TREE_DAMAGE_MOD;
public Lumberjack(RobotController r) throws GameActionException{
super(r);
myRandomDirection = Util.randomDirection();
debug = false;
DAMAGE_THEM_MOD = 2f; // tested and determined to be better than 2.5
TREE_DAMAGE_MOD = .2f;
}
public static boolean attacked = false;
public static boolean moved = false;
public static int treesWithinRange;
public static Direction myRandomDirection;
// public TreeInfo closestNeutralWithUnit;
static MapLocation clearAroundLoc;
public Message[] messagesToTry = {Message.DISTRESS_SIGNALS, Message.TREES_WITH_UNITS, Message.CLEAR_TREES_PLEASE, Message.ENEMY_TREES, Message.ENEMY_ARCHONS};
public int[] howFarToGoForMessage = { 15, 10, 15, 10, 10};
// public boolean[] checkEnemiesToRemove = { true, false, false, true};
public void takeTurn() throws Exception{
treesWithinRange = rc.senseNearbyTrees(here, 2, Team.NEUTRAL).length;
attacked = false;
moved = false;
if(rc.getRoundNum() % 23 == 0){
myRandomDirection = Util.randomDirection();
}
// closestNeutralWithUnit = Util.closestTree(nearbyNeutralTrees, rc.getLocation(), true, 50, true);
// if(debug && closestNeutralWithUnit != null) rc.setIndicatorLine(here, closestNeutralWithUnit.getLocation(), 0, 0, 255);
if(nearbyEnemyRobots.length > 0) {
//Notify allies of enemies
if ((rc.getRoundNum() + rc.getID()) % 5 == 0 || target == null) {
notifyFriendsOfEnemies(nearbyEnemyRobots);
}
}
if(nearbyEnemyRobots.length > 0 // pickier micro condition because LJs suck at fighting
&& (nearbyEnemyRobots[0].type == RobotType.GARDENER
|| nearbyEnemyRobots[0].type == RobotType.ARCHON
|| nearbyEnemyRobots[0].type == RobotType.LUMBERJACK && here.distanceTo(nearbyEnemyRobots[0].location) < 6
|| nearbyEnemyRobots[0].type == RobotType.SCOUT && here.distanceTo(nearbyEnemyRobots[0].location) < 5
|| nearbyEnemyRobots[0].type == RobotType.SOLDIER && here.distanceTo(nearbyEnemyRobots[0].location) < 4
|| nearbyEnemyRobots[0].type == RobotType.TANK && here.distanceTo(nearbyEnemyRobots[0].location) < 5)){
doMicro();
} else {
updateTarget(1);
}
if(target != null && !moved && treesWithinRange == 0){
if(clearAroundLoc == null
|| here.distanceTo(clearAroundLoc) > 5
|| nearbyNeutralTrees.length > 0 && clearAroundLoc.distanceTo(nearbyNeutralTrees[0].location) > 6 + nearbyNeutralTrees[0].radius) {
goTo(target);
moved = true;
}
// else go for trees will take care of movement
}
// int start = Clock.getBytecodeNum();
goForTrees(); // moves towards them and chops
// if(debug) System.out.println(" going for trees took " + (Clock.getBytecodeNum() - start));
if (!moved) { // no trees around // just random ish
MapLocation[] enemyArchonLocs = rc.getInitialArchonLocations(enemy);
if ((((roundNum + rc.getID()) / 20) % (enemyArchonLocs.length + 1)) == 0) {
tryMoveDirection(myRandomDirection, true, true);
} else {
tryMoveDirection(
here.directionTo(
enemyArchonLocs[(((roundNum + rc.getID()) / 20) % (enemyArchonLocs.length + 1)) -1]),
true, true);
}
moved = true;
}
if(debug && target != null) { rc.setIndicatorLine(here, target, (us == Team.A ? 255: 0), (us == Team.A ? 0: 255), 0); };
}
public void updateTarget(int howDesperate) throws GameActionException {
/*if(target != null && roundNum + rc.getID() % 10 == 0 && !Message.DISTRESS_SIGNALS.containsLocation(target) && !Message.ENEMY_ARCHONS.containsLocation(target) ){
//if(debug)System.out.println("changing");
target = null;
}*/
// target = (closestNeutralWithUnit == null ? null : closestNeutralWithUnit.getLocation());
target = null;
MapLocation targetD;
for(int i = 0; i < messagesToTry.length; i++){
//System.out.println("loops " + i);
targetD = messagesToTry[i].getClosestLocation(here);
if (targetD != null && here.distanceTo(targetD) < howFarToGoForMessage[i]*howDesperate && (target == null || (here.distanceTo(targetD) < here.distanceTo(target) && here.distanceTo(targetD) < 7))) {
//if(debug)System.out.println("targetD = " + targetD);
target = targetD;
if (messagesToTry[i] == Message.CLEAR_TREES_PLEASE ){//&& treesWithinRange == 0){
clearAroundLoc = target;
}
}
}
if (clearAroundLoc != null && here.distanceTo(clearAroundLoc) < 5
&& (Util.numBodiesTouchingRadius(nearbyNeutralTrees, clearAroundLoc, 5, 18) == 0) &&
Message.CLEAR_TREES_PLEASE.removeLocation(clearAroundLoc)) {
target = null;
clearAroundLoc = null;
}
if (target != null && rc.getLocation().distanceTo(target) < 3) {
if (nearbyEnemyRobots.length == 0 &&
Message.ENEMY_ARCHONS.removeLocation(target)) {
//if(debug)System.out.println("thinking about removing");
target = null;
} else if (nearbyEnemyTrees.length == 0 &&
Message.ENEMY_TREES.removeLocation(target)) {
target = null;
} else if (here.distanceTo(target) < 1.5 &&
Message.TREES_WITH_UNITS.removeLocation(target)) {
target = null;
} else if (nearbyEnemyRobots.length == 0 &&
Message.DISTRESS_SIGNALS.removeLocation(target)) {
target = null;
}
}
// may have to be less strict
if(target == null && howDesperate == 1) {
updateTarget(2);
} else if(target == null && howDesperate == 2){
updateTarget(10);
}
}
public float DIST_TO_ME_MOD = .3f;
public float DIST_TO_CA_MOD = 1f;
public float CONTAINS_UNIT_MOD = 10f;
public float IN_THE_WAY_MOD = 1f;
public float ENEMY_TREE_MOD = 3f;
public float HEALTH_PCT_MOD = 2f;
public float scoreTree(TreeInfo tree){
return -DIST_TO_ME_MOD * rc.getLocation().distanceTo(tree.getLocation())
-DIST_TO_CA_MOD * (clearAroundLoc != null? clearAroundLoc.distanceTo(tree.getLocation()) : 0)
+ (tree.containedRobot == null ? 0 : CONTAINS_UNIT_MOD )
-IN_THE_WAY_MOD * (target == null? 0 : rc.getLocation().distanceTo(tree.getLocation()) + tree.getLocation().distanceTo(target) - rc.getLocation().distanceTo(target))
+ (tree.getTeam() == enemy? ENEMY_TREE_MOD : 0)
-HEALTH_PCT_MOD * (tree.health / tree.maxHealth)
;
}
public int WHEN_TO_STOP_SCORING_TREES_AND_MOVE = 5000;
public void goForTrees() throws GameActionException {
// int s = Clock.getBytecodeNum();
// System.out.println("getting closest " + nearbyNeutralTrees.length + " neutral took " + (Clock.getBytecodeNum() - s));
// if(debug) rc.setIndicatorDot(rc.getLocation(), 0, 255,0);
// System.out.println("TSA pre-check");
if(moved && attacked) return;
// System.out.println("TSA post-check" + Clock.getBytecodesLeft());
TreeInfo moveTo = null;
TreeInfo attackMe = null;
float bestMoveScore = -99999f;
float bestAttackScore = -999999f;
float score;
for(int i = 0; i < nearbyTrees.length && Clock.getBytecodesLeft() > WHEN_TO_STOP_SCORING_TREES_AND_MOVE; i++){
// if(debug) System.out.print("loopy");
if(nearbyTrees[i].getTeam() == us) continue;
score = scoreTree(nearbyTrees[i]);
// if(debug) System.out.println("loc: " + nearbyTrees[i].location.x + " " + nearbyTrees[i].location.y + " score: " + score);
if(!moved && score > bestMoveScore){
bestMoveScore = score;
moveTo = nearbyTrees[i];
}
if(!attacked && score > bestAttackScore && rc.getLocation().distanceTo(nearbyTrees[i].location) < GameConstants.LUMBERJACK_STRIKE_RADIUS + nearbyTrees[i].radius){
bestAttackScore = score;
attackMe = nearbyTrees[i];
}
}
if(debug){
if(attackMe != null){
rc.setIndicatorLine(rc.getLocation(), attackMe.location, 255, 255, 255);
rc.setIndicatorDot(attackMe.location, 255, 255, 255);
}
if(moveTo != null) rc.setIndicatorLine(rc.getLocation(), moveTo.location, 0, 0, 0);
}
if(attackMe != null){
if(attackMe.health > 5 && Util.numBodiesTouchingRadius(nearbyAlliedRobots, rc.getLocation(), GameConstants.LUMBERJACK_STRIKE_RADIUS) == 0
&& Util.numBodiesTouchingRadius(nearbyNeutralTrees, rc.getLocation(), GameConstants.LUMBERJACK_STRIKE_RADIUS, 5)
+ Util.numBodiesTouchingRadius(nearbyEnemyTrees, rc.getLocation(), GameConstants.LUMBERJACK_STRIKE_RADIUS, 5) > 2){
rc.strike();
attacked = true;
} else {
rc.chop(attackMe.ID);
attacked = true;
}
}
if(moveTo != null){
if(moveTo == attackMe){
tryMoveDirection(here.directionTo(moveTo.location), false, false);
if(debug) rc.setIndicatorDot(here.add(calculatedMove), 0, 0, 255);
if(calculatedMove != null && here.distanceTo(moveTo.getLocation()) + TOLERANCE > here.add(calculatedMove).distanceTo(moveTo.getLocation())){
rc.move(calculatedMove, type.strideRadius);
}
} else if(treesWithinRange == 0){
goTo(moveTo.location);
}
moved = true;
}
}
public void doMicro() throws GameActionException {
if(debug) rc.setIndicatorDot(here, 255, 0 , 0);
calculatedMove = null;
tryMoveDirection(here.directionTo(nearbyEnemyRobots[0].location), false, true);
if(calculatedMove != null && here.add(calculatedMove, type.strideRadius).distanceTo(nearbyEnemyRobots[0].location) < here.distanceTo(nearbyEnemyRobots[0].location)){
rc.move(calculatedMove, type.strideRadius);
moved = true;
}
if(evalForAttacking(rc.getLocation()) > 0) {
rc.strike();
attacked = true;
}
if(calculatedMove != null && !moved){
rc.move(calculatedMove, type.strideRadius);
moved = true;
}
if(!attacked && evalForAttacking(rc.getLocation()) > 0) {
rc.strike();
attacked = true;
}
}
/* public void doLumberjackMicro() throws Exception{
// gets called when there are enemies that can be seen
// don't worry about chopping trees here, that's checked for after. only enemies
if (debug) { System.out.println("whee micro"); }
// TODO: add kamikaze function: if about to die anyways, just go for best place to attack for final stand
float attackScoreHere = evalForAttacking(here);
float bestMoveScore = evaluateLocation(here) + (attackScoreHere < 0 ? 0 : MOVE_ATTACK_MOD * attackScoreHere) + IMPATIENCE_MOD * turnsWithoutMovingOrAttacking;
// there should be a way to remove the attack bit here such that
// a better location won't be disregarded since we can attack
// here and then move there
if (debug) { System.out.println("here score " + bestMoveScore); }
MapLocation bestLoc = here;
float bestLocAttackScore = -999;
MapLocation currLoc;
float score, attackScore;
int startTheta = 0; // if we want to start at something nonzero then change the hardcoded zeroes below
int currentTheta = 0;
int dtheta = 36;
int numLocsEvaled = 0;
float stridedist = RobotType.LUMBERJACK.strideRadius;
int startBytecode = Clock.getBytecodeNum();
while (Clock.getBytecodeNum() + (Clock.getBytecodeNum() - startBytecode)/((numLocsEvaled < 2 ? 1 : numLocsEvaled)) < WHEN_TO_STOP_MICRO){
// stop when the average time it takes to eval puts us over the WHEN_TO_STOP_MICRO threshold
currLoc = here.add(Util.radians(currentTheta), stridedist);
if (rc.canMove(currLoc)) {
if (debug) { rc.setIndicatorDot(currLoc, 0, 0, (int)(1.0*currentTheta / 360 * 255)); }
attackScore = evalForAttacking(currLoc);
score = evaluateLocation(currLoc) + (attackScoreHere < 0 ? 0 : MOVE_ATTACK_MOD * attackScoreHere);
// if you're not going to attack anyways, it doesn't matter how bad it is
if (debug) { System.out.println(currentTheta + " " + currLoc.x + " " + currLoc.y + " score " + score); }
if (score > bestMoveScore) {
bestLoc = currLoc;
bestLocAttackScore = attackScore;
bestMoveScore = score;
}
numLocsEvaled += 1;
}
currentTheta += dtheta;
if (currentTheta >= 360){
// tried every point around a circle, now try closer
// TODO: make the test points more evenly distributed inside (see circle-packing on wikipedia)
stridedist /= 2;
currentTheta = 0;
dtheta = dtheta * 5 / 3; // it'll get more dense as it gets closer so adjust a little for that
if (stridedist < .187) { // probably silly to keep checking
if (debug) { System.out.print("I've tried everything dammit"); }
break;
}
}
}
if (debug) { System.out.println("tried " + numLocsEvaled + " locs and finished at theta " + currentTheta + " and radius " + stridedist); }
if ( attackScoreHere > bestLocAttackScore && attackScoreHere > 0){
// attack first, then move
if (debug) {rc.setIndicatorDot(here, 255,0,0); }//red dot == SMASH
rc.strike();
rc.move(bestLoc);
} else if (bestLocAttackScore > 0){
// move first, then attack
rc.move(bestLoc);
if (debug) { rc.setIndicatorDot(bestLoc, 255, 0, 0); }//red dot == SMASH
rc.strike();
} else if (bestLoc != here){
// just move
rc.move(bestLoc);
}
}
public float evaluateLocation(MapLocation loc){
// 'scores' the location in terms of possible damage accrued (bullets and otherwise) and forward progress,
// but NOT attacking damage
// TODO: take into account other strategery like defending our trees/units, swarming or not, etc
float distToNearestEnemy = (loc == here ? here.distanceTo(nearbyEnemyRobots[0].getLocation()) : Util.distToClosestBody(nearbyEnemyRobots, loc));
/*if (distToNearestEnemy < GameConstants.LUMBERJACK_STRIKE_RADIUS + RobotType.LUMBERJACK.strideRadius + 1){
distToNearestEnemy = 0; // close enough to hit already
}*//*
return KNOWN_DAMAGE_MOD * knownDamageToLoc(loc)
+ HYPOTHETICAL_DAMAGE_MOD * hypotheticalDamageToSpot(loc)
+ PROXIMITY_MOD * distToNearestEnemy
+ (target != null ? PROGRESS_MOD * here.distanceTo(target) - loc.distanceTo(target) : 0)
+ (gardenerLoc != null ? GARDENER_PROXIMITY_MOD * (loc.distanceTo(gardenerLoc) < 3.6 ? 3.6f - loc.distanceTo(gardenerLoc) : 0) : 0 )
// translation: if too close to gardener I'm defending, it's bad. (3.6 isn't random, it's sqrt(3)*3/2)
;
}*/
public float evalForAttacking(MapLocation loc){
// how good it is to attack from this spot
// score <= 0 means it's better not to attack
float damageToThem = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyEnemyRobots, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
float damageToUs = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyAlliedRobots, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
float damageToEnemyTrees = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyEnemyTrees, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
float damageToAlliedTrees = RobotType.LUMBERJACK.attackPower * Util.numBodiesTouchingRadius(nearbyAlliedTrees, loc, GameConstants.LUMBERJACK_STRIKE_RADIUS);
return DAMAGE_THEM_MOD * damageToThem - damageToUs + TREE_DAMAGE_MOD * (damageToEnemyTrees - damageToAlliedTrees);
}
public static void goTo(MapLocation dest) throws GameActionException {
// this method makes us not try to bug if we can chop the thing in the way
if(debug) System.out.println("goin' to " + dest.toString());
Direction dir = here.directionTo(dest);
MapLocation directlyInFront = here.add(dir, type.strideRadius*2);
MapLocation left = here.add(dir.rotateLeftDegrees(30), type.strideRadius*2);
MapLocation right = here.add(dir.rotateRightDegrees(30), type.strideRadius*2);
TreeInfo treeInTheWay = rc.senseTreeAtLocation(directlyInFront);
if(treeInTheWay == null)
treeInTheWay = rc.senseTreeAtLocation(left);
if(treeInTheWay == null)
treeInTheWay = rc.senseTreeAtLocation(right);
if(treeInTheWay != null) {
if(treeInTheWay.team != us){
tryMoveDirection(here.directionTo(dest), true, false);
moved = true;
}
} else {
RobotInfo botInTheWay = rc.senseRobotAtLocation(directlyInFront);
if(botInTheWay == null)
botInTheWay = rc.senseRobotAtLocation(left);
if(botInTheWay == null)
botInTheWay = rc.senseRobotAtLocation(right);
if(botInTheWay != null){
if(botInTheWay.team != us){
tryMoveDirection(here.directionTo(dest), true, false);
moved = true;
}
}
}
if(!moved){
// if(clearAroundLoc != null && here.distanceTo(clearAroundLoc) < 10)
// bugState = BugState.DIRECT;
Bot.goTo(dest);
moved = true;
}
}
}
| 19,171 | 0.586302 | 0.573888 | 377 | 49.854111 | 41.535355 | 209 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.811671 | false | false |
3
|
c9752d658750a8c043513166e58ce4cf9742cebb
| 1,116,691,540,922 |
9732e9b48acd3b98aff6af9f3f7681ede920c6af
|
/MVC_Swing/src/com/rose/View1.java
|
2a236cbf1c6e70dda9e14fef170723dd94894d15
|
[] |
no_license
|
tqcenglish/JavaBase
|
https://github.com/tqcenglish/JavaBase
|
e80dd4ea48da8624d7fdc1b0b0b02e6c134cf9bc
|
287264fd8dccffda30cd9876a4e727df74af6734
|
refs/heads/master
| 2015-08-07T18:11:40.484000 | 2013-09-01T07:46:05 | 2013-09-01T07:46:05 | 9,713,894 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rose;
/* file: View1.java */
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
public class View1 extends JPanel implements Observer
{
Model model;
public View1()
{
}
public View1(Model model)
{
try
{
this.model = model;
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
this.setBackground(Color.white);
this.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.black,1),"View1"));
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
if ( model == null ) return;
int x = 20,y = 50;
int h = g.getFontMetrics().getHeight();
for ( int i=0; i< model.size(); i++ )
{
Data data = model.getData(i);
g.drawString(data.name,x,y);
y+=h;
g.drawString(String.valueOf(data.value),x,y);
y+=h;
}
}
// 当模型数据发生改变时,会自动调用此方法来刷新图形
public void dataUpdate(Model model)
{
/**@todo: Implement this Observer method*/
this.model = model;
repaint();
}
}
|
GB18030
|
Java
| 1,251 |
java
|
View1.java
|
Java
|
[] | null |
[] |
package com.rose;
/* file: View1.java */
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
public class View1 extends JPanel implements Observer
{
Model model;
public View1()
{
}
public View1(Model model)
{
try
{
this.model = model;
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
this.setBackground(Color.white);
this.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.black,1),"View1"));
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
if ( model == null ) return;
int x = 20,y = 50;
int h = g.getFontMetrics().getHeight();
for ( int i=0; i< model.size(); i++ )
{
Data data = model.getData(i);
g.drawString(data.name,x,y);
y+=h;
g.drawString(String.valueOf(data.value),x,y);
y+=h;
}
}
// 当模型数据发生改变时,会自动调用此方法来刷新图形
public void dataUpdate(Model model)
{
/**@todo: Implement this Observer method*/
this.model = model;
repaint();
}
}
| 1,251 | 0.552785 | 0.543641 | 54 | 21.277779 | 18.640276 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
3
|
d5adb476f148d9e9685176fb9ca9598c292c38f9
| 1,829,656,127,431 |
91b178f92dd0edd7fbd2bcca001fddcc72684e15
|
/src/test/java/com/bug/AbstractTest.java
|
126e596453b5de2776bfe6b2d9c238148c6d047c
|
[] |
no_license
|
OleksandrSankin/spring-boot-bug
|
https://github.com/OleksandrSankin/spring-boot-bug
|
89d1c5de5cb8c5da23b205e6faba9a2d2b98a94e
|
1217488d654cf800d6ec4efeb024f01fa70ff11f
|
refs/heads/master
| 2022-11-29T19:20:14.402000 | 2020-08-06T15:36:58 | 2020-08-06T15:46:29 | 285,619,615 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bug;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.web.client.RestTemplate;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
abstract class AbstractTest {
@LocalServerPort private int port;
@Autowired private RestTemplateBuilder restTemplateBuilder;
//Ignore this line and spring-boot will not run a separate instance of Tomcat per test
@SpyBean private HelloService helloService;
protected RestTemplate getRestTemplate() {
return restTemplateBuilder.build();
}
protected String getUrl() {
return "http://localhost:" + port;
}
}
|
UTF-8
|
Java
| 875 |
java
|
AbstractTest.java
|
Java
|
[] | null |
[] |
package com.bug;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.web.client.RestTemplate;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
abstract class AbstractTest {
@LocalServerPort private int port;
@Autowired private RestTemplateBuilder restTemplateBuilder;
//Ignore this line and spring-boot will not run a separate instance of Tomcat per test
@SpyBean private HelloService helloService;
protected RestTemplate getRestTemplate() {
return restTemplateBuilder.build();
}
protected String getUrl() {
return "http://localhost:" + port;
}
}
| 875 | 0.817143 | 0.817143 | 27 | 31.407408 | 27.611403 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.888889 | false | false |
3
|
5d6cec4c66bc5acf741a0e59bb07955381db2d30
| 24,335,284,716,687 |
d30ccaf338bb18de7aae958f4cef8d17865f27a8
|
/src/creational/prototype/Attachment.java
|
b76be328d68fadc88147e41c95674c150e629238
|
[] |
no_license
|
SimpleIto/design-pattern-examples
|
https://github.com/SimpleIto/design-pattern-examples
|
e294e32ed92881069c9feb7fe87a2a8821cfdc92
|
45b53fbecc5974990c0a624fa84b3c07d1a80988
|
refs/heads/master
| 2020-04-26T16:59:07.493000 | 2019-03-19T13:31:43 | 2019-03-19T13:31:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package creational.prototype;
import java.io.Serializable;
public class Attachment implements Serializable {
public void show(){
System.out.println("这是附件");
}
}
|
UTF-8
|
Java
| 187 |
java
|
Attachment.java
|
Java
|
[] | null |
[] |
package creational.prototype;
import java.io.Serializable;
public class Attachment implements Serializable {
public void show(){
System.out.println("这是附件");
}
}
| 187 | 0.709497 | 0.709497 | 9 | 18.888889 | 16.980017 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
3
|
0b4a8b5480c73106ce1c83ad42972fe1616574b6
| 3,994,319,600,679 |
5bfcb686da64aa1d213094add7b30f711878dd77
|
/io/src/main/java/file/nio/write/Write.java
|
501928fa82ae06c4af4a662952695654d3dc3ad8
|
[
"MIT"
] |
permissive
|
victorsheng/verification-everything
|
https://github.com/victorsheng/verification-everything
|
b7979339b2de6b65d26393eba59185fcb4b7462e
|
f6dd7f8b1b3c5370083bda05a062abe64d90cc10
|
refs/heads/master
| 2022-11-22T06:29:20.531000 | 2019-08-27T02:06:54 | 2019-08-27T02:06:54 | 196,312,406 | 0 | 0 |
MIT
| false | 2022-11-16T10:33:28 | 2019-07-11T03:20:12 | 2019-08-27T02:07:04 | 2022-11-16T10:33:25 | 63 | 0 | 0 | 5 |
Java
| false | false |
package file.nio.write;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class Write {
public static void main(String[] args) throws IOException {
RandomAccessFile aFile = new RandomAccessFile(
"/Users/victor/code/vicProjects/verification-everything/io/src/main/resources/write.txt",
"rw");
FileChannel channel = aFile.getChannel();
String newData = "New String to write to file..." + System.currentTimeMillis();
ByteBuffer buf = ByteBuffer.allocate(48);
buf.clear();
buf.put(newData.getBytes());
buf.flip();
while(buf.hasRemaining()) {
channel.write(buf);
}
}
}
|
UTF-8
|
Java
| 717 |
java
|
Write.java
|
Java
|
[
{
"context": "ile aFile = new RandomAccessFile(\n \"/Users/victor/code/vicProjects/verification-everything/io/src/m",
"end": 310,
"score": 0.9969276189804077,
"start": 304,
"tag": "USERNAME",
"value": "victor"
}
] | null |
[] |
package file.nio.write;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class Write {
public static void main(String[] args) throws IOException {
RandomAccessFile aFile = new RandomAccessFile(
"/Users/victor/code/vicProjects/verification-everything/io/src/main/resources/write.txt",
"rw");
FileChannel channel = aFile.getChannel();
String newData = "New String to write to file..." + System.currentTimeMillis();
ByteBuffer buf = ByteBuffer.allocate(48);
buf.clear();
buf.put(newData.getBytes());
buf.flip();
while(buf.hasRemaining()) {
channel.write(buf);
}
}
}
| 717 | 0.695955 | 0.693166 | 28 | 24.607143 | 25.154295 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
84651c2c1a78e62d6011a455e0eb88d92408bc0a
| 20,392,504,744,575 |
c8c45e735174e9d4b74f13d21deb52500a6f5369
|
/src/com/algocw/gui/MainScreen.java
|
33ca572581303cb2fa56f7276b6be2391de01bf7
|
[] |
no_license
|
wdevon99/A-Star-Path-Finder
|
https://github.com/wdevon99/A-Star-Path-Finder
|
b290ebf84482bfc2c29e1451770a3632d346128e
|
d956c238dd08d1370aea6cda3e32af8ca70914e1
|
refs/heads/master
| 2021-04-15T15:28:36.101000 | 2019-09-10T04:49:08 | 2019-09-10T04:49:08 | 126,278,075 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.algocw.gui;
import com.algocw.algo.AStar;
import com.algocw.algo.Node;
import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import java.util.ArrayList;
public class MainScreen extends Application{
//tjis variable will store the main pane in which all other components will be set to
private static BorderPane mainBorderPane;
//this variable will store the main grid pane object
private static GridPane mainGridPane;
//this variable will store the formHbox object
private static VBox formPaneVBox;
//this variable will state true for colored , false for black and white
private static boolean isColored=true;
//variables to store the start and end coordinates
private static int startX=0;
private static int startY=0;
private static int endX=19;
private static int endY=0;
//this click count variable is to keep track of the nuber of clicks on the grid pane
private int clickCount=0;
//text fields that are used to take the coordinates
private TextField tfStartX;
private TextField tfStartY;
private TextField tfEndX;
private TextField tfEndY;
private final ToggleGroup toggleGroup = new ToggleGroup();
//these radio buttons will store the type of formulae to be used
private RadioButton rbManhattan;
private RadioButton rbEuclidean;
private RadioButton rbChebyshev;
//this string will store the selected formulae method from the radio buttons
private static String selectedMethod="Manhattan";
//creating a new AStar object to use the AStar pathfinder
private AStar as= new AStar();
@Override
public void start(Stage primaryStage) throws Exception {
//setting the title
primaryStage.setTitle("Devon Wijesinghe - CW");
//getting the main scene
Scene scene= getMainScene();
//linking the main style sheet
scene.getStylesheets().add("mainStyle.css");
//setting the resizability as false
primaryStage.setResizable(false);
//setting the scene and showing it
primaryStage.setScene(scene);
primaryStage.show();
//setting up the grid for the 1st time
resetGridColorFill(true);
//initializing the path finder
initializePathFinder();
}
/**
*
* @return : The main scene that will be set to the primaryStage
*/
public Scene getMainScene(){
// ----- heading -----
HBox heading = new HBox(5);
heading.setAlignment(Pos.CENTER);
Label lblHeading = new Label("A* Path Finder by Devon Wijesinghe");
heading.getChildren().add(lblHeading);
lblHeading.getStyleClass().add("mainHeading");
heading.getStyleClass().add("heading");
// ----- heading end -----
//instantiating BorderPane
mainBorderPane= new BorderPane();
//setting the style class
//creating the components
//setting the main 20x20 grid pane
mainGridPane=getAnGrid(20,20);
//On mouse click event handle to get the grid coordinated when clicked
mainGridPane.addEventHandler(MouseEvent.MOUSE_CLICKED, e ->{
//getting the source node
javafx.scene.Node source = (javafx.scene.Node) e.getTarget();
//calling the setStartAndEndPointsFromClick method
setStartAndEndPointsFromClick(source);;
});
//setting style class
mainGridPane.getStyleClass().add("grid");
//setting the form pane
formPaneVBox=getFormPane();
//aligning to center
BorderPane.setAlignment(mainGridPane, Pos.CENTER);
BorderPane.setAlignment(formPaneVBox,Pos.CENTER);
//adding the components to the main Border Pane
mainBorderPane.setTop(heading);
mainBorderPane.setCenter(mainGridPane);
mainBorderPane.setBottom(getFormPane());
//creating the scene
Scene scene = new Scene(mainBorderPane, 630,930);
return scene;
}
/**
*
* This method created the form required to take coordinates of the start and end point and also the heuristic type
* @return : a HBox containing the form
*/
public VBox getFormPane(){
VBox formPaneVBox = new VBox(30);
HBox firstrow = new HBox(5);
HBox secondRow = new HBox(5);
HBox thirdRow = new HBox(5);
//creating the form component
//== row 1 ==
Label lblSX=new Label("Start X :");
tfStartX = new TextField("0");
Label lblSY=new Label("Start Y :");
tfStartY = new TextField("0");
Label lblSpace=new Label(" ");
Label lblEX=new Label("End X :");
tfEndX = new TextField("0");
Label lblEY=new Label("End Y :");
tfEndY = new TextField("19");
//== row 2 ==
rbManhattan= new RadioButton("Manhattan");
rbManhattan.setSelected(true);
rbEuclidean= new RadioButton("Euclidean");
rbChebyshev= new RadioButton("Chebyshev");
//setting the toggle group
rbManhattan.setToggleGroup(toggleGroup);
rbEuclidean.setToggleGroup(toggleGroup);
rbChebyshev.setToggleGroup(toggleGroup);
//== row 3 ==
Button runBtn= new Button("RUN");
Button colorBtn= new Button("Color ON/OFF");
//setting Style classes
tfStartX.getStyleClass().add("textField");
tfStartY.getStyleClass().add("textField");
tfEndX.getStyleClass().add("textField");
tfEndY.getStyleClass().add("textField");
runBtn.getStyleClass().add("btnRun");
colorBtn.getStyleClass().add("btnColor");
lblSX.getStyleClass().add("lbl");
formPaneVBox.getStyleClass().add("formPane");
//setting alignment to center
formPaneVBox.setAlignment(Pos.CENTER);
firstrow.setAlignment(Pos.CENTER);
secondRow.setAlignment(Pos.CENTER);
thirdRow.setAlignment(Pos.CENTER);
//====== On click and on change actions ======
//main run button login
runBtn.setOnAction(e -> {
//the onRunButtonPressed method is called to which run the algorithm and draws the path
onRunButtonPressed();
});
//changing between black and white and colored
colorBtn.setOnAction(e->{
isColored=!isColored;
resetGridColorFill(isColored);
});
//=======================================================
//adding components to HBox
// --- first row
firstrow.getChildren().addAll(lblSX,tfStartX,lblSY,tfStartY,lblSpace,lblEX,tfEndX,lblEY,tfEndY);
// --- Second row
secondRow.getChildren().addAll(rbManhattan,rbEuclidean,rbChebyshev);
// --- third row
thirdRow.getChildren().addAll(runBtn,colorBtn);
//adding HBoxes to VBox
formPaneVBox.getChildren().addAll(firstrow,secondRow,thirdRow);
return formPaneVBox;
}
/**
* This method will initialize the AStar path finder
*/
public void initializePathFinder(){
//Creating a new AStar object
as= new AStar();
//resetting the grid
resetGridColorFill(isIsColored());
//populating the matrix
as.populateNodeMatrix();
}
/**
* This method is the method that is called when the RUN button is pressed, this method will run the algorithm and draws the path
*/
public void onRunButtonPressed(){
long startTime = System.nanoTime();
//initializing the path finder
initializePathFinder();
//setting the values retrieved from the radio button to the variables
setTheRadioValue();
//set and end start points in get
setStartAndEndPoints();
//populating the matrix again with new values
as.populateNodeMatrix();
//getting the start node from the matrix
Node startNode = as.nodeMatrix[startX][startY];
// call the Main method that will run to find the path from the start point to the end point
as.findPath(startNode);
//========== FOR TESTING ==========
//as.printArray(as.nodeMatrix);
System.out.println("--------------");
System.out.println(as.visitedArraylist);
System.out.println("--------------");
System.out.println(as.finalPathArrayList);
//========== FOR TESTING ==========
//Coloring the visited nodes in one colordd
//drawPath(as.visitedArraylist,Color.CYAN);
if(isIsColored()){
//Coloring the final path in YELLOW
drawPath(as.finalPathArrayList,Color.CYAN);
}else {
//Coloring the final path in YELLOW
drawPath(as.finalPathArrayList,Color.CYAN);
}
//the time taken in milli seconds
long estimatedTime = (System.nanoTime() - startTime )/1000000;
PopUps.popUp("PATH FOUND" , "Path found succesfully :) \nDetails are shown below","Selected Metric : "+ selectedMethod +"\n\nTime taken : "+ estimatedTime + "ms" + "\nG Cost : "+as.nodeMatrix[endX][endY].getgCost() , Alert.AlertType.INFORMATION);
}
/**
* This method will color the grid by populating grid with rectangles
* @param isColored : to make the grid coloured or black and white - True for colored
*/
public static void resetGridColorFill(boolean isColored){
mainGridPane.getChildren().clear();
//looping through the 2d array matrix
for(int i=0;i<20;i++){
for (int j=0;j<20;j++){
int val=GridPopulator.matrixArray[i][j];
//adding rectangles to the grid pane
Rectangle rectangle= new Rectangle(0,0,29,29);
//this switch will set the cell color based on the value
switch (val){
case 2:
if(isColored){
rectangle.setFill(Color.rgb(36, 221, 36,0.2));
}else{
//lightest shade of grey (weight = 2)
rectangle.setFill(Color.rgb(240, 240, 240,0.2));
}
break;
case 3:
if(isColored){
rectangle.setFill(Color.rgb(0, 181, 0,0.2));
}else {
//middle shade of grey (weight = 3)
rectangle.setFill(Color.rgb(224, 224, 224,0.2));
}
break;
case 4:
if(isColored){
rectangle.setFill(Color.rgb(198, 198, 198,0.2));
}else {
//darkest shade of greay (weight = 4);
rectangle.setFill(Color.rgb(208, 208, 208,0.2));
}
break;
case 5:
if(isColored){
rectangle.setFill(Color.rgb(0, 57, 222,0.2));
}else {
//black
rectangle.setFill(Color.rgb(0, 0, 0,0.2));
}
break;
default:
if(isColored){
rectangle.setFill(Color.rgb(107, 181, 0,0.5));
}else{
//white shade of grey (weight = 1)
rectangle.setFill(Color.rgb(255, 255, 255,0.5));
break;
}
}
mainGridPane.add(rectangle,j,i);
}
}
}
/**
* this method will mark the start and end points in the GUI grid
*/
public void setStartAndEndPoints(){
//getting the tf values
startX= Integer.parseInt(tfStartX.getText());
startY= Integer.parseInt(tfStartY.getText());
endX= Integer.parseInt(tfEndX.getText());
endY= Integer.parseInt(tfEndY.getText());
//setting the color of the START point as red
colorAnCell(startX,startY,Color.GREEN);
//setting the color of the END point as green
colorAnCell(endX,endY,Color.RED);
}
/**
* This method will set the start and end points in the grid by clicking
* @param source : the target node source
*/
private void setStartAndEndPointsFromClick(javafx.scene.Node source) {
//incrementing the count
clickCount ++;
//getting the col and row index of the node
Integer colIndex = GridPane.getColumnIndex(source);
Integer rowIndex = GridPane.getRowIndex(source);
//getting the node object of the corresponding index
Node selectedNode = as.nodeMatrix[colIndex][rowIndex];
//checking if node is blocked
if(selectedNode.isBlocked()){
//if blocked , a alert will be show and the method will stop with the return
PopUps.popUp("Warning","This node is blocked","You can not go to this node as it is blocked , click on a different cell . Sorry :)", Alert.AlertType.WARNING);
clickCount--;
return;
}
//checking for the first click
if(clickCount==1){
//setting up the start point
tfStartX.setText(String .valueOf(colIndex));
tfStartY.setText(String .valueOf(rowIndex));
//coloring the start Node GREEN
colorAnCell(colIndex,rowIndex,Color.GREEN);
}
//checking for the second click
else if (clickCount==2){
//setting up the end point
tfEndX.setText(String.valueOf(colIndex));
tfEndY.setText(String .valueOf(rowIndex));
//coloring the end Node RED
colorAnCell(colIndex,rowIndex,Color.RED);
}
//if more than 2 click recorded
else {
clickCount=0;
//this will reset the grid
resetGridColorFill(isIsColored());
}
}
/**
* This method will draw a path using a 2d array and colorAnCell() method
* @param finalPathArrayList : list of node containing the final path
*/
public void drawPath(ArrayList<Node> finalPathArrayList ,Color pathColor){
for (Node node : finalPathArrayList){
//X coordinate
int x=node.getxCoordinate();
//Y coordinate
int y=node.getyCoordinate();
if( !(x ==startX && y==startY) && !(x ==endX && y==endY)){
//coloring a cell with coordinates x,t
colorAnCell(x,y,pathColor);
}
}
}
/**
* This method will set the radio button values and set the selected radio value
*/
public void setTheRadioValue(){
//setting user data
rbManhattan.setUserData("Manhattan");
rbEuclidean.setUserData("Euclidean");
rbChebyshev.setUserData("Chebyshev");
//getting the selected radio button
RadioButton selectedRadioButton =
(RadioButton) toggleGroup.getSelectedToggle();
//setting the value of the selected radio button to the variable
selectedMethod = String.valueOf(selectedRadioButton.getUserData());
System.out.println(selectedMethod);
}
/**
*
* This method will color a single cell in the grid
*
* @param x : X axis coordinate
* @param y : y axis coordinate
* @param color : the color of the fill
*/
public static void colorAnCell(int x,int y ,Color color){
//creating a new rectrangle and aligning to center
Rectangle rectrangle = new Rectangle(20,20);
//setting alignment to center
GridPane.setHalignment(rectrangle, HPos.CENTER);
//setting the color
rectrangle.setFill(color);
//adding to the grid pain at the correct position - (x,y)
mainGridPane.add(rectrangle,x,y);
}
/**
* this method will return a grid pane
* @param rows :number of rows of the grid
* @param columns :number of columns of the grid
* @return : return a rows x columns grid pane
*/
public static GridPane getAnGrid(int rows ,int columns){
//Declaring and instantiating a grid pane
GridPane grid;
grid = new GridPane();
//creating the columns
for(int i = 0; i < columns; i++) {
ColumnConstraints column = new ColumnConstraints(30);
grid.getColumnConstraints().add(column);
}
//creating the rows
for(int i = 0; i < rows; i++) {
RowConstraints row = new RowConstraints(30);
grid.getRowConstraints().add(row);
}
return grid;
}
//Getters and setters
public static boolean isIsColored() {
return isColored;
}
public static int getEndX() {
return endX;
}
public static int getEndY() {
return endY;
}
public static String getSelectedMethod() {
return selectedMethod;
}
}
|
UTF-8
|
Java
| 17,589 |
java
|
MainScreen.java
|
Java
|
[
{
"context": "/setting the title\n primaryStage.setTitle(\"Devon Wijesinghe - CW\");\n //getting the main scene\n ",
"end": 2102,
"score": 0.9998099207878113,
"start": 2086,
"tag": "NAME",
"value": "Devon Wijesinghe"
},
{
"context": " Label lblHeading = new Label(\"A* Path Finder by Devon Wijesinghe\");\n heading.getChildren().add(lblHeading);",
"end": 2937,
"score": 0.9998961687088013,
"start": 2921,
"tag": "NAME",
"value": "Devon Wijesinghe"
}
] | null |
[] |
package com.algocw.gui;
import com.algocw.algo.AStar;
import com.algocw.algo.Node;
import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import java.util.ArrayList;
public class MainScreen extends Application{
//tjis variable will store the main pane in which all other components will be set to
private static BorderPane mainBorderPane;
//this variable will store the main grid pane object
private static GridPane mainGridPane;
//this variable will store the formHbox object
private static VBox formPaneVBox;
//this variable will state true for colored , false for black and white
private static boolean isColored=true;
//variables to store the start and end coordinates
private static int startX=0;
private static int startY=0;
private static int endX=19;
private static int endY=0;
//this click count variable is to keep track of the nuber of clicks on the grid pane
private int clickCount=0;
//text fields that are used to take the coordinates
private TextField tfStartX;
private TextField tfStartY;
private TextField tfEndX;
private TextField tfEndY;
private final ToggleGroup toggleGroup = new ToggleGroup();
//these radio buttons will store the type of formulae to be used
private RadioButton rbManhattan;
private RadioButton rbEuclidean;
private RadioButton rbChebyshev;
//this string will store the selected formulae method from the radio buttons
private static String selectedMethod="Manhattan";
//creating a new AStar object to use the AStar pathfinder
private AStar as= new AStar();
@Override
public void start(Stage primaryStage) throws Exception {
//setting the title
primaryStage.setTitle("<NAME> - CW");
//getting the main scene
Scene scene= getMainScene();
//linking the main style sheet
scene.getStylesheets().add("mainStyle.css");
//setting the resizability as false
primaryStage.setResizable(false);
//setting the scene and showing it
primaryStage.setScene(scene);
primaryStage.show();
//setting up the grid for the 1st time
resetGridColorFill(true);
//initializing the path finder
initializePathFinder();
}
/**
*
* @return : The main scene that will be set to the primaryStage
*/
public Scene getMainScene(){
// ----- heading -----
HBox heading = new HBox(5);
heading.setAlignment(Pos.CENTER);
Label lblHeading = new Label("A* Path Finder by <NAME>");
heading.getChildren().add(lblHeading);
lblHeading.getStyleClass().add("mainHeading");
heading.getStyleClass().add("heading");
// ----- heading end -----
//instantiating BorderPane
mainBorderPane= new BorderPane();
//setting the style class
//creating the components
//setting the main 20x20 grid pane
mainGridPane=getAnGrid(20,20);
//On mouse click event handle to get the grid coordinated when clicked
mainGridPane.addEventHandler(MouseEvent.MOUSE_CLICKED, e ->{
//getting the source node
javafx.scene.Node source = (javafx.scene.Node) e.getTarget();
//calling the setStartAndEndPointsFromClick method
setStartAndEndPointsFromClick(source);;
});
//setting style class
mainGridPane.getStyleClass().add("grid");
//setting the form pane
formPaneVBox=getFormPane();
//aligning to center
BorderPane.setAlignment(mainGridPane, Pos.CENTER);
BorderPane.setAlignment(formPaneVBox,Pos.CENTER);
//adding the components to the main Border Pane
mainBorderPane.setTop(heading);
mainBorderPane.setCenter(mainGridPane);
mainBorderPane.setBottom(getFormPane());
//creating the scene
Scene scene = new Scene(mainBorderPane, 630,930);
return scene;
}
/**
*
* This method created the form required to take coordinates of the start and end point and also the heuristic type
* @return : a HBox containing the form
*/
public VBox getFormPane(){
VBox formPaneVBox = new VBox(30);
HBox firstrow = new HBox(5);
HBox secondRow = new HBox(5);
HBox thirdRow = new HBox(5);
//creating the form component
//== row 1 ==
Label lblSX=new Label("Start X :");
tfStartX = new TextField("0");
Label lblSY=new Label("Start Y :");
tfStartY = new TextField("0");
Label lblSpace=new Label(" ");
Label lblEX=new Label("End X :");
tfEndX = new TextField("0");
Label lblEY=new Label("End Y :");
tfEndY = new TextField("19");
//== row 2 ==
rbManhattan= new RadioButton("Manhattan");
rbManhattan.setSelected(true);
rbEuclidean= new RadioButton("Euclidean");
rbChebyshev= new RadioButton("Chebyshev");
//setting the toggle group
rbManhattan.setToggleGroup(toggleGroup);
rbEuclidean.setToggleGroup(toggleGroup);
rbChebyshev.setToggleGroup(toggleGroup);
//== row 3 ==
Button runBtn= new Button("RUN");
Button colorBtn= new Button("Color ON/OFF");
//setting Style classes
tfStartX.getStyleClass().add("textField");
tfStartY.getStyleClass().add("textField");
tfEndX.getStyleClass().add("textField");
tfEndY.getStyleClass().add("textField");
runBtn.getStyleClass().add("btnRun");
colorBtn.getStyleClass().add("btnColor");
lblSX.getStyleClass().add("lbl");
formPaneVBox.getStyleClass().add("formPane");
//setting alignment to center
formPaneVBox.setAlignment(Pos.CENTER);
firstrow.setAlignment(Pos.CENTER);
secondRow.setAlignment(Pos.CENTER);
thirdRow.setAlignment(Pos.CENTER);
//====== On click and on change actions ======
//main run button login
runBtn.setOnAction(e -> {
//the onRunButtonPressed method is called to which run the algorithm and draws the path
onRunButtonPressed();
});
//changing between black and white and colored
colorBtn.setOnAction(e->{
isColored=!isColored;
resetGridColorFill(isColored);
});
//=======================================================
//adding components to HBox
// --- first row
firstrow.getChildren().addAll(lblSX,tfStartX,lblSY,tfStartY,lblSpace,lblEX,tfEndX,lblEY,tfEndY);
// --- Second row
secondRow.getChildren().addAll(rbManhattan,rbEuclidean,rbChebyshev);
// --- third row
thirdRow.getChildren().addAll(runBtn,colorBtn);
//adding HBoxes to VBox
formPaneVBox.getChildren().addAll(firstrow,secondRow,thirdRow);
return formPaneVBox;
}
/**
* This method will initialize the AStar path finder
*/
public void initializePathFinder(){
//Creating a new AStar object
as= new AStar();
//resetting the grid
resetGridColorFill(isIsColored());
//populating the matrix
as.populateNodeMatrix();
}
/**
* This method is the method that is called when the RUN button is pressed, this method will run the algorithm and draws the path
*/
public void onRunButtonPressed(){
long startTime = System.nanoTime();
//initializing the path finder
initializePathFinder();
//setting the values retrieved from the radio button to the variables
setTheRadioValue();
//set and end start points in get
setStartAndEndPoints();
//populating the matrix again with new values
as.populateNodeMatrix();
//getting the start node from the matrix
Node startNode = as.nodeMatrix[startX][startY];
// call the Main method that will run to find the path from the start point to the end point
as.findPath(startNode);
//========== FOR TESTING ==========
//as.printArray(as.nodeMatrix);
System.out.println("--------------");
System.out.println(as.visitedArraylist);
System.out.println("--------------");
System.out.println(as.finalPathArrayList);
//========== FOR TESTING ==========
//Coloring the visited nodes in one colordd
//drawPath(as.visitedArraylist,Color.CYAN);
if(isIsColored()){
//Coloring the final path in YELLOW
drawPath(as.finalPathArrayList,Color.CYAN);
}else {
//Coloring the final path in YELLOW
drawPath(as.finalPathArrayList,Color.CYAN);
}
//the time taken in milli seconds
long estimatedTime = (System.nanoTime() - startTime )/1000000;
PopUps.popUp("PATH FOUND" , "Path found succesfully :) \nDetails are shown below","Selected Metric : "+ selectedMethod +"\n\nTime taken : "+ estimatedTime + "ms" + "\nG Cost : "+as.nodeMatrix[endX][endY].getgCost() , Alert.AlertType.INFORMATION);
}
/**
* This method will color the grid by populating grid with rectangles
* @param isColored : to make the grid coloured or black and white - True for colored
*/
public static void resetGridColorFill(boolean isColored){
mainGridPane.getChildren().clear();
//looping through the 2d array matrix
for(int i=0;i<20;i++){
for (int j=0;j<20;j++){
int val=GridPopulator.matrixArray[i][j];
//adding rectangles to the grid pane
Rectangle rectangle= new Rectangle(0,0,29,29);
//this switch will set the cell color based on the value
switch (val){
case 2:
if(isColored){
rectangle.setFill(Color.rgb(36, 221, 36,0.2));
}else{
//lightest shade of grey (weight = 2)
rectangle.setFill(Color.rgb(240, 240, 240,0.2));
}
break;
case 3:
if(isColored){
rectangle.setFill(Color.rgb(0, 181, 0,0.2));
}else {
//middle shade of grey (weight = 3)
rectangle.setFill(Color.rgb(224, 224, 224,0.2));
}
break;
case 4:
if(isColored){
rectangle.setFill(Color.rgb(198, 198, 198,0.2));
}else {
//darkest shade of greay (weight = 4);
rectangle.setFill(Color.rgb(208, 208, 208,0.2));
}
break;
case 5:
if(isColored){
rectangle.setFill(Color.rgb(0, 57, 222,0.2));
}else {
//black
rectangle.setFill(Color.rgb(0, 0, 0,0.2));
}
break;
default:
if(isColored){
rectangle.setFill(Color.rgb(107, 181, 0,0.5));
}else{
//white shade of grey (weight = 1)
rectangle.setFill(Color.rgb(255, 255, 255,0.5));
break;
}
}
mainGridPane.add(rectangle,j,i);
}
}
}
/**
* this method will mark the start and end points in the GUI grid
*/
public void setStartAndEndPoints(){
//getting the tf values
startX= Integer.parseInt(tfStartX.getText());
startY= Integer.parseInt(tfStartY.getText());
endX= Integer.parseInt(tfEndX.getText());
endY= Integer.parseInt(tfEndY.getText());
//setting the color of the START point as red
colorAnCell(startX,startY,Color.GREEN);
//setting the color of the END point as green
colorAnCell(endX,endY,Color.RED);
}
/**
* This method will set the start and end points in the grid by clicking
* @param source : the target node source
*/
private void setStartAndEndPointsFromClick(javafx.scene.Node source) {
//incrementing the count
clickCount ++;
//getting the col and row index of the node
Integer colIndex = GridPane.getColumnIndex(source);
Integer rowIndex = GridPane.getRowIndex(source);
//getting the node object of the corresponding index
Node selectedNode = as.nodeMatrix[colIndex][rowIndex];
//checking if node is blocked
if(selectedNode.isBlocked()){
//if blocked , a alert will be show and the method will stop with the return
PopUps.popUp("Warning","This node is blocked","You can not go to this node as it is blocked , click on a different cell . Sorry :)", Alert.AlertType.WARNING);
clickCount--;
return;
}
//checking for the first click
if(clickCount==1){
//setting up the start point
tfStartX.setText(String .valueOf(colIndex));
tfStartY.setText(String .valueOf(rowIndex));
//coloring the start Node GREEN
colorAnCell(colIndex,rowIndex,Color.GREEN);
}
//checking for the second click
else if (clickCount==2){
//setting up the end point
tfEndX.setText(String.valueOf(colIndex));
tfEndY.setText(String .valueOf(rowIndex));
//coloring the end Node RED
colorAnCell(colIndex,rowIndex,Color.RED);
}
//if more than 2 click recorded
else {
clickCount=0;
//this will reset the grid
resetGridColorFill(isIsColored());
}
}
/**
* This method will draw a path using a 2d array and colorAnCell() method
* @param finalPathArrayList : list of node containing the final path
*/
public void drawPath(ArrayList<Node> finalPathArrayList ,Color pathColor){
for (Node node : finalPathArrayList){
//X coordinate
int x=node.getxCoordinate();
//Y coordinate
int y=node.getyCoordinate();
if( !(x ==startX && y==startY) && !(x ==endX && y==endY)){
//coloring a cell with coordinates x,t
colorAnCell(x,y,pathColor);
}
}
}
/**
* This method will set the radio button values and set the selected radio value
*/
public void setTheRadioValue(){
//setting user data
rbManhattan.setUserData("Manhattan");
rbEuclidean.setUserData("Euclidean");
rbChebyshev.setUserData("Chebyshev");
//getting the selected radio button
RadioButton selectedRadioButton =
(RadioButton) toggleGroup.getSelectedToggle();
//setting the value of the selected radio button to the variable
selectedMethod = String.valueOf(selectedRadioButton.getUserData());
System.out.println(selectedMethod);
}
/**
*
* This method will color a single cell in the grid
*
* @param x : X axis coordinate
* @param y : y axis coordinate
* @param color : the color of the fill
*/
public static void colorAnCell(int x,int y ,Color color){
//creating a new rectrangle and aligning to center
Rectangle rectrangle = new Rectangle(20,20);
//setting alignment to center
GridPane.setHalignment(rectrangle, HPos.CENTER);
//setting the color
rectrangle.setFill(color);
//adding to the grid pain at the correct position - (x,y)
mainGridPane.add(rectrangle,x,y);
}
/**
* this method will return a grid pane
* @param rows :number of rows of the grid
* @param columns :number of columns of the grid
* @return : return a rows x columns grid pane
*/
public static GridPane getAnGrid(int rows ,int columns){
//Declaring and instantiating a grid pane
GridPane grid;
grid = new GridPane();
//creating the columns
for(int i = 0; i < columns; i++) {
ColumnConstraints column = new ColumnConstraints(30);
grid.getColumnConstraints().add(column);
}
//creating the rows
for(int i = 0; i < rows; i++) {
RowConstraints row = new RowConstraints(30);
grid.getRowConstraints().add(row);
}
return grid;
}
//Getters and setters
public static boolean isIsColored() {
return isColored;
}
public static int getEndX() {
return endX;
}
public static int getEndY() {
return endY;
}
public static String getSelectedMethod() {
return selectedMethod;
}
}
| 17,569 | 0.587128 | 0.577406 | 538 | 31.69145 | 26.865658 | 255 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535316 | false | false |
3
|
a536e0eb0b02fd126bf081ce64dc711c5b175db1
| 10,402,410,842,500 |
eae29eb2d265f49d1360ce77cdfa3e59ba447ffb
|
/src/main/java/com/dreamgo/util/UploadUtil.java
|
29682f7c79c49c2031cacb1924cb29e870a993a5
|
[] |
no_license
|
kimsintae/DreamGo-ver0.2-
|
https://github.com/kimsintae/DreamGo-ver0.2-
|
3ce1e3671ae94f9c3b23ab0bea88daeefe82bf76
|
20d3f5c2622ddd2b443740b6f0968e5c6f3b2c33
|
refs/heads/master
| 2021-01-20T08:19:48.519000 | 2017-04-05T11:01:03 | 2017-04-05T11:01:03 | 83,903,576 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dreamgo.util;
import java.io.File;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
public class UploadUtil {
//업로드될 경로
private static String uploadPath =
"C:\\Users\\kim\\Desktop\\workspace\\Spring-legercy\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp1\\wtpwebapps\\dream_go\\resources\\upload";
public static String upload(MultipartFile profile)throws Exception{
System.out.println(uploadPath);
//파일이름의 중복을 피하기 위한 고유키값 생성
UUID uKey = UUID.randomUUID();
//고유한 키값과 파일이름으로 저장될 파일명 생성
String savedFileName = uKey.toString()+"_"+profile.getOriginalFilename();
//경로와 파일
File target = new File(uploadPath, savedFileName);
//파일 실제 업로드
FileCopyUtils.copy(profile.getBytes(), target);
System.out.println("저장될 파일 이름 : "+savedFileName);
return savedFileName;
}
}
|
UTF-8
|
Java
| 1,084 |
java
|
UploadUtil.java
|
Java
|
[
{
"context": "rivate static String uploadPath = \n\t\t\t\"C:\\\\Users\\\\kim\\\\Desktop\\\\workspace\\\\Spring-legercy\\\\.metadata\\\\.",
"end": 316,
"score": 0.9678808450698853,
"start": 313,
"tag": "USERNAME",
"value": "kim"
}
] | null |
[] |
package com.dreamgo.util;
import java.io.File;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
public class UploadUtil {
//업로드될 경로
private static String uploadPath =
"C:\\Users\\kim\\Desktop\\workspace\\Spring-legercy\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp1\\wtpwebapps\\dream_go\\resources\\upload";
public static String upload(MultipartFile profile)throws Exception{
System.out.println(uploadPath);
//파일이름의 중복을 피하기 위한 고유키값 생성
UUID uKey = UUID.randomUUID();
//고유한 키값과 파일이름으로 저장될 파일명 생성
String savedFileName = uKey.toString()+"_"+profile.getOriginalFilename();
//경로와 파일
File target = new File(uploadPath, savedFileName);
//파일 실제 업로드
FileCopyUtils.copy(profile.getBytes(), target);
System.out.println("저장될 파일 이름 : "+savedFileName);
return savedFileName;
}
}
| 1,084 | 0.733264 | 0.732218 | 38 | 24.157894 | 30.133497 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.552632 | false | false |
3
|
7055751620529b3cf7cf0aadeb2f12516b9f8d17
| 11,854,109,749,558 |
f9559e3036659dac628b7fa4d342bb244780e362
|
/table-game-impl/src/main/java/ru/tablegame/config/WebFluxConfig.java
|
d66057f532e8f9652dbb503ccaeb0199caf42706
|
[] |
no_license
|
liestory/spring-tablegame
|
https://github.com/liestory/spring-tablegame
|
123534f9086fb3a4c09306812855ecab7d94a60d
|
523a2fe9055e240b970a3f3294c4fd73f0ca07ee
|
refs/heads/develop
| 2023-04-26T18:17:19.088000 | 2021-05-12T16:30:55 | 2021-05-12T16:30:55 | 303,677,004 | 0 | 0 | null | false | 2020-12-30T11:43:48 | 2020-10-13T11:13:15 | 2020-12-28T21:34:17 | 2020-12-30T11:43:47 | 322 | 0 | 0 | 0 |
Java
| false | false |
package ru.tablegame.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.web.ReactivePageableHandlerMethodArgumentResolver;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
import org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer;
/**
* кастомный конфигуратор для webFlux
*
* @author nemykin 20.12.2020
*/
@Configuration
@ConditionalOnClass(EnableWebFlux.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
public class WebFluxConfig implements WebFluxConfigurer {
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
configurer.addCustomResolver(new ReactivePageableHandlerMethodArgumentResolver());
}
}
|
UTF-8
|
Java
| 1,051 |
java
|
WebFluxConfig.java
|
Java
|
[
{
"context": "* кастомный конфигуратор для webFlux\n *\n * @author nemykin 20.12.2020\n */\n@Configuration\n@ConditionalOnClass",
"end": 620,
"score": 0.999615490436554,
"start": 613,
"tag": "USERNAME",
"value": "nemykin"
}
] | null |
[] |
package ru.tablegame.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.web.ReactivePageableHandlerMethodArgumentResolver;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
import org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer;
/**
* кастомный конфигуратор для webFlux
*
* @author nemykin 20.12.2020
*/
@Configuration
@ConditionalOnClass(EnableWebFlux.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
public class WebFluxConfig implements WebFluxConfigurer {
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
configurer.addCustomResolver(new ReactivePageableHandlerMethodArgumentResolver());
}
}
| 1,051 | 0.848101 | 0.840312 | 25 | 40.080002 | 33.813511 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.36 | false | false |
3
|
1a2968ba7b38483f910002580d92a65db03d6b07
| 4,509,715,675,018 |
9ed09a23ee89333d3b4fbafa01759c0727d94d2e
|
/Chapter 6/src/cc/nailos/P6_9NailosTester.java
|
ba73f3d6290c839aeb4b6ddeb35f2eac2f3b0833
|
[] |
no_license
|
spaceisawaste/workspace
|
https://github.com/spaceisawaste/workspace
|
6f54fe02ca1e3b42f230c08991d682f70a150ac1
|
6fc0d485c6943640ac2e604283d4cf75a8cc9b5d
|
refs/heads/master
| 2016-08-09T05:55:04.440000 | 2016-03-01T17:52:48 | 2016-03-01T17:52:48 | 52,897,092 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cc.nailos;
import java.util.Scanner;
/**
* Class to test the prime number lister. Will take any user input so long as it's an int
* @author Conor
*
*/
public class P6_9NailosTester
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("It's prime time bb! \nGimme a number and I'll show you all the prime that came before it!");
P6_9Nailos primes = new P6_9Nailos(in.nextInt());
System.out.println(primes.listPrimes());
in.close();
}
}
|
UTF-8
|
Java
| 530 |
java
|
P6_9NailosTester.java
|
Java
|
[
{
"context": " any user input so long as it's an int\r\n * @author Conor\r\n *\r\n */\r\npublic class P6_9NailosTester\r\n{\r\n\tpubl",
"end": 161,
"score": 0.9971692562103271,
"start": 156,
"tag": "NAME",
"value": "Conor"
}
] | null |
[] |
package cc.nailos;
import java.util.Scanner;
/**
* Class to test the prime number lister. Will take any user input so long as it's an int
* @author Conor
*
*/
public class P6_9NailosTester
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("It's prime time bb! \nGimme a number and I'll show you all the prime that came before it!");
P6_9Nailos primes = new P6_9Nailos(in.nextInt());
System.out.println(primes.listPrimes());
in.close();
}
}
| 530 | 0.669811 | 0.658491 | 20 | 24.5 | 30.408058 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.1 | false | false |
3
|
5b473fe630a3603f827e3478648e0e1f69cbed30
| 25,726,854,129,911 |
71ed252261480583ed2748436f1b3382ef1049f0
|
/src/Interviews/Indeed/Practice/Moving_Average_Practice.java
|
0e9d897e1c3a6c8886cb29052ad9a41c47a13d23
|
[] |
no_license
|
calculus008/shuati
|
https://github.com/calculus008/shuati
|
5f5a901bd9a74e793f236d7e06802a1b538144b7
|
c99e2f5b7ea7d8ab984462b304f68226d6ee32d1
|
refs/heads/master
| 2023-07-25T18:53:27.699000 | 2023-07-16T19:04:13 | 2023-07-16T19:04:13 | 129,973,144 | 1 | 6 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Interviews.Indeed.Practice;
import java.util.*;
public class Moving_Average_Practice {
class Event {
int val;
int time;
public Event(int val, int time) {
this.val = val;
this.time = time;
}
}
Queue<Event> q = new LinkedList<>();
public int getNow() {return 0;}
int sum = 0;
private boolean isExpired(int preTime) {
return getNow() - preTime > 300;
}
private void removeExpired() {
while (!q.isEmpty() && isExpired(q.peek().time)) {
Event e = q.poll();
sum -= e.val;
}
}
public void record(int val) {
removeExpired();
Event e = new Event(getNow(), val);
q.offer(e);
sum += val;
}
public double getAvg() {
removeExpired();
return q.size() == 0 ? 0.0 : (double)sum / q.size();
}
/**
* -----------
* Follow up 1
* 如果对record和getaverage的性能要求特别⾼高,不想出现突刺刺情况,就是某个请求要等⽐比较久
* 可以把removeExpired函数拿出来专⻔门⽤用⼀一个线程去跑,每秒调⽤用⼀一次
*
* 多线程的话 是不是要不这几个方法都上锁呢
* 都上锁比较影响效率。
* 可以考虑用synchronized关键字,把需要Thread-safe的东西保护起来。
* 可以用Collections.synchronizedcList 给List加一层保护,再用 synchronized关键字
*/
/**
* ------------
* Follow up 2
* memory不够大怎么办(数据点非常密集,5分钟就把内存爆了)
*/
class Event1 {
int val;
int time;
int size;
public Event1 (int val, int time) {
this.val = val;
this.time = time;
this.size = 1;
}
}
Deque<Event1> q1 = new ArrayDeque<>();
long sum1 = 0;
long size = 0;
public void removeExpired1() {
while (!q1.isEmpty() && isExpired(q1.peekFirst().time)) {
Event1 e = q1.pollFirst();
sum -= e.val;
size -= e.size;
}
}
public void record1(int val) {
removeExpired1();
if (!q1.isEmpty()) {
Event1 last = q1.peekLast();
if (getNow() - last.time < 10) {
last.val += val;
last.size++;
} else {
Event1 e = new Event1(val, getNow());
q1.offer(e);
}
} else {
Event1 e = new Event1(val, getNow());
q1.offer(e);
}
sum += val;
size++;
}
public double getAvg1() {
removeExpired1();
return q1.isEmpty() ? 0.0 : (double)sum /size;
}
/**
* ------------
* Follow up 3
* getMedian(), quickSelect, O(n)
*
* Only for case that memory is enough (1st case)
*/
public double getMedian() {
removeExpired();
if (q.isEmpty()) return 0.0;
int[] nums = new int[q.size()];
int i = 0;
for (Event e : q) {
nums[i++] = e.val;
}
int n = nums.length;
if (n % 2 == 0) {
return (quickSelect(nums, n / 2, 0, n - 1) + quickSelect(nums, n / 2 - 1, 0, n - 1)) * 0.5;
}
return quickSelect(nums, n / 2, 0, n - 1);
}
public int quickSelect(int[] nums, int k, int start, int end) {
if (start >= end) {
return nums[start];
}
int l = start;
int r = end;
int pivot = nums[(start + end) / 2];
while (l <= r) {
while (l <= r && nums[l] < pivot) {
l++;
}
while (l <= r && nums[r] > pivot) {
r--;
}
if (l <= r) {
int temp = nums[l];
nums[l] = nums[r];
nums[r] = temp;
l++;
r--;
}
}
//!!!
if (r >= k && r >= start) {
return quickSelect(nums, k, start, r);
} else if (l <= k && l <= end) {
return quickSelect(nums, k, l, end);
} else {
return nums[k];
}
}
private void swap(int[] nums, int l, int r) {
int temp = nums[l];
nums[l] = nums[r];
nums[r] = temp;
}
}
|
UTF-8
|
Java
| 4,391 |
java
|
Moving_Average_Practice.java
|
Java
|
[] | null |
[] |
package Interviews.Indeed.Practice;
import java.util.*;
public class Moving_Average_Practice {
class Event {
int val;
int time;
public Event(int val, int time) {
this.val = val;
this.time = time;
}
}
Queue<Event> q = new LinkedList<>();
public int getNow() {return 0;}
int sum = 0;
private boolean isExpired(int preTime) {
return getNow() - preTime > 300;
}
private void removeExpired() {
while (!q.isEmpty() && isExpired(q.peek().time)) {
Event e = q.poll();
sum -= e.val;
}
}
public void record(int val) {
removeExpired();
Event e = new Event(getNow(), val);
q.offer(e);
sum += val;
}
public double getAvg() {
removeExpired();
return q.size() == 0 ? 0.0 : (double)sum / q.size();
}
/**
* -----------
* Follow up 1
* 如果对record和getaverage的性能要求特别⾼高,不想出现突刺刺情况,就是某个请求要等⽐比较久
* 可以把removeExpired函数拿出来专⻔门⽤用⼀一个线程去跑,每秒调⽤用⼀一次
*
* 多线程的话 是不是要不这几个方法都上锁呢
* 都上锁比较影响效率。
* 可以考虑用synchronized关键字,把需要Thread-safe的东西保护起来。
* 可以用Collections.synchronizedcList 给List加一层保护,再用 synchronized关键字
*/
/**
* ------------
* Follow up 2
* memory不够大怎么办(数据点非常密集,5分钟就把内存爆了)
*/
class Event1 {
int val;
int time;
int size;
public Event1 (int val, int time) {
this.val = val;
this.time = time;
this.size = 1;
}
}
Deque<Event1> q1 = new ArrayDeque<>();
long sum1 = 0;
long size = 0;
public void removeExpired1() {
while (!q1.isEmpty() && isExpired(q1.peekFirst().time)) {
Event1 e = q1.pollFirst();
sum -= e.val;
size -= e.size;
}
}
public void record1(int val) {
removeExpired1();
if (!q1.isEmpty()) {
Event1 last = q1.peekLast();
if (getNow() - last.time < 10) {
last.val += val;
last.size++;
} else {
Event1 e = new Event1(val, getNow());
q1.offer(e);
}
} else {
Event1 e = new Event1(val, getNow());
q1.offer(e);
}
sum += val;
size++;
}
public double getAvg1() {
removeExpired1();
return q1.isEmpty() ? 0.0 : (double)sum /size;
}
/**
* ------------
* Follow up 3
* getMedian(), quickSelect, O(n)
*
* Only for case that memory is enough (1st case)
*/
public double getMedian() {
removeExpired();
if (q.isEmpty()) return 0.0;
int[] nums = new int[q.size()];
int i = 0;
for (Event e : q) {
nums[i++] = e.val;
}
int n = nums.length;
if (n % 2 == 0) {
return (quickSelect(nums, n / 2, 0, n - 1) + quickSelect(nums, n / 2 - 1, 0, n - 1)) * 0.5;
}
return quickSelect(nums, n / 2, 0, n - 1);
}
public int quickSelect(int[] nums, int k, int start, int end) {
if (start >= end) {
return nums[start];
}
int l = start;
int r = end;
int pivot = nums[(start + end) / 2];
while (l <= r) {
while (l <= r && nums[l] < pivot) {
l++;
}
while (l <= r && nums[r] > pivot) {
r--;
}
if (l <= r) {
int temp = nums[l];
nums[l] = nums[r];
nums[r] = temp;
l++;
r--;
}
}
//!!!
if (r >= k && r >= start) {
return quickSelect(nums, k, start, r);
} else if (l <= k && l <= end) {
return quickSelect(nums, k, l, end);
} else {
return nums[k];
}
}
private void swap(int[] nums, int l, int r) {
int temp = nums[l];
nums[l] = nums[r];
nums[r] = temp;
}
}
| 4,391 | 0.436965 | 0.421787 | 185 | 21.081081 | 18.042261 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.508108 | false | false |
3
|
18f0494baeba19b73590973dd8b41ff15dcac695
| 15,015,205,689,720 |
e3d399c9ad7b8aa0931544a6800951f81b112f54
|
/PropertyManage/src/com/hd/servlet/CreateGoodInfoServlet.java
|
eda7b1be91548948f6f59bd1a8bf76b7854bec6e
|
[] |
no_license
|
lostwen/PropertyManage
|
https://github.com/lostwen/PropertyManage
|
8953ccdd3b139402b4dad40c117f92c201c7677b
|
407190d2602b9e7ac9cae7ee936c698769719f6b
|
refs/heads/master
| 2021-01-11T18:46:49.900000 | 2017-01-21T04:48:59 | 2017-01-21T04:48:59 | 79,624,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hd.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Date;
import java.sql.SQLException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.googlecode.jsonplugin.JSONException;
import com.googlecode.jsonplugin.JSONUtil;
import com.hd.controller.UpdateBase;
import com.hd.controller.ValidateUser;
/**
* Servlet implementation class CreateUserServlet
*/
@WebServlet("/createGoodInfo")
public class CreateGoodInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public CreateGoodInfoServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String goodIllegal = request.getParameter("goodIllegal");
Integer hostId = Integer.parseInt(request.getParameter("hostId"));
String goodHelp = request.getParameter("goodHelp");
String goodThing = request.getParameter("goodThing");
String goodComment = request.getParameter("goodComment");
String text = null;
String sql = "INSERT INTO `业主杂事`(业主,违规违章,求助,好事,备注) VALUES(" + hostId + ",'" + goodIllegal + "','" + goodHelp
+ "','" + goodThing + "','" + goodComment + "');";
int rs = 0;
try {
rs = new UpdateBase().updateBase(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (rs > 0) {
text = "新增报修记录成功!";
}
PrintWriter out = response.getWriter();
out.print(text);
out.flush();
out.close();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
|
UTF-8
|
Java
| 2,394 |
java
|
CreateGoodInfoServlet.java
|
Java
|
[] | null |
[] |
package com.hd.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Date;
import java.sql.SQLException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.googlecode.jsonplugin.JSONException;
import com.googlecode.jsonplugin.JSONUtil;
import com.hd.controller.UpdateBase;
import com.hd.controller.ValidateUser;
/**
* Servlet implementation class CreateUserServlet
*/
@WebServlet("/createGoodInfo")
public class CreateGoodInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public CreateGoodInfoServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String goodIllegal = request.getParameter("goodIllegal");
Integer hostId = Integer.parseInt(request.getParameter("hostId"));
String goodHelp = request.getParameter("goodHelp");
String goodThing = request.getParameter("goodThing");
String goodComment = request.getParameter("goodComment");
String text = null;
String sql = "INSERT INTO `业主杂事`(业主,违规违章,求助,好事,备注) VALUES(" + hostId + ",'" + goodIllegal + "','" + goodHelp
+ "','" + goodThing + "','" + goodComment + "');";
int rs = 0;
try {
rs = new UpdateBase().updateBase(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (rs > 0) {
text = "新增报修记录成功!";
}
PrintWriter out = response.getWriter();
out.print(text);
out.flush();
out.close();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| 2,394 | 0.736775 | 0.734642 | 80 | 28.3125 | 23.656179 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.7625 | false | false |
3
|
1713986faf8d674e9cde6d2730f8b74c165dc2ec
| 32,186,484,935,266 |
8987d8757ee5a6c18e27c20af19e60eaad4c8ef3
|
/app/src/main/java/com/example/toolbar/model/Ruta.java
|
e1019f9d6a8b54df353165497bd537f700c0b4eb
|
[] |
no_license
|
Kenneth2698/RutasTuristicas
|
https://github.com/Kenneth2698/RutasTuristicas
|
70d3eca1dbc5206bce3004f4555b7ad274c3545c
|
5b3b66e00b928393d477871d1772e30ab85179c0
|
refs/heads/master
| 2022-10-15T20:13:52.742000 | 2020-06-12T22:33:22 | 2020-06-12T22:33:22 | 263,735,814 | 0 | 0 | null | false | 2020-06-12T22:33:23 | 2020-05-13T20:26:56 | 2020-06-11T01:08:59 | 2020-06-12T22:33:23 | 2,260 | 0 | 0 | 0 |
Java
| false | false |
package com.example.toolbar.model;
public class Ruta {
private int id;
private String nombre;
private int precio;
private int tipoTurista;
private int tipoActividad;
private String latitud;
private String longitud;
public Ruta(int id, String nombre, int precio, int tipoTurista, int tipoActividad, String latitud, String longitud) {
this.id = id;
this.nombre = nombre;
this.precio = precio;
this.tipoTurista = tipoTurista;
this.tipoActividad = tipoActividad;
this.latitud = latitud;
this.longitud = longitud;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getPrecio() {
return precio;
}
public void setPrecio(int precio) {
this.precio = precio;
}
public int getTipoTurista() {
return tipoTurista;
}
public void setTipoTurista(int tipoTurista) {
this.tipoTurista = tipoTurista;
}
public int getTipoActividad() {
return tipoActividad;
}
public void setTipoActividad(int tipoActividad) {
this.tipoActividad = tipoActividad;
}
public String getLatitud() {
return latitud;
}
public void setLatitud(String latitud) {
this.latitud = latitud;
}
public String getLongitud() {
return longitud;
}
public void setLongitud(String longitud) {
this.longitud = longitud;
}
}
|
UTF-8
|
Java
| 1,644 |
java
|
Ruta.java
|
Java
|
[] | null |
[] |
package com.example.toolbar.model;
public class Ruta {
private int id;
private String nombre;
private int precio;
private int tipoTurista;
private int tipoActividad;
private String latitud;
private String longitud;
public Ruta(int id, String nombre, int precio, int tipoTurista, int tipoActividad, String latitud, String longitud) {
this.id = id;
this.nombre = nombre;
this.precio = precio;
this.tipoTurista = tipoTurista;
this.tipoActividad = tipoActividad;
this.latitud = latitud;
this.longitud = longitud;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getPrecio() {
return precio;
}
public void setPrecio(int precio) {
this.precio = precio;
}
public int getTipoTurista() {
return tipoTurista;
}
public void setTipoTurista(int tipoTurista) {
this.tipoTurista = tipoTurista;
}
public int getTipoActividad() {
return tipoActividad;
}
public void setTipoActividad(int tipoActividad) {
this.tipoActividad = tipoActividad;
}
public String getLatitud() {
return latitud;
}
public void setLatitud(String latitud) {
this.latitud = latitud;
}
public String getLongitud() {
return longitud;
}
public void setLongitud(String longitud) {
this.longitud = longitud;
}
}
| 1,644 | 0.611314 | 0.611314 | 78 | 20.076923 | 19.336937 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.448718 | false | false |
3
|
b6c639c654f8fecea3667550cb23d7af16fc3f10
| 32,186,484,938,206 |
efaa3f779e726b217221e1f0fe705fa574525f73
|
/src/com/javarush/test/level16/lesson13/bonus01/ImageReaderFactory.java
|
7cc4e2cb3870d214d54b6fd90f6b25599bf097f7
|
[] |
no_license
|
Sleu2/JavaRushHomeWork
|
https://github.com/Sleu2/JavaRushHomeWork
|
6f41ce8b11e376561080a2e2c1f9b2e4cb1168cc
|
9c539e523bc5781d15b8cf7d5fb59e47735c69b8
|
refs/heads/master
| 2019-07-31T01:09:40.559000 | 2017-02-07T06:45:36 | 2017-02-07T06:45:36 | 75,975,427 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.javarush.test.level16.lesson13.bonus01;
import com.javarush.test.level16.lesson13.bonus01.common.*;
/**
* Created by Home on 22.08.2016.
*/
public class ImageReaderFactory
{
private static ImageReader imageReader;
public static ImageReader getReader(ImageTypes imageType) throws IllegalArgumentException {
if (imageType == ImageTypes.BMP) imageReader = new BmpReader();
else
if (imageType == ImageTypes.JPG) imageReader= new JpgReader();
else
if (imageType == ImageTypes.PNG) imageReader = new PngReader();
else
throw new IllegalArgumentException("Неизвестный тип картинки");
return imageReader;
}
}
|
UTF-8
|
Java
| 719 |
java
|
ImageReaderFactory.java
|
Java
|
[
{
"context": "el16.lesson13.bonus01.common.*;\n\n/**\n * Created by Home on 22.08.2016.\n */\npublic class ImageReaderFactor",
"end": 136,
"score": 0.9799072742462158,
"start": 132,
"tag": "USERNAME",
"value": "Home"
}
] | null |
[] |
package com.javarush.test.level16.lesson13.bonus01;
import com.javarush.test.level16.lesson13.bonus01.common.*;
/**
* Created by Home on 22.08.2016.
*/
public class ImageReaderFactory
{
private static ImageReader imageReader;
public static ImageReader getReader(ImageTypes imageType) throws IllegalArgumentException {
if (imageType == ImageTypes.BMP) imageReader = new BmpReader();
else
if (imageType == ImageTypes.JPG) imageReader= new JpgReader();
else
if (imageType == ImageTypes.PNG) imageReader = new PngReader();
else
throw new IllegalArgumentException("Неизвестный тип картинки");
return imageReader;
}
}
| 719 | 0.695839 | 0.667145 | 21 | 32.190475 | 30.238132 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.380952 | false | false |
3
|
44fd235a01ab3198e7823f2a4ba0febf39e72208
| 28,759,101,045,021 |
47cc40e74d278a63912a38f127c58cf50015e353
|
/src/main/java/com/rddi/registerapp/dto/ApiWebServiceDetails.java
|
b17e1fdbe40d9103d45983aaec57deffbc1f3f25
|
[] |
no_license
|
anikolv/resthub
|
https://github.com/anikolv/resthub
|
80715585e241fe6703d89ac786b100cd5377e787
|
ff377193842de121d7eec1d5d491e716a2de4354
|
refs/heads/master
| 2020-08-04T15:27:50.722000 | 2020-06-20T13:08:14 | 2020-06-20T13:08:14 | 212,184,619 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rddi.registerapp.dto;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.rddi.registerapp.model.WebService;
import com.rddi.registerapp.model.WebServiceComment;
import com.rddi.registerapp.model.WebServiceStatus;
import com.rddi.registerapp.model.enums.WebServiceCategory;
import com.rddi.registerapp.model.enums.WebServiceType;
@JsonInclude(Include.NON_EMPTY)
public class ApiWebServiceDetails {
private Long id;
private String name;
private String shortDescription;
private String description;
private WebServiceCategory category;
private String version;
private String openApiContractUrl;
private String documentationUrl;
private WebServiceType type;
private Date createdAt;
private ApiServiceProvider serviceProvider;
private ApiWebServiceEvaluation evaluationDetails;
private List<ApiWebServiceComment> comments = new ArrayList<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public WebServiceCategory getCategory() {
return category;
}
public void setCategory(WebServiceCategory category) {
this.category = category;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getOpenApiContractUrl() {
return openApiContractUrl;
}
public void setOpenApiContractUrl(String openApiContractUrl) {
this.openApiContractUrl = openApiContractUrl;
}
public String getDocumentationUrl() {
return documentationUrl;
}
public void setDocumentationUrl(String documentationUrl) {
this.documentationUrl = documentationUrl;
}
public WebServiceType getType() {
return type;
}
public void setType(WebServiceType type) {
this.type = type;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public ApiServiceProvider getServiceProvider() {
return serviceProvider;
}
public void setServiceProvider(ApiServiceProvider serviceProvider) {
this.serviceProvider = serviceProvider;
}
public ApiWebServiceEvaluation getEvaluationDetails() {
return evaluationDetails;
}
public void setEvaluationDetails(ApiWebServiceEvaluation evaluationDetails) {
this.evaluationDetails = evaluationDetails;
}
public List<ApiWebServiceComment> getComments() {
return comments;
}
public void setComments(List<ApiWebServiceComment> comments) {
this.comments = comments;
}
public void addComment(ApiWebServiceComment comment) {
this.comments.add(comment);
}
public static ApiWebServiceDetails from(WebService from) {
ApiWebServiceDetails to = new ApiWebServiceDetails();
BeanUtils.copyProperties(from, to, "serviceProvider", "comments");
to.setServiceProvider(ApiServiceProvider.from(from.getServiceProvider()));
from.getComments()
.stream()
.sorted(Comparator.comparingLong(WebServiceComment::getId).reversed())
.forEach(comment -> to.addComment(ApiWebServiceComment.from(comment)));
return to;
}
public void addEvaluationDetails(WebServiceStatus webServiceStatus, Integer lastMonthAvailabilityInPercentage,
Integer reliabilityPercentage, Double averageRating) {
ApiWebServiceEvaluation to = new ApiWebServiceEvaluation();
to.setAverageRating(averageRating.intValue());
to.setLastMonthAvailabilityInPercentage(lastMonthAvailabilityInPercentage);
to.setReliabilityPercentage(reliabilityPercentage);
to.setWebServiceStatus(webServiceStatus.getAvailable() ? "ONLINE" : "OFFLINE");
this.setEvaluationDetails(to);
}
}
|
UTF-8
|
Java
| 4,362 |
java
|
ApiWebServiceDetails.java
|
Java
|
[] | null |
[] |
package com.rddi.registerapp.dto;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.rddi.registerapp.model.WebService;
import com.rddi.registerapp.model.WebServiceComment;
import com.rddi.registerapp.model.WebServiceStatus;
import com.rddi.registerapp.model.enums.WebServiceCategory;
import com.rddi.registerapp.model.enums.WebServiceType;
@JsonInclude(Include.NON_EMPTY)
public class ApiWebServiceDetails {
private Long id;
private String name;
private String shortDescription;
private String description;
private WebServiceCategory category;
private String version;
private String openApiContractUrl;
private String documentationUrl;
private WebServiceType type;
private Date createdAt;
private ApiServiceProvider serviceProvider;
private ApiWebServiceEvaluation evaluationDetails;
private List<ApiWebServiceComment> comments = new ArrayList<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public WebServiceCategory getCategory() {
return category;
}
public void setCategory(WebServiceCategory category) {
this.category = category;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getOpenApiContractUrl() {
return openApiContractUrl;
}
public void setOpenApiContractUrl(String openApiContractUrl) {
this.openApiContractUrl = openApiContractUrl;
}
public String getDocumentationUrl() {
return documentationUrl;
}
public void setDocumentationUrl(String documentationUrl) {
this.documentationUrl = documentationUrl;
}
public WebServiceType getType() {
return type;
}
public void setType(WebServiceType type) {
this.type = type;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public ApiServiceProvider getServiceProvider() {
return serviceProvider;
}
public void setServiceProvider(ApiServiceProvider serviceProvider) {
this.serviceProvider = serviceProvider;
}
public ApiWebServiceEvaluation getEvaluationDetails() {
return evaluationDetails;
}
public void setEvaluationDetails(ApiWebServiceEvaluation evaluationDetails) {
this.evaluationDetails = evaluationDetails;
}
public List<ApiWebServiceComment> getComments() {
return comments;
}
public void setComments(List<ApiWebServiceComment> comments) {
this.comments = comments;
}
public void addComment(ApiWebServiceComment comment) {
this.comments.add(comment);
}
public static ApiWebServiceDetails from(WebService from) {
ApiWebServiceDetails to = new ApiWebServiceDetails();
BeanUtils.copyProperties(from, to, "serviceProvider", "comments");
to.setServiceProvider(ApiServiceProvider.from(from.getServiceProvider()));
from.getComments()
.stream()
.sorted(Comparator.comparingLong(WebServiceComment::getId).reversed())
.forEach(comment -> to.addComment(ApiWebServiceComment.from(comment)));
return to;
}
public void addEvaluationDetails(WebServiceStatus webServiceStatus, Integer lastMonthAvailabilityInPercentage,
Integer reliabilityPercentage, Double averageRating) {
ApiWebServiceEvaluation to = new ApiWebServiceEvaluation();
to.setAverageRating(averageRating.intValue());
to.setLastMonthAvailabilityInPercentage(lastMonthAvailabilityInPercentage);
to.setReliabilityPercentage(reliabilityPercentage);
to.setWebServiceStatus(webServiceStatus.getAvailable() ? "ONLINE" : "OFFLINE");
this.setEvaluationDetails(to);
}
}
| 4,362 | 0.7547 | 0.7547 | 168 | 23.964285 | 23.984095 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.410714 | false | false |
3
|
cecdb457e0e38c74da84a1e7f73ef2c0373bd84e
| 16,045,997,835,427 |
a1c7d6ad2ce68c3b27597ee794e610b668c9d6a2
|
/src/ex04.java
|
353564de7f480884e407df3a7de96fe35f4f6d07
|
[] |
no_license
|
hectorblanco95/Arrays
|
https://github.com/hectorblanco95/Arrays
|
963b36367e79cf6b611d89e48b2c99f38d43fc12
|
5701c624d461237394e65d3f5049eadf9bc3adc2
|
refs/heads/master
| 2017-04-19T17:07:58.816000 | 2017-02-06T16:27:53 | 2017-02-06T16:27:53 | 80,882,276 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.*;
public class ex04 {
//Escriure un programa en Java que llegeixi una paraula per teclat, i el programa digui si �s un pal�ndrom o no. Cal utilitzar l�estructura array.
public static void main(String[] args) {
try{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Introduce un palabra");
String palabra=buffer.readLine();
char[] letra= palabra.toCharArray();
int j=letra.length-1;
boolean l=false;
for(int i=0;i<letra.length && l==false;i++, j--){
if(letra[i]!=letra[j]){
l=true;
}
}
if(l==false){
System.out.println("És palindromo");
}else System.out.println("No és palindromo");
}
catch (Exception e){
System.out.println("Error " + e);
}
}
}
|
UTF-8
|
Java
| 818 |
java
|
ex04.java
|
Java
|
[] | null |
[] |
import java.io.*;
public class ex04 {
//Escriure un programa en Java que llegeixi una paraula per teclat, i el programa digui si �s un pal�ndrom o no. Cal utilitzar l�estructura array.
public static void main(String[] args) {
try{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Introduce un palabra");
String palabra=buffer.readLine();
char[] letra= palabra.toCharArray();
int j=letra.length-1;
boolean l=false;
for(int i=0;i<letra.length && l==false;i++, j--){
if(letra[i]!=letra[j]){
l=true;
}
}
if(l==false){
System.out.println("És palindromo");
}else System.out.println("No és palindromo");
}
catch (Exception e){
System.out.println("Error " + e);
}
}
}
| 818 | 0.62963 | 0.624691 | 32 | 23.375 | 29.76549 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.46875 | false | false |
3
|
a1a6f748b7f3a1fe983f85e91b45d6d61ed7f60e
| 12,781,822,701,416 |
496c83c9804b4696a9baf72566763d88b7979ffd
|
/griffin/tags/0.7.2/src/main/java/au/org/arcs/griffin/cmd/impl/FtpCmdPass.java
|
00c6c8ddfe5a2ddedd2a134cdba306fc72c1e143
|
[] |
no_license
|
shundezhang/datafabric-griffin
|
https://github.com/shundezhang/datafabric-griffin
|
ac12f25e7b283bb10cbb29bf43fd22c7b20727ca
|
caa43de6d307a9cacf39972e6d74e30284727140
|
refs/heads/master
| 2021-01-22T10:02:34.357000 | 2013-06-20T07:31:07 | 2013-06-20T07:31:07 | 32,371,459 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* ------------------------------------------------------------------------------
* Hermes FTP Server
* Copyright (c) 2005-2007 Lars Behnke
* ------------------------------------------------------------------------------
*
* This file is part of Hermes FTP Server.
*
* Hermes FTP Server 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 2 of the License, or
* (at your option) any later version.
*
* Hermes FTP Server 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 Hermes FTP Server; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ------------------------------------------------------------------------------
*/
package au.org.arcs.griffin.cmd.impl;
import au.org.arcs.griffin.cmd.AbstractFtpCmd;
import au.org.arcs.griffin.exception.FtpCmdException;
/**
* <b>PASSWORD (PASS)</b>
* <p>
* The argument field is a Telnet string specifying the user's password. This command must be
* immediately preceded by the user name command, and, for some sites, completes the user's
* identification for access control. Since password information is quite sensitive, it is desirable
* in general to "mask" it or suppress typeout. It appears that the server has no foolproof way to
* achieve this. It is therefore the responsibility of the user-FTP process to hide the sensitive
* password information.
* <p>
* <i>[Excerpt from RFC-959, Postel and Reynolds]</i>
* </p>
*
* @author Lars Behnke
*/
public class FtpCmdPass extends AbstractFtpCmd {
/**
* {@inheritDoc}
*/
public void execute() throws FtpCmdException {
String response;
if (getCtx().getUser() == null || getCtx().getUser().length() == 0) {
response = msg(MSG503_USR);
} else {
getCtx().setPassword(getArguments());
try {
getCtx().authenticate();
response = msg(MSG230);
}catch (Exception e){
response = msg(MSG530);
}
}
out(response);
String clientHost = getCtx().getClientSocket().getInetAddress().getHostAddress();
getCtx().getEventListener().loginPerformed(clientHost, getCtx().isAuthenticated());
}
/**
* {@inheritDoc}
*/
public String getHelp() {
return "Sets the user's password";
}
/**
* {@inheritDoc}
*/
public boolean isAuthenticationRequired() {
return false;
}
public boolean isExtension() {
// TODO Auto-generated method stub
return false;
}
}
|
UTF-8
|
Java
| 3,047 |
java
|
FtpCmdPass.java
|
Java
|
[
{
"context": "\r\n * Hermes FTP Server\r\n * Copyright (c) 2005-2007 Lars Behnke\r\n * ---------------------------------------------",
"end": 147,
"score": 0.9997682571411133,
"start": 136,
"tag": "NAME",
"value": "Lars Behnke"
},
{
"context": "Postel and Reynolds]</i>\r\n * </p>\r\n * \r\n * @author Lars Behnke\r\n */\r\npublic class FtpCmdPass extends AbstractFtp",
"end": 1924,
"score": 0.999835193157196,
"start": 1913,
"tag": "NAME",
"value": "Lars Behnke"
}
] | null |
[] |
/*
* ------------------------------------------------------------------------------
* Hermes FTP Server
* Copyright (c) 2005-2007 <NAME>
* ------------------------------------------------------------------------------
*
* This file is part of Hermes FTP Server.
*
* Hermes FTP Server 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 2 of the License, or
* (at your option) any later version.
*
* Hermes FTP Server 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 Hermes FTP Server; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ------------------------------------------------------------------------------
*/
package au.org.arcs.griffin.cmd.impl;
import au.org.arcs.griffin.cmd.AbstractFtpCmd;
import au.org.arcs.griffin.exception.FtpCmdException;
/**
* <b>PASSWORD (PASS)</b>
* <p>
* The argument field is a Telnet string specifying the user's password. This command must be
* immediately preceded by the user name command, and, for some sites, completes the user's
* identification for access control. Since password information is quite sensitive, it is desirable
* in general to "mask" it or suppress typeout. It appears that the server has no foolproof way to
* achieve this. It is therefore the responsibility of the user-FTP process to hide the sensitive
* password information.
* <p>
* <i>[Excerpt from RFC-959, Postel and Reynolds]</i>
* </p>
*
* @author <NAME>
*/
public class FtpCmdPass extends AbstractFtpCmd {
/**
* {@inheritDoc}
*/
public void execute() throws FtpCmdException {
String response;
if (getCtx().getUser() == null || getCtx().getUser().length() == 0) {
response = msg(MSG503_USR);
} else {
getCtx().setPassword(getArguments());
try {
getCtx().authenticate();
response = msg(MSG230);
}catch (Exception e){
response = msg(MSG530);
}
}
out(response);
String clientHost = getCtx().getClientSocket().getInetAddress().getHostAddress();
getCtx().getEventListener().loginPerformed(clientHost, getCtx().isAuthenticated());
}
/**
* {@inheritDoc}
*/
public String getHelp() {
return "Sets the user's password";
}
/**
* {@inheritDoc}
*/
public boolean isAuthenticationRequired() {
return false;
}
public boolean isExtension() {
// TODO Auto-generated method stub
return false;
}
}
| 3,037 | 0.58976 | 0.57893 | 87 | 33.022987 | 30.469875 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.494253 | false | false |
3
|
aea481d49be340307b3ecdedd9d5d5607818331e
| 32,564,442,093,625 |
b4893f22c8c9a0e4ec38955b6f87aca7b032d218
|
/week-07/day-4/fox/src/main/java/com/greenfox/foxclub/services/TrickService.java
|
66feb5c5cee86fb6c7e75fc4cb2d447c0a908387
|
[] |
no_license
|
green-fox-academy/zombityu
|
https://github.com/green-fox-academy/zombityu
|
85105633f5b34d9ab4906334f3c6cff3d7602c13
|
77237c738be80117af86800513643b2d7984f586
|
refs/heads/master
| 2020-06-11T09:33:54.578000 | 2019-09-19T17:49:33 | 2019-09-19T17:49:33 | 193,917,315 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.greenfox.foxclub.services;
import com.greenfox.foxclub.models.Trick;
import java.util.List;
public interface TrickService {
List<Trick> allTricks();
List<Trick> availableTricks(List<Trick> alreadyKnownTricks,List<Trick> all);
}
|
UTF-8
|
Java
| 248 |
java
|
TrickService.java
|
Java
|
[] | null |
[] |
package com.greenfox.foxclub.services;
import com.greenfox.foxclub.models.Trick;
import java.util.List;
public interface TrickService {
List<Trick> allTricks();
List<Trick> availableTricks(List<Trick> alreadyKnownTricks,List<Trick> all);
}
| 248 | 0.782258 | 0.782258 | 11 | 21.545454 | 23.788322 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false |
3
|
f4619327004fc495a56d9bd4b658782adfad53df
| 21,242,908,288,663 |
8638fd326bf37198d86ae2b94b1d3529e7b1fadd
|
/de.uni_stuttgart.iste.cowolf.model.lqn/src/de/uni_stuttgart/iste/cowolf/model/LqnCore/impl/ParaTypeImpl.java
|
5c0780e30b350032786a19ef620cf7e1808efd21
|
[] |
no_license
|
timsanwald/CoWolf
|
https://github.com/timsanwald/CoWolf
|
774c22d8e1f097a87093498f09524eeece1be4ad
|
706b12b6170cb7369d82c6840b93e3854122e6b8
|
refs/heads/master
| 2021-01-21T16:11:11.770000 | 2014-12-02T21:31:17 | 2014-12-02T21:31:17 | 25,541,447 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*/
package de.uni_stuttgart.iste.cowolf.model.LqnCore.impl;
import de.uni_stuttgart.iste.cowolf.model.LqnCore.LQNPackage;
import de.uni_stuttgart.iste.cowolf.model.LqnCore.ParaType;
import de.uni_stuttgart.iste.cowolf.model.commonBase.impl.IDBaseImpl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Para Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getStartValue <em>Start Value</em>}</li>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getEndValue <em>End Value</em>}</li>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getStepValue <em>Step Value</em>}</li>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ParaTypeImpl extends IDBaseImpl implements ParaType {
/**
* The default value of the '{@link #getStartValue() <em>Start Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartValue()
* @generated
* @ordered
*/
protected static final int START_VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getStartValue() <em>Start Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartValue()
* @generated
* @ordered
*/
protected int startValue = START_VALUE_EDEFAULT;
/**
* This is true if the Start Value attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean startValueESet;
/**
* The default value of the '{@link #getEndValue() <em>End Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndValue()
* @generated
* @ordered
*/
protected static final int END_VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getEndValue() <em>End Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndValue()
* @generated
* @ordered
*/
protected int endValue = END_VALUE_EDEFAULT;
/**
* This is true if the End Value attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean endValueESet;
/**
* The default value of the '{@link #getStepValue() <em>Step Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStepValue()
* @generated
* @ordered
*/
protected static final int STEP_VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getStepValue() <em>Step Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStepValue()
* @generated
* @ordered
*/
protected int stepValue = STEP_VALUE_EDEFAULT;
/**
* This is true if the Step Value attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean stepValueESet;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected EList<Integer> value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ParaTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return LQNPackage.Literals.PARA_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getStartValue() {
return startValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStartValue(int newStartValue) {
int oldStartValue = startValue;
startValue = newStartValue;
boolean oldStartValueESet = startValueESet;
startValueESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LQNPackage.PARA_TYPE__START_VALUE, oldStartValue, startValue, !oldStartValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetStartValue() {
int oldStartValue = startValue;
boolean oldStartValueESet = startValueESet;
startValue = START_VALUE_EDEFAULT;
startValueESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, LQNPackage.PARA_TYPE__START_VALUE, oldStartValue, START_VALUE_EDEFAULT, oldStartValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetStartValue() {
return startValueESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getEndValue() {
return endValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEndValue(int newEndValue) {
int oldEndValue = endValue;
endValue = newEndValue;
boolean oldEndValueESet = endValueESet;
endValueESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LQNPackage.PARA_TYPE__END_VALUE, oldEndValue, endValue, !oldEndValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetEndValue() {
int oldEndValue = endValue;
boolean oldEndValueESet = endValueESet;
endValue = END_VALUE_EDEFAULT;
endValueESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, LQNPackage.PARA_TYPE__END_VALUE, oldEndValue, END_VALUE_EDEFAULT, oldEndValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetEndValue() {
return endValueESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getStepValue() {
return stepValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStepValue(int newStepValue) {
int oldStepValue = stepValue;
stepValue = newStepValue;
boolean oldStepValueESet = stepValueESet;
stepValueESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LQNPackage.PARA_TYPE__STEP_VALUE, oldStepValue, stepValue, !oldStepValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetStepValue() {
int oldStepValue = stepValue;
boolean oldStepValueESet = stepValueESet;
stepValue = STEP_VALUE_EDEFAULT;
stepValueESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, LQNPackage.PARA_TYPE__STEP_VALUE, oldStepValue, STEP_VALUE_EDEFAULT, oldStepValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetStepValue() {
return stepValueESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Integer> getValue() {
if (value == null) {
value = new EDataTypeEList<Integer>(Integer.class, this, LQNPackage.PARA_TYPE__VALUE);
}
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
return getStartValue();
case LQNPackage.PARA_TYPE__END_VALUE:
return getEndValue();
case LQNPackage.PARA_TYPE__STEP_VALUE:
return getStepValue();
case LQNPackage.PARA_TYPE__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
setStartValue((Integer)newValue);
return;
case LQNPackage.PARA_TYPE__END_VALUE:
setEndValue((Integer)newValue);
return;
case LQNPackage.PARA_TYPE__STEP_VALUE:
setStepValue((Integer)newValue);
return;
case LQNPackage.PARA_TYPE__VALUE:
getValue().clear();
getValue().addAll((Collection<? extends Integer>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
unsetStartValue();
return;
case LQNPackage.PARA_TYPE__END_VALUE:
unsetEndValue();
return;
case LQNPackage.PARA_TYPE__STEP_VALUE:
unsetStepValue();
return;
case LQNPackage.PARA_TYPE__VALUE:
getValue().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
return isSetStartValue();
case LQNPackage.PARA_TYPE__END_VALUE:
return isSetEndValue();
case LQNPackage.PARA_TYPE__STEP_VALUE:
return isSetStepValue();
case LQNPackage.PARA_TYPE__VALUE:
return value != null && !value.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (startValue: ");
if (startValueESet) result.append(startValue); else result.append("<unset>");
result.append(", endValue: ");
if (endValueESet) result.append(endValue); else result.append("<unset>");
result.append(", stepValue: ");
if (stepValueESet) result.append(stepValue); else result.append("<unset>");
result.append(", value: ");
result.append(value);
result.append(')');
return result.toString();
}
} //ParaTypeImpl
|
UTF-8
|
Java
| 10,333 |
java
|
ParaTypeImpl.java
|
Java
|
[] | null |
[] |
/**
*/
package de.uni_stuttgart.iste.cowolf.model.LqnCore.impl;
import de.uni_stuttgart.iste.cowolf.model.LqnCore.LQNPackage;
import de.uni_stuttgart.iste.cowolf.model.LqnCore.ParaType;
import de.uni_stuttgart.iste.cowolf.model.commonBase.impl.IDBaseImpl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Para Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getStartValue <em>Start Value</em>}</li>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getEndValue <em>End Value</em>}</li>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getStepValue <em>Step Value</em>}</li>
* <li>{@link de.uni_stuttgart.iste.cowolf.model.LqnCore.impl.ParaTypeImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ParaTypeImpl extends IDBaseImpl implements ParaType {
/**
* The default value of the '{@link #getStartValue() <em>Start Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartValue()
* @generated
* @ordered
*/
protected static final int START_VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getStartValue() <em>Start Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartValue()
* @generated
* @ordered
*/
protected int startValue = START_VALUE_EDEFAULT;
/**
* This is true if the Start Value attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean startValueESet;
/**
* The default value of the '{@link #getEndValue() <em>End Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndValue()
* @generated
* @ordered
*/
protected static final int END_VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getEndValue() <em>End Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndValue()
* @generated
* @ordered
*/
protected int endValue = END_VALUE_EDEFAULT;
/**
* This is true if the End Value attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean endValueESet;
/**
* The default value of the '{@link #getStepValue() <em>Step Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStepValue()
* @generated
* @ordered
*/
protected static final int STEP_VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getStepValue() <em>Step Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStepValue()
* @generated
* @ordered
*/
protected int stepValue = STEP_VALUE_EDEFAULT;
/**
* This is true if the Step Value attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean stepValueESet;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected EList<Integer> value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ParaTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return LQNPackage.Literals.PARA_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getStartValue() {
return startValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStartValue(int newStartValue) {
int oldStartValue = startValue;
startValue = newStartValue;
boolean oldStartValueESet = startValueESet;
startValueESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LQNPackage.PARA_TYPE__START_VALUE, oldStartValue, startValue, !oldStartValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetStartValue() {
int oldStartValue = startValue;
boolean oldStartValueESet = startValueESet;
startValue = START_VALUE_EDEFAULT;
startValueESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, LQNPackage.PARA_TYPE__START_VALUE, oldStartValue, START_VALUE_EDEFAULT, oldStartValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetStartValue() {
return startValueESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getEndValue() {
return endValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEndValue(int newEndValue) {
int oldEndValue = endValue;
endValue = newEndValue;
boolean oldEndValueESet = endValueESet;
endValueESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LQNPackage.PARA_TYPE__END_VALUE, oldEndValue, endValue, !oldEndValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetEndValue() {
int oldEndValue = endValue;
boolean oldEndValueESet = endValueESet;
endValue = END_VALUE_EDEFAULT;
endValueESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, LQNPackage.PARA_TYPE__END_VALUE, oldEndValue, END_VALUE_EDEFAULT, oldEndValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetEndValue() {
return endValueESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getStepValue() {
return stepValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStepValue(int newStepValue) {
int oldStepValue = stepValue;
stepValue = newStepValue;
boolean oldStepValueESet = stepValueESet;
stepValueESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LQNPackage.PARA_TYPE__STEP_VALUE, oldStepValue, stepValue, !oldStepValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetStepValue() {
int oldStepValue = stepValue;
boolean oldStepValueESet = stepValueESet;
stepValue = STEP_VALUE_EDEFAULT;
stepValueESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, LQNPackage.PARA_TYPE__STEP_VALUE, oldStepValue, STEP_VALUE_EDEFAULT, oldStepValueESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetStepValue() {
return stepValueESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Integer> getValue() {
if (value == null) {
value = new EDataTypeEList<Integer>(Integer.class, this, LQNPackage.PARA_TYPE__VALUE);
}
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
return getStartValue();
case LQNPackage.PARA_TYPE__END_VALUE:
return getEndValue();
case LQNPackage.PARA_TYPE__STEP_VALUE:
return getStepValue();
case LQNPackage.PARA_TYPE__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
setStartValue((Integer)newValue);
return;
case LQNPackage.PARA_TYPE__END_VALUE:
setEndValue((Integer)newValue);
return;
case LQNPackage.PARA_TYPE__STEP_VALUE:
setStepValue((Integer)newValue);
return;
case LQNPackage.PARA_TYPE__VALUE:
getValue().clear();
getValue().addAll((Collection<? extends Integer>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
unsetStartValue();
return;
case LQNPackage.PARA_TYPE__END_VALUE:
unsetEndValue();
return;
case LQNPackage.PARA_TYPE__STEP_VALUE:
unsetStepValue();
return;
case LQNPackage.PARA_TYPE__VALUE:
getValue().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LQNPackage.PARA_TYPE__START_VALUE:
return isSetStartValue();
case LQNPackage.PARA_TYPE__END_VALUE:
return isSetEndValue();
case LQNPackage.PARA_TYPE__STEP_VALUE:
return isSetStepValue();
case LQNPackage.PARA_TYPE__VALUE:
return value != null && !value.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (startValue: ");
if (startValueESet) result.append(startValue); else result.append("<unset>");
result.append(", endValue: ");
if (endValueESet) result.append(endValue); else result.append("<unset>");
result.append(", stepValue: ");
if (stepValueESet) result.append(stepValue); else result.append("<unset>");
result.append(", value: ");
result.append(value);
result.append(')');
return result.toString();
}
} //ParaTypeImpl
| 10,333 | 0.644537 | 0.644247 | 417 | 23.779377 | 24.99754 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.625899 | false | false |
3
|
45ae8108d8de242434afd0823be08dfd968f3aca
| 33,758,442,955,260 |
a9bf0bd108ef1f73aa77458ae60600843f1f7f86
|
/FiniteStateMachine/app/src/main/java/com/destro13/finitestatemachine/apiservice/FSMService.java
|
6061b9668262083791d7a39ce2daf76dd1e984e2
|
[] |
no_license
|
Destro13/Android_finite-state-machine
|
https://github.com/Destro13/Android_finite-state-machine
|
b2bb6686385aaf88f489f7aa0c10b3eab7c3c994
|
60db2a95e9ac9d0cf4cd0eb4fc46989fb03b8d87
|
refs/heads/master
| 2018-04-19T04:15:03.295000 | 2017-06-13T02:24:35 | 2017-06-13T02:24:35 | 90,643,646 | 0 | 0 | null | false | 2017-06-13T02:24:35 | 2017-05-08T15:26:59 | 2017-06-10T17:25:35 | 2017-06-13T02:24:35 | 194 | 0 | 0 | 0 |
Java
| null | null |
package com.destro13.finitestatemachine.apiservice;
import com.destro13.finitestatemachine.model.FSM;
import java.util.List;
import retrofit2.http.GET;
import rx.Observable;
/**
* Created by pavlyknazariy on 25.05.17.
*/
public interface FSMService {
@GET("/fsm")
Observable<List<FSM>> getData();
}
|
UTF-8
|
Java
| 315 |
java
|
FSMService.java
|
Java
|
[
{
"context": "http.GET;\nimport rx.Observable;\n\n/**\n * Created by pavlyknazariy on 25.05.17.\n */\n\npublic interface FSMService {\n ",
"end": 210,
"score": 0.999417245388031,
"start": 197,
"tag": "USERNAME",
"value": "pavlyknazariy"
}
] | null |
[] |
package com.destro13.finitestatemachine.apiservice;
import com.destro13.finitestatemachine.model.FSM;
import java.util.List;
import retrofit2.http.GET;
import rx.Observable;
/**
* Created by pavlyknazariy on 25.05.17.
*/
public interface FSMService {
@GET("/fsm")
Observable<List<FSM>> getData();
}
| 315 | 0.736508 | 0.701587 | 18 | 16.5 | 17.817751 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
3
|
1cae22a36a80be432a585f403b4df5ce789b509b
| 2,044,404,502,950 |
f419a3fb2c06a65e3ef5e85028951859fdbe0fa8
|
/app/src/main/java/jp/ac/asojuku/jousisenb/hidakakun/MainActivity.java
|
191a152f0e0ad8428c9d06f137c646f4fea6d9b1
|
[] |
no_license
|
aso1501152/hidakakun
|
https://github.com/aso1501152/hidakakun
|
f565223a5e515c7cdaef7eb54ceea003a043a87d
|
cddd011cdd7b3e47ce4e7a9f6328c7fab6c729f3
|
refs/heads/master
| 2021-01-21T11:54:42.669000 | 2017-06-23T03:39:27 | 2017-06-23T03:39:27 | 91,761,789 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package jp.ac.asojuku.jousisenb.hidakakun;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
//更新テスト
//更新だよ
//juggguyguyfy
//awsfasewfaef
}
|
UTF-8
|
Java
| 426 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package jp.ac.asojuku.jousisenb.hidakakun;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
//更新テスト
//更新だよ
//juggguyguyfy
//awsfasewfaef
}
| 426 | 0.72549 | 0.723039 | 18 | 21.666666 | 20.152199 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false |
3
|
a7496d142530d4a3d92f1cca3cd6bbcb60c50ba6
| 32,530,082,359,501 |
a11dd06232bc98b995c09aceedfe7f1961120aa3
|
/src/snakeladder/Constant.java
|
a98909d27d55dfa8010b4804dadec0e351542f46
|
[] |
no_license
|
almaluisa/snakeladder
|
https://github.com/almaluisa/snakeladder
|
210279f5938b935dde5c692c57994a7dddc5e44d
|
b8284fb81bac26428ac64d6a23eb2325a8f78ecb
|
refs/heads/master
| 2018-01-08T14:14:59.872000 | 2015-12-03T22:38:01 | 2015-12-03T22:38:01 | 46,538,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 snakeladder;
/**
*
* @author almaluisa
*/
public class Constant {
static String ANSWERL_OK = "Tu respuesta fue CORRECTA, ganas 10 puntos, SUBES LA ESCALERA!!";
static String ANSWERL_BAD = "ERROR!! Respuesta incorrecta, 10 puntos perdidos, NO PUEDES SUBIR LA ESCALERA!!";
static String ANSWERS_OK = "Tu respuesta fue CORRECTA, ganas 10 puntos, MANTIENES LA POSICION!!";
static String ANSWERS_BAD = "ERROR!! Respuesta incorrecta, 10 puntos perdidos, BAJAS POR LA SERPIENTE!!";
public static String getANSWERL_OK() {
return ANSWERL_OK;
}
public static String getANSWERL_BAD() {
return ANSWERL_BAD;
}
public static String getANSWERS_OK() {
return ANSWERS_OK;
}
public static String getANSWERS_BAD() {
return ANSWERS_BAD;
}
}
|
UTF-8
|
Java
| 1,032 |
java
|
Constant.java
|
Java
|
[
{
"context": "ditor.\n */\npackage snakeladder;\n\n/**\n *\n * @author almaluisa\n */\npublic class Constant {\n static String ANS",
"end": 234,
"score": 0.9992353916168213,
"start": 225,
"tag": "USERNAME",
"value": "almaluisa"
}
] | 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 snakeladder;
/**
*
* @author almaluisa
*/
public class Constant {
static String ANSWERL_OK = "Tu respuesta fue CORRECTA, ganas 10 puntos, SUBES LA ESCALERA!!";
static String ANSWERL_BAD = "ERROR!! Respuesta incorrecta, 10 puntos perdidos, NO PUEDES SUBIR LA ESCALERA!!";
static String ANSWERS_OK = "Tu respuesta fue CORRECTA, ganas 10 puntos, MANTIENES LA POSICION!!";
static String ANSWERS_BAD = "ERROR!! Respuesta incorrecta, 10 puntos perdidos, BAJAS POR LA SERPIENTE!!";
public static String getANSWERL_OK() {
return ANSWERL_OK;
}
public static String getANSWERL_BAD() {
return ANSWERL_BAD;
}
public static String getANSWERS_OK() {
return ANSWERS_OK;
}
public static String getANSWERS_BAD() {
return ANSWERS_BAD;
}
}
| 1,032 | 0.66376 | 0.656008 | 39 | 25.461538 | 32.742855 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512821 | false | false |
3
|
8ef981003a653dd36b003f8c8db6e4f64a3af67b
| 13,426,067,800,500 |
5832134be6eea906cfc2f364dcdd1837634a67ba
|
/trunk/spikes/mikes-workspace/mikespike3/src/mikespike3/gui/FieldBuilderFactory.java
|
63206c98ba7952e598351e027a815b5cd9781041
|
[] |
no_license
|
BackupTheBerlios/rcpviewer-svn
|
https://github.com/BackupTheBerlios/rcpviewer-svn
|
61c0ea77a3c2e3639656338623f61cb02135112c
|
eb63faba1c5e9c812a99df389acf2ec31ec60745
|
refs/heads/master
| 2020-06-04T07:12:21.899000 | 2006-02-28T22:34:19 | 2006-02-28T22:34:19 | 40,805,658 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mikespike3.gui;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import mikespike3.util.ConfigElementSorter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
public class FieldBuilderFactory {
private final IFieldBuilder[] builders;
private final Map mappings;
/**
* Constructor instantiates all implementations of
* "mikespike3.fieldbuilder" extension point.
* @throws CoreException
*/
public FieldBuilderFactory() throws CoreException {
IConfigurationElement[] elems
= Platform.getExtensionRegistry()
.getConfigurationElementsFor( "mikespike3.fieldbuilder" );
Arrays.sort( elems, new ConfigElementSorter() );
int num = elems.length;
builders = new IFieldBuilder[ num ];
for ( int i=0 ; i < num ; i++ ) {
Object obj = elems[i].createExecutableExtension( "class" );
assert obj instanceof IFieldBuilder;
builders[i] = (IFieldBuilder)obj;
}
mappings = new HashMap();
}
/**
* Selects and generates IFieldBuilder appropriate for passed method on the
* passed instance
* @param instance
* @return
*/
public IFieldBuilder getInstance( Class clazz, Object value ) {
// ignoring value for now for simplicity
IFieldBuilder builder = (IFieldBuilder)mappings.get( clazz );
if ( builder == null ) {
for ( int i=0, num = builders.length ; i < num ; i++ ) {
if ( builders[i].isApplicable( clazz, value ) ) {
builder = builders[i];
break;
}
}
if ( builder == null ) {
builder = new DefaultFieldBuilder();
}
mappings.put( clazz, builder );
}
return builder;
}
}
|
UTF-8
|
Java
| 1,780 |
java
|
FieldBuilderFactory.java
|
Java
|
[] | null |
[] |
package mikespike3.gui;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import mikespike3.util.ConfigElementSorter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
public class FieldBuilderFactory {
private final IFieldBuilder[] builders;
private final Map mappings;
/**
* Constructor instantiates all implementations of
* "mikespike3.fieldbuilder" extension point.
* @throws CoreException
*/
public FieldBuilderFactory() throws CoreException {
IConfigurationElement[] elems
= Platform.getExtensionRegistry()
.getConfigurationElementsFor( "mikespike3.fieldbuilder" );
Arrays.sort( elems, new ConfigElementSorter() );
int num = elems.length;
builders = new IFieldBuilder[ num ];
for ( int i=0 ; i < num ; i++ ) {
Object obj = elems[i].createExecutableExtension( "class" );
assert obj instanceof IFieldBuilder;
builders[i] = (IFieldBuilder)obj;
}
mappings = new HashMap();
}
/**
* Selects and generates IFieldBuilder appropriate for passed method on the
* passed instance
* @param instance
* @return
*/
public IFieldBuilder getInstance( Class clazz, Object value ) {
// ignoring value for now for simplicity
IFieldBuilder builder = (IFieldBuilder)mappings.get( clazz );
if ( builder == null ) {
for ( int i=0, num = builders.length ; i < num ; i++ ) {
if ( builders[i].isApplicable( clazz, value ) ) {
builder = builders[i];
break;
}
}
if ( builder == null ) {
builder = new DefaultFieldBuilder();
}
mappings.put( clazz, builder );
}
return builder;
}
}
| 1,780 | 0.667416 | 0.664045 | 64 | 25.8125 | 21.672905 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.90625 | false | false |
3
|
a898e98f0cd28d5b138b56ff22f7e0bdcbb62d42
| 30,863,635,055,831 |
ef597a69355334a0167126c5df1cb0ecc2772f51
|
/AnnotateWord.java
|
91cfb777b49f6c9373c917c5a098a0a4626f85c5
|
[] |
no_license
|
joalliswellchin/StoryGenerater
|
https://github.com/joalliswellchin/StoryGenerater
|
b259274508ca65aa866d2406248249bcc376ac44
|
36b71b8146bb13a01d7d4b7fcfad197fbe81aaac
|
refs/heads/master
| 2021-10-02T20:32:54.596000 | 2018-11-30T15:01:40 | 2018-11-30T15:01:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//ChinZhiQiJoel_140224142_CO3320_AdditionalMaterial
package storyIllustrationGenerator;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.CoreAnnotations.LemmaAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.TreeCoreAnnotations;
import edu.stanford.nlp.util.CoreMap;
/*
* This class parses the sentence to tag
* the words with the respective parts of
* speech tagging.
*/
public class AnnotateWord extends Word {
private String s;
private Annotation a;
private Tree tree;
public AnnotateWord(String simpleSentence) throws FileNotFoundException {
super();
// using properties of sentence splitting and Parts Of Speech (POS)
Properties p = new Properties();
// p.setProperty("annotators", "tokenize, ssplit, pos");//without tree notation
p.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref, sentiment");
StanfordCoreNLP pipeline = new StanfordCoreNLP(p);
s = simpleSentence;
// annotate text
a = new Annotation(s);
pipeline.annotate(a);
List<CoreMap> sentences = a.get(CoreAnnotations.SentencesAnnotation.class);
if (sentences != null && !sentences.isEmpty()) {
CoreMap sentence = sentences.get(0);
// use Tree class to get the nodes needed
tree = sentence.get(TreeCoreAnnotations.TreeAnnotation.class);
}
// for testing purposes
PrintWriter out = new PrintWriter(System.out);
if (sentences != null && !sentences.isEmpty()) {
CoreMap sentence = sentences.get(0);
out.println();
for (CoreMap token : sentence.get(CoreAnnotations.TokensAnnotation.class)) {
out.println(token.toShorterString());
}
}
out.println("\nTree structure of sentence:");
tree.pennPrint(out);
out.println();
}
public AnnotateWord() {
super();
}
public Tree getTree() {
return tree;
}
public void storeAllWords() {
// get POS of individual words of text
// and set the nouns of the sentence
for (CoreLabel token : a.get(TokensAnnotation.class)) {
String word = token.get(LemmaAnnotation.class);// sets to inferred lemma (dictionary meaning)
String pos = token.get(PartOfSpeechAnnotation.class);
add(word, pos);
}
}
public String lemmaWord() {
List<CoreMap> list = a.get(SentencesAnnotation.class);
return list.get(0).get(TokensAnnotation.class).get(0).get(LemmaAnnotation.class);
}
}
|
UTF-8
|
Java
| 2,776 |
java
|
AnnotateWord.java
|
Java
|
[] | null |
[] |
//ChinZhiQiJoel_140224142_CO3320_AdditionalMaterial
package storyIllustrationGenerator;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.CoreAnnotations.LemmaAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.TreeCoreAnnotations;
import edu.stanford.nlp.util.CoreMap;
/*
* This class parses the sentence to tag
* the words with the respective parts of
* speech tagging.
*/
public class AnnotateWord extends Word {
private String s;
private Annotation a;
private Tree tree;
public AnnotateWord(String simpleSentence) throws FileNotFoundException {
super();
// using properties of sentence splitting and Parts Of Speech (POS)
Properties p = new Properties();
// p.setProperty("annotators", "tokenize, ssplit, pos");//without tree notation
p.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref, sentiment");
StanfordCoreNLP pipeline = new StanfordCoreNLP(p);
s = simpleSentence;
// annotate text
a = new Annotation(s);
pipeline.annotate(a);
List<CoreMap> sentences = a.get(CoreAnnotations.SentencesAnnotation.class);
if (sentences != null && !sentences.isEmpty()) {
CoreMap sentence = sentences.get(0);
// use Tree class to get the nodes needed
tree = sentence.get(TreeCoreAnnotations.TreeAnnotation.class);
}
// for testing purposes
PrintWriter out = new PrintWriter(System.out);
if (sentences != null && !sentences.isEmpty()) {
CoreMap sentence = sentences.get(0);
out.println();
for (CoreMap token : sentence.get(CoreAnnotations.TokensAnnotation.class)) {
out.println(token.toShorterString());
}
}
out.println("\nTree structure of sentence:");
tree.pennPrint(out);
out.println();
}
public AnnotateWord() {
super();
}
public Tree getTree() {
return tree;
}
public void storeAllWords() {
// get POS of individual words of text
// and set the nouns of the sentence
for (CoreLabel token : a.get(TokensAnnotation.class)) {
String word = token.get(LemmaAnnotation.class);// sets to inferred lemma (dictionary meaning)
String pos = token.get(PartOfSpeechAnnotation.class);
add(word, pos);
}
}
public String lemmaWord() {
List<CoreMap> list = a.get(SentencesAnnotation.class);
return list.get(0).get(TokensAnnotation.class).get(0).get(LemmaAnnotation.class);
}
}
| 2,776 | 0.747118 | 0.740994 | 93 | 28.849463 | 25.892227 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.698925 | false | false |
3
|
267a277971f257e6a8156e038d2fd534040d025d
| 35,416,300,323,988 |
668ae0ee0258527facd0021ddbbfebf82c36b73e
|
/src/main/java/com/invillia/acme/config/EnvironmentReader.java
|
a650cc73ba223a5f7292b6f7577260c0d5d1404f
|
[] |
no_license
|
kfpereira/backend-challenge
|
https://github.com/kfpereira/backend-challenge
|
2a487e2c97d7a8bb9fe2381bba2b193d72db61d9
|
603805e4b30ecc2f602b92a37d1a7e8778395cff
|
refs/heads/master
| 2020-04-24T21:00:09.791000 | 2019-02-27T07:05:16 | 2019-02-27T07:05:16 | 172,262,900 | 0 | 0 | null | true | 2019-02-27T07:05:17 | 2019-02-23T20:53:20 | 2019-02-27T03:05:37 | 2019-02-27T07:05:17 | 104 | 0 | 0 | 0 |
Java
| false | null |
package com.invillia.acme.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@Service
class EnvironmentReader {
private static final String AMBIENTE_DE_TESTES = "test";
private final Environment environment;
@Autowired
public EnvironmentReader(Environment environment) {
this.environment = environment;
}
boolean isAmbienteDeTeste() {
String[] activeProfiles = environment.getActiveProfiles();
return activeProfiles[0].equals(AMBIENTE_DE_TESTES);
}
}
|
UTF-8
|
Java
| 625 |
java
|
EnvironmentReader.java
|
Java
|
[] | null |
[] |
package com.invillia.acme.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@Service
class EnvironmentReader {
private static final String AMBIENTE_DE_TESTES = "test";
private final Environment environment;
@Autowired
public EnvironmentReader(Environment environment) {
this.environment = environment;
}
boolean isAmbienteDeTeste() {
String[] activeProfiles = environment.getActiveProfiles();
return activeProfiles[0].equals(AMBIENTE_DE_TESTES);
}
}
| 625 | 0.7488 | 0.7472 | 23 | 26.173914 | 24.215792 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.391304 | false | false |
3
|
2cc924ac78aa59ff075e0891297aa2d82fb88531
| 18,519,899,021,149 |
c2b22e74eb9310999501b5c2623e0b406e3b1b59
|
/Crypto.java
|
5b0e3811122f867776c93c191ce12aeb8e4c6589
|
[
"MIT"
] |
permissive
|
Shealy99/Cryptography-OneTimePad
|
https://github.com/Shealy99/Cryptography-OneTimePad
|
0d89c5f02f09f3f6420f4d5020fa7df830439e58
|
558e03c557c69088691bc25beb4c4f3718266da6
|
refs/heads/master
| 2020-03-21T09:44:07.005000 | 2018-06-23T16:06:52 | 2018-06-23T16:06:52 | 138,415,190 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package crypto;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Random;
public class Crypto {
public static File decrypt(String path, String keyPath) throws FileNotFoundException, IOException {
byte[] key = Files.readAllBytes(new File(keyPath).toPath());
File encrypted = new File(path);
byte[] encrypt = Files.readAllBytes(encrypted.toPath());
byte[] dec = new byte[encrypt.length];
int in = encrypted.getAbsolutePath().lastIndexOf(".");
String ext = "";
int index = 0;
for (int i = 0; i < encrypt.length; i++) {
if (index == key.length) {
index = 0;
}
dec[i] = (byte) (key[index] ^ encrypt[i]);
index++;
}
if (in > -1) {
ext = encrypted.getAbsolutePath().substring(in + 1);
}
File newFile = new File("decrypted." + ext);
FileOutputStream stream = new FileOutputStream(newFile);
stream.write(dec);
stream.close();
return newFile;
}
public static File encrypt(String path) throws FileNotFoundException, IOException {
File f = new File(path);
byte[] key = getRandomKey(64);
FileOutputStream writeKey = new FileOutputStream(new File("key.txt"));
writeKey.write(key);
writeKey.close();
byte[] b = Files.readAllBytes(f.toPath());
int index = 0;
byte[] encrypt = new byte[b.length];
String ext = "";
for (int i = 0; i < b.length; i++) {
if (index == key.length) {
index = 0;
}
encrypt[i] = (byte) (key[index] ^ b[i]);
index++;
}
int in = f.getAbsolutePath().lastIndexOf(".");
if (in > -1) {
ext = f.getAbsolutePath().substring(in + 1);
}
File newFile = new File("encrypted." + ext);
FileOutputStream stream = new FileOutputStream(newFile);
stream.write(encrypt);
stream.close();
return newFile;
}
private static byte[] getRandomKey(int n) {
Random r = new Random();
byte[] keyBytes = new byte[n];
r.nextBytes(keyBytes);
return keyBytes;
}
public static void main(String[] args) throws IOException {
encrypt("real.jpg");
decrypt("encrypted.jpg", "key.txt");
}
}
|
UTF-8
|
Java
| 2,581 |
java
|
Crypto.java
|
Java
|
[] | null |
[] |
package crypto;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Random;
public class Crypto {
public static File decrypt(String path, String keyPath) throws FileNotFoundException, IOException {
byte[] key = Files.readAllBytes(new File(keyPath).toPath());
File encrypted = new File(path);
byte[] encrypt = Files.readAllBytes(encrypted.toPath());
byte[] dec = new byte[encrypt.length];
int in = encrypted.getAbsolutePath().lastIndexOf(".");
String ext = "";
int index = 0;
for (int i = 0; i < encrypt.length; i++) {
if (index == key.length) {
index = 0;
}
dec[i] = (byte) (key[index] ^ encrypt[i]);
index++;
}
if (in > -1) {
ext = encrypted.getAbsolutePath().substring(in + 1);
}
File newFile = new File("decrypted." + ext);
FileOutputStream stream = new FileOutputStream(newFile);
stream.write(dec);
stream.close();
return newFile;
}
public static File encrypt(String path) throws FileNotFoundException, IOException {
File f = new File(path);
byte[] key = getRandomKey(64);
FileOutputStream writeKey = new FileOutputStream(new File("key.txt"));
writeKey.write(key);
writeKey.close();
byte[] b = Files.readAllBytes(f.toPath());
int index = 0;
byte[] encrypt = new byte[b.length];
String ext = "";
for (int i = 0; i < b.length; i++) {
if (index == key.length) {
index = 0;
}
encrypt[i] = (byte) (key[index] ^ b[i]);
index++;
}
int in = f.getAbsolutePath().lastIndexOf(".");
if (in > -1) {
ext = f.getAbsolutePath().substring(in + 1);
}
File newFile = new File("encrypted." + ext);
FileOutputStream stream = new FileOutputStream(newFile);
stream.write(encrypt);
stream.close();
return newFile;
}
private static byte[] getRandomKey(int n) {
Random r = new Random();
byte[] keyBytes = new byte[n];
r.nextBytes(keyBytes);
return keyBytes;
}
public static void main(String[] args) throws IOException {
encrypt("real.jpg");
decrypt("encrypted.jpg", "key.txt");
}
}
| 2,581 | 0.539326 | 0.534676 | 83 | 29.096386 | 22.842897 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.674699 | false | false |
3
|
ebb9029bbcbb7aa27cdf9b39ad4f1631c39e8970
| 37,898,791,421,907 |
0bf94d6024d97a2afc7219f993cc269955a44169
|
/JavaJDBC/src/ManejoPersonas/Main.java
|
92da7c67d81414eb09fb2fc3809941ab8f7cb9aa
|
[
"Apache-2.0"
] |
permissive
|
kioscar/Java
|
https://github.com/kioscar/Java
|
0a3c00450cb790f2bf227d327aa0a843ff54a2ae
|
d825d3ed0ecd533982e6b2c0b14a123d03bba077
|
refs/heads/master
| 2020-05-03T07:02:04.710000 | 2019-09-26T17:15:38 | 2019-09-26T17:15:38 | 178,487,287 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ManejoPersonas;
import ManejoPersonas.datos.PersonaJDBC;
import ManejoPersonas.domain.Persona;
import java.util.List;
public class Main {
/**
* Método main.
* @param args
*/
public static void main(String[] args) {
PersonaJDBC personaJDBC = new PersonaJDBC();
//listarPersonas(personaJDBC);
// Prueba del metodo insert
//personaJDBC.insert("Karla", "Amaya");
//listarPersonas(personaJDBC);
// Prueba de update
//personaJDBC.update(2, "Nombre3", "Apellido 3");
//listarPersonas(personaJDBC);
// Prueba de delete
personaJDBC.delete(7);
listarPersonas(personaJDBC);
}
private static void listarPersonas(PersonaJDBC personaJDBC) {
List<Persona> listaPersonas;
listaPersonas = personaJDBC.select();
for (Persona persona : listaPersonas) {
System.out.println(persona);
System.out.println();
}
listaPersonas.clear();
listaPersonas = null;
}
}
|
ISO-8859-2
|
Java
| 968 |
java
|
Main.java
|
Java
|
[
{
"context": "Prueba del metodo insert\r\n\t\t//personaJDBC.insert(\"Karla\", \"Amaya\");\r\n\t\t//listarPersonas(personaJDBC);\r\n\t\t",
"end": 395,
"score": 0.9998090267181396,
"start": 390,
"tag": "NAME",
"value": "Karla"
},
{
"context": "l metodo insert\r\n\t\t//personaJDBC.insert(\"Karla\", \"Amaya\");\r\n\t\t//listarPersonas(personaJDBC);\r\n\t\t\r\n\t\t// Pr",
"end": 404,
"score": 0.9997650384902954,
"start": 399,
"tag": "NAME",
"value": "Amaya"
}
] | null |
[] |
package ManejoPersonas;
import ManejoPersonas.datos.PersonaJDBC;
import ManejoPersonas.domain.Persona;
import java.util.List;
public class Main {
/**
* Método main.
* @param args
*/
public static void main(String[] args) {
PersonaJDBC personaJDBC = new PersonaJDBC();
//listarPersonas(personaJDBC);
// Prueba del metodo insert
//personaJDBC.insert("Karla", "Amaya");
//listarPersonas(personaJDBC);
// Prueba de update
//personaJDBC.update(2, "Nombre3", "Apellido 3");
//listarPersonas(personaJDBC);
// Prueba de delete
personaJDBC.delete(7);
listarPersonas(personaJDBC);
}
private static void listarPersonas(PersonaJDBC personaJDBC) {
List<Persona> listaPersonas;
listaPersonas = personaJDBC.select();
for (Persona persona : listaPersonas) {
System.out.println(persona);
System.out.println();
}
listaPersonas.clear();
listaPersonas = null;
}
}
| 968 | 0.66908 | 0.664943 | 45 | 19.48889 | 16.83201 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.866667 | false | false |
3
|
a69584100eb1edf8f5befd1bb73961a3151375bb
| 13,889,924,282,474 |
6a7a3c200dd7a0fecd8690287b18fa96bde4994e
|
/src/main/java/com/fury/game/world/update/flag/block/graphic/GraphicHeight.java
|
ccf9134efcc2a4f3e2c573242295f5595eabcfba
|
[] |
no_license
|
GregHib/fury
|
https://github.com/GregHib/fury
|
5d6c39a08bd05148076feb809ff26401e4d0d330
|
24fd71ebd515219d4d7ceca4bd2d5c6a96042cc1
|
refs/heads/master
| 2023-01-27T19:29:44.829000 | 2020-12-03T09:54:17 | 2020-12-03T09:54:17 | 318,140,865 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fury.game.world.update.flag.block.graphic;
public enum GraphicHeight {
LOW,
MIDDLE,
HIGH,
SALAMANDER_FIRE;
public int toInt() {
return ordinal() >= 3 ? 65 : (ordinal() * 50);
}
}
|
UTF-8
|
Java
| 201 |
java
|
GraphicHeight.java
|
Java
|
[] | null |
[] |
package com.fury.game.world.update.flag.block.graphic;
public enum GraphicHeight {
LOW,
MIDDLE,
HIGH,
SALAMANDER_FIRE;
public int toInt() {
return ordinal() >= 3 ? 65 : (ordinal() * 50);
}
}
| 201 | 0.666667 | 0.641791 | 12 | 15.75 | 17.870483 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false |
3
|
5ca6be74d421601b3a13be1503f75652e0ddd7f9
| 35,442,070,144,188 |
d4d497cc01d181dd72d7f46c9102481675c525ec
|
/pssif/pssif.transform/src/main/java/de/tum/pssif/transform/transformation/RenameTransformation.java
|
1dbba49d82b1294a80e4b7b7ddc9b42d6c809a44
|
[] |
no_license
|
basirati/Afshin
|
https://github.com/basirati/Afshin
|
d8cf1931b4ba877d6728f1e56bf9a6a95a228be4
|
5345f72ea189677a59e49da03805f062a12ab4e5
|
refs/heads/master
| 2017-12-19T09:56:31.192000 | 2016-12-19T16:49:49 | 2016-12-19T16:49:49 | 76,879,184 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.tum.pssif.transform.transformation;
import de.tum.pssif.core.metamodel.traits.Named;
public abstract class RenameTransformation<T extends Named> extends AbstractTransformation {
private final String target;
private final String name;
public RenameTransformation(T target, String name) {
this.target = target.getName();
this.name = name;
}
protected final String getTarget() {
return target;
}
protected final String getName() {
return name;
}
}
|
UTF-8
|
Java
| 494 |
java
|
RenameTransformation.java
|
Java
|
[] | null |
[] |
package de.tum.pssif.transform.transformation;
import de.tum.pssif.core.metamodel.traits.Named;
public abstract class RenameTransformation<T extends Named> extends AbstractTransformation {
private final String target;
private final String name;
public RenameTransformation(T target, String name) {
this.target = target.getName();
this.name = name;
}
protected final String getTarget() {
return target;
}
protected final String getName() {
return name;
}
}
| 494 | 0.734818 | 0.734818 | 22 | 21.454546 | 23.713684 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.409091 | false | false |
3
|
22492cdd40c2117b4f16a24484a7b01489ddf9cd
| 34,488,587,411,445 |
9dab6fe3eb02f77d40b049781e37b972adf9e502
|
/src/main/java/generator/utils/GeneratorHelper.java
|
f59f58f9679aebdd993eb543d46cb92b7a1e1a7c
|
[] |
no_license
|
MariaOskar/DocsGenerator
|
https://github.com/MariaOskar/DocsGenerator
|
f8555cfc2c244fa620cd8bd50b8477d319576f24
|
d9816783301338b03dcf8eb9b312305de17b5c83
|
refs/heads/master
| 2020-03-31T15:11:50.317000 | 2018-10-22T14:26:17 | 2018-10-22T14:26:17 | 152,324,289 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package generator.utils;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.util.Date;
import java.util.Random;
public class GeneratorHelper {
public static String formatBirthday(Date birthday) {
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
return format.format(birthday);
}
public static int calculateAge(Date birthday) {
Date now = new Date();
LocalDate nowLocal = now.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate birthdayLocal = birthday.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
return Period.between(birthdayLocal, nowLocal).getYears();
}
public static int randomNum(int min, int max) {
Random rand = new Random();
return min + rand.nextInt((max - min) + 1);
}
public static String getRandomNums(int quantity) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < quantity; i++) {
builder.append(String.valueOf(randomNum(0, 9)));
}
return builder.toString();
}
}
|
UTF-8
|
Java
| 1,157 |
java
|
GeneratorHelper.java
|
Java
|
[] | null |
[] |
package generator.utils;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.util.Date;
import java.util.Random;
public class GeneratorHelper {
public static String formatBirthday(Date birthday) {
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
return format.format(birthday);
}
public static int calculateAge(Date birthday) {
Date now = new Date();
LocalDate nowLocal = now.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate birthdayLocal = birthday.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
return Period.between(birthdayLocal, nowLocal).getYears();
}
public static int randomNum(int min, int max) {
Random rand = new Random();
return min + rand.nextInt((max - min) + 1);
}
public static String getRandomNums(int quantity) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < quantity; i++) {
builder.append(String.valueOf(randomNum(0, 9)));
}
return builder.toString();
}
}
| 1,157 | 0.668971 | 0.665514 | 36 | 31.138889 | 26.332439 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.638889 | false | false |
3
|
dab16512d22fcc593f042e6bfe6cf4842e1e3c20
| 35,218,731,849,563 |
efd06b39f17d5f258b46aa0d5e6705d0397df09c
|
/Taskscheduler/src/runner/Runner.java
|
353206f8135dd7364fbfa06497b40c29cce3f288
|
[] |
no_license
|
saurabhy/TaskScheduler-lld
|
https://github.com/saurabhy/TaskScheduler-lld
|
157b5b1cb64f0361d30a362e686cb2de4e4eb2f4
|
32ee156552d120c029131e46c91f83184a9f3856
|
refs/heads/master
| 2023-07-12T20:01:38.399000 | 2021-08-12T16:39:27 | 2021-08-12T16:39:27 | 395,380,619 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package runner;
import common.TaskHolder;
import pojos.Task;
public class Runner extends Thread{
public void run() {
while(true) {
Task task = TaskHolder.getElement();
if(task!=null) {
task.runTask();
task.setLastCompleted(System.currentTimeMillis());
task.setPresent(false);
}
}
}
}
|
UTF-8
|
Java
| 324 |
java
|
Runner.java
|
Java
|
[] | null |
[] |
package runner;
import common.TaskHolder;
import pojos.Task;
public class Runner extends Thread{
public void run() {
while(true) {
Task task = TaskHolder.getElement();
if(task!=null) {
task.runTask();
task.setLastCompleted(System.currentTimeMillis());
task.setPresent(false);
}
}
}
}
| 324 | 0.657407 | 0.657407 | 20 | 15.2 | 14.739742 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.9 | false | false |
3
|
ff83530713787cb55a8b639156394a33e065cc29
| 5,042,291,667,970 |
d1b4f742bc13543a150545d2935028f7289a5fad
|
/src/main/java/com/na/backend/exception/EntityNotFoundException.java
|
dd157cc53be00f832660b86ffc2eb02490b7e28b
|
[] |
no_license
|
mash-up-kr/NNAA_REPO
|
https://github.com/mash-up-kr/NNAA_REPO
|
37f4f310d4d957aa5310fb1a3ef0228e2447404c
|
69a0cd087b23a14f88031a19fdd46124d52e1e89
|
refs/heads/develop
| 2020-09-16T03:15:21.819000 | 2020-06-08T18:07:35 | 2020-06-08T18:07:35 | 223,633,112 | 2 | 0 | null | false | 2020-06-08T18:07:36 | 2019-11-23T18:15:31 | 2020-05-16T06:36:30 | 2020-06-08T18:07:35 | 562 | 1 | 0 | 0 |
Java
| false | false |
package com.na.backend.exception;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
public class EntityNotFoundException extends BaseException {
public EntityNotFoundException(String message) {
super(ApiError.builder()
.httpStatus(HttpStatus.BAD_REQUEST)
.message("[ EntityNotFoundException ]\n" + message)
.build());
}
}
|
UTF-8
|
Java
| 412 |
java
|
EntityNotFoundException.java
|
Java
|
[] | null |
[] |
package com.na.backend.exception;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
public class EntityNotFoundException extends BaseException {
public EntityNotFoundException(String message) {
super(ApiError.builder()
.httpStatus(HttpStatus.BAD_REQUEST)
.message("[ EntityNotFoundException ]\n" + message)
.build());
}
}
| 412 | 0.677184 | 0.677184 | 15 | 26.533333 | 23.076298 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false |
3
|
19bdab4b792b5cb9b0cc880bd3e090c3e9333f26
| 34,016,141,017,926 |
3a1e7af3d147fafc215ec5bdb20f29c966985744
|
/android-application/CUSTOMER/src/com/vishrant/customer/activity/FeedbackTypeSelectActivity.java
|
d5ea24a0c5d384ff7e6a238c3679d8940a91d5d6
|
[] |
no_license
|
vishrantgupta/CSAT-and-ADHOC-Feedback-System
|
https://github.com/vishrantgupta/CSAT-and-ADHOC-Feedback-System
|
13ae18b8ee922f75ff5108d53d1618b7fe3170e3
|
aa70696e59547de628488b1d3a87a096c7ab86c0
|
refs/heads/master
| 2020-03-18T07:22:14.351000 | 2018-05-22T18:01:50 | 2018-05-22T18:01:50 | 134,448,010 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.vishrant.customer.activity;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import com.vishrant.customer.R;
import com.vishrant.customer.beans.ApplicableFeedbacks;
import com.vishrant.customer.beans.Question;
import com.vishrant.customer.constant.ApplicationGlobalVariable;
import com.vishrant.customer.tabActivity.FetchQuestionsActivity;
import com.vishrant.customer.utils.Utils;
public class FeedbackTypeSelectActivity extends Activity {
private View view = null;
private LinearLayout linearLayout = null;
private LinearLayout linearLayoutMain = null;
// private ScrollView scrollView = null;
private String selectedProjectName = null;
String userId = null;
private SimpleDateFormat dateFormat = new SimpleDateFormat();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
linearLayout = new LinearLayout(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.activity_feedback_type_select, null);
// Find the ScrollView
linearLayoutMain = (LinearLayout) view.findViewById(R.id.scrollViewFeedbackSelect);
Bundle bundle = getIntent().getExtras();
this.selectedProjectName = bundle.getString("selectedProject");
//linearLayoutMain.setBackgroundColor(Color.rgb(221, 221, 221));
// Create a LinearLayout element
linearLayout.setOrientation(LinearLayout.VERTICAL);
LayoutParams layoutParamsLinearLayout = new LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
layoutParamsLinearLayout.setMargins(20, 50, 20, 10);
linearLayout.setLayoutParams(layoutParamsLinearLayout);
linearLayoutMain.addView(linearLayout);
linearLayout.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
//linearLayoutMain.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
setContentView(view);
CheckIfFeedbackGiven isFeedbackSubmitted = new CheckIfFeedbackGiven();
isFeedbackSubmitted.execute(new String[]{new String("")});
}
private void createStatusLabel(String messgae) {
TextView statusMessage = new TextView(FeedbackTypeSelectActivity.this);
//questionLabel.setPadding(20, 10, 20, 10);
statusMessage.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
statusMessage.setTypeface(null, Typeface.BOLD);
LayoutParams layoutParams = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
statusMessage.setLayoutParams(layoutParams);
statusMessage.setGravity(Gravity.CENTER_HORIZONTAL);
statusMessage.setText(messgae);
setMargins(statusMessage, 25, 10, 25, 10);
linearLayout.addView(statusMessage);
}
private void setMargins (View v, int left, int top, int right, int bottom) {
android.widget.LinearLayout.LayoutParams layoutparams = null;
// for RatingBar
if (v instanceof RatingBar) {
layoutparams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutparams.setMargins(left, top, right, bottom);
v.setLayoutParams(layoutparams);
} else if (v instanceof View) { // for views other then RatingBar
layoutparams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
layoutparams.setMargins(left, top, right, bottom);
v.setLayoutParams(layoutparams);
}
}
private void createSubmitBtn() {
LinearLayout submitBtnLayout = new LinearLayout(this);
LayoutParams layoutParams = new LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
submitBtnLayout.setLayoutParams(layoutParams);
submitBtnLayout.setGravity(Gravity.RIGHT | Gravity.BOTTOM);
submitBtnLayout.setPadding(0, 0, 10, 10);
Button submitBtn = new Button(FeedbackTypeSelectActivity.this);
submitBtn.setText("Continue");
submitBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_background));
submitBtn.setTextColor(Color.WHITE);
submitBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
RadioGroup radioGroup = (RadioGroup) findViewById(1);
int id = radioGroup.getCheckedRadioButtonId();
View radioButton = radioGroup.findViewById(id);
int radioId = radioGroup.indexOfChild(radioButton);
RadioButton btn = (RadioButton) radioGroup.getChildAt(radioId);
if (btn != null) {
String radioSelection = (String) btn.getText();
Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, RatingScaleNoteActivity.class);
slideactivity.putExtra("feedbackSelected", radioSelection);
slideactivity.putExtra("selectedProjectName", selectedProjectName);
startActivity(slideactivity);
finish();
} else {
Toast.makeText(getApplicationContext(), "Please select feedback type", Toast.LENGTH_SHORT).show();
}
}
});
submitBtnLayout.addView(submitBtn);
linearLayout.addView(submitBtnLayout);
}
private class CheckIfFeedbackGiven extends AsyncTask<String, Void, Void> {
ProgressDialog progressDialog;
ArrayList<ApplicableFeedbacks> values = null;
public CheckIfFeedbackGiven() {
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(FeedbackTypeSelectActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected Void doInBackground(String... params) {
Utils utils = new Utils();
userId = ((ApplicationGlobalVariable) getApplication()).getUserId();
values = utils.isFeedbackGive(userId, selectedProjectName);
return null;
}
@Override
protected void onPostExecute(Void result) {
RadioGroup group = new RadioGroup(FeedbackTypeSelectActivity.this);
group.setOrientation(RadioGroup.HORIZONTAL);
// random id
group.setId(1);
group.setGravity(Gravity.CENTER);
setMargins(group, 35, 50, 35, 10);
int btnDisabledCount = 0;
ArrayList<RadioButton> listOfRadioButtons = new ArrayList<RadioButton>();
int idCount = 100;
if (values != null) {
dateFormat.applyPattern("MMM - yyyy");
String monthYear = dateFormat.format(new Date());
TextView monthTv = new TextView(FeedbackTypeSelectActivity.this);
//csatMonth.setPadding(25, 20, 20, 15);
monthTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
monthTv.setTypeface(null, Typeface.BOLD);
setMargins(monthTv, 25, 20, 25, 15);
monthTv.setText(monthYear.toUpperCase());
monthTv.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
linearLayout.addView(monthTv);
for (ApplicableFeedbacks feedbackType : values) {
RadioButton btn = new RadioButton(
FeedbackTypeSelectActivity.this);
btn.setId(++idCount);
String type = feedbackType.getFeedbackType().trim();
btn.setText(type);
String status = feedbackType.getStatus();
if (status != null && !status.equalsIgnoreCase("null")) {
if (status.equalsIgnoreCase("new")) {
/*btnDisabledCount++;
btn.setEnabled(false);*/
} else if (status.equalsIgnoreCase("conform")
|| status.equalsIgnoreCase("resolved")) {
btn.setEnabled(false);
// btn.setVisibility(View.INVISIBLE);
btnDisabledCount++;
createViewStatusBtn("Check " + type + " status", type, status);
} else /*if (status.equalsIgnoreCase("open")) {
btn.setEnabled(false);
btnDisabledCount++;
} else if (status.equalsIgnoreCase("close")) {*/
{
btn.setEnabled(false);
// btn.setVisibility(View.INVISIBLE);
btnDisabledCount++;
}
}
group.addView(btn);
listOfRadioButtons.add(btn);
}
} else {
Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, NoRecordsFoundActivity.class);
slideactivity.putExtra("message", "No feedback type available, please come back again.");
startActivity(slideactivity);
finish();
}
linearLayout.addView(group);
if (listOfRadioButtons.size() > btnDisabledCount) {
// creating submit button
createSubmitBtn();
}
progressDialog.dismiss();
}
}
private void createViewStatusBtn(String btnLabel, final String feedbackType, String status){
if (status.equalsIgnoreCase("resolved")) {
createStatusLabel(feedbackType + " is resolved.");
} else {
Button submitBtn = new Button(FeedbackTypeSelectActivity.this);
LayoutParams layoutParams = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
submitBtn.setLayoutParams(layoutParams);
submitBtn.setText(btnLabel);
setMargins(submitBtn, 25, 10, 25, 10);
submitBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_background));
submitBtn.setTextColor(Color.WHITE);
submitBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
/*RadioGroup radioGroup = (RadioGroup) findViewById(1);
int id = radioGroup.getCheckedRadioButtonId();
View radioButton = radioGroup.findViewById(id);
int radioId = radioGroup.indexOfChild(radioButton);
RadioButton btn = (RadioButton) radioGroup.getChildAt(radioId);
String radioSelection = (String) btn.getText();*/
GetFeedbackStatus feedbackStatus = new GetFeedbackStatus(feedbackType);
feedbackStatus.execute(new String[]{new String("")});
/*Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, RatingScaleNoteActivity.class);
slideactivity.putExtra("feedbackSelected", radioSelection);
startActivity(slideactivity);
finish();*/
}
});
linearLayout.addView(submitBtn);
}
}
private class GetFeedbackStatus extends AsyncTask<String, Void, Void> {
ProgressDialog progressDialog;
String feedbackStatusStr = null;
String feedbackType = null;
public GetFeedbackStatus(String feedbackType) {
this.feedbackType = feedbackType;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(FeedbackTypeSelectActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected Void doInBackground(String... params) {
Utils utils = new Utils();
String userId = ((ApplicationGlobalVariable) getApplication()).getUserId();
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy");
feedbackStatusStr = utils.getFeedbackStatus(userId, feedbackType, sdf.format(d));
return null;
}
@Override
protected void onPostExecute(Void result) {
if (feedbackStatusStr != null) {
Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, FeedbackStatusActivity.class);
slideactivity.putExtra("feedbackStatus", feedbackStatusStr);
slideactivity.putExtra("selectedProjectName", selectedProjectName);
startActivity(slideactivity);
//finish();
}
/*for (String str : feedbackStatusStr) {
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_LONG).show();
}*/
progressDialog.dismiss();
}
}
}
|
UTF-8
|
Java
| 12,618 |
java
|
FeedbackTypeSelectActivity.java
|
Java
|
[] | null |
[] |
package com.vishrant.customer.activity;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import com.vishrant.customer.R;
import com.vishrant.customer.beans.ApplicableFeedbacks;
import com.vishrant.customer.beans.Question;
import com.vishrant.customer.constant.ApplicationGlobalVariable;
import com.vishrant.customer.tabActivity.FetchQuestionsActivity;
import com.vishrant.customer.utils.Utils;
public class FeedbackTypeSelectActivity extends Activity {
private View view = null;
private LinearLayout linearLayout = null;
private LinearLayout linearLayoutMain = null;
// private ScrollView scrollView = null;
private String selectedProjectName = null;
String userId = null;
private SimpleDateFormat dateFormat = new SimpleDateFormat();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
linearLayout = new LinearLayout(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.activity_feedback_type_select, null);
// Find the ScrollView
linearLayoutMain = (LinearLayout) view.findViewById(R.id.scrollViewFeedbackSelect);
Bundle bundle = getIntent().getExtras();
this.selectedProjectName = bundle.getString("selectedProject");
//linearLayoutMain.setBackgroundColor(Color.rgb(221, 221, 221));
// Create a LinearLayout element
linearLayout.setOrientation(LinearLayout.VERTICAL);
LayoutParams layoutParamsLinearLayout = new LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
layoutParamsLinearLayout.setMargins(20, 50, 20, 10);
linearLayout.setLayoutParams(layoutParamsLinearLayout);
linearLayoutMain.addView(linearLayout);
linearLayout.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
//linearLayoutMain.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
setContentView(view);
CheckIfFeedbackGiven isFeedbackSubmitted = new CheckIfFeedbackGiven();
isFeedbackSubmitted.execute(new String[]{new String("")});
}
private void createStatusLabel(String messgae) {
TextView statusMessage = new TextView(FeedbackTypeSelectActivity.this);
//questionLabel.setPadding(20, 10, 20, 10);
statusMessage.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
statusMessage.setTypeface(null, Typeface.BOLD);
LayoutParams layoutParams = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
statusMessage.setLayoutParams(layoutParams);
statusMessage.setGravity(Gravity.CENTER_HORIZONTAL);
statusMessage.setText(messgae);
setMargins(statusMessage, 25, 10, 25, 10);
linearLayout.addView(statusMessage);
}
private void setMargins (View v, int left, int top, int right, int bottom) {
android.widget.LinearLayout.LayoutParams layoutparams = null;
// for RatingBar
if (v instanceof RatingBar) {
layoutparams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutparams.setMargins(left, top, right, bottom);
v.setLayoutParams(layoutparams);
} else if (v instanceof View) { // for views other then RatingBar
layoutparams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
layoutparams.setMargins(left, top, right, bottom);
v.setLayoutParams(layoutparams);
}
}
private void createSubmitBtn() {
LinearLayout submitBtnLayout = new LinearLayout(this);
LayoutParams layoutParams = new LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
submitBtnLayout.setLayoutParams(layoutParams);
submitBtnLayout.setGravity(Gravity.RIGHT | Gravity.BOTTOM);
submitBtnLayout.setPadding(0, 0, 10, 10);
Button submitBtn = new Button(FeedbackTypeSelectActivity.this);
submitBtn.setText("Continue");
submitBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_background));
submitBtn.setTextColor(Color.WHITE);
submitBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
RadioGroup radioGroup = (RadioGroup) findViewById(1);
int id = radioGroup.getCheckedRadioButtonId();
View radioButton = radioGroup.findViewById(id);
int radioId = radioGroup.indexOfChild(radioButton);
RadioButton btn = (RadioButton) radioGroup.getChildAt(radioId);
if (btn != null) {
String radioSelection = (String) btn.getText();
Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, RatingScaleNoteActivity.class);
slideactivity.putExtra("feedbackSelected", radioSelection);
slideactivity.putExtra("selectedProjectName", selectedProjectName);
startActivity(slideactivity);
finish();
} else {
Toast.makeText(getApplicationContext(), "Please select feedback type", Toast.LENGTH_SHORT).show();
}
}
});
submitBtnLayout.addView(submitBtn);
linearLayout.addView(submitBtnLayout);
}
private class CheckIfFeedbackGiven extends AsyncTask<String, Void, Void> {
ProgressDialog progressDialog;
ArrayList<ApplicableFeedbacks> values = null;
public CheckIfFeedbackGiven() {
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(FeedbackTypeSelectActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected Void doInBackground(String... params) {
Utils utils = new Utils();
userId = ((ApplicationGlobalVariable) getApplication()).getUserId();
values = utils.isFeedbackGive(userId, selectedProjectName);
return null;
}
@Override
protected void onPostExecute(Void result) {
RadioGroup group = new RadioGroup(FeedbackTypeSelectActivity.this);
group.setOrientation(RadioGroup.HORIZONTAL);
// random id
group.setId(1);
group.setGravity(Gravity.CENTER);
setMargins(group, 35, 50, 35, 10);
int btnDisabledCount = 0;
ArrayList<RadioButton> listOfRadioButtons = new ArrayList<RadioButton>();
int idCount = 100;
if (values != null) {
dateFormat.applyPattern("MMM - yyyy");
String monthYear = dateFormat.format(new Date());
TextView monthTv = new TextView(FeedbackTypeSelectActivity.this);
//csatMonth.setPadding(25, 20, 20, 15);
monthTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
monthTv.setTypeface(null, Typeface.BOLD);
setMargins(monthTv, 25, 20, 25, 15);
monthTv.setText(monthYear.toUpperCase());
monthTv.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
linearLayout.addView(monthTv);
for (ApplicableFeedbacks feedbackType : values) {
RadioButton btn = new RadioButton(
FeedbackTypeSelectActivity.this);
btn.setId(++idCount);
String type = feedbackType.getFeedbackType().trim();
btn.setText(type);
String status = feedbackType.getStatus();
if (status != null && !status.equalsIgnoreCase("null")) {
if (status.equalsIgnoreCase("new")) {
/*btnDisabledCount++;
btn.setEnabled(false);*/
} else if (status.equalsIgnoreCase("conform")
|| status.equalsIgnoreCase("resolved")) {
btn.setEnabled(false);
// btn.setVisibility(View.INVISIBLE);
btnDisabledCount++;
createViewStatusBtn("Check " + type + " status", type, status);
} else /*if (status.equalsIgnoreCase("open")) {
btn.setEnabled(false);
btnDisabledCount++;
} else if (status.equalsIgnoreCase("close")) {*/
{
btn.setEnabled(false);
// btn.setVisibility(View.INVISIBLE);
btnDisabledCount++;
}
}
group.addView(btn);
listOfRadioButtons.add(btn);
}
} else {
Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, NoRecordsFoundActivity.class);
slideactivity.putExtra("message", "No feedback type available, please come back again.");
startActivity(slideactivity);
finish();
}
linearLayout.addView(group);
if (listOfRadioButtons.size() > btnDisabledCount) {
// creating submit button
createSubmitBtn();
}
progressDialog.dismiss();
}
}
private void createViewStatusBtn(String btnLabel, final String feedbackType, String status){
if (status.equalsIgnoreCase("resolved")) {
createStatusLabel(feedbackType + " is resolved.");
} else {
Button submitBtn = new Button(FeedbackTypeSelectActivity.this);
LayoutParams layoutParams = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
submitBtn.setLayoutParams(layoutParams);
submitBtn.setText(btnLabel);
setMargins(submitBtn, 25, 10, 25, 10);
submitBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.button_background));
submitBtn.setTextColor(Color.WHITE);
submitBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
/*RadioGroup radioGroup = (RadioGroup) findViewById(1);
int id = radioGroup.getCheckedRadioButtonId();
View radioButton = radioGroup.findViewById(id);
int radioId = radioGroup.indexOfChild(radioButton);
RadioButton btn = (RadioButton) radioGroup.getChildAt(radioId);
String radioSelection = (String) btn.getText();*/
GetFeedbackStatus feedbackStatus = new GetFeedbackStatus(feedbackType);
feedbackStatus.execute(new String[]{new String("")});
/*Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, RatingScaleNoteActivity.class);
slideactivity.putExtra("feedbackSelected", radioSelection);
startActivity(slideactivity);
finish();*/
}
});
linearLayout.addView(submitBtn);
}
}
private class GetFeedbackStatus extends AsyncTask<String, Void, Void> {
ProgressDialog progressDialog;
String feedbackStatusStr = null;
String feedbackType = null;
public GetFeedbackStatus(String feedbackType) {
this.feedbackType = feedbackType;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(FeedbackTypeSelectActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected Void doInBackground(String... params) {
Utils utils = new Utils();
String userId = ((ApplicationGlobalVariable) getApplication()).getUserId();
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy");
feedbackStatusStr = utils.getFeedbackStatus(userId, feedbackType, sdf.format(d));
return null;
}
@Override
protected void onPostExecute(Void result) {
if (feedbackStatusStr != null) {
Intent slideactivity = new Intent(FeedbackTypeSelectActivity.this, FeedbackStatusActivity.class);
slideactivity.putExtra("feedbackStatus", feedbackStatusStr);
slideactivity.putExtra("selectedProjectName", selectedProjectName);
startActivity(slideactivity);
//finish();
}
/*for (String str : feedbackStatusStr) {
Toast.makeText(getApplicationContext(), str, Toast.LENGTH_LONG).show();
}*/
progressDialog.dismiss();
}
}
}
| 12,618 | 0.723728 | 0.717229 | 401 | 30.466333 | 27.184223 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.134663 | false | false |
3
|
fb79f1bb066f3d105b4983d7a5ed5eae8b72dc42
| 33,887,292,001,578 |
cdcefcd3829ac881635b7b8ece43eae93f1fa461
|
/app/src/main/java/com/example/administrator/tinaya/modules/Equip/widget/PercnetagBar.java
|
e95835e1fee4cd6b9cf95eaeed23520b334df059
|
[] |
no_license
|
Edion-Liu/woyou
|
https://github.com/Edion-Liu/woyou
|
19665e7530af899ca167752b762b2121541f77a2
|
91e046fb238b5e29e667a43d2d2f7c23ce2de7fd
|
refs/heads/master
| 2018-03-24T19:47:57.539000 | 2017-03-31T07:12:04 | 2017-03-31T07:12:23 | 86,788,808 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.administrator.tinaya.modules.Equip.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import com.example.administrator.tinaya.R;
import java.util.List;
/**
* Created by Administrator on 2016/12/5 0005.
*/
public class PercnetagBar extends View {
//画线的画笔
//画柱状图的画笔
private Paint mBarPaint;
//写字的画笔
private Paint mTextPaint;
public PercnetagBar(Context context) {
super(context);
}
public PercnetagBar(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
// 坐标轴 轴线 画笔:
private Paint axisLinePaint;
// 坐标轴水平内部 虚线画笔
private Paint hLinePaint;
// 矩形画笔 柱状图的样式信息
private Paint recPaint;
private void init(Context context, AttributeSet attrs)
{
axisLinePaint = new Paint();
hLinePaint = new Paint();
recPaint = new Paint();
axisLinePaint.setColor(Color.DKGRAY);
hLinePaint.setColor(Color.LTGRAY);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setTextSize(3*60/5);
mTextPaint.setStrokeWidth(2);
mTextPaint.setColor(getResources().getColor(R.color.black));
mBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBarPaint.setColor(0xff40E0D0);
mBarPaint.setStyle(Paint.Style.FILL);
}
//7 条
private int[] thisYear;
/**
* 跟新自身的数据 需要View子类重绘。
*
* 主线程 刷新控件的时候调用:
* this.invalidate(); 失效的意思。
* this.postInvalidate(); 可以子线程 更新视图的方法调用。
*
* */
//updata this year data
public void updateThisData(int[] thisData)
{
thisYear = thisData;
// this.invalidate(); //失效的意思。
this.postInvalidate(); //可以子线程 更新视图的方法调用。
}
public void updateThisTemp(List<String> thistemp)
{
temp =thistemp;
// this.invalidate(); //失效的意思。
this.postInvalidate(); //可以子线程 更新视图的方法调用。
}
private String[] yTitlesStrings =
new String[]{"100","90","80","70","60","50","40","30","20","10","0"};
private String[] xTitles =
new String[]{"净水位", "热水位", "灰水位","污水位","油箱位"};
public List<String> getTemp() {
return temp;
}
public void setTemp(List<String> temp) {
this.temp = temp;
}
private List<String> temp ;
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int width = getWidth();
int height = getHeight();
// Log.e("info",height+"");
// 1 绘制坐标线:
canvas.drawLine(100, 10, 100, 900, axisLinePaint);//
canvas.drawLine(100, 900, width-10 , 900, axisLinePaint);
// 2 绘制坐标内部的水平线
int leftHeight =790;// 左侧外周的 需要划分的高度:
int hPerHeight = leftHeight/10;
hLinePaint.setTextAlign(Paint.Align.CENTER);
for(int i=0;i<10;i++)
{
canvas.drawLine(100, 100+i*hPerHeight, width-10, 100+i*hPerHeight, hLinePaint);
}
// 3 绘制 Y 周坐标
Paint.FontMetrics metrics = mTextPaint.getFontMetrics();
int descent = (int)metrics.descent;
mTextPaint.setTextAlign(Paint.Align.RIGHT);
for(int i=0;i<yTitlesStrings.length;i++)
{
canvas.drawText(yTitlesStrings[i], 80,100+ i*hPerHeight+descent,mTextPaint);
}
// 4 绘制 X 周 做坐标
int xAxisLength = width-110;
int columCount = xTitles.length+1;
int step = xAxisLength/columCount;
for(int i=0;i<columCount-1;i++)
{
canvas.drawText(xTitles[i], 100+step*(i+1)+50, 940 , mTextPaint);
if(temp!=null)
canvas.drawText(temp.get(i), 100+step*(i+1)+35, 980 , mTextPaint);
}
// 5 绘制矩形
if(thisYear != null && thisYear.length >0)
{
int thisCount = thisYear.length;
for(int i=0;i<thisCount;i++)
{
int value = thisYear[i];
// Log.e("info",value+"");
double num = 10 - value / 10.0 ;
recPaint.setColor(0xFF1078CF);
Rect rect = new Rect();
rect.left = 100 + step * (i+1) - 30;
rect.right = 100 + step * (i+1) + 30;
// 当前的相对高度:
int rh = (int) ((leftHeight * num) / 10);
if(num==10.0)
{
rect.top=900;
}
else {
rect.top = rh + 100;
}
rect.bottom = 900 ;
// Log.e("info",rect.top+" "+rect.bottom+" "+rect.left+" "+rect.right);
canvas.drawRect(rect, mBarPaint);
canvas.drawText(Integer.toString(thisYear[i])+"%",rect.right+8,rect.top-20,mTextPaint);
}
}
}
}
|
UTF-8
|
Java
| 5,398 |
java
|
PercnetagBar.java
|
Java
|
[
{
"context": "naya.R;\n\nimport java.util.List;\n\n/**\n * Created by Administrator on 2016/12/5 0005.\n */\npublic class PercnetagBar ",
"end": 380,
"score": 0.8370246887207031,
"start": 367,
"tag": "USERNAME",
"value": "Administrator"
}
] | null |
[] |
package com.example.administrator.tinaya.modules.Equip.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import com.example.administrator.tinaya.R;
import java.util.List;
/**
* Created by Administrator on 2016/12/5 0005.
*/
public class PercnetagBar extends View {
//画线的画笔
//画柱状图的画笔
private Paint mBarPaint;
//写字的画笔
private Paint mTextPaint;
public PercnetagBar(Context context) {
super(context);
}
public PercnetagBar(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
// 坐标轴 轴线 画笔:
private Paint axisLinePaint;
// 坐标轴水平内部 虚线画笔
private Paint hLinePaint;
// 矩形画笔 柱状图的样式信息
private Paint recPaint;
private void init(Context context, AttributeSet attrs)
{
axisLinePaint = new Paint();
hLinePaint = new Paint();
recPaint = new Paint();
axisLinePaint.setColor(Color.DKGRAY);
hLinePaint.setColor(Color.LTGRAY);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setTextSize(3*60/5);
mTextPaint.setStrokeWidth(2);
mTextPaint.setColor(getResources().getColor(R.color.black));
mBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBarPaint.setColor(0xff40E0D0);
mBarPaint.setStyle(Paint.Style.FILL);
}
//7 条
private int[] thisYear;
/**
* 跟新自身的数据 需要View子类重绘。
*
* 主线程 刷新控件的时候调用:
* this.invalidate(); 失效的意思。
* this.postInvalidate(); 可以子线程 更新视图的方法调用。
*
* */
//updata this year data
public void updateThisData(int[] thisData)
{
thisYear = thisData;
// this.invalidate(); //失效的意思。
this.postInvalidate(); //可以子线程 更新视图的方法调用。
}
public void updateThisTemp(List<String> thistemp)
{
temp =thistemp;
// this.invalidate(); //失效的意思。
this.postInvalidate(); //可以子线程 更新视图的方法调用。
}
private String[] yTitlesStrings =
new String[]{"100","90","80","70","60","50","40","30","20","10","0"};
private String[] xTitles =
new String[]{"净水位", "热水位", "灰水位","污水位","油箱位"};
public List<String> getTemp() {
return temp;
}
public void setTemp(List<String> temp) {
this.temp = temp;
}
private List<String> temp ;
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int width = getWidth();
int height = getHeight();
// Log.e("info",height+"");
// 1 绘制坐标线:
canvas.drawLine(100, 10, 100, 900, axisLinePaint);//
canvas.drawLine(100, 900, width-10 , 900, axisLinePaint);
// 2 绘制坐标内部的水平线
int leftHeight =790;// 左侧外周的 需要划分的高度:
int hPerHeight = leftHeight/10;
hLinePaint.setTextAlign(Paint.Align.CENTER);
for(int i=0;i<10;i++)
{
canvas.drawLine(100, 100+i*hPerHeight, width-10, 100+i*hPerHeight, hLinePaint);
}
// 3 绘制 Y 周坐标
Paint.FontMetrics metrics = mTextPaint.getFontMetrics();
int descent = (int)metrics.descent;
mTextPaint.setTextAlign(Paint.Align.RIGHT);
for(int i=0;i<yTitlesStrings.length;i++)
{
canvas.drawText(yTitlesStrings[i], 80,100+ i*hPerHeight+descent,mTextPaint);
}
// 4 绘制 X 周 做坐标
int xAxisLength = width-110;
int columCount = xTitles.length+1;
int step = xAxisLength/columCount;
for(int i=0;i<columCount-1;i++)
{
canvas.drawText(xTitles[i], 100+step*(i+1)+50, 940 , mTextPaint);
if(temp!=null)
canvas.drawText(temp.get(i), 100+step*(i+1)+35, 980 , mTextPaint);
}
// 5 绘制矩形
if(thisYear != null && thisYear.length >0)
{
int thisCount = thisYear.length;
for(int i=0;i<thisCount;i++)
{
int value = thisYear[i];
// Log.e("info",value+"");
double num = 10 - value / 10.0 ;
recPaint.setColor(0xFF1078CF);
Rect rect = new Rect();
rect.left = 100 + step * (i+1) - 30;
rect.right = 100 + step * (i+1) + 30;
// 当前的相对高度:
int rh = (int) ((leftHeight * num) / 10);
if(num==10.0)
{
rect.top=900;
}
else {
rect.top = rh + 100;
}
rect.bottom = 900 ;
// Log.e("info",rect.top+" "+rect.bottom+" "+rect.left+" "+rect.right);
canvas.drawRect(rect, mBarPaint);
canvas.drawText(Integer.toString(thisYear[i])+"%",rect.right+8,rect.top-20,mTextPaint);
}
}
}
}
| 5,398 | 0.553751 | 0.52146 | 199 | 24.045227 | 22.737146 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.663317 | false | false |
3
|
fc4cf0228ec53dd447f090e0cb3047ea8224c1cd
| 8,727,373,590,302 |
9b9a20bcd34f1d9e8cac1f3b3f345a51b4718e26
|
/src/main/java/egovframework/ar/ca/web/ARCAAD01Controller.java
|
4c4c331b3ccebfbb0488417014b01afa70e647cc
|
[] |
no_license
|
pacadmin/ar.pac
|
https://github.com/pacadmin/ar.pac
|
62349db3d0dc20b6fb7c60983596c4e6f2bc1fb0
|
8e11a4444a537267420f7ecd2b89b553ff5846f8
|
refs/heads/master
| 2018-09-09T11:30:46.101000 | 2018-08-24T07:44:07 | 2018-08-24T07:44:07 | 73,781,583 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @Class Name : ARCAAD01Controller.java
* @Description : 중재결정서관리 Controller Class
* @Modification Information
* @
* @ 수정일 수정자 수정내용
* @ --------- --------- -------------------------------
* @ 2010.09.03 Jerry 최초생성
*
* @author Jerry Youn
* @since 2010. 09.03
* @version 1.0
* @see
*
* Copyright (C) by EDSK All right reserved.
*/
package egovframework.ar.ca.web;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import egovframework.ar.ca.service.ARCAAD01Service;
import egovframework.ar.ca.service.ARCAAD01VO;
import egovframework.ar.ca.service.ARCAAD02VO;
import egovframework.ar.cm.service.PECMAR01Service;
import egovframework.ar.cm.service.PECMAR01VO;
import egovframework.ar.cr.service.ARCRAD01Service;
import egovframework.ar.cr.service.ARINDHISTVO;
import egovframework.ar.cr.service.FILELISTVO;
import egovframework.frame.core.PacController;
import egovframework.frame.session.SessionForm;
import egovframework.frame.session.SessionManager;
import egovframework.frame.util.FileUtil;
import egovframework.frame.util.service.FileInfoVO;
@Controller
public class ARCAAD01Controller extends PacController{
/** arcaad01Service */
@Resource(name = "arcaad01Service")
private ARCAAD01Service arcaad01Service;
/** arcrad01Service */
@Resource(name = "arcrad01Service")
private ARCRAD01Service arcrad01Service;
/** pecmar01Service */
@Resource(name = "pecmar01Service")
private PECMAR01Service pecmar01Service;
/**
* 등록정보를 가져온다.
* @param arcaad01VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_C1.do")
public String createFormARCRAD01(@ModelAttribute("arcaad01VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"createFormARCRAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
model.addAttribute("arAplInfo",arcaad01Service.selectAPLINFO(arcaad01VO));
arcaad01VO.setApltDiv("1");
model.addAttribute("arPdiInfo1",arcaad01Service.selectARPDIINfO(arcaad01VO));
model.addAttribute("arTrlPdiInfo1",arcaad01Service.selectARTRLPDIINfO(arcaad01VO));
arcaad01VO.setApltDiv("2");
model.addAttribute("arPdiInfo2",arcaad01Service.selectARPDIINfO(arcaad01VO));
model.addAttribute("arTrlPdiInfo2",arcaad01Service.selectARTRLPDIINfO(arcaad01VO));
model.addAttribute("arMastVO",arcaad01Service.selectARMAST(arcaad01VO));
model.addAttribute("arDemdrsltLst",arcaad01Service.selectARDEMDRSLT(arcaad01VO));
return "/ar/ca/arcaad01_C1";
}
/**
* 결정서를 등록한다.
* @param request
* @param arcaad02VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_C2.do")
public String createARCRAD01(final HttpServletRequest request, @ModelAttribute("arcaad02VO") ARCAAD02VO arcaad02VO, ModelMap model, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"createARCRAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad02VO);
int resultCnt = arcaad01Service.createARCAAD01(arcaad02VO, request);
return "redirect:/ar/ca/arcaad01_R1.do?rcpYy="+ arcaad02VO.getRcpYy() + "&rcpNo=" + arcaad02VO.getRcpNo() + "&chrgMdpt=" + arcaad02VO.getChrgMdpt();
}
/**
* 선택박스의 값을 가져온다
* @param optCode
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_C3.do")
public String selectOptionBox(@RequestParam("optCode")String optCode, @RequestParam("optNum")String optNum, ModelMap model)throws Exception {
model.addAttribute("optList",arcrad01Service.selectOptionBox(optCode));
model.addAttribute("optNum",optNum);
return "/ar/ca/arcaad01_C3";
}
/**
* 결정서를 상세조회한다.
* @param arcaad01VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_R1.do")
public String selectARCAAD01(@ModelAttribute("arcaad01VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"selectARCAAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
String returnValue ="";
model.addAttribute("arMastVO",arcaad01Service.selectARMAST(arcaad01VO));
model.addAttribute("arDemdrsltLst",arcaad01Service.selectARDEMDRSLT(arcaad01VO));
ARCAAD01VO toVo = arcaad01Service.selectARPRTCDEMD(arcaad01VO);
model.addAttribute("arPrtcdemd",toVo); //결정서 정보
model.addAttribute("arFileLst",arcaad01Service.selectFileList(arcaad01VO)); //파일정보
try{
if(toVo.getApltInfoPrt() != null && !"".equals(toVo.getApltInfoPrt())){
returnValue= "/ar/ca/arcaad01_R1";
}else{
returnValue ="redirect:/ar/ca/arcaad01_C1.do?rcpYy="+ arcaad01VO.getRcpYy() + "&rcpNo=" + arcaad01VO.getRcpNo() + "&chrgMdpt=" + arcaad01VO.getChrgMdpt();
}
}catch(Exception ex){
returnValue ="redirect:/ar/ca/arcaad01_C1.do?rcpYy="+ arcaad01VO.getRcpYy() + "&rcpNo=" + arcaad01VO.getRcpNo() + "&chrgMdpt=" + arcaad01VO.getChrgMdpt();
}
return returnValue;
}
/**
* 수정정보를 가져온다.
* @param arcaad01VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_U1.do")
public String updateARCRAD01(@ModelAttribute("arcaad01VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"selectARCAAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
String returnValue ="";
model.addAttribute("arMastVO",arcaad01Service.selectARMAST(arcaad01VO)); //사건기본정보
model.addAttribute("arDemdrsltLst",arcaad01Service.selectARDEMDRSLT(arcaad01VO)); //처리결과
model.addAttribute("arPrtcdemd",arcaad01Service.selectARPRTCDEMD(arcaad01VO)); //결정서 정보
model.addAttribute("arFileLst",arcaad01Service.selectFileList(arcaad01VO)); //파일정보
return "/ar/ca/arcaad01_U1";
}
/**
* 결정서 수정하기
* @param request
* @param arcaad02VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_U2.do")
public String updateARCRAD01(final HttpServletRequest request, @ModelAttribute("arcaad01VO") ARCAAD02VO arcaad02VO, ModelMap model, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"updateARCRAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad02VO);
SessionForm sessionInfo = SessionManager.getSessionManager().getSessionForm(request);
arcaad02VO.setRgId(sessionInfo.getSessionUsrId());
int resultCnt = arcaad01Service.updateARCAAD01(arcaad02VO, request);
return "redirect:/ar/ca/arcaad01_R1.do?rcpYy="+ arcaad02VO.getRcpYy() + "&rcpNo=" + arcaad02VO.getRcpNo() + "&chrgMdpt=" + arcaad02VO.getChrgMdpt();
}
/**
* 결정서를 삭제처리한다.
* @param arcaad01VO
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_D1.do")
public String deleteARCAAD01(@ModelAttribute("arcaad02VO") ARCAAD02VO arcaad02VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"deleteARCAAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad02VO);
arcaad01Service.deleteARCAAD01(arcaad02VO);
return "redirect:/ar/ca/arcaad01_C1.do?rcpYy="+ arcaad02VO.getRcpYy() + "&rcpNo=" + arcaad02VO.getRcpNo() + "&chrgMdpt=" + arcaad02VO.getChrgMdpt();
}
/**
* 첨부파일을 삭제처리한다.
* @param fileListVO
* @param arcrad02VO
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_D2.do")
public String deleteFileList(@ModelAttribute("arcaad02VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response)throws Exception {
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
model.addAttribute("returnValue",arcaad01Service.deleteFile(arcaad01VO));
return "/ar/cr/arcrad01_U1";
}
/**
* 첨부파일 다운로드
* @param response
* @param fileListVo
* @param arcrad02VO
* @param model
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_FileDownload.do")
public void fileDownload(final HttpServletResponse response,
@ModelAttribute("fileListVo") FILELISTVO fileListVo,HttpServletRequest request,
ModelMap model)throws Exception {
String filePath = fileListVo.getFilePath() + fileListVo.getLfileNm();
FileInfoVO fileInfoVO = new FileInfoVO();
// 서버에 저장되어 있는 파일명
fileInfoVO.setSvrFileNm(filePath); //풀경로로 줘야함.....
// 사용자에게 다운로드 될 파일명
fileInfoVO.setFileNm(fileListVo.getPfileNm()); //사용자에게 보여줘야할 파일명
FileUtil.fileDownload(request,response, fileInfoVO);
}
/**
* PDF파일 출력
* @param response
* @param arindhistVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/pdfView.do")
public String PdfView(final HttpServletResponse response, @ModelAttribute("arindhistVO") ARINDHISTVO arindhistVO,ModelMap model) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"PdfView() Start >>>>>");
/*PECMAR01VO pecmar01VO = new PECMAR01VO();
pecmar01VO.setRcpNo(arindhistVO.getRcpNo());
pecmar01VO.setRcpYy(arindhistVO.getRcpYy());
pecmar01VO.setChrgMdpt(arindhistVO.getChrgMdpt());
pecmar01VO.setAtc("2"); //발송
pecmar01VO.setSubmForm("5"); //우편(배)
pecmar01VO.setPdiDiv(""); //당사자구분
pecmar01VO.setRgId(arindhistVO.getRgId());
pecmar01VO.setChId(arindhistVO.getChId());
pecmar01VO.setDtlDes("중재결정서 발송");
pecmar01Service.insertINDPRGDTL(pecmar01VO);*/
return "/ar/pdf/pdfViewer";
}
}
|
UTF-8
|
Java
| 12,484 |
java
|
ARCAAD01Controller.java
|
Java
|
[
{
"context": " -------------------------------\r\n * @ 2010.09.03 Jerry 최초생성\r\n * \r\n * @author Jerry Youn\r\n * @sinc",
"end": 253,
"score": 0.9997262954711914,
"start": 248,
"tag": "NAME",
"value": "Jerry"
},
{
"context": "* @ 2010.09.03 Jerry 최초생성\r\n * \r\n * @author Jerry Youn\r\n * @since 2010. 09.03\r\n * @version 1.0\r\n * @see\r",
"end": 293,
"score": 0.9998733401298523,
"start": 283,
"tag": "NAME",
"value": "Jerry Youn"
},
{
"context": " throws Exception {\r\n \t\r\n \tlogger.debug(\">>> Jerry : \"+this.getClass().getName()+\".\"+\"createFormARCR",
"end": 2337,
"score": 0.9263449907302856,
"start": 2332,
"tag": "NAME",
"value": "Jerry"
}
] | null |
[] |
/**
* @Class Name : ARCAAD01Controller.java
* @Description : 중재결정서관리 Controller Class
* @Modification Information
* @
* @ 수정일 수정자 수정내용
* @ --------- --------- -------------------------------
* @ 2010.09.03 Jerry 최초생성
*
* @author <NAME>
* @since 2010. 09.03
* @version 1.0
* @see
*
* Copyright (C) by EDSK All right reserved.
*/
package egovframework.ar.ca.web;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import egovframework.ar.ca.service.ARCAAD01Service;
import egovframework.ar.ca.service.ARCAAD01VO;
import egovframework.ar.ca.service.ARCAAD02VO;
import egovframework.ar.cm.service.PECMAR01Service;
import egovframework.ar.cm.service.PECMAR01VO;
import egovframework.ar.cr.service.ARCRAD01Service;
import egovframework.ar.cr.service.ARINDHISTVO;
import egovframework.ar.cr.service.FILELISTVO;
import egovframework.frame.core.PacController;
import egovframework.frame.session.SessionForm;
import egovframework.frame.session.SessionManager;
import egovframework.frame.util.FileUtil;
import egovframework.frame.util.service.FileInfoVO;
@Controller
public class ARCAAD01Controller extends PacController{
/** arcaad01Service */
@Resource(name = "arcaad01Service")
private ARCAAD01Service arcaad01Service;
/** arcrad01Service */
@Resource(name = "arcrad01Service")
private ARCRAD01Service arcrad01Service;
/** pecmar01Service */
@Resource(name = "pecmar01Service")
private PECMAR01Service pecmar01Service;
/**
* 등록정보를 가져온다.
* @param arcaad01VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_C1.do")
public String createFormARCRAD01(@ModelAttribute("arcaad01VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"createFormARCRAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
model.addAttribute("arAplInfo",arcaad01Service.selectAPLINFO(arcaad01VO));
arcaad01VO.setApltDiv("1");
model.addAttribute("arPdiInfo1",arcaad01Service.selectARPDIINfO(arcaad01VO));
model.addAttribute("arTrlPdiInfo1",arcaad01Service.selectARTRLPDIINfO(arcaad01VO));
arcaad01VO.setApltDiv("2");
model.addAttribute("arPdiInfo2",arcaad01Service.selectARPDIINfO(arcaad01VO));
model.addAttribute("arTrlPdiInfo2",arcaad01Service.selectARTRLPDIINfO(arcaad01VO));
model.addAttribute("arMastVO",arcaad01Service.selectARMAST(arcaad01VO));
model.addAttribute("arDemdrsltLst",arcaad01Service.selectARDEMDRSLT(arcaad01VO));
return "/ar/ca/arcaad01_C1";
}
/**
* 결정서를 등록한다.
* @param request
* @param arcaad02VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_C2.do")
public String createARCRAD01(final HttpServletRequest request, @ModelAttribute("arcaad02VO") ARCAAD02VO arcaad02VO, ModelMap model, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"createARCRAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad02VO);
int resultCnt = arcaad01Service.createARCAAD01(arcaad02VO, request);
return "redirect:/ar/ca/arcaad01_R1.do?rcpYy="+ arcaad02VO.getRcpYy() + "&rcpNo=" + arcaad02VO.getRcpNo() + "&chrgMdpt=" + arcaad02VO.getChrgMdpt();
}
/**
* 선택박스의 값을 가져온다
* @param optCode
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_C3.do")
public String selectOptionBox(@RequestParam("optCode")String optCode, @RequestParam("optNum")String optNum, ModelMap model)throws Exception {
model.addAttribute("optList",arcrad01Service.selectOptionBox(optCode));
model.addAttribute("optNum",optNum);
return "/ar/ca/arcaad01_C3";
}
/**
* 결정서를 상세조회한다.
* @param arcaad01VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_R1.do")
public String selectARCAAD01(@ModelAttribute("arcaad01VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"selectARCAAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
String returnValue ="";
model.addAttribute("arMastVO",arcaad01Service.selectARMAST(arcaad01VO));
model.addAttribute("arDemdrsltLst",arcaad01Service.selectARDEMDRSLT(arcaad01VO));
ARCAAD01VO toVo = arcaad01Service.selectARPRTCDEMD(arcaad01VO);
model.addAttribute("arPrtcdemd",toVo); //결정서 정보
model.addAttribute("arFileLst",arcaad01Service.selectFileList(arcaad01VO)); //파일정보
try{
if(toVo.getApltInfoPrt() != null && !"".equals(toVo.getApltInfoPrt())){
returnValue= "/ar/ca/arcaad01_R1";
}else{
returnValue ="redirect:/ar/ca/arcaad01_C1.do?rcpYy="+ arcaad01VO.getRcpYy() + "&rcpNo=" + arcaad01VO.getRcpNo() + "&chrgMdpt=" + arcaad01VO.getChrgMdpt();
}
}catch(Exception ex){
returnValue ="redirect:/ar/ca/arcaad01_C1.do?rcpYy="+ arcaad01VO.getRcpYy() + "&rcpNo=" + arcaad01VO.getRcpNo() + "&chrgMdpt=" + arcaad01VO.getChrgMdpt();
}
return returnValue;
}
/**
* 수정정보를 가져온다.
* @param arcaad01VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_U1.do")
public String updateARCRAD01(@ModelAttribute("arcaad01VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"selectARCAAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
String returnValue ="";
model.addAttribute("arMastVO",arcaad01Service.selectARMAST(arcaad01VO)); //사건기본정보
model.addAttribute("arDemdrsltLst",arcaad01Service.selectARDEMDRSLT(arcaad01VO)); //처리결과
model.addAttribute("arPrtcdemd",arcaad01Service.selectARPRTCDEMD(arcaad01VO)); //결정서 정보
model.addAttribute("arFileLst",arcaad01Service.selectFileList(arcaad01VO)); //파일정보
return "/ar/ca/arcaad01_U1";
}
/**
* 결정서 수정하기
* @param request
* @param arcaad02VO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_U2.do")
public String updateARCRAD01(final HttpServletRequest request, @ModelAttribute("arcaad01VO") ARCAAD02VO arcaad02VO, ModelMap model, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"updateARCRAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad02VO);
SessionForm sessionInfo = SessionManager.getSessionManager().getSessionForm(request);
arcaad02VO.setRgId(sessionInfo.getSessionUsrId());
int resultCnt = arcaad01Service.updateARCAAD01(arcaad02VO, request);
return "redirect:/ar/ca/arcaad01_R1.do?rcpYy="+ arcaad02VO.getRcpYy() + "&rcpNo=" + arcaad02VO.getRcpNo() + "&chrgMdpt=" + arcaad02VO.getChrgMdpt();
}
/**
* 결정서를 삭제처리한다.
* @param arcaad01VO
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_D1.do")
public String deleteARCAAD01(@ModelAttribute("arcaad02VO") ARCAAD02VO arcaad02VO, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"deleteARCAAD01() Start >>>>>");
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad02VO);
arcaad01Service.deleteARCAAD01(arcaad02VO);
return "redirect:/ar/ca/arcaad01_C1.do?rcpYy="+ arcaad02VO.getRcpYy() + "&rcpNo=" + arcaad02VO.getRcpNo() + "&chrgMdpt=" + arcaad02VO.getChrgMdpt();
}
/**
* 첨부파일을 삭제처리한다.
* @param fileListVO
* @param arcrad02VO
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_D2.do")
public String deleteFileList(@ModelAttribute("arcaad02VO") ARCAAD01VO arcaad01VO, ModelMap model, HttpServletRequest request, HttpServletResponse response)throws Exception {
// 화면 메뉴리스트 에 셋팅 및 권한 체크.
setUsrInfoAuth(model, request, response);
// 세션 사건 정보 가져오기
SessionManager.getCaseInfo(request, arcaad01VO);
model.addAttribute("returnValue",arcaad01Service.deleteFile(arcaad01VO));
return "/ar/cr/arcrad01_U1";
}
/**
* 첨부파일 다운로드
* @param response
* @param fileListVo
* @param arcrad02VO
* @param model
* @throws Exception
*/
@RequestMapping(value="/ar/ca/arcaad01_FileDownload.do")
public void fileDownload(final HttpServletResponse response,
@ModelAttribute("fileListVo") FILELISTVO fileListVo,HttpServletRequest request,
ModelMap model)throws Exception {
String filePath = fileListVo.getFilePath() + fileListVo.getLfileNm();
FileInfoVO fileInfoVO = new FileInfoVO();
// 서버에 저장되어 있는 파일명
fileInfoVO.setSvrFileNm(filePath); //풀경로로 줘야함.....
// 사용자에게 다운로드 될 파일명
fileInfoVO.setFileNm(fileListVo.getPfileNm()); //사용자에게 보여줘야할 파일명
FileUtil.fileDownload(request,response, fileInfoVO);
}
/**
* PDF파일 출력
* @param response
* @param arindhistVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value="/ar/ca/pdfView.do")
public String PdfView(final HttpServletResponse response, @ModelAttribute("arindhistVO") ARINDHISTVO arindhistVO,ModelMap model) throws Exception {
logger.debug(">>> Jerry : "+this.getClass().getName()+"."+"PdfView() Start >>>>>");
/*PECMAR01VO pecmar01VO = new PECMAR01VO();
pecmar01VO.setRcpNo(arindhistVO.getRcpNo());
pecmar01VO.setRcpYy(arindhistVO.getRcpYy());
pecmar01VO.setChrgMdpt(arindhistVO.getChrgMdpt());
pecmar01VO.setAtc("2"); //발송
pecmar01VO.setSubmForm("5"); //우편(배)
pecmar01VO.setPdiDiv(""); //당사자구분
pecmar01VO.setRgId(arindhistVO.getRgId());
pecmar01VO.setChId(arindhistVO.getChId());
pecmar01VO.setDtlDes("중재결정서 발송");
pecmar01Service.insertINDPRGDTL(pecmar01VO);*/
return "/ar/pdf/pdfViewer";
}
}
| 12,480 | 0.665275 | 0.633924 | 322 | 34.453415 | 37.79414 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.26087 | false | false |
3
|
5e8f69006ddba74fea6b077fbe438dbf41bff833
| 35,579,509,101,797 |
c76480c7d7b2410839c8d71242d698750f929428
|
/problems/CodeChef/FLOW017.java
|
c4dd5fcaade2c69b5d166e1c47faad4569357091
|
[
"MIT"
] |
permissive
|
AravindVasudev/datastructures-and-algorithms
|
https://github.com/AravindVasudev/datastructures-and-algorithms
|
c234ec83768a18a4b184012a0b670e059f64842f
|
42a3089c044846d7b0adf311ec816bd736f2eb06
|
refs/heads/master
| 2023-04-15T15:22:49.544000 | 2023-04-03T07:48:08 | 2023-04-03T07:48:08 | 85,127,389 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Arrays;
import java.util.Scanner;
class FLOW017 {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int testCases = kb.nextInt();
int[] arr = new int[3];
while (testCases-- > 0) {
for (int i = 0; i < 3; i++) arr[i] = kb.nextInt();
Arrays.sort(arr);
System.out.println(arr[1]);
}
}
}
|
UTF-8
|
Java
| 415 |
java
|
FLOW017.java
|
Java
|
[] | null |
[] |
import java.util.Arrays;
import java.util.Scanner;
class FLOW017 {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int testCases = kb.nextInt();
int[] arr = new int[3];
while (testCases-- > 0) {
for (int i = 0; i < 3; i++) arr[i] = kb.nextInt();
Arrays.sort(arr);
System.out.println(arr[1]);
}
}
}
| 415 | 0.520482 | 0.501205 | 17 | 23.411764 | 18.330492 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false |
3
|
104a37b531f15f2a270188149be480512f0832de
| 16,192,026,725,922 |
6b36849674265cc64013f871c5b1d62cca2a0623
|
/src/main/java/controllers/hendlers/creators/DepartmentFromRequest.java
|
931df1753efb815c48442e618b43e76b5e61525e
|
[] |
no_license
|
pavel-bielichenko/departmentsJDBC
|
https://github.com/pavel-bielichenko/departmentsJDBC
|
f4a12eb79397f7a09c8d4627fc352986d730ae72
|
8afa0e8f8a80f036281dc423c1f51433e1676101
|
refs/heads/master
| 2020-12-11T03:34:12.695000 | 2015-04-24T14:39:58 | 2015-04-24T14:39:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package controllers.hendlers.creators;
import models.Department;
import javax.servlet.http.HttpServletRequest;
/**
* Created by pavel on 22.04.15.
*/
public class DepartmentFromRequest {
public static Department createDepartmentByName(HttpServletRequest request){
Department department = new Department();
department.setName(request.getParameter("name"));
return department;
}
public static Department createDepartment(HttpServletRequest request){
Department department = new Department();
department.setId(Integer.valueOf(request.getParameter("id")));
department.setName(request.getParameter("name"));
return department;
}
}
|
UTF-8
|
Java
| 709 |
java
|
DepartmentFromRequest.java
|
Java
|
[
{
"context": "ervlet.http.HttpServletRequest;\n\n/**\n * Created by pavel on 22.04.15.\n */\npublic class DepartmentFromReque",
"end": 137,
"score": 0.9480617046356201,
"start": 132,
"tag": "USERNAME",
"value": "pavel"
}
] | null |
[] |
package controllers.hendlers.creators;
import models.Department;
import javax.servlet.http.HttpServletRequest;
/**
* Created by pavel on 22.04.15.
*/
public class DepartmentFromRequest {
public static Department createDepartmentByName(HttpServletRequest request){
Department department = new Department();
department.setName(request.getParameter("name"));
return department;
}
public static Department createDepartment(HttpServletRequest request){
Department department = new Department();
department.setId(Integer.valueOf(request.getParameter("id")));
department.setName(request.getParameter("name"));
return department;
}
}
| 709 | 0.719323 | 0.71086 | 28 | 24.321428 | 26.286951 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false |
3
|
7791fd95af0e203521fa2c37cf882638aa5ace14
| 34,462,817,613,994 |
94e026e2806352362d1375ae890f032d43b89962
|
/grassroot-core/src/main/java/za/org/grassroot/core/repository/NotificationRepository.java
|
c6048b65af4dcd0089cdf34227e2507412a61a69
|
[] |
no_license
|
Andrew8305/grassroot-platform
|
https://github.com/Andrew8305/grassroot-platform
|
b0a8f448bc9b5423cf7cb2c5f89c00dde21c4155
|
82d4719994f4fce4acaa69d00ee2eec97d4ad34f
|
refs/heads/master
| 2021-06-23T14:51:13.152000 | 2017-08-30T22:06:23 | 2017-08-30T22:06:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package za.org.grassroot.core.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;
import za.org.grassroot.core.domain.Notification;
import za.org.grassroot.core.domain.User;
import java.time.Instant;
import java.util.List;
import java.util.Set;
/**
* Created by paballo on 2016/04/07.
*/
public interface NotificationRepository extends JpaRepository<Notification,Long>, JpaSpecificationExecutor<Notification> {
Notification findByUid(String uid);
List<Notification> findByUidIn(Set<String> uids);
List<Notification> findByTargetAndForAndroidTimelineTrueOrderByCreatedDateTimeDesc(User target);
Page<Notification> findByTargetAndForAndroidTimelineTrueOrderByCreatedDateTimeDesc(User target, Pageable pageable);
List<Notification> findByTargetAndForAndroidTimelineTrueAndCreatedDateTimeGreaterThanOrderByCreatedDateTimeDesc(User target, Instant start);
int countByTargetAndViewedOnAndroidFalseAndForAndroidTimelineTrue(User target);
@Transactional(readOnly = true)
List<Notification> findFirst75ByNextAttemptTimeBeforeOrderByNextAttemptTimeAsc(Instant time);
@Transactional(readOnly = true)
List<Notification> findFirst100ByReadFalseAndAttemptCountGreaterThanAndLastAttemptTimeGreaterThan(int minAttemptCount, Instant lastAttemptTime);
}
|
UTF-8
|
Java
| 1,543 |
java
|
NotificationRepository.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Set;\n\n/**\n * Created by paballo on 2016/04/07.\n */\npublic interface NotificationR",
"end": 527,
"score": 0.9996501207351685,
"start": 520,
"tag": "USERNAME",
"value": "paballo"
}
] | null |
[] |
package za.org.grassroot.core.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;
import za.org.grassroot.core.domain.Notification;
import za.org.grassroot.core.domain.User;
import java.time.Instant;
import java.util.List;
import java.util.Set;
/**
* Created by paballo on 2016/04/07.
*/
public interface NotificationRepository extends JpaRepository<Notification,Long>, JpaSpecificationExecutor<Notification> {
Notification findByUid(String uid);
List<Notification> findByUidIn(Set<String> uids);
List<Notification> findByTargetAndForAndroidTimelineTrueOrderByCreatedDateTimeDesc(User target);
Page<Notification> findByTargetAndForAndroidTimelineTrueOrderByCreatedDateTimeDesc(User target, Pageable pageable);
List<Notification> findByTargetAndForAndroidTimelineTrueAndCreatedDateTimeGreaterThanOrderByCreatedDateTimeDesc(User target, Instant start);
int countByTargetAndViewedOnAndroidFalseAndForAndroidTimelineTrue(User target);
@Transactional(readOnly = true)
List<Notification> findFirst75ByNextAttemptTimeBeforeOrderByNextAttemptTimeAsc(Instant time);
@Transactional(readOnly = true)
List<Notification> findFirst100ByReadFalseAndAttemptCountGreaterThanAndLastAttemptTimeGreaterThan(int minAttemptCount, Instant lastAttemptTime);
}
| 1,543 | 0.84057 | 0.832145 | 37 | 40.702702 | 43.288387 | 148 | false | false | 0 | 0 | 0 | 0 | 92 | 0.110175 | 0.648649 | false | false |
3
|
e73f6c469e82584a642367fcc0c98489204a3dcc
| 38,182,259,266,765 |
48da887dc524dea063e505d70c55e5ca1c716b50
|
/app-services/app-service-impl/app-service/src/main/java/com/hupu/smart/app/service/api/serviceImpl/cache/league/LeagueSchTmsCache.java
|
7e3bd3e0b68822fd1c7e32f42caa7fb8e4c72bc9
|
[] |
no_license
|
ziyerachel/el-game
|
https://github.com/ziyerachel/el-game
|
a78814844c37a2309a7527627a5b5508100528a8
|
8bf304b5fdded996e0012f84c8d018ec7f63603f
|
refs/heads/master
| 2018-01-13T15:38:29.028000 | 2017-03-14T08:26:51 | 2017-03-14T08:26:51 | 82,893,269 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hupu.smart.app.service.api.serviceImpl.cache.league;
import com.hupu.smart.app.service.api.interfaces.game.domain.LeagueSchedule;
import com.hupu.smart.app.service.api.serviceImpl.cache.DataTimestampCache;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* - ┏┓ ┏┓
* - ┏┛┻━━━┛┻┓
* - ┃ ━ ┃
* - ┃ ┳┛ ┗┳ ┃
* - ┃ ┃
* - ┃ ┻ ┃
* - ┗━┓ ┏━┛
* - ┃ ┃
* - ┃\ /┃
* - ┃ \ / ┗━━━━┓
* - ┃ @ ┣┓
* - ┃ ┏┛
* - ┗┓┓┏━┳┓┏━┛
* - ┃┫┫ ┃┫┫
* - ┗┻┛ ┗┻┛
* - 神兽保佑
* - 代码无BUG!
* Created by luhongning@huiti.com on 2016/12/15.
*/
@Service
public class LeagueSchTmsCache extends DataTimestampCache<LeagueSchedule> {
private static Logger logger = LoggerFactory.getLogger(LeagueSchTmsCache.class);
private final static String GAME_LEAGUE_SCHEDULE = "game:league:schedule:";
@Override
protected long timeoutTime() {
return 30 * 60;
}
@Override
protected long cleanTime() {
return 60 * 60;
}
@Override
protected Logger getLog() {
return logger;
}
@Override
public String genKey(String orgKey) {
if (StringUtils.isBlank(orgKey)) {
return "";
}
return GAME_LEAGUE_SCHEDULE + orgKey;
}
@Override
protected boolean isAutoClean() {
return true;
}
}
|
UTF-8
|
Java
| 1,731 |
java
|
LeagueSchTmsCache.java
|
Java
|
[
{
"context": " * - 神兽保佑\n * - 代码无BUG!\n * Created by luhongning@huiti.com on 2016/12/15.\n */\n@Service\npublic class LeagueSc",
"end": 707,
"score": 0.9999327659606934,
"start": 687,
"tag": "EMAIL",
"value": "luhongning@huiti.com"
}
] | null |
[] |
package com.hupu.smart.app.service.api.serviceImpl.cache.league;
import com.hupu.smart.app.service.api.interfaces.game.domain.LeagueSchedule;
import com.hupu.smart.app.service.api.serviceImpl.cache.DataTimestampCache;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* - ┏┓ ┏┓
* - ┏┛┻━━━┛┻┓
* - ┃ ━ ┃
* - ┃ ┳┛ ┗┳ ┃
* - ┃ ┃
* - ┃ ┻ ┃
* - ┗━┓ ┏━┛
* - ┃ ┃
* - ┃\ /┃
* - ┃ \ / ┗━━━━┓
* - ┃ @ ┣┓
* - ┃ ┏┛
* - ┗┓┓┏━┳┓┏━┛
* - ┃┫┫ ┃┫┫
* - ┗┻┛ ┗┻┛
* - 神兽保佑
* - 代码无BUG!
* Created by <EMAIL> on 2016/12/15.
*/
@Service
public class LeagueSchTmsCache extends DataTimestampCache<LeagueSchedule> {
private static Logger logger = LoggerFactory.getLogger(LeagueSchTmsCache.class);
private final static String GAME_LEAGUE_SCHEDULE = "game:league:schedule:";
@Override
protected long timeoutTime() {
return 30 * 60;
}
@Override
protected long cleanTime() {
return 60 * 60;
}
@Override
protected Logger getLog() {
return logger;
}
@Override
public String genKey(String orgKey) {
if (StringUtils.isBlank(orgKey)) {
return "";
}
return GAME_LEAGUE_SCHEDULE + orgKey;
}
@Override
protected boolean isAutoClean() {
return true;
}
}
| 1,718 | 0.559838 | 0.546991 | 63 | 22.476191 | 21.448984 | 84 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.238095 | false | false |
3
|
7b3565c3c99c424b49d39c37fb68e0f8fa060269
| 34,428,457,880,394 |
141306e92ead4d5b44a5c95340758fd3806e1aba
|
/app/src/main/java/pl/edu/pjwstk/s11959/nawadnianie/MainActivity.java
|
e33c47f0423f7f6da0a837d81e94731439ee3f93
|
[
"MIT"
] |
permissive
|
my4n/apka_nawadnianie
|
https://github.com/my4n/apka_nawadnianie
|
4447af13bcc479001f56ed322d6d46174524f267
|
649de06d01f2cf9a3b9ec34980398acd942fd0be
|
refs/heads/master
| 2020-02-29T18:09:33.155000 | 2017-05-06T12:19:08 | 2017-05-06T12:19:08 | 89,928,087 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pl.edu.pjwstk.s11959.nawadnianie;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import pl.edu.pjwstk.s11959.nawadnianie.android.Notificator;
import pl.edu.pjwstk.s11959.nawadnianie.day.HourMinute;
import pl.edu.pjwstk.s11959.nawadnianie.day.IndexedWaterBreak;
import pl.edu.pjwstk.s11959.nawadnianie.day.Schedule;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private Persistencer persistencer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
persistencer = new Persistencer(getApplicationContext());
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Schedule schedule = persistencer.readOrDefaultSchedule();
Notificator notificator = new Notificator(this);
List<IndexedWaterBreak> futureWaterBreaks = schedule.getFutureWaterBreaks(new Date());
for (IndexedWaterBreak futureWaterBreak : futureWaterBreaks) {
notificator.createNotification(futureWaterBreak.getHourMinute().defaultString(),createDate(futureWaterBreak.getHourMinute()), futureWaterBreak.getIndex());
}
TextView mlText = (TextView) findViewById(R.id.text_view_drink_amount);
mlText.setText(schedule.getDrunkWater().getMilliliters() + " ml");
ListView listView = (ListView) findViewById(R.id.list_main);
listView.setAdapter(new ScheduleAdapter(inflater, schedule, this));
actionBar();
}
private void actionBar() {
ActionBar mActionBar = getSupportActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.action_bar, null);
ImageButton settingButton = (ImageButton) mCustomView.findViewById(R.id.settings_button);
final Intent intent = new Intent(this, SettingsActivity.class);
settingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
startActivity(intent);
}
});
mActionBar.setCustomView(mCustomView);
mActionBar.setDisplayShowCustomEnabled(true);
}
private Date createDate(HourMinute hourMinute) {
// FIXME: it does not work with WaterBreaks after 0:00 / 12:00 AM
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, hourMinute.getHour());
cal.set(Calendar.MINUTE, hourMinute.getMinute());
return cal.getTime();
}
}
|
UTF-8
|
Java
| 2,913 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package pl.edu.pjwstk.s11959.nawadnianie;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import pl.edu.pjwstk.s11959.nawadnianie.android.Notificator;
import pl.edu.pjwstk.s11959.nawadnianie.day.HourMinute;
import pl.edu.pjwstk.s11959.nawadnianie.day.IndexedWaterBreak;
import pl.edu.pjwstk.s11959.nawadnianie.day.Schedule;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private Persistencer persistencer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
persistencer = new Persistencer(getApplicationContext());
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Schedule schedule = persistencer.readOrDefaultSchedule();
Notificator notificator = new Notificator(this);
List<IndexedWaterBreak> futureWaterBreaks = schedule.getFutureWaterBreaks(new Date());
for (IndexedWaterBreak futureWaterBreak : futureWaterBreaks) {
notificator.createNotification(futureWaterBreak.getHourMinute().defaultString(),createDate(futureWaterBreak.getHourMinute()), futureWaterBreak.getIndex());
}
TextView mlText = (TextView) findViewById(R.id.text_view_drink_amount);
mlText.setText(schedule.getDrunkWater().getMilliliters() + " ml");
ListView listView = (ListView) findViewById(R.id.list_main);
listView.setAdapter(new ScheduleAdapter(inflater, schedule, this));
actionBar();
}
private void actionBar() {
ActionBar mActionBar = getSupportActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.action_bar, null);
ImageButton settingButton = (ImageButton) mCustomView.findViewById(R.id.settings_button);
final Intent intent = new Intent(this, SettingsActivity.class);
settingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
startActivity(intent);
}
});
mActionBar.setCustomView(mCustomView);
mActionBar.setDisplayShowCustomEnabled(true);
}
private Date createDate(HourMinute hourMinute) {
// FIXME: it does not work with WaterBreaks after 0:00 / 12:00 AM
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, hourMinute.getHour());
cal.set(Calendar.MINUTE, hourMinute.getMinute());
return cal.getTime();
}
}
| 2,913 | 0.764504 | 0.752832 | 83 | 34.096386 | 30.197189 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.674699 | false | false |
3
|
f8e7159815bcc36c8f9ec7280991b35ffce8eec9
| 34,591,666,625,033 |
aa3b9858efe8d73fb8ad41e4d43bbb2cb2fa6f71
|
/UldServer/.svn/pristine/62/6292630ceaf0470bdf8772ae2aebccb10083e1cb.svn-base
|
d9dcb77f7c2ede3e5a5e6dbc9ad18ac46e9677cb
|
[] |
no_license
|
s-Heart/Sdk
|
https://github.com/s-Heart/Sdk
|
3eba33e78f01f71187424aacf2107868673af2c8
|
1c64265e10283eaed5b75bbc770d67cf5a544af4
|
refs/heads/master
| 2021-01-22T11:37:32.736000 | 2015-08-08T04:55:38 | 2015-08-08T04:55:38 | 40,389,270 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package wh.shop.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import uld.sdk.tools.Utility;
public class ViewLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 无参构造函数
*/
public ViewLog(){
;
}
private int viewLogId;
/**
* 获取浏览日志编号
* @return 浏览日志编号
*/
public int getViewLogId()
{
return viewLogId;
}
/**
* 设置浏览日志编号
* @param 浏览日志编号
*/
public void setViewLogId(int value)
{
viewLogId = value;
}
private wh.member.model.User user;
/**
* 获取用户
* @return 用户
*/
public wh.member.model.User getUser(){
return this.user;
}
/**
* 设置用户
* @param user 用户
*/
public void setUser(wh.member.model.User user){
this.user = user;
}
private int userId;
/**
* 获取用户编号
* @return 用户编号
*/
public int getUserId(){
if(user != null){
return user.getUserId();
}else{
return userId;
}
}
/**
* 设置用户编号
* @param 用户编号
*/
public void setUserId(int value){
if(user != null){
user.setUserId(value);
}else{
userId = value;
}
}
/**
* 获取用户名称
* @return 用户名称
*/
public String getUserName(){
if(user != null){
return user.getUserName();
}else{
return "";
}
}
private wh.shop.model.Goods goods;
/**
* 获取商品
* @return 商品
*/
public wh.shop.model.Goods getGoods(){
return this.goods;
}
/**
* 设置商品
* @param goods 商品
*/
public void setGoods(wh.shop.model.Goods goods){
this.goods = goods;
}
private int goodsId;
/**
* 获取商品编号
* @return 商品编号
*/
public int getGoodsId(){
if(goods != null){
return goods.getGoodsId();
}else{
return goodsId;
}
}
/**
* 设置商品编号
* @param 商品编号
*/
public void setGoodsId(int value){
if(goods != null){
goods.setGoodsId(value);
}else{
goodsId = value;
}
}
/**
* 获取商品名称
* @return 商品名称
*/
public String getGoodsName(){
if(goods != null){
return goods.getName();
}else{
return "";
}
}
private Date createDate;
/**
* 获取创建日期
* @return 创建日期
*/
public Date getCreateDate()
{
if(createDate == null){
return Utility.getDbMinDate();
}
return createDate;
}
/**
* 设置创建日期
* @param 创建日期
*/
public void setCreateDate(Date value)
{
createDate = value;
}
private Date createDateBegin;
/**
* 获取创建日期
* @return 创建日期
*/
public Date getCreateDateBegin()
{
if(createDateBegin == null){
return Utility.getDbMinDate();
}
return createDateBegin;
}
/**
* 设置创建日期
* @param 创建日期
*/
public void setCreateDateBegin(Date value)
{
createDateBegin = value;
}
private Date createDateEnd;
/**
* 获取创建日期
* @return 创建日期
*/
public Date getCreateDateEnd()
{
if(createDateEnd == null){
return Utility.getDbMinDate();
}
return createDateEnd;
}
/**
* 设置创建日期
* @param 创建日期
*/
public void setCreateDateEnd(Date value)
{
createDateEnd = value;
}
private int createDateDay;
/**
* 获取创建日期天,eg:20110101
* @return 创建日期天,eg:20110101
*/
public int getCreateDateDay()
{
return createDateDay;
}
/**
* 设置创建日期天,eg:20110101
* @param 创建日期天,eg:20110101
*/
public void setCreateDateDay(int value)
{
createDateDay = value;
}
private int createDateMonth;
/**
* 获取创建日期月,eg:201101
* @return 创建日期月,eg:201101
*/
public int getCreateDateMonth()
{
return createDateMonth;
}
/**
* 设置创建日期月,eg:201101
* @param 创建日期月,eg:201101
*/
public void setCreateDateMonth(int value)
{
createDateMonth = value;
}
private int createDateYear;
/**
* 获取创建日期年,eg:2011
* @return 创建日期年,eg:2011
*/
public int getCreateDateYear()
{
return createDateYear;
}
/**
* 设置创建日期年,eg:2011
* @param 创建日期年,eg:2011
*/
public void setCreateDateYear(int value)
{
createDateYear = value;
}
}
|
UTF-8
|
Java
| 4,348 |
6292630ceaf0470bdf8772ae2aebccb10083e1cb.svn-base
|
Java
|
[] | null |
[] |
package wh.shop.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import uld.sdk.tools.Utility;
public class ViewLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 无参构造函数
*/
public ViewLog(){
;
}
private int viewLogId;
/**
* 获取浏览日志编号
* @return 浏览日志编号
*/
public int getViewLogId()
{
return viewLogId;
}
/**
* 设置浏览日志编号
* @param 浏览日志编号
*/
public void setViewLogId(int value)
{
viewLogId = value;
}
private wh.member.model.User user;
/**
* 获取用户
* @return 用户
*/
public wh.member.model.User getUser(){
return this.user;
}
/**
* 设置用户
* @param user 用户
*/
public void setUser(wh.member.model.User user){
this.user = user;
}
private int userId;
/**
* 获取用户编号
* @return 用户编号
*/
public int getUserId(){
if(user != null){
return user.getUserId();
}else{
return userId;
}
}
/**
* 设置用户编号
* @param 用户编号
*/
public void setUserId(int value){
if(user != null){
user.setUserId(value);
}else{
userId = value;
}
}
/**
* 获取用户名称
* @return 用户名称
*/
public String getUserName(){
if(user != null){
return user.getUserName();
}else{
return "";
}
}
private wh.shop.model.Goods goods;
/**
* 获取商品
* @return 商品
*/
public wh.shop.model.Goods getGoods(){
return this.goods;
}
/**
* 设置商品
* @param goods 商品
*/
public void setGoods(wh.shop.model.Goods goods){
this.goods = goods;
}
private int goodsId;
/**
* 获取商品编号
* @return 商品编号
*/
public int getGoodsId(){
if(goods != null){
return goods.getGoodsId();
}else{
return goodsId;
}
}
/**
* 设置商品编号
* @param 商品编号
*/
public void setGoodsId(int value){
if(goods != null){
goods.setGoodsId(value);
}else{
goodsId = value;
}
}
/**
* 获取商品名称
* @return 商品名称
*/
public String getGoodsName(){
if(goods != null){
return goods.getName();
}else{
return "";
}
}
private Date createDate;
/**
* 获取创建日期
* @return 创建日期
*/
public Date getCreateDate()
{
if(createDate == null){
return Utility.getDbMinDate();
}
return createDate;
}
/**
* 设置创建日期
* @param 创建日期
*/
public void setCreateDate(Date value)
{
createDate = value;
}
private Date createDateBegin;
/**
* 获取创建日期
* @return 创建日期
*/
public Date getCreateDateBegin()
{
if(createDateBegin == null){
return Utility.getDbMinDate();
}
return createDateBegin;
}
/**
* 设置创建日期
* @param 创建日期
*/
public void setCreateDateBegin(Date value)
{
createDateBegin = value;
}
private Date createDateEnd;
/**
* 获取创建日期
* @return 创建日期
*/
public Date getCreateDateEnd()
{
if(createDateEnd == null){
return Utility.getDbMinDate();
}
return createDateEnd;
}
/**
* 设置创建日期
* @param 创建日期
*/
public void setCreateDateEnd(Date value)
{
createDateEnd = value;
}
private int createDateDay;
/**
* 获取创建日期天,eg:20110101
* @return 创建日期天,eg:20110101
*/
public int getCreateDateDay()
{
return createDateDay;
}
/**
* 设置创建日期天,eg:20110101
* @param 创建日期天,eg:20110101
*/
public void setCreateDateDay(int value)
{
createDateDay = value;
}
private int createDateMonth;
/**
* 获取创建日期月,eg:201101
* @return 创建日期月,eg:201101
*/
public int getCreateDateMonth()
{
return createDateMonth;
}
/**
* 设置创建日期月,eg:201101
* @param 创建日期月,eg:201101
*/
public void setCreateDateMonth(int value)
{
createDateMonth = value;
}
private int createDateYear;
/**
* 获取创建日期年,eg:2011
* @return 创建日期年,eg:2011
*/
public int getCreateDateYear()
{
return createDateYear;
}
/**
* 设置创建日期年,eg:2011
* @param 创建日期年,eg:2011
*/
public void setCreateDateYear(int value)
{
createDateYear = value;
}
}
| 4,348 | 0.615061 | 0.59584 | 275 | 12.8 | 12.144883 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.410909 | false | false |
3
|
|
fe1fecd9053bf276450480633b1c0552712eda56
| 38,671,885,545,005 |
c3b8f80d8d99c5124aefb55de0e1d4bddb3f3874
|
/src/main/java/com/walmart/warehouse/rest/model/Shelf.java
|
d98a54eb5f3cc2f9852305ec35ef2df938f00225
|
[
"MIT"
] |
permissive
|
Kingpin007/Warehouse-Management
|
https://github.com/Kingpin007/Warehouse-Management
|
f65315becc410dd32a2ef13a78b1b55e26fe941a
|
3fa093ac921954cc2ecbb9f1ff2cb83f7dfc8b4d
|
refs/heads/master
| 2020-04-28T00:55:20.782000 | 2019-03-13T09:36:15 | 2019-03-13T09:36:15 | 174,833,993 | 0 | 6 |
MIT
| false | 2019-03-12T20:29:25 | 2019-03-10T14:22:20 | 2019-03-12T20:29:09 | 2019-03-12T20:29:25 | 51 | 0 | 2 | 0 |
Java
| false | null |
package com.walmart.warehouse.rest.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Shelf {
private String shelfName;
private Double latitude;
private Double longitude;
private Double elevation;
private Double productQuantity;
private Double maxQuantity;
}
|
UTF-8
|
Java
| 361 |
java
|
Shelf.java
|
Java
|
[] | null |
[] |
package com.walmart.warehouse.rest.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Shelf {
private String shelfName;
private Double latitude;
private Double longitude;
private Double elevation;
private Double productQuantity;
private Double maxQuantity;
}
| 361 | 0.811634 | 0.811634 | 18 | 19.111111 | 16.512247 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
3
|
6bea33e1614996bcf14d0b40ac465a231d7c1be1
| 34,754,875,398,374 |
71b54b9599df1c8104d46d08a3a0c33997248a9a
|
/java8/src/test/java/kz/tanat/recommendation/RecommenderTest.java
|
9e37fba7c9f47faded79f58ef9f2f42e42737ffb
|
[] |
no_license
|
Researcher86/java-sample
|
https://github.com/Researcher86/java-sample
|
beb3ea62b31f8d5c78ac529cb32c89026a16b510
|
7c73265c6dee989c921c19fa49c25babda02136b
|
refs/heads/master
| 2018-09-04T21:57:32.298000 | 2018-08-29T01:24:03 | 2018-08-29T01:24:03 | 114,628,379 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package kz.tanat.recommendation;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.core.IsCollectionContaining.hasItems;
import static org.junit.Assert.assertThat;
/**
* @author Tanat
* @version 1.1
* @since 14.06.17.
*/
public class RecommenderTest {
private List<Critic> criticList;
private EuclideanDistance euclideanDistance;
private CoefficientPearson correlationPearson;
private Recommender recommender;
private Critic toby;
@Before
public void setUp() throws Exception {
criticList = TestData.create();
euclideanDistance = new EuclideanDistance();
correlationPearson = new CoefficientPearson();
toby = criticList.stream().filter(critic -> critic.equals(new Critic("Toby"))).findFirst().get();
}
@Test
public void topMatches() throws Exception {
recommender = new Recommender(criticList, correlationPearson);
List<Ratio> ratios = recommender.topMatches(toby);
assertThat(ratios, hasItems(
new Ratio("Lisa Rose", 0.9912407071619299),
new Ratio("Mick LaSalle", 0.9244734516419049),
new Ratio("Claudia Puig", 0.8934051474415647),
new Ratio("Jack Matthews", 0.66284898035987),
new Ratio("Gene Seymour", 0.38124642583151164),
new Ratio("Michael Phillips", -1.0)
));
}
@Test
public void getRecommendationsEuclideanDistance() throws Exception {
recommender = new Recommender(criticList, euclideanDistance);
List<Ratio> ratios = recommender.recommendedTo(toby);
assertThat(ratios, hasItems(
new Ratio("The Night Listener", 3.5002478401415877),
new Ratio("Lady in the Water", 2.7561242939959363),
new Ratio("Just My Luck", 2.461988486074374)
));
}
@Test
public void getRecommendationsCoefficientPearson() throws Exception {
recommender = new Recommender(criticList, correlationPearson);
List<Ratio> ratios = recommender.recommendedTo(toby);
assertThat(ratios, hasItems(
new Ratio("The Night Listener", 3.3477895267131017),
new Ratio("Lady in the Water", 2.8325499182641614),
new Ratio("Just My Luck", 2.530980703765565)
));
}
@Test
public void getRecommendationsCoefficientPearsonThenTrack7() throws Exception {
Critic c1 = new Critic("User1");
c1.addRating(new Rating("Track1", 1));
c1.addRating(new Rating("Track2", 1));
c1.addRating(new Rating("Track3", 3));
c1.addRating(new Rating("Track4", 3));
c1.addRating(new Rating("Track5", 3));
c1.addRating(new Rating("Track6", -2));
Critic c2 = new Critic("User2");
c2.addRating(new Rating("Track1", 1));
c2.addRating(new Rating("Track2", 1));
c2.addRating(new Rating("Track3", 1));
c2.addRating(new Rating("Track4", 3));
c2.addRating(new Rating("Track5", 3));
Critic c3 = new Critic("User3");
c3.addRating(new Rating("Track1", 1));
c3.addRating(new Rating("Track2", 1));
c3.addRating(new Rating("Track3", 1));
c3.addRating(new Rating("Track4", 3));
c3.addRating(new Rating("Track5", 3));
c3.addRating(new Rating("Track6", 2));
c3.addRating(new Rating("Track7", 1));
recommender = new Recommender(Arrays.asList(c1, c2, c3), correlationPearson);
List<Ratio> ratios = recommender.recommendedTo(c1);
assertThat(ratios, hasItems(
new Ratio("Track7", 1)
));
}
@Test
public void getRecommendationsCoefficientPearsonThenEmpty() throws Exception {
Critic c1 = new Critic("User1");
c1.addRating(new Rating("Track1", 1));
c1.addRating(new Rating("Track2", 1));
c1.addRating(new Rating("Track3", 3));
c1.addRating(new Rating("Track4", 3));
c1.addRating(new Rating("Track5", 3));
c1.addRating(new Rating("Track6", -2));
Critic c2 = new Critic("User2");
c2.addRating(new Rating("Track1", 1));
c2.addRating(new Rating("Track2", 1));
c2.addRating(new Rating("Track3", 1));
c2.addRating(new Rating("Track4", 3));
c2.addRating(new Rating("Track5", 3));
Critic c3 = new Critic("User3");
c3.addRating(new Rating("Track1", 1));
c3.addRating(new Rating("Track2", 1));
c3.addRating(new Rating("Track3", 1));
c3.addRating(new Rating("Track4", 3));
c3.addRating(new Rating("Track5", 3));
c3.addRating(new Rating("Track6", 2));
recommender = new Recommender(Arrays.asList(c1, c2, c3), correlationPearson);
List<Ratio> ratios = recommender.recommendedTo(c1);
assertThat(ratios, is(empty()));
}
}
|
UTF-8
|
Java
| 5,016 |
java
|
RecommenderTest.java
|
Java
|
[
{
"context": "tatic org.junit.Assert.assertThat;\n\n/**\n * @author Tanat\n * @version 1.1\n * @since 14.06.17.\n */\npublic cl",
"end": 348,
"score": 0.996170699596405,
"start": 343,
"tag": "NAME",
"value": "Tanat"
},
{
"context": "That(ratios, hasItems(\n new Ratio(\"Lisa Rose\", 0.9912407071619299),\n new Ratio(",
"end": 1199,
"score": 0.999849796295166,
"start": 1190,
"tag": "NAME",
"value": "Lisa Rose"
},
{
"context": ", 0.9912407071619299),\n new Ratio(\"Mick LaSalle\", 0.9244734516419049),\n new Ratio(",
"end": 1262,
"score": 0.999886155128479,
"start": 1250,
"tag": "NAME",
"value": "Mick LaSalle"
},
{
"context": ", 0.9244734516419049),\n new Ratio(\"Claudia Puig\", 0.8934051474415647),\n new Ratio(",
"end": 1325,
"score": 0.9998955726623535,
"start": 1313,
"tag": "NAME",
"value": "Claudia Puig"
},
{
"context": ", 0.8934051474415647),\n new Ratio(\"Jack Matthews\", 0.66284898035987),\n new Ratio(\"G",
"end": 1389,
"score": 0.9998756051063538,
"start": 1376,
"tag": "NAME",
"value": "Jack Matthews"
},
{
"context": "s\", 0.66284898035987),\n new Ratio(\"Gene Seymour\", 0.38124642583151164),\n new Ratio",
"end": 1450,
"score": 0.9998909831047058,
"start": 1438,
"tag": "NAME",
"value": "Gene Seymour"
},
{
"context": " 0.38124642583151164),\n new Ratio(\"Michael Phillips\", -1.0)\n ));\n }\n\n @Test\n public v",
"end": 1518,
"score": 0.999844491481781,
"start": 1502,
"tag": "NAME",
"value": "Michael Phillips"
}
] | null |
[] |
package kz.tanat.recommendation;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.core.IsCollectionContaining.hasItems;
import static org.junit.Assert.assertThat;
/**
* @author Tanat
* @version 1.1
* @since 14.06.17.
*/
public class RecommenderTest {
private List<Critic> criticList;
private EuclideanDistance euclideanDistance;
private CoefficientPearson correlationPearson;
private Recommender recommender;
private Critic toby;
@Before
public void setUp() throws Exception {
criticList = TestData.create();
euclideanDistance = new EuclideanDistance();
correlationPearson = new CoefficientPearson();
toby = criticList.stream().filter(critic -> critic.equals(new Critic("Toby"))).findFirst().get();
}
@Test
public void topMatches() throws Exception {
recommender = new Recommender(criticList, correlationPearson);
List<Ratio> ratios = recommender.topMatches(toby);
assertThat(ratios, hasItems(
new Ratio("<NAME>", 0.9912407071619299),
new Ratio("<NAME>", 0.9244734516419049),
new Ratio("<NAME>", 0.8934051474415647),
new Ratio("<NAME>", 0.66284898035987),
new Ratio("<NAME>", 0.38124642583151164),
new Ratio("<NAME>", -1.0)
));
}
@Test
public void getRecommendationsEuclideanDistance() throws Exception {
recommender = new Recommender(criticList, euclideanDistance);
List<Ratio> ratios = recommender.recommendedTo(toby);
assertThat(ratios, hasItems(
new Ratio("The Night Listener", 3.5002478401415877),
new Ratio("Lady in the Water", 2.7561242939959363),
new Ratio("Just My Luck", 2.461988486074374)
));
}
@Test
public void getRecommendationsCoefficientPearson() throws Exception {
recommender = new Recommender(criticList, correlationPearson);
List<Ratio> ratios = recommender.recommendedTo(toby);
assertThat(ratios, hasItems(
new Ratio("The Night Listener", 3.3477895267131017),
new Ratio("Lady in the Water", 2.8325499182641614),
new Ratio("Just My Luck", 2.530980703765565)
));
}
@Test
public void getRecommendationsCoefficientPearsonThenTrack7() throws Exception {
Critic c1 = new Critic("User1");
c1.addRating(new Rating("Track1", 1));
c1.addRating(new Rating("Track2", 1));
c1.addRating(new Rating("Track3", 3));
c1.addRating(new Rating("Track4", 3));
c1.addRating(new Rating("Track5", 3));
c1.addRating(new Rating("Track6", -2));
Critic c2 = new Critic("User2");
c2.addRating(new Rating("Track1", 1));
c2.addRating(new Rating("Track2", 1));
c2.addRating(new Rating("Track3", 1));
c2.addRating(new Rating("Track4", 3));
c2.addRating(new Rating("Track5", 3));
Critic c3 = new Critic("User3");
c3.addRating(new Rating("Track1", 1));
c3.addRating(new Rating("Track2", 1));
c3.addRating(new Rating("Track3", 1));
c3.addRating(new Rating("Track4", 3));
c3.addRating(new Rating("Track5", 3));
c3.addRating(new Rating("Track6", 2));
c3.addRating(new Rating("Track7", 1));
recommender = new Recommender(Arrays.asList(c1, c2, c3), correlationPearson);
List<Ratio> ratios = recommender.recommendedTo(c1);
assertThat(ratios, hasItems(
new Ratio("Track7", 1)
));
}
@Test
public void getRecommendationsCoefficientPearsonThenEmpty() throws Exception {
Critic c1 = new Critic("User1");
c1.addRating(new Rating("Track1", 1));
c1.addRating(new Rating("Track2", 1));
c1.addRating(new Rating("Track3", 3));
c1.addRating(new Rating("Track4", 3));
c1.addRating(new Rating("Track5", 3));
c1.addRating(new Rating("Track6", -2));
Critic c2 = new Critic("User2");
c2.addRating(new Rating("Track1", 1));
c2.addRating(new Rating("Track2", 1));
c2.addRating(new Rating("Track3", 1));
c2.addRating(new Rating("Track4", 3));
c2.addRating(new Rating("Track5", 3));
Critic c3 = new Critic("User3");
c3.addRating(new Rating("Track1", 1));
c3.addRating(new Rating("Track2", 1));
c3.addRating(new Rating("Track3", 1));
c3.addRating(new Rating("Track4", 3));
c3.addRating(new Rating("Track5", 3));
c3.addRating(new Rating("Track6", 2));
recommender = new Recommender(Arrays.asList(c1, c2, c3), correlationPearson);
List<Ratio> ratios = recommender.recommendedTo(c1);
assertThat(ratios, is(empty()));
}
}
| 4,978 | 0.625 | 0.560805 | 143 | 34.083916 | 25.001957 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.013986 | false | false |
3
|
f618bde1970de1feb077ddbf8dd3a90afcad5edc
| 28,948,079,579,500 |
1f20c0b33e49060124ce8ba92d0901386e1d78d7
|
/micirclews/src/main/java/com/example/mymodule/datalayer/userProfile/DLEmail.java
|
f633f4585c18abe2a80549d16083e37bc25d85b6
|
[] |
no_license
|
yassirasad/mi-circle-backend
|
https://github.com/yassirasad/mi-circle-backend
|
530655ac39697645fa72da738bfcf63d38cb52f8
|
8f50e33f9569f7bddbb48a16ffabc994d5ba1a52
|
refs/heads/master
| 2022-11-25T09:30:19.246000 | 2020-07-22T17:15:29 | 2020-07-22T17:15:29 | 281,719,241 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.mymodule.datalayer.userProfile;
import com.example.mymodule.businessObject.common.ApiResponse;
import com.example.mymodule.businessObject.common.Constants;
import com.example.mymodule.businessObject.common.DeviceSessionEntity;
import com.example.mymodule.businessObject.userProfile.EmailChangeRequest;
import com.example.mymodule.businessObject.userProfile.EmailVerifyOTPRequest;
import com.example.mymodule.datalayer.common.ConnectionManager;
import com.example.mymodule.datalayer.common.StoreProcedures;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
/**
* Created by yassir on 4/5/17.
*/
public class DLEmail {
public static ApiResponse changeEmail(EmailChangeRequest req)
{
ApiResponse res = new ApiResponse();
try{
if(req.emailId == null || req.emailId.trim().equals("")){
res.status = 0;
res.message = "Entered Email is empty";
}
else{
Connection conn = ConnectionManager.getConnection();
CallableStatement cs = conn.prepareCall(StoreProcedures.UserProfile.USER_EMAIL_CHANGE);
cs.setString(1, req.deviceSession);
cs.setString(2, req.emailId.trim());
cs.executeUpdate();
cs.close();
conn.close();
res.status = 1;
res.message = "success";
}
}catch (Exception ex){
res.status = 0;
res.message = ex.getMessage();
}
return res;
}
public static ApiResponse verifyEmail(DeviceSessionEntity req)
{
ApiResponse res = new ApiResponse();
try{
Connection conn = ConnectionManager.getConnection();
CallableStatement cs = conn.prepareCall(StoreProcedures.UserProfile.USER_EMAIL_VERIFY);
cs.setString(1, req.deviceSession);
cs.registerOutParameter(2, Types.VARCHAR);
cs.registerOutParameter(3, Types.VARCHAR);
cs.executeUpdate();
String userEmail = cs.getString(2);
String otp = cs.getString(3);
cs.close();
conn.close();
//send otp to userEmail
sendMailForOTP(userEmail.trim(),otp);
res.status = 1;
res.message = "success";
}
catch (Exception ex){
res.status = 0;
res.message = ex.getMessage();
}
return res;
}
public static ApiResponse verifyEmailOTP(EmailVerifyOTPRequest req)
{
ApiResponse res = new ApiResponse();
try{
if(req.otp == null || req.otp.trim().equals("")){
res.status = 0;
res.message = "Entered OTP is empty";
}
else{
Connection conn = ConnectionManager.getConnection();
CallableStatement cs = conn.prepareCall(StoreProcedures.UserProfile.USER_EMAIL_OTP_VERIFY);
cs.setString(1, req.deviceSession);
cs.setString(2, req.otp.trim());
cs.execute();
cs.close();
conn.close();
res.status = 1;
res.message = "success";
}
}catch (Exception ex){
res.status = 0;
res.message = ex.getMessage();
}
return res;
}
private static void sendMailForOTP(String mailID, String otp) throws Exception
{
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(Constants.SMTP_MAIL_ADD, "StopNSolve.com Admin"));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(mailID));
msg.setSubject("mi-Circle : OTP for email verification");
// Create a multi-part to combine the parts
Multipart multipart = new MimeMultipart();
// Create the html part
MimeBodyPart messageBodyPart = new MimeBodyPart();
String htmlMessage = ("Your One time password (OTP) for mi-Circle email verification is <b>" + otp + "</b>");
messageBodyPart.setContent(htmlMessage, "text/html");
// Add html part to multi part
multipart.addBodyPart(messageBodyPart);
// Associate multi-part with message
msg.setContent(multipart);
Transport.send(msg);
} catch (AddressException e) {
throw e;
}
}
}
|
UTF-8
|
Java
| 5,016 |
java
|
DLEmail.java
|
Java
|
[
{
"context": "ax.mail.internet.MimeMultipart;\n\n/**\n * Created by yassir on 4/5/17.\n */\n\npublic class DLEmail {\n\n publi",
"end": 993,
"score": 0.9977124333381653,
"start": 987,
"tag": "USERNAME",
"value": "yassir"
}
] | null |
[] |
package com.example.mymodule.datalayer.userProfile;
import com.example.mymodule.businessObject.common.ApiResponse;
import com.example.mymodule.businessObject.common.Constants;
import com.example.mymodule.businessObject.common.DeviceSessionEntity;
import com.example.mymodule.businessObject.userProfile.EmailChangeRequest;
import com.example.mymodule.businessObject.userProfile.EmailVerifyOTPRequest;
import com.example.mymodule.datalayer.common.ConnectionManager;
import com.example.mymodule.datalayer.common.StoreProcedures;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
/**
* Created by yassir on 4/5/17.
*/
public class DLEmail {
public static ApiResponse changeEmail(EmailChangeRequest req)
{
ApiResponse res = new ApiResponse();
try{
if(req.emailId == null || req.emailId.trim().equals("")){
res.status = 0;
res.message = "Entered Email is empty";
}
else{
Connection conn = ConnectionManager.getConnection();
CallableStatement cs = conn.prepareCall(StoreProcedures.UserProfile.USER_EMAIL_CHANGE);
cs.setString(1, req.deviceSession);
cs.setString(2, req.emailId.trim());
cs.executeUpdate();
cs.close();
conn.close();
res.status = 1;
res.message = "success";
}
}catch (Exception ex){
res.status = 0;
res.message = ex.getMessage();
}
return res;
}
public static ApiResponse verifyEmail(DeviceSessionEntity req)
{
ApiResponse res = new ApiResponse();
try{
Connection conn = ConnectionManager.getConnection();
CallableStatement cs = conn.prepareCall(StoreProcedures.UserProfile.USER_EMAIL_VERIFY);
cs.setString(1, req.deviceSession);
cs.registerOutParameter(2, Types.VARCHAR);
cs.registerOutParameter(3, Types.VARCHAR);
cs.executeUpdate();
String userEmail = cs.getString(2);
String otp = cs.getString(3);
cs.close();
conn.close();
//send otp to userEmail
sendMailForOTP(userEmail.trim(),otp);
res.status = 1;
res.message = "success";
}
catch (Exception ex){
res.status = 0;
res.message = ex.getMessage();
}
return res;
}
public static ApiResponse verifyEmailOTP(EmailVerifyOTPRequest req)
{
ApiResponse res = new ApiResponse();
try{
if(req.otp == null || req.otp.trim().equals("")){
res.status = 0;
res.message = "Entered OTP is empty";
}
else{
Connection conn = ConnectionManager.getConnection();
CallableStatement cs = conn.prepareCall(StoreProcedures.UserProfile.USER_EMAIL_OTP_VERIFY);
cs.setString(1, req.deviceSession);
cs.setString(2, req.otp.trim());
cs.execute();
cs.close();
conn.close();
res.status = 1;
res.message = "success";
}
}catch (Exception ex){
res.status = 0;
res.message = ex.getMessage();
}
return res;
}
private static void sendMailForOTP(String mailID, String otp) throws Exception
{
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(Constants.SMTP_MAIL_ADD, "StopNSolve.com Admin"));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(mailID));
msg.setSubject("mi-Circle : OTP for email verification");
// Create a multi-part to combine the parts
Multipart multipart = new MimeMultipart();
// Create the html part
MimeBodyPart messageBodyPart = new MimeBodyPart();
String htmlMessage = ("Your One time password (OTP) for mi-Circle email verification is <b>" + otp + "</b>");
messageBodyPart.setContent(htmlMessage, "text/html");
// Add html part to multi part
multipart.addBodyPart(messageBodyPart);
// Associate multi-part with message
msg.setContent(multipart);
Transport.send(msg);
} catch (AddressException e) {
throw e;
}
}
}
| 5,016 | 0.60307 | 0.598884 | 156 | 31.153847 | 26.632868 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634615 | false | false |
3
|
589582f52c99af85a0810d2be65cb146f1417a8e
| 37,203,006,730,857 |
332452b5ba91d91e9e7dc81600062629a5e02fc8
|
/src/main/java/com/example/prisonProject/DAO/Service/Decision/DecisionServiceImpl.java
|
58472da81d91bcfaa3c69517f5d7bdb386af4be5
|
[] |
no_license
|
Totodsv/Prison
|
https://github.com/Totodsv/Prison
|
9efd7619537d77001b8aada77a2c7c232f9ff6ac
|
ac84859c3b7baee229b7dd014fa145324e266fbc
|
refs/heads/master
| 2023-06-28T07:16:40.340000 | 2020-12-03T14:10:45 | 2020-12-03T14:10:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.prisonProject.DAO.Service.Decision;
import com.example.prisonProject.DAO.Repository.DecisionRepository;
import com.example.prisonProject.DAO.Repository.DetenuAffaireRepository;
import com.example.prisonProject.POJO.Decision;
import com.example.prisonProject.POJO.DetenuAffaire;
import com.example.prisonProject.POJO.Incarceration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.util.Collection;
import java.util.Collections;
@Service
public class DecisionServiceImpl implements DecisionService {
@Autowired
private DecisionRepository decisionRepository;
@Override
public Decision createDecision(String n_type_decision, String n_ecrou, Date date_decision) {
Decision d = new Decision();
d.setNumTypeDecision(n_type_decision);
d.setnEcrou(n_ecrou);
d.setDateDecision(date_decision);
return decisionRepository.save(d);
}
@Override
public Decision readDecision(String n_type_decision, String n_ecrou, Date date_decision) {
return decisionRepository.findDecisionBynEcrouAndNumTypeDecisionAndDateDecision(n_type_decision, n_ecrou, date_decision);
}
@Override
public Decision updateDecision(String n_type_decision, String n_ecrou, Date date_decision) {
return null;
}
@Override
public void deleteDecision(String n_ecrou, String n_type_decision, Date date_decision) {
Decision d = decisionRepository.findDecisionBynEcrouAndNumTypeDecisionAndDateDecision(n_ecrou, n_type_decision, date_decision);
decisionRepository.delete(d);
}
}
|
UTF-8
|
Java
| 1,677 |
java
|
DecisionServiceImpl.java
|
Java
|
[] | null |
[] |
package com.example.prisonProject.DAO.Service.Decision;
import com.example.prisonProject.DAO.Repository.DecisionRepository;
import com.example.prisonProject.DAO.Repository.DetenuAffaireRepository;
import com.example.prisonProject.POJO.Decision;
import com.example.prisonProject.POJO.DetenuAffaire;
import com.example.prisonProject.POJO.Incarceration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.util.Collection;
import java.util.Collections;
@Service
public class DecisionServiceImpl implements DecisionService {
@Autowired
private DecisionRepository decisionRepository;
@Override
public Decision createDecision(String n_type_decision, String n_ecrou, Date date_decision) {
Decision d = new Decision();
d.setNumTypeDecision(n_type_decision);
d.setnEcrou(n_ecrou);
d.setDateDecision(date_decision);
return decisionRepository.save(d);
}
@Override
public Decision readDecision(String n_type_decision, String n_ecrou, Date date_decision) {
return decisionRepository.findDecisionBynEcrouAndNumTypeDecisionAndDateDecision(n_type_decision, n_ecrou, date_decision);
}
@Override
public Decision updateDecision(String n_type_decision, String n_ecrou, Date date_decision) {
return null;
}
@Override
public void deleteDecision(String n_ecrou, String n_type_decision, Date date_decision) {
Decision d = decisionRepository.findDecisionBynEcrouAndNumTypeDecisionAndDateDecision(n_ecrou, n_type_decision, date_decision);
decisionRepository.delete(d);
}
}
| 1,677 | 0.767442 | 0.767442 | 47 | 34.680851 | 35.47076 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.702128 | false | false |
3
|
24a29806e3d7c52eb0c1d74871a6916f971be34f
| 94,489,336,492 |
0235f92f2245162f6e1bf8deae57368d9f72aeec
|
/src/com/digiturtle/ui/GLFont.java
|
464b9d246ddb2155b8f33b85daea6f7bb8eaa523
|
[] |
no_license
|
CopyableCougar4/DigiTurtle-Library
|
https://github.com/CopyableCougar4/DigiTurtle-Library
|
b873acb0933da50a63a144187add7e900467af68
|
a237b15818559cc3b90392949f727af9b9770ad1
|
refs/heads/master
| 2016-09-05T09:46:39.477000 | 2014-11-15T22:34:29 | 2014-11-15T22:34:29 | 26,094,566 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.digiturtle.ui;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import com.digiturtle.common.ComponentRegion;
import com.digiturtle.common.DisplayList;
import com.digiturtle.common.Logger.LoggingSystem;
import com.digiturtle.common.Renderable;
import com.digiturtle.common.StaticVBO;
import com.digiturtle.common.Texture;
import static org.lwjgl.opengl.GL11.*;
public class GLFont {
public static HashMap<Float, Texture> textures = new HashMap<Float, Texture>();
public static HashMap<Float, IntObject[]> objectMap = new HashMap<Float, IntObject[]>();
public static HashMap<Float, BufferedImage> imageMap = new HashMap<Float, BufferedImage>();
public static HashMap<Float, FontMetrics> metricsMap = new HashMap<Float, FontMetrics>();
public static HashMap<Float, StaticVBO[]> vboMap = new HashMap<Float, StaticVBO[]>();
private Font font;
private float fontsize;
private IntObject[] objects = new IntObject[256];
private StaticVBO[] vbos = new StaticVBO[256];
private FontMetrics metrics;
private Texture fontTexture;
private BufferedImage image;
private int fontHeight = 0;
public static class IntObject {
public int x, y, width, height;
public void debug() {
LoggingSystem.debug("IntObject[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]");
}
}
public float getSize() {
return fontsize;
}
public float getHeight(String input) {
String[] check = input.split("\\n");
return check.length * (getSize() + 5);
}
public GLFont(float fontsize, Theme theme) {
this(theme.FONT, fontsize);
}
public GLFont(Font _font, float fontsize) {
this.fontsize = fontsize;
font = _font.deriveFont(fontsize);
if (textures.get(fontsize) != null) {
fontTexture = new Texture(imageMap.get(fontsize), "");
objects = objectMap.get(fontsize);
metrics = metricsMap.get(fontsize);
vbos = vboMap.get(fontsize);
} else {
createTexture();
textures.put(fontsize, fontTexture);
imageMap.put(fontsize, image);
objectMap.put(fontsize, objects);
metricsMap.put(fontsize, metrics);
vboMap.put(fontsize, vbos);
}
}
public float getSplitWidth(String input) {
String[] lines = input.split("\\n");
float maxwidth = 0;
for (String line : lines) {
maxwidth = Math.max(maxwidth, getWidth(line));
}
return maxwidth;
}
public float getWidth(String input) {
if (input.contains("\\n")) {
String[] lines = input.split("\\n");
float maxwidth = 0;
for (String line : lines) {
maxwidth = Math.max(maxwidth, getWidth(line));
}
return maxwidth;
} else {
float width = 0;
for (char letter : input.toCharArray()) {
width += metrics.charWidth(letter);
}
return width;
}
}
private float textureWidth = 512, textureHeight = 512;
public void drawText(float x, float y, String text, Color color, float angleDegrees) {
glPushMatrix();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTranslatef(x, y, 0);
glRotatef(angleDegrees, 0, 0, 1);
glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f);
fontTexture.bind();
float drawX = 0;
float drawY = 0;
glBegin(GL_QUADS);
String[] lines = text.split("\\n");
for (String line : lines) {
drawX = 0;
for (char letter : line.toCharArray()) {
IntObject intObject = objects[(int)letter];
if (intObject == null) {
continue;
}
float drawX2 = drawX + intObject.width;
float drawY2 = drawY + intObject.height;
float srcX = intObject.x;
float srcY = intObject.y; //
float srcX2 = srcX + intObject.width;
float srcY2 = srcY + intObject.height;
float DrawWidth = drawX2 - drawX;
float DrawHeight = drawY2 - drawY;
float TextureSrcX = srcX / textureWidth;
float TextureSrcY = srcY / textureHeight;
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
// Draw the letter
glTexCoord2f(TextureSrcX, TextureSrcY);
glVertex2f(drawX, drawY);
glTexCoord2f(TextureSrcX, TextureSrcY + RenderHeight);
glVertex2f(drawX, drawY + DrawHeight);
glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
glVertex2f(drawX + DrawWidth, drawY + DrawHeight);
glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY);
glVertex2f(drawX + DrawWidth, drawY);
drawX += intObject.width;
}
drawY += getSize() + 5;
}
glEnd();
glColor3f(1.0f, 1.0f, 1.0f);
glPopMatrix();
}
public void drawText(float x, float y, String text, Color color) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f);
fontTexture.bind();
float drawX = x;
float drawY = y;
String[] lines = text.split("\\n");
for (String line : lines) {
drawX = x;
for (char letter : line.toCharArray()) {
IntObject intObject = objects[(int) letter];
if (intObject == null) {
continue;
}
// Draw the letter
StaticVBO vbo = vbos[(int) letter];
vbo.render(drawX, drawY);
drawX += intObject.width;
}
drawY += getSize() + 5;
}
glColor3f(1.0f, 1.0f, 1.0f);
}
public DisplayList drawCachedText(final float x, final float y, final String text, final Color color) {
return new DisplayList(new Renderable() {
public void render() {
drawText(x, y, text, color);
}
});
}
public void debug() {
fontTexture.bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(512, 0);
glTexCoord2f(1, 1);
glVertex2f(512, 512);
glTexCoord2f(0, 1);
glVertex2f(0, 512);
glEnd();
}
public void createTexture() {
image = new BufferedImage(512, 512, BufferedImage.TYPE_INT_ARGB);
BufferedImage scratch = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = scratch.createGraphics();
// get the dimensions
graphics.setFont(font);
metrics = graphics.getFontMetrics();
// prepare the graphics
Graphics2D realGraphics = image.createGraphics();
realGraphics.setBackground(new Color(255, 255, 255, 0));
realGraphics.clearRect(0, 0, 512, 512);
realGraphics.setColor(Color.WHITE);
realGraphics.setFont(font);
realGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// real work
int rowHeight = 0;
int positionX = 0;
int positionY = 0;
for (int index = 0; index < 256; index++) {
char letter = (char) index;
int charwidth = metrics.charWidth(letter);
if (charwidth <= 0) {
charwidth = 1;
}
int charheight = metrics.getHeight();
if (charheight <= 0) {
charheight = Math.round(fontsize);
}
IntObject intObject = new IntObject();
intObject.width = charwidth;
intObject.height = charheight;
if (positionX + intObject.width >= 512) {
positionX = 0;
positionY += rowHeight + 10;
rowHeight = 0;
}
intObject.x = positionX;
intObject.y = positionY;
if (intObject.height > fontHeight) {
fontHeight = intObject.height;
}
if (intObject.height > rowHeight) {
rowHeight = intObject.height;
}
// Log.print("Rendering char " + letter + " as " + String.valueOf(letter) + " @ " + positionX + ", " + positionY);
realGraphics.drawString(String.valueOf(letter), positionX, positionY + metrics.getAscent());
positionX += intObject.width;
objects[index] = intObject;
}
fontTexture = new Texture(image, "");
for (int index = 0; index < 256; index++) {
IntObject intObject = objects[index];
float srcX = intObject.x;
float srcY = intObject.y; //
float srcX2 = srcX + intObject.width;
float srcY2 = srcY + intObject.height;
float TextureSrcX = srcX / textureWidth;
float TextureSrcY = srcY / textureHeight;
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
StaticVBO vbo = StaticVBO.getVBO(fontTexture, new ComponentRegion(0, 0, intObject.width, intObject.height), TextureSrcX, TextureSrcY, TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
vbos[index] = vbo;
}
}
}
|
UTF-8
|
Java
| 8,463 |
java
|
GLFont.java
|
Java
|
[] | null |
[] |
package com.digiturtle.ui;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import com.digiturtle.common.ComponentRegion;
import com.digiturtle.common.DisplayList;
import com.digiturtle.common.Logger.LoggingSystem;
import com.digiturtle.common.Renderable;
import com.digiturtle.common.StaticVBO;
import com.digiturtle.common.Texture;
import static org.lwjgl.opengl.GL11.*;
public class GLFont {
public static HashMap<Float, Texture> textures = new HashMap<Float, Texture>();
public static HashMap<Float, IntObject[]> objectMap = new HashMap<Float, IntObject[]>();
public static HashMap<Float, BufferedImage> imageMap = new HashMap<Float, BufferedImage>();
public static HashMap<Float, FontMetrics> metricsMap = new HashMap<Float, FontMetrics>();
public static HashMap<Float, StaticVBO[]> vboMap = new HashMap<Float, StaticVBO[]>();
private Font font;
private float fontsize;
private IntObject[] objects = new IntObject[256];
private StaticVBO[] vbos = new StaticVBO[256];
private FontMetrics metrics;
private Texture fontTexture;
private BufferedImage image;
private int fontHeight = 0;
public static class IntObject {
public int x, y, width, height;
public void debug() {
LoggingSystem.debug("IntObject[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]");
}
}
public float getSize() {
return fontsize;
}
public float getHeight(String input) {
String[] check = input.split("\\n");
return check.length * (getSize() + 5);
}
public GLFont(float fontsize, Theme theme) {
this(theme.FONT, fontsize);
}
public GLFont(Font _font, float fontsize) {
this.fontsize = fontsize;
font = _font.deriveFont(fontsize);
if (textures.get(fontsize) != null) {
fontTexture = new Texture(imageMap.get(fontsize), "");
objects = objectMap.get(fontsize);
metrics = metricsMap.get(fontsize);
vbos = vboMap.get(fontsize);
} else {
createTexture();
textures.put(fontsize, fontTexture);
imageMap.put(fontsize, image);
objectMap.put(fontsize, objects);
metricsMap.put(fontsize, metrics);
vboMap.put(fontsize, vbos);
}
}
public float getSplitWidth(String input) {
String[] lines = input.split("\\n");
float maxwidth = 0;
for (String line : lines) {
maxwidth = Math.max(maxwidth, getWidth(line));
}
return maxwidth;
}
public float getWidth(String input) {
if (input.contains("\\n")) {
String[] lines = input.split("\\n");
float maxwidth = 0;
for (String line : lines) {
maxwidth = Math.max(maxwidth, getWidth(line));
}
return maxwidth;
} else {
float width = 0;
for (char letter : input.toCharArray()) {
width += metrics.charWidth(letter);
}
return width;
}
}
private float textureWidth = 512, textureHeight = 512;
public void drawText(float x, float y, String text, Color color, float angleDegrees) {
glPushMatrix();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTranslatef(x, y, 0);
glRotatef(angleDegrees, 0, 0, 1);
glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f);
fontTexture.bind();
float drawX = 0;
float drawY = 0;
glBegin(GL_QUADS);
String[] lines = text.split("\\n");
for (String line : lines) {
drawX = 0;
for (char letter : line.toCharArray()) {
IntObject intObject = objects[(int)letter];
if (intObject == null) {
continue;
}
float drawX2 = drawX + intObject.width;
float drawY2 = drawY + intObject.height;
float srcX = intObject.x;
float srcY = intObject.y; //
float srcX2 = srcX + intObject.width;
float srcY2 = srcY + intObject.height;
float DrawWidth = drawX2 - drawX;
float DrawHeight = drawY2 - drawY;
float TextureSrcX = srcX / textureWidth;
float TextureSrcY = srcY / textureHeight;
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
// Draw the letter
glTexCoord2f(TextureSrcX, TextureSrcY);
glVertex2f(drawX, drawY);
glTexCoord2f(TextureSrcX, TextureSrcY + RenderHeight);
glVertex2f(drawX, drawY + DrawHeight);
glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
glVertex2f(drawX + DrawWidth, drawY + DrawHeight);
glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY);
glVertex2f(drawX + DrawWidth, drawY);
drawX += intObject.width;
}
drawY += getSize() + 5;
}
glEnd();
glColor3f(1.0f, 1.0f, 1.0f);
glPopMatrix();
}
public void drawText(float x, float y, String text, Color color) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f);
fontTexture.bind();
float drawX = x;
float drawY = y;
String[] lines = text.split("\\n");
for (String line : lines) {
drawX = x;
for (char letter : line.toCharArray()) {
IntObject intObject = objects[(int) letter];
if (intObject == null) {
continue;
}
// Draw the letter
StaticVBO vbo = vbos[(int) letter];
vbo.render(drawX, drawY);
drawX += intObject.width;
}
drawY += getSize() + 5;
}
glColor3f(1.0f, 1.0f, 1.0f);
}
public DisplayList drawCachedText(final float x, final float y, final String text, final Color color) {
return new DisplayList(new Renderable() {
public void render() {
drawText(x, y, text, color);
}
});
}
public void debug() {
fontTexture.bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(512, 0);
glTexCoord2f(1, 1);
glVertex2f(512, 512);
glTexCoord2f(0, 1);
glVertex2f(0, 512);
glEnd();
}
public void createTexture() {
image = new BufferedImage(512, 512, BufferedImage.TYPE_INT_ARGB);
BufferedImage scratch = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = scratch.createGraphics();
// get the dimensions
graphics.setFont(font);
metrics = graphics.getFontMetrics();
// prepare the graphics
Graphics2D realGraphics = image.createGraphics();
realGraphics.setBackground(new Color(255, 255, 255, 0));
realGraphics.clearRect(0, 0, 512, 512);
realGraphics.setColor(Color.WHITE);
realGraphics.setFont(font);
realGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// real work
int rowHeight = 0;
int positionX = 0;
int positionY = 0;
for (int index = 0; index < 256; index++) {
char letter = (char) index;
int charwidth = metrics.charWidth(letter);
if (charwidth <= 0) {
charwidth = 1;
}
int charheight = metrics.getHeight();
if (charheight <= 0) {
charheight = Math.round(fontsize);
}
IntObject intObject = new IntObject();
intObject.width = charwidth;
intObject.height = charheight;
if (positionX + intObject.width >= 512) {
positionX = 0;
positionY += rowHeight + 10;
rowHeight = 0;
}
intObject.x = positionX;
intObject.y = positionY;
if (intObject.height > fontHeight) {
fontHeight = intObject.height;
}
if (intObject.height > rowHeight) {
rowHeight = intObject.height;
}
// Log.print("Rendering char " + letter + " as " + String.valueOf(letter) + " @ " + positionX + ", " + positionY);
realGraphics.drawString(String.valueOf(letter), positionX, positionY + metrics.getAscent());
positionX += intObject.width;
objects[index] = intObject;
}
fontTexture = new Texture(image, "");
for (int index = 0; index < 256; index++) {
IntObject intObject = objects[index];
float srcX = intObject.x;
float srcY = intObject.y; //
float srcX2 = srcX + intObject.width;
float srcY2 = srcY + intObject.height;
float TextureSrcX = srcX / textureWidth;
float TextureSrcY = srcY / textureHeight;
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
StaticVBO vbo = StaticVBO.getVBO(fontTexture, new ComponentRegion(0, 0, intObject.width, intObject.height), TextureSrcX, TextureSrcY, TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
vbos[index] = vbo;
}
}
}
| 8,463 | 0.678719 | 0.65745 | 264 | 31.056818 | 24.581354 | 192 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.280303 | false | false |
3
|
f1e8e0fdcb016bd90bf2f38a9cf096c68ea03745
| 38,491,496,924,972 |
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/4/4_58d696eae1590ceefa0716486dc51df9cdf1857a/PaymentActions/4_58d696eae1590ceefa0716486dc51df9cdf1857a_PaymentActions_s.java
|
f6ab20cdb3950813acc8eef48e1b998d3bfea088
|
[] |
no_license
|
zhongxingyu/Seer
|
https://github.com/zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false |
/*
* Copyright (c) 2006 - 2010 Open Source Strategies, Inc.
*
* Opentaps is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Opentaps is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Opentaps. If not, see <http://www.gnu.org/licenses/>.
*/
package com.opensourcestrategies.financials.payment;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import javax.servlet.http.HttpServletRequest;
import com.opensourcestrategies.financials.util.UtilFinancial;
import javolution.util.FastList;
import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.party.party.PartyHelper;
import org.opentaps.base.constants.PaymentTypeConstants;
import org.opentaps.base.constants.StatusTypeConstants;
import org.opentaps.base.entities.PaymentAndPaymentApplication;
import org.opentaps.base.entities.PaymentMethod;
import org.opentaps.base.entities.PaymentMethodType;
import org.opentaps.base.entities.PaymentType;
import org.opentaps.base.entities.StatusItem;
import org.opentaps.common.builder.EntityListBuilder;
import org.opentaps.common.builder.PageBuilder;
import org.opentaps.common.util.UtilAccountingTags;
import org.opentaps.common.util.UtilCommon;
import org.opentaps.common.util.UtilDate;
import org.opentaps.domain.DomainsDirectory;
import org.opentaps.domain.billing.BillingDomainInterface;
import org.opentaps.domain.billing.payment.Payment;
import org.opentaps.domain.billing.payment.PaymentRepositoryInterface;
import org.opentaps.domain.organization.Organization;
import org.opentaps.domain.organization.OrganizationRepositoryInterface;
import org.opentaps.foundation.action.ActionContext;
/**
* PaymentActions - Java Actions for payments.
*/
public final class PaymentActions {
private static final String MODULE = PaymentActions.class.getName();
private PaymentActions() { }
/**
* Action for the find / list payments screen.
* @param context the screen context
* @throws GeneralException if an error occurs
* @throws ParseException if an error occurs
*/
public static void findPayments(Map<String, Object> context) throws GeneralException, ParseException {
final ActionContext ac = new ActionContext(context);
final HttpServletRequest request = ac.getRequest();
final GenericDelegator delegator = ac.getDelegator();
final Locale locale = ac.getLocale();
final TimeZone timeZone = ac.getTimeZone();
final String organizationPartyId = UtilCommon.getOrganizationPartyId(request);
if (organizationPartyId == null) {
Debug.logError("No organizationPartyId set in the current request.", MODULE);
return;
}
ac.put("organizationPartyId", organizationPartyId);
DomainsDirectory dd = DomainsDirectory.getDomainsDirectory(ac);
BillingDomainInterface billingDomain = dd.getBillingDomain();
PaymentRepositoryInterface paymentRepository = billingDomain.getPaymentRepository();
OrganizationRepositoryInterface organizationRepository = dd.getOrganizationDomain().getOrganizationRepository();
Organization organization = organizationRepository.getOrganizationById(organizationPartyId);
// this gets overrided later according to the payment type
ac.put("decoratorLocation", "component://opentaps-common/widget/screens/common/CommonScreens.xml");
// set the disbursement flag which is used to set the partyIdFrom/To to that of the organization on the find payment form as a hidden field
// also set a default status id which is based on whether it's a disbursement (SENT) or not (RECEIVED), but this is overriden by parameters.statusId
ac.put("headerItem", "receivables");
// for accounting tag filtering
String tagsType = UtilAccountingTags.LOOKUP_RECEIPT_PAYMENT_TAG;
boolean findDisbursement = false;
String findPaymentTypeId = ac.getParameter("findPaymentTypeId");
if ("DISBURSEMENT".equals(findPaymentTypeId)) {
findDisbursement = true;
tagsType = UtilAccountingTags.LOOKUP_DISBURSEMENT_PAYMENT_TAG;
ac.put("headerItem", "payables");
}
ac.put("findDisbursement", findDisbursement);
// get the list of paymentMethods, PaymentMethodTypes, paymentTypes
List<String> supportedPaymentTypes = null;
if (findDisbursement) {
ac.put("decoratorLocation", "component://financials/widget/financials/screens/payables/PayablesScreens.xml");
ac.put("headerItem", "payables");
ac.put("paymentMethodList", organization.getRelated(PaymentMethod.class, UtilMisc.toList("paymentMethodTypeId")));
supportedPaymentTypes = Arrays.asList(PaymentTypeConstants.Disbursement.CUSTOMER_REFUND,
PaymentTypeConstants.Disbursement.VENDOR_PAYMENT,
PaymentTypeConstants.Disbursement.VENDOR_PREPAY,
PaymentTypeConstants.Disbursement.COMMISSION_PAYMENT,
PaymentTypeConstants.TaxPayment.SALES_TAX_PAYMENT,
PaymentTypeConstants.TaxPayment.INCOME_TAX_PAYMENT,
PaymentTypeConstants.TaxPayment.PAYROLL_TAX_PAYMENT);
} else {
ac.put("decoratorLocation", "component://financials/widget/financials/screens/receivables/ReceivablesScreens.xml");
ac.put("headerItem", "receivables");
ac.put("paymentMethodTypeList", UtilFinancial.getSimpleCustomerPaymentMethodTypes(delegator));
supportedPaymentTypes = Arrays.asList(PaymentTypeConstants.Receipt.INTEREST_RECEIPT,
PaymentTypeConstants.Receipt.VENDOR_CREDIT_RCPT,
PaymentTypeConstants.Receipt.CUSTOMER_PAYMENT,
PaymentTypeConstants.Receipt.CUSTOMER_DEPOSIT);
}
List<PaymentType> paymentTypeList = paymentRepository.findListCache(PaymentType.class, EntityCondition.makeCondition(PaymentType.Fields.paymentTypeId.name(), EntityOperator.IN, supportedPaymentTypes));
ac.put("paymentTypeList", paymentTypeList);
List<StatusItem> statusList = paymentRepository.findListCache(StatusItem.class, paymentRepository.map(StatusItem.Fields.statusTypeId, StatusTypeConstants.PMNT_STATUS), UtilMisc.toList(StatusItem.Fields.sequenceId.desc()));
ac.put("statusList", statusList);
// get the accounting tags for the select inputs
if (tagsType != null) {
ac.put("tagFilters", UtilAccountingTags.getAccountingTagFiltersForOrganization(organizationPartyId, tagsType, delegator, locale));
}
// possible fields we're searching by
String paymentId = ac.getParameter("paymentId");
String partyIdFrom = ac.getParameter("partyIdFrom");
String partyIdTo = ac.getParameter("partyIdTo");
String paymentTypeId = ac.getParameter("paymentTypeId");
String paymentMethodId = ac.getParameter("paymentMethodId");
String paymentMethodTypeId = ac.getParameter("paymentMethodTypeId");
String paymentRefNum = ac.getParameter("paymentRefNum");
String statusId = ac.getParameter("statusId");
Timestamp fromDate = UtilDate.toTimestamp(ac.getCompositeParameter("fromDate"), timeZone, locale);
Timestamp thruDate = UtilDate.toTimestamp(ac.getCompositeParameter("thruDate"), timeZone, locale);
String amountFrom = ac.getParameter("amountFrom");
String amountThru = ac.getParameter("amountThru");
String openAmountFrom = ac.getParameter("openAmountFrom");
String openAmountThru = ac.getParameter("openAmountThru");
// construct search conditions
List<EntityCondition> searchConditions = new FastList<EntityCondition>();
if (paymentId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentId.name(), EntityOperator.EQUALS, paymentId));
}
// force one of the party to the organization according to the payment type
if (findDisbursement) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdFrom.name(), EntityOperator.EQUALS, organizationPartyId));
if (partyIdTo != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdTo.name(), EntityOperator.EQUALS, partyIdTo));
}
} else {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdTo.name(), EntityOperator.EQUALS, organizationPartyId));
if (partyIdFrom != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdFrom.name(), EntityOperator.EQUALS, partyIdFrom));
}
}
if (paymentTypeId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentTypeId.name(), EntityOperator.EQUALS, paymentTypeId));
} else {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentTypeId.name(), EntityOperator.IN, supportedPaymentTypes));
}
if (findDisbursement) {
if (paymentMethodId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentMethodId.name(), EntityOperator.EQUALS, paymentMethodId));
}
} else {
if (paymentMethodTypeId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentMethodTypeId.name(), EntityOperator.EQUALS, paymentMethodTypeId));
}
}
if (paymentRefNum != null) {
// make sure the look up is case insensitive
searchConditions.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(Payment.Fields.paymentRefNum.name()), EntityOperator.LIKE, EntityFunction.UPPER(paymentRefNum + "%")));
}
if (statusId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.statusId.name(), EntityOperator.EQUALS, statusId));
}
if (fromDate != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.effectiveDate.name(), EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
}
if (thruDate != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.effectiveDate.name(), EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
}
if (amountFrom != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.amount.name(), EntityOperator.GREATER_THAN_EQUAL_TO, new BigDecimal(amountFrom)));
}
if (amountThru != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.amount.name(), EntityOperator.LESS_THAN_EQUAL_TO, new BigDecimal(amountThru)));
}
if (openAmountFrom != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.openAmount.name(), EntityOperator.GREATER_THAN_EQUAL_TO, new BigDecimal(openAmountFrom)));
}
if (openAmountThru != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.openAmount.name(), EntityOperator.LESS_THAN_EQUAL_TO, new BigDecimal(openAmountThru)));
}
if (tagsType != null) {
// if the organization is using allocatePaymentTagsToApplications then the tags are on the payment applications,
// else they are on the Payments
if (organization.allocatePaymentTagsToApplications()) {
searchConditions.addAll(UtilAccountingTags.buildTagConditions(organizationPartyId, tagsType, delegator, request, UtilAccountingTags.TAG_PARAM_PREFIX, "applAcctgTagEnumId"));
} else {
searchConditions.addAll(UtilAccountingTags.buildTagConditions(organizationPartyId, tagsType, delegator, request));
}
}
// Pagination
Set<String> fieldsToSelect = new HashSet<String>(new Payment().getAllFieldsNames());
fieldsToSelect.retainAll(new PaymentAndPaymentApplication().getAllFieldsNames());
EntityListBuilder paymentListBuilder = new EntityListBuilder(paymentRepository, PaymentAndPaymentApplication.class, EntityCondition.makeCondition(searchConditions, EntityOperator.AND), fieldsToSelect, UtilMisc.toList(PaymentAndPaymentApplication.Fields.effectiveDate.desc()));
PageBuilder<PaymentAndPaymentApplication> pageBuilder = new PageBuilder<PaymentAndPaymentApplication>() {
public List<Map<String, Object>> build(List<PaymentAndPaymentApplication> page) throws Exception {
GenericDelegator delegator = ac.getDelegator();
List<Map<String, Object>> newPage = FastList.newInstance();
for (PaymentAndPaymentApplication payment : page) {
Map<String, Object> newRow = FastMap.newInstance();
newRow.putAll(payment.toMap());
StatusItem status = payment.getStatusItem();
newRow.put("statusDescription", status.get(StatusItem.Fields.description.name(), locale));
PaymentMethodType meth = payment.getPaymentMethodType();
if (meth != null) {
newRow.put("paymentMethodDescription", meth.get(PaymentMethodType.Fields.description.name(), locale));
}
newRow.put("partyNameFrom", PartyHelper.getPartyName(delegator, payment.getPartyIdFrom(), false));
newRow.put("partyNameTo", PartyHelper.getPartyName(delegator, payment.getPartyIdTo(), false));
newPage.add(newRow);
}
return newPage;
}
};
paymentListBuilder.setPageBuilder(pageBuilder);
ac.put("paymentListBuilder", paymentListBuilder);
}
}
|
UTF-8
|
Java
| 15,354 |
java
|
4_58d696eae1590ceefa0716486dc51df9cdf1857a_PaymentActions_s.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2006 - 2010 Open Source Strategies, Inc.
*
* Opentaps is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Opentaps is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Opentaps. If not, see <http://www.gnu.org/licenses/>.
*/
package com.opensourcestrategies.financials.payment;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import javax.servlet.http.HttpServletRequest;
import com.opensourcestrategies.financials.util.UtilFinancial;
import javolution.util.FastList;
import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.party.party.PartyHelper;
import org.opentaps.base.constants.PaymentTypeConstants;
import org.opentaps.base.constants.StatusTypeConstants;
import org.opentaps.base.entities.PaymentAndPaymentApplication;
import org.opentaps.base.entities.PaymentMethod;
import org.opentaps.base.entities.PaymentMethodType;
import org.opentaps.base.entities.PaymentType;
import org.opentaps.base.entities.StatusItem;
import org.opentaps.common.builder.EntityListBuilder;
import org.opentaps.common.builder.PageBuilder;
import org.opentaps.common.util.UtilAccountingTags;
import org.opentaps.common.util.UtilCommon;
import org.opentaps.common.util.UtilDate;
import org.opentaps.domain.DomainsDirectory;
import org.opentaps.domain.billing.BillingDomainInterface;
import org.opentaps.domain.billing.payment.Payment;
import org.opentaps.domain.billing.payment.PaymentRepositoryInterface;
import org.opentaps.domain.organization.Organization;
import org.opentaps.domain.organization.OrganizationRepositoryInterface;
import org.opentaps.foundation.action.ActionContext;
/**
* PaymentActions - Java Actions for payments.
*/
public final class PaymentActions {
private static final String MODULE = PaymentActions.class.getName();
private PaymentActions() { }
/**
* Action for the find / list payments screen.
* @param context the screen context
* @throws GeneralException if an error occurs
* @throws ParseException if an error occurs
*/
public static void findPayments(Map<String, Object> context) throws GeneralException, ParseException {
final ActionContext ac = new ActionContext(context);
final HttpServletRequest request = ac.getRequest();
final GenericDelegator delegator = ac.getDelegator();
final Locale locale = ac.getLocale();
final TimeZone timeZone = ac.getTimeZone();
final String organizationPartyId = UtilCommon.getOrganizationPartyId(request);
if (organizationPartyId == null) {
Debug.logError("No organizationPartyId set in the current request.", MODULE);
return;
}
ac.put("organizationPartyId", organizationPartyId);
DomainsDirectory dd = DomainsDirectory.getDomainsDirectory(ac);
BillingDomainInterface billingDomain = dd.getBillingDomain();
PaymentRepositoryInterface paymentRepository = billingDomain.getPaymentRepository();
OrganizationRepositoryInterface organizationRepository = dd.getOrganizationDomain().getOrganizationRepository();
Organization organization = organizationRepository.getOrganizationById(organizationPartyId);
// this gets overrided later according to the payment type
ac.put("decoratorLocation", "component://opentaps-common/widget/screens/common/CommonScreens.xml");
// set the disbursement flag which is used to set the partyIdFrom/To to that of the organization on the find payment form as a hidden field
// also set a default status id which is based on whether it's a disbursement (SENT) or not (RECEIVED), but this is overriden by parameters.statusId
ac.put("headerItem", "receivables");
// for accounting tag filtering
String tagsType = UtilAccountingTags.LOOKUP_RECEIPT_PAYMENT_TAG;
boolean findDisbursement = false;
String findPaymentTypeId = ac.getParameter("findPaymentTypeId");
if ("DISBURSEMENT".equals(findPaymentTypeId)) {
findDisbursement = true;
tagsType = UtilAccountingTags.LOOKUP_DISBURSEMENT_PAYMENT_TAG;
ac.put("headerItem", "payables");
}
ac.put("findDisbursement", findDisbursement);
// get the list of paymentMethods, PaymentMethodTypes, paymentTypes
List<String> supportedPaymentTypes = null;
if (findDisbursement) {
ac.put("decoratorLocation", "component://financials/widget/financials/screens/payables/PayablesScreens.xml");
ac.put("headerItem", "payables");
ac.put("paymentMethodList", organization.getRelated(PaymentMethod.class, UtilMisc.toList("paymentMethodTypeId")));
supportedPaymentTypes = Arrays.asList(PaymentTypeConstants.Disbursement.CUSTOMER_REFUND,
PaymentTypeConstants.Disbursement.VENDOR_PAYMENT,
PaymentTypeConstants.Disbursement.VENDOR_PREPAY,
PaymentTypeConstants.Disbursement.COMMISSION_PAYMENT,
PaymentTypeConstants.TaxPayment.SALES_TAX_PAYMENT,
PaymentTypeConstants.TaxPayment.INCOME_TAX_PAYMENT,
PaymentTypeConstants.TaxPayment.PAYROLL_TAX_PAYMENT);
} else {
ac.put("decoratorLocation", "component://financials/widget/financials/screens/receivables/ReceivablesScreens.xml");
ac.put("headerItem", "receivables");
ac.put("paymentMethodTypeList", UtilFinancial.getSimpleCustomerPaymentMethodTypes(delegator));
supportedPaymentTypes = Arrays.asList(PaymentTypeConstants.Receipt.INTEREST_RECEIPT,
PaymentTypeConstants.Receipt.VENDOR_CREDIT_RCPT,
PaymentTypeConstants.Receipt.CUSTOMER_PAYMENT,
PaymentTypeConstants.Receipt.CUSTOMER_DEPOSIT);
}
List<PaymentType> paymentTypeList = paymentRepository.findListCache(PaymentType.class, EntityCondition.makeCondition(PaymentType.Fields.paymentTypeId.name(), EntityOperator.IN, supportedPaymentTypes));
ac.put("paymentTypeList", paymentTypeList);
List<StatusItem> statusList = paymentRepository.findListCache(StatusItem.class, paymentRepository.map(StatusItem.Fields.statusTypeId, StatusTypeConstants.PMNT_STATUS), UtilMisc.toList(StatusItem.Fields.sequenceId.desc()));
ac.put("statusList", statusList);
// get the accounting tags for the select inputs
if (tagsType != null) {
ac.put("tagFilters", UtilAccountingTags.getAccountingTagFiltersForOrganization(organizationPartyId, tagsType, delegator, locale));
}
// possible fields we're searching by
String paymentId = ac.getParameter("paymentId");
String partyIdFrom = ac.getParameter("partyIdFrom");
String partyIdTo = ac.getParameter("partyIdTo");
String paymentTypeId = ac.getParameter("paymentTypeId");
String paymentMethodId = ac.getParameter("paymentMethodId");
String paymentMethodTypeId = ac.getParameter("paymentMethodTypeId");
String paymentRefNum = ac.getParameter("paymentRefNum");
String statusId = ac.getParameter("statusId");
Timestamp fromDate = UtilDate.toTimestamp(ac.getCompositeParameter("fromDate"), timeZone, locale);
Timestamp thruDate = UtilDate.toTimestamp(ac.getCompositeParameter("thruDate"), timeZone, locale);
String amountFrom = ac.getParameter("amountFrom");
String amountThru = ac.getParameter("amountThru");
String openAmountFrom = ac.getParameter("openAmountFrom");
String openAmountThru = ac.getParameter("openAmountThru");
// construct search conditions
List<EntityCondition> searchConditions = new FastList<EntityCondition>();
if (paymentId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentId.name(), EntityOperator.EQUALS, paymentId));
}
// force one of the party to the organization according to the payment type
if (findDisbursement) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdFrom.name(), EntityOperator.EQUALS, organizationPartyId));
if (partyIdTo != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdTo.name(), EntityOperator.EQUALS, partyIdTo));
}
} else {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdTo.name(), EntityOperator.EQUALS, organizationPartyId));
if (partyIdFrom != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.partyIdFrom.name(), EntityOperator.EQUALS, partyIdFrom));
}
}
if (paymentTypeId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentTypeId.name(), EntityOperator.EQUALS, paymentTypeId));
} else {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentTypeId.name(), EntityOperator.IN, supportedPaymentTypes));
}
if (findDisbursement) {
if (paymentMethodId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentMethodId.name(), EntityOperator.EQUALS, paymentMethodId));
}
} else {
if (paymentMethodTypeId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.paymentMethodTypeId.name(), EntityOperator.EQUALS, paymentMethodTypeId));
}
}
if (paymentRefNum != null) {
// make sure the look up is case insensitive
searchConditions.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(Payment.Fields.paymentRefNum.name()), EntityOperator.LIKE, EntityFunction.UPPER(paymentRefNum + "%")));
}
if (statusId != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.statusId.name(), EntityOperator.EQUALS, statusId));
}
if (fromDate != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.effectiveDate.name(), EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
}
if (thruDate != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.effectiveDate.name(), EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
}
if (amountFrom != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.amount.name(), EntityOperator.GREATER_THAN_EQUAL_TO, new BigDecimal(amountFrom)));
}
if (amountThru != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.amount.name(), EntityOperator.LESS_THAN_EQUAL_TO, new BigDecimal(amountThru)));
}
if (openAmountFrom != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.openAmount.name(), EntityOperator.GREATER_THAN_EQUAL_TO, new BigDecimal(openAmountFrom)));
}
if (openAmountThru != null) {
searchConditions.add(EntityCondition.makeCondition(Payment.Fields.openAmount.name(), EntityOperator.LESS_THAN_EQUAL_TO, new BigDecimal(openAmountThru)));
}
if (tagsType != null) {
// if the organization is using allocatePaymentTagsToApplications then the tags are on the payment applications,
// else they are on the Payments
if (organization.allocatePaymentTagsToApplications()) {
searchConditions.addAll(UtilAccountingTags.buildTagConditions(organizationPartyId, tagsType, delegator, request, UtilAccountingTags.TAG_PARAM_PREFIX, "applAcctgTagEnumId"));
} else {
searchConditions.addAll(UtilAccountingTags.buildTagConditions(organizationPartyId, tagsType, delegator, request));
}
}
// Pagination
Set<String> fieldsToSelect = new HashSet<String>(new Payment().getAllFieldsNames());
fieldsToSelect.retainAll(new PaymentAndPaymentApplication().getAllFieldsNames());
EntityListBuilder paymentListBuilder = new EntityListBuilder(paymentRepository, PaymentAndPaymentApplication.class, EntityCondition.makeCondition(searchConditions, EntityOperator.AND), fieldsToSelect, UtilMisc.toList(PaymentAndPaymentApplication.Fields.effectiveDate.desc()));
PageBuilder<PaymentAndPaymentApplication> pageBuilder = new PageBuilder<PaymentAndPaymentApplication>() {
public List<Map<String, Object>> build(List<PaymentAndPaymentApplication> page) throws Exception {
GenericDelegator delegator = ac.getDelegator();
List<Map<String, Object>> newPage = FastList.newInstance();
for (PaymentAndPaymentApplication payment : page) {
Map<String, Object> newRow = FastMap.newInstance();
newRow.putAll(payment.toMap());
StatusItem status = payment.getStatusItem();
newRow.put("statusDescription", status.get(StatusItem.Fields.description.name(), locale));
PaymentMethodType meth = payment.getPaymentMethodType();
if (meth != null) {
newRow.put("paymentMethodDescription", meth.get(PaymentMethodType.Fields.description.name(), locale));
}
newRow.put("partyNameFrom", PartyHelper.getPartyName(delegator, payment.getPartyIdFrom(), false));
newRow.put("partyNameTo", PartyHelper.getPartyName(delegator, payment.getPartyIdTo(), false));
newPage.add(newRow);
}
return newPage;
}
};
paymentListBuilder.setPageBuilder(pageBuilder);
ac.put("paymentListBuilder", paymentListBuilder);
}
}
| 15,354 | 0.685685 | 0.685098 | 272 | 55.444855 | 47.810486 | 285 | false | false | 0 | 0 | 0 | 0 | 69 | 0.004494 | 0.893382 | false | false |
3
|
7d69fbaeabcba78d835babefd16a667c13bc0d49
| 37,881,611,558,946 |
d2bb66456dbf2e932012fffb71a65fd44276e7a3
|
/app/src/main/java/cn/gdcp/myapplication/MainActivity.java
|
e5b7733d12cf32978f53742bba6f2242ae9cab05
|
[] |
no_license
|
xiaozhupeiqixx/MyApplicatione
|
https://github.com/xiaozhupeiqixx/MyApplicatione
|
99253a30ceaf1db4345b63d8489b51771668db43
|
68d268b875992f2057f65db655803be1113633ed
|
refs/heads/master
| 2020-03-28T03:24:37.677000 | 2018-09-06T08:36:30 | 2018-09-06T08:36:30 | 147,643,150 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.gdcp.myapplication;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView textView;
private Button button;
private ImageView imageView;
private int[] arr={R.drawable.as,R.drawable.as1,R.drawable.as2,R.drawable.as3,R.drawable.as4,};
private int index;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=findViewById(R.id.text1);
textView.setTextColor(Color.BLUE);
imageView=findViewById(R.id.img1);
button=findViewById(R.id.button1);
button.setTextColor(Color.RED);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setImageResource(arr[index]);
index=(index+1)%arr.length;
}
});
}
}
|
UTF-8
|
Java
| 1,140 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package cn.gdcp.myapplication;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView textView;
private Button button;
private ImageView imageView;
private int[] arr={R.drawable.as,R.drawable.as1,R.drawable.as2,R.drawable.as3,R.drawable.as4,};
private int index;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=findViewById(R.id.text1);
textView.setTextColor(Color.BLUE);
imageView=findViewById(R.id.img1);
button=findViewById(R.id.button1);
button.setTextColor(Color.RED);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setImageResource(arr[index]);
index=(index+1)%arr.length;
}
});
}
}
| 1,140 | 0.703509 | 0.695614 | 37 | 29.81081 | 20.908859 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.756757 | false | false |
3
|
b72b993fd2c403157d04b911b15ca5f545c6c089
| 34,239,479,329,972 |
c9231f5ebca199f8de67a0ee66c2612a460ec9cb
|
/RunGoogleAPI/src/org/handuraby/memorize/mvp/MemoModel.java
|
e9dcf818ce9a6ced917db54ca0f5e5abdc4f4581
|
[] |
no_license
|
attila9/Handuraby
|
https://github.com/attila9/Handuraby
|
4ae7e07c548a28a95a67267902ec08aaf5c642a4
|
08e2f4a43ff17036d00d74e4e823060b829c0358
|
refs/heads/master
| 2016-08-05T16:48:16.243000 | 2011-11-23T09:20:55 | 2011-11-23T09:20:55 | 2,822,785 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.handuraby.memorize.mvp;
import java.util.List;
public class MemoModel {
// -------------game rules
private boolean randomOrder;
private int maxloadCount;
// ----------game & load settings
private String user;
private boolean validateUploadedContent;
public synchronized boolean isValidateUploadedContent() {
return validateUploadedContent;
}
public synchronized void setValidateUploadedContent(
boolean validateUploadedContent) {
this.validateUploadedContent = validateUploadedContent;
}
// state actual game
public enum GAME_STATE {
INSTALLED, RUNNING, PAUESED, FINISHED
}
GAME_STATE state;
// -----------getter-setter
public synchronized boolean isRandomOrder() {
return randomOrder;
}
public synchronized void setRandomOrder(boolean randomOrder) {
this.randomOrder = randomOrder;
}
public synchronized int getMaxloadCount() {
return maxloadCount;
}
public synchronized void setMaxloadCount(int maxloadCount) {
this.maxloadCount = maxloadCount;
}
public synchronized GAME_STATE getState() {
return state;
}
public synchronized void setState(GAME_STATE state) {
this.state = state;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
}
|
UTF-8
|
Java
| 1,277 |
java
|
MemoModel.java
|
Java
|
[] | null |
[] |
package org.handuraby.memorize.mvp;
import java.util.List;
public class MemoModel {
// -------------game rules
private boolean randomOrder;
private int maxloadCount;
// ----------game & load settings
private String user;
private boolean validateUploadedContent;
public synchronized boolean isValidateUploadedContent() {
return validateUploadedContent;
}
public synchronized void setValidateUploadedContent(
boolean validateUploadedContent) {
this.validateUploadedContent = validateUploadedContent;
}
// state actual game
public enum GAME_STATE {
INSTALLED, RUNNING, PAUESED, FINISHED
}
GAME_STATE state;
// -----------getter-setter
public synchronized boolean isRandomOrder() {
return randomOrder;
}
public synchronized void setRandomOrder(boolean randomOrder) {
this.randomOrder = randomOrder;
}
public synchronized int getMaxloadCount() {
return maxloadCount;
}
public synchronized void setMaxloadCount(int maxloadCount) {
this.maxloadCount = maxloadCount;
}
public synchronized GAME_STATE getState() {
return state;
}
public synchronized void setState(GAME_STATE state) {
this.state = state;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
}
| 1,277 | 0.730619 | 0.730619 | 68 | 17.779411 | 19.165567 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.176471 | false | false |
3
|
55fc28b49f65bb7cb989c69f166082b15f3738b7
| 29,291,677,020,682 |
0feec9a847517c98651771c51f5945d50ef55d2e
|
/src/com/product_tracking/model/ProductTrackingVO.java
|
2e04c7f7680347e572d64d8ef2f5004ae4533d82
|
[] |
no_license
|
air-gi/EA102G4
|
https://github.com/air-gi/EA102G4
|
d9fb111ae13b21ded94499c1527d683e1d656901
|
1657fc867df3f5657089bb9b663b504b37dd0e28
|
refs/heads/master
| 2023-04-18T19:11:12.639000 | 2021-05-06T12:53:14 | 2021-05-06T12:53:14 | 364,875,460 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.product_tracking.model;
import java.io.Serializable;
public class ProductTrackingVO implements Serializable{
private static final long serialVersionUID = 1L;
private String memId;
private String productNo;
public String getMemId() {
return memId;
}
public void setMemId(String memId) {
this.memId = memId;
}
public String getProductNo() {
return productNo;
}
public void setProductNo(String productNo) {
this.productNo = productNo;
}
}
|
UTF-8
|
Java
| 477 |
java
|
ProductTrackingVO.java
|
Java
|
[] | null |
[] |
package com.product_tracking.model;
import java.io.Serializable;
public class ProductTrackingVO implements Serializable{
private static final long serialVersionUID = 1L;
private String memId;
private String productNo;
public String getMemId() {
return memId;
}
public void setMemId(String memId) {
this.memId = memId;
}
public String getProductNo() {
return productNo;
}
public void setProductNo(String productNo) {
this.productNo = productNo;
}
}
| 477 | 0.746331 | 0.744235 | 26 | 17.346153 | 17.258091 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.192308 | false | false |
3
|
7d1b4e3b9e49de61ebee933290c00a0dd45e5158
| 38,920,993,644,248 |
90a2549356fbb292af26681a85e0dcc6809deca3
|
/message/src/main/java/com/canlong/imagesearch/util/ImageUtil.java
|
82c7c02ac350cbb7eaca7325d279bc5d0262eea5
|
[
"Apache-2.0"
] |
permissive
|
qmc000/NewMessage
|
https://github.com/qmc000/NewMessage
|
13c6a099aa6b9fe557ed398456fdceeeece6e900
|
fa3fa612a32d7f9eb0aed736400e3464d78fc8b2
|
refs/heads/master
| 2018-01-10T21:10:44.257000 | 2016-02-01T17:22:08 | 2016-02-01T17:22:08 | 49,614,985 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.canlong.imagesearch.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import android.os.Environment;
public class ImageUtil {
public static List<String> getImageURL(String json) {
if (json == null || "".equals(json)) {
return null;
}
return null;
}
// 获取文件夹的字节大小
public static long getFileSize(File f) throws Exception {
long size = 0;
File flist[] = f.listFiles();
for (int i = 0; i < flist.length; i++) {
if (flist[i].isDirectory()) {
size = size + getFileSize(flist[i]);
} else {
size = size + flist[i].length();
}
}
return size;
}
public static String sendGETRequest(String path) throws Exception {
HttpURLConnection conn = (HttpURLConnection) new URL(path)
.openConnection();
conn.setConnectTimeout(5000);
conn.setRequestMethod("GET");
// if (conn.getResponseCode() == 200) {
InputStream inStream = conn.getInputStream();
byte[] data = StreamTool.read(inStream);
String result = new String(data);
return result;
// }else{
// return null;
// }
}
public static List<String> resolveImageData(String json) throws Exception {
List<String> list = new ArrayList<String>();
JSONObject object = new JSONObject(json);
JSONArray data = object.getJSONArray("data");
for (int i = 0; i < data.length() - 1; i++) {
String objURL = data.getJSONObject(i).getString("objURL");
list.add(objURL);
}
return list;
}
public static void deleteFile(File f) {
if(f.exists()&&f.isDirectory()){
File[] files = f.listFiles();
for(File file:files){
file.delete();
}
}
}
public static boolean saveImageList(List<String> imageData)throws Exception {
for(String url : imageData){
saveImage(url);
}
return true;
}
public static boolean saveImage(String url) throws Exception{
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
File f = new File(Environment.getExternalStorageDirectory()
+ "/netimage/image/");
if(!f.exists()){
f.mkdirs();
}
File temp = new File(Environment.getExternalStorageDirectory()
+ "/netimage/cache/" + MD5.getMD5(url));
if (temp.exists()) {
FileOutputStream out = new FileOutputStream(f.getPath()+"/"+getSystemTime()+".jpg");
FileInputStream in = new FileInputStream(temp);
byte[] buffer = new byte[1024];
int len = 0;
while((len = in.read(buffer))!=-1){
out.write(buffer, 0, len);
}
out.close();
in.close();
return true;
}
}
return false;
}
public static String getSystemTime(){
long time = System.currentTimeMillis();
Date date = new Date(time);
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmmss");
return sdf.format(date)+time%1000;
}
}
|
UTF-8
|
Java
| 3,022 |
java
|
ImageUtil.java
|
Java
|
[] | null |
[] |
package com.canlong.imagesearch.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import android.os.Environment;
public class ImageUtil {
public static List<String> getImageURL(String json) {
if (json == null || "".equals(json)) {
return null;
}
return null;
}
// 获取文件夹的字节大小
public static long getFileSize(File f) throws Exception {
long size = 0;
File flist[] = f.listFiles();
for (int i = 0; i < flist.length; i++) {
if (flist[i].isDirectory()) {
size = size + getFileSize(flist[i]);
} else {
size = size + flist[i].length();
}
}
return size;
}
public static String sendGETRequest(String path) throws Exception {
HttpURLConnection conn = (HttpURLConnection) new URL(path)
.openConnection();
conn.setConnectTimeout(5000);
conn.setRequestMethod("GET");
// if (conn.getResponseCode() == 200) {
InputStream inStream = conn.getInputStream();
byte[] data = StreamTool.read(inStream);
String result = new String(data);
return result;
// }else{
// return null;
// }
}
public static List<String> resolveImageData(String json) throws Exception {
List<String> list = new ArrayList<String>();
JSONObject object = new JSONObject(json);
JSONArray data = object.getJSONArray("data");
for (int i = 0; i < data.length() - 1; i++) {
String objURL = data.getJSONObject(i).getString("objURL");
list.add(objURL);
}
return list;
}
public static void deleteFile(File f) {
if(f.exists()&&f.isDirectory()){
File[] files = f.listFiles();
for(File file:files){
file.delete();
}
}
}
public static boolean saveImageList(List<String> imageData)throws Exception {
for(String url : imageData){
saveImage(url);
}
return true;
}
public static boolean saveImage(String url) throws Exception{
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
File f = new File(Environment.getExternalStorageDirectory()
+ "/netimage/image/");
if(!f.exists()){
f.mkdirs();
}
File temp = new File(Environment.getExternalStorageDirectory()
+ "/netimage/cache/" + MD5.getMD5(url));
if (temp.exists()) {
FileOutputStream out = new FileOutputStream(f.getPath()+"/"+getSystemTime()+".jpg");
FileInputStream in = new FileInputStream(temp);
byte[] buffer = new byte[1024];
int len = 0;
while((len = in.read(buffer))!=-1){
out.write(buffer, 0, len);
}
out.close();
in.close();
return true;
}
}
return false;
}
public static String getSystemTime(){
long time = System.currentTimeMillis();
Date date = new Date(time);
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmmss");
return sdf.format(date)+time%1000;
}
}
| 3,022 | 0.677548 | 0.669554 | 116 | 24.887932 | 20.455069 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.405172 | false | false |
3
|
becfc66e5dcc5a495e5dd1766e0788f2053b85c1
| 30,219,389,958,077 |
cada1010b6b17e30b5ad98af22a07277682f339d
|
/src/main/java/coop/tecso/examen/titularescuentasapi/util/Validador.java
|
fb90d2c33d8690bbc0abcdd044b01d6a8f317bac
|
[] |
no_license
|
ccastillo32/titulares-cuentas-api-con-seguridad
|
https://github.com/ccastillo32/titulares-cuentas-api-con-seguridad
|
0f88a96aa99763658b4a88324cd69cf7c2f42576
|
4dfa3d4cdf167903e386e186e290bfa39241946b
|
refs/heads/master
| 2022-01-09T00:19:44.443000 | 2019-05-17T13:35:27 | 2019-05-17T13:35:27 | 186,958,436 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package coop.tecso.examen.titularescuentasapi.util;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import coop.tecso.examen.titularescuentasapi.dto.TitularFisicoDto;
import coop.tecso.examen.titularescuentasapi.dto.TitularJuridicoDto;
public class Validador {
public static List<String> validarTitularFisico(TitularFisicoDto titularFisico) {
List<String> validaciones = new ArrayList<>();
boolean cuitEsValido = false;
String cuit = titularFisico.getCuit();
String dni = titularFisico.getDni();
String nombres = titularFisico.getNombre();
String apellidos = titularFisico.getApellido();
// validar cuit
if(esVacio(cuit)) {
validaciones.add("El campo CUIT es obligatorio");
} else if(!esUnCUITValido(cuit)) {
validaciones.add("El campo CUIT debe tener el formato (20|23|24|27|30|33|34)-XXXXXXXX-X");
}
cuitEsValido = validaciones.isEmpty();
// validar dni
if(esVacio(dni)) {
validaciones.add("El campo DNI es obligatorio");
} else if(!esNumero(dni)) {
validaciones.add("El campo DNI debe ser un número");
} else if(!(dni.length() == 8)) {
validaciones.add("El campo DNI debe ser de 8 caracteres");
} else if(cuitEsValido && !(cuit.contains(dni))) {
validaciones.add("El campo DNI no esta contenido como una parte del CUIT");
}
// validar nombres
if(esVacio(nombres)) {
validaciones.add("El nombre del titular es obligatorio");
} else if(!tieneSoloLetrasYEspacios(nombres)) {
validaciones.add("El nombre del titular debe tener solo letras y espacios");
} else if(nombres.length() > 80) {
validaciones.add("El nombre del titular debe ser de máximo 80 caracteres");
}
// validar apellidos
if(esVacio(apellidos)) {
validaciones.add("El apellido del titular es obligatorio");
} else if(!tieneSoloLetrasYEspacios(nombres)) {
validaciones.add("El apellido del titular debe tener solo letras y espacios");
} else if(apellidos.length() > 250) {
validaciones.add("El apellido del titular debe ser de máximo 250 caracteres");
}
return validaciones;
}
public static List<String> validarTitularJuridico(TitularJuridicoDto titularJuridico) {
List<String> validaciones = new ArrayList<>();
String cuit = titularJuridico.getCuit();
String razonSocial = titularJuridico.getRazonSocial();
Integer anioFundacion = titularJuridico.getAnioFundacion();
// validar cuit
if(esVacio(cuit)) {
validaciones.add("El campo CUIT es obligatorio");
} else if(!esUnCUITValido(cuit)) {
validaciones.add("El campo CUIT debe tener el formato (20|23|24|27|30|33|34)-XXXXXXXX-X");
}
// validar razon social
if(esVacio(razonSocial)) {
validaciones.add("El campo razón social es obligatorio");
} else if(razonSocial.length() > 100) {
validaciones.add("El campo razón social debe ser de máximo 100 caracteres");
}
// validar anio fundacion
if(esVacio(anioFundacion)) {
validaciones.add("El nombre del titular es obligatorio");
} else if(anioFundacion.intValue() == 0) {
validaciones.add("El campo año de fundacion no puede ser cero");
} else if(esMayorAlAnioActual(anioFundacion.intValue())) {
validaciones.add("El año de fundación no puede ser mayor al año actual");
}
return validaciones;
}
public static boolean esUnCUITValido(String cuit) {
String regex = "\\b(20|23|24|27|30|33|34)(\\D)?[0-9]{8}(\\D)?[0-9]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(cuit);
return matcher.matches();
}
public static boolean esVacio(String valor) {
return valor == null || valor.isEmpty();
}
public static boolean esVacio(Integer valor) {
return valor == null || valor.intValue() == 0;
}
public static boolean esVacio(Object valor) {
return valor == null;
}
public static boolean esNumero(String valor) {
String regex = "\\d+";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(valor);
return matcher.matches();
}
public static boolean tieneSoloLetrasYEspacios(String valor) {
String regex = "^[\\p{L} .'-]+$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(valor);
return matcher.matches();
}
public static boolean esMayorAlAnioActual(int valor) {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return valor > calendar.get(Calendar.YEAR);
}
}
|
ISO-8859-1
|
Java
| 5,250 |
java
|
Validador.java
|
Java
|
[] | null |
[] |
package coop.tecso.examen.titularescuentasapi.util;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import coop.tecso.examen.titularescuentasapi.dto.TitularFisicoDto;
import coop.tecso.examen.titularescuentasapi.dto.TitularJuridicoDto;
public class Validador {
public static List<String> validarTitularFisico(TitularFisicoDto titularFisico) {
List<String> validaciones = new ArrayList<>();
boolean cuitEsValido = false;
String cuit = titularFisico.getCuit();
String dni = titularFisico.getDni();
String nombres = titularFisico.getNombre();
String apellidos = titularFisico.getApellido();
// validar cuit
if(esVacio(cuit)) {
validaciones.add("El campo CUIT es obligatorio");
} else if(!esUnCUITValido(cuit)) {
validaciones.add("El campo CUIT debe tener el formato (20|23|24|27|30|33|34)-XXXXXXXX-X");
}
cuitEsValido = validaciones.isEmpty();
// validar dni
if(esVacio(dni)) {
validaciones.add("El campo DNI es obligatorio");
} else if(!esNumero(dni)) {
validaciones.add("El campo DNI debe ser un número");
} else if(!(dni.length() == 8)) {
validaciones.add("El campo DNI debe ser de 8 caracteres");
} else if(cuitEsValido && !(cuit.contains(dni))) {
validaciones.add("El campo DNI no esta contenido como una parte del CUIT");
}
// validar nombres
if(esVacio(nombres)) {
validaciones.add("El nombre del titular es obligatorio");
} else if(!tieneSoloLetrasYEspacios(nombres)) {
validaciones.add("El nombre del titular debe tener solo letras y espacios");
} else if(nombres.length() > 80) {
validaciones.add("El nombre del titular debe ser de máximo 80 caracteres");
}
// validar apellidos
if(esVacio(apellidos)) {
validaciones.add("El apellido del titular es obligatorio");
} else if(!tieneSoloLetrasYEspacios(nombres)) {
validaciones.add("El apellido del titular debe tener solo letras y espacios");
} else if(apellidos.length() > 250) {
validaciones.add("El apellido del titular debe ser de máximo 250 caracteres");
}
return validaciones;
}
public static List<String> validarTitularJuridico(TitularJuridicoDto titularJuridico) {
List<String> validaciones = new ArrayList<>();
String cuit = titularJuridico.getCuit();
String razonSocial = titularJuridico.getRazonSocial();
Integer anioFundacion = titularJuridico.getAnioFundacion();
// validar cuit
if(esVacio(cuit)) {
validaciones.add("El campo CUIT es obligatorio");
} else if(!esUnCUITValido(cuit)) {
validaciones.add("El campo CUIT debe tener el formato (20|23|24|27|30|33|34)-XXXXXXXX-X");
}
// validar razon social
if(esVacio(razonSocial)) {
validaciones.add("El campo razón social es obligatorio");
} else if(razonSocial.length() > 100) {
validaciones.add("El campo razón social debe ser de máximo 100 caracteres");
}
// validar anio fundacion
if(esVacio(anioFundacion)) {
validaciones.add("El nombre del titular es obligatorio");
} else if(anioFundacion.intValue() == 0) {
validaciones.add("El campo año de fundacion no puede ser cero");
} else if(esMayorAlAnioActual(anioFundacion.intValue())) {
validaciones.add("El año de fundación no puede ser mayor al año actual");
}
return validaciones;
}
public static boolean esUnCUITValido(String cuit) {
String regex = "\\b(20|23|24|27|30|33|34)(\\D)?[0-9]{8}(\\D)?[0-9]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(cuit);
return matcher.matches();
}
public static boolean esVacio(String valor) {
return valor == null || valor.isEmpty();
}
public static boolean esVacio(Integer valor) {
return valor == null || valor.intValue() == 0;
}
public static boolean esVacio(Object valor) {
return valor == null;
}
public static boolean esNumero(String valor) {
String regex = "\\d+";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(valor);
return matcher.matches();
}
public static boolean tieneSoloLetrasYEspacios(String valor) {
String regex = "^[\\p{L} .'-]+$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(valor);
return matcher.matches();
}
public static boolean esMayorAlAnioActual(int valor) {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return valor > calendar.get(Calendar.YEAR);
}
}
| 5,250 | 0.612595 | 0.599809 | 143 | 35.643356 | 26.869642 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.573427 | false | false |
3
|
9409dd6095f529b0f3abc7c605f08713f7be7d08
| 34,540,127,036,456 |
5ab3f025fe62046ced661803e4faa19bb66b7f05
|
/RMIserver/src/Account.java
|
efd56e4cb0f48478f4a9051535a6370002518da6
|
[] |
no_license
|
creaghstc/RMI-Banking-Application
|
https://github.com/creaghstc/RMI-Banking-Application
|
ab26c4832eb8335647efe494574f3be9b588fd18
|
c016f4bbc41d777a1fe81716788a4a0b7e3b1918
|
refs/heads/master
| 2021-01-19T19:25:25.479000 | 2017-08-23T14:45:57 | 2017-08-23T14:45:57 | 101,191,212 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.ArrayList;
import java.util.Date;
import java.time.LocalDate;
//Conor Creagh 13454222
public class Account {
//variables
private ArrayList<Transaction> transactions = new ArrayList<Transaction>();
private String username;
private String password;
private int accountNo;
private int balance;
LocalDate localDate;
//constructor
public Account(String Username, String Password, int AccountNo, int Balance){
username = Username;
password = Password;
accountNo = AccountNo;
balance = Balance;
}
//setter for username
public void setUsername(String name){
username = name;
}
//setter for password
public void setPassword(String pass){
password = pass;
}
//setter for account number
public void setAccountNo(int number){
accountNo = number;
}
//setter for balance
public void setBalance(int bal){
balance = bal;
}
//getter for username
public String getUsername() {
return username;
}
//getter for password
public String getPassword() {
return password;
}
//deposit method
public void depositFunds(int amount) {
balance += amount; //increment balance to amaount parameter
System.out.println(amount + " Succesfully deposited"); //report
transactions.add(new Transaction(LocalDate.now(), "Deposit : " + amount )); //log transaction
}
//getter account number
public int getAccountNo() {
return accountNo;
}
//withdraw method
public void withdrawFunds(int amount) {
balance -= amount; //decrement amount
System.out.println(amount + " Succesfully withdrawn"); //report
transactions.add(new Transaction(localDate.now(), "Withdraw: " + amount )); //log transaction
}
//getter for balance
public int getbalance() {
return balance;
}
//search transactions method
public void searchTransactions(LocalDate from, LocalDate to){
System.out.println("--------STATEMENT--------");
for(Transaction t : transactions){ //loop over transactions
if(t.getDate().isAfter(from) && t.getDate().isBefore(to)){ //check if is after and before search params
System.out.println(t.getDate()+ " :" + t.getInfo()); //print t to user
}
else{
System.out.println("No transactions in current date Parameters"); //inform user if no transactions in given window
}
}
}
}
|
UTF-8
|
Java
| 2,261 |
java
|
Account.java
|
Java
|
[
{
"context": "rt java.util.Date;\nimport java.time.LocalDate;\n\n//Conor Creagh 13454222\npublic class Account {\n\t//variables\n\tpri",
"end": 94,
"score": 0.9998726844787598,
"start": 82,
"tag": "NAME",
"value": "Conor Creagh"
},
{
"context": "assword, int AccountNo, int Balance){\n\t\tusername = Username;\n\t\tpassword = Password;\n\t\taccountNo = AccountNo;\n",
"end": 453,
"score": 0.9955916404724121,
"start": 445,
"tag": "USERNAME",
"value": "Username"
},
{
"context": " int Balance){\n\t\tusername = Username;\n\t\tpassword = Password;\n\t\taccountNo = AccountNo;\n\t\tbalance = Balance;\n\t}",
"end": 476,
"score": 0.9988235831260681,
"start": 468,
"tag": "PASSWORD",
"value": "Password"
},
{
"context": "public void setPassword(String pass){\n\t\tpassword = pass;\n\t}\n\t//setter for account number\n\tpublic void set",
"end": 692,
"score": 0.9859728217124939,
"start": 688,
"tag": "PASSWORD",
"value": "pass"
},
{
"context": "r username\n\tpublic String getUsername() {\n\t\treturn username;\n\t}\n\t//getter for password\n\tpublic String getPass",
"end": 937,
"score": 0.5358812212944031,
"start": 929,
"tag": "USERNAME",
"value": "username"
},
{
"context": "r password\n\tpublic String getPassword() {\n\t\treturn password;\n\t}\n\t//deposit method\n\tpublic void depositFunds(i",
"end": 1013,
"score": 0.9610767364501953,
"start": 1005,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
import java.util.ArrayList;
import java.util.Date;
import java.time.LocalDate;
//<NAME> 13454222
public class Account {
//variables
private ArrayList<Transaction> transactions = new ArrayList<Transaction>();
private String username;
private String password;
private int accountNo;
private int balance;
LocalDate localDate;
//constructor
public Account(String Username, String Password, int AccountNo, int Balance){
username = Username;
password = <PASSWORD>;
accountNo = AccountNo;
balance = Balance;
}
//setter for username
public void setUsername(String name){
username = name;
}
//setter for password
public void setPassword(String pass){
password = <PASSWORD>;
}
//setter for account number
public void setAccountNo(int number){
accountNo = number;
}
//setter for balance
public void setBalance(int bal){
balance = bal;
}
//getter for username
public String getUsername() {
return username;
}
//getter for password
public String getPassword() {
return <PASSWORD>;
}
//deposit method
public void depositFunds(int amount) {
balance += amount; //increment balance to amaount parameter
System.out.println(amount + " Succesfully deposited"); //report
transactions.add(new Transaction(LocalDate.now(), "Deposit : " + amount )); //log transaction
}
//getter account number
public int getAccountNo() {
return accountNo;
}
//withdraw method
public void withdrawFunds(int amount) {
balance -= amount; //decrement amount
System.out.println(amount + " Succesfully withdrawn"); //report
transactions.add(new Transaction(localDate.now(), "Withdraw: " + amount )); //log transaction
}
//getter for balance
public int getbalance() {
return balance;
}
//search transactions method
public void searchTransactions(LocalDate from, LocalDate to){
System.out.println("--------STATEMENT--------");
for(Transaction t : transactions){ //loop over transactions
if(t.getDate().isAfter(from) && t.getDate().isBefore(to)){ //check if is after and before search params
System.out.println(t.getDate()+ " :" + t.getInfo()); //print t to user
}
else{
System.out.println("No transactions in current date Parameters"); //inform user if no transactions in given window
}
}
}
}
| 2,265 | 0.71517 | 0.711632 | 84 | 25.916666 | 25.878475 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.738095 | false | false |
3
|
a9d61669014ae49c4f11bc73f94cb6a881383f01
| 34,351,148,485,883 |
9876a4465b088a025c0c489e80f27a81ec845fae
|
/app/src/main/java/vmap/a2016/khkt/myvmap/AppActivities/video_activity.java
|
14916f48c8201e46e1368991ba46030abad5e19f
|
[] |
no_license
|
ntvthuyen/MyVmap
|
https://github.com/ntvthuyen/MyVmap
|
694f70e1d5d63960bcb5a96860c6a89badd10a39
|
892ed1c83eec15d7c2eda23ce8a2732c6feca279
|
refs/heads/master
| 2022-06-30T18:54:05.350000 | 2019-05-13T04:46:26 | 2019-05-13T04:46:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package vmap.a2016.khkt.myvmap.AppActivities;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import vmap.a2016.khkt.myvmap.HTML5WebView.HTML5WebView;
public class video_activity extends AppCompatActivity {
HTML5WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_video);
// WebView myVideo = (WebView) findViewById(R.id.webView);
// myVideo.setWebChromeClient(new WebChromeClient());
// myVideo.setWebViewClient(new WebViewClient() {
// @Override
// public boolean shouldOverrideUrlLoading(WebView view, String url) {
// return false;
// }
// });
Intent callerIntent = getIntent();
Bundle packageFromCaller = callerIntent.getBundleExtra("getVIDEO");
String myText = packageFromCaller.getString("VIDEO");
// myVideo.getSettings().setJavaScriptEnabled(true);
//myVideo.loadData(myText, "text/html", "utf-8");
// myVideo.loadUrl(myText);;
mWebView = new HTML5WebView(video_activity.this);
if (savedInstanceState != null) {
mWebView.restoreState(savedInstanceState);
} else {
mWebView.loadUrl(myText);
}
setContentView(mWebView.getLayout());
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mWebView.saveState(outState);
}
@Override
public void onStop() {
super.onStop();
mWebView.stopLoading();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mWebView.inCustomView()) {
mWebView.hideCustomView();
// mWebView.goBack();
//mWebView.goBack();6
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}
|
UTF-8
|
Java
| 2,113 |
java
|
video_activity.java
|
Java
|
[] | null |
[] |
package vmap.a2016.khkt.myvmap.AppActivities;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import vmap.a2016.khkt.myvmap.HTML5WebView.HTML5WebView;
public class video_activity extends AppCompatActivity {
HTML5WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_video);
// WebView myVideo = (WebView) findViewById(R.id.webView);
// myVideo.setWebChromeClient(new WebChromeClient());
// myVideo.setWebViewClient(new WebViewClient() {
// @Override
// public boolean shouldOverrideUrlLoading(WebView view, String url) {
// return false;
// }
// });
Intent callerIntent = getIntent();
Bundle packageFromCaller = callerIntent.getBundleExtra("getVIDEO");
String myText = packageFromCaller.getString("VIDEO");
// myVideo.getSettings().setJavaScriptEnabled(true);
//myVideo.loadData(myText, "text/html", "utf-8");
// myVideo.loadUrl(myText);;
mWebView = new HTML5WebView(video_activity.this);
if (savedInstanceState != null) {
mWebView.restoreState(savedInstanceState);
} else {
mWebView.loadUrl(myText);
}
setContentView(mWebView.getLayout());
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mWebView.saveState(outState);
}
@Override
public void onStop() {
super.onStop();
mWebView.stopLoading();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mWebView.inCustomView()) {
mWebView.hideCustomView();
// mWebView.goBack();
//mWebView.goBack();6
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}
| 2,113 | 0.628017 | 0.620918 | 68 | 30.07353 | 22.361546 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.558824 | false | false |
3
|
cc575be2285152fee50f7e74451426b80ca88a8f
| 38,482,906,990,715 |
809792ede00f148c9a07da194452c637e0eaa03d
|
/limelight_webapp/src/main/java/org/yeastrc/limelight/limelight_webapp/file_import_pipeline_run/dao/FileImportAndPipelineRunTrackingDAO.java
|
cb02ab05356ae4fc8dd1170372df0e832c528f47
|
[
"Apache-2.0"
] |
permissive
|
yeastrc/limelight-core
|
https://github.com/yeastrc/limelight-core
|
80eb23d62c3b967db42b12a3e90cd1b2878ea793
|
bc609c814f67393b787f31c4d813e8fec9ec1b96
|
refs/heads/master
| 2023-08-31T20:37:29.180000 | 2023-08-21T21:21:48 | 2023-08-21T21:21:48 | 159,243,534 | 5 | 3 |
Apache-2.0
| false | 2023-03-03T01:30:00 | 2018-11-26T22:52:14 | 2023-01-31T10:41:56 | 2023-03-03T01:29:58 | 34,603 | 4 | 2 | 10 |
TypeScript
| false | false |
/*
* Original author: Daniel Jaschob <djaschob .at. uw.edu>
*
* Copyright 2018 University of Washington - Seattle, WA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yeastrc.limelight.limelight_webapp.file_import_pipeline_run.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.yeastrc.limelight.limelight_shared.constants.Database_OneTrueZeroFalse_Constants;
import org.yeastrc.limelight.limelight_shared.file_import_limelight_xml_scans.enum_classes.FileImportStatus;
import org.yeastrc.limelight.limelight_shared.file_import_pipeline_run.dto.FileImportAndPipelineRunTrackingDTO;
import org.yeastrc.limelight.limelight_shared.file_import_pipeline_run.enum_classes.FileImportAndPipelineRun_RequestType;
import org.yeastrc.limelight.limelight_webapp.db.Limelight_JDBC_Base;
/**
* table import_and_pipeline_run_tracking_tbl
*
*/
@Component
public class FileImportAndPipelineRunTrackingDAO extends Limelight_JDBC_Base implements FileImportAndPipelineRunTrackingDAO_IF {
private static final Logger log = LoggerFactory.getLogger( FileImportAndPipelineRunTrackingDAO.class );
/**
* @param id
* @return
* @throws Exception
*/
@Override
public FileImportAndPipelineRunTrackingDTO getForId( int id ) throws Exception {
FileImportAndPipelineRunTrackingDTO result = null;
final String sql = "SELECT * FROM import_and_pipeline_run_tracking_tbl WHERE id = ?";
try ( Connection connection = super.getDBConnection();
PreparedStatement preparedStatement = connection.prepareStatement( sql ) ) {
preparedStatement.setInt( 1, id );
try ( ResultSet rs = preparedStatement.executeQuery() ) {
if ( rs.next() ) {
result = populateResultObject( rs );
}
}
} catch ( Exception e ) {
String msg = "Failed to select FileImportAndPipelineRunTrackingDTO, id: " + id + ", sql: " + sql;
log.error( msg, e );
throw e;
}
return result;
}
/**
* @param rs
* @return
* @throws SQLException
*/
private FileImportAndPipelineRunTrackingDTO populateResultObject( ResultSet rs ) throws SQLException {
FileImportAndPipelineRunTrackingDTO returnItem = new FileImportAndPipelineRunTrackingDTO();
returnItem.setId( rs.getInt( "id" ) );
returnItem.setRequestType( FileImportAndPipelineRun_RequestType.fromValue( rs.getInt( "request_type" ) ) );
returnItem.setProjectId( rs.getInt( "project_id" ) );
returnItem.setPriority( rs.getInt( "priority" ) );
returnItem.setStatus( FileImportStatus.fromValue( rs.getInt( "status_id" ) ) );
returnItem.setUserId( rs.getInt( "insert_request_user_id" ) );
// Skipped some fields
return returnItem;
}
// Spring DB Transactions
@Override
@Transactional( propagation = Propagation.REQUIRED ) // Do NOT throw checked exceptions, they don't trigger rollback in Spring Transactions
public void save( FileImportAndPipelineRunTrackingDTO item ) {
// Insert field "id" since not autoincrement
final String sql = "INSERT INTO import_and_pipeline_run_tracking_tbl ( "
+ " id, request_type, project_id, priority, status_id, marked_for_deletion, insert_request_url, "
+ " insert_request_user_id, "
+ " insert_request__remote_user_ip_address )"
+ " VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sql );
int counter = 0;
counter++;
pstmt.setInt( counter, item.getId() );
counter++;
pstmt.setInt( counter, item.getRequestType().value() );
counter++;
pstmt.setInt( counter, item.getProjectId() );
counter++;
pstmt.setInt( counter, item.getPriority() );
counter++;
pstmt.setInt( counter, item.getStatus().value() );
counter++;
if ( item.isMarkedForDeletion() ) {
pstmt.setInt( counter, Database_OneTrueZeroFalse_Constants.DATABASE_FIELD_TRUE );
} else {
pstmt.setInt( counter, Database_OneTrueZeroFalse_Constants.DATABASE_FIELD_FALSE );
}
counter++;
pstmt.setString( counter, item.getInsertRequestURL() );
counter++;
pstmt.setInt( counter, item.getUserId() );
counter++;
pstmt.setString( counter, item.getInsertRequest_RemoteUserIpAddress() );
return pstmt;
}
});
} catch ( RuntimeException e ) {
String msg = "item: " + item + ", item.id: " + item.getId() + ", SQL: " + sql;
log.error( msg, e );
throw e;
}
}
/**
* @param status
* @param id
* @return true if record updated, false otherwise
* @throws Exception
*/
@Override
public boolean updateStatus( FileImportStatus status, int id ) throws Exception {
boolean recordUpdated = false;
String sql = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET "
+ " status_id = ?, last_updated_date_time = NOW() "
+ " WHERE id = ?";
final String sqlFinal = sql;
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setInt( counter, status.value() );
counter++;
pstmt.setInt( counter, id );
return pstmt;
}
});
if ( rowsUpdated > 0 ) {
recordUpdated = true;
}
} catch ( RuntimeException e ) {
String msg = "updateStatus(...) id: " + id + ", SQL: " + sql;
log.error( msg, e );
throw e;
}
return recordUpdated;
}
/**
* @param status
* @param id
* @return true if record updated, false otherwise
* @throws Exception
*/
@Override
public void updateStatus_All_IdList( FileImportStatus status, List<Integer> id_List ) throws Exception {
final String sql_Start = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET "
+ " status_id = ?, last_updated_date_time = NOW() "
+ " WHERE id IN (";
StringBuilder sqlSB = new StringBuilder(10000);
sqlSB.append( sql_Start );
for ( int counter = 1; counter <= id_List.size(); counter++ ) {
if ( counter != 1 ) {
sqlSB.append( "," );
}
sqlSB.append( "?" );
}
sqlSB.append( ")" );
final String sqlFinal = sqlSB.toString();
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setInt( counter, status.value() );
for ( Integer id : id_List ) {
counter++;
pstmt.setInt( counter, id );
}
return pstmt;
}
});
// if ( rowsUpdated > 0 ) {
// recordUpdated = true;
// }
} catch ( RuntimeException e ) {
String msg = "updateStatus_All_IdList(...) id_List: " + StringUtils.join( id_List, ", " ) + ", SQL: " + sqlFinal;
log.error( msg, e );
throw e;
}
}
/**
* @param status
* @param id
* @return true if record updated, false otherwise
* @throws Exception
*/
@Override
public boolean update__request_data( FileImportAndPipelineRunTrackingDTO item ) throws Exception {
boolean recordUpdated = false;
String sql = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET "
+ " request_data = ?, request_data_format_version_number = ?, request_data_contents_version_number = ?, "
+ " request_data__label_value_pairs__json = ?, "
+ " request_data__label_value_pairs__json__format_version_number = ?, "
+ " request_data__label_value_pairs__json__content_version_number = ?, "
+ " last_updated_date_time = NOW() "
+ " WHERE id = ?";
final String sqlFinal = sql;
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setString( counter, item.getRequestData_AsString() );
counter++;
pstmt.setInt( counter, item.getRequestData_Format_VersionNumber() );
counter++;
pstmt.setInt( counter, item.getRequestData_Content_VersionNumber() );
counter++;
pstmt.setString( counter, item.getRequestData_LabelValuePairs_JSON_AsString() );
counter++;
pstmt.setInt( counter, item.getRequestData_LabelValuePairs_JSON_Format_VersionNumber() );
counter++;
pstmt.setInt( counter, item.getRequestData_LabelValuePairs_JSON_Content_VersionNumber() );
counter++;
pstmt.setInt( counter, item.getId() );
return pstmt;
}
});
if ( rowsUpdated > 0 ) {
recordUpdated = true;
}
} catch ( RuntimeException e ) {
String msg = "updateStatus(...) id: " + item.getId() + ", SQL: " + sql;
log.error( msg, e );
throw e;
}
return recordUpdated;
}
/**
* @param id
* @param status_ToExclude - Do NOT update if has this status
* @param deletedByUserId
* @throws Exception
*/
@Override
public void setMarkedForDeletionForId_ExcludingStatus(
int id, FileImportStatus status_ToExclude, int deletedByUserId ) throws Exception {
final String sqlFinal = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET marked_for_deletion = " + Database_OneTrueZeroFalse_Constants.DATABASE_FIELD_TRUE
+ " , last_updated_date_time = NOW(),"
+ " deleted_by_user_id = ?, deleted_date_time = NOW() "
+ " WHERE id = ? AND status_id != ?";
;
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setInt( counter, deletedByUserId );
counter++;
pstmt.setInt( counter, id );
counter++;
pstmt.setInt( counter, status_ToExclude.value() );
return pstmt;
}
});
} catch ( RuntimeException e ) {
String msg = "setMarkedForDeletionForId_ExcludingStatus(...) id: " + id + ", SQL: " + sqlFinal;
log.error( msg, e );
throw e;
}
}
}
|
UTF-8
|
Java
| 11,936 |
java
|
FileImportAndPipelineRunTrackingDAO.java
|
Java
|
[
{
"context": "/*\n* Original author: Daniel Jaschob <djaschob .at. uw.edu>\n* \n* Copy",
"end": 36,
"score": 0.9998807907104492,
"start": 22,
"tag": "NAME",
"value": "Daniel Jaschob"
},
{
"context": "/*\n* Original author: Daniel Jaschob <djaschob .at. uw.edu>\n* \n* Copyrig",
"end": 39,
"score": 0.7700455188751221,
"start": 38,
"tag": "EMAIL",
"value": "d"
}
] | null |
[] |
/*
* Original author: <NAME> <djaschob .at. uw.edu>
*
* Copyright 2018 University of Washington - Seattle, WA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yeastrc.limelight.limelight_webapp.file_import_pipeline_run.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.yeastrc.limelight.limelight_shared.constants.Database_OneTrueZeroFalse_Constants;
import org.yeastrc.limelight.limelight_shared.file_import_limelight_xml_scans.enum_classes.FileImportStatus;
import org.yeastrc.limelight.limelight_shared.file_import_pipeline_run.dto.FileImportAndPipelineRunTrackingDTO;
import org.yeastrc.limelight.limelight_shared.file_import_pipeline_run.enum_classes.FileImportAndPipelineRun_RequestType;
import org.yeastrc.limelight.limelight_webapp.db.Limelight_JDBC_Base;
/**
* table import_and_pipeline_run_tracking_tbl
*
*/
@Component
public class FileImportAndPipelineRunTrackingDAO extends Limelight_JDBC_Base implements FileImportAndPipelineRunTrackingDAO_IF {
private static final Logger log = LoggerFactory.getLogger( FileImportAndPipelineRunTrackingDAO.class );
/**
* @param id
* @return
* @throws Exception
*/
@Override
public FileImportAndPipelineRunTrackingDTO getForId( int id ) throws Exception {
FileImportAndPipelineRunTrackingDTO result = null;
final String sql = "SELECT * FROM import_and_pipeline_run_tracking_tbl WHERE id = ?";
try ( Connection connection = super.getDBConnection();
PreparedStatement preparedStatement = connection.prepareStatement( sql ) ) {
preparedStatement.setInt( 1, id );
try ( ResultSet rs = preparedStatement.executeQuery() ) {
if ( rs.next() ) {
result = populateResultObject( rs );
}
}
} catch ( Exception e ) {
String msg = "Failed to select FileImportAndPipelineRunTrackingDTO, id: " + id + ", sql: " + sql;
log.error( msg, e );
throw e;
}
return result;
}
/**
* @param rs
* @return
* @throws SQLException
*/
private FileImportAndPipelineRunTrackingDTO populateResultObject( ResultSet rs ) throws SQLException {
FileImportAndPipelineRunTrackingDTO returnItem = new FileImportAndPipelineRunTrackingDTO();
returnItem.setId( rs.getInt( "id" ) );
returnItem.setRequestType( FileImportAndPipelineRun_RequestType.fromValue( rs.getInt( "request_type" ) ) );
returnItem.setProjectId( rs.getInt( "project_id" ) );
returnItem.setPriority( rs.getInt( "priority" ) );
returnItem.setStatus( FileImportStatus.fromValue( rs.getInt( "status_id" ) ) );
returnItem.setUserId( rs.getInt( "insert_request_user_id" ) );
// Skipped some fields
return returnItem;
}
// Spring DB Transactions
@Override
@Transactional( propagation = Propagation.REQUIRED ) // Do NOT throw checked exceptions, they don't trigger rollback in Spring Transactions
public void save( FileImportAndPipelineRunTrackingDTO item ) {
// Insert field "id" since not autoincrement
final String sql = "INSERT INTO import_and_pipeline_run_tracking_tbl ( "
+ " id, request_type, project_id, priority, status_id, marked_for_deletion, insert_request_url, "
+ " insert_request_user_id, "
+ " insert_request__remote_user_ip_address )"
+ " VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sql );
int counter = 0;
counter++;
pstmt.setInt( counter, item.getId() );
counter++;
pstmt.setInt( counter, item.getRequestType().value() );
counter++;
pstmt.setInt( counter, item.getProjectId() );
counter++;
pstmt.setInt( counter, item.getPriority() );
counter++;
pstmt.setInt( counter, item.getStatus().value() );
counter++;
if ( item.isMarkedForDeletion() ) {
pstmt.setInt( counter, Database_OneTrueZeroFalse_Constants.DATABASE_FIELD_TRUE );
} else {
pstmt.setInt( counter, Database_OneTrueZeroFalse_Constants.DATABASE_FIELD_FALSE );
}
counter++;
pstmt.setString( counter, item.getInsertRequestURL() );
counter++;
pstmt.setInt( counter, item.getUserId() );
counter++;
pstmt.setString( counter, item.getInsertRequest_RemoteUserIpAddress() );
return pstmt;
}
});
} catch ( RuntimeException e ) {
String msg = "item: " + item + ", item.id: " + item.getId() + ", SQL: " + sql;
log.error( msg, e );
throw e;
}
}
/**
* @param status
* @param id
* @return true if record updated, false otherwise
* @throws Exception
*/
@Override
public boolean updateStatus( FileImportStatus status, int id ) throws Exception {
boolean recordUpdated = false;
String sql = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET "
+ " status_id = ?, last_updated_date_time = NOW() "
+ " WHERE id = ?";
final String sqlFinal = sql;
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setInt( counter, status.value() );
counter++;
pstmt.setInt( counter, id );
return pstmt;
}
});
if ( rowsUpdated > 0 ) {
recordUpdated = true;
}
} catch ( RuntimeException e ) {
String msg = "updateStatus(...) id: " + id + ", SQL: " + sql;
log.error( msg, e );
throw e;
}
return recordUpdated;
}
/**
* @param status
* @param id
* @return true if record updated, false otherwise
* @throws Exception
*/
@Override
public void updateStatus_All_IdList( FileImportStatus status, List<Integer> id_List ) throws Exception {
final String sql_Start = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET "
+ " status_id = ?, last_updated_date_time = NOW() "
+ " WHERE id IN (";
StringBuilder sqlSB = new StringBuilder(10000);
sqlSB.append( sql_Start );
for ( int counter = 1; counter <= id_List.size(); counter++ ) {
if ( counter != 1 ) {
sqlSB.append( "," );
}
sqlSB.append( "?" );
}
sqlSB.append( ")" );
final String sqlFinal = sqlSB.toString();
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setInt( counter, status.value() );
for ( Integer id : id_List ) {
counter++;
pstmt.setInt( counter, id );
}
return pstmt;
}
});
// if ( rowsUpdated > 0 ) {
// recordUpdated = true;
// }
} catch ( RuntimeException e ) {
String msg = "updateStatus_All_IdList(...) id_List: " + StringUtils.join( id_List, ", " ) + ", SQL: " + sqlFinal;
log.error( msg, e );
throw e;
}
}
/**
* @param status
* @param id
* @return true if record updated, false otherwise
* @throws Exception
*/
@Override
public boolean update__request_data( FileImportAndPipelineRunTrackingDTO item ) throws Exception {
boolean recordUpdated = false;
String sql = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET "
+ " request_data = ?, request_data_format_version_number = ?, request_data_contents_version_number = ?, "
+ " request_data__label_value_pairs__json = ?, "
+ " request_data__label_value_pairs__json__format_version_number = ?, "
+ " request_data__label_value_pairs__json__content_version_number = ?, "
+ " last_updated_date_time = NOW() "
+ " WHERE id = ?";
final String sqlFinal = sql;
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setString( counter, item.getRequestData_AsString() );
counter++;
pstmt.setInt( counter, item.getRequestData_Format_VersionNumber() );
counter++;
pstmt.setInt( counter, item.getRequestData_Content_VersionNumber() );
counter++;
pstmt.setString( counter, item.getRequestData_LabelValuePairs_JSON_AsString() );
counter++;
pstmt.setInt( counter, item.getRequestData_LabelValuePairs_JSON_Format_VersionNumber() );
counter++;
pstmt.setInt( counter, item.getRequestData_LabelValuePairs_JSON_Content_VersionNumber() );
counter++;
pstmt.setInt( counter, item.getId() );
return pstmt;
}
});
if ( rowsUpdated > 0 ) {
recordUpdated = true;
}
} catch ( RuntimeException e ) {
String msg = "updateStatus(...) id: " + item.getId() + ", SQL: " + sql;
log.error( msg, e );
throw e;
}
return recordUpdated;
}
/**
* @param id
* @param status_ToExclude - Do NOT update if has this status
* @param deletedByUserId
* @throws Exception
*/
@Override
public void setMarkedForDeletionForId_ExcludingStatus(
int id, FileImportStatus status_ToExclude, int deletedByUserId ) throws Exception {
final String sqlFinal = "UPDATE import_and_pipeline_run_tracking_tbl "
+ " SET marked_for_deletion = " + Database_OneTrueZeroFalse_Constants.DATABASE_FIELD_TRUE
+ " , last_updated_date_time = NOW(),"
+ " deleted_by_user_id = ?, deleted_date_time = NOW() "
+ " WHERE id = ? AND status_id != ?";
;
// Use Spring JdbcTemplate so Transactions work properly
try {
int rowsUpdated = this.getJdbcTemplate().update(
new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement pstmt =
connection.prepareStatement( sqlFinal );
int counter = 0;
counter++;
pstmt.setInt( counter, deletedByUserId );
counter++;
pstmt.setInt( counter, id );
counter++;
pstmt.setInt( counter, status_ToExclude.value() );
return pstmt;
}
});
} catch ( RuntimeException e ) {
String msg = "setMarkedForDeletionForId_ExcludingStatus(...) id: " + id + ", SQL: " + sqlFinal;
log.error( msg, e );
throw e;
}
}
}
| 11,928 | 0.670241 | 0.667979 | 378 | 30.576719 | 30.575533 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.492064 | false | false |
3
|
fe728907292f087b6b01928726570b5c42ecd92e
| 39,230,231,306,118 |
fe5965763a5bf5013a7ed9fd6d7685e1e9e37856
|
/src/main/java/seedu/algobase/logic/parser/tag/EditTagCommandParser.java
|
d1c176fd30e90abf843298bc881bef879f67dcf3
|
[
"MIT"
] |
permissive
|
AY1920S1-CS2103T-W11-1/main
|
https://github.com/AY1920S1-CS2103T-W11-1/main
|
063061de6c02e2d84b71adacd006b76f8292ca84
|
884578867b5cfd435f84162ec0c29518b918f819
|
refs/heads/master
| 2020-07-21T05:29:39.323000 | 2019-11-11T15:10:17 | 2019-11-11T15:10:17 | 206,759,466 | 0 | 11 |
NOASSERTION
| true | 2019-11-11T15:14:26 | 2019-09-06T09:23:32 | 2019-11-11T15:10:21 | 2019-11-11T15:14:25 | 56,136 | 0 | 5 | 0 |
Java
| false | false |
package seedu.algobase.logic.parser.tag;
import static java.util.Objects.requireNonNull;
import static seedu.algobase.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.algobase.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.algobase.logic.parser.CliSyntax.PREFIX_TAG_COLOR;
import java.util.Optional;
import java.util.stream.Stream;
import seedu.algobase.commons.core.index.Index;
import seedu.algobase.logic.commands.tag.EditTagCommand;
import seedu.algobase.logic.parser.ArgumentMultimap;
import seedu.algobase.logic.parser.ArgumentTokenizer;
import seedu.algobase.logic.parser.Parser;
import seedu.algobase.logic.parser.ParserUtil;
import seedu.algobase.logic.parser.Prefix;
import seedu.algobase.logic.parser.exceptions.ParseException;
/**
* Parses input arguments and creates a new EditTagCommand object
*/
public class EditTagCommandParser implements Parser<EditTagCommand> {
/**
* Parses the given {@code String} of arguments in the context of the EditTagCommand
* and returns an EditTagCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public EditTagCommand parse(String args) throws ParseException {
requireNonNull(args);
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_TAG, PREFIX_TAG_COLOR);
Index index;
try {
index = ParserUtil.parseIndex(argMultimap.getPreamble());
} catch (ParseException pe) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditTagCommand.MESSAGE_USAGE), pe);
}
Optional<String> name;
if (arePrefixesPresent(argMultimap, PREFIX_TAG)) {
name = Optional.ofNullable(argMultimap.getValue(PREFIX_TAG).get());
} else {
name = Optional.empty();
}
Optional<String> color;
if (arePrefixesPresent(argMultimap, PREFIX_TAG_COLOR)) {
color = Optional.ofNullable(argMultimap.getValue(PREFIX_TAG_COLOR).get());
} else {
color = Optional.empty();
}
return new EditTagCommand(index, name, color);
}
private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
}
}
|
UTF-8
|
Java
| 2,422 |
java
|
EditTagCommandParser.java
|
Java
|
[] | null |
[] |
package seedu.algobase.logic.parser.tag;
import static java.util.Objects.requireNonNull;
import static seedu.algobase.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.algobase.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.algobase.logic.parser.CliSyntax.PREFIX_TAG_COLOR;
import java.util.Optional;
import java.util.stream.Stream;
import seedu.algobase.commons.core.index.Index;
import seedu.algobase.logic.commands.tag.EditTagCommand;
import seedu.algobase.logic.parser.ArgumentMultimap;
import seedu.algobase.logic.parser.ArgumentTokenizer;
import seedu.algobase.logic.parser.Parser;
import seedu.algobase.logic.parser.ParserUtil;
import seedu.algobase.logic.parser.Prefix;
import seedu.algobase.logic.parser.exceptions.ParseException;
/**
* Parses input arguments and creates a new EditTagCommand object
*/
public class EditTagCommandParser implements Parser<EditTagCommand> {
/**
* Parses the given {@code String} of arguments in the context of the EditTagCommand
* and returns an EditTagCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public EditTagCommand parse(String args) throws ParseException {
requireNonNull(args);
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_TAG, PREFIX_TAG_COLOR);
Index index;
try {
index = ParserUtil.parseIndex(argMultimap.getPreamble());
} catch (ParseException pe) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditTagCommand.MESSAGE_USAGE), pe);
}
Optional<String> name;
if (arePrefixesPresent(argMultimap, PREFIX_TAG)) {
name = Optional.ofNullable(argMultimap.getValue(PREFIX_TAG).get());
} else {
name = Optional.empty();
}
Optional<String> color;
if (arePrefixesPresent(argMultimap, PREFIX_TAG_COLOR)) {
color = Optional.ofNullable(argMultimap.getValue(PREFIX_TAG_COLOR).get());
} else {
color = Optional.empty();
}
return new EditTagCommand(index, name, color);
}
private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
}
}
| 2,422 | 0.718415 | 0.718415 | 62 | 38.064518 | 31.694036 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.596774 | false | false |
3
|
193df2e670ffa793f40034174f1e27e35ffd4122
| 39,213,051,433,985 |
5dd26c226ad5d040853c0de71570cd7705e7e1be
|
/Implementation/src/test/java/lightBehaviours/TestStraightLightBehaviourGermany.java
|
ee35cc9e5251f9319cce9205be625051ab8bc3d6
|
[
"MIT"
] |
permissive
|
Warglaive/Project-3-Reactive-Systems-on-22-01-2021
|
https://github.com/Warglaive/Project-3-Reactive-Systems-on-22-01-2021
|
13056864a877f75a658e7f2cbc250aefb3db0d16
|
965b6eee626993697be3c3ecf618a3858632f988
|
refs/heads/main
| 2023-02-22T22:55:45.025000 | 2021-01-23T12:21:25 | 2021-01-23T12:21:25 | 332,187,398 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lightBehaviours;
import lights.observer.StraightTrafficObserverLight;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.Mockito;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public class TestStraightLightBehaviourGermany {
StraightTrafficObserverLight mockedStraightTrafficLight;
@BeforeEach
public void init() {
mockedStraightTrafficLight = mock(StraightTrafficObserverLight.class, Mockito.CALLS_REAL_METHODS);
}
@ParameterizedTest
@CsvSource({
//startBehaviour, expectedBehaviour
"RED, REDYELLOW",
"REDYELLOW, GREEN",
"GREEN, YELLOW",
"YELLOW, RED"
})
public void testStateMachineChange(StraightTrafficLightBehaviourGermany startBehaviour,
StraightTrafficLightBehaviourGermany expectedBehaviour) {
startBehaviour.changeColor(mockedStraightTrafficLight);
verify(mockedStraightTrafficLight).setChangeBehaviour(expectedBehaviour);
}
@ParameterizedTest
@CsvSource({
//startBehaviour, expectedBehaviour
"RED, redYellow",
"REDYELLOW, green",
"GREEN, yellow",
"YELLOW, red"
})
public void testStateMachineChangeReturnsColor(StraightTrafficLightBehaviourGermany startBehaviour,
String expected) {
String actual = startBehaviour.changeColor(mockedStraightTrafficLight);
assertEquals(expected, actual);
}
@ParameterizedTest
@CsvSource({
//behaviour, expectedColor
"RED, red",
"REDYELLOW, redYellow",
"YELLOW, yellow",
"GREEN, green"
})
public void testGetColor(StraightTrafficLightBehaviourGermany behaviour, String expected) {
String color = behaviour.getColor();
assertEquals(expected, color);
}
@Test
public void testGoStateCorrect() {
assertThat(StraightTrafficLightBehaviourGermany.RED.getGoState())
.isEqualTo(StraightTrafficLightBehaviourGermany.GREEN);
}
@Test
public void testStopStateCorrect() {
assertThat(StraightTrafficLightBehaviourGermany.RED.getStopState())
.isEqualTo(StraightTrafficLightBehaviourGermany.RED);
}
@ParameterizedTest
@CsvSource({
//startBehaviour, expectedBehaviour
"RED, REDYELLOW",
"REDYELLOW, GREEN",
"GREEN, YELLOW",
"YELLOW, RED"
})
public void testNextStateCorrect(StraightTrafficLightBehaviourGermany startBehaviour,
StraightTrafficLightBehaviourGermany expected) {
assertThat(startBehaviour.getNextState()).isEqualTo(expected);
}
}
|
UTF-8
|
Java
| 3,085 |
java
|
TestStraightLightBehaviourGermany.java
|
Java
|
[] | null |
[] |
package lightBehaviours;
import lights.observer.StraightTrafficObserverLight;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.Mockito;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public class TestStraightLightBehaviourGermany {
StraightTrafficObserverLight mockedStraightTrafficLight;
@BeforeEach
public void init() {
mockedStraightTrafficLight = mock(StraightTrafficObserverLight.class, Mockito.CALLS_REAL_METHODS);
}
@ParameterizedTest
@CsvSource({
//startBehaviour, expectedBehaviour
"RED, REDYELLOW",
"REDYELLOW, GREEN",
"GREEN, YELLOW",
"YELLOW, RED"
})
public void testStateMachineChange(StraightTrafficLightBehaviourGermany startBehaviour,
StraightTrafficLightBehaviourGermany expectedBehaviour) {
startBehaviour.changeColor(mockedStraightTrafficLight);
verify(mockedStraightTrafficLight).setChangeBehaviour(expectedBehaviour);
}
@ParameterizedTest
@CsvSource({
//startBehaviour, expectedBehaviour
"RED, redYellow",
"REDYELLOW, green",
"GREEN, yellow",
"YELLOW, red"
})
public void testStateMachineChangeReturnsColor(StraightTrafficLightBehaviourGermany startBehaviour,
String expected) {
String actual = startBehaviour.changeColor(mockedStraightTrafficLight);
assertEquals(expected, actual);
}
@ParameterizedTest
@CsvSource({
//behaviour, expectedColor
"RED, red",
"REDYELLOW, redYellow",
"YELLOW, yellow",
"GREEN, green"
})
public void testGetColor(StraightTrafficLightBehaviourGermany behaviour, String expected) {
String color = behaviour.getColor();
assertEquals(expected, color);
}
@Test
public void testGoStateCorrect() {
assertThat(StraightTrafficLightBehaviourGermany.RED.getGoState())
.isEqualTo(StraightTrafficLightBehaviourGermany.GREEN);
}
@Test
public void testStopStateCorrect() {
assertThat(StraightTrafficLightBehaviourGermany.RED.getStopState())
.isEqualTo(StraightTrafficLightBehaviourGermany.RED);
}
@ParameterizedTest
@CsvSource({
//startBehaviour, expectedBehaviour
"RED, REDYELLOW",
"REDYELLOW, GREEN",
"GREEN, YELLOW",
"YELLOW, RED"
})
public void testNextStateCorrect(StraightTrafficLightBehaviourGermany startBehaviour,
StraightTrafficLightBehaviourGermany expected) {
assertThat(startBehaviour.getNextState()).isEqualTo(expected);
}
}
| 3,085 | 0.67034 | 0.67034 | 88 | 34.05682 | 28.126484 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.693182 | false | false |
3
|
c1e9d2b70f435041696b03effa7539bd5b2ed5a9
| 24,953,760,057,216 |
909313f9295d578a0fdc1358bca836934ca60352
|
/src/No160/TwoPoint_160.java
|
203883769003fe14137c759780ea5a8e1088bdb2
|
[] |
no_license
|
BUhdh951018/LeetCode
|
https://github.com/BUhdh951018/LeetCode
|
d41fe21ce95894d1139c2471a21073197f5ab20a
|
60e66e52975a81d2687a2b2179636cdd0bf540e1
|
refs/heads/master
| 2023-04-15T06:26:17.894000 | 2023-04-10T11:49:39 | 2023-04-10T11:49:39 | 252,291,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package No160;
import structure.ListNode;
public class TwoPoint_160 {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
ListNode pa = headA, pb = headB;
while (pa != pb) {
/*pa = pa != null ? pa.next : headB;
pb = pb != null ? pb.next : headA;*/
if (pa != null) {
pa = pa.next;
} else {
pa = headB;
}
if (pb != null) {
pb = pb.next;
} else {
pb = headA;
}
}
return pa;
}
}
|
UTF-8
|
Java
| 595 |
java
|
TwoPoint_160.java
|
Java
|
[] | null |
[] |
package No160;
import structure.ListNode;
public class TwoPoint_160 {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
ListNode pa = headA, pb = headB;
while (pa != pb) {
/*pa = pa != null ? pa.next : headB;
pb = pb != null ? pb.next : headA;*/
if (pa != null) {
pa = pa.next;
} else {
pa = headB;
}
if (pb != null) {
pb = pb.next;
} else {
pb = headA;
}
}
return pa;
}
}
| 595 | 0.415126 | 0.405042 | 24 | 23.791666 | 16.608179 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
e807bfabd91031d8a59998d75cdbf3bd21829049
| 37,391,985,313,234 |
2ebf3e9e92b1d9f154c4f3382639604ae71caf32
|
/app/src/main/java/anulom/executioner/com/anulom/services/Biometricdatalist.java
|
a8e019ab5f54ecce2736eb4202738d38a608dcdf
|
[] |
no_license
|
AmbigaManick/ExecutionerVersionV2
|
https://github.com/AmbigaManick/ExecutionerVersionV2
|
0a60710ba4d86e5b6a3789487e21522e0e376a79
|
294f5d5e56a9cdaf95fb659483d2f4a31b089105
|
refs/heads/master
| 2020-07-22T16:47:45.013000 | 2019-09-09T08:47:08 | 2019-09-09T08:47:08 | 207,264,470 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package anulom.executioner.com.anulom.services;
import android.app.ProgressDialog;
import android.app.Service;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import anulom.executioner.com.anulom.GenericMethods;
import anulom.executioner.com.anulom.database.DBManager;
import anulom.executioner.com.anulom.database.DBOperation;
import anulom.executioner.com.anulom.fragment.CompletedDetails;
import anulom.executioner.com.anulom.fragment.NewDetails;
import anulom.executioner.com.anulom.fragment.OlderDetails;
import anulom.executioner.com.anulom.fragment.TodayDetails;
import static anulom.executioner.com.anulom.database.DBManager.TableInfo.TABLE_NAME_APPOINTMENT;
public class Biometricdatalist extends Service {
String startnewdate, startnewtime1, startnewtime2;
ArrayList<String> ownername = new ArrayList<>();
ArrayList<String> ownercontact = new ArrayList<>();
ArrayList<String> documentid = new ArrayList<>();
ArrayList<String> appointmentaddress = new ArrayList<>();
ArrayList<String> executionerid = new ArrayList<>();
ArrayList<String> appointmentid = new ArrayList<>();
ArrayList<String> commentid = new ArrayList<>();
ArrayList<String> Addpayid = new ArrayList<>();
ArrayList<String> userlist = new ArrayList<>();
ArrayList<HashMap<String, String>> getCommentDatalist = null;
ArrayList<HashMap<String, String>> getAlldataList = null;
ArrayList<HashMap<String, String>> getuserdataList = null;
JSONArray ja = null;
JSONArray ja3 = null;
JSONArray ja4 = null;
JSONArray ja5 = null;
JSONArray ja20 = null;
JSONArray ja25 = null;
GenericMethods response;
String APPOINTMENTURL = "";
String ID1;
DBOperation db;
private String username2 = "";
ProgressDialog pDialog1;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
db = new DBOperation(getApplicationContext());
response = new GenericMethods();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try {
SharedPreferences usermail = PreferenceManager.getDefaultSharedPreferences(this);
username2 = usermail.getString("username", "");
String password2 = usermail.getString("password", "");
APPOINTMENTURL = GenericMethods.MAIN_URL + "/api/v3/get_exec_data?get_auth_token=DOtUBMhv5pk51tl0D37uBcezq85cXNN7hZQ7&exec_email=" + username2 + "&password=" + password2 + "&version="+GenericMethods.apiversion;
System.out.println("values from get biometric all data service file");
arraylistclear();
db = new DBOperation(getApplicationContext());
new GetContacts().execute();
} catch (Exception e) {
e.printStackTrace();
}
return super.onStartCommand(intent, flags, startId);
}
private void arraylistclear() {
ownername.clear();
ownercontact.clear();
documentid.clear();
appointmentaddress.clear();
executionerid.clear();
appointmentid.clear();
commentid.clear();
Addpayid.clear();
userlist.clear();
}
private class GetContacts extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... arg0) {
String jsonStr = "";
try {
jsonStr = response.doGetRequest(APPOINTMENTURL);
} catch (IOException e) {
e.printStackTrace();
}
Log.d("Response: ", "> " + jsonStr);
if (jsonStr != null || !jsonStr.trim().isEmpty()) {
try {
JSONObject jsonObject = null;
jsonObject = new JSONObject(jsonStr);
String jStrResult = jsonObject.getString("status");
String jStrResult1 = jsonObject.getString("version");
GenericMethods.apiversion = jStrResult1;
} catch (JSONException e) {
e.printStackTrace();
}
}
getAlldataList = db.getAllData(db);
for (int i = 0; i < getAlldataList.size(); i++) {
documentid.add(getAlldataList.get(i).get("Did"));
appointmentid.add(getAlldataList.get(i).get("Aid"));
ownername.add(getAlldataList.get(i).get("Oname"));
executionerid.add(getAlldataList.get(i).get("Exid"));
}
getuserdataList = db.getdataList(db);
for (int i = 0; i < getuserdataList.size(); i++) {
userlist.add(getuserdataList.get(i).get("UserId"));
}
getCommentDatalist = db.getCommentlist(db);
for (int i = 0; i < getCommentDatalist.size(); i++) {
commentid.add(getCommentDatalist.get(i).get("Cid"));
}
if (jsonStr != null) {
try {
JSONObject jsonObj = new JSONObject(jsonStr);
ja = jsonObj.getJSONArray(GenericMethods.TAG_NAME);
ja3 = jsonObj.getJSONArray(GenericMethods.TAG_NAME3);
ja4 = jsonObj.getJSONArray(GenericMethods.TAG_NAME4);
ja20 = jsonObj.getJSONArray(GenericMethods.TAG_NAME14);
ja25 = jsonObj.getJSONArray(GenericMethods.TAG_NAME20);
for (int i = 0; i < ja.length(); i++) {
JSONObject c = ja.getJSONObject(i);
String rtoken1 = c.getString(GenericMethods.TAG_RTOKEN);
String rkey1 = c.getString(GenericMethods.TAG_REPORT_KEY);
String sgrn = c.getString(GenericMethods.TAG_sgrn);
String rgrn = c.getString(GenericMethods.TAG_rgrn);
String uname1 = c.getString(GenericMethods.TAG_UNAME);
String email1 = c.getString(GenericMethods.TAG_UEMAIL);
String contact_number1 = c.getString(GenericMethods.TAG_UCONTACT);
String paddress1 = c.getString(GenericMethods.TAG_PADDRESS);
String oname1 = c.getString(GenericMethods.TAG_ONAME);
String ocontact1 = c.getString(GenericMethods.TAG_OCONTACT);
String oemail1 = c.getString(GenericMethods.TAG_OEMAIL);
String oaddress1 = c.getString(GenericMethods.TAG_OADDRESS);
String tname1 = c.getString(GenericMethods.TAG_TNAME);
String tcontact1 = c.getString(GenericMethods.TAG_TCONTACT);
String temail1 = c.getString(GenericMethods.TAG_TEMAIL);
String taddress1 = c.getString(GenericMethods.TAG_TADDRESS);
String status1 = c.getString(GenericMethods.TAG_STATUS);
String appdate = c.getString(GenericMethods.TAG_APPDATE);
String biocomp = c.getString(GenericMethods.TAG_BIO_COMP);
String appdate1 = c.getString(GenericMethods.TAG_APPDATE1);
String biocomp1 = c.getString(GenericMethods.TAG_BIO_COMP1);
String regfromcomp = c.getString(GenericMethods.TAG_REG_FROM_COMP);
String witness = c.getString(GenericMethods.TAG_WITNESS);
String shipadd = c.getString(GenericMethods.TAG_SHIP_ADDRESS);
String shipdiffadd = c.getString(GenericMethods.TAG_SHIP_DIFF_ADDRESS);
String strlatitude, strlongitude;
if (c.has(GenericMethods.TAG_CUSTOMER_LAT)) {
strlatitude = c.getString(GenericMethods.TAG_CUSTOMER_LAT);
} else strlatitude = "0";
if (c.has(GenericMethods.TAG_CUSTOMER_LONG)) {
strlongitude = c.getString(GenericMethods.TAG_CUSTOMER_LONG);
} else strlongitude = "0";
String docid = c.getString(GenericMethods.TAG_DOCID);
String app_status = c.getString(GenericMethods.TAG_APP_STATUS);
String appid = c.getString(GenericMethods.TAG_APPID);
String start1 = c.getString(GenericMethods.TAG_START1);
String start2 = c.getString(GenericMethods.TAG_START2);
String appaddress = c.getString(GenericMethods.TAG_APPADDRESS);
String exeid = c.getString(GenericMethods.TAG_EXECUTIONER_ID);
String appfor = c.getString(GenericMethods.TAG_APP_FOR);
String apptype = c.getString(GenericMethods.TAG_APPTYPE);
String post_status = c.getString(GenericMethods.TAG_POST_STATUS);
String landmark = c.getString(GenericMethods.TAG_LANDMARK);
String contact_person = c.getString(GenericMethods.TAG_CONTACTPERSON);
String distance1 = c.getString(GenericMethods.TAG_CUSTOMER_DISTANCE);
String amount1 = c.getString(GenericMethods.TAG_CUSTOMER_AMOUNT);
String transporttype1 = c.getString(GenericMethods.TAG_CUSTOMER_TRANS_TYPE);
String biostatus = c.getString(GenericMethods.TAG_DOC_BIOMETRIC_STATUS);
JSONObject jsonatten = ja.getJSONObject(i);
JSONArray jsonattendees = jsonatten.getJSONArray(GenericMethods.TAG_NAME13);
if (jsonattendees != null) {
for (int j = 0; j < jsonattendees.length(); j++) {
JSONObject atten = jsonattendees.getJSONObject(j);
if (atten != null) {
String name = atten.getString(GenericMethods.TAG_NAMEATTEND);
String email = atten.getString(GenericMethods.TAG_EMAILATTEND);
String contact = atten.getString(GenericMethods.TAG_CONTACTATTEND);
db.Insertbioattendees(db, ID1, name, email, contact, appid, username2);
}
}
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
SimpleDateFormat output = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat output1 = new SimpleDateFormat("HH:mm");
SimpleDateFormat output2 = new SimpleDateFormat("HH:mm");
java.util.Date date, time1, time2;
try {
date = sdf.parse(start1);
time1 = sdf.parse(start1);
time2 = sdf.parse(start2);
startnewdate = output.format(date);
startnewtime1 = output1.format(time1);
startnewtime2 = output2.format(time2);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (documentid.contains(docid)) {
db.Update(db, docid, rtoken1, rkey1, uname1, email1, contact_number1, paddress1, oname1,
ocontact1, oemail1, oaddress1, tname1, tcontact1, temail1, taddress1, status1,
appdate, biocomp, appdate1, biocomp1, regfromcomp, witness, shipadd, shipdiffadd, apptype, biostatus,sgrn,rgrn);
} else {
if (!db.DocumentID(db, docid)) {
db.InsertRecord(db, rtoken1, rkey1, uname1, email1, contact_number1, paddress1, oname1,
ocontact1, oemail1, oaddress1, tname1, tcontact1, temail1, taddress1, status1,
username2, docid, appdate, biocomp, appdate1, biocomp1, regfromcomp, witness, shipadd,
shipdiffadd, "SYNC", apptype, biostatus,sgrn,rgrn);
}
}
if (appointmentid.contains(appid)) {
db.Updateacvr(db, appid, docid, startnewdate, startnewtime1, startnewtime2, appaddress, exeid,
appfor, distance1, amount1, transporttype1, contact_person, landmark, "", post_status, strlatitude, strlongitude, "false", app_status);
} else {
db.InsertRecord2(db, docid, appid, startnewdate, startnewtime1, startnewtime2, appaddress,
exeid, appfor, distance1, amount1, transporttype1, "SYNC", contact_person, landmark, "", post_status, strlatitude, strlongitude, "false", app_status);
}
for (int i1 = 0; i1 < db.getnotificationtable(db).size(); i1++) {
if (db.getnotificationtable(db).get(i1).get("appid").equals(appid)) {
db.Updateacvr(db, appid, docid, startnewdate, startnewtime1, startnewtime2, appaddress, exeid,
appfor, distance1, amount1, transporttype1, contact_person, landmark, "", post_status, strlatitude, strlongitude, "true", app_status);
}
}
}
for (int l = 0; l < ja3.length(); l++) {
JSONObject c = ja3.getJSONObject(l);
String userid = c.getString(GenericMethods.TAG_USERID);
String username = c.getString(GenericMethods.TAG_USERNAME);
String email = c.getString(GenericMethods.TAG_EMAIL);
String role = c.getString(GenericMethods.TAG_ROLE);
String platformid = c.getString(GenericMethods.TAG_PLATFORMID);
String roleid = c.getString(GenericMethods.TAG_ROLEID);
String idu = c.getString(GenericMethods.TAG_IDu);
if (userlist.contains(userid)) {
db.Updateuser(db, userid, username, email, role, platformid, roleid, idu);
} else {
if (!db.checkUserId(db, userid)) {
db.InsertRecord5(db, userid, username, email, role, platformid, roleid, idu);
}
}
}
for (int n = 0; n < ja4.length(); n++) {
JSONObject c = ja4.getJSONObject(n);
String DocumentId = c.getString(GenericMethods.TAG_DOCUMENTID);
String Amt = c.getString(GenericMethods.TAG_PAYAMOUNT);
String ReportKey = c.getString(GenericMethods.TAG_REPORTKEY);
db.Insertbiopayment(db, ID1, DocumentId, ReportKey, Amt, username2);
}
for (int n = 0; n < ja20.length(); n++) {
JSONObject c = ja20.getJSONObject(n);
String DocumentId = c.getString(GenericMethods.TAG_DOCUMENTID);
String att_status = c.getString(GenericMethods.Tag_att_status);
SQLiteDatabase sqldb = db.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(DBManager.TableInfo.att_status, att_status);
sqldb.update(TABLE_NAME_APPOINTMENT, values, DBManager.TableInfo.DocumentId + "=?", new String[]{DocumentId});
sqldb.close();
}
ja5 = jsonObj.getJSONArray(GenericMethods.TAG_NAME5);
for (int n = 0; n < ja5.length(); n++) {
JSONObject c = ja5.getJSONObject(n);
String Document1 = c.getString(GenericMethods.TAG_DOCUMENT);
String Attendance = c.getString(GenericMethods.TAG_ATTENDANCE);
String name = c.getString(GenericMethods.TAG_NAMENEW);
String email = c.getString(GenericMethods.TAG_EMAILNEW);
String partytype = c.getString(GenericMethods.TAG_PARTYTYPE);
String poa = c.getString(GenericMethods.TAG_POA);
String contact = c.getString(GenericMethods.TAG_CONTACTNUMBER);
String biometric = c.getString(GenericMethods.TAG_BIOMETRIC);
String address = c.getString(GenericMethods.TAG_PARTY_ADDRESS);
db.Insertbioparties(db, ID1, Document1, Attendance, name, startnewdate, email, partytype, poa, contact, biometric, address, username2);
}
for (int n = 0; n < ja25.length(); n++) {
JSONObject c = ja25.getJSONObject(n);
String penaltyid = c.getString(GenericMethods.penalty_id);
String penaly_appid = c.getString(GenericMethods.penalty_appointment_id);
String penalty_docid = c.getString(GenericMethods.penalty_doc_id);
String penalty_execid = c.getString(GenericMethods.penalty_exec_id);
String penalty_amount = c.getString(GenericMethods.penalty_amount);
String penalty_verify = c.getString(GenericMethods.penalty_verify);
String penalty_type = c.getString(GenericMethods.penalty_type);
String penalty_managercomment = c.getString(GenericMethods.penalty_manager_comment);
String penalty_systemreason = c.getString(GenericMethods.penalty_system_reason);
String penalty_createdat = c.getString(GenericMethods.penalty_created_at);
String penalty_env = c.getString(GenericMethods.penalty_env);
db.InsertPenaltyreports(db, ID1, penaltyid, penaly_appid, penalty_docid, penalty_execid, penalty_amount, penalty_verify, penalty_type, penalty_managercomment, penalty_systemreason, penalty_createdat, penalty_env,username2);
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if (TodayDetails.thisToday != null) {
TodayDetails.thisToday.reFreshReload();
}
if (OlderDetails.thisOlderDetails != null) {
OlderDetails.thisOlderDetails.reFreshReload();
}
if (NewDetails.thisnewDetails != null) {
NewDetails.thisnewDetails.reFreshReload();
}
if (CompletedDetails.thiscompleteDetails != null) {
CompletedDetails.thiscompleteDetails.reFreshReload();
}
stopSelf();
}
}
}
|
UTF-8
|
Java
| 21,100 |
java
|
Biometricdatalist.java
|
Java
|
[
{
"context": "his);\n username2 = usermail.getString(\"username\", \"\");\n String password2 = usermail.ge",
"end": 2866,
"score": 0.9897605776786804,
"start": 2858,
"tag": "USERNAME",
"value": "username"
},
{
"context": ".MAIN_URL + \"/api/v3/get_exec_data?get_auth_token=DOtUBMhv5pk51tl0D37uBcezq85cXNN7hZQ7&exec_email=\" + username2 + \"&pass",
"end": 3054,
"score": 0.575488269329071,
"start": 3034,
"tag": "PASSWORD",
"value": "DOtUBMhv5pk51tl0D37u"
},
{
"context": "/get_exec_data?get_auth_token=DOtUBMhv5pk51tl0D37uBcezq85cXNN7hZQ7&exec_email=\" + username2 + \"&passw",
"end": 3055,
"score": 0.5060634016990662,
"start": 3054,
"tag": "KEY",
"value": "B"
},
{
"context": "get_exec_data?get_auth_token=DOtUBMhv5pk51tl0D37uBcezq85cXNN7hZQ7&exec_email=\" + username2 + \"&password=\" ",
"end": 3061,
"score": 0.5215680599212646,
"start": 3055,
"tag": "PASSWORD",
"value": "cezq85"
},
{
"context": "ec_data?get_auth_token=DOtUBMhv5pk51tl0D37uBcezq85cXNN7hZQ7&exec_email=\" + username2 + \"&password=\" + pa",
"end": 3065,
"score": 0.5268146991729736,
"start": 3061,
"tag": "KEY",
"value": "cXNN"
},
{
"context": "ata?get_auth_token=DOtUBMhv5pk51tl0D37uBcezq85cXNN7hZQ7&exec_email=\" + username2 + \"&password=\" + passwor",
"end": 3070,
"score": 0.5444777607917786,
"start": 3065,
"tag": "PASSWORD",
"value": "7hZQ7"
},
{
"context": "XNN7hZQ7&exec_email=\" + username2 + \"&password=\" + password2 + \"&version=\"+GenericMethods.apiversion;\n ",
"end": 3122,
"score": 0.9971336126327515,
"start": 3113,
"tag": "PASSWORD",
"value": "password2"
},
{
"context": "ees(db, ID1, name, email, contact, appid, username2);\n\n\n }\n\n ",
"end": 11322,
"score": 0.9452729821205139,
"start": 11321,
"tag": "USERNAME",
"value": "2"
}
] | null |
[] |
package anulom.executioner.com.anulom.services;
import android.app.ProgressDialog;
import android.app.Service;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import anulom.executioner.com.anulom.GenericMethods;
import anulom.executioner.com.anulom.database.DBManager;
import anulom.executioner.com.anulom.database.DBOperation;
import anulom.executioner.com.anulom.fragment.CompletedDetails;
import anulom.executioner.com.anulom.fragment.NewDetails;
import anulom.executioner.com.anulom.fragment.OlderDetails;
import anulom.executioner.com.anulom.fragment.TodayDetails;
import static anulom.executioner.com.anulom.database.DBManager.TableInfo.TABLE_NAME_APPOINTMENT;
public class Biometricdatalist extends Service {
String startnewdate, startnewtime1, startnewtime2;
ArrayList<String> ownername = new ArrayList<>();
ArrayList<String> ownercontact = new ArrayList<>();
ArrayList<String> documentid = new ArrayList<>();
ArrayList<String> appointmentaddress = new ArrayList<>();
ArrayList<String> executionerid = new ArrayList<>();
ArrayList<String> appointmentid = new ArrayList<>();
ArrayList<String> commentid = new ArrayList<>();
ArrayList<String> Addpayid = new ArrayList<>();
ArrayList<String> userlist = new ArrayList<>();
ArrayList<HashMap<String, String>> getCommentDatalist = null;
ArrayList<HashMap<String, String>> getAlldataList = null;
ArrayList<HashMap<String, String>> getuserdataList = null;
JSONArray ja = null;
JSONArray ja3 = null;
JSONArray ja4 = null;
JSONArray ja5 = null;
JSONArray ja20 = null;
JSONArray ja25 = null;
GenericMethods response;
String APPOINTMENTURL = "";
String ID1;
DBOperation db;
private String username2 = "";
ProgressDialog pDialog1;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
db = new DBOperation(getApplicationContext());
response = new GenericMethods();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try {
SharedPreferences usermail = PreferenceManager.getDefaultSharedPreferences(this);
username2 = usermail.getString("username", "");
String password2 = usermail.getString("password", "");
APPOINTMENTURL = GenericMethods.MAIN_URL + "/api/v3/get_exec_data?get_auth_token=<PASSWORD>B<PASSWORD>cXNN<PASSWORD>&exec_email=" + username2 + "&password=" + <PASSWORD> + "&version="+GenericMethods.apiversion;
System.out.println("values from get biometric all data service file");
arraylistclear();
db = new DBOperation(getApplicationContext());
new GetContacts().execute();
} catch (Exception e) {
e.printStackTrace();
}
return super.onStartCommand(intent, flags, startId);
}
private void arraylistclear() {
ownername.clear();
ownercontact.clear();
documentid.clear();
appointmentaddress.clear();
executionerid.clear();
appointmentid.clear();
commentid.clear();
Addpayid.clear();
userlist.clear();
}
private class GetContacts extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... arg0) {
String jsonStr = "";
try {
jsonStr = response.doGetRequest(APPOINTMENTURL);
} catch (IOException e) {
e.printStackTrace();
}
Log.d("Response: ", "> " + jsonStr);
if (jsonStr != null || !jsonStr.trim().isEmpty()) {
try {
JSONObject jsonObject = null;
jsonObject = new JSONObject(jsonStr);
String jStrResult = jsonObject.getString("status");
String jStrResult1 = jsonObject.getString("version");
GenericMethods.apiversion = jStrResult1;
} catch (JSONException e) {
e.printStackTrace();
}
}
getAlldataList = db.getAllData(db);
for (int i = 0; i < getAlldataList.size(); i++) {
documentid.add(getAlldataList.get(i).get("Did"));
appointmentid.add(getAlldataList.get(i).get("Aid"));
ownername.add(getAlldataList.get(i).get("Oname"));
executionerid.add(getAlldataList.get(i).get("Exid"));
}
getuserdataList = db.getdataList(db);
for (int i = 0; i < getuserdataList.size(); i++) {
userlist.add(getuserdataList.get(i).get("UserId"));
}
getCommentDatalist = db.getCommentlist(db);
for (int i = 0; i < getCommentDatalist.size(); i++) {
commentid.add(getCommentDatalist.get(i).get("Cid"));
}
if (jsonStr != null) {
try {
JSONObject jsonObj = new JSONObject(jsonStr);
ja = jsonObj.getJSONArray(GenericMethods.TAG_NAME);
ja3 = jsonObj.getJSONArray(GenericMethods.TAG_NAME3);
ja4 = jsonObj.getJSONArray(GenericMethods.TAG_NAME4);
ja20 = jsonObj.getJSONArray(GenericMethods.TAG_NAME14);
ja25 = jsonObj.getJSONArray(GenericMethods.TAG_NAME20);
for (int i = 0; i < ja.length(); i++) {
JSONObject c = ja.getJSONObject(i);
String rtoken1 = c.getString(GenericMethods.TAG_RTOKEN);
String rkey1 = c.getString(GenericMethods.TAG_REPORT_KEY);
String sgrn = c.getString(GenericMethods.TAG_sgrn);
String rgrn = c.getString(GenericMethods.TAG_rgrn);
String uname1 = c.getString(GenericMethods.TAG_UNAME);
String email1 = c.getString(GenericMethods.TAG_UEMAIL);
String contact_number1 = c.getString(GenericMethods.TAG_UCONTACT);
String paddress1 = c.getString(GenericMethods.TAG_PADDRESS);
String oname1 = c.getString(GenericMethods.TAG_ONAME);
String ocontact1 = c.getString(GenericMethods.TAG_OCONTACT);
String oemail1 = c.getString(GenericMethods.TAG_OEMAIL);
String oaddress1 = c.getString(GenericMethods.TAG_OADDRESS);
String tname1 = c.getString(GenericMethods.TAG_TNAME);
String tcontact1 = c.getString(GenericMethods.TAG_TCONTACT);
String temail1 = c.getString(GenericMethods.TAG_TEMAIL);
String taddress1 = c.getString(GenericMethods.TAG_TADDRESS);
String status1 = c.getString(GenericMethods.TAG_STATUS);
String appdate = c.getString(GenericMethods.TAG_APPDATE);
String biocomp = c.getString(GenericMethods.TAG_BIO_COMP);
String appdate1 = c.getString(GenericMethods.TAG_APPDATE1);
String biocomp1 = c.getString(GenericMethods.TAG_BIO_COMP1);
String regfromcomp = c.getString(GenericMethods.TAG_REG_FROM_COMP);
String witness = c.getString(GenericMethods.TAG_WITNESS);
String shipadd = c.getString(GenericMethods.TAG_SHIP_ADDRESS);
String shipdiffadd = c.getString(GenericMethods.TAG_SHIP_DIFF_ADDRESS);
String strlatitude, strlongitude;
if (c.has(GenericMethods.TAG_CUSTOMER_LAT)) {
strlatitude = c.getString(GenericMethods.TAG_CUSTOMER_LAT);
} else strlatitude = "0";
if (c.has(GenericMethods.TAG_CUSTOMER_LONG)) {
strlongitude = c.getString(GenericMethods.TAG_CUSTOMER_LONG);
} else strlongitude = "0";
String docid = c.getString(GenericMethods.TAG_DOCID);
String app_status = c.getString(GenericMethods.TAG_APP_STATUS);
String appid = c.getString(GenericMethods.TAG_APPID);
String start1 = c.getString(GenericMethods.TAG_START1);
String start2 = c.getString(GenericMethods.TAG_START2);
String appaddress = c.getString(GenericMethods.TAG_APPADDRESS);
String exeid = c.getString(GenericMethods.TAG_EXECUTIONER_ID);
String appfor = c.getString(GenericMethods.TAG_APP_FOR);
String apptype = c.getString(GenericMethods.TAG_APPTYPE);
String post_status = c.getString(GenericMethods.TAG_POST_STATUS);
String landmark = c.getString(GenericMethods.TAG_LANDMARK);
String contact_person = c.getString(GenericMethods.TAG_CONTACTPERSON);
String distance1 = c.getString(GenericMethods.TAG_CUSTOMER_DISTANCE);
String amount1 = c.getString(GenericMethods.TAG_CUSTOMER_AMOUNT);
String transporttype1 = c.getString(GenericMethods.TAG_CUSTOMER_TRANS_TYPE);
String biostatus = c.getString(GenericMethods.TAG_DOC_BIOMETRIC_STATUS);
JSONObject jsonatten = ja.getJSONObject(i);
JSONArray jsonattendees = jsonatten.getJSONArray(GenericMethods.TAG_NAME13);
if (jsonattendees != null) {
for (int j = 0; j < jsonattendees.length(); j++) {
JSONObject atten = jsonattendees.getJSONObject(j);
if (atten != null) {
String name = atten.getString(GenericMethods.TAG_NAMEATTEND);
String email = atten.getString(GenericMethods.TAG_EMAILATTEND);
String contact = atten.getString(GenericMethods.TAG_CONTACTATTEND);
db.Insertbioattendees(db, ID1, name, email, contact, appid, username2);
}
}
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
SimpleDateFormat output = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat output1 = new SimpleDateFormat("HH:mm");
SimpleDateFormat output2 = new SimpleDateFormat("HH:mm");
java.util.Date date, time1, time2;
try {
date = sdf.parse(start1);
time1 = sdf.parse(start1);
time2 = sdf.parse(start2);
startnewdate = output.format(date);
startnewtime1 = output1.format(time1);
startnewtime2 = output2.format(time2);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (documentid.contains(docid)) {
db.Update(db, docid, rtoken1, rkey1, uname1, email1, contact_number1, paddress1, oname1,
ocontact1, oemail1, oaddress1, tname1, tcontact1, temail1, taddress1, status1,
appdate, biocomp, appdate1, biocomp1, regfromcomp, witness, shipadd, shipdiffadd, apptype, biostatus,sgrn,rgrn);
} else {
if (!db.DocumentID(db, docid)) {
db.InsertRecord(db, rtoken1, rkey1, uname1, email1, contact_number1, paddress1, oname1,
ocontact1, oemail1, oaddress1, tname1, tcontact1, temail1, taddress1, status1,
username2, docid, appdate, biocomp, appdate1, biocomp1, regfromcomp, witness, shipadd,
shipdiffadd, "SYNC", apptype, biostatus,sgrn,rgrn);
}
}
if (appointmentid.contains(appid)) {
db.Updateacvr(db, appid, docid, startnewdate, startnewtime1, startnewtime2, appaddress, exeid,
appfor, distance1, amount1, transporttype1, contact_person, landmark, "", post_status, strlatitude, strlongitude, "false", app_status);
} else {
db.InsertRecord2(db, docid, appid, startnewdate, startnewtime1, startnewtime2, appaddress,
exeid, appfor, distance1, amount1, transporttype1, "SYNC", contact_person, landmark, "", post_status, strlatitude, strlongitude, "false", app_status);
}
for (int i1 = 0; i1 < db.getnotificationtable(db).size(); i1++) {
if (db.getnotificationtable(db).get(i1).get("appid").equals(appid)) {
db.Updateacvr(db, appid, docid, startnewdate, startnewtime1, startnewtime2, appaddress, exeid,
appfor, distance1, amount1, transporttype1, contact_person, landmark, "", post_status, strlatitude, strlongitude, "true", app_status);
}
}
}
for (int l = 0; l < ja3.length(); l++) {
JSONObject c = ja3.getJSONObject(l);
String userid = c.getString(GenericMethods.TAG_USERID);
String username = c.getString(GenericMethods.TAG_USERNAME);
String email = c.getString(GenericMethods.TAG_EMAIL);
String role = c.getString(GenericMethods.TAG_ROLE);
String platformid = c.getString(GenericMethods.TAG_PLATFORMID);
String roleid = c.getString(GenericMethods.TAG_ROLEID);
String idu = c.getString(GenericMethods.TAG_IDu);
if (userlist.contains(userid)) {
db.Updateuser(db, userid, username, email, role, platformid, roleid, idu);
} else {
if (!db.checkUserId(db, userid)) {
db.InsertRecord5(db, userid, username, email, role, platformid, roleid, idu);
}
}
}
for (int n = 0; n < ja4.length(); n++) {
JSONObject c = ja4.getJSONObject(n);
String DocumentId = c.getString(GenericMethods.TAG_DOCUMENTID);
String Amt = c.getString(GenericMethods.TAG_PAYAMOUNT);
String ReportKey = c.getString(GenericMethods.TAG_REPORTKEY);
db.Insertbiopayment(db, ID1, DocumentId, ReportKey, Amt, username2);
}
for (int n = 0; n < ja20.length(); n++) {
JSONObject c = ja20.getJSONObject(n);
String DocumentId = c.getString(GenericMethods.TAG_DOCUMENTID);
String att_status = c.getString(GenericMethods.Tag_att_status);
SQLiteDatabase sqldb = db.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(DBManager.TableInfo.att_status, att_status);
sqldb.update(TABLE_NAME_APPOINTMENT, values, DBManager.TableInfo.DocumentId + "=?", new String[]{DocumentId});
sqldb.close();
}
ja5 = jsonObj.getJSONArray(GenericMethods.TAG_NAME5);
for (int n = 0; n < ja5.length(); n++) {
JSONObject c = ja5.getJSONObject(n);
String Document1 = c.getString(GenericMethods.TAG_DOCUMENT);
String Attendance = c.getString(GenericMethods.TAG_ATTENDANCE);
String name = c.getString(GenericMethods.TAG_NAMENEW);
String email = c.getString(GenericMethods.TAG_EMAILNEW);
String partytype = c.getString(GenericMethods.TAG_PARTYTYPE);
String poa = c.getString(GenericMethods.TAG_POA);
String contact = c.getString(GenericMethods.TAG_CONTACTNUMBER);
String biometric = c.getString(GenericMethods.TAG_BIOMETRIC);
String address = c.getString(GenericMethods.TAG_PARTY_ADDRESS);
db.Insertbioparties(db, ID1, Document1, Attendance, name, startnewdate, email, partytype, poa, contact, biometric, address, username2);
}
for (int n = 0; n < ja25.length(); n++) {
JSONObject c = ja25.getJSONObject(n);
String penaltyid = c.getString(GenericMethods.penalty_id);
String penaly_appid = c.getString(GenericMethods.penalty_appointment_id);
String penalty_docid = c.getString(GenericMethods.penalty_doc_id);
String penalty_execid = c.getString(GenericMethods.penalty_exec_id);
String penalty_amount = c.getString(GenericMethods.penalty_amount);
String penalty_verify = c.getString(GenericMethods.penalty_verify);
String penalty_type = c.getString(GenericMethods.penalty_type);
String penalty_managercomment = c.getString(GenericMethods.penalty_manager_comment);
String penalty_systemreason = c.getString(GenericMethods.penalty_system_reason);
String penalty_createdat = c.getString(GenericMethods.penalty_created_at);
String penalty_env = c.getString(GenericMethods.penalty_env);
db.InsertPenaltyreports(db, ID1, penaltyid, penaly_appid, penalty_docid, penalty_execid, penalty_amount, penalty_verify, penalty_type, penalty_managercomment, penalty_systemreason, penalty_createdat, penalty_env,username2);
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if (TodayDetails.thisToday != null) {
TodayDetails.thisToday.reFreshReload();
}
if (OlderDetails.thisOlderDetails != null) {
OlderDetails.thisOlderDetails.reFreshReload();
}
if (NewDetails.thisnewDetails != null) {
NewDetails.thisnewDetails.reFreshReload();
}
if (CompletedDetails.thiscompleteDetails != null) {
CompletedDetails.thiscompleteDetails.reFreshReload();
}
stopSelf();
}
}
}
| 21,100 | 0.535118 | 0.526588 | 482 | 42.775932 | 40.981167 | 251 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.919087 | false | false |
3
|
ab9f56245a76c8b2417865c0f90f03365f311955
| 37,400,575,249,387 |
a25acb59b0c8b7fb42f80229e6b01c9a5773b4bc
|
/src/br/com/lealdn/Testing.java
|
79fc307443e03237a977e13218abb78c8c30bc96
|
[] |
no_license
|
jolealdoneto/soot-android
|
https://github.com/jolealdoneto/soot-android
|
beb6d63c2f7cbca40c42209b25e3d6e87b9c50a6
|
00c821f898e3ea100a39e624cd4de3b171a46c67
|
refs/heads/master
| 2020-12-24T17:08:32.913000 | 2015-05-25T23:28:57 | 2015-05-25T23:28:57 | 30,353,279 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.lealdn;
public class Testing {
public void doNothing() {
int i = 0;
i += 1;
if (i > 0) {
System.currentTimeMillis();
if (i < 2) {
System.out.println("ok");
}
else {
System.out.println("nein");
}
}
else {
System.out.println("Hello");
}
}
}
|
UTF-8
|
Java
| 297 |
java
|
Testing.java
|
Java
|
[] | null |
[] |
package br.com.lealdn;
public class Testing {
public void doNothing() {
int i = 0;
i += 1;
if (i > 0) {
System.currentTimeMillis();
if (i < 2) {
System.out.println("ok");
}
else {
System.out.println("nein");
}
}
else {
System.out.println("Hello");
}
}
}
| 297 | 0.538721 | 0.525253 | 22 | 12.5 | 11.109987 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.136364 | false | false |
3
|
5c879d3007b80348d8a0607d047b4a635ad2882a
| 38,809,324,536,523 |
e37b4302e353571df6ad4c6af90b4dba2408923e
|
/src/wordBreak.java
|
6ecbfb0e5ceefd2ce0e51778a222d0133350f27b
|
[] |
no_license
|
HuzAejaz75/DataStructuresandAlgortihms
|
https://github.com/HuzAejaz75/DataStructuresandAlgortihms
|
8b51a97f5215c5f10befb32c5f49d86c5ce4287b
|
865218144bef53576317541507be95545813c1a2
|
refs/heads/master
| 2021-08-09T01:18:23.524000 | 2018-10-25T05:55:59 | 2018-10-25T05:55:59 | 136,547,876 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Created by huzaifa.aejaz on 7/5/18.
*/
public class wordBreak {
/*public boolean wordBreak(String s, List<String> wordDict) {
int len = s.length();
for(int i = s.length(); i >=0; i--){
String check = s.substring(0,i);
if(wordDict.contains(check)){
s=s.substring(i,len);
i=s.length()+1;
len = s.length();
}
}
if(s.equals(""))return true;
else return false;
}*/
public boolean wordBreak(String s, List<String> wordDict) {
Set<String> wordDictSet=new HashSet(wordDict);
boolean[] dp = new boolean[s.length() + 1];
dp[0] = true;
for (int i = 1; i <= s.length(); i++) {
for (int j = 0; j < i; j++) {
if (dp[j] && wordDictSet.contains(s.substring(j, i))) {
dp[i] = true;
break;
}
}
}
return dp[s.length()];
}
}
|
UTF-8
|
Java
| 1,069 |
java
|
wordBreak.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Set;\n\n/**\n * Created by huzaifa.aejaz on 7/5/18.\n */\npublic class wordBreak {\n /*pub",
"end": 103,
"score": 0.9982426762580872,
"start": 90,
"tag": "USERNAME",
"value": "huzaifa.aejaz"
}
] | null |
[] |
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Created by huzaifa.aejaz on 7/5/18.
*/
public class wordBreak {
/*public boolean wordBreak(String s, List<String> wordDict) {
int len = s.length();
for(int i = s.length(); i >=0; i--){
String check = s.substring(0,i);
if(wordDict.contains(check)){
s=s.substring(i,len);
i=s.length()+1;
len = s.length();
}
}
if(s.equals(""))return true;
else return false;
}*/
public boolean wordBreak(String s, List<String> wordDict) {
Set<String> wordDictSet=new HashSet(wordDict);
boolean[] dp = new boolean[s.length() + 1];
dp[0] = true;
for (int i = 1; i <= s.length(); i++) {
for (int j = 0; j < i; j++) {
if (dp[j] && wordDictSet.contains(s.substring(j, i))) {
dp[i] = true;
break;
}
}
}
return dp[s.length()];
}
}
| 1,069 | 0.471469 | 0.461179 | 36 | 28.694445 | 18.516989 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
3
|
e388f1f210e106e1d2acec205f77409f3d37c73a
| 4,028,679,391,989 |
a089fc2cb7429110faf4034573028a958d306d80
|
/src/main/java/com/brownbag_api/model/jpa/ObjPos.java
|
dec4f3d90875549e14f582828e15682fbabfa84c
|
[] |
no_license
|
Danielmethner/brownbag-api
|
https://github.com/Danielmethner/brownbag-api
|
42d26d330315459f4c52b609498f4d55e09160a4
|
6ab642452496fcc0329757fccc812c883ec236b8
|
refs/heads/master
| 2021-01-07T07:05:20.950000 | 2020-08-29T08:03:20 | 2020-08-29T08:03:20 | 241,613,114 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.brownbag_api.model.jpa;
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.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
@Table(name = "OBJ_POS", uniqueConstraints = { @UniqueConstraint(columnNames = { "ASSET_ID", "PARTY_ID" }) })
@Inheritance(strategy = InheritanceType.JOINED)
public class ObjPos implements Serializable {
private static final long serialVersionUID = 1530699992135610397L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
@NotBlank
@Size(max = 200)
private String name;
@NotNull
@Column(name = "QTY", columnDefinition = "Decimal(20,2)")
private double qty;
@NotNull
@Column(name = "QTY_BLOCKED", columnDefinition = "Decimal(20,2)")
private double qtyBlocked;
@NotNull
@ManyToOne(targetEntity = ObjAsset.class)
@JoinColumn(name = "ASSET_ID")
public ObjAsset asset;
@NotNull
@ManyToOne(targetEntity = ObjParty.class)
@JoinColumn(name = "PARTY_ID")
private ObjParty party;
@NotNull
@Column(name = "PRICE_AVG", columnDefinition = "Decimal(20,2)")
private double priceAvg;
public ObjPos() {
}
public ObjPos(@NotNull double qty, @NotNull double qtyBlocked, @NotNull ObjAsset asset, @NotNull ObjParty owner,
@NotNull double priceAvg) {
super();
this.qty = qty;
this.qtyBlocked = qtyBlocked;
this.asset = asset;
this.party = owner;
this.name = genName();
this.priceAvg = priceAvg;
}
private String genName() {
return this.party.getName() + ": " + this.asset.getName();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public ObjAsset getAsset() {
return asset;
}
public void setAsset(ObjAsset asset) {
this.asset = asset;
}
public ObjParty getParty() {
return party;
}
public void setParty(ObjParty party) {
this.party = party;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public double getQty() {
return qty;
}
public void setQty(double qty) {
this.qty = qty;
}
public double getQtyBlocked() {
return qtyBlocked;
}
public void setQtyBlocked(double qtyBlocked) {
this.qtyBlocked = qtyBlocked;
}
public ObjPos raiseQtyBlocked(double qty) {
setQtyBlocked(getQtyBlocked() + qty);
return this;
}
public ObjPos lowerQtyBlocked(double qty) {
setQtyBlocked(getQtyBlocked() - qty);
return this;
}
public double getPriceAvg() {
return priceAvg;
}
public void setPriceAvg(double priceAvg) {
this.priceAvg = priceAvg;
}
}
|
UTF-8
|
Java
| 3,211 |
java
|
ObjPos.java
|
Java
|
[] | null |
[] |
package com.brownbag_api.model.jpa;
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.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
@Table(name = "OBJ_POS", uniqueConstraints = { @UniqueConstraint(columnNames = { "ASSET_ID", "PARTY_ID" }) })
@Inheritance(strategy = InheritanceType.JOINED)
public class ObjPos implements Serializable {
private static final long serialVersionUID = 1530699992135610397L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
@NotBlank
@Size(max = 200)
private String name;
@NotNull
@Column(name = "QTY", columnDefinition = "Decimal(20,2)")
private double qty;
@NotNull
@Column(name = "QTY_BLOCKED", columnDefinition = "Decimal(20,2)")
private double qtyBlocked;
@NotNull
@ManyToOne(targetEntity = ObjAsset.class)
@JoinColumn(name = "ASSET_ID")
public ObjAsset asset;
@NotNull
@ManyToOne(targetEntity = ObjParty.class)
@JoinColumn(name = "PARTY_ID")
private ObjParty party;
@NotNull
@Column(name = "PRICE_AVG", columnDefinition = "Decimal(20,2)")
private double priceAvg;
public ObjPos() {
}
public ObjPos(@NotNull double qty, @NotNull double qtyBlocked, @NotNull ObjAsset asset, @NotNull ObjParty owner,
@NotNull double priceAvg) {
super();
this.qty = qty;
this.qtyBlocked = qtyBlocked;
this.asset = asset;
this.party = owner;
this.name = genName();
this.priceAvg = priceAvg;
}
private String genName() {
return this.party.getName() + ": " + this.asset.getName();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public ObjAsset getAsset() {
return asset;
}
public void setAsset(ObjAsset asset) {
this.asset = asset;
}
public ObjParty getParty() {
return party;
}
public void setParty(ObjParty party) {
this.party = party;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public double getQty() {
return qty;
}
public void setQty(double qty) {
this.qty = qty;
}
public double getQtyBlocked() {
return qtyBlocked;
}
public void setQtyBlocked(double qtyBlocked) {
this.qtyBlocked = qtyBlocked;
}
public ObjPos raiseQtyBlocked(double qty) {
setQtyBlocked(getQtyBlocked() + qty);
return this;
}
public ObjPos lowerQtyBlocked(double qty) {
setQtyBlocked(getQtyBlocked() - qty);
return this;
}
public double getPriceAvg() {
return priceAvg;
}
public void setPriceAvg(double priceAvg) {
this.priceAvg = priceAvg;
}
}
| 3,211 | 0.696979 | 0.687325 | 145 | 20.144827 | 20.535244 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.275862 | false | false |
3
|
51f5124095f72fe0fcfe55dbaa6c8f6252d29e0d
| 738,734,432,817 |
3063bf142918090a523e3c258f02a694705b8cb9
|
/src/main/java/juliosilveiradev/site/facades/PortfolioFacade.java
|
e283e0dd4a678637511061e7c3ba222bd2954ba6
|
[] |
no_license
|
juliofalbo/personal-site
|
https://github.com/juliofalbo/personal-site
|
1454cafb2778a0f321069c7973e47c9a94331b19
|
e5d4f11ed3710d9e60ab986fe67bc1ca9379440b
|
refs/heads/master
| 2021-06-28T06:54:28.066000 | 2017-09-18T17:41:44 | 2017-09-18T17:41:44 | 103,966,577 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package juliosilveiradev.site.facades;
import java.math.BigInteger;
import org.springframework.web.multipart.MultipartFile;
import juliosilveiradev.site.facades.interfaces.FacadeInterface;
import juliosilveiradev.site.model.Portfolio;
import juliosilveiradev.site.utils.CriptografiaUtils;
import juliosilveiradev.site.utils.JUtils;
public class PortfolioFacade implements FacadeInterface
{
private Portfolio portfolio = null;
private Iterable<Portfolio> portfolios = null;
public PortfolioFacade(Portfolio portfolio)
{
this.portfolio = portfolio;
}
public PortfolioFacade(Iterable<Portfolio> portfolios)
{
this.portfolios = portfolios;
}
public void procedimentosPadroesLista()
{
for (Portfolio portfolio : this.portfolios)
{
PortfolioFacade facade = new PortfolioFacade(portfolio);
facade.criptografarId();
facade.adicionarPlic();
}
}
public void salvarArquivoUpload(MultipartFile file)
{
String caminhoFotoBanco = JUtils.getInstance().salvarArquivoRetornandoCaminhoDoBD("portfolio",
file);
this.portfolio.setFoto(caminhoFotoBanco);
}
@Override
public void criptografarId()
{
this.portfolio.setIdCriptografado(CriptografiaUtils.getInstance()
.criptografarInteiro(BigInteger.valueOf(this.portfolio.getId())));
}
public void atualizarObjeto(Portfolio portfolioEditado)
{
this.portfolio = (Portfolio) JUtils.getInstance().atualizarObjeto(portfolioEditado,
this.portfolio);
}
public void adicionarPlic()
{
this.portfolio.setNomePlic("'" + this.portfolio.getNome() + "'");
this.portfolio.setLinkPlic("'" + this.portfolio.getLink() + "'");
this.portfolio.setTipoPlic("'" + this.portfolio.getTipo() + "'");
this.portfolio.setFiltroPlic("'" + this.portfolio.getFiltro() + "'");
this.portfolio.setIconePlic("'" + this.portfolio.getIcone() + "'");
}
}
|
UTF-8
|
Java
| 1,829 |
java
|
PortfolioFacade.java
|
Java
|
[] | null |
[] |
package juliosilveiradev.site.facades;
import java.math.BigInteger;
import org.springframework.web.multipart.MultipartFile;
import juliosilveiradev.site.facades.interfaces.FacadeInterface;
import juliosilveiradev.site.model.Portfolio;
import juliosilveiradev.site.utils.CriptografiaUtils;
import juliosilveiradev.site.utils.JUtils;
public class PortfolioFacade implements FacadeInterface
{
private Portfolio portfolio = null;
private Iterable<Portfolio> portfolios = null;
public PortfolioFacade(Portfolio portfolio)
{
this.portfolio = portfolio;
}
public PortfolioFacade(Iterable<Portfolio> portfolios)
{
this.portfolios = portfolios;
}
public void procedimentosPadroesLista()
{
for (Portfolio portfolio : this.portfolios)
{
PortfolioFacade facade = new PortfolioFacade(portfolio);
facade.criptografarId();
facade.adicionarPlic();
}
}
public void salvarArquivoUpload(MultipartFile file)
{
String caminhoFotoBanco = JUtils.getInstance().salvarArquivoRetornandoCaminhoDoBD("portfolio",
file);
this.portfolio.setFoto(caminhoFotoBanco);
}
@Override
public void criptografarId()
{
this.portfolio.setIdCriptografado(CriptografiaUtils.getInstance()
.criptografarInteiro(BigInteger.valueOf(this.portfolio.getId())));
}
public void atualizarObjeto(Portfolio portfolioEditado)
{
this.portfolio = (Portfolio) JUtils.getInstance().atualizarObjeto(portfolioEditado,
this.portfolio);
}
public void adicionarPlic()
{
this.portfolio.setNomePlic("'" + this.portfolio.getNome() + "'");
this.portfolio.setLinkPlic("'" + this.portfolio.getLink() + "'");
this.portfolio.setTipoPlic("'" + this.portfolio.getTipo() + "'");
this.portfolio.setFiltroPlic("'" + this.portfolio.getFiltro() + "'");
this.portfolio.setIconePlic("'" + this.portfolio.getIcone() + "'");
}
}
| 1,829 | 0.761618 | 0.761618 | 67 | 26.298508 | 27.45472 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.462687 | false | false |
3
|
73540970d0d4175e60e4a88bf76513151e247c34
| 24,309,514,954,060 |
1a427e74f5e7b76edd6c3979d730223c86a068c2
|
/F31_Controller/app/src/main/java/com/example/rd_softwaredeveloper/f31_controller/ExpandableAdapter.java
|
cbca1c7116b0e1146ad7fa6648f719c05c718156
|
[] |
no_license
|
kib06277/RemoteControl
|
https://github.com/kib06277/RemoteControl
|
dac84736d75d422aa77dc32b5e95c3c27487e88b
|
1c89193632f05c7bfd8337e7dfe62aa05ecb07c3
|
refs/heads/master
| 2018-12-04T04:25:23.667000 | 2018-12-03T03:27:22 | 2018-12-03T03:27:22 | 147,630,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.rd_softwaredeveloper.f31_controller;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.List;
import java.util.Map;
public class ExpandableAdapter extends BaseExpandableListAdapter
{
private Context context;
List<Map<String, String>> groups;
List<List<Map<String, String>>> childs;
/*
* 構造函數: 參數1:context物件 參數2:一級清單資料來源 參數3:二級清單資料來源
*/
public ExpandableAdapter(Context context, List<Map<String, String>> groups, List<List<Map<String, String>>> childs)
{
this.groups = groups;
this.childs = childs;
this.context = context;
}
public Object getChild(int groupPosition, int childPosition)
{
return childs.get(groupPosition).get(childPosition);
}
public long getChildId(int groupPosition, int childPosition)
{
return childPosition;
}
// 獲取二級清單的View物件
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
@SuppressWarnings("unchecked")
String text = ((Map<String, String>) getChild(groupPosition, childPosition)).get("child");
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// 獲取二級清單對應的佈局檔, 並將其各元素設置相應的屬性
LinearLayout linearLayout = (LinearLayout) layoutInflater.inflate(R.layout.child, null);
TextView tv = (TextView) linearLayout.findViewById(R.id.child_tv);
tv.setText(text);
Spinner child_sp = (Spinner) linearLayout.findViewById(R.id.child_sp);
final String[] RadioMode = {"省電跳頻模式", "標準跳頻模式", "單一頻道模式"};
ArrayAdapter<String> RadioModehList = new ArrayAdapter<>(context, android.R.layout.simple_spinner_dropdown_item, RadioMode);
child_sp.setAdapter(RadioModehList);
child_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
}
@Override
public void onNothingSelected(AdapterView<?> parent)
{
}
});
return linearLayout;
}
public int getChildrenCount(int groupPosition)
{
return childs.get(groupPosition).size();
}
public Object getGroup(int groupPosition)
{
return groups.get(groupPosition);
}
public int getGroupCount()
{
return groups.size();
}
public long getGroupId(int groupPosition)
{
return groupPosition;
}
// 獲取一級清單View物件
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
{
String text = groups.get(groupPosition).get("group");
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// 獲取一級清單佈局檔,設置相應元素屬性
LinearLayout linearLayout = (LinearLayout) layoutInflater.inflate(R.layout.group_layout, null);
TextView textView = (TextView) linearLayout.findViewById(R.id.group_tv);
textView.setText(text);
return linearLayout;
}
public boolean hasStableIds()
{
return false;
}
public boolean isChildSelectable(int groupPosition, int childPosition)
{
return false;
}
}
|
UTF-8
|
Java
| 3,934 |
java
|
ExpandableAdapter.java
|
Java
|
[] | null |
[] |
package com.example.rd_softwaredeveloper.f31_controller;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.List;
import java.util.Map;
public class ExpandableAdapter extends BaseExpandableListAdapter
{
private Context context;
List<Map<String, String>> groups;
List<List<Map<String, String>>> childs;
/*
* 構造函數: 參數1:context物件 參數2:一級清單資料來源 參數3:二級清單資料來源
*/
public ExpandableAdapter(Context context, List<Map<String, String>> groups, List<List<Map<String, String>>> childs)
{
this.groups = groups;
this.childs = childs;
this.context = context;
}
public Object getChild(int groupPosition, int childPosition)
{
return childs.get(groupPosition).get(childPosition);
}
public long getChildId(int groupPosition, int childPosition)
{
return childPosition;
}
// 獲取二級清單的View物件
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
@SuppressWarnings("unchecked")
String text = ((Map<String, String>) getChild(groupPosition, childPosition)).get("child");
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// 獲取二級清單對應的佈局檔, 並將其各元素設置相應的屬性
LinearLayout linearLayout = (LinearLayout) layoutInflater.inflate(R.layout.child, null);
TextView tv = (TextView) linearLayout.findViewById(R.id.child_tv);
tv.setText(text);
Spinner child_sp = (Spinner) linearLayout.findViewById(R.id.child_sp);
final String[] RadioMode = {"省電跳頻模式", "標準跳頻模式", "單一頻道模式"};
ArrayAdapter<String> RadioModehList = new ArrayAdapter<>(context, android.R.layout.simple_spinner_dropdown_item, RadioMode);
child_sp.setAdapter(RadioModehList);
child_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
}
@Override
public void onNothingSelected(AdapterView<?> parent)
{
}
});
return linearLayout;
}
public int getChildrenCount(int groupPosition)
{
return childs.get(groupPosition).size();
}
public Object getGroup(int groupPosition)
{
return groups.get(groupPosition);
}
public int getGroupCount()
{
return groups.size();
}
public long getGroupId(int groupPosition)
{
return groupPosition;
}
// 獲取一級清單View物件
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
{
String text = groups.get(groupPosition).get("group");
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// 獲取一級清單佈局檔,設置相應元素屬性
LinearLayout linearLayout = (LinearLayout) layoutInflater.inflate(R.layout.group_layout, null);
TextView textView = (TextView) linearLayout.findViewById(R.id.group_tv);
textView.setText(text);
return linearLayout;
}
public boolean hasStableIds()
{
return false;
}
public boolean isChildSelectable(int groupPosition, int childPosition)
{
return false;
}
}
| 3,934 | 0.684211 | 0.682868 | 120 | 30.041666 | 32.421032 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.616667 | false | false |
3
|
1fd1ed0a06d3a4996f8a5c819dfde305984481a6
| 4,423,816,367,356 |
783cefa9e87eb0f07489b513235123b038aa8bbf
|
/apps/api/src/main/java/com/subrosagames/subrosa/event/handler/GameStartMessageHandler.java
|
2a36fa5fc979ccee75632c81ed10b33a51da0709
|
[
"MIT"
] |
permissive
|
subrosa/subrosa
|
https://github.com/subrosa/subrosa
|
5dfd1c2f31731bb11508c4255f9d6be12bcede46
|
3fbd5357d086c1323018c679c0b34c0720f65241
|
refs/heads/master
| 2021-04-26T13:58:17.098000 | 2017-01-07T18:38:29 | 2017-01-07T18:38:29 | 23,121,124 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.subrosagames.subrosa.event.handler;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.subrosagames.subrosa.domain.game.Game;
import com.subrosagames.subrosa.domain.notification.NotificationCode;
import com.subrosagames.subrosa.domain.notification.NotificationDetails;
import com.subrosagames.subrosa.domain.notification.Notifier;
/**
* Handler for starting a game.
*/
public class GameStartMessageHandler extends AbstractMessageHandler {
private static final Logger LOG = LoggerFactory.getLogger(GameStartMessageHandler.class);
@Autowired
private Notifier notifier;
@Override
public void process(Game game, Map<String, Serializable> properties) throws MessageHandlingException {
game.startGame();
NotificationDetails notificationDetails = new NotificationDetails();
notificationDetails.setGameId(game.getId());
notificationDetails.setCode(NotificationCode.GAME_START);
try {
notifier.sendNotification(notificationDetails);
} catch (IOException e) {
throw new MessageHandlingException(e);
}
}
}
|
UTF-8
|
Java
| 1,281 |
java
|
GameStartMessageHandler.java
|
Java
|
[] | null |
[] |
package com.subrosagames.subrosa.event.handler;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.subrosagames.subrosa.domain.game.Game;
import com.subrosagames.subrosa.domain.notification.NotificationCode;
import com.subrosagames.subrosa.domain.notification.NotificationDetails;
import com.subrosagames.subrosa.domain.notification.Notifier;
/**
* Handler for starting a game.
*/
public class GameStartMessageHandler extends AbstractMessageHandler {
private static final Logger LOG = LoggerFactory.getLogger(GameStartMessageHandler.class);
@Autowired
private Notifier notifier;
@Override
public void process(Game game, Map<String, Serializable> properties) throws MessageHandlingException {
game.startGame();
NotificationDetails notificationDetails = new NotificationDetails();
notificationDetails.setGameId(game.getId());
notificationDetails.setCode(NotificationCode.GAME_START);
try {
notifier.sendNotification(notificationDetails);
} catch (IOException e) {
throw new MessageHandlingException(e);
}
}
}
| 1,281 | 0.761905 | 0.760343 | 40 | 31.025 | 29.44273 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.525 | false | false |
3
|
13e1d882619ae22a3ce87a91dd2f05377fb76f62
| 28,819,230,608,320 |
ff2ff95618ed3826baa2c48b916d12b1bb5cffde
|
/src/test/java/com/example/mapper/ChooseCourseMapperTest.java
|
f41506524a823abe8400bef7da3f310ad5663cbe
|
[] |
no_license
|
prodCoder/SPM-Website
|
https://github.com/prodCoder/SPM-Website
|
4374cea4a8cafa20eb1c595e16403a5f729638a7
|
1bead5ed0806290cd68c6a8b10c0f2e0694772a8
|
refs/heads/master
| 2020-03-17T09:28:16.742000 | 2018-05-15T07:01:48 | 2018-05-15T07:01:48 | 133,452,247 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test.mapper;
import static org.junit.Assert.fail;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.example.entity.ChooseCourse;
import com.example.entity.Course;
import com.example.entity.Student;
import com.example.mapper.ChooseCourseMapper;
public class ChooseCourseMapperTest {
private ApplicationContext applicationContext;
@Before
public void setUp() throws Exception {
applicationContext=new ClassPathXmlApplicationContext("classpath:/spring/applicationContext.xml");
}
@Test
public void testInsertChooseCourse() throws Exception {
Course course =new Course();
course.setiD(1);
Student student=new Student();
student.setId(311502);
ChooseCourse chooseCourse=new ChooseCourse();
chooseCourse.setCourse(course);
chooseCourse.setStudent(student);
ChooseCourseMapper chooseCourseMapper=(ChooseCourseMapper)applicationContext.getBean("chooseCourseMapper");
chooseCourseMapper.insertChooseCourse(chooseCourse);
}
@Test
public void testDeleteChooseCourseById() {
}
@Test
public void testFindChooseCourseListByStudentId() throws Exception {
ChooseCourseMapper chooseCourseMapper=(ChooseCourseMapper)applicationContext.getBean("chooseCourseMapper");
List<ChooseCourse> list=chooseCourseMapper.findChooseCourseListByStudentId(311501);
System.out.println(list);
}
public static void main(String args[]) throws Exception {
ChooseCourseMapperTest test=new ChooseCourseMapperTest();
test.setUp();
test.testInsertChooseCourse();
// test.testFindChooseCourseListByStudentId();
}
}
|
UTF-8
|
Java
| 1,706 |
java
|
ChooseCourseMapperTest.java
|
Java
|
[] | null |
[] |
package test.mapper;
import static org.junit.Assert.fail;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.example.entity.ChooseCourse;
import com.example.entity.Course;
import com.example.entity.Student;
import com.example.mapper.ChooseCourseMapper;
public class ChooseCourseMapperTest {
private ApplicationContext applicationContext;
@Before
public void setUp() throws Exception {
applicationContext=new ClassPathXmlApplicationContext("classpath:/spring/applicationContext.xml");
}
@Test
public void testInsertChooseCourse() throws Exception {
Course course =new Course();
course.setiD(1);
Student student=new Student();
student.setId(311502);
ChooseCourse chooseCourse=new ChooseCourse();
chooseCourse.setCourse(course);
chooseCourse.setStudent(student);
ChooseCourseMapper chooseCourseMapper=(ChooseCourseMapper)applicationContext.getBean("chooseCourseMapper");
chooseCourseMapper.insertChooseCourse(chooseCourse);
}
@Test
public void testDeleteChooseCourseById() {
}
@Test
public void testFindChooseCourseListByStudentId() throws Exception {
ChooseCourseMapper chooseCourseMapper=(ChooseCourseMapper)applicationContext.getBean("chooseCourseMapper");
List<ChooseCourse> list=chooseCourseMapper.findChooseCourseListByStudentId(311501);
System.out.println(list);
}
public static void main(String args[]) throws Exception {
ChooseCourseMapperTest test=new ChooseCourseMapperTest();
test.setUp();
test.testInsertChooseCourse();
// test.testFindChooseCourseListByStudentId();
}
}
| 1,706 | 0.810082 | 0.802462 | 57 | 28.929825 | 28.701036 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.438596 | false | false |
3
|
58e9fe103aa0cfb643dcc86d0a6bd9e21b2e59c5
| 8,512,625,243,361 |
afe84da0d0c9a701629d365e5c7df1e50d936cf0
|
/app/src/main/java/com/goalreminderbeta/sa/goalreminderbeta/all/science/languages/LanguageLevels.java
|
46a62b14b4a7637ebf27e0a64f97fce60a47f84f
|
[] |
no_license
|
Mircella/androidapp
|
https://github.com/Mircella/androidapp
|
1fcb8a8abc60b2b558a07516d06a7a1b49080612
|
80506089e685d9088f7305d22c7c9eea12b71184
|
refs/heads/master
| 2020-03-21T10:35:06.022000 | 2018-06-24T06:51:15 | 2018-06-24T06:51:15 | 138,459,476 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.goalreminderbeta.sa.goalreminderbeta.all.science.languages;
public enum LanguageLevels {
Begin,A1,A2,B1,B2,C1,C2;
}
|
UTF-8
|
Java
| 133 |
java
|
LanguageLevels.java
|
Java
|
[] | null |
[] |
package com.goalreminderbeta.sa.goalreminderbeta.all.science.languages;
public enum LanguageLevels {
Begin,A1,A2,B1,B2,C1,C2;
}
| 133 | 0.781955 | 0.736842 | 5 | 25.6 | 25.819372 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6 | false | false |
3
|
0aa611590bfc10b63b6ea950d87c22ee20f855b9
| 34,789,235,143,100 |
961cf7c3c949b87bc14a94a31ecfc0c3104668f8
|
/src/Interfaces/IGestionIngresosOtro.java
|
64cd25658042ed5b0a91e5721438d945193c70f8
|
[] |
no_license
|
nudelman-mauricio/mamisHockey
|
https://github.com/nudelman-mauricio/mamisHockey
|
87862c3f0eeacaa45a49f695fcba7c55eea1cad8
|
9ebd29d65f817b9459cdb2e8636a906cce97bd87
|
refs/heads/master
| 2020-05-17T16:24:18.898000 | 2015-10-29T22:08:30 | 2015-10-29T22:08:30 | 18,992,123 | 0 | 0 | null | false | 2014-05-13T17:47:27 | 2014-04-21T12:43:55 | 2014-05-13T17:47:27 | 2014-05-13T17:47:27 | 18,380 | 0 | 0 | 0 |
Java
| null | null |
package Interfaces;
import DataSources.GestionIngresosDS;
import java.awt.Color;
import java.awt.event.ItemEvent;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import logicaNegocios.ConceptoIngreso;
import logicaNegocios.IngresoOtro;
import main.ControladoraGlobal;
public class IGestionIngresosOtro extends javax.swing.JInternalFrame {
private ControladoraGlobal unaControladoraGlobal;
private DefaultTableModel modeloTablaGestionIngresos;
private IngresoOtro unIngresoSeleccionado;
private DateFormat df = DateFormat.getDateInstance();
public IGestionIngresosOtro(ControladoraGlobal unaControladoraGlobal) {
initComponents();
IMenuPrincipal.jDesktopPane.add(this);
IMenuPrincipal.centrarYalFrente(this);
this.unaControladoraGlobal = unaControladoraGlobal;
this.modeloTablaGestionIngresos = (DefaultTableModel) jTableIngresos.getModel();
setFrameIcon(new ImageIcon(getClass().getResource("/Iconos Nuevos/Contabilidad.png")));
this.setTitle("Gestión de Ingresos Otro");
this.jTableIngresos.getTableHeader().setReorderingAllowed(false);
if (unaControladoraGlobal.getIngresosOtrosBD().size() > 0) {
cargarFechasFiltrado();
cargarTabla();
}
jTextPaneDetalle.setBackground(new Color(228, 231, 237));
}
private void cargarComboBoxConceptoIngreso() {
this.jComboBoxConceptoIngreso.setModel(new DefaultComboBoxModel((Vector) this.unaControladoraGlobal.getConceptosIngresosBD()));
this.jComboBoxConceptoIngreso.setSelectedIndex(-1);
}
private void cargarFechasFiltrado() {
if (unaControladoraGlobal.getPrimerIngresoOtro() != null) {
String fecha = df.format(unaControladoraGlobal.getPrimerIngresoOtro().getFecha());
String[] fechaDividida = fecha.split("/");
jComboBoxDesdeMes.setSelectedIndex(Integer.parseInt(fechaDividida[1]) - 1);
jComboBoxDesdeAño.setSelectedIndex(Integer.parseInt(fechaDividida[2]) + 1 - Integer.parseInt(jComboBoxDesdeAño.getItemAt(1).toString()));
fecha = df.format(unaControladoraGlobal.getUltimoIngresoOtro().getFecha());
fechaDividida = fecha.split("/");
jComboBoxHastaMes.setSelectedIndex(Integer.parseInt(fechaDividida[1]) - 1);
jComboBoxHastaAño.setSelectedIndex(Integer.parseInt(fechaDividida[2]) + 1 - Integer.parseInt(jComboBoxDesdeAño.getItemAt(1).toString()));
}
}
private void cargarTabla() {
limpiarTabla();
String desde = "01/" + String.valueOf(jComboBoxDesdeMes.getSelectedIndex() + 1) + "/" + String.valueOf(jComboBoxDesdeAño.getSelectedItem());
String hasta = "01/" + String.valueOf(jComboBoxHastaMes.getSelectedIndex() + 2) + "/" + String.valueOf(jComboBoxHastaAño.getSelectedItem());
Date fechaHasta = null;
Date fechaDesde = null;
try {
fechaDesde = new java.sql.Date(df.parse(String.valueOf(desde)).getTime());
fechaHasta = new java.sql.Date(df.parse(String.valueOf(hasta)).getTime());
for (IngresoOtro unIngreso : this.unaControladoraGlobal.getIngresoOtroEntreFechas(fechaDesde, fechaHasta)) {
this.modeloTablaGestionIngresos.addRow(new Object[]{unIngreso.getIdIngresoOtro(), df.format(unIngreso.getFecha()), unIngreso.getUnConceptoIngreso(), unIngreso.getDetalle(), unIngreso.getMonto()});
}
} catch (ParseException ex) {
Logger.getLogger(IGestionIngresosOtro.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void limpiarTabla() {
int filas = this.modeloTablaGestionIngresos.getRowCount();
for (int i = 0; i < filas; i++) {
modeloTablaGestionIngresos.removeRow(0);
}
camposLimpiar();
}
private void camposFiltroActivo(boolean Editable) {
jComboBoxDesdeMes.setEnabled(Editable);
jComboBoxDesdeAño.setEnabled(Editable);
jComboBoxHastaMes.setEnabled(Editable);
jComboBoxHastaAño.setEnabled(Editable);
}
private void camposActivo(boolean Editable) {
jTextFieldMonto.setEditable(Editable);
jDateChooserFecha.setEnabled(Editable);
jTextPaneDetalle.setEditable(Editable);
jComboBoxConceptoIngreso.setEnabled(Editable);
jButtonNuevoIngreso.setEnabled(Editable);
if (Editable) {
jTextPaneDetalle.setBackground(Color.WHITE);
} else {
jTextPaneDetalle.setBackground(new Color(228, 231, 237));
}
}
//blanquea componentes editables
private void camposLimpiar() {
jTextPaneDetalle.setText("");
jDateChooserFecha.setDate(null);
jTextFieldMonto.setText("");
jComboBoxConceptoIngreso.setSelectedIndex(-1);
}
//actualizar campos al seleccionar en la tabla
private void camposCargar() {
if (jTableIngresos.getSelectedRow() > -1) {
if (jTableIngresos.getValueAt(jTableIngresos.getSelectedRow(), 0) != null) {
unIngresoSeleccionado = unaControladoraGlobal.getIngresoOtroBD((Long) jTableIngresos.getValueAt(jTableIngresos.getSelectedRow(), 0));
camposLimpiar();
jDateChooserFecha.setDate((unIngresoSeleccionado.getFecha()));
jTextFieldMonto.setText(String.valueOf(unIngresoSeleccionado.getMonto()));
jTextPaneDetalle.setText(unIngresoSeleccionado.getDetalle());
jComboBoxConceptoIngreso.setSelectedItem(unIngresoSeleccionado.getUnConceptoIngreso());
camposActivo(false);
jButtonEditar.setEnabled(true);
jButtonEliminar.setEnabled(true);
}
}
}
private boolean camposValidar() {
boolean bandera = true;
if (jTextFieldMonto.getText().isEmpty()) {
jLabelMonto.setForeground(Color.red);
bandera = false;
} else {
jLabelMonto.setForeground(Color.black);
}
if (jComboBoxConceptoIngreso.getSelectedIndex() == -1) {
jLabelConceptoIngreso.setForeground(Color.red);
bandera = false;
} else {
jLabelConceptoIngreso.setForeground(Color.black);
}
if (jDateChooserFecha.getDate() == null) {
jLabelFecha.setForeground(Color.red);
bandera = false;
} else {
jLabelFecha.setForeground(Color.black);
}
if (!bandera) {
JOptionPane.showMessageDialog(this, "Por favor complete todos los campos obligatorios");
}
return bandera;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanelBotones = new javax.swing.JPanel();
jButtonEditar = new javax.swing.JButton();
jButtonEliminar = new javax.swing.JButton();
jButtonNuevo = new javax.swing.JButton();
jButtonImprimir = new javax.swing.JButton();
jButtonGuardar = new javax.swing.JButton();
jButtonCancelar = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTableIngresos = new javax.swing.JTable();
jPanel7 = new javax.swing.JPanel();
jLabelFecha = new javax.swing.JLabel();
jLabelConceptoIngreso = new javax.swing.JLabel();
jLabelComentario = new javax.swing.JLabel();
jTextFieldMonto = new javax.swing.JTextField();
jLabelMonto = new javax.swing.JLabel();
jComboBoxConceptoIngreso = new javax.swing.JComboBox();
jButtonNuevoIngreso = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTextPaneDetalle = new javax.swing.JTextPane();
jDateChooserFecha = new com.toedter.calendar.JDateChooser();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jComboBoxDesdeMes = new javax.swing.JComboBox();
jComboBoxDesdeAño = new javax.swing.JComboBox();
jPanel4 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jComboBoxHastaMes = new javax.swing.JComboBox();
jComboBoxHastaAño = new javax.swing.JComboBox();
setClosable(true);
setMaximumSize(new java.awt.Dimension(792, 695));
setMinimumSize(new java.awt.Dimension(792, 695));
setPreferredSize(new java.awt.Dimension(792, 695));
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
jPanelBotones.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jButtonEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/Edit2.png"))); // NOI18N
jButtonEditar.setText("Editar");
jButtonEditar.setEnabled(false);
jButtonEditar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonEditar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonEditar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonEditarActionPerformed(evt);
}
});
jButtonEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/deletered.png"))); // NOI18N
jButtonEliminar.setText("Eliminar");
jButtonEliminar.setEnabled(false);
jButtonEliminar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonEliminar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonEliminarActionPerformed(evt);
}
});
jButtonNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/add2.png"))); // NOI18N
jButtonNuevo.setText("Nuevo");
jButtonNuevo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonNuevo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonNuevo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonNuevoActionPerformed(evt);
}
});
jButtonImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/printer.png"))); // NOI18N
jButtonImprimir.setText("Imprimir");
jButtonImprimir.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonImprimir.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonImprimir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonImprimirActionPerformed(evt);
}
});
jButtonGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/save.png"))); // NOI18N
jButtonGuardar.setText("Guardar");
jButtonGuardar.setEnabled(false);
jButtonGuardar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonGuardar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonGuardarActionPerformed(evt);
}
});
jButtonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/cancel.png"))); // NOI18N
jButtonCancelar.setText("Cancelar");
jButtonCancelar.setEnabled(false);
jButtonCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCancelarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanelBotonesLayout = new javax.swing.GroupLayout(jPanelBotones);
jPanelBotones.setLayout(jPanelBotonesLayout);
jPanelBotonesLayout.setHorizontalGroup(
jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelBotonesLayout.createSequentialGroup()
.addGap(3, 3, 3)
.addComponent(jButtonNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(257, Short.MAX_VALUE))
);
jPanelBotonesLayout.setVerticalGroup(
jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelBotonesLayout.createSequentialGroup()
.addGap(3, 3, 3)
.addGroup(jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButtonCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonGuardar)
.addComponent(jButtonEliminar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonImprimir, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButtonEditar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGap(3, 3, 3))
);
jTableIngresos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"id", "Fecha", "Concepto Ingreso", "Observación", "Monto"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jTableIngresos);
if (jTableIngresos.getColumnModel().getColumnCount() > 0) {
jTableIngresos.getColumnModel().getColumn(0).setMinWidth(0);
jTableIngresos.getColumnModel().getColumn(0).setPreferredWidth(0);
jTableIngresos.getColumnModel().getColumn(0).setMaxWidth(0);
}
jTableIngresos.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent event) {
camposCargar();
}
});
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
);
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalle", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
jPanel7.setName(""); // NOI18N
jLabelFecha.setText("Fecha");
jLabelConceptoIngreso.setText("Concepto Ingreso");
jLabelComentario.setText("Observación");
jTextFieldMonto.setEditable(false);
jLabelMonto.setText("Monto");
jComboBoxConceptoIngreso.setEnabled(false);
jButtonNuevoIngreso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/Nuevo2.png"))); // NOI18N
jButtonNuevoIngreso.setEnabled(false);
jButtonNuevoIngreso.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonNuevoIngresoActionPerformed(evt);
}
});
jTextPaneDetalle.setEditable(false);
jScrollPane3.setViewportView(jTextPaneDetalle);
jDateChooserFecha.setEnabled(false);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(188, 188, 188)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelMonto)
.addComponent(jLabelConceptoIngreso)
.addComponent(jLabelFecha)
.addComponent(jLabelComentario))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jComboBoxConceptoIngreso, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextFieldMonto, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jDateChooserFecha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonNuevoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelFecha)
.addComponent(jDateChooserFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelConceptoIngreso)
.addComponent(jComboBoxConceptoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButtonNuevoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(8, 8, 8)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextFieldMonto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelMonto))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabelComentario)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE))
.addContainerGap())
);
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Desde"));
jLabel1.setText("Año");
jLabel2.setText("Mes");
jComboBoxDesdeMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" }));
jComboBoxDesdeMes.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxDesdeMesItemStateChanged(evt);
}
});
jComboBoxDesdeAño.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
jComboBoxDesdeAño.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxDesdeAñoItemStateChanged(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()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxDesdeMes, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxDesdeAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 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(jLabel1)
.addComponent(jComboBoxDesdeAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jComboBoxDesdeMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Hasta"));
jLabel7.setText("Año");
jLabel8.setText("Mes");
jComboBoxHastaMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" }));
jComboBoxHastaMes.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxHastaMesItemStateChanged(evt);
}
});
jComboBoxHastaAño.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
jComboBoxHastaAño.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxHastaAñoItemStateChanged(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()
.addContainerGap()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxHastaMes, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxHastaAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jComboBoxHastaAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(jComboBoxHastaMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.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))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelBotones, 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(10, 10, 10)
.addComponent(jPanelBotones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditarActionPerformed
jButtonNuevo.setEnabled(false);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(true);
jButtonCancelar.setEnabled(true);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(false);
camposFiltroActivo(false);
camposActivo(true);
}//GEN-LAST:event_jButtonEditarActionPerformed
private void jButtonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarActionPerformed
jButtonNuevo.setEnabled(true);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(false);
jButtonCancelar.setEnabled(false);
jButtonEliminar.setEnabled(false);
camposActivo(false);
Object[] options = {"OK", "Cancelar"};
if (0 == JOptionPane.showOptionDialog(
this,
"Desea eliminar el Ingreso: " + unIngresoSeleccionado.getFecha() + " - " + unIngresoSeleccionado.getUnConceptoIngreso() + " - " + unIngresoSeleccionado.getMonto(),
"Eliminar",
JOptionPane.PLAIN_MESSAGE,
JOptionPane.WARNING_MESSAGE,
null,
options,
options)) {
unaControladoraGlobal.eliminarIngresoOtro(unIngresoSeleccionado);
cargarFechasFiltrado();
cargarTabla();
}
unIngresoSeleccionado = null;
jTableIngresos.clearSelection();
jTableIngresos.setEnabled(true);
camposLimpiar();
}//GEN-LAST:event_jButtonEliminarActionPerformed
private void jButtonNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNuevoActionPerformed
jButtonNuevo.setEnabled(false);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(true);
jButtonCancelar.setEnabled(true);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(false);
camposFiltroActivo(false);
camposActivo(true);
camposLimpiar();
cargarComboBoxConceptoIngreso();
unIngresoSeleccionado = null;
jDateChooserFecha.setDate(unaControladoraGlobal.fechaSistema());
}//GEN-LAST:event_jButtonNuevoActionPerformed
private void jButtonImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonImprimirActionPerformed
if (jTableIngresos.getRowCount() > 0) {
String desde = "01/" + String.valueOf(jComboBoxDesdeMes.getSelectedIndex() + 1) + "/" + String.valueOf(jComboBoxDesdeAño.getSelectedItem());
String hasta = "01/" + String.valueOf(jComboBoxHastaMes.getSelectedIndex() + 1) + "/" + String.valueOf(jComboBoxHastaAño.getSelectedItem());
Date fechaHasta = null;
Date fechaDesde = null;
try {
fechaDesde = new java.sql.Date(df.parse(String.valueOf(desde)).getTime());
fechaHasta = new java.sql.Date(df.parse(String.valueOf(hasta)).getTime());
} catch (ParseException ex) {
Logger.getLogger(IGestionEgresos.class.getName()).log(Level.SEVERE, null, ex);
}
List<IngresoOtro> unaListaIngreso = new ArrayList();
IngresoOtro unIngresoOtro;
int filas = this.modeloTablaGestionIngresos.getRowCount();
for (int i = 0; i < filas; i++) {
unIngresoOtro = unaControladoraGlobal.getIngresoOtroBD((Long) jTableIngresos.getValueAt(i, 0));
unaListaIngreso.add(unIngresoOtro);
}
GestionIngresosDS unaGestionIgresosDS = new GestionIngresosDS(unaControladoraGlobal, unaListaIngreso, fechaDesde, fechaHasta);
unaGestionIgresosDS.verReporte();
} else {
JOptionPane.showMessageDialog(this, "La tabla esta Vacia");
}
}//GEN-LAST:event_jButtonImprimirActionPerformed
private void jButtonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarActionPerformed
if (camposValidar()) {
Date fecha = new java.sql.Date(jDateChooserFecha.getDate().getTime());
if (unIngresoSeleccionado == null) {
unaControladoraGlobal.crearIngresoOtro(fecha, Integer.parseInt(jTextFieldMonto.getText()), (ConceptoIngreso) jComboBoxConceptoIngreso.getSelectedItem(), jTextPaneDetalle.getText());
JOptionPane.showMessageDialog(this, "Ingreso Guardado");
} else {
unaControladoraGlobal.modificarIngresoOtro(unIngresoSeleccionado, fecha, Integer.parseInt(jTextFieldMonto.getText()), (ConceptoIngreso) jComboBoxConceptoIngreso.getSelectedItem(), jTextPaneDetalle.getText(), false);
JOptionPane.showMessageDialog(this, "Ingreso Modificado");
unIngresoSeleccionado = null;
}
cargarFechasFiltrado();
cargarTabla();
jButtonNuevo.setEnabled(true);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(false);
jButtonCancelar.setEnabled(false);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(true);
camposActivo(false);
camposFiltroActivo(true);
camposLimpiar();
}
}//GEN-LAST:event_jButtonGuardarActionPerformed
private void jButtonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarActionPerformed
jButtonNuevo.setEnabled(true);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(false);
jButtonCancelar.setEnabled(false);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(true);
camposFiltroActivo(true);
camposActivo(false);
camposLimpiar();
}//GEN-LAST:event_jButtonCancelarActionPerformed
private void jButtonNuevoIngresoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNuevoIngresoActionPerformed
IConceptoIngresoOtro unaIConceptoIngresos = new IConceptoIngresoOtro(this, unaControladoraGlobal);
unaIConceptoIngresos.pack();
unaIConceptoIngresos.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_jButtonNuevoIngresoActionPerformed
private void jComboBoxDesdeMesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxDesdeMesItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxDesdeMesItemStateChanged
private void jComboBoxDesdeAñoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxDesdeAñoItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxDesdeAñoItemStateChanged
private void jComboBoxHastaMesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxHastaMesItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxHastaMesItemStateChanged
private void jComboBoxHastaAñoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxHastaAñoItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxHastaAñoItemStateChanged
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
cargarComboBoxConceptoIngreso();
}//GEN-LAST:event_formComponentShown
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonCancelar;
private javax.swing.JButton jButtonEditar;
private javax.swing.JButton jButtonEliminar;
private javax.swing.JButton jButtonGuardar;
private javax.swing.JButton jButtonImprimir;
private javax.swing.JButton jButtonNuevo;
private javax.swing.JButton jButtonNuevoIngreso;
private javax.swing.JComboBox jComboBoxConceptoIngreso;
private javax.swing.JComboBox jComboBoxDesdeAño;
private javax.swing.JComboBox jComboBoxDesdeMes;
private javax.swing.JComboBox jComboBoxHastaAño;
private javax.swing.JComboBox jComboBoxHastaMes;
private com.toedter.calendar.JDateChooser jDateChooserFecha;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabelComentario;
private javax.swing.JLabel jLabelConceptoIngreso;
private javax.swing.JLabel jLabelFecha;
private javax.swing.JLabel jLabelMonto;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanelBotones;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable jTableIngresos;
private javax.swing.JTextField jTextFieldMonto;
private javax.swing.JTextPane jTextPaneDetalle;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 42,117 |
java
|
IGestionIngresosOtro.java
|
Java
|
[] | null |
[] |
package Interfaces;
import DataSources.GestionIngresosDS;
import java.awt.Color;
import java.awt.event.ItemEvent;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import logicaNegocios.ConceptoIngreso;
import logicaNegocios.IngresoOtro;
import main.ControladoraGlobal;
public class IGestionIngresosOtro extends javax.swing.JInternalFrame {
private ControladoraGlobal unaControladoraGlobal;
private DefaultTableModel modeloTablaGestionIngresos;
private IngresoOtro unIngresoSeleccionado;
private DateFormat df = DateFormat.getDateInstance();
public IGestionIngresosOtro(ControladoraGlobal unaControladoraGlobal) {
initComponents();
IMenuPrincipal.jDesktopPane.add(this);
IMenuPrincipal.centrarYalFrente(this);
this.unaControladoraGlobal = unaControladoraGlobal;
this.modeloTablaGestionIngresos = (DefaultTableModel) jTableIngresos.getModel();
setFrameIcon(new ImageIcon(getClass().getResource("/Iconos Nuevos/Contabilidad.png")));
this.setTitle("Gestión de Ingresos Otro");
this.jTableIngresos.getTableHeader().setReorderingAllowed(false);
if (unaControladoraGlobal.getIngresosOtrosBD().size() > 0) {
cargarFechasFiltrado();
cargarTabla();
}
jTextPaneDetalle.setBackground(new Color(228, 231, 237));
}
private void cargarComboBoxConceptoIngreso() {
this.jComboBoxConceptoIngreso.setModel(new DefaultComboBoxModel((Vector) this.unaControladoraGlobal.getConceptosIngresosBD()));
this.jComboBoxConceptoIngreso.setSelectedIndex(-1);
}
private void cargarFechasFiltrado() {
if (unaControladoraGlobal.getPrimerIngresoOtro() != null) {
String fecha = df.format(unaControladoraGlobal.getPrimerIngresoOtro().getFecha());
String[] fechaDividida = fecha.split("/");
jComboBoxDesdeMes.setSelectedIndex(Integer.parseInt(fechaDividida[1]) - 1);
jComboBoxDesdeAño.setSelectedIndex(Integer.parseInt(fechaDividida[2]) + 1 - Integer.parseInt(jComboBoxDesdeAño.getItemAt(1).toString()));
fecha = df.format(unaControladoraGlobal.getUltimoIngresoOtro().getFecha());
fechaDividida = fecha.split("/");
jComboBoxHastaMes.setSelectedIndex(Integer.parseInt(fechaDividida[1]) - 1);
jComboBoxHastaAño.setSelectedIndex(Integer.parseInt(fechaDividida[2]) + 1 - Integer.parseInt(jComboBoxDesdeAño.getItemAt(1).toString()));
}
}
private void cargarTabla() {
limpiarTabla();
String desde = "01/" + String.valueOf(jComboBoxDesdeMes.getSelectedIndex() + 1) + "/" + String.valueOf(jComboBoxDesdeAño.getSelectedItem());
String hasta = "01/" + String.valueOf(jComboBoxHastaMes.getSelectedIndex() + 2) + "/" + String.valueOf(jComboBoxHastaAño.getSelectedItem());
Date fechaHasta = null;
Date fechaDesde = null;
try {
fechaDesde = new java.sql.Date(df.parse(String.valueOf(desde)).getTime());
fechaHasta = new java.sql.Date(df.parse(String.valueOf(hasta)).getTime());
for (IngresoOtro unIngreso : this.unaControladoraGlobal.getIngresoOtroEntreFechas(fechaDesde, fechaHasta)) {
this.modeloTablaGestionIngresos.addRow(new Object[]{unIngreso.getIdIngresoOtro(), df.format(unIngreso.getFecha()), unIngreso.getUnConceptoIngreso(), unIngreso.getDetalle(), unIngreso.getMonto()});
}
} catch (ParseException ex) {
Logger.getLogger(IGestionIngresosOtro.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void limpiarTabla() {
int filas = this.modeloTablaGestionIngresos.getRowCount();
for (int i = 0; i < filas; i++) {
modeloTablaGestionIngresos.removeRow(0);
}
camposLimpiar();
}
private void camposFiltroActivo(boolean Editable) {
jComboBoxDesdeMes.setEnabled(Editable);
jComboBoxDesdeAño.setEnabled(Editable);
jComboBoxHastaMes.setEnabled(Editable);
jComboBoxHastaAño.setEnabled(Editable);
}
private void camposActivo(boolean Editable) {
jTextFieldMonto.setEditable(Editable);
jDateChooserFecha.setEnabled(Editable);
jTextPaneDetalle.setEditable(Editable);
jComboBoxConceptoIngreso.setEnabled(Editable);
jButtonNuevoIngreso.setEnabled(Editable);
if (Editable) {
jTextPaneDetalle.setBackground(Color.WHITE);
} else {
jTextPaneDetalle.setBackground(new Color(228, 231, 237));
}
}
//blanquea componentes editables
private void camposLimpiar() {
jTextPaneDetalle.setText("");
jDateChooserFecha.setDate(null);
jTextFieldMonto.setText("");
jComboBoxConceptoIngreso.setSelectedIndex(-1);
}
//actualizar campos al seleccionar en la tabla
private void camposCargar() {
if (jTableIngresos.getSelectedRow() > -1) {
if (jTableIngresos.getValueAt(jTableIngresos.getSelectedRow(), 0) != null) {
unIngresoSeleccionado = unaControladoraGlobal.getIngresoOtroBD((Long) jTableIngresos.getValueAt(jTableIngresos.getSelectedRow(), 0));
camposLimpiar();
jDateChooserFecha.setDate((unIngresoSeleccionado.getFecha()));
jTextFieldMonto.setText(String.valueOf(unIngresoSeleccionado.getMonto()));
jTextPaneDetalle.setText(unIngresoSeleccionado.getDetalle());
jComboBoxConceptoIngreso.setSelectedItem(unIngresoSeleccionado.getUnConceptoIngreso());
camposActivo(false);
jButtonEditar.setEnabled(true);
jButtonEliminar.setEnabled(true);
}
}
}
private boolean camposValidar() {
boolean bandera = true;
if (jTextFieldMonto.getText().isEmpty()) {
jLabelMonto.setForeground(Color.red);
bandera = false;
} else {
jLabelMonto.setForeground(Color.black);
}
if (jComboBoxConceptoIngreso.getSelectedIndex() == -1) {
jLabelConceptoIngreso.setForeground(Color.red);
bandera = false;
} else {
jLabelConceptoIngreso.setForeground(Color.black);
}
if (jDateChooserFecha.getDate() == null) {
jLabelFecha.setForeground(Color.red);
bandera = false;
} else {
jLabelFecha.setForeground(Color.black);
}
if (!bandera) {
JOptionPane.showMessageDialog(this, "Por favor complete todos los campos obligatorios");
}
return bandera;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanelBotones = new javax.swing.JPanel();
jButtonEditar = new javax.swing.JButton();
jButtonEliminar = new javax.swing.JButton();
jButtonNuevo = new javax.swing.JButton();
jButtonImprimir = new javax.swing.JButton();
jButtonGuardar = new javax.swing.JButton();
jButtonCancelar = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTableIngresos = new javax.swing.JTable();
jPanel7 = new javax.swing.JPanel();
jLabelFecha = new javax.swing.JLabel();
jLabelConceptoIngreso = new javax.swing.JLabel();
jLabelComentario = new javax.swing.JLabel();
jTextFieldMonto = new javax.swing.JTextField();
jLabelMonto = new javax.swing.JLabel();
jComboBoxConceptoIngreso = new javax.swing.JComboBox();
jButtonNuevoIngreso = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTextPaneDetalle = new javax.swing.JTextPane();
jDateChooserFecha = new com.toedter.calendar.JDateChooser();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jComboBoxDesdeMes = new javax.swing.JComboBox();
jComboBoxDesdeAño = new javax.swing.JComboBox();
jPanel4 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jComboBoxHastaMes = new javax.swing.JComboBox();
jComboBoxHastaAño = new javax.swing.JComboBox();
setClosable(true);
setMaximumSize(new java.awt.Dimension(792, 695));
setMinimumSize(new java.awt.Dimension(792, 695));
setPreferredSize(new java.awt.Dimension(792, 695));
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
jPanelBotones.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jButtonEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/Edit2.png"))); // NOI18N
jButtonEditar.setText("Editar");
jButtonEditar.setEnabled(false);
jButtonEditar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonEditar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonEditar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonEditarActionPerformed(evt);
}
});
jButtonEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/deletered.png"))); // NOI18N
jButtonEliminar.setText("Eliminar");
jButtonEliminar.setEnabled(false);
jButtonEliminar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonEliminar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonEliminarActionPerformed(evt);
}
});
jButtonNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/add2.png"))); // NOI18N
jButtonNuevo.setText("Nuevo");
jButtonNuevo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonNuevo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonNuevo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonNuevoActionPerformed(evt);
}
});
jButtonImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/printer.png"))); // NOI18N
jButtonImprimir.setText("Imprimir");
jButtonImprimir.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonImprimir.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonImprimir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonImprimirActionPerformed(evt);
}
});
jButtonGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/save.png"))); // NOI18N
jButtonGuardar.setText("Guardar");
jButtonGuardar.setEnabled(false);
jButtonGuardar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonGuardar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonGuardarActionPerformed(evt);
}
});
jButtonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/cancel.png"))); // NOI18N
jButtonCancelar.setText("Cancelar");
jButtonCancelar.setEnabled(false);
jButtonCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButtonCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCancelarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanelBotonesLayout = new javax.swing.GroupLayout(jPanelBotones);
jPanelBotones.setLayout(jPanelBotonesLayout);
jPanelBotonesLayout.setHorizontalGroup(
jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelBotonesLayout.createSequentialGroup()
.addGap(3, 3, 3)
.addComponent(jButtonNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(257, Short.MAX_VALUE))
);
jPanelBotonesLayout.setVerticalGroup(
jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelBotonesLayout.createSequentialGroup()
.addGap(3, 3, 3)
.addGroup(jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButtonCancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonGuardar)
.addComponent(jButtonEliminar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonImprimir, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButtonEditar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGap(3, 3, 3))
);
jTableIngresos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"id", "Fecha", "Concepto Ingreso", "Observación", "Monto"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jTableIngresos);
if (jTableIngresos.getColumnModel().getColumnCount() > 0) {
jTableIngresos.getColumnModel().getColumn(0).setMinWidth(0);
jTableIngresos.getColumnModel().getColumn(0).setPreferredWidth(0);
jTableIngresos.getColumnModel().getColumn(0).setMaxWidth(0);
}
jTableIngresos.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent event) {
camposCargar();
}
});
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
);
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalle", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
jPanel7.setName(""); // NOI18N
jLabelFecha.setText("Fecha");
jLabelConceptoIngreso.setText("Concepto Ingreso");
jLabelComentario.setText("Observación");
jTextFieldMonto.setEditable(false);
jLabelMonto.setText("Monto");
jComboBoxConceptoIngreso.setEnabled(false);
jButtonNuevoIngreso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos Nuevos/Nuevo2.png"))); // NOI18N
jButtonNuevoIngreso.setEnabled(false);
jButtonNuevoIngreso.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonNuevoIngresoActionPerformed(evt);
}
});
jTextPaneDetalle.setEditable(false);
jScrollPane3.setViewportView(jTextPaneDetalle);
jDateChooserFecha.setEnabled(false);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(188, 188, 188)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelMonto)
.addComponent(jLabelConceptoIngreso)
.addComponent(jLabelFecha)
.addComponent(jLabelComentario))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jComboBoxConceptoIngreso, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextFieldMonto, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jDateChooserFecha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonNuevoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelFecha)
.addComponent(jDateChooserFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelConceptoIngreso)
.addComponent(jComboBoxConceptoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButtonNuevoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(8, 8, 8)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextFieldMonto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelMonto))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabelComentario)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE))
.addContainerGap())
);
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Desde"));
jLabel1.setText("Año");
jLabel2.setText("Mes");
jComboBoxDesdeMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" }));
jComboBoxDesdeMes.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxDesdeMesItemStateChanged(evt);
}
});
jComboBoxDesdeAño.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
jComboBoxDesdeAño.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxDesdeAñoItemStateChanged(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()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxDesdeMes, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxDesdeAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 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(jLabel1)
.addComponent(jComboBoxDesdeAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jComboBoxDesdeMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Hasta"));
jLabel7.setText("Año");
jLabel8.setText("Mes");
jComboBoxHastaMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" }));
jComboBoxHastaMes.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxHastaMesItemStateChanged(evt);
}
});
jComboBoxHastaAño.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
jComboBoxHastaAño.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBoxHastaAñoItemStateChanged(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()
.addContainerGap()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxHastaMes, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxHastaAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jComboBoxHastaAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(jComboBoxHastaMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.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))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10))
);
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelBotones, 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(10, 10, 10)
.addComponent(jPanelBotones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditarActionPerformed
jButtonNuevo.setEnabled(false);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(true);
jButtonCancelar.setEnabled(true);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(false);
camposFiltroActivo(false);
camposActivo(true);
}//GEN-LAST:event_jButtonEditarActionPerformed
private void jButtonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarActionPerformed
jButtonNuevo.setEnabled(true);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(false);
jButtonCancelar.setEnabled(false);
jButtonEliminar.setEnabled(false);
camposActivo(false);
Object[] options = {"OK", "Cancelar"};
if (0 == JOptionPane.showOptionDialog(
this,
"Desea eliminar el Ingreso: " + unIngresoSeleccionado.getFecha() + " - " + unIngresoSeleccionado.getUnConceptoIngreso() + " - " + unIngresoSeleccionado.getMonto(),
"Eliminar",
JOptionPane.PLAIN_MESSAGE,
JOptionPane.WARNING_MESSAGE,
null,
options,
options)) {
unaControladoraGlobal.eliminarIngresoOtro(unIngresoSeleccionado);
cargarFechasFiltrado();
cargarTabla();
}
unIngresoSeleccionado = null;
jTableIngresos.clearSelection();
jTableIngresos.setEnabled(true);
camposLimpiar();
}//GEN-LAST:event_jButtonEliminarActionPerformed
private void jButtonNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNuevoActionPerformed
jButtonNuevo.setEnabled(false);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(true);
jButtonCancelar.setEnabled(true);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(false);
camposFiltroActivo(false);
camposActivo(true);
camposLimpiar();
cargarComboBoxConceptoIngreso();
unIngresoSeleccionado = null;
jDateChooserFecha.setDate(unaControladoraGlobal.fechaSistema());
}//GEN-LAST:event_jButtonNuevoActionPerformed
private void jButtonImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonImprimirActionPerformed
if (jTableIngresos.getRowCount() > 0) {
String desde = "01/" + String.valueOf(jComboBoxDesdeMes.getSelectedIndex() + 1) + "/" + String.valueOf(jComboBoxDesdeAño.getSelectedItem());
String hasta = "01/" + String.valueOf(jComboBoxHastaMes.getSelectedIndex() + 1) + "/" + String.valueOf(jComboBoxHastaAño.getSelectedItem());
Date fechaHasta = null;
Date fechaDesde = null;
try {
fechaDesde = new java.sql.Date(df.parse(String.valueOf(desde)).getTime());
fechaHasta = new java.sql.Date(df.parse(String.valueOf(hasta)).getTime());
} catch (ParseException ex) {
Logger.getLogger(IGestionEgresos.class.getName()).log(Level.SEVERE, null, ex);
}
List<IngresoOtro> unaListaIngreso = new ArrayList();
IngresoOtro unIngresoOtro;
int filas = this.modeloTablaGestionIngresos.getRowCount();
for (int i = 0; i < filas; i++) {
unIngresoOtro = unaControladoraGlobal.getIngresoOtroBD((Long) jTableIngresos.getValueAt(i, 0));
unaListaIngreso.add(unIngresoOtro);
}
GestionIngresosDS unaGestionIgresosDS = new GestionIngresosDS(unaControladoraGlobal, unaListaIngreso, fechaDesde, fechaHasta);
unaGestionIgresosDS.verReporte();
} else {
JOptionPane.showMessageDialog(this, "La tabla esta Vacia");
}
}//GEN-LAST:event_jButtonImprimirActionPerformed
private void jButtonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarActionPerformed
if (camposValidar()) {
Date fecha = new java.sql.Date(jDateChooserFecha.getDate().getTime());
if (unIngresoSeleccionado == null) {
unaControladoraGlobal.crearIngresoOtro(fecha, Integer.parseInt(jTextFieldMonto.getText()), (ConceptoIngreso) jComboBoxConceptoIngreso.getSelectedItem(), jTextPaneDetalle.getText());
JOptionPane.showMessageDialog(this, "Ingreso Guardado");
} else {
unaControladoraGlobal.modificarIngresoOtro(unIngresoSeleccionado, fecha, Integer.parseInt(jTextFieldMonto.getText()), (ConceptoIngreso) jComboBoxConceptoIngreso.getSelectedItem(), jTextPaneDetalle.getText(), false);
JOptionPane.showMessageDialog(this, "Ingreso Modificado");
unIngresoSeleccionado = null;
}
cargarFechasFiltrado();
cargarTabla();
jButtonNuevo.setEnabled(true);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(false);
jButtonCancelar.setEnabled(false);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(true);
camposActivo(false);
camposFiltroActivo(true);
camposLimpiar();
}
}//GEN-LAST:event_jButtonGuardarActionPerformed
private void jButtonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarActionPerformed
jButtonNuevo.setEnabled(true);
jButtonEditar.setEnabled(false);
jButtonGuardar.setEnabled(false);
jButtonCancelar.setEnabled(false);
jButtonEliminar.setEnabled(false);
jTableIngresos.setEnabled(true);
camposFiltroActivo(true);
camposActivo(false);
camposLimpiar();
}//GEN-LAST:event_jButtonCancelarActionPerformed
private void jButtonNuevoIngresoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNuevoIngresoActionPerformed
IConceptoIngresoOtro unaIConceptoIngresos = new IConceptoIngresoOtro(this, unaControladoraGlobal);
unaIConceptoIngresos.pack();
unaIConceptoIngresos.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_jButtonNuevoIngresoActionPerformed
private void jComboBoxDesdeMesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxDesdeMesItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxDesdeMesItemStateChanged
private void jComboBoxDesdeAñoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxDesdeAñoItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxDesdeAñoItemStateChanged
private void jComboBoxHastaMesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxHastaMesItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxHastaMesItemStateChanged
private void jComboBoxHastaAñoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxHastaAñoItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
cargarTabla();
}
}//GEN-LAST:event_jComboBoxHastaAñoItemStateChanged
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
cargarComboBoxConceptoIngreso();
}//GEN-LAST:event_formComponentShown
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonCancelar;
private javax.swing.JButton jButtonEditar;
private javax.swing.JButton jButtonEliminar;
private javax.swing.JButton jButtonGuardar;
private javax.swing.JButton jButtonImprimir;
private javax.swing.JButton jButtonNuevo;
private javax.swing.JButton jButtonNuevoIngreso;
private javax.swing.JComboBox jComboBoxConceptoIngreso;
private javax.swing.JComboBox jComboBoxDesdeAño;
private javax.swing.JComboBox jComboBoxDesdeMes;
private javax.swing.JComboBox jComboBoxHastaAño;
private javax.swing.JComboBox jComboBoxHastaMes;
private com.toedter.calendar.JDateChooser jDateChooserFecha;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabelComentario;
private javax.swing.JLabel jLabelConceptoIngreso;
private javax.swing.JLabel jLabelFecha;
private javax.swing.JLabel jLabelMonto;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanelBotones;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable jTableIngresos;
private javax.swing.JTextField jTextFieldMonto;
private javax.swing.JTextPane jTextPaneDetalle;
// End of variables declaration//GEN-END:variables
}
| 42,117 | 0.68117 | 0.670239 | 773 | 53.439846 | 43.17683 | 240 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.835705 | false | false |
3
|
8f452feaacec9fbd824d653e947414551914a70e
| 30,288,109,430,384 |
8df4c67fb51b9750e96484f1a3c4debc3c908e14
|
/companies-service/src/main/java/com/tghcastro/gullveig/companies/service/domain/exceptions/SectorNotFoundException.java
|
9d3a5b911b68e3213d30eabe6c3d80cbc31869ff
|
[] |
no_license
|
tghcastro/gullveig-service
|
https://github.com/tghcastro/gullveig-service
|
7005ef8c8043bd0bd56a2b9d2be5f404370c2e9b
|
fff39756a95a195159bba6c013db6180c9c382fc
|
refs/heads/master
| 2023-01-22T02:11:52.552000 | 2020-11-11T09:34:10 | 2020-11-11T09:34:10 | 260,042,339 | 0 | 0 | null | false | 2020-11-11T19:48:06 | 2020-04-29T20:46:49 | 2020-11-11T09:34:26 | 2020-11-11T09:34:23 | 357 | 0 | 0 | 1 |
Java
| false | false |
package com.tghcastro.gullveig.companies.service.domain.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.text.MessageFormat;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class SectorNotFoundException extends RuntimeException {
public SectorNotFoundException(Long id) {
super(MessageFormat.format("Sector not found [id:{0}]", id));
}
}
|
UTF-8
|
Java
| 444 |
java
|
SectorNotFoundException.java
|
Java
|
[] | null |
[] |
package com.tghcastro.gullveig.companies.service.domain.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.text.MessageFormat;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class SectorNotFoundException extends RuntimeException {
public SectorNotFoundException(Long id) {
super(MessageFormat.format("Sector not found [id:{0}]", id));
}
}
| 444 | 0.790541 | 0.788288 | 13 | 33.153847 | 27.259003 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false |
3
|
09fbd0adbc1cf9739374aa76559d03f5183aab78
| 36,850,819,428,672 |
c2d7cac3064a1ee72bf63a5d48de0c186ade012e
|
/src/main/java/Command/CommandController.java
|
9fc6c56ee048cef2c6772336bd8984abfcb20b2f
|
[] |
no_license
|
Fhuu/ProjectLibrary
|
https://github.com/Fhuu/ProjectLibrary
|
f0af674375e5dc0c5fdb0fe3cdb65629712dd0ad
|
84d41022da4cf3bd3a00028029c5ca52e02b589d
|
refs/heads/master
| 2021-07-21T16:11:03.859000 | 2019-11-26T22:58:14 | 2019-11-26T22:58:14 | 223,813,829 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Command;
import Account.Logger;
import Library.BookShelfController;
import java.util.Scanner;
public class CommandController {
private static CommandController cc = new CommandController();
Commands command;
public final String help = "Available commands:" +
"\n- add -> to add book into bookshelf" +
"\n- print -> to see books inside bookshelf" +
"\n- login -> to log into a profile" +
"\n- check-profile -> to check whether you are logged in" +
"\n- help -> to see all available commands";
private CommandController() {
}
public static CommandController getInstance() {
return cc;
}
public void setCommand(Commands command) {
this.command = command;
}
public Commands getCommand() {
return command;
}
public void validateCommand(String commandInput) {
for(Commands command : Commands.values()) {
if (command.toString().equals(commandInput.toLowerCase())) {
cc.processCommand(command);
}
}
}
public void processCommand(Commands command) {
Scanner scanner = new Scanner(System.in);
switch (command) {
case add :
System.out.print("Title: ");
String title = scanner.nextLine();
System.out.print("ISBN: ");
String isbn = scanner.nextLine();
System.out.print("number of page: ");
int pageNumber = scanner.nextInt();
BookShelfController.getInstance().addBook(title, isbn, pageNumber);
break;
case print :
BookShelfController.getInstance().printBookShelf();
System.out.println("---------------------D-I-R-O-L-I-B-R-A-R-Y-------------------\n");
break;
case help:
System.out.println(help);
break;
case login:
Logger logger = Logger.getInstance();
logger.login();
break;
case check_profile:
System.out.println(Logger.getInstance().isLoggedInStat());
break;
case end:
System.out.println("Thank you for using our service.\n-DB");
break;
}
}
}
|
UTF-8
|
Java
| 2,370 |
java
|
CommandController.java
|
Java
|
[] | null |
[] |
package Command;
import Account.Logger;
import Library.BookShelfController;
import java.util.Scanner;
public class CommandController {
private static CommandController cc = new CommandController();
Commands command;
public final String help = "Available commands:" +
"\n- add -> to add book into bookshelf" +
"\n- print -> to see books inside bookshelf" +
"\n- login -> to log into a profile" +
"\n- check-profile -> to check whether you are logged in" +
"\n- help -> to see all available commands";
private CommandController() {
}
public static CommandController getInstance() {
return cc;
}
public void setCommand(Commands command) {
this.command = command;
}
public Commands getCommand() {
return command;
}
public void validateCommand(String commandInput) {
for(Commands command : Commands.values()) {
if (command.toString().equals(commandInput.toLowerCase())) {
cc.processCommand(command);
}
}
}
public void processCommand(Commands command) {
Scanner scanner = new Scanner(System.in);
switch (command) {
case add :
System.out.print("Title: ");
String title = scanner.nextLine();
System.out.print("ISBN: ");
String isbn = scanner.nextLine();
System.out.print("number of page: ");
int pageNumber = scanner.nextInt();
BookShelfController.getInstance().addBook(title, isbn, pageNumber);
break;
case print :
BookShelfController.getInstance().printBookShelf();
System.out.println("---------------------D-I-R-O-L-I-B-R-A-R-Y-------------------\n");
break;
case help:
System.out.println(help);
break;
case login:
Logger logger = Logger.getInstance();
logger.login();
break;
case check_profile:
System.out.println(Logger.getInstance().isLoggedInStat());
break;
case end:
System.out.println("Thank you for using our service.\n-DB");
break;
}
}
}
| 2,370 | 0.534599 | 0.534599 | 75 | 30.6 | 24.331598 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.453333 | false | false |
3
|
d830b829cef58047cc891c4802f79802f21f4255
| 37,048,387,925,313 |
9c57370e454bfff2cf3c05ac62fb614aee5c312a
|
/redis/src/main/java/com/example/autumn/redis/base/ScoreFunction.java
|
4970e78242adaab70b718ba7e7207b3a5cd6df45
|
[] |
no_license
|
709248556/demo
|
https://github.com/709248556/demo
|
9f4a77b124b870092b365d92d3652537dcdcd45f
|
6c57d887fb81f1996589cfc45acdeac6229a9f62
|
refs/heads/master
| 2022-11-08T06:28:26.645000 | 2020-06-19T07:05:34 | 2020-06-19T07:05:34 | 271,154,307 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.autumn.redis.base;
import java.io.Serializable;
/**
* @description:
* @author: yanlianglong
* @create: 2020-06-10 10:43
**/
@FunctionalInterface
public interface ScoreFunction<TResult> extends Serializable {
/**
* 应用
*/
TResult apply();
}
|
UTF-8
|
Java
| 287 |
java
|
ScoreFunction.java
|
Java
|
[
{
"context": "io.Serializable;\n\n/**\n * @description:\n * @author: yanlianglong\n * @create: 2020-06-10 10:43\n **/\n@FunctionalInte",
"end": 115,
"score": 0.9901426434516907,
"start": 103,
"tag": "USERNAME",
"value": "yanlianglong"
}
] | null |
[] |
package com.example.autumn.redis.base;
import java.io.Serializable;
/**
* @description:
* @author: yanlianglong
* @create: 2020-06-10 10:43
**/
@FunctionalInterface
public interface ScoreFunction<TResult> extends Serializable {
/**
* 应用
*/
TResult apply();
}
| 287 | 0.671378 | 0.628975 | 16 | 16.6875 | 16.273901 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | false | false |
3
|
a943f2f4be76d82b5ef9fae78388f798578ff89c
| 34,333,968,615,423 |
37fd3f1a64b33b0706bb821bb29b0992e5b21423
|
/Algorithms/src/NarsihmaKarunmanchi/Trees/GenaricTrees/FindDepthInGenericTress.java
|
292e1e82c674260cb985a77ca4305ae8941c8490
|
[] |
no_license
|
srinivasvemula4u/programming
|
https://github.com/srinivasvemula4u/programming
|
a44e0b6c9212d86a9c01c522e2b863b06b5e006e
|
2763ae83303719af751531c5776d6dd5b5a1f933
|
refs/heads/master
| 2021-01-16T23:18:03.643000 | 2018-05-29T01:41:22 | 2018-05-29T01:41:22 | 82,819,650 | 1 | 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 NarsihmaKarunmanchi.Trees.GenaricTrees;
/**
*
* @author srivemul
*/
public class FindDepthInGenericTress {
/* Given a Parent array P, Where p[i] indicates the parent of ith node in the tree(Assume parent of root node is indicated with -1)
Give an algorithm finding the height or depth of the tree.
*/
public static int findDepthInGenericTrees(int[] P) {
int maxDepth = -1, currentDepth = -1, j;
for (int i = 0; i < P.length; i++) {
currentDepth = 0;
j = i;
while (P[j] != -1) {
currentDepth++;
j = P[j];
}
if (maxDepth < currentDepth) {
maxDepth = currentDepth;
}
}
return maxDepth;
}
public static void main(String args[]) {
System.out.println(findDepthInGenericTrees(new int[]{-1, 0, 1, 6, 6, 0, 0, 2, 7}));
}
}
|
UTF-8
|
Java
| 1,102 |
java
|
FindDepthInGenericTress.java
|
Java
|
[
{
"context": "Karunmanchi.Trees.GenaricTrees;\n\n/**\n *\n * @author srivemul\n */\npublic class FindDepthInGenericTress {\n\n /",
"end": 260,
"score": 0.9878121614456177,
"start": 252,
"tag": "USERNAME",
"value": "srivemul"
}
] | 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 NarsihmaKarunmanchi.Trees.GenaricTrees;
/**
*
* @author srivemul
*/
public class FindDepthInGenericTress {
/* Given a Parent array P, Where p[i] indicates the parent of ith node in the tree(Assume parent of root node is indicated with -1)
Give an algorithm finding the height or depth of the tree.
*/
public static int findDepthInGenericTrees(int[] P) {
int maxDepth = -1, currentDepth = -1, j;
for (int i = 0; i < P.length; i++) {
currentDepth = 0;
j = i;
while (P[j] != -1) {
currentDepth++;
j = P[j];
}
if (maxDepth < currentDepth) {
maxDepth = currentDepth;
}
}
return maxDepth;
}
public static void main(String args[]) {
System.out.println(findDepthInGenericTrees(new int[]{-1, 0, 1, 6, 6, 0, 0, 2, 7}));
}
}
| 1,102 | 0.57804 | 0.564428 | 36 | 29.611111 | 29.528967 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.694444 | false | false |
3
|
7f6c43666664bc55fea85a6085d1af851c8e98d7
| 39,496,519,254,073 |
0313bc658b664bc1dceff9a78c9babd678990f32
|
/platform/src/com/test/service/impl/ChangeTimeServiceImpl.java
|
b504030414ccd047af880a99924218fb3d1d8982
|
[] |
no_license
|
chengyz/platform
|
https://github.com/chengyz/platform
|
0121df0fbc2c7ba0868983c0d20300b97f69b65d
|
5a28dae62ee06937917b67a49180dc1773b6e39a
|
refs/heads/master
| 2021-09-02T08:48:52.064000 | 2018-01-01T05:33:09 | 2018-01-01T05:33:09 | 115,899,894 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test.service.impl;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import spark.annotation.Auto;
import com.test.entity.ChangeTime;
import com.test.service.ChangeTimeService;
import com.util.DateUtil;
import dbengine.dao.EntityDao;
import dbengine.dao.SqlDao;
import dbengine.util.Page;
/**
* 各种时间的service接口实现
* @author chengyz
*
*/
public class ChangeTimeServiceImpl implements ChangeTimeService {
@Auto(name=SqlDao.class)
private SqlDao sqldao;
@Auto(name=EntityDao.class)
private EntityDao entityDao;
/**
* 添加或修改
*/
@Override
public boolean saveOrUpChangeTime(String sourceId, boolean closeConn, ChangeTime changeTime) {
if(changeTime == null){
return false;
}
if(changeTime.getId() == null){
changeTime.setCreateTime(DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
changeTime.setTimeUUID(UUID.randomUUID().toString());
return entityDao.saveEntity(sourceId, changeTime, closeConn);
}else{
changeTime.setUpdateTime(DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
return entityDao.updateEntity(sourceId, changeTime, closeConn);
}
}
/**
* 查询各种时间
*/
@Override
public ChangeTime findChangeTime(String sourceId, boolean closeConn, String timeUUID) {
if(timeUUID == null || "".equals(timeUUID)){
return null;
}
StringBuilder sql = new StringBuilder();
sql.append("select * from change_time where timeUUID = '").append(timeUUID).append("'");
ChangeTime times = (ChangeTime)sqldao.findEntityBySql(sourceId, sql.toString(), ChangeTime.class, closeConn, null);
if(times == null){
return null;
}else{
return times;
}
}
/**
* 删除各种时间
*/
@Override
public boolean deleteChangeTime(String sourceId, boolean closeConn, String timeUUID) {
if(timeUUID == null || "".equals(timeUUID)){
return false;
}
StringBuilder sql = new StringBuilder();
sql.append("delete from change_time where timeUUID = '").append(timeUUID).append("'");
return sqldao.executeSql(sourceId, sql.toString(), closeConn, null);
}
/**
* 查询各种时间列表
*/
@Override
public List<ChangeTime> findTimeList(String sourceId, boolean closeConn,Page page) {
StringBuilder sql = new StringBuilder();
sql.append("select * from change_time");
if(page == null){
return sqldao.findListBySql(sourceId, sql.toString(), ChangeTime.class, closeConn, null);
}else{
return sqldao.findPageByMysql(sourceId, sql.toString(), closeConn, ChangeTime.class, page, null);
}
}
/**
* 通过所属平台查询各种时间
*/
@Override
public ChangeTime findTimeByBelong(String sourceId, boolean closeConn, String belongPlatform) {
if(belongPlatform == null || "".equals(belongPlatform)){
return null;
}
StringBuilder sql = new StringBuilder();
sql.append("select * from change_time where belongPlatform = '").append(belongPlatform).append("'");
@SuppressWarnings("unchecked")
ChangeTime time = (ChangeTime)sqldao.findEntityBySql(sourceId, sql.toString(), ChangeTime.class, closeConn, null);
if(time == null){
return null;
}
return time;
}
}
|
UTF-8
|
Java
| 3,137 |
java
|
ChangeTimeServiceImpl.java
|
Java
|
[
{
"context": "gine.util.Page;\n/**\n * 各种时间的service接口实现\n * @author chengyz\n *\n */\npublic class ChangeTimeServiceImpl impleme",
"end": 366,
"score": 0.9995784759521484,
"start": 359,
"tag": "USERNAME",
"value": "chengyz"
}
] | null |
[] |
package com.test.service.impl;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import spark.annotation.Auto;
import com.test.entity.ChangeTime;
import com.test.service.ChangeTimeService;
import com.util.DateUtil;
import dbengine.dao.EntityDao;
import dbengine.dao.SqlDao;
import dbengine.util.Page;
/**
* 各种时间的service接口实现
* @author chengyz
*
*/
public class ChangeTimeServiceImpl implements ChangeTimeService {
@Auto(name=SqlDao.class)
private SqlDao sqldao;
@Auto(name=EntityDao.class)
private EntityDao entityDao;
/**
* 添加或修改
*/
@Override
public boolean saveOrUpChangeTime(String sourceId, boolean closeConn, ChangeTime changeTime) {
if(changeTime == null){
return false;
}
if(changeTime.getId() == null){
changeTime.setCreateTime(DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
changeTime.setTimeUUID(UUID.randomUUID().toString());
return entityDao.saveEntity(sourceId, changeTime, closeConn);
}else{
changeTime.setUpdateTime(DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
return entityDao.updateEntity(sourceId, changeTime, closeConn);
}
}
/**
* 查询各种时间
*/
@Override
public ChangeTime findChangeTime(String sourceId, boolean closeConn, String timeUUID) {
if(timeUUID == null || "".equals(timeUUID)){
return null;
}
StringBuilder sql = new StringBuilder();
sql.append("select * from change_time where timeUUID = '").append(timeUUID).append("'");
ChangeTime times = (ChangeTime)sqldao.findEntityBySql(sourceId, sql.toString(), ChangeTime.class, closeConn, null);
if(times == null){
return null;
}else{
return times;
}
}
/**
* 删除各种时间
*/
@Override
public boolean deleteChangeTime(String sourceId, boolean closeConn, String timeUUID) {
if(timeUUID == null || "".equals(timeUUID)){
return false;
}
StringBuilder sql = new StringBuilder();
sql.append("delete from change_time where timeUUID = '").append(timeUUID).append("'");
return sqldao.executeSql(sourceId, sql.toString(), closeConn, null);
}
/**
* 查询各种时间列表
*/
@Override
public List<ChangeTime> findTimeList(String sourceId, boolean closeConn,Page page) {
StringBuilder sql = new StringBuilder();
sql.append("select * from change_time");
if(page == null){
return sqldao.findListBySql(sourceId, sql.toString(), ChangeTime.class, closeConn, null);
}else{
return sqldao.findPageByMysql(sourceId, sql.toString(), closeConn, ChangeTime.class, page, null);
}
}
/**
* 通过所属平台查询各种时间
*/
@Override
public ChangeTime findTimeByBelong(String sourceId, boolean closeConn, String belongPlatform) {
if(belongPlatform == null || "".equals(belongPlatform)){
return null;
}
StringBuilder sql = new StringBuilder();
sql.append("select * from change_time where belongPlatform = '").append(belongPlatform).append("'");
@SuppressWarnings("unchecked")
ChangeTime time = (ChangeTime)sqldao.findEntityBySql(sourceId, sql.toString(), ChangeTime.class, closeConn, null);
if(time == null){
return null;
}
return time;
}
}
| 3,137 | 0.720197 | 0.720197 | 104 | 28.278847 | 31.048801 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.153846 | false | false |
3
|
c9fab3da6ed71fb3ff1be39d76d47a299f01b719
| 39,496,519,255,434 |
4acb80c2f1136aa8335acec5de9d89e6861f1d34
|
/handlebars/src/test/java/com/github/jknack/handlebars/InlinePartialsTest.java
|
8a64bddc17695c42ee29e2c3240dfbc676fc9f31
|
[
"Apache-2.0"
] |
permissive
|
DannyReinhold/handlebars.java
|
https://github.com/DannyReinhold/handlebars.java
|
d179125c359e8f65d8b1d3af87a6a837b05c8a9e
|
b711a96b6b979d7fac0cdb9b9f92fc664ced6215
|
refs/heads/master
| 2021-01-23T04:19:23.019000 | 2018-01-23T16:03:02 | 2018-01-23T16:03:02 | 92,924,073 | 0 | 1 | null | true | 2017-05-31T08:36:42 | 2017-05-31T08:36:42 | 2017-05-27T07:07:17 | 2017-04-05T21:51:27 | 3,778 | 0 | 0 | 0 | null | null | null |
package com.github.jknack.handlebars;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.junit.Test;
public class InlinePartialsTest extends AbstractTest {
@Test
public void shouldDefineInlinePartialsForTemplate() throws IOException {
shouldCompileTo("{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}", $, "success");
}
@Test
public void shouldOverwriteMultiplePartialsInTheSameTemplate() throws IOException {
shouldCompileTo(
"{{#*inline \"myPartial\"}}fail{{/inline}}{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}",
$, "success");
}
@Test
public void shouldDefineInlinePartialsForBlock() throws IOException {
shouldCompileTo(
"{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}{{/with}}", $,
"success");
}
@Test(expected = HandlebarsException.class)
public void shouldDefineInlinePartialsForBlockErr() throws IOException {
shouldCompileTo(
"{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{/with}}{{> myPartial}}", $,
"success");
}
@Test
public void shouldOverrideGlobalPartials() throws IOException {
shouldCompileToWithPartials("{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}", $,
$("myPartial", "fail"), "success");
}
@Test
public void shouldOverrideTemplatePartials() throws IOException {
shouldCompileTo(
"{{#*inline \"myPartial\"}}fail{{/inline}}{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}{{/with}}",
$, "success");
}
@Test
public void shouldOverridePartialsDownTheEntireStack() throws IOException {
shouldCompileTo(
"{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{#with .}}{{#with .}}{{> myPartial}}{{/with}}{{/with}}{{/with}}",
$, "success");
}
@Test
public void shouldDefineInlinePartialsForPartialCall() throws IOException {
shouldCompileToWithPartials("{{#*inline \"myPartial\"}}success{{/inline}}{{> dude}}", $,
$("dude", "{{> myPartial}}"), "success");
}
@Test
public void shouldDefineInlinePartialsInPartialBlockCall() throws IOException {
shouldCompileToWithPartials("{{#> dude}}{{#*inline \"myPartial\"}}success{{/inline}}{{/dude}}", $,
$("dude", "{{> myPartial}}"), "success");
}
@Test
public void inlinePartialText() throws IOException {
assertEquals("{{#*inline \"myPartial\"}}success{{/inline}}{{>myPartial}}",
compile("{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}").text());
}
}
|
UTF-8
|
Java
| 2,579 |
java
|
InlinePartialsTest.java
|
Java
|
[
{
"context": "package com.github.jknack.handlebars;\n\nimport static org.junit.Assert.asser",
"end": 25,
"score": 0.9990926384925842,
"start": 19,
"tag": "USERNAME",
"value": "jknack"
}
] | null |
[] |
package com.github.jknack.handlebars;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.junit.Test;
public class InlinePartialsTest extends AbstractTest {
@Test
public void shouldDefineInlinePartialsForTemplate() throws IOException {
shouldCompileTo("{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}", $, "success");
}
@Test
public void shouldOverwriteMultiplePartialsInTheSameTemplate() throws IOException {
shouldCompileTo(
"{{#*inline \"myPartial\"}}fail{{/inline}}{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}",
$, "success");
}
@Test
public void shouldDefineInlinePartialsForBlock() throws IOException {
shouldCompileTo(
"{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}{{/with}}", $,
"success");
}
@Test(expected = HandlebarsException.class)
public void shouldDefineInlinePartialsForBlockErr() throws IOException {
shouldCompileTo(
"{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{/with}}{{> myPartial}}", $,
"success");
}
@Test
public void shouldOverrideGlobalPartials() throws IOException {
shouldCompileToWithPartials("{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}", $,
$("myPartial", "fail"), "success");
}
@Test
public void shouldOverrideTemplatePartials() throws IOException {
shouldCompileTo(
"{{#*inline \"myPartial\"}}fail{{/inline}}{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}{{/with}}",
$, "success");
}
@Test
public void shouldOverridePartialsDownTheEntireStack() throws IOException {
shouldCompileTo(
"{{#with .}}{{#*inline \"myPartial\"}}success{{/inline}}{{#with .}}{{#with .}}{{> myPartial}}{{/with}}{{/with}}{{/with}}",
$, "success");
}
@Test
public void shouldDefineInlinePartialsForPartialCall() throws IOException {
shouldCompileToWithPartials("{{#*inline \"myPartial\"}}success{{/inline}}{{> dude}}", $,
$("dude", "{{> myPartial}}"), "success");
}
@Test
public void shouldDefineInlinePartialsInPartialBlockCall() throws IOException {
shouldCompileToWithPartials("{{#> dude}}{{#*inline \"myPartial\"}}success{{/inline}}{{/dude}}", $,
$("dude", "{{> myPartial}}"), "success");
}
@Test
public void inlinePartialText() throws IOException {
assertEquals("{{#*inline \"myPartial\"}}success{{/inline}}{{>myPartial}}",
compile("{{#*inline \"myPartial\"}}success{{/inline}}{{> myPartial}}").text());
}
}
| 2,579 | 0.640171 | 0.640171 | 75 | 33.386665 | 37.505871 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52 | false | false |
3
|
9272acf5b41e1497561862ad7fefa8f7e7276af3
| 37,495,064,524,844 |
028d6009f3beceba80316daa84b628496a210f8d
|
/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/IModelListener.java
|
a5bd08cfe1ece1ecac94bce2b28b858592b6ecf3
|
[] |
no_license
|
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
|
https://github.com/JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
|
fa50cafa69d3e317abf0db0f4e3e557150fd88b3
|
4420f338bc4e522c563f8899d81201857236a66a
|
refs/heads/master
| 2020-12-30T16:45:28.474000 | 2010-10-20T16:19:31 | 2010-10-20T16:19:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
package com.nokia.carbide.cpp.epoc.engine.model;
/**
* This listener provides notifications of notable changes to the model.
*
*/
public interface IModelListener {
/**
* Called when underlying source and DOM have changed due to view commits
*/
void modelUpdated(IOwnedModel model, IView view);
/**
* Called when underlying source and DOM have changed with unknown deltas
* (e.g. external text edits, CVS checkout, direct document manipulation, etc)
*/
void modelChanged(IOwnedModel model);
}
|
UTF-8
|
Java
| 1,007 |
java
|
IModelListener.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
package com.nokia.carbide.cpp.epoc.engine.model;
/**
* This listener provides notifications of notable changes to the model.
*
*/
public interface IModelListener {
/**
* Called when underlying source and DOM have changed due to view commits
*/
void modelUpdated(IOwnedModel model, IView view);
/**
* Called when underlying source and DOM have changed with unknown deltas
* (e.g. external text edits, CVS checkout, direct document manipulation, etc)
*/
void modelChanged(IOwnedModel model);
}
| 1,007 | 0.713009 | 0.701092 | 36 | 25.972221 | 28.353411 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
636692ebb1fd1981120f4522b795eb3d823d8e03
| 37,417,755,107,826 |
b2b4a6bab187aaa35f5bfc324f0ef07d37c8914a
|
/stack/L735.java
|
88df06eaf0516b546b04b98b060999841906f1aa
|
[] |
no_license
|
fyiyu091/Leetcode
|
https://github.com/fyiyu091/Leetcode
|
7dd908a39bde4c019bda98038538ddcbfaf2e9c7
|
54c0a823cbf742f4693bb8c7824d9d67221fc5bb
|
refs/heads/master
| 2023-07-19T05:37:41.645000 | 2021-08-31T03:25:25 | 2021-08-31T03:25:25 | 275,048,455 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package stack;
import java.util.ArrayDeque;
import java.util.Deque;
/*
When we encounter to remove the element basic on the coming element
think of stack
1. If peek is + and coming is -, eliminate all the way and if is empty or is negative
*/
public class L735 {
public int[] asteroidCollision(int[] asteroids) {
Deque<Integer> stack = new ArrayDeque<>();
for (int asteroid : asteroids) {
if (asteroid > 0) {
stack.push(asteroid);
}
else {
// When to push, when the peek() is smaller
while (!stack.isEmpty() && stack.peek() > 0) {
// peek is 10, asteroid is -5 -> 5
if (stack.peek() >= -asteroid) {
break;
}
else {
stack.pop();
}
}
if (!stack.isEmpty() && stack.peek() == -asteroid) {
stack.pop();
}
else if (stack.isEmpty() || stack.peek() < 0) {
stack.push(asteroid);
}
}
}
int size = stack.size();
int[] res = new int[size];
for (int i = res.length - 1; i >= 0; i--) {
res[i] = stack.pop();
}
return res;
}
}
|
UTF-8
|
Java
| 1,377 |
java
|
L735.java
|
Java
|
[] | null |
[] |
package stack;
import java.util.ArrayDeque;
import java.util.Deque;
/*
When we encounter to remove the element basic on the coming element
think of stack
1. If peek is + and coming is -, eliminate all the way and if is empty or is negative
*/
public class L735 {
public int[] asteroidCollision(int[] asteroids) {
Deque<Integer> stack = new ArrayDeque<>();
for (int asteroid : asteroids) {
if (asteroid > 0) {
stack.push(asteroid);
}
else {
// When to push, when the peek() is smaller
while (!stack.isEmpty() && stack.peek() > 0) {
// peek is 10, asteroid is -5 -> 5
if (stack.peek() >= -asteroid) {
break;
}
else {
stack.pop();
}
}
if (!stack.isEmpty() && stack.peek() == -asteroid) {
stack.pop();
}
else if (stack.isEmpty() || stack.peek() < 0) {
stack.push(asteroid);
}
}
}
int size = stack.size();
int[] res = new int[size];
for (int i = res.length - 1; i >= 0; i--) {
res[i] = stack.pop();
}
return res;
}
}
| 1,377 | 0.430646 | 0.421206 | 46 | 28.934782 | 21.789907 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
3
|
a19a22994e70e64b4703487dcba29d425597282a
| 37,486,474,583,988 |
1e04d9fca6e7412466409b23669831bab716ff2d
|
/Monaqsat/src/com/monaqsat/beans/ArchiveBean.java
|
8f360e794f9756175f108024361fb9e452a8a111
|
[] |
no_license
|
saurabhomi/Monaqsat_workspace_new
|
https://github.com/saurabhomi/Monaqsat_workspace_new
|
eeefbcef3ca96fb3d0e498e3d8dfb4362bb9bd8a
|
7d2eb0637efa210a87a34f6044d3b5ca31fee74f
|
refs/heads/master
| 2021-05-15T02:04:56.313000 | 2021-04-13T12:53:10 | 2021-04-13T12:53:10 | 250,197,493 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.monaqsat.beans;
public class ArchiveBean {
private String tokenId;
private String passkey;
private int sectorId;
private String sectorNameEn;
private String NewRecords;
private String sectorNameAr;
private String IadsActive;
private int totalRecords;
private String strSectorLogo;
public String getIadsActive() {
return IadsActive;
}
public void setIadsActive(String iadsActive) {
IadsActive = iadsActive;
}
public String getNewRecords() {
return NewRecords;
}
public void setNewRecords(String newRecords) {
NewRecords = newRecords;
}
public String getStrSectorLogo() {
return strSectorLogo;
}
public void setStrSectorLogo(String strSectorLogo) {
this.strSectorLogo = strSectorLogo;
}
public String getTokenId() {
return tokenId;
}
public void setTokenId(String tokenId) {
this.tokenId = tokenId;
}
public String getPasskey() {
return passkey;
}
public void setPasskey(String passkey) {
this.passkey = passkey;
}
public int getSectorId() {
return sectorId;
}
public void setSectorId(int sectorId) {
this.sectorId = sectorId;
}
public String getSectorNameEn() {
return sectorNameEn;
}
public void setSectorNameEn(String sectorNameEn) {
this.sectorNameEn = sectorNameEn;
}
public String getSectorNameAr() {
return sectorNameAr;
}
public void setSectorNameAr(String sectorNameAr) {
this.sectorNameAr = sectorNameAr;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
}
|
UTF-8
|
Java
| 1,812 |
java
|
ArchiveBean.java
|
Java
|
[] | null |
[] |
package com.monaqsat.beans;
public class ArchiveBean {
private String tokenId;
private String passkey;
private int sectorId;
private String sectorNameEn;
private String NewRecords;
private String sectorNameAr;
private String IadsActive;
private int totalRecords;
private String strSectorLogo;
public String getIadsActive() {
return IadsActive;
}
public void setIadsActive(String iadsActive) {
IadsActive = iadsActive;
}
public String getNewRecords() {
return NewRecords;
}
public void setNewRecords(String newRecords) {
NewRecords = newRecords;
}
public String getStrSectorLogo() {
return strSectorLogo;
}
public void setStrSectorLogo(String strSectorLogo) {
this.strSectorLogo = strSectorLogo;
}
public String getTokenId() {
return tokenId;
}
public void setTokenId(String tokenId) {
this.tokenId = tokenId;
}
public String getPasskey() {
return passkey;
}
public void setPasskey(String passkey) {
this.passkey = passkey;
}
public int getSectorId() {
return sectorId;
}
public void setSectorId(int sectorId) {
this.sectorId = sectorId;
}
public String getSectorNameEn() {
return sectorNameEn;
}
public void setSectorNameEn(String sectorNameEn) {
this.sectorNameEn = sectorNameEn;
}
public String getSectorNameAr() {
return sectorNameAr;
}
public void setSectorNameAr(String sectorNameAr) {
this.sectorNameAr = sectorNameAr;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
}
| 1,812 | 0.645144 | 0.645144 | 87 | 19.827587 | 17.508755 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.321839 | false | false |
3
|
ae1f5872879ab3fdb782fb98ff1d5c24f5a6c586
| 37,254,546,360,200 |
ec02ced619c408fb68973cbe89e72fbf09394684
|
/LA-Factory-boot/src/main/java/fr/formation/Controller/ModeleEtapeController.java
|
6035584825cca353f80f4a0ebbc17efde991aba6
|
[] |
no_license
|
DesrochesMichael/LA-Factory
|
https://github.com/DesrochesMichael/LA-Factory
|
90ba0a8e4ace2ff4f01dfd670afc9016768ac504
|
31f87276bd5e644c1ca006a6e622e7939dbdd5c7
|
refs/heads/master
| 2023-01-12T05:11:00.868000 | 2020-02-11T14:05:59 | 2020-02-11T14:05:59 | 238,902,400 | 0 | 0 | null | false | 2023-01-07T14:34:45 | 2020-02-07T11:02:09 | 2020-02-11T14:06:10 | 2023-01-07T14:34:45 | 1,228 | 0 | 0 | 26 |
Java
| false | false |
package fr.formation.Controller;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import fr.formation.dao.IDAOEtape;
import fr.formation.dao.IDAOModele;
import fr.formation.model.Etape;
import fr.formation.model.Modele;
@Controller
public class ModeleEtapeController {
@Autowired
private IDAOModele daoModele;
@Autowired
private IDAOEtape daoEtape;
@GetMapping("/ModeleEtape")
public String get(Model model, @RequestParam int id, HttpSession session) {
model.addAttribute("etapes", daoEtape.findByModeleId(id));
model.addAttribute("modele", daoModele.findById(id).get());
session.setAttribute("modele", daoModele.findById(id).get());
model.addAttribute("etape", new Etape());
return ("ModeleEtape");
}
@PostMapping("/ModeleEtape")
public String save(@ModelAttribute Etape etape, Model model, HttpSession session) {
Modele modele = (Modele) session.getAttribute("modele");
Etape et = daoEtape.findTopByOrderByIdDesc();
etape.setModele(modele);
etape.setId(et.getId() + 1);
daoEtape.save(etape);
model.addAttribute("etape", new Etape());
return "redirect:ModeleEtape?id=" + modele.getId();
}
@GetMapping("/supModeleEtape")
public String sup(@RequestParam int id, HttpSession session, Model model) {
Modele modele = (Modele) session.getAttribute("modele");
model.addAttribute("etapes", daoEtape.findByModeleId(modele.getId()));
model.addAttribute("modele", modele);
daoEtape.deleteById(id);
return "redirect:ModeleEtape?id=" + modele.getId();
}
@GetMapping("/editModeleEtape")
public String edit(@RequestParam int id, HttpSession session, Model model) {
Modele modele = (Modele) session.getAttribute("modele");
model.addAttribute("etape", daoEtape.findById(id).get());
model.addAttribute("etapes", daoEtape.findByModeleId(modele.getId()));
model.addAttribute("modele", modele);
return "ModeleEtape";
}
@PostMapping("/editModeleEtape")
public String editpost(@RequestParam int id,@RequestParam(name = "titre") String titre,@RequestParam(name="description") String descritption,@RequestParam(name="numero") int numero, @RequestParam(name="lien") String lien,HttpSession session, Model model) {
Modele modele = (Modele) session.getAttribute("modele");
Etape et = new Etape();
et.setModele(modele);
et.setDescription(descritption);
et.setTitre(titre);
et.setLien(lien);
et.setNumero(numero);
et.setId(id);
daoEtape.save(et);
model.addAttribute("etapes", daoEtape.findByModeleId(modele.getId()));
model.addAttribute("modele", modele);
model.addAttribute("etape", new Etape());
return "redirect:ModeleEtape?id="+modele.getId();
}
}
|
UTF-8
|
Java
| 3,161 |
java
|
ModeleEtapeController.java
|
Java
|
[] | null |
[] |
package fr.formation.Controller;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import fr.formation.dao.IDAOEtape;
import fr.formation.dao.IDAOModele;
import fr.formation.model.Etape;
import fr.formation.model.Modele;
@Controller
public class ModeleEtapeController {
@Autowired
private IDAOModele daoModele;
@Autowired
private IDAOEtape daoEtape;
@GetMapping("/ModeleEtape")
public String get(Model model, @RequestParam int id, HttpSession session) {
model.addAttribute("etapes", daoEtape.findByModeleId(id));
model.addAttribute("modele", daoModele.findById(id).get());
session.setAttribute("modele", daoModele.findById(id).get());
model.addAttribute("etape", new Etape());
return ("ModeleEtape");
}
@PostMapping("/ModeleEtape")
public String save(@ModelAttribute Etape etape, Model model, HttpSession session) {
Modele modele = (Modele) session.getAttribute("modele");
Etape et = daoEtape.findTopByOrderByIdDesc();
etape.setModele(modele);
etape.setId(et.getId() + 1);
daoEtape.save(etape);
model.addAttribute("etape", new Etape());
return "redirect:ModeleEtape?id=" + modele.getId();
}
@GetMapping("/supModeleEtape")
public String sup(@RequestParam int id, HttpSession session, Model model) {
Modele modele = (Modele) session.getAttribute("modele");
model.addAttribute("etapes", daoEtape.findByModeleId(modele.getId()));
model.addAttribute("modele", modele);
daoEtape.deleteById(id);
return "redirect:ModeleEtape?id=" + modele.getId();
}
@GetMapping("/editModeleEtape")
public String edit(@RequestParam int id, HttpSession session, Model model) {
Modele modele = (Modele) session.getAttribute("modele");
model.addAttribute("etape", daoEtape.findById(id).get());
model.addAttribute("etapes", daoEtape.findByModeleId(modele.getId()));
model.addAttribute("modele", modele);
return "ModeleEtape";
}
@PostMapping("/editModeleEtape")
public String editpost(@RequestParam int id,@RequestParam(name = "titre") String titre,@RequestParam(name="description") String descritption,@RequestParam(name="numero") int numero, @RequestParam(name="lien") String lien,HttpSession session, Model model) {
Modele modele = (Modele) session.getAttribute("modele");
Etape et = new Etape();
et.setModele(modele);
et.setDescription(descritption);
et.setTitre(titre);
et.setLien(lien);
et.setNumero(numero);
et.setId(id);
daoEtape.save(et);
model.addAttribute("etapes", daoEtape.findByModeleId(modele.getId()));
model.addAttribute("modele", modele);
model.addAttribute("etape", new Etape());
return "redirect:ModeleEtape?id="+modele.getId();
}
}
| 3,161 | 0.73869 | 0.738374 | 87 | 34.333332 | 34.053936 | 257 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.954023 | false | false |
3
|
47f1576afa257580016868369bb52cdffd7525f4
| 23,587,960,457,619 |
fb10a05ea3293707d61c8a81ed63259898938508
|
/src/test/java/webApi/automation/rest/search/ShouldNotGetCountryByNonExistingIso3CodeTest.java
|
fda14f970d44e90e7772de5697ef87fd02802a55
|
[] |
no_license
|
dzonioroz/automation
|
https://github.com/dzonioroz/automation
|
0d12bd702e474eb962f45a0ef80e46e85309d772
|
9677b06b0cf850ce12b21198184f83ca5c92d49d
|
refs/heads/master
| 2020-03-21T06:28:51.314000 | 2018-06-21T21:25:35 | 2018-06-21T21:25:35 | 138,223,084 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package webApi.automation.rest.search;
import org.testng.annotations.Test;
import io.restassured.response.Response;
import webApi.automation.rest.BaseRestTest;
public class ShouldNotGetCountryByNonExistingIso3CodeTest extends BaseRestTest {
@Test
public void shouldNotGetCountryByNonExistingIso3Code() {
String nonExistingIso3Code = "QQQ";
String iso3CodePath = BASE_URL + ISO3CODE_URL + nonExistingIso3Code;
Response response = getRequestJson(STATUS_OK,iso3CodePath);
Long time = response.time();
System.out.println("Response time in milliseconds is: " + time);
System.out.println(response.asString());
validateResponseMessageFail(response, nonExistingIso3Code);
}
}
|
UTF-8
|
Java
| 713 |
java
|
ShouldNotGetCountryByNonExistingIso3CodeTest.java
|
Java
|
[] | null |
[] |
package webApi.automation.rest.search;
import org.testng.annotations.Test;
import io.restassured.response.Response;
import webApi.automation.rest.BaseRestTest;
public class ShouldNotGetCountryByNonExistingIso3CodeTest extends BaseRestTest {
@Test
public void shouldNotGetCountryByNonExistingIso3Code() {
String nonExistingIso3Code = "QQQ";
String iso3CodePath = BASE_URL + ISO3CODE_URL + nonExistingIso3Code;
Response response = getRequestJson(STATUS_OK,iso3CodePath);
Long time = response.time();
System.out.println("Response time in milliseconds is: " + time);
System.out.println(response.asString());
validateResponseMessageFail(response, nonExistingIso3Code);
}
}
| 713 | 0.772791 | 0.761571 | 22 | 30.40909 | 27.132099 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.363636 | false | false |
3
|
54965a99780ee055eed615d092954a87e9377e8e
| 37,950,331,052,969 |
8c20b5d69a1118f2eef84b1b9647309d5185d5c1
|
/jeesite-master/src/main/java/com/thinkgem/jeesite/modules/hiddendanger/service/HiddenDangerService.java
|
9d38d44ba1f731b8e166e1a86779cdcc61a5718f
|
[
"Apache-2.0"
] |
permissive
|
pengdingyong/danger
|
https://github.com/pengdingyong/danger
|
9e9e92ceacdd3eea053c0e179e6f5bd562a0de1c
|
05aab123fcaa36d606ae47dcfe1be5b6cfdf6ccb
|
refs/heads/master
| 2020-03-26T15:59:07.664000 | 2018-08-17T04:08:17 | 2018-08-17T04:08:17 | 145,075,648 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.hiddendanger.service;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.hiddendanger.entity.HiddenDanger;
import com.thinkgem.jeesite.modules.hiddendanger.dao.HiddenDangerDao;
/**
* 隐患管理Service
* @author Bill
* @version 2018-06-10
*/
@Service
@Transactional(readOnly = true)
public class HiddenDangerService extends CrudService<HiddenDangerDao, HiddenDanger> {
@Autowired
private HiddenDangerDao hiddenDangerDao;
public HiddenDanger get(String id) {
return super.get(id);
}
public List<HiddenDanger> findList(HiddenDanger hiddenDanger) {
return super.findList(hiddenDanger);
}
public List<HiddenDanger> findChildList() {
return hiddenDangerDao.findChildList();
}
public Page<HiddenDanger> findPage(Page<HiddenDanger> page, HiddenDanger hiddenDanger) {
page.setPageSize(5);
return super.findPage(page, hiddenDanger);
}
@Transactional(readOnly = false)
public void save(HiddenDanger hiddenDanger) {
if (StringUtils.isBlank(hiddenDanger.getParentId())){
hiddenDanger.setParentId("0");
}
super.save(hiddenDanger);
}
@Transactional(readOnly = false)
public void delete(HiddenDanger hiddenDanger) {
super.delete(hiddenDanger);
}
}
|
UTF-8
|
Java
| 1,684 |
java
|
HiddenDangerService.java
|
Java
|
[
{
"context": "ight © 2012-2016 <a href=\"https://github.com/thinkgem/jeesite\">JeeSite</a> All rights reserved.\n */\npac",
"end": 70,
"score": 0.9985756874084473,
"start": 62,
"tag": "USERNAME",
"value": "thinkgem"
},
{
"context": "ao.HiddenDangerDao;\n\n/**\n * 隐患管理Service\n * @author Bill\n * @version 2018-06-10\n */\n@Service\n@Transactiona",
"end": 706,
"score": 0.9994732737541199,
"start": 702,
"tag": "NAME",
"value": "Bill"
}
] | null |
[] |
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.hiddendanger.service;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.hiddendanger.entity.HiddenDanger;
import com.thinkgem.jeesite.modules.hiddendanger.dao.HiddenDangerDao;
/**
* 隐患管理Service
* @author Bill
* @version 2018-06-10
*/
@Service
@Transactional(readOnly = true)
public class HiddenDangerService extends CrudService<HiddenDangerDao, HiddenDanger> {
@Autowired
private HiddenDangerDao hiddenDangerDao;
public HiddenDanger get(String id) {
return super.get(id);
}
public List<HiddenDanger> findList(HiddenDanger hiddenDanger) {
return super.findList(hiddenDanger);
}
public List<HiddenDanger> findChildList() {
return hiddenDangerDao.findChildList();
}
public Page<HiddenDanger> findPage(Page<HiddenDanger> page, HiddenDanger hiddenDanger) {
page.setPageSize(5);
return super.findPage(page, hiddenDanger);
}
@Transactional(readOnly = false)
public void save(HiddenDanger hiddenDanger) {
if (StringUtils.isBlank(hiddenDanger.getParentId())){
hiddenDanger.setParentId("0");
}
super.save(hiddenDanger);
}
@Transactional(readOnly = false)
public void delete(HiddenDanger hiddenDanger) {
super.delete(hiddenDanger);
}
}
| 1,684 | 0.781623 | 0.770286 | 60 | 26.950001 | 27.045902 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.116667 | false | false |
3
|
0c75b5ffd760dde20d9d4cb4a98241c569195853
| 18,751,827,220,870 |
5062ee782f41ab21500ca675c9f7d81c948e9724
|
/src/test/java/za/ac/cput/elective/repository/impl/RoomRepositoryImplTest.java
|
63cd0501a516a57dc6bcb07a78f8cbd97e4a3a5d
|
[] |
no_license
|
Dogfoger/UniversityElectiveManagementSystem
|
https://github.com/Dogfoger/UniversityElectiveManagementSystem
|
8c3ca1e0035d773ccbf6e8f3c028caf1158fc1e4
|
4f99e8ffee7fcb69ee44764ab44ca02f067bf540
|
refs/heads/master
| 2023-01-08T08:59:39.555000 | 2020-11-09T07:39:25 | 2020-11-09T07:39:25 | 276,887,191 | 2 | 0 | null | true | 2020-11-09T07:39:26 | 2020-07-03T11:47:34 | 2020-11-09T07:37:46 | 2020-11-09T07:39:25 | 387 | 1 | 0 | 0 |
Java
| false | false |
//package za.ac.cput.elective.repository.impl;
//
///**
// * @author Sinethemba Poni
// * Desc: Test for the RoomRepository
// * Date: 2020/08/27
// **/
//import org.junit.Assert;
//import org.junit.FixMethodOrder;
//import org.junit.Test;
//import org.junit.runners.MethodSorters;
//import za.ac.cput.elective.entity.Room;
//import za.ac.cput.elective.factory.RoomFactory;
//import za.ac.cput.elective.repository.RoomRepository;
//
//@FixMethodOrder(MethodSorters.NAME_ASCENDING)
//
//public class RoomRepositoryImplTest {
// private static RoomRepository roomRepository = RoomRepositoryImpl.getRoomRepository();
// private static Room room = RoomFactory.createRoom("Room One", 29);
//
// @Test
// public void getRoomRepository() {
// }
//
// @Test
// public void a_create() {
// Room created = roomRepository.create(room);
// Assert.assertEquals(room.getRoomNum(), created.getRoomNum());
// System.out.println("Succesfully created: " +created);
// }
//
// @Test
// public void b_read() {
// Room read = roomRepository.read(room.getRoomNum());
// System.out.println("Read.." +read);
//
// }
//
// @Test
// public void c_update() {
// Room updated = new Room.Builder().copy(room).setRoomNum("Room Two").build();
// updated = roomRepository.update(updated);
// System.out.println("Succesfully updated:" +updated);
// }
//
// @Test
// public void e_delete() {
// boolean deleted = roomRepository.delete(room.getRoomNum());
// Assert.assertTrue(deleted);
// System.out.println("Succesfully deleted:"+ deleted);
//
//
// }
//
// @Test
// public void d_getAll() {
// System.out.println("Get all:" +roomRepository.getAll());
// }
//}
|
UTF-8
|
Java
| 1,771 |
java
|
RoomRepositoryImplTest.java
|
Java
|
[
{
"context": "ut.elective.repository.impl;\n//\n///**\n// * @author Sinethemba Poni\n// * Desc: Test for the RoomRepository\n// * Date:",
"end": 84,
"score": 0.9998818635940552,
"start": 69,
"tag": "NAME",
"value": "Sinethemba Poni"
}
] | null |
[] |
//package za.ac.cput.elective.repository.impl;
//
///**
// * @author <NAME>
// * Desc: Test for the RoomRepository
// * Date: 2020/08/27
// **/
//import org.junit.Assert;
//import org.junit.FixMethodOrder;
//import org.junit.Test;
//import org.junit.runners.MethodSorters;
//import za.ac.cput.elective.entity.Room;
//import za.ac.cput.elective.factory.RoomFactory;
//import za.ac.cput.elective.repository.RoomRepository;
//
//@FixMethodOrder(MethodSorters.NAME_ASCENDING)
//
//public class RoomRepositoryImplTest {
// private static RoomRepository roomRepository = RoomRepositoryImpl.getRoomRepository();
// private static Room room = RoomFactory.createRoom("Room One", 29);
//
// @Test
// public void getRoomRepository() {
// }
//
// @Test
// public void a_create() {
// Room created = roomRepository.create(room);
// Assert.assertEquals(room.getRoomNum(), created.getRoomNum());
// System.out.println("Succesfully created: " +created);
// }
//
// @Test
// public void b_read() {
// Room read = roomRepository.read(room.getRoomNum());
// System.out.println("Read.." +read);
//
// }
//
// @Test
// public void c_update() {
// Room updated = new Room.Builder().copy(room).setRoomNum("Room Two").build();
// updated = roomRepository.update(updated);
// System.out.println("Succesfully updated:" +updated);
// }
//
// @Test
// public void e_delete() {
// boolean deleted = roomRepository.delete(room.getRoomNum());
// Assert.assertTrue(deleted);
// System.out.println("Succesfully deleted:"+ deleted);
//
//
// }
//
// @Test
// public void d_getAll() {
// System.out.println("Get all:" +roomRepository.getAll());
// }
//}
| 1,762 | 0.63354 | 0.627894 | 60 | 28.533333 | 24.929544 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
3
|
14e9a9fb4fcb0f85d112019b11b2fa94da754440
| 30,167,850,287,572 |
67996de487e275abf66eabfa77f4976d24d2cb97
|
/comment/src/main/java/com/daleyzou/comment/MainActivity.java
|
b7b69c4c8c8232b2b26d1d11b4355d17ae6323f1
|
[] |
no_license
|
otaserver/couponyes
|
https://github.com/otaserver/couponyes
|
98b49199cf6701f252871f37cc542a77eea54bec
|
8e0724938cc4688b9c6e15e009397bf3fb5a32c8
|
refs/heads/master
| 2021-07-24T20:03:57.636000 | 2021-07-15T08:01:15 | 2021-07-15T08:02:05 | 218,231,623 | 1 | 0 | null | true | 2020-07-28T06:39:54 | 2019-10-29T07:48:45 | 2020-07-28T06:30:10 | 2020-07-28T06:39:53 | 12,160 | 0 | 0 | 0 |
Java
| false | false |
package com.daleyzou.comment;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.backends.pipeline.Fresco;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
//Fresco是Facebook开源Android平台上一个强大的图片加载库,也是迄今为止Android平台上最强大的图片加载库。
public class MainActivity extends AppCompatActivity {
@BindView(R.id.am_lv_comments)
ListView mAmLvComments;
@BindView(R.id.am_tv_zan)
TextView mAmTvZan;
@BindView(R.id.am_tv_comment)
TextView mAmTvComment;
@BindView(R.id.am_srl_reflush)
SwipeRefreshLayout mAmSrlReflush;
//添加listview头
View mView;
//列表数据
List<Comment> mCommentList;
//adapter
BaseAdapter mBaseAdapter;
@BindView(R.id.am_et_msg)
EditText mAmEtMsg;
@BindView(R.id.am_b_save)
Button mAmBSave;
@BindView(R.id.am_ll_liuyan)
LinearLayout mAmLlLiuyan;
@BindView(R.id.am_ll_info)
LinearLayout mAmLlInfo;
//回复的内容
String info = "";
//标记位,是评论还是回复。默true认评论
boolean isComment = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//以下是Fresco相关配置
Fresco.initialize(this);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
initView();
initData();
initAdapter();
initListener();
}
private void initView() {
mView = LayoutInflater.from(this).inflate(R.layout.head_topic, null);
}
private void initData() {
mCommentList = new ArrayList<>();
Comment comment = null;
for (int i = 0; i < 15; i++) {
if (i % 2 == 0) {
comment = new Comment(i + "", "张三" + i, "http://d.hiphotos.baidu.com/image/h%3D360/sign=856d60650933874483c5297a610fd937/55e736d12f2eb938e81944c7d0628535e5dd6f8a.jpg", 1, "郑州航空工业管理学院", "今天真开心,敲了一天代码。", "2015-03-04 23:02:06", null);
}
if (i % 2 == 1) {
comment = new Comment(i + "", "张三" + i, "http://g.hiphotos.baidu.com/image/h%3D360/sign=c7fd97e3bc0e7bec3cda05e71f2cb9fa/960a304e251f95ca2f34115acd177f3e6609521d.jpg", 1, "郑州航空工业管理学院", "今天真开心,敲了一天代码。", "2015-03-04 23:02:06", "王二狗" + i);
}
mCommentList.add(comment);
}
}
private void initAdapter() {
mBaseAdapter = new MyDetailSoicalAdapter(this, mCommentList);
mAmLvComments.addHeaderView(mView);//添加头
mAmLvComments.setAdapter(mBaseAdapter);
}
private void initListener() {
mAmLvComments.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int post = position - 1;//除去头
Toast.makeText(MainActivity.this, "点击了第" + post + "个", Toast.LENGTH_SHORT).show();
isComment = false;//
comment(true);//调出评论框
mAmEtMsg.setText("");//清空
mAmEtMsg.setHint("回复" + mCommentList.get(post).getNickName());
}
});
}
@OnClick({R.id.am_tv_zan, R.id.am_tv_comment, R.id.am_et_msg, R.id.am_b_save, R.id.am_ll_liuyan})
public void onClick(View view) {
switch (view.getId()) {
case R.id.am_tv_zan:
break;
case R.id.am_tv_comment:
//点击评论按钮
comment(true);
break;
case R.id.am_et_msg:
break;
case R.id.am_b_save:
saveComment();
break;
case R.id.am_ll_liuyan:
break;
}
}
private void saveComment() {
if (!TextUtils.isEmpty(mAmEtMsg.getText())) {
info = mAmEtMsg.getText().toString();
updateComment();
} else {
Toast.makeText(MainActivity.this, "请输入内容后在留言", Toast.LENGTH_SHORT).show();
}
}
//这边应该上传用户留言,然后刷新界面
private void updateComment() {
Comment comment = null;
comment = new Comment(666 + "", "张三" + 666, "http://d.hiphotos.baidu.com/image/h%3D360/sign=856d60650933874483c5297a610fd937/55e736d12f2eb938e81944c7d0628535e5dd6f8a.jpg", 1, "郑州航空工业管理学院", info, "2015-03-04 23:02:06", null);
mCommentList.add(0, comment);
mBaseAdapter.notifyDataSetChanged();
//还原
comment(false);
}
private void comment(boolean flag) {
if (flag) {
mAmLlInfo.setVisibility(View.GONE);
mAmLlLiuyan.setVisibility(View.VISIBLE);
onFocusChange(flag);
} else {
mAmLlInfo.setVisibility(View.VISIBLE);
mAmLlLiuyan.setVisibility(View.GONE);
onFocusChange(flag);
}
}
/**
* 显示或隐藏输入法
*/
private void onFocusChange(boolean hasFocus) {
final boolean isFocus = hasFocus;
(new Handler()).postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager)
MainActivity.this.getSystemService(INPUT_METHOD_SERVICE);
if (isFocus) {
//显示输入法
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
mAmEtMsg.setFocusable(true);
mAmEtMsg.requestFocus();
} else {
//隐藏输入法
imm.hideSoftInputFromWindow(mAmEtMsg.getWindowToken(), 0);
}
}
}, 100);
}
}
|
UTF-8
|
Java
| 6,560 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.daleyzou.comment;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.backends.pipeline.Fresco;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
//Fresco是Facebook开源Android平台上一个强大的图片加载库,也是迄今为止Android平台上最强大的图片加载库。
public class MainActivity extends AppCompatActivity {
@BindView(R.id.am_lv_comments)
ListView mAmLvComments;
@BindView(R.id.am_tv_zan)
TextView mAmTvZan;
@BindView(R.id.am_tv_comment)
TextView mAmTvComment;
@BindView(R.id.am_srl_reflush)
SwipeRefreshLayout mAmSrlReflush;
//添加listview头
View mView;
//列表数据
List<Comment> mCommentList;
//adapter
BaseAdapter mBaseAdapter;
@BindView(R.id.am_et_msg)
EditText mAmEtMsg;
@BindView(R.id.am_b_save)
Button mAmBSave;
@BindView(R.id.am_ll_liuyan)
LinearLayout mAmLlLiuyan;
@BindView(R.id.am_ll_info)
LinearLayout mAmLlInfo;
//回复的内容
String info = "";
//标记位,是评论还是回复。默true认评论
boolean isComment = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//以下是Fresco相关配置
Fresco.initialize(this);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
initView();
initData();
initAdapter();
initListener();
}
private void initView() {
mView = LayoutInflater.from(this).inflate(R.layout.head_topic, null);
}
private void initData() {
mCommentList = new ArrayList<>();
Comment comment = null;
for (int i = 0; i < 15; i++) {
if (i % 2 == 0) {
comment = new Comment(i + "", "张三" + i, "http://d.hiphotos.baidu.com/image/h%3D360/sign=856d60650933874483c5297a610fd937/55e736d12f2eb938e81944c7d0628535e5dd6f8a.jpg", 1, "郑州航空工业管理学院", "今天真开心,敲了一天代码。", "2015-03-04 23:02:06", null);
}
if (i % 2 == 1) {
comment = new Comment(i + "", "张三" + i, "http://g.hiphotos.baidu.com/image/h%3D360/sign=c7fd97e3bc0e7bec3cda05e71f2cb9fa/960a304e251f95ca2f34115acd177f3e6609521d.jpg", 1, "郑州航空工业管理学院", "今天真开心,敲了一天代码。", "2015-03-04 23:02:06", "王二狗" + i);
}
mCommentList.add(comment);
}
}
private void initAdapter() {
mBaseAdapter = new MyDetailSoicalAdapter(this, mCommentList);
mAmLvComments.addHeaderView(mView);//添加头
mAmLvComments.setAdapter(mBaseAdapter);
}
private void initListener() {
mAmLvComments.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int post = position - 1;//除去头
Toast.makeText(MainActivity.this, "点击了第" + post + "个", Toast.LENGTH_SHORT).show();
isComment = false;//
comment(true);//调出评论框
mAmEtMsg.setText("");//清空
mAmEtMsg.setHint("回复" + mCommentList.get(post).getNickName());
}
});
}
@OnClick({R.id.am_tv_zan, R.id.am_tv_comment, R.id.am_et_msg, R.id.am_b_save, R.id.am_ll_liuyan})
public void onClick(View view) {
switch (view.getId()) {
case R.id.am_tv_zan:
break;
case R.id.am_tv_comment:
//点击评论按钮
comment(true);
break;
case R.id.am_et_msg:
break;
case R.id.am_b_save:
saveComment();
break;
case R.id.am_ll_liuyan:
break;
}
}
private void saveComment() {
if (!TextUtils.isEmpty(mAmEtMsg.getText())) {
info = mAmEtMsg.getText().toString();
updateComment();
} else {
Toast.makeText(MainActivity.this, "请输入内容后在留言", Toast.LENGTH_SHORT).show();
}
}
//这边应该上传用户留言,然后刷新界面
private void updateComment() {
Comment comment = null;
comment = new Comment(666 + "", "张三" + 666, "http://d.hiphotos.baidu.com/image/h%3D360/sign=856d60650933874483c5297a610fd937/55e736d12f2eb938e81944c7d0628535e5dd6f8a.jpg", 1, "郑州航空工业管理学院", info, "2015-03-04 23:02:06", null);
mCommentList.add(0, comment);
mBaseAdapter.notifyDataSetChanged();
//还原
comment(false);
}
private void comment(boolean flag) {
if (flag) {
mAmLlInfo.setVisibility(View.GONE);
mAmLlLiuyan.setVisibility(View.VISIBLE);
onFocusChange(flag);
} else {
mAmLlInfo.setVisibility(View.VISIBLE);
mAmLlLiuyan.setVisibility(View.GONE);
onFocusChange(flag);
}
}
/**
* 显示或隐藏输入法
*/
private void onFocusChange(boolean hasFocus) {
final boolean isFocus = hasFocus;
(new Handler()).postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager)
MainActivity.this.getSystemService(INPUT_METHOD_SERVICE);
if (isFocus) {
//显示输入法
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
mAmEtMsg.setFocusable(true);
mAmEtMsg.requestFocus();
} else {
//隐藏输入法
imm.hideSoftInputFromWindow(mAmEtMsg.getWindowToken(), 0);
}
}
}, 100);
}
}
| 6,560 | 0.605306 | 0.568522 | 190 | 31.336842 | 34.015667 | 252 | false | false | 0 | 0 | 0 | 0 | 84 | 0.041016 | 0.673684 | false | false |
3
|
290960d6d2a07d75e880939ee3274e4fc679f1d2
| 24,704,651,888,251 |
dc60a3523c3d3c127fdad4f9c6ceee39c2a3312e
|
/common/src/main/java/github/bonapartedawn/common/bean/MyX500Name.java
|
34dcfa09e84b4fd3156646eb955452f0e27bb5e2
|
[] |
no_license
|
BonaparteDawn/bonapartedawn
|
https://github.com/BonaparteDawn/bonapartedawn
|
a86422ea9c35a30f574ef883e544e52fd1a0d23d
|
9d3c42cc08624eb6458ad4d5d89433b33b817e04
|
refs/heads/master
| 2021-01-19T13:18:21.367000 | 2017-04-04T13:28:19 | 2017-04-04T13:28:19 | 82,381,100 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package github.bonapartedawn.common.bean;
public class MyX500Name{
/**
* 一般名字
*/
private String commonName = "az";
/**
* 地方名
*/
private String localityName = "";
/**
* 州省名
*/
private String stateOrProvinceName = "四川省";
/**
* 组织名
*/
private String organizationName;
/**
* 组织单位名
*/
private String organizationalUnitName;
/**
* 国家
*/
private String countryName ="中国";
/**
* 街道地址
*/
private String streetAddress;
/**
* 领域
*/
private String domainComponent;
/**
* 用户ID
*/
private String userID;
private String name;
public MyX500Name(String arg0){
name = arg0;
}
public String getCommonName() {
return commonName;
}
public void setCommonName(String commonName) {
this.commonName = commonName;
}
public String getLocalityName() {
return localityName;
}
public void setLocalityName(String localityName) {
this.localityName = localityName;
}
public String getStateOrProvinceName() {
return stateOrProvinceName;
}
public void setStateOrProvinceName(String stateOrProvinceName) {
this.stateOrProvinceName = stateOrProvinceName;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
public String getOrganizationalUnitName() {
return organizationalUnitName;
}
public void setOrganizationalUnitName(String organizationalUnitName) {
this.organizationalUnitName = organizationalUnitName;
}
public String getCountryName() {
return countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
public String getStreetAddress() {
return streetAddress;
}
public void setStreetAddress(String streetAddress) {
this.streetAddress = streetAddress;
}
public String getDomainComponent() {
return domainComponent;
}
public void setDomainComponent(String domainComponent) {
this.domainComponent = domainComponent;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getName() {
String res = name;
if (name == null || "".equals(name)) {
res =
"CN="+getCommonName()+","+
"L="+getLocalityName()+","+
"ST="+getStateOrProvinceName()+","+
"O="+getOrganizationName()+","+
"OU="+getOrganizationalUnitName()+","+
"C="+getCountryName()+","+
"STREET="+getStreetAddress()+","+
"DC="+getDomainComponent()+","+
"UID="+getUserID();
}
return res;
}
@Override
public String toString() {
return getName();
}
}
|
UTF-8
|
Java
| 3,246 |
java
|
MyX500Name.java
|
Java
|
[
{
"context": "package github.bonapartedawn.common.bean;\n\npublic class MyX500Name{\n /**\n ",
"end": 28,
"score": 0.8637818098068237,
"start": 15,
"tag": "USERNAME",
"value": "bonapartedawn"
}
] | null |
[] |
package github.bonapartedawn.common.bean;
public class MyX500Name{
/**
* 一般名字
*/
private String commonName = "az";
/**
* 地方名
*/
private String localityName = "";
/**
* 州省名
*/
private String stateOrProvinceName = "四川省";
/**
* 组织名
*/
private String organizationName;
/**
* 组织单位名
*/
private String organizationalUnitName;
/**
* 国家
*/
private String countryName ="中国";
/**
* 街道地址
*/
private String streetAddress;
/**
* 领域
*/
private String domainComponent;
/**
* 用户ID
*/
private String userID;
private String name;
public MyX500Name(String arg0){
name = arg0;
}
public String getCommonName() {
return commonName;
}
public void setCommonName(String commonName) {
this.commonName = commonName;
}
public String getLocalityName() {
return localityName;
}
public void setLocalityName(String localityName) {
this.localityName = localityName;
}
public String getStateOrProvinceName() {
return stateOrProvinceName;
}
public void setStateOrProvinceName(String stateOrProvinceName) {
this.stateOrProvinceName = stateOrProvinceName;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
public String getOrganizationalUnitName() {
return organizationalUnitName;
}
public void setOrganizationalUnitName(String organizationalUnitName) {
this.organizationalUnitName = organizationalUnitName;
}
public String getCountryName() {
return countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
public String getStreetAddress() {
return streetAddress;
}
public void setStreetAddress(String streetAddress) {
this.streetAddress = streetAddress;
}
public String getDomainComponent() {
return domainComponent;
}
public void setDomainComponent(String domainComponent) {
this.domainComponent = domainComponent;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getName() {
String res = name;
if (name == null || "".equals(name)) {
res =
"CN="+getCommonName()+","+
"L="+getLocalityName()+","+
"ST="+getStateOrProvinceName()+","+
"O="+getOrganizationName()+","+
"OU="+getOrganizationalUnitName()+","+
"C="+getCountryName()+","+
"STREET="+getStreetAddress()+","+
"DC="+getDomainComponent()+","+
"UID="+getUserID();
}
return res;
}
@Override
public String toString() {
return getName();
}
}
| 3,246 | 0.566667 | 0.564151 | 120 | 25.508333 | 19.916491 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.366667 | false | false |
3
|
ca9623213abf4c8dc93e754de97fabc1cf76757b
| 33,139,967,725,497 |
e5f89fa9143ad6f6cde094c5db181824f4d8f8a0
|
/app/src/main/java/com/example/spinnerlanguages/MainActivity.java
|
28664503041e9bf3b176e13c1af7efc9003ce681
|
[] |
no_license
|
Dimkuss/languages
|
https://github.com/Dimkuss/languages
|
5b5273236604a6694e66552c07fc2b64a29281ff
|
f78b371c49919f81b58d993ee9f9d73515b9d1f2
|
refs/heads/main
| 2023-03-03T13:38:56.297000 | 2021-01-30T13:11:25 | 2021-01-30T13:11:25 | 332,733,843 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.spinnerlanguages;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TextView;
import java.util.Arrays;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
private Spinner mLangSpinner;
private Spinner mColorSpinner;
private Spinner mMarginSpinner;
private Button mOkBtn;
private static @StyleRes int AppThemeDefault = R.style.Theme_SpinnerLanguages;
private static @StyleRes int AppThemeMargin = R.style.Margin3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(AppThemeDefault);
setTheme(AppThemeMargin);
setContentView(R.layout.activity_main);
initViews();
}
private void initViews() {
mLangSpinner = findViewById(R.id.languagesSpinner);
mColorSpinner = findViewById(R.id.colorspinner);
mMarginSpinner = findViewById(R.id.marginspinner);
mOkBtn = findViewById(R.id.okBtn);
initSpinnerLang();
// initSpinnerColor();
}
private void initSpinnerLang(){
ArrayAdapter<CharSequence> adapterLang = ArrayAdapter.createFromResource(this, R.array.language, android.R.layout.simple_spinner_item);
adapterLang.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mLangSpinner.setAdapter(adapterLang);
ArrayAdapter<CharSequence> adapterColor = ArrayAdapter.createFromResource(this, R.array.color, android.R.layout.simple_spinner_item);
adapterColor.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mColorSpinner.setAdapter(adapterColor);
ArrayAdapter<CharSequence> adapterMargin = ArrayAdapter.createFromResource(this, R.array.margin, android.R.layout.simple_spinner_item);
adapterMargin.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mMarginSpinner.setAdapter(adapterMargin);
mOkBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mLangSpinner.getSelectedItem().toString().equals("Русский")) {
Locale locale = new Locale("ru");
Configuration config = new Configuration();
config.setLocale(locale);
getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
} if (mLangSpinner.getSelectedItem().toString().equals("English")) {
Locale locale = new Locale("en");
Configuration config = new Configuration();
config.setLocale(locale);
getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}
if (mColorSpinner.getSelectedItem().toString().equals("Зеленый")){
AppThemeDefault = R.style.AppThemeGreen;
}
if (mColorSpinner.getSelectedItem().toString().equals("Черный")){
AppThemeDefault = R.style.AppThemeBlack;
}
if (mColorSpinner.getSelectedItem().toString().equals("Синий")){
AppThemeDefault = R.style.AppThemeBlue;
}
if (mMarginSpinner.getSelectedItem().toString().equals("Большие")){
AppThemeMargin = R.style.Margin1;}
if (mMarginSpinner.getSelectedItem().toString().equals("Средние")){
AppThemeMargin = R.style.Margin2;}
if (mMarginSpinner.getSelectedItem().toString().equals("Мелкие")){
AppThemeMargin = R.style.Margin3;}
recreate();
}
});
}
}
|
UTF-8
|
Java
| 4,122 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.spinnerlanguages;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TextView;
import java.util.Arrays;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
private Spinner mLangSpinner;
private Spinner mColorSpinner;
private Spinner mMarginSpinner;
private Button mOkBtn;
private static @StyleRes int AppThemeDefault = R.style.Theme_SpinnerLanguages;
private static @StyleRes int AppThemeMargin = R.style.Margin3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(AppThemeDefault);
setTheme(AppThemeMargin);
setContentView(R.layout.activity_main);
initViews();
}
private void initViews() {
mLangSpinner = findViewById(R.id.languagesSpinner);
mColorSpinner = findViewById(R.id.colorspinner);
mMarginSpinner = findViewById(R.id.marginspinner);
mOkBtn = findViewById(R.id.okBtn);
initSpinnerLang();
// initSpinnerColor();
}
private void initSpinnerLang(){
ArrayAdapter<CharSequence> adapterLang = ArrayAdapter.createFromResource(this, R.array.language, android.R.layout.simple_spinner_item);
adapterLang.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mLangSpinner.setAdapter(adapterLang);
ArrayAdapter<CharSequence> adapterColor = ArrayAdapter.createFromResource(this, R.array.color, android.R.layout.simple_spinner_item);
adapterColor.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mColorSpinner.setAdapter(adapterColor);
ArrayAdapter<CharSequence> adapterMargin = ArrayAdapter.createFromResource(this, R.array.margin, android.R.layout.simple_spinner_item);
adapterMargin.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mMarginSpinner.setAdapter(adapterMargin);
mOkBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mLangSpinner.getSelectedItem().toString().equals("Русский")) {
Locale locale = new Locale("ru");
Configuration config = new Configuration();
config.setLocale(locale);
getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
} if (mLangSpinner.getSelectedItem().toString().equals("English")) {
Locale locale = new Locale("en");
Configuration config = new Configuration();
config.setLocale(locale);
getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}
if (mColorSpinner.getSelectedItem().toString().equals("Зеленый")){
AppThemeDefault = R.style.AppThemeGreen;
}
if (mColorSpinner.getSelectedItem().toString().equals("Черный")){
AppThemeDefault = R.style.AppThemeBlack;
}
if (mColorSpinner.getSelectedItem().toString().equals("Синий")){
AppThemeDefault = R.style.AppThemeBlue;
}
if (mMarginSpinner.getSelectedItem().toString().equals("Большие")){
AppThemeMargin = R.style.Margin1;}
if (mMarginSpinner.getSelectedItem().toString().equals("Средние")){
AppThemeMargin = R.style.Margin2;}
if (mMarginSpinner.getSelectedItem().toString().equals("Мелкие")){
AppThemeMargin = R.style.Margin3;}
recreate();
}
});
}
}
| 4,122 | 0.664459 | 0.663478 | 102 | 38.970589 | 33.942413 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.627451 | false | false |
3
|
e0f73d9c316dc4f8a414fb66fb6192d94ad42ad5
| 33,466,385,185,261 |
5eeef357dda16437f988ee271034425788c9f7d1
|
/src/main/java/baek_jun/No_3055.java
|
e21a68cb874ae755cc65b4aae6cbe26b82ffbbba
|
[] |
no_license
|
kimdia200/baekjoon_Algorithm
|
https://github.com/kimdia200/baekjoon_Algorithm
|
dad1a315ffca65541017c4f79bc9d19c6e7e7ad7
|
7e4daf549c8612d8ea398040597465a1a722fe4f
|
refs/heads/master
| 2023-04-26T14:43:48.995000 | 2023-04-20T06:02:18 | 2023-04-20T06:02:18 | 194,688,304 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package baek_jun;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class No_3055 {
//상 하 좌 우
static int[] moveI = {-1, 1, 0, 0};
static int[] moveJ = {0, 0, -1, 1};
public static void main(String[] args) {
String answer = "KAKTUS";
Scanner sc = new Scanner(System.in);
int r = sc.nextInt();
int c = sc.nextInt();
Queue<int[]> dochi = new LinkedList<>();
Queue<int[]> water = new LinkedList<>();
String[][] map = new String[r][c];
for(int i=0; i<r; i++){
String[] temp = sc.next().split("");
for(int j=0; j<c; j++){
map[i][j] = temp[j];
if(temp[j].equals("S")) dochi.add(new int[]{i,j});
else if (temp[j].equals("*")) water.add(new int[]{i,j});
}
}
//비어있는곳 .
//물이차는곳 *
//돌 x
//비버굴 D
//고슴도치 S
int[][] cnt = new int[r][c];
cnt[dochi.peek()[0]][dochi.peek()[1]] = 1;
outter:
while(!water.isEmpty()){
//물먼저 계산
int waterLoop = water.size();
for(int i=0; i<waterLoop; i++){
int[] nowWater = water.poll();
for(int j=0; j<4; j++){
int nextI = nowWater[0]+moveI[j];
int nextJ = nowWater[1]+moveJ[j];
if(nextI>=0 && nextJ>=0 && nextI<r && nextJ <c && !map[nextI][nextJ].equals("D") && !map[nextI][nextJ].equalsIgnoreCase("X") && !map[nextI][nextJ].equals("*")){
map[nextI][nextJ]="*";
water.add(new int[]{nextI,nextJ});
}
}
}
//고슴도치 계산
int dochiLoop = dochi.size();
for(int i=0; i<dochiLoop; i++){
int[] nowDochi = dochi.poll();
int nowCount = cnt[nowDochi[0]][nowDochi[1]];
for(int j=0; j<4; j++){
int nextI = nowDochi[0]+moveI[j];
int nextJ = nowDochi[1]+moveJ[j];
if(nextI>=0 && nextJ >=0 && nextI<r && nextJ<c && !map[nextI][nextJ].equals("*") && !map[nextI][nextJ].equalsIgnoreCase("X")){
if(cnt[nextI][nextJ]!=0) continue;
if(map[nextI][nextJ].equals("D")){
answer = String.valueOf(nowCount);
break outter;
}
cnt[nextI][nextJ] = nowCount+1;
dochi.add(new int[]{nextI,nextJ});
map[nextI][nextJ] = "S";
}
}
}
}
System.out.println(answer);
}
}
|
UHC
|
Java
| 2,824 |
java
|
No_3055.java
|
Java
|
[] | null |
[] |
package baek_jun;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class No_3055 {
//상 하 좌 우
static int[] moveI = {-1, 1, 0, 0};
static int[] moveJ = {0, 0, -1, 1};
public static void main(String[] args) {
String answer = "KAKTUS";
Scanner sc = new Scanner(System.in);
int r = sc.nextInt();
int c = sc.nextInt();
Queue<int[]> dochi = new LinkedList<>();
Queue<int[]> water = new LinkedList<>();
String[][] map = new String[r][c];
for(int i=0; i<r; i++){
String[] temp = sc.next().split("");
for(int j=0; j<c; j++){
map[i][j] = temp[j];
if(temp[j].equals("S")) dochi.add(new int[]{i,j});
else if (temp[j].equals("*")) water.add(new int[]{i,j});
}
}
//비어있는곳 .
//물이차는곳 *
//돌 x
//비버굴 D
//고슴도치 S
int[][] cnt = new int[r][c];
cnt[dochi.peek()[0]][dochi.peek()[1]] = 1;
outter:
while(!water.isEmpty()){
//물먼저 계산
int waterLoop = water.size();
for(int i=0; i<waterLoop; i++){
int[] nowWater = water.poll();
for(int j=0; j<4; j++){
int nextI = nowWater[0]+moveI[j];
int nextJ = nowWater[1]+moveJ[j];
if(nextI>=0 && nextJ>=0 && nextI<r && nextJ <c && !map[nextI][nextJ].equals("D") && !map[nextI][nextJ].equalsIgnoreCase("X") && !map[nextI][nextJ].equals("*")){
map[nextI][nextJ]="*";
water.add(new int[]{nextI,nextJ});
}
}
}
//고슴도치 계산
int dochiLoop = dochi.size();
for(int i=0; i<dochiLoop; i++){
int[] nowDochi = dochi.poll();
int nowCount = cnt[nowDochi[0]][nowDochi[1]];
for(int j=0; j<4; j++){
int nextI = nowDochi[0]+moveI[j];
int nextJ = nowDochi[1]+moveJ[j];
if(nextI>=0 && nextJ >=0 && nextI<r && nextJ<c && !map[nextI][nextJ].equals("*") && !map[nextI][nextJ].equalsIgnoreCase("X")){
if(cnt[nextI][nextJ]!=0) continue;
if(map[nextI][nextJ].equals("D")){
answer = String.valueOf(nowCount);
break outter;
}
cnt[nextI][nextJ] = nowCount+1;
dochi.add(new int[]{nextI,nextJ});
map[nextI][nextJ] = "S";
}
}
}
}
System.out.println(answer);
}
}
| 2,824 | 0.419144 | 0.406454 | 75 | 35.773335 | 28.008368 | 180 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.786667 | false | false |
3
|
ef64d2ac87c45815acd13528334e670235556064
| 16,561,393,897,869 |
62eef621ebaf9bef896e45671d0af993c4002ef3
|
/src/publication-server/src/main/java/org/epo/publicationserver/dao/s3/RtbS3Repository.java
|
7d37bbe456ff45c6a1172c8d3d0c96f25f369958
|
[] |
no_license
|
mirzaabazovic/publication-server
|
https://github.com/mirzaabazovic/publication-server
|
b17e6b9a66a6470e3e243954444d1cfa3c83f2db
|
19cb4c3cfb9570c978fa8e4825e77a1bf769c4ba
|
refs/heads/master
| 2015-09-26T11:04:42.748000 | 2015-09-21T21:00:14 | 2015-09-21T21:00:14 | 42,893,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.epo.publicationserver.dao.s3;
import java.util.Map;
import org.epo.publicationserver.managers.PatentFileNameResolverFactory;
import org.epo.publicationserver.managers.RtbPatentFileNameResolverFactory;
/**
* Implementation of the RTB S3 repository
*/
public class RtbS3Repository extends AbstractS3Repository {
private PatentFileNameResolverFactory patentFileNameResolverFactory = new RtbPatentFileNameResolverFactory();
/**
* Instantiates a new RTB S3 repository.
*
* @param parameters the parameters
*/
public RtbS3Repository(Map<String, String> parameters) {
super(parameters);
}
@Override
public PatentFileNameResolverFactory getPatentFileNameResolverFactory() {
return this.patentFileNameResolverFactory;
}
}
|
UTF-8
|
Java
| 782 |
java
|
RtbS3Repository.java
|
Java
|
[] | null |
[] |
package org.epo.publicationserver.dao.s3;
import java.util.Map;
import org.epo.publicationserver.managers.PatentFileNameResolverFactory;
import org.epo.publicationserver.managers.RtbPatentFileNameResolverFactory;
/**
* Implementation of the RTB S3 repository
*/
public class RtbS3Repository extends AbstractS3Repository {
private PatentFileNameResolverFactory patentFileNameResolverFactory = new RtbPatentFileNameResolverFactory();
/**
* Instantiates a new RTB S3 repository.
*
* @param parameters the parameters
*/
public RtbS3Repository(Map<String, String> parameters) {
super(parameters);
}
@Override
public PatentFileNameResolverFactory getPatentFileNameResolverFactory() {
return this.patentFileNameResolverFactory;
}
}
| 782 | 0.777494 | 0.769821 | 27 | 27.962963 | 30.199928 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false |
3
|
5111bca6f538681525755686db5d00003d0dfac2
| 11,828,339,963,457 |
e7e1754962387c9deb92c41f2a574f74d94869a6
|
/app/src/main/java/com/priyanka/myapplication/MainActivity.java
|
2815a3e69b66f51510d9a62ebc3f57ec3ee5e462
|
[] |
no_license
|
OrganicProduce/OPMS-master
|
https://github.com/OrganicProduce/OPMS-master
|
4b2797a52644d47a1967c322df7559d8c738c679
|
e849206480bc01032e2ff0e08fbd7d579d116cd2
|
refs/heads/master
| 2020-03-19T20:56:16.357000 | 2018-06-12T06:37:37 | 2018-06-12T06:37:37 | 136,923,234 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.priyanka.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.firebase.auth.FirebaseAuth;
public class MainActivity extends AppCompatActivity {
Button a,s,c;
private FirebaseAuth auth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
a=findViewById(R.id.a);
s=findViewById(R.id.s);
c=findViewById(R.id.c);
auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null) {
startActivity(new Intent(MainActivity.this, home.class));
finish();
}
a.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, LoginActivity.class));
}
});
s.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, CustomerSignup.class));
}
});
c.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, customer.class));
}
});
}
}
|
UTF-8
|
Java
| 1,506 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.priyanka.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.firebase.auth.FirebaseAuth;
public class MainActivity extends AppCompatActivity {
Button a,s,c;
private FirebaseAuth auth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
a=findViewById(R.id.a);
s=findViewById(R.id.s);
c=findViewById(R.id.c);
auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null) {
startActivity(new Intent(MainActivity.this, home.class));
finish();
}
a.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, LoginActivity.class));
}
});
s.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, CustomerSignup.class));
}
});
c.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, customer.class));
}
});
}
}
| 1,506 | 0.625498 | 0.624834 | 50 | 29.120001 | 23.051802 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.58 | false | false |
3
|
37c3454bb0b84bf8b4f98a7e4deb7e67fbd533e1
| 24,601,572,685,803 |
3ea76692df7278fa7622f6b500946924e907056b
|
/app/src/main/java/com/example/lea_maria/shelter4u/contact/ContactDAO.java
|
3db50920168e11a862adfccd2c1cfe4e97d43282
|
[] |
no_license
|
Lea-MariaSchell/shelter4u
|
https://github.com/Lea-MariaSchell/shelter4u
|
5e04fb4f8ffc5a09a43793ef6a9b3581cdfa2c49
|
730b7cd1ef8cbcaf19b0544f9a3f4d42af59fcba
|
refs/heads/master
| 2020-03-21T09:44:26.487000 | 2018-07-02T17:27:33 | 2018-07-02T17:27:33 | 138,415,559 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.lea_maria.shelter4u.contact;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import java.util.List;
/**
* Created by rieckers on 27.06.2018.
*/
@Dao
public interface ContactDAO {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(ContactItem contactItem);
@Query("DELETE FROM contact_table")
void deleteAll();
@Delete
void delete (ContactItem contactItem);
@Query("SELECT * FROM contact_table WHERE contactID = :id")
List<ContactItem> getContactItem(int id);
@Query("UPDATE contact_table SET email = :email, phone = :phone WHERE contactID=999")
void updateProfile(String email, String phone);
}
|
UTF-8
|
Java
| 862 |
java
|
ContactDAO.java
|
Java
|
[
{
"context": "package com.example.lea_maria.shelter4u.contact;\n\nimport android.arch.persisten",
"end": 29,
"score": 0.8428931832313538,
"start": 20,
"tag": "USERNAME",
"value": "lea_maria"
},
{
"context": ".Query;\n\nimport java.util.List;\n\n/**\n * Created by rieckers on 27.06.2018.\n */\n\n@Dao\npublic interface Contact",
"end": 334,
"score": 0.9871863722801208,
"start": 326,
"tag": "USERNAME",
"value": "rieckers"
}
] | null |
[] |
package com.example.lea_maria.shelter4u.contact;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import java.util.List;
/**
* Created by rieckers on 27.06.2018.
*/
@Dao
public interface ContactDAO {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(ContactItem contactItem);
@Query("DELETE FROM contact_table")
void deleteAll();
@Delete
void delete (ContactItem contactItem);
@Query("SELECT * FROM contact_table WHERE contactID = :id")
List<ContactItem> getContactItem(int id);
@Query("UPDATE contact_table SET email = :email, phone = :phone WHERE contactID=999")
void updateProfile(String email, String phone);
}
| 862 | 0.74478 | 0.730858 | 32 | 25.90625 | 24.265923 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false |
3
|
f93f1c3ca4ca2eb1c3f8014db04c5bc7f133b8ba
| 3,324,304,757,978 |
554fe06c77b2990a804f40ead718be8eaf3e98c9
|
/app/src/main/java/com/lahvuun/heartratesender/HRReadingsSender.java
|
4cbd923450137b0edd432287b805f4e1bd835a5b
|
[
"MIT"
] |
permissive
|
luddite478/HeartrateSender
|
https://github.com/luddite478/HeartrateSender
|
495af2c63e3020677f67465a5e10746e1edb015d
|
79928b63e4d878a34491a3454ab622e1bb8996a3
|
refs/heads/master
| 2020-11-24T10:30:43.669000 | 2018-12-18T18:57:27 | 2018-12-18T18:57:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lahvuun.heartratesender;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.concurrent.LinkedBlockingQueue;
public class HRReadingsSender implements Runnable {
private LinkedBlockingQueue readingsQueue;
private String host;
private int port;
public HRReadingsSender(LinkedBlockingQueue queue, String h, int p) {
readingsQueue = queue;
host = h;
port = p;
}
@Override
public void run() {
try (
Socket socket = new Socket(host, port);
PrintWriter pw = new PrintWriter(socket.getOutputStream(), true)
){
while (true) {
int reading = (int) readingsQueue.take();
pw.println(reading);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 936 |
java
|
HRReadingsSender.java
|
Java
|
[] | null |
[] |
package com.lahvuun.heartratesender;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.concurrent.LinkedBlockingQueue;
public class HRReadingsSender implements Runnable {
private LinkedBlockingQueue readingsQueue;
private String host;
private int port;
public HRReadingsSender(LinkedBlockingQueue queue, String h, int p) {
readingsQueue = queue;
host = h;
port = p;
}
@Override
public void run() {
try (
Socket socket = new Socket(host, port);
PrintWriter pw = new PrintWriter(socket.getOutputStream(), true)
){
while (true) {
int reading = (int) readingsQueue.take();
pw.println(reading);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| 936 | 0.602564 | 0.602564 | 35 | 25.742857 | 20.274323 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
3
|
c0afd0652455b2c919dece8e292b1bca296318e5
| 32,762,010,536,370 |
28d7c3b68a9780f8d0dce54e44afc152c4f29ba4
|
/moka-core/moka-core-tps/src/main/java/jmnet/moka/core/tps/mvc/archive/vo/OriginCodeVO.java
|
79a6a403dd3a2d346b39d58c395ffb13487e8bdd
|
[] |
no_license
|
raika11/-
|
https://github.com/raika11/-
|
e937bc95e584b2c8f375e638b0b92ebcc7c8ee00
|
68981ddc6c90936bd5d30bdc8c854776023e2483
|
refs/heads/master
| 2023-04-23T11:42:54.105000 | 2021-05-06T06:52:21 | 2021-05-06T06:52:21 | 364,823,740 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package jmnet.moka.core.tps.mvc.archive.vo;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* <pre>
*
* Project : moka
* Package : jmnet.moka.core.tps.mvc.achive.vo
* ClassName : OriginCodeVO
* Created : 2020-11-23 ince
* </pre>
*
* @author ince
* @since 2020-11-23 18:07
*/
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class OriginCodeVO {
/**
* 출처 코드(all, regPhoto, regImage ... 등 / all, coverage, newsis)
*/
private String code;
/**
* 매체코드
*/
private String siteCd;
/**
* 출처 명( 전체 목록, 등록사진목록, 등록이미지목록 … 등 / 전체 목록, 취재사진, 뉴시스 등)
*/
private String name;
}
|
UTF-8
|
Java
| 794 |
java
|
OriginCodeVO.java
|
Java
|
[
{
"context": " Created : 2020-11-23 ince\n * </pre>\n *\n * @author ince\n * @since 2020-11-23 18:07\n */\n@AllArgsConstructo",
"end": 323,
"score": 0.9996527433395386,
"start": 319,
"tag": "USERNAME",
"value": "ince"
}
] | null |
[] |
package jmnet.moka.core.tps.mvc.archive.vo;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* <pre>
*
* Project : moka
* Package : jmnet.moka.core.tps.mvc.achive.vo
* ClassName : OriginCodeVO
* Created : 2020-11-23 ince
* </pre>
*
* @author ince
* @since 2020-11-23 18:07
*/
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class OriginCodeVO {
/**
* 출처 코드(all, regPhoto, regImage ... 등 / all, coverage, newsis)
*/
private String code;
/**
* 매체코드
*/
private String siteCd;
/**
* 출처 명( 전체 목록, 등록사진목록, 등록이미지목록 … 등 / 전체 목록, 취재사진, 뉴시스 등)
*/
private String name;
}
| 794 | 0.634181 | 0.605932 | 38 | 17.631578 | 16.211466 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false |
3
|
0c3e232afadd4679d3948e1f3bd910423e9d9fd5
| 14,628,658,623,729 |
c738ea3d691f2f7cf08d47c7cd37a13a4d1d417c
|
/src/select/MultDataSelect.java
|
83d46333c709f81b73b55420bf72c01460b54e10
|
[] |
no_license
|
jonataspassos/jd3
|
https://github.com/jonataspassos/jd3
|
bb52ff3db34cc744384c68029e61a21f10d7a736
|
05b30ff5e1e348105d7640e60b5bed7c6d0e2de7
|
refs/heads/master
| 2020-12-01T23:00:08.969000 | 2020-01-19T10:32:12 | 2020-01-19T10:32:12 | 230,802,934 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package select;
import java.util.ArrayList;
public class MultDataSelect extends AbstractSelect{
private ArrayList<DataSelect> multiDataList;
private Tag parent;
public MultDataSelect(ArrayList<DataSelect> multiDataList,Tag parent) {
super();
this.multiDataList = multiDataList;
}
@Override
protected void setD(Object d) {
for(Object i : multiDataList.toArray()) {
((DataSelect)i).setD(d);
}
}
@Override
protected void setI(int i) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).setI(i);
}
}
@Override
protected void setDI(Object d, int i) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).setDI(d,i);
}
}
@Override
public MultSelect select(String identifier) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).select(identifier));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public MultSelect selectAll(String identifier) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).selectAll(identifier));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public AbstractSelect select(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).select(f));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public MultSelect selectAll(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).selectAll(f));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public MultDataSelect attr(String key, F f) throws Exception {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, f);
}
return this;
}
@Override
public AbstractSelect attr(String key, String value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public AbstractSelect attr(String key, int value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public AbstractSelect attr(String key, float value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public AbstractSelect attr(String key, double value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public String attr(String key) {
return "";
}
@Override
public AbstractSelect innerText(String text) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).innerText(text);
}
return this;
}
@Override
public AbstractSelect innerText(F f) throws Exception {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).innerText(f);
}
return this;
}
@Override
public String innerText() {
return "";
}
@Override
protected MultSelect append(Tag element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).append(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect append(String element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).append(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect append(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).append(f));
}
return new MultSelect(ret, this.thisParent());
}
@Override
protected MultSelect preppend(Tag element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).preppend(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect preppend(String element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).preppend(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect preppend(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).preppend(f));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public void remove() {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).remove();
}
this.multiDataList = null;
}
@Override
public boolean isEmpty() {
if(this.multiDataList.isEmpty()) {
return true;
}else {
for(Object j : multiDataList.toArray()) {
if(!((DataSelect)j).isEmpty())
return false;
}
return true;
}
}
@Override
protected Tag thisParent() {
return this.parent;
}
public MultSelect enter() {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).enter());
}
return new MultSelect(ret, this.thisParent()) {
@Override
public MultSelect append(Tag element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object i : this.getSelection()) {
ret.add(((AbstractSelect)i).append(element));
}
return new MultSelect(ret, this.getParent());
}
@Override
public MultSelect append(String element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object i : this.getSelection()) {
ret.add(((AbstractSelect)i).append(element));
}
return new MultSelect(ret, this.getParent());
}
@Override
public MultSelect append(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object i : this.getSelection()) {
ret.add(((AbstractSelect)i).append(f));
}
return new MultSelect(ret, this.getParent());
}
};
}
public MultSelect exit() {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).exit());
}
return new MultSelect(ret, this.thisParent());
}
}
|
UTF-8
|
Java
| 6,506 |
java
|
MultDataSelect.java
|
Java
|
[] | null |
[] |
package select;
import java.util.ArrayList;
public class MultDataSelect extends AbstractSelect{
private ArrayList<DataSelect> multiDataList;
private Tag parent;
public MultDataSelect(ArrayList<DataSelect> multiDataList,Tag parent) {
super();
this.multiDataList = multiDataList;
}
@Override
protected void setD(Object d) {
for(Object i : multiDataList.toArray()) {
((DataSelect)i).setD(d);
}
}
@Override
protected void setI(int i) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).setI(i);
}
}
@Override
protected void setDI(Object d, int i) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).setDI(d,i);
}
}
@Override
public MultSelect select(String identifier) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).select(identifier));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public MultSelect selectAll(String identifier) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).selectAll(identifier));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public AbstractSelect select(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).select(f));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public MultSelect selectAll(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).selectAll(f));
}
return new MultSelect(ret,this.thisParent());
}
@Override
public MultDataSelect attr(String key, F f) throws Exception {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, f);
}
return this;
}
@Override
public AbstractSelect attr(String key, String value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public AbstractSelect attr(String key, int value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public AbstractSelect attr(String key, float value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public AbstractSelect attr(String key, double value) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).attr(key, value);
}
return this;
}
@Override
public String attr(String key) {
return "";
}
@Override
public AbstractSelect innerText(String text) {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).innerText(text);
}
return this;
}
@Override
public AbstractSelect innerText(F f) throws Exception {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).innerText(f);
}
return this;
}
@Override
public String innerText() {
return "";
}
@Override
protected MultSelect append(Tag element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).append(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect append(String element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).append(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect append(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).append(f));
}
return new MultSelect(ret, this.thisParent());
}
@Override
protected MultSelect preppend(Tag element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).preppend(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect preppend(String element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).preppend(element));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public AbstractSelect preppend(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).preppend(f));
}
return new MultSelect(ret, this.thisParent());
}
@Override
public void remove() {
for(Object j : multiDataList.toArray()) {
((DataSelect)j).remove();
}
this.multiDataList = null;
}
@Override
public boolean isEmpty() {
if(this.multiDataList.isEmpty()) {
return true;
}else {
for(Object j : multiDataList.toArray()) {
if(!((DataSelect)j).isEmpty())
return false;
}
return true;
}
}
@Override
protected Tag thisParent() {
return this.parent;
}
public MultSelect enter() {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).enter());
}
return new MultSelect(ret, this.thisParent()) {
@Override
public MultSelect append(Tag element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object i : this.getSelection()) {
ret.add(((AbstractSelect)i).append(element));
}
return new MultSelect(ret, this.getParent());
}
@Override
public MultSelect append(String element) {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object i : this.getSelection()) {
ret.add(((AbstractSelect)i).append(element));
}
return new MultSelect(ret, this.getParent());
}
@Override
public MultSelect append(F f) throws Exception {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object i : this.getSelection()) {
ret.add(((AbstractSelect)i).append(f));
}
return new MultSelect(ret, this.getParent());
}
};
}
public MultSelect exit() {
ArrayList<AbstractSelect> ret = new ArrayList<AbstractSelect>();
for(Object j : multiDataList.toArray()) {
ret.add(((DataSelect)j).exit());
}
return new MultSelect(ret, this.thisParent());
}
}
| 6,506 | 0.686136 | 0.686136 | 270 | 23.096296 | 21.875193 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.103704 | false | false |
3
|
ffe5e324bfb2058c87e03642e628898e45ea4f19
| 32,366,873,556,499 |
4525df2b9236b1c373f4923fdb7db3039cea94bd
|
/src/main/java/com/netcracker/infrastructure/servicesForConsol/Connector.java
|
7b78d9fe9ac63e2267bece07dfdec390d863008c
|
[] |
no_license
|
redmaul/new_book_store_base
|
https://github.com/redmaul/new_book_store_base
|
bdbc95b0a03eb82f1c61338a9917e6afec1dc279
|
cea32b366a4f844a0a02d1ebf09a395429d7c41c
|
refs/heads/master
| 2020-03-09T07:14:32.352000 | 2018-04-26T10:13:33 | 2018-04-26T10:13:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//package com.netcracker.infrastructure.servicesForConsol;
//
//import com.netcracker.infrastructure.repositories.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Component
//public class Connector {
//
// @Autowired
// AuthorRepository authorRepository;
// BookRepository bookRepository;
// PublishingHouseRepository pubHouseRepository;
// StoreRepository storeRepository;
// HelpRepository helpRepository;
//
// public Connector(BookRepository bookRepository, AuthorRepository authorRepository,
// PublishingHouseRepository pubHouseRepository, StoreRepository storeRepository,
// HelpRepository helpRepository) {
// this.bookRepository = bookRepository;
// this.authorRepository = authorRepository;
// this.pubHouseRepository = pubHouseRepository;
// this.storeRepository = storeRepository;
// this.helpRepository = helpRepository;
// }
//
// public BookRepository getBookRepository() {
// return bookRepository;
// }
//
// public AuthorRepository getAuthorRepository() {
// return authorRepository;
// }
//
// public PublishingHouseRepository getPubHouseRepository() {
// return pubHouseRepository;
// }
//
// public StoreRepository getStoreRepository() {
// return storeRepository;
// }
//
// public HelpRepository getHelpRepository() {
// return helpRepository;
// }
//}
|
UTF-8
|
Java
| 1,516 |
java
|
Connector.java
|
Java
|
[] | null |
[] |
//package com.netcracker.infrastructure.servicesForConsol;
//
//import com.netcracker.infrastructure.repositories.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Component
//public class Connector {
//
// @Autowired
// AuthorRepository authorRepository;
// BookRepository bookRepository;
// PublishingHouseRepository pubHouseRepository;
// StoreRepository storeRepository;
// HelpRepository helpRepository;
//
// public Connector(BookRepository bookRepository, AuthorRepository authorRepository,
// PublishingHouseRepository pubHouseRepository, StoreRepository storeRepository,
// HelpRepository helpRepository) {
// this.bookRepository = bookRepository;
// this.authorRepository = authorRepository;
// this.pubHouseRepository = pubHouseRepository;
// this.storeRepository = storeRepository;
// this.helpRepository = helpRepository;
// }
//
// public BookRepository getBookRepository() {
// return bookRepository;
// }
//
// public AuthorRepository getAuthorRepository() {
// return authorRepository;
// }
//
// public PublishingHouseRepository getPubHouseRepository() {
// return pubHouseRepository;
// }
//
// public StoreRepository getStoreRepository() {
// return storeRepository;
// }
//
// public HelpRepository getHelpRepository() {
// return helpRepository;
// }
//}
| 1,516 | 0.69657 | 0.69657 | 46 | 31.956522 | 25.049479 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
caf654c6c4ed073cd8f62d9caf185bcc30415338
| 17,463,337,030,403 |
ba1512f6fe865d49f2c1267faeaa4c07f2dae2e6
|
/test/unit/com/google/enterprise/connector/spi/SimpleDocumentTest.java
|
d2621522c798b78756df78d2b784f7fb86c93129
|
[] |
no_license
|
lizunmvn/google-connector-manager
|
https://github.com/lizunmvn/google-connector-manager
|
971af9be14ab7613fe25e85f3143ae74883a2f9b
|
b6adcd4aee552459d27ee847a6003d55622aa3db
|
refs/heads/master
| 2017-04-24T20:40:15.144000 | 2013-02-01T16:21:51 | 2013-02-01T16:21:51 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Copyright (C) 2008-2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.enterprise.connector.spi;
import com.google.enterprise.connector.test.ConnectorTestUtils;
import junit.framework.TestCase;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class SimpleDocumentTest extends TestCase {
private SimpleDocument document;
@Override
protected void setUp() throws Exception {
Map<String, Object> props = new HashMap<String, Object>();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(10 * 1000);
props.put(SpiConstants.PROPNAME_LASTMODIFIED, cal);
props.put(SpiConstants.PROPNAME_ACTION,
SpiConstants.ActionType.DELETE.toString());
props.put(SpiConstants.PROPNAME_DOCID, "doc1");
props.put(SpiConstants.PROPNAME_CONTENT, "now is the time");
props.put(SpiConstants.PROPNAME_CONTENTURL,
"http://www.comtesturl.com/test");
document = ConnectorTestUtils.createSimpleDocument(props);
}
@Override
protected void tearDown() throws Exception {
document = null;
}
public void testFindProperty() throws RepositoryException {
Set<String> propNames = document.getPropertyNames();
for (String propName : propNames) {
Property prop = document.findProperty(propName);
assertNotNull("Checking for " + propName + " property", prop.nextValue());
}
// Now try it again since properties should be able to be reused.
for (String propName : propNames) {
Property prop = document.findProperty(propName);
assertNotNull("Checking for " + propName + " property", prop.nextValue());
}
}
public void testGetPropertyNames() {
Set<String> propNames = document.getPropertyNames();
assertTrue(propNames.contains(SpiConstants.PROPNAME_LASTMODIFIED));
assertTrue(propNames.contains(SpiConstants.PROPNAME_ACTION));
assertTrue(propNames.contains(SpiConstants.PROPNAME_DOCID));
assertTrue(propNames.contains(SpiConstants.PROPNAME_CONTENT));
assertTrue(propNames.contains(SpiConstants.PROPNAME_CONTENTURL));
}
}
|
UTF-8
|
Java
| 2,638 |
java
|
SimpleDocumentTest.java
|
Java
|
[] | null |
[] |
// Copyright (C) 2008-2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.enterprise.connector.spi;
import com.google.enterprise.connector.test.ConnectorTestUtils;
import junit.framework.TestCase;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class SimpleDocumentTest extends TestCase {
private SimpleDocument document;
@Override
protected void setUp() throws Exception {
Map<String, Object> props = new HashMap<String, Object>();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(10 * 1000);
props.put(SpiConstants.PROPNAME_LASTMODIFIED, cal);
props.put(SpiConstants.PROPNAME_ACTION,
SpiConstants.ActionType.DELETE.toString());
props.put(SpiConstants.PROPNAME_DOCID, "doc1");
props.put(SpiConstants.PROPNAME_CONTENT, "now is the time");
props.put(SpiConstants.PROPNAME_CONTENTURL,
"http://www.comtesturl.com/test");
document = ConnectorTestUtils.createSimpleDocument(props);
}
@Override
protected void tearDown() throws Exception {
document = null;
}
public void testFindProperty() throws RepositoryException {
Set<String> propNames = document.getPropertyNames();
for (String propName : propNames) {
Property prop = document.findProperty(propName);
assertNotNull("Checking for " + propName + " property", prop.nextValue());
}
// Now try it again since properties should be able to be reused.
for (String propName : propNames) {
Property prop = document.findProperty(propName);
assertNotNull("Checking for " + propName + " property", prop.nextValue());
}
}
public void testGetPropertyNames() {
Set<String> propNames = document.getPropertyNames();
assertTrue(propNames.contains(SpiConstants.PROPNAME_LASTMODIFIED));
assertTrue(propNames.contains(SpiConstants.PROPNAME_ACTION));
assertTrue(propNames.contains(SpiConstants.PROPNAME_DOCID));
assertTrue(propNames.contains(SpiConstants.PROPNAME_CONTENT));
assertTrue(propNames.contains(SpiConstants.PROPNAME_CONTENTURL));
}
}
| 2,638 | 0.73768 | 0.730478 | 73 | 35.136986 | 26.621813 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.589041 | false | false |
3
|
69e511e17f4ab1ea25220f624eaa0140ee947898
| 8,658,654,074,730 |
60c7939e4339a85fc92cf86c22ef28b637e2d4a5
|
/src/main/java/com/comdosoft/financial/timing/joint/zhonghui/transactions/TransactionAction.java
|
006ab2b816cdd620fb1e66ecefb0c86636577632
|
[] |
no_license
|
lifang/ZFTiming
|
https://github.com/lifang/ZFTiming
|
6b0c99027d03a0fff2ac7049878035bbb219cf9e
|
330a123cc1bdf62fb37fa0b592b652696fa8ee33
|
refs/heads/master
| 2020-04-01T23:55:12.975000 | 2015-05-22T02:39:36 | 2015-05-22T02:39:36 | 32,558,182 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.comdosoft.financial.timing.joint.zhonghui.transactions;
import java.util.List;
import java.util.Map;
import com.comdosoft.financial.timing.joint.zhonghui.RequireLoginAction;
import com.comdosoft.financial.timing.joint.zhonghui.Result;
public abstract class TransactionAction extends RequireLoginAction {
public TransactionAction(String phoneNum, String password, String position, String appVersion) {
super(phoneNum, password, position, appVersion);
}
@Override
protected Map<String, String> params() {
return null;
}
@Override
protected Method getMethod() {
return Method.GET;
}
@Override
protected Class<? extends Result> getResultType() {
return TransResult.class;
}
public static class TransResult extends Result{
private String merchantName;
private String merchantNo;
private String terminalNo;
private List<Transaction> transactions;
public String getMerchantName() {
return merchantName;
}
public void setMerchantName(String merchantName) {
this.merchantName = merchantName;
}
public String getMerchantNo() {
return merchantNo;
}
public void setMerchantNo(String merchantNo) {
this.merchantNo = merchantNo;
}
public String getTerminalNo() {
return terminalNo;
}
public void setTerminalNo(String terminalNo) {
this.terminalNo = terminalNo;
}
public List<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(List<Transaction> transactions) {
this.transactions = transactions;
}
}
}
|
UTF-8
|
Java
| 1,588 |
java
|
TransactionAction.java
|
Java
|
[] | null |
[] |
package com.comdosoft.financial.timing.joint.zhonghui.transactions;
import java.util.List;
import java.util.Map;
import com.comdosoft.financial.timing.joint.zhonghui.RequireLoginAction;
import com.comdosoft.financial.timing.joint.zhonghui.Result;
public abstract class TransactionAction extends RequireLoginAction {
public TransactionAction(String phoneNum, String password, String position, String appVersion) {
super(phoneNum, password, position, appVersion);
}
@Override
protected Map<String, String> params() {
return null;
}
@Override
protected Method getMethod() {
return Method.GET;
}
@Override
protected Class<? extends Result> getResultType() {
return TransResult.class;
}
public static class TransResult extends Result{
private String merchantName;
private String merchantNo;
private String terminalNo;
private List<Transaction> transactions;
public String getMerchantName() {
return merchantName;
}
public void setMerchantName(String merchantName) {
this.merchantName = merchantName;
}
public String getMerchantNo() {
return merchantNo;
}
public void setMerchantNo(String merchantNo) {
this.merchantNo = merchantNo;
}
public String getTerminalNo() {
return terminalNo;
}
public void setTerminalNo(String terminalNo) {
this.terminalNo = terminalNo;
}
public List<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(List<Transaction> transactions) {
this.transactions = transactions;
}
}
}
| 1,588 | 0.730479 | 0.730479 | 61 | 24.032787 | 23.046616 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.885246 | false | false |
3
|
66d33b5787e6959508874297ae43ed742741c646
| 14,216,341,760,930 |
fca61bc672afd70f4bc93e8fac7b304e6207f03d
|
/AdaptiveDefenseMDP/src/lts/ActionDescr.java
|
5cde97f82787d2dd5c1a11fc477b9b2a43178c04
|
[] |
no_license
|
YehiaElrakaiby/React
|
https://github.com/YehiaElrakaiby/React
|
114babdb2e4be21ba2199393cf73c8f644d046a7
|
2fe3d459fef35bf79db6fdb567727c67369f73f7
|
refs/heads/master
| 2021-01-19T17:48:05.788000 | 2017-07-13T09:59:52 | 2017-07-13T09:59:52 | 88,341,404 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lts;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class ActionDescr {
private Set<HashMap<String, String>> precondition;
private HashSet<Effect> effects;
private BigDecimal cost;
private String type;
public ActionDescr() {
this.precondition = new HashSet<HashMap<String, String>>();
this.effects = new HashSet<Effect>();
}
public BigDecimal getCost() {
return cost;
}
public void setCost(BigDecimal cost2) {
this.cost = cost2;
}
public Set<HashMap<String, String>> getPrecondition() {
return precondition;
}
public void setPrecondition(Set<HashMap<String, String>> preconds) {
this.precondition = preconds;
}
public HashSet<Effect> getEffects() {
return effects;
}
public void setEffects(HashSet<Effect> effects) {
this.effects = effects;
}
public void addEffect(Effect effect) {
this.effects.add(effect);
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "<" + precondition + "," + effects + "," + cost + ">";
}
}
|
UTF-8
|
Java
| 1,170 |
java
|
ActionDescr.java
|
Java
|
[] | null |
[] |
package lts;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class ActionDescr {
private Set<HashMap<String, String>> precondition;
private HashSet<Effect> effects;
private BigDecimal cost;
private String type;
public ActionDescr() {
this.precondition = new HashSet<HashMap<String, String>>();
this.effects = new HashSet<Effect>();
}
public BigDecimal getCost() {
return cost;
}
public void setCost(BigDecimal cost2) {
this.cost = cost2;
}
public Set<HashMap<String, String>> getPrecondition() {
return precondition;
}
public void setPrecondition(Set<HashMap<String, String>> preconds) {
this.precondition = preconds;
}
public HashSet<Effect> getEffects() {
return effects;
}
public void setEffects(HashSet<Effect> effects) {
this.effects = effects;
}
public void addEffect(Effect effect) {
this.effects.add(effect);
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "<" + precondition + "," + effects + "," + cost + ">";
}
}
| 1,170 | 0.68718 | 0.68547 | 77 | 14.194805 | 18.077065 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.116883 | false | false |
3
|
672a5b2a7c3faa8741d1791dca4f071134738fa3
| 31,327,491,476,785 |
8d4fbe18a5ea41b230a621fb49dd1afb99056e9c
|
/src/main/java/com/aygxy/controller/UserController.java
|
c17620d4263333c05e415473314f1b1c68a9e78d
|
[] |
no_license
|
guozhengit/luyuntong
|
https://github.com/guozhengit/luyuntong
|
e4dced48b6baaaff4be4eb51b20bbf3fbbc8cfd6
|
af6a8a7c58f6e803b29c8796b77f17bd386a64d5
|
refs/heads/master
| 2022-07-30T05:15:26.719000 | 2019-07-12T07:49:07 | 2019-07-12T07:49:07 | 180,906,051 | 1 | 1 | null | false | 2022-06-17T02:05:49 | 2019-04-12T01:25:49 | 2020-09-15T04:11:45 | 2022-06-17T02:05:48 | 4,337 | 1 | 0 | 1 |
Java
| false | false |
package com.aygxy.controller;
import com.alibaba.fastjson.JSON;
import com.aygxy.service.UserService;
import com.aygxy.base.Result;
import com.aygxy.jpa.entity.User;
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.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;
/**
* @Description: 用户控制类
* @Author: xmf
* @Date: 2019/4/8-0:07
*/
@RestController
@Api(value = "用户管理")
@RequestMapping("/users")
public class UserController {
private static Logger logger = LoggerFactory.getLogger(UserController.class);
@Autowired
private UserService userService;
@ApiOperation(value = "添加用户", notes = "根据User对象创建用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用户id(必填)", required = true, dataType = "String"),
@ApiImplicitParam(name = "name", value = "用户账号(必填)", required = true, dataType = "String"),
@ApiImplicitParam(name = "password", value = "用户密码(必填)", required = true, dataType = "String")})
@PostMapping()
public Result addUser(@RequestBody User user) {
logger.info("user.add parameter is [{}]",JSON.toJSON(user));
return userService.addByOne(user);
}
@ApiOperation(value = "删除用户", notes = "通过id删除用户")
@ApiImplicitParam(name = "uid", value = "用户id(必填)", required = true, dataType = "String")
@DeleteMapping("/{uid}")
public Result deleteUser(@PathVariable String uid) {
logger.info("user.delete parameter is [{}]",JSON.toJSON(uid));
return userService.deleteByOne(uid);
}
@ApiOperation(value = "修改用户", notes = "通过id修改用户")
@ApiImplicitParam(name = "uid", value = "用户id(必填)", required = true, dataType = "String")
@PutMapping("/{uid}")
public Result updateUser(@PathVariable String uid, @RequestBody User user) {
logger.info("user.update parameter is [{}]",JSON.toJSON(user));
return userService.update(uid, user);
}
@ApiOperation(value = "通过id查询用户", notes = "通过id添加用户")
@GetMapping(value = "/{uid}")
public Result queryUser(@PathVariable String uid) {
logger.info("user.add parameter is [{}]",JSON.toJSON(uid));
return userService.queryById(uid);
}
@ApiOperation(value = "查询用户", notes = "分页查询部分用户")
@GetMapping()
public Result pageUser(@PageableDefault(value = 10, sort = {"createTime"}, direction = Sort.Direction.ASC) Pageable pageable) {
return userService.findAll(pageable);
}
@ApiOperation(value = "查询用户", notes = "分页查询部分用户")
@PostMapping("/pageQuery")
public Result pageUser(@PageableDefault(value = 10, sort = {"createTime"}, direction = Sort.Direction.ASC) Pageable pageable,@RequestBody User user) {
return userService.dynamicQuery(pageable,user);
}
}
|
UTF-8
|
Java
| 3,321 |
java
|
UserController.java
|
Java
|
[
{
"context": "tation.*;\n\n\n/**\n * @Description: 用户控制类\n * @Author: xmf\n * @Date: 2019/4/8-0:07\n */\n@RestController\n@Api(",
"end": 704,
"score": 0.9996731281280518,
"start": 701,
"tag": "USERNAME",
"value": "xmf"
}
] | null |
[] |
package com.aygxy.controller;
import com.alibaba.fastjson.JSON;
import com.aygxy.service.UserService;
import com.aygxy.base.Result;
import com.aygxy.jpa.entity.User;
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.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;
/**
* @Description: 用户控制类
* @Author: xmf
* @Date: 2019/4/8-0:07
*/
@RestController
@Api(value = "用户管理")
@RequestMapping("/users")
public class UserController {
private static Logger logger = LoggerFactory.getLogger(UserController.class);
@Autowired
private UserService userService;
@ApiOperation(value = "添加用户", notes = "根据User对象创建用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用户id(必填)", required = true, dataType = "String"),
@ApiImplicitParam(name = "name", value = "用户账号(必填)", required = true, dataType = "String"),
@ApiImplicitParam(name = "password", value = "用户密码(必填)", required = true, dataType = "String")})
@PostMapping()
public Result addUser(@RequestBody User user) {
logger.info("user.add parameter is [{}]",JSON.toJSON(user));
return userService.addByOne(user);
}
@ApiOperation(value = "删除用户", notes = "通过id删除用户")
@ApiImplicitParam(name = "uid", value = "用户id(必填)", required = true, dataType = "String")
@DeleteMapping("/{uid}")
public Result deleteUser(@PathVariable String uid) {
logger.info("user.delete parameter is [{}]",JSON.toJSON(uid));
return userService.deleteByOne(uid);
}
@ApiOperation(value = "修改用户", notes = "通过id修改用户")
@ApiImplicitParam(name = "uid", value = "用户id(必填)", required = true, dataType = "String")
@PutMapping("/{uid}")
public Result updateUser(@PathVariable String uid, @RequestBody User user) {
logger.info("user.update parameter is [{}]",JSON.toJSON(user));
return userService.update(uid, user);
}
@ApiOperation(value = "通过id查询用户", notes = "通过id添加用户")
@GetMapping(value = "/{uid}")
public Result queryUser(@PathVariable String uid) {
logger.info("user.add parameter is [{}]",JSON.toJSON(uid));
return userService.queryById(uid);
}
@ApiOperation(value = "查询用户", notes = "分页查询部分用户")
@GetMapping()
public Result pageUser(@PageableDefault(value = 10, sort = {"createTime"}, direction = Sort.Direction.ASC) Pageable pageable) {
return userService.findAll(pageable);
}
@ApiOperation(value = "查询用户", notes = "分页查询部分用户")
@PostMapping("/pageQuery")
public Result pageUser(@PageableDefault(value = 10, sort = {"createTime"}, direction = Sort.Direction.ASC) Pageable pageable,@RequestBody User user) {
return userService.dynamicQuery(pageable,user);
}
}
| 3,321 | 0.690285 | 0.685476 | 82 | 37.036587 | 32.472672 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.768293 | false | false |
3
|
1d349edcaf9e2bf584810d4428726fc763dd5310
| 10,127,532,949,123 |
88414925332ec56ba6483a1ed8cb7499c3bc4a20
|
/web_shop/src/main/java/com/offcn/core/service/UserDetailServiceImpl.java
|
90e6f6196ac13def6ce583a216130e1a95e133a3
|
[] |
no_license
|
ssx0115/ylx_parent
|
https://github.com/ssx0115/ylx_parent
|
2bf909102242434c8ff68dab51f022000b1819c8
|
63c317350f8b3bc4177c9069b58cb91f842f612a
|
refs/heads/master
| 2021-08-08T04:56:22.996000 | 2019-12-12T05:50:15 | 2019-12-12T05:50:15 | 227,530,143 | 0 | 0 | null | false | 2020-10-13T18:10:12 | 2019-12-12T05:50:18 | 2019-12-12T05:55:25 | 2020-10-13T18:10:11 | 17,197 | 0 | 0 | 10 |
JavaScript
| false | false |
package com.offcn.core.service;
import com.offcn.core.pojo.seller.Seller;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import java.util.ArrayList;
import java.util.List;
/*自定义验证类 实现UserDetailsService */
public class UserDetailServiceImpl implements UserDetailsService {
private SellerService sellerService;
public void setSellerService(SellerService sellerService){
this.sellerService = sellerService;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
/*登录验证用户名是否为空,如果为空直接返回null*/
/*根据用户名到数据库查询 用户对象*/
/*如果用户查不到 返回null*/
/*如果用户对象查询到 判断用户是否审核通过, 如果未通过 返回null*/
/*如果成功返回user对象, 将用户名和密码 返回权限集合*/
/*框架帮助比对用户名和密码*/
// 权限集合
List<GrantedAuthority> authList = new ArrayList<>();
// 具体具有什么的权限
authList.add(new SimpleGrantedAuthority("ROLE_SELLER"));
//1 判断用户名是否为null 如果为null 直接返回null
if(username==null){
return null;
}
//2 根据用户名到数据库查询 用户对象
Seller seller = sellerService.findOne(username);
//3 如果用户查不到 返回null
if(seller!=null){
//4 如果用户对象查到了 判断用户审核 是否通过 如果未通过返回null
if("1".equals(seller.getStatus())){
//5 返回user 对象 将用户名 密码 返回权限集合
return new User(username,seller.getPassword(),authList);
}
}
return null;
//6 框架帮助比对用户名和密码是否匹配
}
}
|
UTF-8
|
Java
| 2,288 |
java
|
UserDetailServiceImpl.java
|
Java
|
[] | null |
[] |
package com.offcn.core.service;
import com.offcn.core.pojo.seller.Seller;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import java.util.ArrayList;
import java.util.List;
/*自定义验证类 实现UserDetailsService */
public class UserDetailServiceImpl implements UserDetailsService {
private SellerService sellerService;
public void setSellerService(SellerService sellerService){
this.sellerService = sellerService;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
/*登录验证用户名是否为空,如果为空直接返回null*/
/*根据用户名到数据库查询 用户对象*/
/*如果用户查不到 返回null*/
/*如果用户对象查询到 判断用户是否审核通过, 如果未通过 返回null*/
/*如果成功返回user对象, 将用户名和密码 返回权限集合*/
/*框架帮助比对用户名和密码*/
// 权限集合
List<GrantedAuthority> authList = new ArrayList<>();
// 具体具有什么的权限
authList.add(new SimpleGrantedAuthority("ROLE_SELLER"));
//1 判断用户名是否为null 如果为null 直接返回null
if(username==null){
return null;
}
//2 根据用户名到数据库查询 用户对象
Seller seller = sellerService.findOne(username);
//3 如果用户查不到 返回null
if(seller!=null){
//4 如果用户对象查到了 判断用户审核 是否通过 如果未通过返回null
if("1".equals(seller.getStatus())){
//5 返回user 对象 将用户名 密码 返回权限集合
return new User(username,seller.getPassword(),authList);
}
}
return null;
//6 框架帮助比对用户名和密码是否匹配
}
}
| 2,288 | 0.681325 | 0.677524 | 50 | 35.84 | 23.711061 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
3
|
3b38a50f00801b282215e337899c5341a92f9a35
| 31,121,333,068,303 |
cb8b13038341724512334fbd7bb871ca8ac7e855
|
/src/main/java/com/example/InventoryManager/narola/dao/ProductCriteria.java
|
520f8c955243beacb13f7c8b86b872a206b8b84e
|
[] |
no_license
|
Nikhilsharma1999/InventoryManager
|
https://github.com/Nikhilsharma1999/InventoryManager
|
7202a5de23d8e13b40dd2e2d3eebf7d2b962fc09
|
8fdc7e41c930f0ecbd0c19abcf9f8ebaa90a8e04
|
refs/heads/master
| 2023-04-02T19:38:54.034000 | 2021-03-06T07:00:37 | 2021-03-06T07:00:37 | 345,027,900 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.InventoryManager.narola.dao;
import com.example.InventoryManager.narola.entity.Products;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface ProductCriteria {
List<Products> searchAnyProduct(String value);
List<Products> FindProduct(String value, int catId, String sortOrder, String sortBy, Pageable page);
}
|
UTF-8
|
Java
| 378 |
java
|
ProductCriteria.java
|
Java
|
[] | null |
[] |
package com.example.InventoryManager.narola.dao;
import com.example.InventoryManager.narola.entity.Products;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface ProductCriteria {
List<Products> searchAnyProduct(String value);
List<Products> FindProduct(String value, int catId, String sortOrder, String sortBy, Pageable page);
}
| 378 | 0.804233 | 0.804233 | 12 | 30.5 | 31.468239 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
3
|
07ee3d69aca76b6e86a3ea83b546c24d093282f0
| 7,447,473,362,138 |
902564d740bee866d7798df985a25f0f664f6240
|
/src/trunk/mywar-game-admin/src/main/java/com/adminTool/bo/SystemGrowthPlanReward.java
|
91bc44d9efa4968e8d4405569db511a2c9e8ca08
|
[] |
no_license
|
hw233/Server-java
|
https://github.com/hw233/Server-java
|
539b416821ad67d22120c7146b4c3c7d4ad15929
|
ff74787987f146553684bd823d6bd809eb1e27b6
|
refs/heads/master
| 2020-04-29T04:46:03.263000 | 2016-05-20T12:45:44 | 2016-05-20T12:45:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.adminTool.bo;
/**
* 坐享其成
* @author Administrator
*
*/
public class SystemGrowthPlanReward {
private Integer id;
private Integer activityId;
private Integer userLevel;
private String rewards;
private String description;
public SystemGrowthPlanReward() {}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getActivityId() {
return activityId;
}
public void setActivityId(Integer activityId) {
this.activityId = activityId;
}
public Integer getUserLevel() {
return userLevel;
}
public void setUserLevel(Integer userLevel) {
this.userLevel = userLevel;
}
public String getRewards() {
return rewards;
}
public void setRewards(String rewards) {
this.rewards = rewards;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
UTF-8
|
Java
| 932 |
java
|
SystemGrowthPlanReward.java
|
Java
|
[
{
"context": "package com.adminTool.bo;\n\n/**\n * 坐享其成\n * @author Administrator\n *\n */\npublic class SystemGrowthPlanReward {\n\n\tpr",
"end": 63,
"score": 0.7674679160118103,
"start": 50,
"tag": "NAME",
"value": "Administrator"
}
] | null |
[] |
package com.adminTool.bo;
/**
* 坐享其成
* @author Administrator
*
*/
public class SystemGrowthPlanReward {
private Integer id;
private Integer activityId;
private Integer userLevel;
private String rewards;
private String description;
public SystemGrowthPlanReward() {}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getActivityId() {
return activityId;
}
public void setActivityId(Integer activityId) {
this.activityId = activityId;
}
public Integer getUserLevel() {
return userLevel;
}
public void setUserLevel(Integer userLevel) {
this.userLevel = userLevel;
}
public String getRewards() {
return rewards;
}
public void setRewards(String rewards) {
this.rewards = rewards;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| 932 | 0.727273 | 0.727273 | 48 | 18.25 | 14.975675 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false |
3
|
678db9c571487d74453d5cb9d3b79ffae39fae3a
| 5,712,306,562,496 |
f014045ea774c66f6187cbcb695012357fd90846
|
/js00qz/src/main/java/com/centit/powerruntime/po/CaseDoc.java
|
2a6c717e6697a1ac4e2b0b911a04b9f97f4e9652
|
[] |
no_license
|
gaoyinghe/jttsunzwii
|
https://github.com/gaoyinghe/jttsunzwii
|
12973bad77dd06749dce10f0e20d258027fa4044
|
6b8babdf92d0b7c9c7e6664b3536de060e2c7a33
|
refs/heads/master
| 2020-05-25T19:30:06.596000 | 2019-05-22T02:47:04 | 2019-05-22T02:47:04 | 187,951,030 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.centit.powerruntime.po;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
/**
* create by scaffold
* @author codefan@hotmail.com
*/
public class CaseDoc implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private String no;
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public void setNO(String no) {
this.no = no;
}
private String filename;
private InputStream fileblob;
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public void setFILENAME(String filename) {
this.filename = filename;
}
public InputStream getFileblob() {
return fileblob;
}
public void setFileblob(InputStream fileblob) {
this.fileblob = fileblob;
}
public void setFILEBLOB(Blob fileblob) {
try {
this.fileblob = fileblob.getBinaryStream();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 1,203 |
java
|
CaseDoc.java
|
Java
|
[
{
"context": "Exception;\n\n\n\n/**\n * create by scaffold\n * @author codefan@hotmail.com\n */ \n\npublic class CaseDoc implements java.io.Ser",
"end": 176,
"score": 0.9999225735664368,
"start": 157,
"tag": "EMAIL",
"value": "codefan@hotmail.com"
}
] | null |
[] |
package com.centit.powerruntime.po;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
/**
* create by scaffold
* @author <EMAIL>
*/
public class CaseDoc implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private String no;
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public void setNO(String no) {
this.no = no;
}
private String filename;
private InputStream fileblob;
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public void setFILENAME(String filename) {
this.filename = filename;
}
public InputStream getFileblob() {
return fileblob;
}
public void setFileblob(InputStream fileblob) {
this.fileblob = fileblob;
}
public void setFILEBLOB(Blob fileblob) {
try {
this.fileblob = fileblob.getBinaryStream();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 1,191 | 0.623441 | 0.62261 | 51 | 22.588236 | 16.68647 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.392157 | false | false |
3
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.