blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5e91a03172b432e88dcaabed090fd682611d53eb
|
821f19847681c49c0b554426a576ca54d3cf329b
|
/FTC_2018_2019/Autonomous/PositionR.java
|
3e987fe718de1e4cbb3b1551ff595b8c76d26855
|
[] |
no_license
|
faustus123/FTC_9882
|
4dfb22bdbd44e22cd8cb09f12618dba462c0bc67
|
7265b144667e3f442195e0ae0d4f2cd3f450ba55
|
refs/heads/master
| 2020-04-07T01:29:11.919973 | 2018-12-30T20:39:43 | 2018-12-30T20:39:43 | 157,942,905 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 20,515 |
java
|
/* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.ServoImplEx;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
import org.firstinspires.ftc.robotcore.external.ClassFactory;
import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
import com.qualcomm.robotcore.hardware.DigitalChannel;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.hardware.DcMotorController;
import java.util.Set;
import com.qualcomm.robotcore.util.ElapsedTime;
import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DigitalChannel;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;
import com.qualcomm.hardware.bosch.BNO055IMU;
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
import org.firstinspires.ftc.robotcore.external.navigation.Position;
import org.firstinspires.ftc.robotcore.external.navigation.Velocity;
import java.util.List;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection;
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
/**
* This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
* the autonomous or the teleop period of an FTC match. The names of OpModes appear on the menu
* of the FTC Driver Station. When an selection is made from the menu, the corresponding OpMode
* class is instantiated on the Robot Controller and executed.
*
* This particular OpMode just executes a basic Tank Drive Teleop for a two wheeled robot
* It includes all the skeletal structure that all linear OpModes contain.
*
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
*/
@Autonomous(name="PositionR", group="Linear Opmode")
public class PositionR extends LinearOpMode {
// Declare OpMode members.
private ElapsedTime runtime = new ElapsedTime();
private DcMotor leftDrive = null;
private DcMotor rightDrive = null;
private DcMotor topDrive = null;
DigitalChannel hook_stop = null; // Hardware Device Object
private DcMotor hook = null;
private Servo hook_lock = null;
private Servo mascot_launcher = null;
private static final String TFOD_MODEL_ASSET = "RoverRuckus.tflite";
private static final String LABEL_GOLD_MINERAL = "Gold Mineral";
private static final String LABEL_SILVER_MINERAL = "Silver Mineral";
private static final String VUFORIA_KEY = "AZJZ75//////AAABmdAmg40cSEDOrErUXX2lSa2JCItbFqAqd6UYVKvTVWjcw+/gkmtxHQMZL8SwMFpnTmjAzusU1xDqqetDO1iL9KZb0JwlvnurrYtpwJoCx3JyQ+sTQWOcyDA9ciN7KPYizT5idlIpPX+RqwWsNGSSLVMAlWY4Rn1JXojxV5wEAjrpG2lVAKmF2p6nXrpIGJ+FI8HyQjN81Dy3gNIL9crNwZdCQUps6S57KCXETjC1PELLHAWIt3nyYWYgfHo0UNZGzcrKc/0LBw3qDrsXNbDFZiiz29zBkweDjjAkdbYtyii+dHeS6nIk0yopIGqq1YRGxKtK4r4E9Id6jLnqNruNFgChZ1HpfqzMEGBFGL6lDY4q";
/**
* {@link #vuforia} is the variable we will use to store our instance of the Vuforia
* localization engine.
*/
private VuforiaLocalizer vuforia;
/**
* {@link #tfod} is the variable we will use to store our instance of the Tensor Flow Object
* Detection engine.
*/
private TFObjectDetector tfod;
BNO055IMU imu;
double gTheta; // direction to keep IMU facing during GoDir calls
/**
* Get current angle from gyro
* @return Angle in degrees. + = left, - = right.
*/
private double getAngle()
{
Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
return angles.firstAngle;
}
void FirstMotion (int initPos,double scale,double power)
{
LowerSelf();
MoveTimed(power, -90, 1.0*scale, true);
sleep(100);
MoveTimed(power, 150, 0.5*scale, true);
TurnTo( -60, 0.25);
//MoveTimed(power, -90, 3.5*scale, false);
sleep(500);
MoveTimed(power, 30, 0.5*scale, true);
int loc = FindGold();
telemetry.addData("loc", loc);
telemetry.update();
if (loc == 1) {
gTheta = -60;
MoveTimed(power, 120, 4.1*scale, false);
TurnTo( -120, 0.25);
MoveTimed(power, 90, 2.1*scale, true);
TurnTo( 60, 0.25);
MoveTimed(power,-60, 3.1*scale, true);
mascot_launcher.setPosition(0.0);
sleep(2000);
mascot_launcher.setPosition(1.0);
}
if (loc == 2) {
gTheta = -60;
MoveTimed(power, 82, 3.1*scale, false);
TurnTo( -60, 0.25);
MoveTimed(power, 90, 2.5*scale, true);
TurnTo( 30, 0.25);
MoveTimed(power, 30, 1.5*scale, true);
mascot_launcher.setPosition(0.0);
sleep(2000);
mascot_launcher.setPosition(1.0);
}
if (loc == 3) {
gTheta = -70;
MoveTimed(power, 60, 3.1*scale, false);
TurnTo( 30, 0.25);
MoveTimed(power, 70, 2.5*scale, true);
TurnTo( 30, 0.25);
//MoveTimed(power,-60, 3.0*scale, true);
TurnTo(90, 0.25);
mascot_launcher.setPosition(0.0);
sleep(2000);
mascot_launcher.setPosition(1.0);
}
telemetry.addData("loc", loc);
telemetry.update();
}
void LowerSelf()
{
// releqase hook lock
hook.setPower(-0.4);
hook_lock.setPosition(0.7);
sleep(200);
// Lower robot
hook.setPower(-0.05);
sleep(2300);
hook.setPower(0.0);
// Raise hook slightly
hook.setPower(0.15);
sleep(100);
hook.setPower(0.0);
}
void GoDir( double power, double theta_degrees ){
// Set motors to move the robot in the direction given
// by theta_degrees with the given power. The motion will
// try and maintain the gyro-Z angle given by the theta_face
// member during the move by adjusting the Torque value.
//
// The intent of this is to simply set the motors and return
// immediately. This should be called from within a loop that
// breaks when it decides the movement is done.
double gain = 0.1; // torque power per degree angle
double theta_radians = Math.toRadians(theta_degrees);
double Fx = power * Math.cos( theta_radians );
double Fy = power * Math.sin( theta_radians );
double Tau = gain*(gTheta - getAngle());
double P1 = Fx*2.0/3.0 + Tau/3.0;
double P2 = -Fx*1.0/3.0 + 1.0/Math.sqrt(3.0)*Fy + Tau/3.0;
double P3 = -Fx*2.0/3.0 - 1.0/Math.sqrt(3.0)*Fy + Tau/3.0;
topDrive.setPower( P1 );
leftDrive.setPower( P2 );
rightDrive.setPower( P3 );
}
void MoveTimed( double power, double theta_degrees, double t_secs, boolean set_gTheta){
// Optionally set member gTheta to current gyro reading so GoDir()
// will maintain this orientation. Otherwise, use whatever caller left
if( set_gTheta ) gTheta = getAngle();
double t_start = getRuntime();
while ( opModeIsActive() ) {
GoDir( power, theta_degrees );
Position pos = imu.getPosition();
double t_elapsed = getRuntime()-t_start;
telemetry.addData("T remaining", t_secs-t_elapsed);
telemetry.addData("delta Theta", getAngle() - gTheta);
telemetry.addData("encoder", leftDrive.getCurrentPosition());
telemetry.update();
if ( t_elapsed >= t_secs ) break;
}
topDrive.setPower( 0 );
leftDrive.setPower( 0 );
rightDrive.setPower( 0 );
}
void TurnTo(double theta_degrees, double power){
double gain =0.017;
while ( opModeIsActive() ) {
double delta_theta = (theta_degrees - getAngle());
if (delta_theta < -180) delta_theta += 360;
if (delta_theta > 180) delta_theta -= 360;
double P = power * gain * delta_theta;
if( Math.abs( P ) < 0.1 ) break;
topDrive.setPower( P );
leftDrive.setPower( P );
rightDrive.setPower( P );
}
topDrive.setPower( 0 );
leftDrive.setPower( 0 );
rightDrive.setPower( 0 );
}
void TriRobotInit()
{
telemetry.addData("Status", "initializing...");
telemetry.update();
// Initialize the hardware variables. Note that the strings used here as parameters
// to 'get' must correspond to the names assigned during the robot configuration
// step (using the FTC Robot Controller app on the phone).
leftDrive = hardwareMap.get(DcMotor.class, "left");
rightDrive = hardwareMap.get(DcMotor.class, "right");
topDrive = hardwareMap.get(DcMotor.class, "pot");
//arm = hardwareMap.get(Servo.class, "arm");
hook_stop = hardwareMap.get(DigitalChannel.class, "hook_stop");
hook = hardwareMap.get(DcMotor.class, "hook");
hook_lock = hardwareMap.get(Servo.class, "hook_lock");
mascot_launcher = hardwareMap.get(Servo.class, "mascot_launcher");
hook_stop.setMode(DigitalChannel.Mode.INPUT);
leftDrive.setDirection(DcMotor.Direction.FORWARD);
rightDrive.setDirection(DcMotor.Direction.FORWARD);
topDrive.setDirection(DcMotor.Direction.FORWARD);
BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
parameters.mode = BNO055IMU.SensorMode.IMU;
parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;
parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
parameters.loggingEnabled = false;
// Retrieve and initialize the IMU. We expect the IMU to be attached to an I2C port
// on a Core Device Interface Module, configured to be a sensor of type "AdaFruit IMU",
// and named "imu".
imu = hardwareMap.get(BNO055IMU.class, "imu");
imu.initialize(parameters);
telemetry.addData("Status", "calibrating...");
telemetry.update();
// make sure the imu gyro is calibrated before continuing.
while (!isStopRequested() && !imu.isGyroCalibrated())
{
sleep(50);
idle();
}
telemetry.addData("Status", "waiting for start");
telemetry.addData("imu calib status", imu.getCalibrationStatus().toString());
telemetry.update();
//Remove lock
hook_lock.setPosition(0.5);
sleep(1500);
double t_start = getRuntime();
while( hook_stop.getState() == true ){
double t_diff = getRuntime() - t_start;
if( t_diff > 3 ) break; // only activate motor for 3 seconds max
hook.setPower(-0.3);
}
hook.setPower(0.0);
hook_lock.setPosition(0.0);
sleep(500);
//hook_lock.setPosition(0.5);
//sleep(500);
//hook_lock.setPosition(0.0);
//sleep(500);
//small motion to cease rest on the lock
t_start = getRuntime();
hook.setPower(0.40);
sleep(300);
hook.setPower(0.0);
mascot_launcher.setPosition(0.8);
sleep(2000);
mascot_launcher.setPosition(1.0);
sleep(1000);
// Disable servo PWMs to save power
ServoImplEx mascotex = hardwareMap.get(ServoImplEx.class, "mascot_launcher");
ServoImplEx lockex = hardwareMap.get(ServoImplEx.class, "hook_lock");
mascotex.setPwmDisable();
lockex.setPwmDisable();
// The TFObjectDetector uses the camera frames from the VuforiaLocalizer, so we create that
// first.
// Wait for the game to start (driver presses PLAY)
waitForStart();
//initVuforia();
if (ClassFactory.getInstance().canCreateTFObjectDetector()) {
// initTfod();
} else {
telemetry.addData("Sorry!", "This device is not compatible with TFOD");
}
runtime.reset();
}
@Override
public void runOpMode() {
TriRobotInit();
// run until the end of the match (driver presses STOP)
while (opModeIsActive()) {
int initPos=1;
double scale=1;
double power = 0.5;
gTheta = 0.0;
//GoSq(power);
FirstMotion(initPos,scale,power);
break;
}
}
private int FindGold2(){return 3;}
private int FindGold() {
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
*/
VuforiaLocalizer vuforia;
/**
* {@link #tfod} is the variable we will use to store our instance of the Tensor Flow Object
* Detection engine.
*/
TFObjectDetector tfod;
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
parameters.vuforiaLicenseKey = VUFORIA_KEY;
parameters.cameraDirection = CameraDirection.BACK;
// Instantiate the Vuforia engine
vuforia = ClassFactory.getInstance().createVuforia(parameters);
// Loading trackables is not necessary for the Tensor Flow Object Detection engine.
/**
* Initialize the Tensor Flow Object Detection engine.
*/
if (ClassFactory.getInstance().canCreateTFObjectDetector()) {
int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(
"tfodMonitorViewId", "id", hardwareMap.appContext.getPackageName());
TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);
tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);
tfod.loadModelFromAsset(TFOD_MODEL_ASSET, LABEL_GOLD_MINERAL, LABEL_SILVER_MINERAL);
tfod.activate();
} else {
telemetry.addData("Sorry!", "This device is not compatible with TFOD");
return 3;
}
int Npos1=0;
int Npos2=0;
int Npos3=0;
int NposSilver1=0;
int NposSilver2=0;
int NposSilver3=0;
double t_start = getRuntime();
while (opModeIsActive()) {
if( (getRuntime() - t_start ) > 3.5) break;
if (Npos1 >=5 || Npos2>=5 || Npos3>=5)break;
if (NposSilver1>=5 && NposSilver2>=5)break;
if (NposSilver2>=5 && NposSilver3>=5)break;
if (NposSilver1>=5 && NposSilver3>=5)break;
if (tfod != null) {
// getUpdatedRecognitions() will return null if no new information is available since
// the last time that call was made.
List<Recognition> updatedRecognitions = tfod.getUpdatedRecognitions();
if (updatedRecognitions != null) {
//telemetry.addData("# Object Detected", updatedRecognitions.size());
//if (updatedRecognitions.size() == 3) {
int goldMineralX = -1;
int silverMineralX = -1;
for (Recognition recognition : updatedRecognitions) {
if (recognition.getLabel().equals(LABEL_GOLD_MINERAL)) {
goldMineralX = (int) recognition.getLeft();
telemetry.addData("gold position", goldMineralX);
if(goldMineralX<300) {
Npos1++;
telemetry.addData("loc", 1);
}else if(goldMineralX<800){
Npos2++;
telemetry.addData("loc", 2);
}else{
Npos3++;
telemetry.addData("loc", 3);
}
}
if (recognition.getLabel().equals(LABEL_SILVER_MINERAL)) {
silverMineralX = (int) recognition.getLeft();
telemetry.addData("silver position", silverMineralX);
if(silverMineralX<300) {
NposSilver1++;
telemetry.addData("loc", 1);
}else if(silverMineralX<300){
NposSilver2++;
telemetry.addData("loc", 2);
}else{
NposSilver3++;
telemetry.addData("loc", 3);
}
}
}
telemetry.update();
}
}
}
if (tfod != null) {
tfod.shutdown();
}
telemetry.addData("", 2);
if (Npos1>=5)return 1;
if (Npos2>=5)return 2;
if (Npos3>=5)return 3;
if (NposSilver1>=5 && NposSilver2>=5)return 3;
if (NposSilver2>=5 && NposSilver3>=5)return 1;
if (NposSilver1>=5 && NposSilver3>=5)return 2;
return 3;
}
}
|
[
"[email protected]"
] | |
ad957044396ef6454559146bf72012290d9db0a9
|
0dfbe8f98be8f04e9aad102bef22479f37b6ebe7
|
/2.JavaCore/src/com/javarush/task/task12/task1224/Solution.java
|
57e0d096322eb25b3a9a26ca1cab06be107645fd
|
[] |
no_license
|
evgeniykarpenko/MyJavaRushTasks
|
4a6134bad734bac5cadd7d7591b82a89ea9dc4db
|
07aeab9e89c89f0ddf38ea3c1b3ccb78a0d4f5ce
|
refs/heads/master
| 2020-04-18T04:17:58.702797 | 2019-02-20T19:56:12 | 2019-02-20T19:56:12 | 167,233,011 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 945 |
java
|
package com.javarush.task.task12.task1224;
/*
Неведома зверушка
*/
public class Solution {
public static void main(String[] args) {
System.out.println(getObjectType(new Cat()));
System.out.println(getObjectType(new Tiger()));
System.out.println(getObjectType(new Lion()));
System.out.println(getObjectType(new Bull()));
System.out.println(getObjectType(new Pig()));
}
public static String getObjectType(Object o) {
//напишите тут ваш код
if(o instanceof Cat) return "Кот";
else if(o instanceof Tiger) return "Тигр";
else if(o instanceof Lion) return "Лев";
else if(o instanceof Bull) return "Бык";
return "хз";
}
public static class Cat {
}
public static class Tiger {
}
public static class Lion {
}
public static class Bull {
}
public static class Pig {
}
}
|
[
"[email protected]"
] | |
6f24b5c4a14c2854c4f8a5e3360756d294a0538c
|
3111b2c3aac3aff2f73a5df590e9272207cd2fae
|
/IncomeTax/src/BSIL/IncomeTax.java
|
a4c2a71d315d60b09d0eb9e6c684149031f8df4a
|
[] |
no_license
|
sking115422/OOP-Concepts
|
fd01cde8a2ef4e174e981e257b005dee21b2907b
|
a74c6e0267932d536b1a5ad9472cecf06d0bda72
|
refs/heads/main
| 2023-04-19T06:32:43.123720 | 2021-05-13T18:32:51 | 2021-05-13T18:32:51 | 367,140,424 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,606 |
java
|
// Class: CS5000
// Term: Summer 2020
// Name: Spencer King
// Instructor: Dr. Haddad
// Assignment: 2 - P1
// IDE: IntelliJ IDEA
package BSIL;
import java.util.Scanner; //Import scanner class
//// The IncomeTax program below is designed to take user input of annual income as a postive integer and determine the annual income tax owed as a positive integer based on where income level falls in tax brackets.
public class IncomeTax
{
public static void main(String[] args) //Program main method
{
////Asking for user input
//Using scanner to ask for annual income inputs from user
System.out.println("Welcome to the Annual Income Tax Calculator!");
Scanner value = new Scanner(System.in);
System.out.println("Please enter your annual income as a positive integer: ");
////Declarations
int annualIncome = value.nextInt();
double annualTax = 0;
String taxBracket = "";
////Calculations
//Calculations are based on conditional if-then statements
if (annualIncome <= 30000) { //If annual income is less than or equal to $30,000, then multiply the user inputted annual income value by tax bracket rate of 3%.
annualTax = annualIncome * .03;
taxBracket = "3%";
}
else if ((30000 < annualIncome) && (annualIncome <= 70000)){ //If annual income is greater than min bound (in this case $30,000) and less than or equal to the max bound (in this case $70,000),
annualTax = 30000 * .03 + (annualIncome - 30000) * .10; //Then multiply the user inputted annual income value less the max bound of the previous bracket by tax bracket rate (in this case 10%).
taxBracket = "10%"; //Then add back the max bound of all previous bracket multiplied by the tax rate for each respective bracket.
} //The total sum will represent the annual tax owed
else if ((70000 < annualIncome) && (annualIncome <= 150000)){ //The same logic will hold for all all tax brackets
annualTax = 30000 * .03 + 40000 * .10 + (annualIncome - 70000) * .15;
taxBracket = "15%";
}
else if ((150000 < annualIncome) && (annualIncome <= 300000)){
annualTax = 30000 * .03 + 40000 * .10 + 80000 * .15 + (annualIncome - 150000) * .20;
taxBracket = "20%";
}
else if ((300000 < annualIncome) && (annualIncome <= 900000)){
annualTax = 30000 * .03 + 40000 * .10 + 80000 * .15 + 150000 * .20 + (annualIncome - 300000) * .35;
taxBracket = "35%";
}
else if (900000 < annualIncome){
annualTax = 30000 * .03 + 40000 * .10 + 80000 * .15 + 150000 * .20 + 600000 * .35 + (annualIncome - 900000) * .40;
taxBracket = "40%";
}
////Outputs
//Print outs of income input, tax bracket the income falls in, and tax amount owed.
System.out.print("\nYour income:\t\t$");
System.out.println(annualIncome);
System.out.print("Your tax bracket:\t");
System.out.println(taxBracket);
System.out.print("Your tax amount:\t$");
System.out.print(Math.round(annualTax));
System.out.println();
}
}
|
[
"[email protected]"
] | |
42a41b3279ce6fc44fea40be001fe51b4daef134
|
26908461069eb39d8868a9dccd0de1c67453dcab
|
/lab2/leo/BankTeller.java
|
f1f5aa31dab08cbb6f6ec0907e829e6ffbebf84c
|
[] |
no_license
|
andrewip1027/JAVA745
|
5c4c940d937904edc5586cae647488d53c5d1e96
|
93fd15928380e0c04c8f722f6efbf39a084b7209
|
refs/heads/master
| 2020-12-26T12:23:57.675272 | 2020-07-23T21:11:53 | 2020-07-23T21:11:53 | 237,508,651 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,350 |
java
|
import java.util.Scanner;
/**
* This is an application which models a bank teller system which
* allows the user to create accounts and allows for withdrawal and deposits.
*
* The code is partially complete and was written during the
* JAV 745 lecture on September 16.
*
*/
/**
* @author EDEN.BURTON
*
*/
public class BankTeller {
/**
* Main execution thread of the program
*
* @param args , not used in this application
*
*/
public static void main(String[] args) {
// create accounts
// ask for number of accounts
Scanner input = new Scanner(System.in);
System.out.println("How many accounts would you like to create?");
int numOfAccounts = input.nextInt();
// allocate storage for account objects
BankAccount[] account = new BankAccount[numOfAccounts];
// counter that is used to generate new account
// numbers. Account numbers are distributed by
// the system to ensure uniqueness.
int currentAccNum = 7000;
// iteration structure is used to
for (int x = 0; x < numOfAccounts; x++) {
// initialize a account
System.out.print("name of account holder\n");
String acctName = input.next();
currentAccNum = currentAccNum + 1;
account[x] = new BankAccount(acctName, currentAccNum);
String[] accountInfo = account[x].getInfo();
System.out.printf("new account created, name: %s account number %d\n"
, accountInfo[0], Integer.parseInt(accountInfo[1]));
System.out.println("Account created on " + account[x].getInfo()[2] + "\n");
}
int choice;
do {
// menu options
System.out.println("What do you want to do?");
System.out.println("1. Deposit");
System.out.println("2. Withdraw");
System.out.println("3. Show Balance");
System.out.println("4. Exit");
choice = input.nextInt();
if(choice == 1) {
// deposit
// get account number from user
System.out.println("\nWhich account to you want to deposit to?");
int acctNumDep = input.nextInt();
// find account number
int d = 0;
while ((Integer.parseInt(account[d].getInfo()[1]) != acctNumDep) && (d < numOfAccounts))
d++;
// deposit money into account selected
if (d < numOfAccounts ) {
System.out.println("How much to deposit?");
account[d].deposit(input.nextDouble());
System.out.printf("account updated, name: %s account number %d, bal: $%.2f!\n\n"
,account[d].getInfo()[0], Integer.parseInt(account[d].getInfo()[1]), account[d].showBalance());
} else {
System.out.println("\nInvalid account number\n");
}
}else if(choice == 2) {
// withdrawal
// get account number from user
System.out.println("\nWhich account to you want to withdraw from?");
int acctNumDep = input.nextInt();
// find account number
int d = 0;
while ((Integer.parseInt(account[d].getInfo()[1]) != acctNumDep) && (d < numOfAccounts))
d++;
// withdraw money from account selected
if (d < numOfAccounts ) {
System.out.println("How much to withdraw?");
account[d].withdraw(input.nextDouble());
System.out.printf("account updated, name: %s account number %d, bal: $%.2f!\n\n"
,account[d].getInfo()[0], Integer.parseInt(account[d].getInfo()[1]), account[d].showBalance());
} else {
System.out.println("\nInvalid account number\n");
}
}else if(choice == 3) {
//show balance
// get account number from user
System.out.println("\nWhich account to you want to show balance from?");
int acctNumDep = input.nextInt();
// find account number
int d = 0;
while ((Integer.parseInt(account[d].getInfo()[1]) != acctNumDep) && (d < numOfAccounts))
d++;
//show balance from account selected
if (d < numOfAccounts ) {
System.out.printf("account name: %s account number %d, current balance: $%.2f!\n\n"
,account[d].getInfo()[0], Integer.parseInt(account[d].getInfo()[1]), account[d].showBalance());
} else {
System.out.println("\nInvalid account number\n");
}
}else if(choice == 4) {
// exit
System.out.println("\nThank you very much. Have a nice day!\n");
}else{
// invalid
System.out.println("\nPlease select the available options.\n");
}
} while(choice != 4);
}
}
|
[
"[email protected]"
] | |
52b0a123e5c6200edd29e3bf2cca7e0f70f2d5af
|
7814fb0d5e6e12a5010f3e238120603103b351d1
|
/testData.java
|
2b48ff123de3673494a0be88ecd7864db65370f7
|
[] |
no_license
|
LeifHelbig/Systemudvikling2021
|
3655ae2647bdce45b174a98e93fc933cc6548c56
|
dba042974776d66f178668b365ac5deafd2d6f3c
|
refs/heads/main
| 2023-05-30T21:34:24.866487 | 2021-06-14T20:56:41 | 2021-06-14T20:56:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,107 |
java
|
package sample;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import java.sql.*;
import java.time.LocalDate;
public class testData {
public Boolean getResult() {
return result;
}
public void setResult(Boolean result) {
this.result = result;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public LocalDate getTestDate() {
return testDate;
}
public void setTestDate(LocalDate testDate) {
this.testDate = testDate;
}
public Integer getIdHP() {
return idHP;
}
public void setIdHP(Integer idHP) {
this.idHP = idHP;
}
public testData(Boolean result, String type, LocalDate testDate, Integer idHP) {
this.result = result;
this.type = type;
this.testDate = testDate;
this.idHP = idHP;
}
private Boolean result;
private String type;
private LocalDate testDate;
private Integer idHP;
public static boolean getTestData(String CPR) throws SQLException {
ObservableList<testData> list = FXCollections.observableArrayList();
try (Connection conn = DriverManager.getConnection(Database.getUrl(), null, Database.getPwd())){
PreparedStatement ps = conn.prepareStatement("Select * FROM cdb.test Where CPR =" + CPR);
ResultSet rs = ps.executeQuery();{
while (rs.next()) {
Boolean result = rs.getBoolean("result");
String type = rs.getString("type");
LocalDate testDate = rs.getDate("testDate").toLocalDate();
Integer idHP = rs.getInt("idHP");
list.add(new testData(result, type, testDate, idHP));
}
}
} catch (SQLException ex){
System.out.println(ex.getMessage());
}
System.out.println(list);
return true;
}
}
|
[
"[email protected]"
] | |
e07361d51c4c5c33f54b82bc9df6dcf3674c15ef
|
6e57bdc0a6cd18f9f546559875256c4570256c45
|
/packages/apps/Launcher3/quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
|
b7cffa7a9d698ee77b21402ae29acc6a02e7ec0e
|
[
"Apache-2.0"
] |
permissive
|
dongdong331/test
|
969d6e945f7f21a5819cd1d5f536d12c552e825c
|
2ba7bcea4f9d9715cbb1c4e69271f7b185a0786e
|
refs/heads/master
| 2023-03-07T06:56:55.210503 | 2020-12-07T04:15:33 | 2020-12-07T04:15:33 | 134,398,935 | 2 | 1 | null | 2022-11-21T07:53:41 | 2018-05-22T10:26:42 | null |
UTF-8
|
Java
| false | false | 3,104 |
java
|
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.uioverrides;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import android.view.MotionEvent;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.views.RecentsView;
import com.sprd.ext.multimode.MultiModeController;
/**
* Touch controller from going from OVERVIEW to ALL_APPS.
*
* This is used in landscape mode. It is also used in portrait mode for the fallback recents.
*/
public class OverviewToAllAppsTouchController extends PortraitStatesTouchController {
public OverviewToAllAppsTouchController(Launcher l) {
super(l);
}
@Override
protected boolean canInterceptTouch(MotionEvent ev) {
if (mCurrentAnimation != null) {
// If we are already animating from a previous state, we can intercept.
return true;
}
if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
return false;
}
if (mLauncher.isInState(ALL_APPS)) {
// In all-apps only listen if the container cannot scroll itself
return mLauncher.getAppsView().shouldContainerScroll(ev);
} else if (mLauncher.isInState(NORMAL)) {
return !MultiModeController.isSingleLayerMode();
} else if (mLauncher.isInState(OVERVIEW)) {
RecentsView rv = mLauncher.getOverviewPanel();
return !MultiModeController.isSingleLayerMode() && ev.getY() > (rv.getBottom() - rv.getPaddingBottom());
} else {
return false;
}
}
@Override
protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
if (fromState == ALL_APPS && !isDragTowardPositive) {
// Should swipe down go to OVERVIEW instead?
return TouchInteractionService.isConnected() ?
mLauncher.getStateManager().getLastState() : NORMAL;
} else if (isDragTowardPositive) {
return ALL_APPS;
}
return fromState;
}
@Override
protected int getLogContainerTypeForNormalState() {
return LauncherLogProto.ContainerType.WORKSPACE;
}
}
|
[
"[email protected]"
] | |
dd2a04f2f6b8759a21861f038e26d2c16443a47a
|
5ec8ce07ca8bdc56a1c7bbaca306a32a8876108a
|
/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContextDecoratorFactory.java
|
6f711920ff7d56be7ed83a149f36728559d97a2c
|
[
"Apache-2.0"
] |
permissive
|
wornxiao/shardingsphere
|
c2c5b0c4ebe91f248bdb504529ced0dd1084810a
|
04cbfa2a807811e15a80148351f6ca5d01c83da0
|
refs/heads/master
| 2022-10-21T20:11:10.042821 | 2022-07-17T06:33:44 | 2022-07-17T06:33:44 | 272,212,232 | 1 | 0 |
Apache-2.0
| 2020-06-14T13:54:42 | 2020-06-14T13:54:41 | null |
UTF-8
|
Java
| false | false | 1,837 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.infra.rewrite.context;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
import java.util.Collection;
import java.util.Map;
/**
* SQL rewrite context decorator factory.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SQLRewriteContextDecoratorFactory {
static {
ShardingSphereServiceLoader.register(SQLRewriteContextDecorator.class);
}
/**
* Get instance of SQL rewrite context decorator.
*
* @param rules rules
* @return got instance
*/
@SuppressWarnings("rawtypes")
public static Map<ShardingSphereRule, SQLRewriteContextDecorator> getInstance(final Collection<ShardingSphereRule> rules) {
return OrderedSPIRegistry.getRegisteredServices(SQLRewriteContextDecorator.class, rules);
}
}
|
[
"[email protected]"
] | |
f98ac954f11dfee81b6d7c6865bd78f758d12539
|
a5d01febfd8d45a61f815b6f5ed447e25fad4959
|
/Source Code/5.27.0/sources/iqoption/operationhistory/a/a.java
|
d17d1a4fdae08c20e2af35435bfa289f0d28e403
|
[] |
no_license
|
kkagill/Decompiler-IQ-Option
|
7fe5911f90ed2490687f5d216cb2940f07b57194
|
c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6
|
refs/heads/master
| 2020-09-14T20:44:49.115289 | 2019-11-04T06:58:55 | 2019-11-04T06:58:55 | 223,236,327 | 1 | 0 | null | 2019-11-21T18:17:17 | 2019-11-21T18:17:16 | null |
UTF-8
|
Java
| false | false | 4,733 |
java
|
package iqoption.operationhistory.a;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.iqoption.core.ui.d.b;
import com.iqoption.core.ui.d.c;
import com.iqoption.core.ui.d.g;
import com.iqoption.j.a.e;
import com.iqoption.j.c.d;
import iqoption.operationhistory.OperationViewModel.FilterType;
import java.util.HashMap;
import kotlin.i;
@i(bne = {1, 1, 15}, bnf = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u0000 \u000f2\u00020\u0001:\u0001\u000fB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016J\b\u0010\u0005\u001a\u00020\u0006H\u0016J&\u0010\u0007\u001a\u0004\u0018\u00010\b2\u0006\u0010\t\u001a\u00020\n2\b\u0010\u000b\u001a\u0004\u0018\u00010\f2\b\u0010\r\u001a\u0004\u0018\u00010\u000eH\u0016¨\u0006\u0010"}, bng = {"Liqoption/operationhistory/navigator/OperationsNavigatorFragment;", "Lcom/iqoption/core/ui/navigation/BaseStackNavigatorFragment;", "()V", "getContainerId", "", "getInitialEntry", "Lcom/iqoption/core/ui/navigation/NavigatorEntry;", "onCreateView", "Landroid/view/View;", "inflater", "Landroid/view/LayoutInflater;", "container", "Landroid/view/ViewGroup;", "savedInstanceState", "Landroid/os/Bundle;", "Companion", "operationhistory_release"})
/* compiled from: OperationsNavigatorFragment.kt */
public final class a extends b {
private static final String TAG;
public static final a eVh = new a();
private HashMap apm;
@i(bne = {1, 1, 15}, bnf = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0002J\u0006\u0010\t\u001a\u00020\nJ\u000e\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\bJ\u0016\u0010\r\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\u000e\u001a\u00020\u000fR\u000e\u0010\u0003\u001a\u00020\u0004X\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, bng = {"Liqoption/operationhistory/navigator/OperationsNavigatorFragment$Companion;", "", "()V", "TAG", "", "getNavigator", "Liqoption/operationhistory/navigator/OperationsNavigatorFragment;", "current", "Landroidx/fragment/app/Fragment;", "navEntry", "Lcom/iqoption/core/ui/navigation/NavigatorEntry;", "showSearchResult", "", "showSelectOptions", "filterType", "Liqoption/operationhistory/OperationViewModel$FilterType;", "operationhistory_release"})
/* compiled from: OperationsNavigatorFragment.kt */
public static final class a {
private a() {
}
public /* synthetic */ a(f fVar) {
this();
}
public final c Lj() {
return new c(a.TAG, a.class, null, 0, 0, 0, 0, null, null, null, null, 2044, null);
}
public final void bH(Fragment fragment) {
kotlin.jvm.internal.i.f(fragment, "current");
g.a(bI(fragment).alE(), iqoption.operationhistory.b.b.eVl.Lj(), false, 2, null);
}
public final void a(Fragment fragment, FilterType filterType) {
kotlin.jvm.internal.i.f(fragment, "current");
kotlin.jvm.internal.i.f(filterType, "filterType");
g.a(bI(fragment).alE(), iqoption.operationhistory.select.b.eVx.g(filterType), false, 2, null);
}
private final a bI(Fragment fragment) {
return (a) com.iqoption.core.ext.a.a(fragment, a.class);
}
}
public void Bj() {
HashMap hashMap = this.apm;
if (hashMap != null) {
hashMap.clear();
}
}
public /* synthetic */ void onDestroyView() {
super.onDestroyView();
Bj();
}
static {
String name = a.class.getName();
if (name == null) {
kotlin.jvm.internal.i.bnJ();
}
TAG = name;
}
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
kotlin.jvm.internal.i.f(layoutInflater, "inflater");
return ((e) com.iqoption.core.ext.a.a((Fragment) this, com.iqoption.j.c.e.fragment_operation_navigator, viewGroup, false, 4, null)).getRoot();
}
public int KW() {
return d.operationNavigatorContainer;
}
public c KX() {
return iqoption.operationhistory.a.eUN.Lj();
}
}
|
[
"[email protected]"
] | |
ce77beada7b970dc7d071b8e0a7fc0287742fe4a
|
f563d5aedb3441a9ff872eeb4d561dfa78ecfb9c
|
/src/headfirst/combined/djview/ControllerInterface.java
|
856490037285372de4a34382701bfe7ec0560ff4
|
[] |
no_license
|
nevenchen/headfirst
|
b1e72fd976cf8b0a52b8c8e8b89ba546e0f9a771
|
d7ec8272af10226f24de0a84ce598df281503b87
|
refs/heads/master
| 2021-01-25T03:49:36.487684 | 2019-04-24T01:37:32 | 2019-04-24T01:37:32 | 7,239,898 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 173 |
java
|
package headfirst.combined.djview;
public interface ControllerInterface {
void start();
void stop();
void increaseBPM();
void decreaseBPM();
void setBPM(int bpm);
}
|
[
"[email protected]"
] | |
c606f5c63921436815b0388ba2a4ceff6db3d758
|
d827e62db993bdf8874d9f9bb93fdd8a8a0b5881
|
/spring-boot-shiro/src/main/java/com/readbean/shiro/conf/RedisSessionDao.java
|
b38a18f8aa80e11a2d60b630ae194e900b0a0ee2
|
[] |
no_license
|
small-red-bean/spring-boot-examples
|
c3445fa87a1ca0d44a742c240533ceee20e6217d
|
2c64637fe3899ba686617ec43e9aec762ec72a01
|
refs/heads/master
| 2020-03-21T02:52:09.556870 | 2018-08-14T05:54:23 | 2018-08-14T05:54:23 | 137,885,681 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 861 |
java
|
package com.readbean.shiro.conf;
import com.readbean.shiro.util.RedisUtil;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
import org.springframework.util.SerializationUtils;
import java.io.Serializable;
import java.util.UUID;
public class RedisSessionDao extends EnterpriseCacheSessionDAO {
@Override
protected Serializable doCreate(Session session) {
Serializable sessionId = super.doCreate(session);
RedisUtil.setObject(SerializationUtils.serialize(sessionId), SerializationUtils.serialize(session));
return sessionId;
}
@Override
protected void doDelete(Session session) {
if(session == null || session.getId() == null) {
return;
}
RedisUtil.removeObject(SerializationUtils.serialize(session.getId()));
}
}
|
[
"[email protected]"
] | |
cf625249b6f289cdaa771fd5ce0a453f0f14c83f
|
a0dfd5c1ac53014855cbdb6c5baf34ee96923b79
|
/net/minecraft/scoreboard/ScoreboardSaveData.java
|
ca9366e18fe52162f2872115ea1abe1fc650eaef
|
[] |
no_license
|
a3535ed54a5ee6917a46cfa6c3f12679/5ab07bac_orizia_v1
|
13b0d93ea8cd77e82f0d2e151b00fa41559fe145
|
1b7507aabd17dea3981a765a18f0798f20815cd7
|
refs/heads/master
| 2021-05-08T16:41:38.684821 | 2018-02-12T14:56:34 | 2018-02-12T14:56:34 | 120,166,619 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,130 |
java
|
package net.minecraft.scoreboard;
import java.util.Collection;
import java.util.Iterator;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.world.WorldSavedData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ScoreboardSaveData extends WorldSavedData
{
private static final Logger logger = LogManager.getLogger();
private Scoreboard theScoreboard;
private NBTTagCompound field_96506_b;
private static final String __OBFID = "CL_00000620";
public ScoreboardSaveData()
{
this("scoreboard");
}
public ScoreboardSaveData(String p_i2310_1_)
{
super(p_i2310_1_);
}
public void func_96499_a(Scoreboard p_96499_1_)
{
this.theScoreboard = p_96499_1_;
if (this.field_96506_b != null)
{
this.readFromNBT(this.field_96506_b);
}
}
/**
* reads in data from the NBTTagCompound into this MapDataBase
*/
public void readFromNBT(NBTTagCompound p_76184_1_)
{
if (this.theScoreboard == null)
{
this.field_96506_b = p_76184_1_;
}
else
{
this.func_96501_b(p_76184_1_.getTagList("Objectives", 10));
this.func_96500_c(p_76184_1_.getTagList("PlayerScores", 10));
if (p_76184_1_.func_150297_b("DisplaySlots", 10))
{
this.func_96504_c(p_76184_1_.getCompoundTag("DisplaySlots"));
}
if (p_76184_1_.func_150297_b("Teams", 9))
{
this.func_96498_a(p_76184_1_.getTagList("Teams", 10));
}
}
}
protected void func_96498_a(NBTTagList p_96498_1_)
{
for (int var2 = 0; var2 < p_96498_1_.tagCount(); ++var2)
{
NBTTagCompound var3 = p_96498_1_.getCompoundTagAt(var2);
ScorePlayerTeam var4 = this.theScoreboard.createTeam(var3.getString("Name"));
var4.setTeamName(var3.getString("DisplayName"));
var4.setNamePrefix(var3.getString("Prefix"));
var4.setNameSuffix(var3.getString("Suffix"));
if (var3.func_150297_b("AllowFriendlyFire", 99))
{
var4.setAllowFriendlyFire(var3.getBoolean("AllowFriendlyFire"));
}
if (var3.func_150297_b("SeeFriendlyInvisibles", 99))
{
var4.setSeeFriendlyInvisiblesEnabled(var3.getBoolean("SeeFriendlyInvisibles"));
}
this.func_96502_a(var4, var3.getTagList("Players", 8));
}
}
protected void func_96502_a(ScorePlayerTeam p_96502_1_, NBTTagList p_96502_2_)
{
for (int var3 = 0; var3 < p_96502_2_.tagCount(); ++var3)
{
this.theScoreboard.func_151392_a(p_96502_2_.getStringTagAt(var3), p_96502_1_.getRegisteredName());
}
}
protected void func_96504_c(NBTTagCompound p_96504_1_)
{
for (int var2 = 0; var2 < 3; ++var2)
{
if (p_96504_1_.func_150297_b("slot_" + var2, 8))
{
String var3 = p_96504_1_.getString("slot_" + var2);
ScoreObjective var4 = this.theScoreboard.getObjective(var3);
this.theScoreboard.func_96530_a(var2, var4);
}
}
}
protected void func_96501_b(NBTTagList p_96501_1_)
{
for (int var2 = 0; var2 < p_96501_1_.tagCount(); ++var2)
{
NBTTagCompound var3 = p_96501_1_.getCompoundTagAt(var2);
IScoreObjectiveCriteria var4 = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.field_96643_a.get(var3.getString("CriteriaName"));
ScoreObjective var5 = this.theScoreboard.addScoreObjective(var3.getString("Name"), var4);
var5.setDisplayName(var3.getString("DisplayName"));
}
}
protected void func_96500_c(NBTTagList p_96500_1_)
{
for (int var2 = 0; var2 < p_96500_1_.tagCount(); ++var2)
{
NBTTagCompound var3 = p_96500_1_.getCompoundTagAt(var2);
ScoreObjective var4 = this.theScoreboard.getObjective(var3.getString("Objective"));
Score var5 = this.theScoreboard.func_96529_a(var3.getString("Name"), var4);
var5.func_96647_c(var3.getInteger("Score"));
}
}
/**
* write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities
*/
public void writeToNBT(NBTTagCompound p_76187_1_)
{
if (this.theScoreboard == null)
{
logger.warn("Tried to save scoreboard without having a scoreboard...");
}
else
{
p_76187_1_.setTag("Objectives", this.func_96505_b());
p_76187_1_.setTag("PlayerScores", this.func_96503_e());
p_76187_1_.setTag("Teams", this.func_96496_a());
this.func_96497_d(p_76187_1_);
}
}
protected NBTTagList func_96496_a()
{
NBTTagList var1 = new NBTTagList();
Collection var2 = this.theScoreboard.getTeams();
Iterator var3 = var2.iterator();
while (var3.hasNext())
{
ScorePlayerTeam var4 = (ScorePlayerTeam)var3.next();
NBTTagCompound var5 = new NBTTagCompound();
var5.setString("Name", var4.getRegisteredName());
var5.setString("DisplayName", var4.func_96669_c());
var5.setString("Prefix", var4.getColorPrefix());
var5.setString("Suffix", var4.getColorSuffix());
var5.setBoolean("AllowFriendlyFire", var4.getAllowFriendlyFire());
var5.setBoolean("SeeFriendlyInvisibles", var4.func_98297_h());
NBTTagList var6 = new NBTTagList();
Iterator var7 = var4.getMembershipCollection().iterator();
while (var7.hasNext())
{
String var8 = (String)var7.next();
var6.appendTag(new NBTTagString(var8));
}
var5.setTag("Players", var6);
var1.appendTag(var5);
}
return var1;
}
protected void func_96497_d(NBTTagCompound p_96497_1_)
{
NBTTagCompound var2 = new NBTTagCompound();
boolean var3 = false;
for (int var4 = 0; var4 < 3; ++var4)
{
ScoreObjective var5 = this.theScoreboard.func_96539_a(var4);
if (var5 != null)
{
var2.setString("slot_" + var4, var5.getName());
var3 = true;
}
}
if (var3)
{
p_96497_1_.setTag("DisplaySlots", var2);
}
}
protected NBTTagList func_96505_b()
{
NBTTagList var1 = new NBTTagList();
Collection var2 = this.theScoreboard.getScoreObjectives();
Iterator var3 = var2.iterator();
while (var3.hasNext())
{
ScoreObjective var4 = (ScoreObjective)var3.next();
NBTTagCompound var5 = new NBTTagCompound();
var5.setString("Name", var4.getName());
var5.setString("CriteriaName", var4.getCriteria().func_96636_a());
var5.setString("DisplayName", var4.getDisplayName());
var1.appendTag(var5);
}
return var1;
}
protected NBTTagList func_96503_e()
{
NBTTagList var1 = new NBTTagList();
Collection var2 = this.theScoreboard.func_96528_e();
Iterator var3 = var2.iterator();
while (var3.hasNext())
{
Score var4 = (Score)var3.next();
NBTTagCompound var5 = new NBTTagCompound();
var5.setString("Name", var4.getPlayerName());
var5.setString("Objective", var4.func_96645_d().getName());
var5.setInteger("Score", var4.getScorePoints());
var1.appendTag(var5);
}
return var1;
}
}
|
[
"[email protected]"
] | |
fcbb10432d47fa510b2fbdf954d9a704442313cf
|
aa62e29f3c1a73146d8f97fbe4950d052ae21d75
|
/src/control/QEncrypt.java
|
bf784fdb93e2208d94c0c7ee042234a920696883
|
[] |
no_license
|
arieldossantos/db-project
|
f0518fa4b803f784763d3da6963286db3673a620
|
e7dbf3af1e41a3b90a117c8321f9807e90f874a9
|
refs/heads/master
| 2021-01-19T14:59:32.672080 | 2017-08-10T12:27:25 | 2017-08-10T12:27:25 | 86,649,566 | 2 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 882 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package control;
import java.util.Base64;
/**
*
* @author Ariel Reis
*
* Criptografa a senha do usuário
*/
public class QEncrypt {
private String encrypted;
private String decrypted;
public QEncrypt(String password){
byte[] encrypt = Base64.getEncoder().encode(password.getBytes());
this.encrypted = new String(encrypt);
byte[] decrypt = Base64.getDecoder().decode(encrypt);
this.decrypted = new String(decrypt);
}
public String getEncrypted() {
return encrypted;
}
/**
* Não use
* @deprecated
* @return
*/
public String getDecrypted() {
return null;
}
}
|
[
"[email protected]"
] | |
08732d55125ee15f2549865c5404024793b36b72
|
588a3f2c0aa67aee2e9a121d698269352281c82e
|
/src/main/java/com/niit/DAO/ForumCommentsDAO.java
|
61f362c1fdd384ec2c28f741c864dd2f84e1abe6
|
[] |
no_license
|
supraja96/CollaborationBackend
|
c1c120aa02337e5c849f0db4bbc657003edbbf32
|
26e669b03b0fd350bf934a6393cde6f09c5e6c21
|
refs/heads/master
| 2021-09-03T03:51:52.697893 | 2018-01-05T09:48:41 | 2018-01-05T09:48:41 | 116,284,700 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 455 |
java
|
package com.niit.DAO;
/*
package com.niit.DAO;
import java.util.List;
import com.niit.model.ForumComments;
public interface ForumCommentsDAO {
public boolean saveForumComments(ForumComments forumComments);
public boolean deleteForumComments(ForumComments forumComments);
public boolean updateForumComments(ForumComments forumComments);
public ForumComments getForumComments(int fComments);
public List<ForumComments> getAllForumComments();
}
*/
|
[
"[email protected]"
] | |
b1e69c6eebf9720bcba1238e4b3077bcaa55df4a
|
ae6b36ea0c1e5e8a5f52a59db155b698e1d6b558
|
/src/test/java/com/github/fge/jsonschema/old/keyword/draftv4/DraftV4KeywordValidatorTest.java
|
db5a2dd8fe664f7625e587edb07314b9c1362156
|
[] |
no_license
|
erwink/json-schema-validator
|
5eeae39fb95ead27131c689a22757dc3d97d00b1
|
dce5c64379e455488c60f8f59cfbe7ba99fbb5f8
|
refs/heads/master
| 2020-12-25T17:14:45.268780 | 2013-02-08T14:00:32 | 2013-02-08T14:00:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,215 |
java
|
/*
* Copyright (c) 2012, Francis Galiegue <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.fge.jsonschema.old.keyword.draftv4;
import com.github.fge.jsonschema.metaschema.BuiltinSchemas;
import com.github.fge.jsonschema.old.keyword.AbstractKeywordValidatorTest;
import java.io.IOException;
public abstract class DraftV4KeywordValidatorTest
extends AbstractKeywordValidatorTest
{
protected DraftV4KeywordValidatorTest(final String resourceName)
throws IOException
{
super(BuiltinSchemas.DRAFTV4_CORE, resourceName);
}
}
|
[
"[email protected]"
] | |
87eeb81089d24f8d5346ee4197bc3af310aa4402
|
69608bd648ffd361b5963d2d06165534c8b62adc
|
/MultithreadingDownloadHandler/app/src/main/java/com/example/enerjizeit/multithreadingdownloadhandler/MainActivity.java
|
2475883aa6f7abd7cce3d02190fb3af7b4fd97dd
|
[] |
no_license
|
EnerJizeIT/projects
|
3f4bced73d9be2e6915b00e37190529bc029ee8d
|
56483af9ceefcd4f33dbab566fcd72db60da1fbe
|
refs/heads/master
| 2021-01-09T20:09:05.336947 | 2016-08-15T11:39:26 | 2016-08-15T11:39:26 | 65,727,687 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,679 |
java
|
package com.example.enerjizeit.multithreadingdownloadhandler;
import android.net.Uri;
import android.os.Environment;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
private EditText editText;
private ListView listView;
private String [] listOfImages;
private LinearLayout loadingSection = null;
private Handler handler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = (EditText)findViewById(R.id.textView);
listView = (ListView)findViewById(R.id.listView);
listView.setOnItemClickListener(this);
loadingSection = (LinearLayout)findViewById(R.id.loadLinear);
listOfImages = getResources().getStringArray(R.array.imageUrls);
handler = new Handler();
}
public void downloadingButton(View view){
String url = editText.getText().toString();
Thread myThread = new Thread(new DownloadThread(url));
myThread.start();
File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
L.l("downloadingButton " + file.getAbsolutePath()); /* Получить путь к файлу */
Uri uri = Uri.parse(url);
L.l("downloadingButton " + uri.getLastPathSegment()); /* Получаем имя после последего / */
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
editText.setText(listOfImages[position]);
}
private boolean downloadImageUsingThreads(String url){
boolean successful = false;
HttpURLConnection connection = null;
InputStream inputStream = null;
FileOutputStream fileOutputStream = null;
try {
URL downloadURL = new URL(url);
connection = (HttpURLConnection) downloadURL.openConnection();
inputStream = connection.getInputStream();
File file = new File(Environment.getExternalStoragePublicDirectory
(Environment.DIRECTORY_PICTURES).getAbsolutePath()
+ "/" + Uri.parse(url).getLastPathSegment()); /* Мы создаём файл с именем загр файла */
L.l("downloadImageUsingThreads " + file.getAbsolutePath());
fileOutputStream = new FileOutputStream(file);
L.l("output" + fileOutputStream.toString());
int read = -1;
byte[] bytes = new byte[1024];
while((read = inputStream.read(bytes)) != -1){
L.l("downloadImageUsingThreads.read " + read);
fileOutputStream.write(bytes, 0 , read);
}
successful = true;
} catch (MalformedURLException e) {
L.l(e.toString());
} catch (IOException e) {
L.l(e.toString());
} finally {
handler.post(new Runnable() {
@Override
public void run() {
loadingSection.setVisibility(View.INVISIBLE);
}
});
if(connection != null){
connection.disconnect();
}
if(inputStream != null){
try {
inputStream.close();
} catch (IOException e) {
L.l(e.toString());
}
}
if(fileOutputStream != null){
try {
fileOutputStream.close();
} catch (IOException e) {
L.l(e.toString());
}
}
}
return successful;
}
private class DownloadThread implements Runnable{
private String url;
public DownloadThread(String st) {
url = st;
}
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
loadingSection.setVisibility(View.VISIBLE);
}
});
downloadImageUsingThreads(url);
}
}
}
|
[
"[email protected]"
] | |
4188da11fc6052973ba2065d887b547658d41d9f
|
5fd23d3b8edf19b36c2fe38c1469198b93ec2fbe
|
/src/com/bank/dao/BillDetailDAO.java
|
560e51a0596ee132f4f7d9260dcf90b458983626
|
[] |
no_license
|
mahesh4kc/test
|
8fcb91b0225cca1fb549615ac9ff1db631cfcc58
|
c69de6c06854c6e3d0f7b724296697cfb3624290
|
refs/heads/master
| 2021-07-17T06:52:32.773471 | 2018-07-07T07:55:04 | 2018-07-07T07:55:04 | 140,059,890 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 19,070 |
java
|
package com.bank.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.bank.bo.BillDetailBO;
import com.bank.helper.BillDetailHelper;
import com.bank.util.FilterClausesConstant;
public class BillDetailDAO extends BankDAO{
public static final String CLASS_NAME = "ProductTypeDatabase";
public static final String CREATE_BILL_DETAIL = "INSERT INTO BILL_DETAIL ( BILL_SEQUENCE, PRODUCT_NO, PRODUCT_DESCRIPTION, PRODUCT_QUANTITY ) " +
" VALUES ( ?,?,?,?) ";
public static final String UPDATE_BILL_DETAIL = "UPDATE BILL_DETAIL " +
" SET PRODUCT_DESCRIPTION = ?, PRODUCT_QUANTITY = ? " +
" WHERE BILL_SEQUENCE = ? AND PRODUCT_NO = ?";
public static final String DELETE_BILL_DETAIL = "DELETE FROM BILL_DETAIL WHERE BILL_SEQUENCE = ? AND PRODUCT_NO = ?";
public static final String SELECT_ALL_BILL_DETAIL = "SELECT BILL_SEQUENCE, PRODUCT_NO, PRODUCT_DESCRIPTION, PRODUCT_QUANTITY " +
" FROM BILL_DETAIL ";
public static final String SELECT_BILL_DETAIL_BY_BILL_SEQUENCE = "SELECT BILL_SEQUENCE, PRODUCT_NO, PRODUCT_DESCRIPTION, PRODUCT_QUANTITY " +
" FROM BILL_DETAIL WHERE BILL_SEQUENCE = ? ";
public static final String SELECT_BILL_DETAIL_BY_PROD_DESC_LIKE = SELECT_ALL_BILL_DETAIL + FilterClausesConstant.WHERE +
" PRODUCT_DESCRIPTION " + FilterClausesConstant.LIKE + FilterClausesConstant.QUESTIONAIRE ;
public static final String SELECT_BILL_DETAIL_BY_BILL_SEQUENCE_IN = SELECT_ALL_BILL_DETAIL + FilterClausesConstant.WHERE +
" BILL_SEQUENCE " ;
public static final String SELECT_MAX_PRODUCT_NO_FOR_BILL_SEQUENCE = "SELECT MAX(PRODUCT_NO) FROM BILL_DETAIL WHERE BILL_SEQUENCE = ? ";
public static final String ORDER_BY_BILL_DETAIL = " ORDER BY BILL_SEQUENCE,PRODUCT_NO ";
public static final String DELETE_BILL_DETAILS = "DELETE FROM BILL_DETAIL WHERE BILL_SEQUENCE = ? ";
//Connection objConnection;
//PreparedStatement objPreparedStatement;
private String jndiName;
public String getJndiName() {
return this.jndiName;
}
public void setJndiName(String jndiName) {
this.jndiName = jndiName;
}
/*
*
*/
public BillDetailDAO(String jndiName) {
super();
//objConnection = getConnection(jndiName);
this.jndiName = jndiName;
}
private void createBillDetail(List<BillDetailBO> billDetailList , Integer billSequence) throws SQLException{
//final String METHOD_NAME = "createBillDetail";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
int noOfInsertedRecords[];
int productNoForBillSequence =0;
try{
//System.out.println("createBillDetail : " );
//objConnection = getConnection();
objPreparedStatement = objConnection.prepareStatement(CREATE_BILL_DETAIL);
productNoForBillSequence = getMaxProductNoForBillSequence(billSequence);
for(BillDetailBO billDetailBO: billDetailList){
if(billDetailBO != null && billDetailBO.getProductNumber().intValue() == 0 &&
billDetailBO.getProductDescription().length() > 0){
objPreparedStatement.setInt(1,billSequence);
objPreparedStatement.setInt(2, productNoForBillSequence);
objPreparedStatement.setString(3, billDetailBO.getProductDescription().toUpperCase());
objPreparedStatement.setInt(4, billDetailBO.getProductQuantity());
objPreparedStatement.addBatch();
productNoForBillSequence = productNoForBillSequence+1;
}
}
noOfInsertedRecords = objPreparedStatement.executeBatch();
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
objPreparedStatement = null;
objConnection = null;
}
}
private void updateBillDetail(List<BillDetailBO> billDetailList , Integer billSequence){
final String METHOD_NAME = "updateProductType";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
int noOfInsertedRecords[];
try{
System.out.println("updateProductType : ");
//objConnection = getConnection();
objPreparedStatement = objConnection.prepareStatement(UPDATE_BILL_DETAIL);
//System.out.println("updateProductType : " + billDetailList.size());
for(BillDetailBO billDetailBO: billDetailList){
if(billDetailBO != null ){
objPreparedStatement.setString(1, billDetailBO.getProductDescription().toUpperCase());
objPreparedStatement.setInt(2, billDetailBO.getProductQuantity());
objPreparedStatement.setInt(3,billSequence);
objPreparedStatement.setInt(4, billDetailBO.getProductNumber());
objPreparedStatement.addBatch();
}
}
noOfInsertedRecords = objPreparedStatement.executeBatch();
}
catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
objPreparedStatement = null;
objConnection = null;
}
}
private void deleteBillDetail(List<BillDetailBO> billDetailList , Integer billSequence){
final String METHOD_NAME = "deleteProductType";
@SuppressWarnings("unused")
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
int noOfInsertedRecords[];
try{
//objConnection = getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(DELETE_BILL_DETAIL);
for(BillDetailBO billDetailBO: billDetailList){
if(billDetailBO != null && billDetailBO.getChecked()){
objPreparedStatement.setInt(1,billSequence);
objPreparedStatement.setInt(2, billDetailBO.getProductNumber());
objPreparedStatement.addBatch();
}
}
noOfInsertedRecords = objPreparedStatement.executeBatch();
}catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
objPreparedStatement = null;
objConnection = null;
}
}
public void deleteBillDetails( Integer billSequence){
final String METHOD_NAME = "deleteProductType";
@SuppressWarnings("unused")
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
boolean deleteSuccess;
int noOfInsertedRecords[];
try{
//objConnection = getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(DELETE_BILL_DETAILS);
objPreparedStatement.setInt(1,billSequence);
deleteSuccess = objPreparedStatement.execute();
}catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
objPreparedStatement = null;
objConnection = null;
}
}
/* public ProductTypeBO updateProductType(ProductTypeBO objProductTypeBO ){
final String METHOD_NAME = "updateProductType";
int noOfInsertedRecords =0;
try{
objConnection = new MySQLConnection().getConnection();
System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(UPDATE_PRODUCT_TYPE);
objPreparedStatement.setString(1, objProductTypeBO.getProductTypeCode().toUpperCase());
objPreparedStatement.setString(2, objProductTypeBO.getProductTypeDescription().toUpperCase());
objPreparedStatement.setDouble(3, objProductTypeBO.getProductTypeRateOfInterest());
objPreparedStatement.setInt(4, objProductTypeBO.getProductTypeNo());
noOfInsertedRecords = objPreparedStatement.executeUpdate();
System.out.println(noOfInsertedRecords + " Record updated");
}
catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}
return objProductTypeBO;
}*/
/*public int deleteProductType(ProductTypeBO objProductTypeBO ){
final String METHOD_NAME = "deleteProductType";
int noOfInsertedRecords =0;
try{
objConnection = new MySQLConnection().getConnection();
System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(DELETE_PRODUCT_TYPE);
objPreparedStatement.setString(1, objProductTypeBO.getProductTypeCode().toUpperCase());
// objPreparedStatement.setString(2, objProductTypeBO.getProductTypeDescription().toUpperCase());
//objPreparedStatement.setDouble(3, objProductTypeBO.getProductTypeRateOfInterest());
//objPreparedStatement.setInt(4, objProductTypeBO.getProductTypeNo());
noOfInsertedRecords = objPreparedStatement.executeUpdate();
System.out.println(noOfInsertedRecords + " Record updated");
}
catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}
return noOfInsertedRecords;
}*/
public List<BillDetailBO> executeAllBillDetails() throws SQLException,Exception{
//final String METHOD_NAME = "executeAllBillDetails";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
ResultSet resultSet = null;
List<BillDetailBO> billDetailList = new ArrayList<BillDetailBO>();
try{
//objConnection = getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(SELECT_ALL_BILL_DETAIL + ORDER_BY_BILL_DETAIL);
resultSet = objPreparedStatement.executeQuery();
BillDetailHelper.setBillDetailListFromResultSet(resultSet, billDetailList);
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultSet = null;
objPreparedStatement = null;
objConnection = null;
}
return billDetailList;
}
public List<BillDetailBO> executeAllBillDetails(String productDescription) throws SQLException,Exception{
//final String METHOD_NAME = "executeAllBillDetails";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
ResultSet resultSet = null;
List<BillDetailBO> billDetailList = new ArrayList<BillDetailBO>();
try{
//objConnection = getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed() + SELECT_BILL_DETAIL_BY_PROD_DESC_LIKE + productDescription);
objPreparedStatement = objConnection.prepareStatement(SELECT_BILL_DETAIL_BY_PROD_DESC_LIKE + ORDER_BY_BILL_DETAIL);
objPreparedStatement.setString(1, productDescription+"%");
resultSet = objPreparedStatement.executeQuery();
BillDetailHelper.setBillDetailListFromResultSet(resultSet, billDetailList);
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultSet = null;
objPreparedStatement = null;
objConnection = null;
}
return billDetailList;
}
public List<BillDetailBO> executeAllBillDetailsUsingBillSequenceIn(String billSequenceNumbersUsingIn) throws SQLException,Exception{
//final String METHOD_NAME = "executeAllBillDetails";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
ResultSet resultSet = null;
List<BillDetailBO> billDetailList = new ArrayList<BillDetailBO>();
try{
//objConnection = getConnection();
/*System.out.println("executeAllBillDetailsUsingBillSequenceIn : " + SELECT_BILL_DETAIL_BY_BILL_SEQUENCE_IN
+ FilterClausesConstant.IN + FilterClausesConstant.LEFT_PARANTHESIS
+ billSequenceNumbersUsingIn + FilterClausesConstant.RIGHT_PARANTHESIS + ORDER_BY_BILL_DETAIL);*/
objPreparedStatement = objConnection.prepareStatement(SELECT_BILL_DETAIL_BY_BILL_SEQUENCE_IN + ORDER_BY_BILL_DETAIL);
//objPreparedStatement.setString(1, billSequenceNumbersUsingIn);
resultSet = objPreparedStatement.executeQuery();
BillDetailHelper.setBillDetailListFromResultSet(resultSet, billDetailList);
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultSet = null;
objPreparedStatement = null;
objConnection = null;
}
return billDetailList;
}
public List<BillDetailBO> executeBillDetailsByBillSequence(Integer billSequence) throws SQLException,Exception{
//final String METHOD_NAME = "executeBillDetailsByBillSequence";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
ResultSet resultSet = null;
List<BillDetailBO> billDetailList = null;
try{
billDetailList = new ArrayList<BillDetailBO>();
//objConnection = getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(SELECT_BILL_DETAIL_BY_BILL_SEQUENCE + ORDER_BY_BILL_DETAIL);
objPreparedStatement.setInt(1, billSequence);
resultSet = objPreparedStatement.executeQuery();
BillDetailHelper.setBillDetailListFromResultSet(resultSet, billDetailList);
}finally{
try {
objConnection.close();
resultSet.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultSet = null;
objPreparedStatement = null;
objConnection = null;
}
return billDetailList;
}
/*public List<ProductTypeBO> executeByProductTypeNoAndCode(String productTypeNo,String productTypeCode) throws SQLException{
//final String METHOD_NAME = "executeProductTypeNo";
StringBuffer queryByProductNoAndCode = new StringBuffer(SELECT_ALL_PRODUCT_TYPE);
queryByProductNoAndCode.append(" WHERE PRODUCT_TYPE_NO = ? AND PRODUCT_TYPE_CODE LIKE ? " + ORDER_BY_PRODUCT_TYPE);
List<ProductTypeBO> productTypeList = new ArrayList<ProductTypeBO>();
objConnection = new MySQLConnection().getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(queryByProductNoAndCode.toString());
objPreparedStatement.setInt(1, Integer.parseInt(productTypeNo));
objPreparedStatement.setString(2, productTypeCode+"%");
ResultSet resultSet = objPreparedStatement.executeQuery();
setProductTypeListFromResultSet(resultSet,productTypeList);
return productTypeList;
}*/
/*public List<ProductTypeBO> executeProductTypeNo(String productTypeNo )
throws SQLException,Exception{
final String METHOD_NAME = "executeProductTypeNo";
List<ProductTypeBO> productTypeList = new ArrayList<ProductTypeBO>();
try{
objConnection = new MySQLConnection().getConnection();
objPreparedStatement = objConnection.prepareStatement(SELECT_PRODUCT_TYPE_NO + ORDER_BY_PRODUCT_TYPE);
objPreparedStatement.setInt(1, Integer.parseInt(productTypeNo));
ResultSet resultSet = objPreparedStatement.executeQuery();
setProductTypeListFromResultSet(resultSet, productTypeList);
}
catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}
catch(Exception ex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + ex.getMessage());
}
return productTypeList;
}
public List<ProductTypeBO> executeProductTypeCode(String productTypeCode ){
final String METHOD_NAME = "executeProductTypeCode";
List<ProductTypeBO> productTypeList = new ArrayList<ProductTypeBO>();
try{
objConnection = new MySQLConnection().getConnection();
System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(SELECT_PRODUCT_TYPE_CODE + ORDER_BY_PRODUCT_TYPE);
System.out.println(" Value for Product Type is : " + productTypeCode);
objPreparedStatement.setString(1, productTypeCode+"%");
ResultSet resultSet = objPreparedStatement.executeQuery();
setProductTypeListFromResultSet(resultSet, productTypeList);
}
catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}
catch(Exception ex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + ex.getMessage());
}
return productTypeList;
}*/
private Integer getMaxProductNoForBillSequence(Integer billSequence){
final String METHOD_NAME = "getMaxProductNoForBillSequence";
Connection objConnection = getConnection(this.jndiName);
PreparedStatement objPreparedStatement = null;
ResultSet resultSet = null;
int maxProductNoForBillSequence =0;
try{
//objConnection = getConnection();
//System.out.println("Connection is Alive : " + !objConnection.isClosed());
objPreparedStatement = objConnection.prepareStatement(SELECT_MAX_PRODUCT_NO_FOR_BILL_SEQUENCE);
objPreparedStatement.setInt(1, billSequence);
resultSet = objPreparedStatement.executeQuery();
while (resultSet.next()){
maxProductNoForBillSequence = resultSet.getInt(1);
}
}
catch(SQLException sqlex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + sqlex.getMessage());
}
catch(Exception ex){
System.out.println("Class Name : " + CLASS_NAME + "Method Name : " +
METHOD_NAME + ex.getMessage());
}finally{
try {
objConnection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultSet = null;
objPreparedStatement = null;
objConnection = null;
}
//System.out.println("Next Sequence for Product Type : " + maxProductNoForBillSequence);
return (maxProductNoForBillSequence+1);
}
// private populateProductTypeBO(){
//}
public void createUpdateDelete(List<BillDetailBO> billDetailList, Integer billSequence ) throws SQLException{
createBillDetail(billDetailList, billSequence);
updateBillDetail(billDetailList, billSequence);
deleteBillDetail(billDetailList, billSequence);
}
}
|
[
"[email protected]"
] | |
b5294c2a5e2d0ab0dc82cb0e149ff9b7fd3001f2
|
13d0cfbe1c817d57467c7a7e1d876e8a438228db
|
/src/main/java/com/lxm/algorithm/sort/CountingSort.java
|
874268112abc5d5579a32e1bc79ef6545bd1a757
|
[] |
no_license
|
liangxm/common-algorithm
|
0f16865b60b5b21a4357c7bcedc7354a09f6fdd5
|
1803d89ee22c13571fc5ef5b832c754ea97cd97c
|
refs/heads/master
| 2020-03-30T15:31:02.022908 | 2018-10-03T05:58:02 | 2018-10-03T05:58:02 | 151,366,731 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,028 |
java
|
package com.lxm.algorithm.sort;
/**
* 计数排序算法
* <h1>算法描述</h1>
* <pre>
* 1. 找出待排序的数组中最大和最小的元素;
* 2. 统计数组中每个值为i的元素出现的次数,存入数组C的第i项;
* 3. 对所有的计数累加(从C中的第一个元素开始,每一项和前一项相加);
* 4. 反向填充目标数组:将每个元素i放在新数组的第C(i)项,每放一个元素就将C(i)减去1。
* </pre>
* @author liang
* @since 2018-10-3 09:31:06
*/
public class CountingSort extends AbstractSort {
/**
* 计数排序
* @param arr 待排序数组
* @param maxNum 数组中最大值
*/
private static void countSort(int[] arr, int maxNum) {
// 创建数组c, 并初始化
int[] b = new int[arr.length];
int[] c = new int[maxNum +1];
for(int i = 0; i < c.length; i++) {
c[i] = 0;
}
// 统计数组arr中每个元素出现的次数
for(int v:arr) {
c[v] ++;
}
/**
* 统计数组arr中小于等于某一个数的数的个数
* 因为小于等于0的数的个数就是等于0的数的个数, 所以迭代从1开始
*/
for(int i = 1; i < c.length; i++) {
c[i] = c[i] + c[i - 1];
}
for(int v:arr) {
/**
* 小于等于arr[i]的数的个数为x就应该将该数放在数组b的第x-1个位置
* 因为数组的下标从0开始
*/
b[c[v] - 1] = v;
/**
* 下一个arr[i]排在这个arr[i]的前面
* 下一个arr[i]排在前面的原因是前面为所有小于等于arr[i]的数留足了空间
*/
c[v]--;
}
System.arraycopy(b, 0, arr, 0, b.length);
}
public static void main(String[] args) {
int[] arr = new int[]{23,34,45,56,567,23,54,4,34,56,2,54,6};
countSort(arr, 567);
printArr(arr);
}
}
|
[
"[email protected]"
] | |
96ec42c300157a0ceb6e940b505bea4860975b13
|
c1cff1c44a60c2b9228a724d828958525e665934
|
/src/com/heygis/servlet/FillInfoServlet.java
|
18173778ce604a7a784011493e2c191f2082ba70
|
[] |
no_license
|
witnesslq/heygis
|
4303988d6a89c81ab5a375475109649505ee02a9
|
d81bd1bcdf8048c8680f74ce30caa9b2a8d030f1
|
refs/heads/master
| 2021-01-01T20:19:01.672560 | 2016-06-12T15:15:03 | 2016-06-12T15:15:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,254 |
java
|
package com.heygis.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heygis.beans.User;
import com.heygis.service.FillInfoService;
public class FillInfoServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
User user = new User(
((User)request.getSession().getAttribute("user")).getUid(),
request.getParameter("account"),
request.getParameter("nickName"),
request.getParameter("grade"),
request.getParameter("optionsRadios"),
request.getParameter("QQ"),
request.getParameter("tel"),
request.getParameter("selfintroduction"),
((User)request.getSession().getAttribute("user")).getIconImg());
if(new FillInfoService().fillInfo(user)){
request.getSession().setAttribute("user", user);
response.sendRedirect("selfCenterServlet");
}else{
request.setAttribute("message", "修改个人信息错误!");
request.getRequestDispatcher("result.jsp").forward(request, response);
}
}
}
|
[
"[email protected]"
] | |
0703f0901c89ecd7e4b713b04ea80875430f9c39
|
7759496f5e7801a9d3e0bfc17dff5a66457db940
|
/src/main/java/com/generator/StringTemplateTool.java
|
08755da9acb054cfb151aeeed3b5b7aa461b5c18
|
[] |
no_license
|
Law-God/jfinal2
|
925b7e3fd06870d94e6b9120c03d7524edd0c555
|
782a017b32b2b33b8d88711798b1c4697f36333e
|
refs/heads/master
| 2021-05-15T06:10:59.385308 | 2018-01-29T09:57:17 | 2018-01-29T09:57:17 | 115,292,841 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 867 |
java
|
package com.generator;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by zzk on 2017-11-22.
* 字符串模板工具
*
*/
public class StringTemplateTool {
/**
* 根据键值对填充字符串,如("${name}",{name:"xiaoming"})
* 输出:
* @param content
* @param map
* @return
*/
public static String renderString(String content, Map<String, String> map){
Set<Map.Entry<String, String>> sets = map.entrySet();
for(Map.Entry<String, String> entry : sets) {
String regex = "\\$\\{" + entry.getKey() + "\\}";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(content);
content = matcher.replaceAll(entry.getValue());
}
return content;
}
}
|
[
"[email protected]"
] | |
76cb96c76f0d6afa1a88b74348062932d2cae466
|
e233a2a2c69ce9b90399416b3ba8ddcc5076b277
|
/src/main/java/com/io/ssm/module/domain/menu/CmMenuExample.java
|
f91e997c602f8c13e0ce798c854523bcaf85634d
|
[] |
no_license
|
llyonga/ssm-java-config
|
7f8079b57705a17cbaa59d11c95a2abb85c92d10
|
a26f313377df252bfe1b2f116a8c8a4f6942a99f
|
refs/heads/master
| 2020-03-26T18:01:36.573682 | 2018-08-18T05:28:04 | 2018-08-18T05:28:04 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 29,056 |
java
|
package com.io.ssm.module.domain.menu;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class CmMenuExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public CmMenuExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andMenuIdIsNull() {
addCriterion("MENU_ID is null");
return (Criteria) this;
}
public Criteria andMenuIdIsNotNull() {
addCriterion("MENU_ID is not null");
return (Criteria) this;
}
public Criteria andMenuIdEqualTo(Long value) {
addCriterion("MENU_ID =", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotEqualTo(Long value) {
addCriterion("MENU_ID <>", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdGreaterThan(Long value) {
addCriterion("MENU_ID >", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdGreaterThanOrEqualTo(Long value) {
addCriterion("MENU_ID >=", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdLessThan(Long value) {
addCriterion("MENU_ID <", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdLessThanOrEqualTo(Long value) {
addCriterion("MENU_ID <=", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdIn(List<Long> values) {
addCriterion("MENU_ID in", values, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotIn(List<Long> values) {
addCriterion("MENU_ID not in", values, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdBetween(Long value1, Long value2) {
addCriterion("MENU_ID between", value1, value2, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotBetween(Long value1, Long value2) {
addCriterion("MENU_ID not between", value1, value2, "menuId");
return (Criteria) this;
}
public Criteria andParentIdIsNull() {
addCriterion("PARENT_ID is null");
return (Criteria) this;
}
public Criteria andParentIdIsNotNull() {
addCriterion("PARENT_ID is not null");
return (Criteria) this;
}
public Criteria andParentIdEqualTo(Long value) {
addCriterion("PARENT_ID =", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotEqualTo(Long value) {
addCriterion("PARENT_ID <>", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThan(Long value) {
addCriterion("PARENT_ID >", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThanOrEqualTo(Long value) {
addCriterion("PARENT_ID >=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThan(Long value) {
addCriterion("PARENT_ID <", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThanOrEqualTo(Long value) {
addCriterion("PARENT_ID <=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdIn(List<Long> values) {
addCriterion("PARENT_ID in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Long> values) {
addCriterion("PARENT_ID not in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdBetween(Long value1, Long value2) {
addCriterion("PARENT_ID between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotBetween(Long value1, Long value2) {
addCriterion("PARENT_ID not between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andMenuNameIsNull() {
addCriterion("MENU_NAME is null");
return (Criteria) this;
}
public Criteria andMenuNameIsNotNull() {
addCriterion("MENU_NAME is not null");
return (Criteria) this;
}
public Criteria andMenuNameEqualTo(String value) {
addCriterion("MENU_NAME =", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameNotEqualTo(String value) {
addCriterion("MENU_NAME <>", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameGreaterThan(String value) {
addCriterion("MENU_NAME >", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameGreaterThanOrEqualTo(String value) {
addCriterion("MENU_NAME >=", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameLessThan(String value) {
addCriterion("MENU_NAME <", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameLessThanOrEqualTo(String value) {
addCriterion("MENU_NAME <=", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameLike(String value) {
addCriterion("MENU_NAME like", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameNotLike(String value) {
addCriterion("MENU_NAME not like", value, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameIn(List<String> values) {
addCriterion("MENU_NAME in", values, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameNotIn(List<String> values) {
addCriterion("MENU_NAME not in", values, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameBetween(String value1, String value2) {
addCriterion("MENU_NAME between", value1, value2, "menuName");
return (Criteria) this;
}
public Criteria andMenuNameNotBetween(String value1, String value2) {
addCriterion("MENU_NAME not between", value1, value2, "menuName");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("URL is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("URL is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("URL =", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("URL <>", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("URL >", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("URL >=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("URL <", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("URL <=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("URL like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("URL not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("URL in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("URL not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("URL between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("URL not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andLevelIsNull() {
addCriterion("LEVEL is null");
return (Criteria) this;
}
public Criteria andLevelIsNotNull() {
addCriterion("LEVEL is not null");
return (Criteria) this;
}
public Criteria andLevelEqualTo(Integer value) {
addCriterion("LEVEL =", value, "level");
return (Criteria) this;
}
public Criteria andLevelNotEqualTo(Integer value) {
addCriterion("LEVEL <>", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThan(Integer value) {
addCriterion("LEVEL >", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThanOrEqualTo(Integer value) {
addCriterion("LEVEL >=", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThan(Integer value) {
addCriterion("LEVEL <", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThanOrEqualTo(Integer value) {
addCriterion("LEVEL <=", value, "level");
return (Criteria) this;
}
public Criteria andLevelIn(List<Integer> values) {
addCriterion("LEVEL in", values, "level");
return (Criteria) this;
}
public Criteria andLevelNotIn(List<Integer> values) {
addCriterion("LEVEL not in", values, "level");
return (Criteria) this;
}
public Criteria andLevelBetween(Integer value1, Integer value2) {
addCriterion("LEVEL between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andLevelNotBetween(Integer value1, Integer value2) {
addCriterion("LEVEL not between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andIconIsNull() {
addCriterion("ICON is null");
return (Criteria) this;
}
public Criteria andIconIsNotNull() {
addCriterion("ICON is not null");
return (Criteria) this;
}
public Criteria andIconEqualTo(String value) {
addCriterion("ICON =", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotEqualTo(String value) {
addCriterion("ICON <>", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThan(String value) {
addCriterion("ICON >", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThanOrEqualTo(String value) {
addCriterion("ICON >=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThan(String value) {
addCriterion("ICON <", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThanOrEqualTo(String value) {
addCriterion("ICON <=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLike(String value) {
addCriterion("ICON like", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotLike(String value) {
addCriterion("ICON not like", value, "icon");
return (Criteria) this;
}
public Criteria andIconIn(List<String> values) {
addCriterion("ICON in", values, "icon");
return (Criteria) this;
}
public Criteria andIconNotIn(List<String> values) {
addCriterion("ICON not in", values, "icon");
return (Criteria) this;
}
public Criteria andIconBetween(String value1, String value2) {
addCriterion("ICON between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andIconNotBetween(String value1, String value2) {
addCriterion("ICON not between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("TYPE is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("TYPE is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("TYPE =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("TYPE <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("TYPE >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("TYPE >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("TYPE <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("TYPE <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("TYPE like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("TYPE not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("TYPE in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("TYPE not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("TYPE between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("TYPE not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andMidIsNull() {
addCriterion("MID is null");
return (Criteria) this;
}
public Criteria andMidIsNotNull() {
addCriterion("MID is not null");
return (Criteria) this;
}
public Criteria andMidEqualTo(Integer value) {
addCriterion("MID =", value, "mid");
return (Criteria) this;
}
public Criteria andMidNotEqualTo(Integer value) {
addCriterion("MID <>", value, "mid");
return (Criteria) this;
}
public Criteria andMidGreaterThan(Integer value) {
addCriterion("MID >", value, "mid");
return (Criteria) this;
}
public Criteria andMidGreaterThanOrEqualTo(Integer value) {
addCriterion("MID >=", value, "mid");
return (Criteria) this;
}
public Criteria andMidLessThan(Integer value) {
addCriterion("MID <", value, "mid");
return (Criteria) this;
}
public Criteria andMidLessThanOrEqualTo(Integer value) {
addCriterion("MID <=", value, "mid");
return (Criteria) this;
}
public Criteria andMidIn(List<Integer> values) {
addCriterion("MID in", values, "mid");
return (Criteria) this;
}
public Criteria andMidNotIn(List<Integer> values) {
addCriterion("MID not in", values, "mid");
return (Criteria) this;
}
public Criteria andMidBetween(Integer value1, Integer value2) {
addCriterion("MID between", value1, value2, "mid");
return (Criteria) this;
}
public Criteria andMidNotBetween(Integer value1, Integer value2) {
addCriterion("MID not between", value1, value2, "mid");
return (Criteria) this;
}
public Criteria andOrderNumIsNull() {
addCriterion("ORDER_NUM is null");
return (Criteria) this;
}
public Criteria andOrderNumIsNotNull() {
addCriterion("ORDER_NUM is not null");
return (Criteria) this;
}
public Criteria andOrderNumEqualTo(Long value) {
addCriterion("ORDER_NUM =", value, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumNotEqualTo(Long value) {
addCriterion("ORDER_NUM <>", value, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumGreaterThan(Long value) {
addCriterion("ORDER_NUM >", value, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumGreaterThanOrEqualTo(Long value) {
addCriterion("ORDER_NUM >=", value, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumLessThan(Long value) {
addCriterion("ORDER_NUM <", value, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumLessThanOrEqualTo(Long value) {
addCriterion("ORDER_NUM <=", value, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumIn(List<Long> values) {
addCriterion("ORDER_NUM in", values, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumNotIn(List<Long> values) {
addCriterion("ORDER_NUM not in", values, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumBetween(Long value1, Long value2) {
addCriterion("ORDER_NUM between", value1, value2, "orderNum");
return (Criteria) this;
}
public Criteria andOrderNumNotBetween(Long value1, Long value2) {
addCriterion("ORDER_NUM not between", value1, value2, "orderNum");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("CREATE_TIME is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("CREATE_TIME is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("CREATE_TIME =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("CREATE_TIME <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("CREATE_TIME >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("CREATE_TIME >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("CREATE_TIME <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("CREATE_TIME <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("CREATE_TIME in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("CREATE_TIME not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("CREATE_TIME between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("CREATE_TIME not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andModifyTimeIsNull() {
addCriterion("MODIFY_TIME is null");
return (Criteria) this;
}
public Criteria andModifyTimeIsNotNull() {
addCriterion("MODIFY_TIME is not null");
return (Criteria) this;
}
public Criteria andModifyTimeEqualTo(Date value) {
addCriterion("MODIFY_TIME =", value, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeNotEqualTo(Date value) {
addCriterion("MODIFY_TIME <>", value, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeGreaterThan(Date value) {
addCriterion("MODIFY_TIME >", value, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeGreaterThanOrEqualTo(Date value) {
addCriterion("MODIFY_TIME >=", value, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeLessThan(Date value) {
addCriterion("MODIFY_TIME <", value, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeLessThanOrEqualTo(Date value) {
addCriterion("MODIFY_TIME <=", value, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeIn(List<Date> values) {
addCriterion("MODIFY_TIME in", values, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeNotIn(List<Date> values) {
addCriterion("MODIFY_TIME not in", values, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeBetween(Date value1, Date value2) {
addCriterion("MODIFY_TIME between", value1, value2, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeNotBetween(Date value1, Date value2) {
addCriterion("MODIFY_TIME not between", value1, value2, "modifyTime");
return (Criteria) this;
}
public Criteria andMenuNameLikeInsensitive(String value) {
addCriterion("upper(MENU_NAME) like", value.toUpperCase(), "menuName");
return (Criteria) this;
}
public Criteria andUrlLikeInsensitive(String value) {
addCriterion("upper(URL) like", value.toUpperCase(), "url");
return (Criteria) this;
}
public Criteria andIconLikeInsensitive(String value) {
addCriterion("upper(ICON) like", value.toUpperCase(), "icon");
return (Criteria) this;
}
public Criteria andTypeLikeInsensitive(String value) {
addCriterion("upper(TYPE) like", value.toUpperCase(), "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
|
[
"[email protected]"
] | |
f3bf96073e788089994bff38df5c1c66c0b8189c
|
76fe307b509a2a21d777c1d51839492e1fec3044
|
/src/main/java/quoters/ProfilingHandlerBeanPostProcessor.java
|
82e9274eae1369241594ca12786217cdba659d3b
|
[] |
no_license
|
tamaslova/Ripper
|
5a433ca87eac603ae3a503b50efec8d0eff7c9b4
|
2e369ccea11b51150156c1f238781843e821629e
|
refs/heads/master
| 2021-08-31T15:03:08.652148 | 2017-12-21T20:19:54 | 2017-12-21T20:19:54 | 114,376,699 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,178 |
java
|
package quoters;
import org.springframework.beans.factory.config.BeanPostProcessor;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.lang.management.ManagementFactory;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;
import java.util.HashMap;
public class ProfilingHandlerBeanPostProcessor implements BeanPostProcessor {
private Map<String, Class> map = new HashMap();
private ProfilingController controller = new ProfilingController();
public ProfilingHandlerBeanPostProcessor() throws Exception {
MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
platformMBeanServer.registerMBean(controller, new ObjectName("profiling", "name","controller"));
}
public Object postProcessBeforeInitialization(Object bean, String beanName){
Class<?> beanClass = bean.getClass();
if (beanClass.isAnnotationPresent(Profiling.class)){
map.put(beanName, beanClass);
}
return bean;
}
public Object postProcessAfterInitialization(final Object bean, String beanName){
Class beanClass = map.get(beanName);
if(beanClass != null){
return Proxy.newProxyInstance(beanClass.getClassLoader(), beanClass.getInterfaces(), new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (controller.isEnabled()) {
System.out.println("Профилирую...");
long before = System.nanoTime();
Object retVal = method.invoke(bean, args);
long after = System.nanoTime();
System.out.println(after - before);
System.out.println("Всё");
return retVal;
}
else{
return method.invoke(bean, args);
}
}
});
}
return bean;
}
}
|
[
"[email protected]"
] | |
3922adb41783ee20f5bfcc0420ed9cf94fe2e867
|
83c877d9b2380a6bc049d8fcf0aa62ebb7d16647
|
/src/test/java/com/SpringBoot/RestCURD/SpringBootRestCurdApplicationTests.java
|
d3c8c9f9fbfdb6f4aaf87678d44f3d29a17e4ac1
|
[] |
no_license
|
Fariha-Arifin/Springboot-Simple-REST-CURD
|
0ac973e98b9b5cc536843177ba7d316d36e8e671
|
694fa80d282140fab020ec92ee04c242a391e2b1
|
refs/heads/master
| 2023-04-20T23:09:37.215637 | 2021-05-08T08:51:24 | 2021-05-08T08:51:24 | 365,448,807 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 227 |
java
|
package com.SpringBoot.RestCURD;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringBootRestCurdApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
43ed9f0e0075e97c7b542df987b3444ec45b67d8
|
72aa2b41fa197c173ae7d47b576291b8d598c975
|
/app/src/main/java/com/timmyg/klimovlessons/myview/MyWidgetView.java
|
34900983eb078810133bcfbf91d17862494d83ea
|
[] |
no_license
|
GorshkovTimur/KlimovLessons
|
d1e73e157561ee100e51ad9bcdedd07074393ce1
|
8b39a362637509b7335752ea61560eab3798ed16
|
refs/heads/master
| 2020-11-27T13:12:36.856260 | 2020-01-30T03:58:33 | 2020-01-30T03:58:33 | 229,455,766 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,238 |
java
|
package com.timmyg.klimovlessons.myview;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
public class MyWidgetView extends View {
final int MIN_WIDTH = 300;
final int MIN_HEGIHT = 150;
final int DEFAULT_COLOR = Color.WHITE;
final int STROKE_WIDTH = 2;
private int color;
private Paint paint;
private RectF rectF;
private Path path;
public MyWidgetView(Context context) {
super(context);
init();
}
public MyWidgetView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
public MyWidgetView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
// public MyWidgetView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
// super(context, attrs, defStyleAttr, defStyleRes);
// }
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
paint.setColor(color);
paint.setStrokeWidth(STROKE_WIDTH);
canvas.drawRect(5,5,getWidth() - 5, getHeight() -5, paint);
paint.setColor(Color.GRAY);
paint.setTextSize(20);
rectF.set(22,22,getWidth() - 22, getHeight() - 22);
path.addArc(rectF, 180, 90);
canvas.drawTextOnPath("Сумасшедший", path, 0,0,paint);
path.reset();
path.addArc(rectF, 0 , 120);
canvas.drawTextOnPath("прямоугольник", path,0 ,0 , paint);
}
private void init() {
setMinimumWidth(MIN_WIDTH);
setMinimumHeight(MIN_HEGIHT);
color = DEFAULT_COLOR;
paint = new Paint();
rectF = new RectF();
path = new Path();
}
public void setColor(int color) {
this.color = color;
}
}
|
[
"[email protected]"
] | |
fe8b26c74d605f4b5d21c91c576c939dcb683c5e
|
8ecf2ff3524cc747967e776992f9976e4609ea8d
|
/src/com/example/androidgames/framework/gl/SpatialHashGrid.java
|
5a7ad4eedcd3f631de3c7ba9ee42128560ae1b6d
|
[] |
no_license
|
steelsoulson/h1
|
52d0c51ceafc80e540dcbb17fb3b65aa985b47d1
|
1be4164779fcaf244c0177367eb47b04aad3c9c3
|
refs/heads/master
| 2016-09-06T11:53:50.297328 | 2014-02-03T13:04:18 | 2014-02-03T13:04:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,423 |
java
|
package com.example.androidgames.framework.gl;
import java.util.ArrayList;
import java.util.List;
import android.util.FloatMath;
import com.example.androidgames.framework.math.Rectangle;
import com.example.androidgames.gamedev2d.GameObject;
public class SpatialHashGrid {
List<GameObject>[] dynamicCells;
List<GameObject>[] staticCells;
int cellsPerRow;
int cellsPerCol;
float cellSize;
int[] cellIds = new int[4];
List<GameObject> foundObjects;
@SuppressWarnings("unchecked")
public SpatialHashGrid(float worldWidth, float worldHeight, float cellSize) {
this.cellSize = cellSize;
this.cellsPerRow = (int)FloatMath.ceil(worldWidth / cellSize);
this.cellsPerCol = (int)FloatMath.ceil(worldHeight / cellSize);
int numCells = cellsPerRow * cellsPerCol;
dynamicCells = new List[numCells];
staticCells = new List[numCells];
for (int i = 0; i < numCells; i++) {
dynamicCells[i] = new ArrayList<GameObject>(10);
staticCells[i] = new ArrayList<GameObject>(10);
}
foundObjects = new ArrayList<GameObject>(10);
}
public void insertStaticObject(GameObject obj) {
int[] cellIds = getCellIds(obj);
int i = 0;
int cellId = -1;
while (i <= 3 && (cellId = cellIds[i++]) != -1) {
staticCells[cellId].add(obj);
}
}
public void insertDynamicObject(GameObject obj) {
int[] cellIds = getCellIds(obj);
int i = 0;
int cellId = -1;
while (i <= 3 && (cellId = cellIds[i++]) != -1) {
staticCells[cellId].add(obj);
}
}
public void removeObject(GameObject obj) {
int[] cellIds = getCellIds(obj);
int i = 0;
int cellId = -1;
while (i <= 3 && (cellId = cellIds[i++]) != -1) {
dynamicCells[cellId].remove(obj);
staticCells[cellId].remove(obj);
}
}
public void clearDynamicCells(GameObject obj) {
int len = dynamicCells.length;
for (int i = 0; i < len; i++)
dynamicCells[i].clear();
}
public List<GameObject> getPotentialColliders(Rectangle objBound) {
foundObjects.clear();
int[] cellIds = getCellIds(objBound);
int i = 0;
int cellId = -1;
while (i <= 3 && (cellId = cellIds[i++]) != -1) {
int len = dynamicCells[cellId].size();
for (int j = 0; j < len; j++) {
GameObject collider = dynamicCells[cellId].get(j);
if (!foundObjects.contains(collider))
foundObjects.add(collider);
}
len = staticCells[cellId].size();
for (int j = 0; j < len; j++) {
GameObject collider = staticCells[cellId].get(j);
if (!foundObjects.contains(collider))
foundObjects.add(collider);
}
}
return foundObjects;
}
public List<GameObject> getPotentialColliders(GameObject obj) {
foundObjects.clear();
int[] cellIds = getCellIds(obj);
int i = 0;
int cellId = -1;
while (i <= 3 && (cellId = cellIds[i++]) != -1) {
int len = dynamicCells[cellId].size();
for (int j = 0; j < len; j++) {
GameObject collider = dynamicCells[cellId].get(j);
if (!foundObjects.contains(collider))
foundObjects.add(collider);
}
len = staticCells[cellId].size();
for (int j = 0; j < len; j++) {
GameObject collider = staticCells[cellId].get(j);
if (!foundObjects.contains(collider))
foundObjects.add(collider);
}
}
return foundObjects;
}
public int[] getCellIds(Rectangle objBound) {
int x1 = (int)FloatMath.floor(objBound.lowerLeft.x / cellSize);
int y1 = (int)FloatMath.floor(objBound.lowerLeft.y / cellSize);
int x2 = (int)FloatMath.floor((objBound.lowerLeft.x + objBound.width) / cellSize);
int y2 = (int)FloatMath.floor((objBound.lowerLeft.y + objBound.height) / cellSize);
cellIds[0] = cellIds[1] = cellIds[2] = cellIds[3] = -1;
if (x1 == x2 && y1 == y2) {
if (x1 >= 0 && x1 < cellsPerRow && y1 >= 0 && y1 < cellsPerCol)
cellIds[0] = x1 + y1 * cellsPerRow;
}
else if (x1 == x2) {
int i = 0;
if (x1 >= 0 && x1 < cellsPerRow) {
if (y1 >= 0 && y1 < cellsPerCol)
cellIds[i++] = x1 + y1 * cellsPerRow;
if (y2 >= 0 && y2 < cellsPerCol)
cellIds[i++] = x1 + y2 * cellsPerRow;
}
}
else if (y1 == y2) {
int i = 0;
if (y1 >= 0 && y1 < cellsPerCol) {
if (x1 >= 0 && x1 < cellsPerRow)
cellIds[i++] = x1 + y1 * cellsPerRow;
if (x2 >= 0 && x2 < cellsPerRow)
cellIds[i++] = x2 + y1 * cellsPerRow;
}
}
else {
int i = 0;
int y1CellsPerRow = y1 * cellsPerRow;
int y2CellsPerRow = y2 * cellsPerRow;
if (x1 >= 0 && x1 < cellsPerRow && y1 >= 0 && y1 < cellsPerCol)
cellIds[i++] = x1 + y1CellsPerRow;
if (x2 >= 0 && x2 < cellsPerRow && y1 >= 0 && y1 < cellsPerCol)
cellIds[i++] = x2 + y1CellsPerRow;
if (x2 >= 0 && x2 < cellsPerRow && y2 >= 0 && y2 < cellsPerCol)
cellIds[i++] = x2 + y2CellsPerRow;
if (x1 >= 0 && x1 < cellsPerRow && y2 >= 0 && y2 < cellsPerCol)
cellIds[i++] = x1 + y2CellsPerRow;
}
return cellIds;
}
public int[] getCellIds(GameObject obj) {
int x1 = (int)FloatMath.floor(obj.bounds.lowerLeft.x / cellSize);
int y1 = (int)FloatMath.floor(obj.bounds.lowerLeft.y / cellSize);
int x2 = (int)FloatMath.floor((obj.bounds.lowerLeft.x + obj.bounds.width) / cellSize);
int y2 = (int)FloatMath.floor((obj.bounds.lowerLeft.y + obj.bounds.height) / cellSize);
cellIds[0] = cellIds[1] = cellIds[2] = cellIds[3] = -1;
if (x1 == x2 && y1 == y2) {
if (x1 >= 0 && x1 < cellsPerRow && y1 >= 0 && y1 < cellsPerCol)
cellIds[0] = x1 + y1 * cellsPerRow;
}
else if (x1 == x2) {
int i = 0;
if (x1 >= 0 && x1 < cellsPerRow) {
if (y1 >= 0 && y1 < cellsPerCol)
cellIds[i++] = x1 + y1 * cellsPerRow;
if (y2 >= 0 && y2 < cellsPerCol)
cellIds[i++] = x1 + y2 * cellsPerRow;
}
}
else if (y1 == y2) {
int i = 0;
if (y1 >= 0 && y1 < cellsPerCol) {
if (x1 >= 0 && x1 < cellsPerRow)
cellIds[i++] = x1 + y1 * cellsPerRow;
if (x2 >= 0 && x2 < cellsPerRow)
cellIds[i++] = x2 + y1 * cellsPerRow;
}
}
else {
int i = 0;
int y1CellsPerRow = y1 * cellsPerRow;
int y2CellsPerRow = y2 * cellsPerRow;
if (x1 >= 0 && x1 < cellsPerRow && y1 >= 0 && y1 < cellsPerCol)
cellIds[i++] = x1 + y1CellsPerRow;
if (x2 >= 0 && x2 < cellsPerRow && y1 >= 0 && y1 < cellsPerCol)
cellIds[i++] = x2 + y1CellsPerRow;
if (x2 >= 0 && x2 < cellsPerRow && y2 >= 0 && y2 < cellsPerCol)
cellIds[i++] = x2 + y2CellsPerRow;
if (x1 >= 0 && x1 < cellsPerRow && y2 >= 0 && y2 < cellsPerCol)
cellIds[i++] = x1 + y2CellsPerRow;
}
return cellIds;
}
}
|
[
"[email protected]"
] | |
2a961259d64a0994dbcadd1141c26d6921ce9b94
|
13424942221e6652cce51cc6bb2842b8e94cf828
|
/src/main/java/egovframework/security/dto/EmployeeDTO.java
|
dbc8c24a3b0d7219c6807f0d15562948e5ec956b
|
[] |
no_license
|
JihunLim/Security-Check-Web-Project
|
6466db2228008af513666d0acddf02b268f47646
|
6a3f60e4f4f573f4673c2a68210d97fac7a27b6b
|
refs/heads/master
| 2021-08-28T12:05:53.019439 | 2017-12-12T06:34:21 | 2017-12-12T06:34:21 | 103,434,913 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,187 |
java
|
package egovframework.security.dto;
public class EmployeeDTO {
/**
* @param emp_email : 회원 이메일 (기본키)
* @param emp_name : 회원 이름
* @param emp_pwd : 회원 비밀번호
* @param deptcode : 회원 부서번호 (외래키)
* @param emp_emp_sex : 회원 성별 (male / female)
* @param emp_phone : 회원 전화번호
* @param emp_role : 회원 권환 (ROLE_USER / ROLE_ADMIN)
* @param emp_checkemail : 당직점검완료 이메일 수신여부(Y/N)
*/
private String emp_email;
private String emp_name;
private String emp_pwd;
private int emp_deptcode;
private String emp_sex; //M or F
private String emp_phone;
private String emp_role;
private Boolean emp_enabled;
private String emp_rank;
private String emp_checkemail;
//부서이름을 가져오기 위한 wrapper
private String deptName;
public EmployeeDTO(){
}
/**
* @param emp_email
* @param emp_name
* @param emp_pwd
* @param emp_deptcode
* @param emp_sex
* @param emp_phone
* @param emp_role
* @param emp_enabled
* @param emp_rank
* @param emp_checkemail
* @param deptName
*/
public EmployeeDTO(String emp_email, String emp_name, String emp_pwd,
int emp_deptcode, String emp_sex, String emp_phone,
String emp_role, Boolean emp_enabled, String emp_rank,
String emp_checkemail, String deptName) {
super();
this.emp_email = emp_email;
this.emp_name = emp_name;
this.emp_pwd = emp_pwd;
this.emp_deptcode = emp_deptcode;
this.emp_sex = emp_sex;
this.emp_phone = emp_phone;
this.emp_role = emp_role;
this.emp_enabled = emp_enabled;
this.emp_rank = emp_rank;
this.emp_checkemail = emp_checkemail;
this.deptName = deptName;
}
public String getEmp_email() {
return emp_email;
}
public void setEmp_email(String emp_email) {
this.emp_email = emp_email;
}
public String getEmp_name() {
return emp_name;
}
public void setEmp_name(String emp_name) {
this.emp_name = emp_name;
}
public String getEmp_pwd() {
return emp_pwd;
}
public void setEmp_pwd(String emp_pwd) {
this.emp_pwd = emp_pwd;
}
public int getEmp_deptcode() {
return emp_deptcode;
}
public void setEmp_deptcode(int dept_code) {
this.emp_deptcode = dept_code;
}
public String getEmp_sex() {
return emp_sex;
}
public void setEmp_sex(String emp_sex) {
this.emp_sex = emp_sex;
}
public String getEmp_phone() {
return emp_phone;
}
public void setEmp_phone(String emp_phone) {
this.emp_phone = emp_phone;
}
public String getEmp_role() {
return emp_role;
}
public void setEmp_role(String emp_role) {
this.emp_role = emp_role;
}
public Boolean getEmp_enabled() {
return emp_enabled;
}
public void setEmp_enabled(Boolean emp_enabled) {
this.emp_enabled = emp_enabled;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getEmp_rank() {
return emp_rank;
}
public void setEmp_rank(String emp_rank) {
this.emp_rank = emp_rank;
}
public String getEmp_checkemail() {
return emp_checkemail;
}
public void setEmp_checkemail(String emp_checkemail) {
this.emp_checkemail = emp_checkemail;
}
}
|
[
"[email protected]"
] | |
db844a74ca95a21dd7c7833d55d405fe53d67d34
|
944f2da2f7bc1cca5b0f7eba2d07ae131dfaa2dc
|
/EAD/Assignment4/Logout.java
|
0d7d1a403fe128f7a2b0453096170619aa8fdc84
|
[] |
no_license
|
meta-naman-mundra/GET2020
|
0be285a1e21f1efa54476e3625d8a95cfd6a5a2a
|
fd12f1c8eeec8d6bc1b65328ac41af099238d0ed
|
refs/heads/master
| 2023-01-28T22:42:51.240917 | 2020-04-10T13:08:12 | 2020-04-10T13:08:12 | 232,491,048 | 0 | 0 | null | 2023-01-07T16:23:22 | 2020-01-08T06:07:43 |
Java
|
UTF-8
|
Java
| false | false | 827 |
java
|
package server;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
/**
* Servlet implementation class Logout
*/
@WebServlet("/Logout")
public class Logout extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Logout() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if(session!=null){
session.invalidate();
}
response.sendRedirect("login.html");
}
}
|
[
"[email protected]"
] | |
9fba41dc712ef8712e8cf7b0ba55180ef6addbcb
|
a4ead5b72d25b514c1e144f742dd1b6f6f7089df
|
/resource-storage-root/resource-storage-plugin/src/main/java/cn/x5456/rs/pre/cleanstrategy/RedisCleanStrategy.java
|
c41ff75162f4143fa041e2f1e8eb2e8498424e1f
|
[] |
no_license
|
x54256/spring-source-study
|
6a2c7dbc91edf56a0832b8c901b198d70666be89
|
b123ad5b6c6c58ee39717ab0b02643b44abf58e3
|
refs/heads/master
| 2023-04-23T05:20:46.162091 | 2021-05-07T09:21:28 | 2021-05-07T09:21:28 | 329,519,227 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,671 |
java
|
package cn.x5456.rs.pre.cleanstrategy;
import cn.x5456.rs.pre.cleanstrategy.redis.v2.CacheExpiredListener;
import cn.x5456.rs.pre.cleanstrategy.redis.v2.MongoAfterSaveEventListener;
import cn.x5456.rs.pre.cleanstrategy.redis.v2.RedisCacheInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisKeyValueAdapter;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.util.Calendar;
import java.util.Date;
import java.util.Set;
/**
* 通过 redis 通知机制清理未上传完成的文件缓存
*
* @author yujx
* @date 2021/04/30 10:09
*/
@Slf4j
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(EnableRedisRepositories.class)
@ConditionalOnProperty(prefix = "x5456.rs.clean", name = "strategy", havingValue = "redis")
@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)
public class RedisCleanStrategy {
@Bean
public MongoAfterSaveEventListener mongoAfterSaveEventListener() {
return new MongoAfterSaveEventListener();
}
@Bean
public CacheExpiredListener cacheExpiredListener() {
return new CacheExpiredListener();
}
/**
* Configuration of scheduled job for cleaning up expired sessions.
*/
@EnableScheduling
@Configuration(proxyBeanMethods = false)
static class CacheCleanupConfiguration implements SchedulingConfigurer {
private final StringRedisTemplate redis;
public CacheCleanupConfiguration(StringRedisTemplate redis) {
this.redis = redis;
}
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
// 每分钟执行一次
taskRegistrar.addCronTask(this::cleanExpiredCaches, "0 * * * * *");
}
private void cleanExpiredCaches() {
long now = System.currentTimeMillis();
long prevMin = this.roundDownMinute(now);
log.info("Cleaning up caches expiring at " + new Date(prevMin));
String expirationKey = this.getExpirationKey(prevMin);
Set<String> sessionsToExpire = this.redis.boundSetOps(expirationKey).members();
this.redis.delete(expirationKey);
if (sessionsToExpire != null) {
for (Object session : sessionsToExpire) {
String sessionKey = (String) session;
this.touch(sessionKey);
}
}
}
private void touch(String key) {
this.redis.hasKey(key);
}
private String getExpirationKey(long prevMin) {
// rs:files:caches:expirationOfNextMinute:1620357780000
return RedisCacheInfo.PREFIX + ":" + RedisCacheInfo.EXPIRATION_OF_NEXT_MINUTE + ":" + prevMin;
}
private long roundDownMinute(long timeInMs) {
Calendar date = Calendar.getInstance();
date.setTimeInMillis(timeInMs);
date.clear(Calendar.SECOND);
date.clear(Calendar.MILLISECOND);
return date.getTimeInMillis();
}
}
}
|
[
"[email protected]"
] | |
0953cde2ffac6fea4162c67438e0a3cba36785ac
|
0301bb1252c229f0e541edd8ab53bc6df7b98b2a
|
/src/main/java/com/grap/pay/security/InMemoryTOTPService.java
|
3fdc44c29723eec152e8ac927b194c275f6e1f56
|
[] |
no_license
|
ShashankN/STARPay
|
150718736a754fbdb0bfaf0a63fc42ee1d8f5c17
|
80dbe7b66d3e506e9480d3e07e5063dbe27b2dfb
|
refs/heads/master
| 2022-02-11T11:01:58.072791 | 2022-01-27T16:15:35 | 2022-01-27T16:15:35 | 226,607,264 | 3 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 607 |
java
|
package com.grap.pay.security;
import java.util.Map;
import org.springframework.stereotype.Service;
@Service
public class InMemoryTOTPService implements TOTPTokenService{
private Map<String,TokenStore> tokenStore;
public InMemoryTOTPService(Map<String,TokenStore> tokenStore) {
this.tokenStore = tokenStore;
}
@Override
public Integer getTotp(String userid, Long timeStamp) {
return tokenStore.get(userid).getToken(timeStamp);
}
@Override
public boolean isValidToken(String userid, Integer token) {
return tokenStore.get(userid).valaidateToken(System.currentTimeMillis(), token);
}
}
|
[
"[email protected]"
] | |
45d5d709a885263fef12648551578f2803235c11
|
28f1dedfa55de3381f0e2124c7c819f582767e2a
|
/core/components/restlet/src/org/smartfrog/services/restlet/overrides/ExtendedResponse.java
|
8e0b29d9e0c0e278b33cc99f757d242984350b53
|
[] |
no_license
|
rhusar/smartfrog
|
3bd0032888c03a8a04036945c2d857f72a89dba6
|
0b4db766fb1ec1e1c2e48cbf5f7bf6bfd2df4e89
|
refs/heads/master
| 2021-01-10T05:07:39.218946 | 2014-11-28T08:52:32 | 2014-11-28T08:52:32 | 47,347,494 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,545 |
java
|
/* (C) Copyright 2008 Hewlett-Packard Development Company, LP
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For more information: www.smartfrog.org
*/
package org.smartfrog.services.restlet.overrides;
import org.restlet.data.Reference;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.data.Status;
/**
* This is an extended response code. One thing we can do is detect forbidden response codes and fail early, not late
* Created 28-Feb-2008 16:22:51
*
*/
public class ExtendedResponse extends Response {
private int min=0, max=-1;
public ExtendedResponse(Request request) {
super(request);
}
public ExtendedResponse(Request request, int min, int max) {
super(request);
this.min = min;
this.max = max;
}
/**
* Fix redirection handling by setting the base reference to the host of the system
* @param redirectUri URI to redirect to
*/
public void setRedirectRef(String redirectUri) {
Reference baseRef=null;
Reference resourceRef = getRequest().getResourceRef();
if (resourceRef != null) {
if (resourceRef.getBaseRef() != null) {
baseRef = resourceRef.getBaseRef();
} else {
baseRef = resourceRef;
}
}
setRedirectRef(new Reference(baseRef, redirectUri).getTargetRef());
}
/**
* Sets the status.
*
* @param status The status to set.
* @throws RuntimeException if the status code is in the forbidden range
*/
public void setStatus(Status status) {
super.setStatus(status);
int code = status.getCode();
if ((max >= 0 && code > max) || (min > 0 && code < min)) {
throw new RuntimeException("Status out of range " + status.toString() + " \n" + status.getDescription());
}
}
}
|
[
"steve_l@9868f95a-be1e-0410-b3e3-a02e98b909e6"
] |
steve_l@9868f95a-be1e-0410-b3e3-a02e98b909e6
|
182896b8be94d66938b5580b08010aa8002497a3
|
287cbc7414d7fb4122c2735fa1c226e584ec5fce
|
/Main.java
|
3ddd53c032596ef1b78c30654c5078dd14fe0722
|
[] |
no_license
|
sunaina09/Java
|
d8de14f1c5b1126f56d47a614fc8327131d3aeaa
|
029a9bb8c1d839419b08732b1b5c5fabfb646224
|
refs/heads/main
| 2023-06-20T23:16:28.712350 | 2021-07-29T07:09:13 | 2021-07-29T07:09:13 | 383,817,291 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 494 |
java
|
//Constructors for Enumrated data types
// Specific values declared
enum Car{
lamborghini(900), tata(2), audi(50), flat(15), honda(12); //enum datatype
private int price;
Car (int p){
price=p;
}
int getPrice(){
return price;
}
}
public class Main{
public static void main(String[] args){
System.out.println("All car prices");
for (Car c: Car.values()){
System.out.println(c+" cost: "+ c.getPrice()+" thousand dollors");
}
}
}
|
[
"[email protected]"
] | |
66094dfe9c291566aba24aa33e5b9cff9d2e1f64
|
862fba24fc1865ea013cc5ab7f70f4f6f45c3821
|
/app/src/main/java/com/sideeg/elegant/fragment/NotVerifiedStudentFragment.java
|
13b331b580a31c2cd6a5761a8180e8edd048533d
|
[] |
no_license
|
sideeg/elegant-school-admin-android
|
51a640483773ea73f6873789452f9fea34b78a16
|
7298133df0b2ca0a491bd053d0310681815f1771
|
refs/heads/master
| 2022-04-10T11:37:12.531066 | 2020-03-26T14:42:29 | 2020-03-26T14:42:29 | 232,291,900 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,006 |
java
|
package com.sideeg.elegant.fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.sideeg.elegant.NetWorkApis.ApiClient;
import com.sideeg.elegant.NetWorkApis.NetWorkApis;
import com.sideeg.elegant.R;
import com.sideeg.elegant.adapters.AllStudentAdapter;
import com.sideeg.elegant.model.getStudentResponse;
import com.sideeg.elegant.utiltiy.SessionManger;
import com.sideeg.elegant.utiltiy.Utility;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class NotVerifiedStudentFragment extends Fragment {
private static final String TAG = "AllStudentFragment";
private RecyclerView recyclerView;
private LinearLayoutManager layoutManager;
private AllStudentAdapter mAdapter;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_sup_student, container, false);
recyclerView = root.findViewById(R.id.sub_student_recycler);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
getList();
return root;
}
private void getList() {
NetWorkApis api = ApiClient.getClient(ApiClient.BASE_URL).create(NetWorkApis.class);
String temp =new SessionManger(getContext()).getSchoolId();
Call<getStudentResponse> loginCall = api.studentWithNoSupervisor(temp);
loginCall.enqueue(new Callback<getStudentResponse>() {
@Override
public void onResponse(Call<getStudentResponse> call, Response<getStudentResponse> response) {
if (response.isSuccessful()) {
if (response.body().isError()) {
Utility.showAlertDialog(getContext().getString(R.string.error), response.body().getMessage(), getContext());
} else {
mAdapter = new AllStudentAdapter( response.body().getData(),getContext());
recyclerView.setAdapter(mAdapter);
}
} else {
Log.i(TAG, response.errorBody().toString());
Utility.showAlertDialog(getContext().getString(R.string.error), getContext().getString(R.string.servererror), getContext());
}
}
@Override
public void onFailure(Call<getStudentResponse> call, Throwable t) {
Utility.showAlertDialog(getContext().getString(R.string.error), t.getMessage(), getContext());
Utility.printLog(TAG, t.getMessage());
}
});
}
}
|
[
"[email protected]"
] | |
e8de82456e619f4f6f2c570f5999ae1ef7b4d36a
|
23b99b5367aeb7859f3040008a67a0b64c92f744
|
/Eclipse/src/org/usfirst/frc/team2077/season2017/subsystems/BallCollector.java
|
410a4834c3ab12be0d84382ae0dfad8e929892d0
|
[] |
no_license
|
ChristianReese/Eclipse
|
afb0102d83c2fb66ca75d3e0551e9aaf2b5c7a5f
|
6f4a9666a142832edc81ae33040e9a71b367388a
|
refs/heads/master
| 2021-01-23T06:54:13.805358 | 2017-03-28T02:45:57 | 2017-03-28T02:45:57 | 86,406,305 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 901 |
java
|
package org.usfirst.frc.team2077.season2017.subsystems;
import org.usfirst.frc.team2077.season2017.commands.PickUp;
import org.usfirst.frc.team2077.season2017.robot.Robot;
import edu.wpi.first.wpilibj.Preferences;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.command.Subsystem;
/**
*
*/
public class BallCollector extends Subsystem {
// Put methods for controlling this subsystem
// here. Call these from Commands.
public static Talon ballCollector = new Talon(2);
public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}
public static void PickUp()
{
Preferences prefs = Preferences.getInstance();
ballCollector.set(prefs.getDouble("Ball Collector Speed", -.5));
}
public static void Drop()
{
ballCollector.set(.25);
}
}
|
[
"[email protected]"
] | |
b78189e3ef8664123e8b980c053d2848450283d1
|
3502c941139b256047bff1b69d01ea859febef52
|
/app/src/main/java/dev/countryfair/player/playlazlo/com/countryfair/TicketValidationActivity.java
|
bd1d004e7f503ef7ecdc052fb1a21ac87a814e77
|
[] |
no_license
|
mickychen0524/CF_Android
|
ad66cab35cf442ec45512740ef8785f8a2761bfb
|
71d7c0ef27d1886efb03aa4b6d44b0226780c5f1
|
refs/heads/master
| 2021-08-15T06:48:40.641476 | 2017-10-21T07:39:40 | 2017-10-21T07:39:40 | 106,809,224 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,696 |
java
|
package dev.countryfair.player.playlazlo.com.countryfair;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
import org.json.JSONObject;
import java.util.Locale;
/**
* Created by mymac on 3/21/17.
*/
public class TicketValidationActivity extends AppCompatActivity {
private float totalAmount;
private String claimLicenseCode;
private JSONObject claimTicketItem;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ticket_validation_activity);
// set initial project variables from intent extra
totalAmount = getIntent().getFloatExtra("totalAmount", 0.0f);
claimLicenseCode = getIntent().getStringExtra("claimLicenseCode");
ImageView qrCodeimage = (ImageView) findViewById(R.id.validation_qrcode_image);
TextView totalAmountTxt = (TextView) findViewById(R.id.validation_award_amount_txt);
totalAmountTxt.setText(String.format(Locale.US, "$%.2f Award!", totalAmount));
MultiFormatWriter writer =new MultiFormatWriter();
try {
claimTicketItem = new JSONObject(getIntent().getStringExtra("claimTicketData"));
String licenseData = Uri.encode(claimLicenseCode, "utf-8");
BitMatrix bm = writer.encode(licenseData, BarcodeFormat.QR_CODE,250, 250);
Bitmap ImageBitmap = Bitmap.createBitmap(350, 350, Bitmap.Config.ARGB_8888);
for (int i = 0; i < 250; i++) {//width
for (int j = 0; j < 250; j++) {//height
ImageBitmap.setPixel(i, j, bm.get(i, j) ? Color.BLACK: Color.WHITE);
}
}
qrCodeimage.setImageBitmap(ImageBitmap);
} catch (Exception e) {
Log.e("checkout_dlg_e-->", e.getMessage());
}
}
public void back(View view) {
Intent i = new Intent(this, TicketListActivity.class);
startActivity(i);
finish();
}
public void claimTicket(View view) {
Intent i = new Intent(this, CardsListActivity.class);
i.putExtra("totalAmount", totalAmount);
i.putExtra("claimLicenseCode", claimLicenseCode);
i.putExtra("claimTicketData", claimTicketItem.toString());
startActivity(i);
finish();
}
}
|
[
"[email protected]"
] | |
e77c045b6d9d236b67cacf3bb3b267d430a10fa2
|
95f5b8ea37bd1854fe8cd76602df752e57902ccd
|
/src/Expression.java
|
dca8ac94ac3556c91ea1fd399e7e53aa10e70223
|
[] |
no_license
|
Libbyg/Math
|
fac9c8fe2538d75665fbecc8a6533028dc5b4036
|
5d426166e9436c4b3d3a852cfe6023be282363b0
|
refs/heads/master
| 2022-08-24T03:10:44.838509 | 2020-05-19T22:23:24 | 2020-05-19T22:23:24 | 265,381,769 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,235 |
java
|
import java.util.List;
import java.util.Map;
public interface Expression {
// Evaluate the expression using the variable values provided
// in the assignment, and return the result. If the expression
// contains a variable which is not in the assignment, an exception
// is thrown.
double evaluate(Map<String, Double> assignment) throws InvalidAssignmentException, ArithmeticException;
// A convenience method. Like the `evaluate(assignment)` method above,
// but uses an empty assignment.
double evaluate() throws Exception;
// Returns a list of the variables in the expression.
List<String> getVariables();
// Returns a nice string representation of the expression.
String toString();
// Returns a new expression in which all occurrences of the variable
// var are replaced with the provided expression (Does not modify the
// current expression).
Expression assign(String var, Expression expression);
// Returns the expression tree resulting from differentiating
// the current expression relative to variable `var`.
Expression differentiate(String var);
// Returned a simplified version of the current expression.
Expression simplify();
}
|
[
"[email protected]"
] | |
dfa291d4ab166f855dd70c75640ddbde9fbb8478
|
a0b3558927f9a32e34b83500000e7611ee7dabf2
|
/src/fancyHashMapImpl/EnhancedLinkedHashMap.java
|
1825bbc84387387a7e2e65566b0527bff33275ec
|
[] |
no_license
|
Gurumoorthym/Java-Examples
|
ed994e89681ba53f2c1865dd1f46f6612003daca
|
0abd88870c4fe350290fb3a5a1008e8b8fdce60b
|
refs/heads/master
| 2020-03-19T18:51:02.828908 | 2018-07-17T15:41:36 | 2018-07-17T15:41:36 | 136,828,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,618 |
java
|
package fancyHashMapImpl;
import java.util.HashMap;
import java.util.LinkedList;
public class EnhancedLinkedHashMap {
/*
* FancyHashMap Class is created to mimic the HashMap Functionality of holding a key and value
*/
public class FancyHash extends HashMap<String,String>{
/**
*
*/
private static final long serialVersionUID = 7195203157942720987L;
/*
* Overloaded method of getKey()
* compared between the actual key from the indexed object of the linkedlist of HashMaps
* and the actual HashMap
*/
public String getKey(FancyHash actualHash, FancyHash comparedHash) {
String actualHashMapKey;
String derivedHashMapKey;
for(String key: comparedHash.keySet()) {
actualHashMapKey = comparedHash.get(key);
derivedHashMapKey = actualHash.get(key);
if(null != derivedHashMapKey && null != actualHashMapKey
&& derivedHashMapKey.equals(actualHashMapKey)) {
return key;
}
}
return null;
}
}
LinkedList<FancyHash> linkedFancyHashMap;
FancyHash fancyHash;
public EnhancedLinkedHashMap() {
linkedFancyHashMap = new LinkedList<FancyHash>();
fancyHash = new FancyHash();
}
/*
* It uses only one get(Key) implementation rather than the getAt(i) which does the retrieval thrice
* removing the actual object from the linkedlist of hashmaps
*/
private void delete(String key) {
FancyHash fancyHashObj = new FancyHash();
fancyHashObj.put(key, fancyHash.get(key));
fancyHash.remove(key);
linkedFancyHashMap.remove(fancyHashObj);
}
/*
* Uses direct HashMap retrival from the super class implementation so its faster retrieval
*/
private String get(String key) {
return fancyHash.get(key);
}
/*
*Uses direct HashMap put method and additionally populating the linkedlist of Hashmaps for index retrival
*/
private void put(String key, String value) {
FancyHash fancyHashObj = new FancyHash();
fancyHashObj.put(key, value);
linkedFancyHashMap.addLast(fancyHashObj);
fancyHash.put(key, value);
}
/*
* Optimized to fetch the key by comparing the fetched index from the linked list which holds the order,
* thereby retrieving the value from the actual hashMap super class implementation
*/
private String getAt(int i) {
return fancyHash.get(fancyHash.getKey(linkedFancyHashMap.get(i),fancyHash));
}
public static void main(String[] args) {
EnhancedLinkedHashMap ea = new EnhancedLinkedHashMap();
ea.put("Guru1" , "Stream1");
ea.put("Guru2" , "Stream2");
ea.put("Guru3" , "Stream3");
ea.put("Guru4" , "Stream4");
ea.put("Guru5" , "Stream5");
ea.put("Guru6" , "Stream6");
System.out.println("Get Value of Guru3: " + ea.get("Guru3"));//Should return Stream3
System.out.println("Get Value at Index 2: " + ea.getAt(2));//Should return Stream3
ea.delete("Guru2");
System.out.println("Get Value of Guru3: " + ea.get("Guru3"));//Should return Stream3
System.out.println("Get Value at Index 1: " + ea.getAt(1));//Should return Stream3
ea.delete("Guru1");
System.out.println("Get Value of Guru3: " + ea.get("Guru3"));//Should return Stream3
System.out.println("Get Value at Index 0: " + ea.getAt(0));//Should return Stream3
ea.put("Guru2" , "Stream2");
System.out.println("Get Value of Guru3: " + ea.get("Guru2"));//Should return Stream2
System.out.println("Get Value at Index 4: " + ea.getAt(4));//Should return Stream2
ea.put("Guru1" , "Stream1");
System.out.println("Get Value of Guru3: " + ea.get("Guru1"));//Should return Stream1
System.out.println("Get Value at Index 5: " + ea.getAt(5));//Should return Stream1
}
}
|
[
"[email protected]"
] | |
caebf99e1eb6b5b4b70f9342e4cc7639de508868
|
017d46e923cffddf715b4fb0f34c0c84f48c7771
|
/src/main/java/com/infinitemule/espn/api/sports/SportsApiService.java
|
93d625a2f8dd3f8b860ef7b1723b347ac11135e4
|
[
"MIT"
] |
permissive
|
infinitemule/spring-espn
|
b1e5ba24727650c5a6e45437810f9db1471301b8
|
9d48ed341ef30f97657b54b9c5effe2bde756eec
|
refs/heads/master
| 2021-01-15T19:45:24.652833 | 2014-01-20T18:44:26 | 2014-01-20T18:44:26 | 11,711,434 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 399 |
java
|
/**
* Spring ESPN
*/
package com.infinitemule.espn.api.sports;
/**
* This is what's known as the "helper" API in the documentation,
* but since they only return information about sports, I thought
* sports was a better name.
*
* http://developer.espn.com/overview#helper-api-calls
*/
public interface SportsApiService {
public SportsApiResponse call(SportsApiRequest request);
}
|
[
"[email protected]"
] | |
de68c2f8dcf0ec10e5f71959b62be98d246b6812
|
47798511441d7b091a394986afd1f72e8f9ff7ab
|
/src/main/java/com/alipay/api/domain/AlipayOpenMiniDataPoiSyncModel.java
|
f17a995458fbff3a8bde756d59af8d2164d4e891
|
[
"Apache-2.0"
] |
permissive
|
yihukurama/alipay-sdk-java-all
|
c53d898371032ed5f296b679fd62335511e4a310
|
0bf19c486251505b559863998b41636d53c13d41
|
refs/heads/master
| 2022-07-01T09:33:14.557065 | 2020-05-07T11:20:51 | 2020-05-07T11:20:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 605 |
java
|
package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 小程序poi数据同步
*
* @author auto create
* @since 1.0, 2019-07-29 16:33:16
*/
public class AlipayOpenMiniDataPoiSyncModel extends AlipayObject {
private static final long serialVersionUID = 3114574956572216527L;
/**
* poi回流数据
*/
@ApiField("poi_data")
private PoiSyncData poiData;
public PoiSyncData getPoiData() {
return this.poiData;
}
public void setPoiData(PoiSyncData poiData) {
this.poiData = poiData;
}
}
|
[
"[email protected]"
] | |
e3c08382ba4c18096ea116c0bcd8e04f0858e8fa
|
cf7f1d2a26ad99e3e9570b8e1f5f5e252dc04995
|
/src/com/jackcholt/reveal/ReloadMainActivity.java
|
f266b147ce64617da5913c6b423e04253360274f
|
[] |
no_license
|
jackcholt/reveal-reader
|
f714d4456594571f45d372c48240d5bcd523eca6
|
97dc8013bdb69bde6d3f927c3bb43cd4c2e5530a
|
refs/heads/master
| 2020-04-28T23:06:19.695090 | 2015-05-08T16:48:13 | 2015-05-08T16:48:13 | 35,062,240 | 0 | 1 | null | 2017-12-14T22:41:54 | 2015-05-04T22:01:55 |
Java
|
UTF-8
|
Java
| false | false | 457 |
java
|
package com.jackcholt.reveal;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
/**
* Activity that allows Main to reload itself when necessary.
*
* @author shon
*
*/
public class ReloadMainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivity(new Intent(this, Main.class));
finish();
}
}
|
[
"shon@73620c91-2435-7102-8ba9-0d0c51097dca"
] |
shon@73620c91-2435-7102-8ba9-0d0c51097dca
|
9424885fe56fba0d990074f5249cd3343669bd5e
|
89fdbe404053b855dbbc2ff4238fea4c4310e011
|
/project01/src/v03/ProjectControl.java
|
d7b928db2e098193d28d0edb2f81afe1eb5153ab
|
[] |
no_license
|
JaeHan-Kim/java76s
|
e9c62d5d5fc7e15032f1ab6c67497b0a511d0c55
|
cb4bfd9d676a62bff21bf029ae486f7aa503fbf8
|
refs/heads/master
| 2021-01-10T16:31:00.002070 | 2015-12-14T11:14:52 | 2015-12-14T11:14:52 | 47,110,874 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,079 |
java
|
package v03;
import java.sql.Date;
import java.util.Scanner;
public class ProjectControl extends StorageMenuControl<Project>{
public ProjectControl(Scanner scanner) {
super(scanner);
}
public void service() {
String command = null;
do {
System.out.print("프로젝트관리> ");
command = scanner.nextLine();
switch (command) {
case "list":
doList();
break;
case "add":
doAdd();
break;
case "delete":
doDelete();
break;
case "help":
doHelp();
break;
case "main":
return;
default:
System.out.println("해당 명령을 지원하지 않습니다.");
}
} while (!command.equals("quit"));
}
private void doList() {
System.out.printf("%-3s %-20s %-10s %-10s %-40s\n",
"No", "Title", "Start", "End", "Members");
Project project = null;
for (int i = 0; i < list.size(); i++) {
project = list.get(i);
if (project == null) // 배열의 항목이 null인 경우, 다음 항목으로 바로 이동.
continue;
System.out.printf("% 3d %-20s %3$tY-%3$tm-%3$td %4$s %5$-40s\n",
i,
project.getTitle(),
project.getStartDate(),
project.getEndDate(),
project.getMember());
}
}
private void doAdd() {
Project project = new Project();
System.out.print("프로젝트명? ");
project.setTitle(scanner.nextLine());
System.out.print("시작일? ");
project.setStartDate(Date.valueOf(scanner.nextLine()));
System.out.print("종료일? ");
project.setEndDate(Date.valueOf(scanner.nextLine()));
System.out.print("멤버? ");
project.setMember(scanner.nextLine());
System.out.print("정말 저장하시겠습니까?(y/n)");
String yesno = scanner.nextLine();
if (yesno.toLowerCase().equals("y")) {
list.add(project);
System.out.println("저장되었습니다.");
}
else {
System.out.println("취소하였습니다.");
}
}
private void doDelete() {
System.out.print("프로젝트 번호? ");
int no = Integer.parseInt(scanner.nextLine());
System.out.print("정말 삭제하시겠습니까?(y/n)");
String yesno = scanner.nextLine();
if (yesno.toLowerCase().equals("y")) {
if (list.remove(no) != null) {
System.out.println("삭제하였습니다.");
} else {
System.out.println("유효하지 않은 번호입니다.");
}
} else {
System.out.println("취소하였습니다.");
}
}
private void doHelp() {
System.out.println("[사용법]");
System.out.println("명령");
System.out.println();
System.out.println("[명령]");
System.out.println("list 프로젝트 목록을 리턴한다.");
System.out.println("add 프로젝트를 추가한다.");
System.out.println("delete 프로젝트를 삭제한다. ");
System.out.println("main 메인으로 이동한다.");
}
}
|
[
"hgal8877"
] |
hgal8877
|
47736fa53fb0bec032bd88c1837d94f3a7d68585
|
18bb64344d70f4a1f5d1f165e5e6394fd3bb04b9
|
/app/src/main/java/com/noplugins/keepfit/userplatform/util/net/progress/ProgressSubscriber.java
|
bec5f05f914a5740aae7adc32dd1aa47e87f5268
|
[] |
no_license
|
joyce2016jiayou/biu_user_android
|
6612db7f860d652e3a7108f37b5cba4a8a2a71b3
|
61f778b3f7ea835bba48ad0304be9e2235b9b4ed
|
refs/heads/master
| 2022-11-17T22:09:28.547361 | 2020-07-11T08:05:20 | 2020-07-11T08:05:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,162 |
java
|
package com.noplugins.keepfit.userplatform.util.net.progress;
import android.content.Context;
import android.content.DialogInterface;
import android.text.TextUtils;
import android.widget.Toast;
import com.noplugins.keepfit.userplatform.util.net.entity.Bean;
import com.orhanobut.logger.Logger;
import rx.Subscriber;
public class ProgressSubscriber<T> extends Subscriber<Bean<T>> implements DialogInterface.OnCancelListener {
private SubscriberOnNextListener<Bean<T>> mListener;
private Context mContext;
private ProgressHUD mProgressHUD;
private String message;
private boolean mIsProgress;
private String Method_Tag;
/**
* 没有加载框 用于列表刷新加载
*
* @param listener 请求成功 逻辑处理
* @param context 上下文
*/
public ProgressSubscriber(SubscriberOnNextListener<Bean<T>> listener, Context context) {
this.mListener = listener;
this.mContext = context;
this.mIsProgress = false;
}
/**
* 可设置有加载框 内容显示为 加载中...
*
* @param listener 请求成功 逻辑处理
* @param context 上下文
* @param isProgress 是否显示进度条
*/
public ProgressSubscriber(String method_tag, SubscriberOnNextListener<Bean<T>> listener, Context context, boolean isProgress) {
this.Method_Tag = method_tag;
this.mListener = listener;
this.mContext = context;
this.mIsProgress = isProgress;
}
/**
* 可设置有加载框 设置加载内容显示
*
* @param listener 请求成功 逻辑处理
* @param context 上下文
* @param isProgress 是否显示进度条
* @param message 进度条内容显示
*/
public ProgressSubscriber(SubscriberOnNextListener<Bean<T>> listener, Context context, boolean isProgress, String message) {
this.mListener = listener;
this.mContext = context;
this.mIsProgress = isProgress;
this.message = message;
}
private void showProgressDialog() {
if (mProgressHUD == null) {
mProgressHUD = new ProgressHUD(mContext);
}
mProgressHUD = ProgressHUD.show(mContext, "加载中", false, this);
}
private void showProgressDialog(String message) {
if (mProgressHUD == null) {
mProgressHUD = new ProgressHUD(mContext);
}
mProgressHUD = ProgressHUD.show(mContext, message, false, this);
}
private void dismissProgressDialog() {
if (mProgressHUD != null) {
mProgressHUD.dismiss();
mProgressHUD = null;
}
}
/**
* 订阅开始时调用
* 显示ProgressDialog
*/
@Override
public void onStart() {
super.onStart();
if (mIsProgress) {
if (message != null && !message.equals("")) {
showProgressDialog(message);
return;
}
showProgressDialog();
}
}
@Override
public void onCompleted() {
dismissProgressDialog();
}
@Override
public void onNext(Bean<T> t) {
if (t != null) {
int code = t.getCode();
Logger.e(Method_Tag + "返回的code:" + code);
if (code == 0) {
Logger.e(Method_Tag + "请求Success:");
if (null != t.getData()) {
mListener.onNext(t);
}
} else {
Logger.e(Method_Tag + "请求Fail:" + t.getMessage());
mListener.onError(t.getMessage());
if (!TextUtils.isEmpty(t.getMessage())) {
Toast.makeText(mContext, t.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
}
@Override
public void onError(Throwable e) {
Logger.e(Method_Tag + "请求Fail:" + e.getMessage());
mListener.onError(e.getMessage());
dismissProgressDialog();
}
@Override
public void onCancel(DialogInterface dialogInterface) {
if (!this.isUnsubscribed()) {
this.unsubscribe();
}
}
}
|
[
"[email protected]"
] | |
e957fd242a2cbe51f1d2219ea1dd8995916420b2
|
6839e7abfa2e354becd034ea46f14db3cbcc7488
|
/src/cn/com/sinosoft/action/admin/LogConfigAction.java
|
ed42010fc5ca3df9487ba5d59233fb9c99b0c584
|
[] |
no_license
|
trigrass2/wj
|
aa2d310baa876f9e32a65238bcd36e7a2440b8c6
|
0d4da9d033c6fa2edb014e3a80715c9751a93cd5
|
refs/heads/master
| 2021-04-19T11:03:25.609807 | 2018-01-12T09:26:11 | 2018-01-12T09:26:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,208 |
java
|
package cn.com.sinosoft.action.admin;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.springframework.beans.BeanUtils;
import cn.com.sinosoft.entity.LogConfig;
import cn.com.sinosoft.service.LogConfigService;
import cn.com.sinosoft.util.StrutsUtil;
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.Validations;
/**
* 后台Action类 - 日志设置
* ============================================================================
*
*
*
*
*
*
* KEY:SINOSOFT1F85E6BEB163D27BD7F7DC801AB8C0EE
* ============================================================================
*/
@ParentPackage("admin")
public class LogConfigAction extends BaseAdminAction {
private static final long serialVersionUID = 1294331179033448358L;
private LogConfig logConfig;
private Set<String> allActionClassName;
@Resource
private LogConfigService logConfigService;
// ajax验证操作名称是否已存在
public String checkOperationName() {
String oldValue = getParameter("oldValue");
String newValue = logConfig.getOperationName();
if (logConfigService.isUnique("operationName", oldValue, newValue)) {
return ajaxText("true");
} else {
return ajaxText("false");
}
}
// ajax根据Action类名称获取所有方法名称(不包含已使用的方法)
@SuppressWarnings("unchecked")
public String getAllActionMethod() throws ClassNotFoundException {
String actionClassName = logConfig.getActionClassName();
Set<String> allActionClassName = StrutsUtil.getAllActionClassName();
if (allActionClassName.contains(actionClassName)) {
Class actionClass = Class.forName(actionClassName);
Method[] methods = actionClass.getDeclaredMethods();
StringBuilder stringBuilder = new StringBuilder();
List<LogConfig> logConfigs = logConfigService.getLogConfigList(actionClassName);
String[] methodNameArray = new String[logConfigs.size()];
for (int i = 0; i < logConfigs.size(); i++) {
methodNameArray[i] = logConfigs.get(i).getActionMethodName();
}
for (Method method : methods) {
if (method.getReturnType() == String.class && !ArrayUtils.contains(methodNameArray, method.getName())) {
stringBuilder.append("<option value=\"" + method.getName() + "\">" + method.getName() + "</option>");
}
}
if (stringBuilder.length() == 0) {
stringBuilder.append("<option value=\"noValue\">无可用方法</option>");
}
return ajaxText(stringBuilder.toString());
}
return null;
}
// 列表
public String list() {
pager = logConfigService.findByPager(pager);
return LIST;
}
// 删除
public String delete() {
logConfigService.delete(ids);
return ajaxJsonSuccessMessage("删除成功!");
}
// 添加
public String add() {
return INPUT;
}
// 编辑
public String edit() {
logConfig = logConfigService.load(id);
return INPUT;
}
// 保存
@SuppressWarnings("unchecked")
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "logConfig.operationName", message = "操作名称不允许为空!"),
@RequiredStringValidator(fieldName = "logConfig.actionClassName", message = "Action类不允许为空!"),
@RequiredStringValidator(fieldName = "logConfig.actionMethodName", message = "Action方法不允许为空!")
}
)
@InputConfig(resultName = "error")
public String save() throws ClassNotFoundException {
String actionClassName = logConfig.getActionClassName();
String actionMethodName = logConfig.getActionMethodName();
if (!StrutsUtil.getAllActionClassName().contains(actionClassName)) {
addActionError("Action类错误!");
return ERROR;
}
Class actionClass = Class.forName(actionClassName);
Method[] methods = actionClass.getDeclaredMethods();
boolean isMethod = false;
for (Method method : methods) {
if (StringUtils.equals(method.getName(), actionMethodName)) {
isMethod = true;
break;
}
}
if (isMethod == false) {
addActionError("Action类错误!");
return ERROR;
}
logConfigService.save(logConfig);
redirectionUrl = "log_config!list.action";
return SUCCESS;
}
// 更新
@SuppressWarnings("unchecked")
@Validations(
requiredStrings = {
@RequiredStringValidator(fieldName = "logConfig.operationName", message = "操作名称不允许为空!"),
@RequiredStringValidator(fieldName = "logConfig.actionClassName", message = "Action类不允许为空!"),
@RequiredStringValidator(fieldName = "logConfig.actionMethodName", message = "Action方法不允许为空!")
}
)
@InputConfig(resultName = "error")
public String update() throws ClassNotFoundException {
LogConfig persistent = logConfigService.load(id);
String actionClassName = logConfig.getActionClassName();
String actionMethodName = logConfig.getActionMethodName();
if (!StrutsUtil.getAllActionClassName().contains(actionClassName)) {
addActionError("Action类错误!");
return ERROR;
}
Class actionClass = Class.forName(actionClassName);
Method[] methods = actionClass.getDeclaredMethods();
boolean isMethod = false;
for (Method method : methods) {
if (StringUtils.equals(method.getName(), actionMethodName)) {
isMethod = true;
break;
}
}
if (isMethod == false) {
addActionError("Action类错误!");
return ERROR;
}
BeanUtils.copyProperties(logConfig, persistent, new String[]{"id", "createDate", "modifyDate"});
logConfigService.update(persistent);
redirectionUrl = "log_config!list.action";
return SUCCESS;
}
public Set<String> getAllActionClassName() {
allActionClassName = StrutsUtil.getAllActionClassName();
return allActionClassName;
}
public void setAllActionClassName(Set<String> allActionClassName) {
this.allActionClassName = allActionClassName;
}
public LogConfig getLogConfig() {
return logConfig;
}
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
}
|
[
"[email protected]"
] | |
28c8eb0bda9a450f1a7d03ea5d5ed91e5f0a6f57
|
09649412e12bdc15cf61607e881203735cfafa50
|
/proxies/com/microsoft/bingads/v10/campaignmanagement/FixedBid.java
|
f55b7e018d3c4674f771cbf37d5fc92ed0f0ea9b
|
[
"MIT"
] |
permissive
|
yosefarr/BingAds-Java-SDK
|
cec603b74a921e71c6173ce112caccdf7c1fdbc8
|
d1c333d0ba5b7e434c85a92c7a80dad0add0d634
|
refs/heads/master
| 2021-01-18T15:02:53.945816 | 2016-03-06T13:18:32 | 2016-03-06T13:18:32 | 51,738,651 | 0 | 1 | null | 2016-02-15T07:38:14 | 2016-02-15T07:38:13 | null |
UTF-8
|
Java
| false | false | 1,453 |
java
|
package com.microsoft.bingads.v10.campaignmanagement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for FixedBid complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="FixedBid">
* <complexContent>
* <extension base="{https://bingads.microsoft.com/CampaignManagement/v10}CriterionBid">
* <sequence>
* <element name="Bid" type="{https://bingads.microsoft.com/CampaignManagement/v10}Bid" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FixedBid", propOrder = {
"bid"
})
public class FixedBid
extends CriterionBid
{
@XmlElement(name = "Bid", nillable = true)
protected Bid bid;
/**
* Gets the value of the bid property.
*
* @return
* possible object is
* {@link Bid }
*
*/
public Bid getBid() {
return bid;
}
/**
* Sets the value of the bid property.
*
* @param value
* allowed object is
* {@link Bid }
*
*/
public void setBid(Bid value) {
this.bid = value;
}
}
|
[
"[email protected]"
] | |
df59c18450d5cd11ef35b6a3f636fc2515507e78
|
e5f44061342a187cacf52f253322630467023702
|
/app/src/main/java/com/yizhan/ouyu/ui/activity/MainActivity.java
|
cc85815bdd5184c876bee1082c65dcddc7e769f2
|
[] |
no_license
|
liqiao1992/OuYu
|
486bd4165d05f3553fad6e1df95a3cc15575a077
|
3f75a81aba357b746fb56c44a2388ed5e6c37a1d
|
refs/heads/master
| 2021-01-21T20:42:41.963603 | 2017-06-06T02:06:52 | 2017-06-06T02:06:52 | 92,269,984 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 899 |
java
|
package com.yizhan.ouyu.ui.activity;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.ViewTreeObserver;
import com.ashokvarma.bottomnavigation.BottomNavigationBar;
import com.ashokvarma.bottomnavigation.BottomNavigationItem;
import com.yizhan.ouyu.R;
import com.yizhan.ouyu.base.BaseActivity;
import com.yizhan.ouyu.ui.fragment.MainFragment;
import com.yizhan.ouyu.ui.fragment.ZhiHuFragment;
/**
* Created by lenovo on 2017/5/18.
*/
public class MainActivity extends BaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState==null) {
loadRootFragment(R.id.fragment_container, new MainFragment());
}
}
}
|
[
"[email protected]"
] | |
18f0b18614a111fa17b68dd65e1cdb8bbec33cfe
|
c04d0a6bbf8ff58aad59ad804430cf962093c381
|
/src/deepDriver/dl/aml/cnn/distribution/DataStreamDistUtil.java
|
3a76c91af45db8179f23e2afafc85baee70cc8e6
|
[
"Apache-2.0"
] |
permissive
|
liulanbo/DeepDriver
|
73bc88c42577e6bacd330a9a001c698e17f2eb05
|
9007e10aae183f960f009fa1dc2ab6fb716bd438
|
refs/heads/master
| 2021-04-26T22:18:00.010827 | 2018-02-06T15:59:50 | 2018-02-06T15:59:50 | 124,065,605 | 2 | 0 |
Apache-2.0
| 2018-03-06T11:02:10 | 2018-03-06T11:02:10 | null |
UTF-8
|
Java
| false | false | 1,417 |
java
|
package deepDriver.dl.aml.cnn.distribution;
import deepDriver.dl.aml.cnn.CacheAbleDataStream;
import deepDriver.dl.aml.cnn.IDataMatrix;
import deepDriver.dl.aml.cnn.IDataStream;
import deepDriver.dl.aml.common.distribution.CommonSlave;
import deepDriver.dl.aml.distribution.ResourceMaster;
public class DataStreamDistUtil {
int cnt;
int cap = 4096;
public int getCap() {
return cap;
}
public void setCap(int cap) {
this.cap = cap;
}
public int getCnt() {
return cnt;
}
public void setCnt(int cnt) {
this.cnt = cnt;
}
public void distributeDs(IDataStream is, int num) throws Exception {
ResourceMaster rm = ResourceMaster.getInstance();
is.reset();
CacheAbleDataStream [] iss = new CacheAbleDataStream[num];
for (int i = 0; i < iss.length; i++) {
iss[i] = new CacheAbleDataStream(cap);
}
int i = 0;
while (is.hasNext()) {
cnt ++;
IDataMatrix [] idm = is.next();
CacheAbleDataStream ids = iss[i++];
ids.add(idm);
if (i > iss.length - 1) {
i = 0;
if (iss[i].getCnt() >= cap) {
rm.distributeCommand(CommonSlave.CTASKPIECE);
rm.distributeObjects(iss);
iss = new CacheAbleDataStream[num];
for (int j = 0; j < iss.length; j++) {
iss[j] = new CacheAbleDataStream(cap);
}
}
}
}
if (iss[0].getCnt() < cap) {
rm.distributeCommand(CommonSlave.CTASKPIECE);
rm.distributeObjects(iss);
}
}
}
|
[
"[email protected]"
] | |
06e2b38536775085d6b18fe1396bda9aa0cb89c4
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/2/2_48cc4eaf1317d4e32514b8d72dde139f04d6a86d/CursorStatusesAdapter/2_48cc4eaf1317d4e32514b8d72dde139f04d6a86d_CursorStatusesAdapter_t.java
|
e24b2f5d5c39c32274c16cfe6458c4efb3f8c505
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null |
UTF-8
|
Java
| false | false | 12,720 |
java
|
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012 Mariotaku Lee <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.adapter;
import static android.text.format.DateUtils.getRelativeTimeSpanString;
import static org.mariotaku.twidere.Constants.INTENT_ACTION_VIEW_IMAGE;
import static org.mariotaku.twidere.util.HtmlEscapeHelper.unescape;
import static org.mariotaku.twidere.util.Utils.findStatusInDatabases;
import static org.mariotaku.twidere.util.Utils.formatSameDayTime;
import static org.mariotaku.twidere.util.Utils.getAccountColor;
import static org.mariotaku.twidere.util.Utils.getAccountUsername;
import static org.mariotaku.twidere.util.Utils.getAllAvailableImage;
import static org.mariotaku.twidere.util.Utils.getBiggerTwitterProfileImage;
import static org.mariotaku.twidere.util.Utils.getPreviewImage;
import static org.mariotaku.twidere.util.Utils.getStatusBackground;
import static org.mariotaku.twidere.util.Utils.getStatusTypeIconRes;
import static org.mariotaku.twidere.util.Utils.getUserColor;
import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
import static org.mariotaku.twidere.util.Utils.isNullOrEmpty;
import static org.mariotaku.twidere.util.Utils.openUserProfile;
import static org.mariotaku.twidere.util.Utils.parseURL;
import java.text.DateFormat;
import java.util.ArrayList;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.model.ImageSpec;
import org.mariotaku.twidere.model.ParcelableStatus;
import org.mariotaku.twidere.model.PreviewImage;
import org.mariotaku.twidere.model.StatusCursorIndices;
import org.mariotaku.twidere.model.StatusViewHolder;
import org.mariotaku.twidere.util.LazyImageLoader;
import org.mariotaku.twidere.util.StatusesAdapterInterface;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.support.v4.widget.SimpleCursorAdapter;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
public class CursorStatusesAdapter extends SimpleCursorAdapter implements StatusesAdapterInterface, OnClickListener {
private boolean mDisplayProfileImage, mDisplayImagePreview, mDisplayName, mShowAccountColor, mShowAbsoluteTime,
mGapDisallowed, mMultiSelectEnabled;
private final LazyImageLoader mProfileImageLoader, mPreviewImageLoader;
private float mTextSize;
private final Context mContext;
private StatusCursorIndices mIndices;
private final ArrayList<Long> mSelectedStatusIds;
private final boolean mDisplayHiResProfileImage;
public CursorStatusesAdapter(final Context context) {
super(context, R.layout.status_list_item, null, new String[0], new int[0], 0);
mContext = context;
final TwidereApplication application = TwidereApplication.getInstance(context);
mSelectedStatusIds = application.getSelectedStatusIds();
mProfileImageLoader = application.getProfileImageLoader();
mPreviewImageLoader = application.getPreviewImageLoader();
mDisplayHiResProfileImage = context.getResources().getBoolean(R.bool.hires_profile_image);
}
@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
final int position = cursor.getPosition();
final StatusViewHolder holder = (StatusViewHolder) view.getTag();
final boolean is_gap = cursor.getShort(mIndices.is_gap) == 1;
final boolean show_gap = is_gap && !mGapDisallowed;
holder.setShowAsGap(show_gap);
if (!show_gap) {
final String retweeted_by = mDisplayName ? cursor.getString(mIndices.retweeted_by_name) : cursor
.getString(mIndices.retweeted_by_screen_name);
final String text = cursor.getString(mIndices.text);
final String screen_name = cursor.getString(mIndices.screen_name);
final String name = mDisplayName ? cursor.getString(mIndices.name) : screen_name;
final String in_reply_to_screen_name = cursor.getString(mIndices.in_reply_to_screen_name);
final long account_id = cursor.getLong(mIndices.account_id);
final long user_id = cursor.getLong(mIndices.user_id);
final long status_id = cursor.getLong(mIndices.status_id);
final long status_timestamp = cursor.getLong(mIndices.status_timestamp);
final long retweet_count = cursor.getLong(mIndices.retweet_count);
final boolean is_favorite = cursor.getShort(mIndices.is_favorite) == 1;
final boolean is_protected = cursor.getShort(mIndices.is_protected) == 1;
final boolean is_verified = cursor.getShort(mIndices.is_verified) == 1;
final boolean has_location = !isNullOrEmpty(cursor.getString(mIndices.location));
final boolean is_retweet = !isNullOrEmpty(retweeted_by) && cursor.getShort(mIndices.is_retweet) == 1;
final boolean is_reply = !isNullOrEmpty(in_reply_to_screen_name)
&& cursor.getLong(mIndices.in_reply_to_status_id) > 0;
if (mMultiSelectEnabled) {
holder.setSelected(mSelectedStatusIds.contains(status_id));
} else {
holder.setSelected(false);
}
holder.setUserColor(getUserColor(mContext, user_id));
if (text != null) {
holder.setHighlightColor(getStatusBackground(
text.contains('@' + getAccountUsername(mContext, account_id)), is_favorite, is_retweet));
}
holder.setAccountColorEnabled(mShowAccountColor);
if (mShowAccountColor) {
holder.setAccountColor(getAccountColor(mContext, account_id));
}
final PreviewImage preview = getPreviewImage(text, mDisplayImagePreview);
final boolean has_media = preview != null ? preview.has_image : false;
holder.setTextSize(mTextSize);
holder.text.setText(unescape(text));
holder.name.setCompoundDrawablesWithIntrinsicBounds(getUserTypeIconRes(is_verified, is_protected), 0, 0, 0);
holder.name.setText(name);
if (mShowAbsoluteTime) {
holder.time.setText(formatSameDayTime(context, status_timestamp));
} else {
holder.time.setText(getRelativeTimeSpanString(status_timestamp));
}
holder.time.setCompoundDrawablesWithIntrinsicBounds(0, 0,
getStatusTypeIconRes(is_favorite, has_location, has_media), 0);
holder.reply_retweet_status.setVisibility(is_retweet || is_reply ? View.VISIBLE : View.GONE);
if (is_retweet) {
holder.reply_retweet_status.setText(retweet_count > 1 ? mContext.getString(
R.string.retweeted_by_with_count, retweeted_by, retweet_count - 1) : mContext.getString(
R.string.retweeted_by, retweeted_by));
holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_retweet, 0,
0, 0);
} else if (is_reply) {
holder.reply_retweet_status.setText(mContext.getString(R.string.in_reply_to, in_reply_to_screen_name));
holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_reply, 0,
0, 0);
}
holder.profile_image.setVisibility(mDisplayProfileImage ? View.VISIBLE : View.GONE);
if (mDisplayProfileImage) {
final String profile_image_url_string = cursor.getString(mIndices.profile_image_url);
if (mDisplayHiResProfileImage) {
mProfileImageLoader.displayImage(parseURL(getBiggerTwitterProfileImage(profile_image_url_string)),
holder.profile_image);
} else {
mProfileImageLoader.displayImage(parseURL(profile_image_url_string), holder.profile_image);
}
holder.profile_image.setTag(position);
}
final boolean has_preview = mDisplayImagePreview && has_media && preview.matched_url != null;
holder.image_preview.setVisibility(has_preview ? View.VISIBLE : View.GONE);
if (has_preview) {
mPreviewImageLoader.displayImage(parseURL(preview.matched_url), holder.image_preview);
holder.image_preview.setTag(position);
}
}
super.bindView(view, context, cursor);
}
public long findItemIdByPosition(final int position) {
if (position >= 0 && position < getCount()) return getItem(position).getLong(mIndices.status_id);
return -1;
}
public int findItemPositionByStatusId(final long status_id) {
final int count = getCount();
for (int i = 0; i < count; i++) {
if (getItem(i).getLong(mIndices.status_id) == status_id) return i;
}
return -1;
}
@Override
public ParcelableStatus findStatus(final long id) {
final int count = getCount();
for (int i = 0; i < count; i++) {
if (getItemId(i) == id) {
final Cursor cur = getItem(i);
final long account_id = cur.getLong(mIndices.account_id);
final long status_id = cur.getLong(mIndices.status_id);
return findStatusInDatabases(mContext, account_id, status_id);
}
}
return null;
}
@Override
public Cursor getItem(final int position) {
return (Cursor) super.getItem(position);
}
public ParcelableStatus getStatus(final int position) {
final Cursor cur = getItem(position);
final long account_id = cur.getLong(mIndices.account_id);
final long status_id = cur.getLong(mIndices.status_id);
return findStatusInDatabases(mContext, account_id, status_id);
}
@Override
public View newView(final Context context, final Cursor cursor, final ViewGroup parent) {
final View view = super.newView(context, cursor, parent);
final Object tag = view.getTag();
if (!(tag instanceof StatusViewHolder)) {
final StatusViewHolder holder = new StatusViewHolder(view);
view.setTag(holder);
holder.profile_image.setOnClickListener(this);
holder.image_preview.setOnClickListener(this);
}
return view;
}
@Override
public void onClick(final View view) {
final Object tag = view.getTag();
final ParcelableStatus status = tag instanceof Integer ? getStatus((Integer) tag) : null;
if (status == null) return;
switch (view.getId()) {
case R.id.image_preview: {
final ImageSpec spec = getAllAvailableImage(status.image_orig_url_string);
if (spec != null) {
final Intent intent = new Intent(INTENT_ACTION_VIEW_IMAGE, Uri.parse(spec.image_link));
intent.setPackage(mContext.getPackageName());
mContext.startActivity(intent);
}
break;
}
case R.id.profile_image: {
if (mContext instanceof Activity) {
openUserProfile((Activity) mContext, status.account_id, status.user_id, status.screen_name);
}
break;
}
}
}
@Override
public void setDisplayImagePreview(final boolean preview) {
if (preview != mDisplayImagePreview) {
mDisplayImagePreview = preview;
notifyDataSetChanged();
}
}
@Override
public void setDisplayName(final boolean display) {
if (display != mDisplayName) {
mDisplayName = display;
notifyDataSetChanged();
}
}
@Override
public void setDisplayProfileImage(final boolean display) {
if (display != mDisplayProfileImage) {
mDisplayProfileImage = display;
notifyDataSetChanged();
}
}
@Override
public void setGapDisallowed(final boolean disallowed) {
if (mGapDisallowed != disallowed) {
mGapDisallowed = disallowed;
notifyDataSetChanged();
}
}
@Override
public void setMultiSelectEnabled(final boolean multi) {
if (mMultiSelectEnabled != multi) {
mMultiSelectEnabled = multi;
notifyDataSetChanged();
}
}
@Override
public void setShowAbsoluteTime(final boolean show) {
if (show != mShowAbsoluteTime) {
mShowAbsoluteTime = show;
notifyDataSetChanged();
}
}
@Override
public void setShowAccountColor(final boolean show) {
if (show != mShowAccountColor) {
mShowAccountColor = show;
notifyDataSetChanged();
}
}
@Override
public void setTextSize(final float text_size) {
if (text_size != mTextSize) {
mTextSize = text_size;
notifyDataSetChanged();
}
}
@Override
public Cursor swapCursor(final Cursor cursor) {
if (cursor != null) {
mIndices = new StatusCursorIndices(cursor);
} else {
mIndices = null;
}
return super.swapCursor(cursor);
}
}
|
[
"[email protected]"
] | |
f727c6f006dbb94457eb072c803cecbfec712a8f
|
e87f985fdd9177e92966f8b2e85b6e57662e7cf6
|
/jOOQ-test/src/org/jooq/test/access/generatedclasses/tables/records/TIdentityPkRecord.java
|
a56ece59403a67a3bf5e3f957aa9a7f892136cae
|
[
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
ben-manes/jOOQ
|
5ef43f8ea8c5c942dc0b2e0669cc927dca6f2ff7
|
9f160d5e869de1a9d66408d90718148f76c5e000
|
refs/heads/master
| 2023-09-05T03:27:56.109520 | 2013-08-26T09:48:14 | 2013-08-26T10:05:05 | 12,375,424 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,729 |
java
|
/**
* This class is generated by jOOQ
*/
package org.jooq.test.access.generatedclasses.tables.records;
/**
* This class is generated by jOOQ.
*/
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class TIdentityPkRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.test.access.generatedclasses.tables.records.TIdentityPkRecord> implements org.jooq.Record2<java.lang.Integer, java.lang.Integer> {
private static final long serialVersionUID = 1104657257;
/**
* Setter for <code>T_IDENTITY_PK.ID</code>.
*/
public void setId(java.lang.Integer value) {
setValue(0, value);
}
/**
* Getter for <code>T_IDENTITY_PK.ID</code>.
*/
public java.lang.Integer getId() {
return (java.lang.Integer) getValue(0);
}
/**
* Setter for <code>T_IDENTITY_PK.VAL</code>.
*/
public void setVal(java.lang.Integer value) {
setValue(1, value);
}
/**
* Getter for <code>T_IDENTITY_PK.VAL</code>.
*/
public java.lang.Integer getVal() {
return (java.lang.Integer) getValue(1);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Record1<java.lang.Integer> key() {
return (org.jooq.Record1) super.key();
}
// -------------------------------------------------------------------------
// Record2 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Row2<java.lang.Integer, java.lang.Integer> fieldsRow() {
return (org.jooq.Row2) super.fieldsRow();
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Row2<java.lang.Integer, java.lang.Integer> valuesRow() {
return (org.jooq.Row2) super.valuesRow();
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field1() {
return org.jooq.test.access.generatedclasses.tables.TIdentityPk.ID;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field2() {
return org.jooq.test.access.generatedclasses.tables.TIdentityPk.VAL;
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value1() {
return getId();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value2() {
return getVal();
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached TIdentityPkRecord
*/
public TIdentityPkRecord() {
super(org.jooq.test.access.generatedclasses.tables.TIdentityPk.T_IDENTITY_PK);
}
}
|
[
"[email protected]"
] | |
6964a02f91561fe86e28ff70e1d82c95e51cc4ec
|
92f10c41bad09bee05acbcb952095c31ba41c57b
|
/app/src/main/java/io/github/alula/ohmygod/MainActivity771.java
|
ef65062fcd3198e0bb02b77bbbd6172973aa5a90
|
[] |
no_license
|
alula/10000-activities
|
bb25be9aead3d3d2ea9f9ef8d1da4c8dff1a7c62
|
f7e8de658c3684035e566788693726f250170d98
|
refs/heads/master
| 2022-07-30T05:54:54.783531 | 2022-01-29T19:53:04 | 2022-01-29T19:53:04 | 453,501,018 | 16 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 338 |
java
|
package io.github.alula.ohmygod;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity771 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
|
[
"[email protected]"
] | |
b6d9704a0ff1b6c88e95f99da6c3dc019953f5ab
|
451a7e9359ef09106c4f4404fdfe55cfa4c5a1f2
|
/Target.java
|
93f704bbd65fd1340baf5674d819bda3f598028d
|
[] |
no_license
|
SANTHIYA9698/santhiya
|
b30e418fb807af7c0b9f100edac993da3e59e562
|
ccd1513367de80d32e18dc6812799f37bcd56956
|
refs/heads/master
| 2021-01-12T05:47:17.637620 | 2017-10-24T06:57:25 | 2017-10-24T06:57:25 | 77,198,135 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 751 |
java
|
package Logics;
import java.util.*;
public class Target {
public static void main(String []args){
Scanner s=new Scanner(System.in);
int First=0;
int Second=0;
System.out.println("Enter the size of the array:");
int size=s.nextInt();
System.out.println("Enter the target number:");
int target=s.nextInt();
System.out.println("Enter the elements in the array:");
int array[]=new int[size];
for(int i=0;i<size;i++){
array[i]=s.nextInt();
}
for(int j=0;j<size;j++){
for(int i=0;i<size;i++){
if(array[i]!=array[j])
if((array[j]+array[i])==target){
First=array[j];
Second=array[i];
}
}
}
System.out.println("The two numbers add up to a specific target number are "+First+" and "+Second);
}
}
|
[
"[email protected]"
] | |
34e5d6490ff3a80b01d9c7c7c142877d50ea5249
|
3e74cf173ee5fe5dd573b8844f6e893c775e071d
|
/platform-shop/src/main/java/com/platform/entity/CouponGoodsEntity.java
|
c4e0ac9212b951cf1c5c6413da7ebc69450e12c7
|
[
"Apache-2.0"
] |
permissive
|
snn37428/tianyuan_platfrom_shop
|
6a8df77f28c206078f4d9dcf89a51e32ba937c28
|
960c7574b31f4b38251753c14342f4921abf6af6
|
refs/heads/master
| 2022-12-20T21:40:23.779375 | 2020-02-03T11:50:44 | 2020-02-03T11:50:44 | 218,230,499 | 0 | 0 |
Apache-2.0
| 2022-12-16T11:35:55 | 2019-10-29T07:42:17 |
TSQL
|
UTF-8
|
Java
| false | false | 1,210 |
java
|
package com.platform.entity;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* 优惠券关联商品实体
* 表名 nideshop_coupon_goods
*
* @author lipengjun
* @email [email protected]
* @date 2017-08-29 21:50:17
*/
@Setter
@Getter
public class CouponGoodsEntity implements Serializable {
private static final long serialVersionUID = 1L;
//主键
private Integer id;
//优惠券Id
private Integer couponId;
//商品id
private Integer goodsId;
/**
* 设置:主键
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:主键
*/
public Integer getId() {
return id;
}
/**
* 设置:优惠券Id
*/
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
/**
* 获取:优惠券Id
*/
public Integer getCouponId() {
return couponId;
}
/**
* 设置:商品id
*/
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
/**
* 获取:商品id
*/
public Integer getGoodsId() {
return goodsId;
}
}
|
[
"[email protected]"
] | |
462ea1c38aa2273787c216a826e9c73d53f96158
|
9359dcc9b8493475de74d2e31a9b87853cbab199
|
/W01.2-HomeWork-X/src/main/java/ru/otus/services/DataOrigin.java
|
7e4a05fbaca0b4bb2932e5ea10a8d44f3c136be1
|
[] |
no_license
|
victorskurihin/java
|
0f8e6e9e368d71ed09383c46e6424b83a8a5947c
|
9c9367fef1ca5279fa827516066288b37e7b474e
|
refs/heads/master
| 2022-12-25T09:00:50.458111 | 2019-01-29T15:26:43 | 2019-01-29T15:26:43 | 118,604,964 | 0 | 0 | null | 2022-12-16T04:47:38 | 2018-01-23T12:04:38 |
Java
|
UTF-8
|
Java
| false | false | 549 |
java
|
/*
* DataOrigin.java
* This file was last modified at 2018.12.03 20:05 by Victor N. Skurikhin.
* $Id$
* This is free and unencumbered software released into the public domain.
* For more information, please refer to <http://unlicense.org>
*/
package ru.otus.services;
import java.sql.SQLException;
public interface DataOrigin
{
boolean isReady();
void fetchData() throws SQLException;
String getDataXML();
String getDataJSON();
}
/* vim: syntax=java:fileencoding=utf-8:fileformat=unix:tw=78:ts=4:sw=4:sts=4:et
*/
//EOF
|
[
"[email protected]"
] | |
b14e6d5ea9ee96a17aedc4754e444d552b4dd9c6
|
134c58824115ec2cb3453b38897481c4af4bc576
|
/core/src/main/java/org/fao/geonet/geocat/kernel/reusable/KeywordsStrategy.java
|
881c64e2448d656721038982f654a68a172b4a2a
|
[] |
no_license
|
kidaak/geocat
|
1cfd0b58f6c5f928670ea441a99ffc0a1e90b087
|
a573c3d3ef7e6072860cd23a181b20d42e225f47
|
refs/heads/geocat_develop
| 2021-01-15T12:31:58.368458 | 2015-12-16T12:57:55 | 2015-12-16T12:57:55 | 48,890,619 | 0 | 0 | null | 2016-01-01T21:57:51 | 2016-01-01T21:57:51 | null |
UTF-8
|
Java
| false | false | 24,454 |
java
|
//==============================================================================
//=== Copyright (C) 2001-2008 Food and Agriculture Organization of the
//=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
//=== and United Nations Environment Programme (UNEP)
//===
//=== This program is free software; you can redistribute it and/or modify
//=== it under the terms of the GNU General Public License as published by
//=== the Free Software Foundation; either version 2 of the License, or (at
//=== your option) any later version.
//===
//=== This program is distributed in the hope that it will be useful, but
//=== WITHOUT ANY WARRANTY; without even the implied warranty of
//=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//=== General Public License for more details.
//===
//=== You should have received a copy of the GNU General Public License
//=== along with this program; if not, write to the Free Software
//=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
//===
//=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
//=== Rome - Italy. email: [email protected]
//==============================================================================
package org.fao.geonet.geocat.kernel.reusable;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import jeeves.server.UserSession;
import jeeves.xlink.XLink;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.WildcardQuery;
import org.fao.geonet.constants.Geocat;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.domain.Pair;
import org.fao.geonet.kernel.AllThesaurus;
import org.fao.geonet.kernel.KeywordBean;
import org.fao.geonet.kernel.Thesaurus;
import org.fao.geonet.kernel.ThesaurusFinder;
import org.fao.geonet.kernel.search.KeywordsSearcher;
import org.fao.geonet.kernel.search.keyword.KeywordSearchParams;
import org.fao.geonet.kernel.search.keyword.KeywordSearchParamsBuilder;
import org.fao.geonet.kernel.search.keyword.KeywordSearchType;
import org.fao.geonet.kernel.search.keyword.KeywordSort;
import org.fao.geonet.kernel.search.keyword.SortDirection;
import org.fao.geonet.languages.IsoLanguagesMapper;
import org.fao.geonet.util.ElementFinder;
import org.fao.geonet.utils.Xml;
import org.jdom.Element;
import org.openrdf.model.URI;
import org.openrdf.sesame.config.AccessDeniedException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.apache.lucene.search.WildcardQuery.WILDCARD_STRING;
public final class KeywordsStrategy extends SharedObjectStrategy {
public static final String NAMESPACE = "http://custom.shared.obj.ch/concept#";
public static final String GEOCAT_THESAURUS_NAME = "local._none_.geocat.ch";
public static final String NON_VALID_THESAURUS_NAME = "local._none_.non_validated";
private final ThesaurusFinder _thesaurusMan;
private final Path _styleSheet;
private final String _currentLocale;
private final IsoLanguagesMapper _isoLanguagesMapper;
public KeywordsStrategy(IsoLanguagesMapper isoLanguagesMapper, ThesaurusFinder thesaurusMan, Path appPath, String baseURL, String
currentLocale) {
this._thesaurusMan = thesaurusMan;
this._isoLanguagesMapper = isoLanguagesMapper;
_styleSheet = appPath.resolve(Utils.XSL_REUSABLE_OBJECT_DATA_XSL);
_currentLocale = currentLocale;
}
public Pair<Collection<Element>, Boolean> find(Element placeholder, Element originalElem, String defaultMetadataLang)
throws Exception {
if (XLink.isXLink(originalElem))
return NULL;
Collection<Element> results = new ArrayList<>();
List<Pair<Element, String>> allKeywords = getAllKeywords(originalElem);
java.util.Set<String> addedIds = new HashSet<>();
for (Pair<Element, String> elem : allKeywords) {
if (elem.one().getParent() == null || elem.two() == null || elem.two().trim().isEmpty()) {
// already processed by another translation.
continue;
}
KeywordsSearcher searcher = search(elem.two());
List<KeywordBean> keywords = searcher.getResults();
if (!keywords.isEmpty()) {
KeywordBean keyword = keywords.get(0);
elem.one().detach();
String thesaurus = keyword.getThesaurusKey();
String uriCode = keyword.getUriCode();
// do not add if a keyword with the same ID and thesaurus has previously been added
if (addedIds.add(thesaurus + "@@" + uriCode)) {
boolean validated = !thesaurus.equalsIgnoreCase(NON_VALID_THESAURUS_NAME);
Element descriptiveKeywords = xlinkIt(thesaurus, uriCode, validated);
results.add(descriptiveKeywords);
}
}
}
// need to return null if not matche are found so the calling class
// knows there is not changes made
if (results.isEmpty()) {
return NULL;
}
boolean done = true;
List<Element> allKeywords1 = Utils.convertToList(originalElem.getDescendants(new ElementFinder(
"keyword", Geonet.Namespaces.GMD, "MD_Keywords")), Element.class);
if (allKeywords1.size() > 0) {
// still have some elements that need to be made re-usable
done = false;
}
return Pair.read(results, done);
}
private List<Pair<Element, String>> getAllKeywords(Element originalElem) {
List<Element> allKeywords1 = Utils.convertToList(originalElem.getDescendants(new ElementFinder(
"keyword", Geonet.Namespaces.GMD, "MD_Keywords")), Element.class);
List<Pair<Element, String>> allKeywords = new ArrayList<>();
for (Element element : allKeywords1) {
allKeywords.addAll(zip(element, Utils.convertToList(originalElem.getDescendants(new ElementFinder(
"CharacterString", Geonet.Namespaces.GCO, "keyword")), Element.class)));
allKeywords.addAll(zip(element, Utils.convertToList(originalElem.getDescendants(new ElementFinder(
"LocalisedCharacterString", Geonet.Namespaces.GMD, "textGroup")), Element.class)));
}
return allKeywords;
}
private Collection<? extends Pair<Element, String>> zip(Element keywordElem, List<Element> convertToList) {
List<Pair<Element, String>> zipped = new ArrayList<>();
for (Element word : convertToList) {
zipped.add(Pair.read(keywordElem, word.getTextTrim()));
}
return zipped;
}
private KeywordsSearcher search(String keyword) throws Exception {
KeywordSearchParamsBuilder builder = new KeywordSearchParamsBuilder(this._isoLanguagesMapper);
builder.addLang("eng")
.addLang("ger")
.addLang("fre")
.addLang("ita")
.maxResults(1)
.keyword(keyword, KeywordSearchType.MATCH, true);
Collection<Thesaurus> thesauri = new ArrayList<>(_thesaurusMan.getThesauriMap().values());
for (Iterator<Thesaurus> iterator = thesauri.iterator(); iterator.hasNext(); ) {
Thesaurus thesaurus = iterator.next();
if (thesaurus instanceof AllThesaurus) {
continue;
}
String type = thesaurus.getType();
if (type.equals("external")) {
builder.addThesaurus(thesaurus.getKey());
iterator.remove();
} else if (thesaurus.getKey().equals(NON_VALID_THESAURUS_NAME)) {
iterator.remove();
}
}
for (Thesaurus thesaurus : thesauri) {
if (thesaurus instanceof AllThesaurus) {
continue;
}
builder.addThesaurus(thesaurus.getKey());
}
builder.addThesaurus(NON_VALID_THESAURUS_NAME);
KeywordsSearcher searcher = new KeywordsSearcher(this._isoLanguagesMapper, _thesaurusMan);
builder.setComparator(KeywordSort.defaultLabelSorter(SortDirection.DESC));
searcher.search(builder.build());
return searcher;
}
public Element list(UserSession session, String validated, String language, int maxResults) throws Exception {
List<String> thesaurusNames = Lists.newArrayList();
if (validated == null) {
thesaurusNames.addAll(_thesaurusMan.getThesauriMap().keySet());
} else if (validated.equalsIgnoreCase(LUCENE_EXTRA_VALIDATED)) {
thesaurusNames.add(GEOCAT_THESAURUS_NAME);
} else if (validated.equalsIgnoreCase(LUCENE_EXTRA_NON_VALIDATED)) {
thesaurusNames.add(NON_VALID_THESAURUS_NAME);
} else {
thesaurusNames.add(validated);
}
Element keywords = new Element(REPORT_ROOT);
for (String thesaurusName : thesaurusNames) {
if (maxResults <= keywords.getContentSize()) {
break;
}
KeywordsSearcher searcher = new KeywordsSearcher(this._isoLanguagesMapper, _thesaurusMan);
KeywordSearchParamsBuilder builder = new KeywordSearchParamsBuilder(this._isoLanguagesMapper);
builder.addLang(_currentLocale).addLang("fre").addLang("eng").addLang("ger").addLang("ita")
.keyword("*", KeywordSearchType.MATCH, false).maxResults(maxResults - keywords.getContentSize())
.addThesaurus(thesaurusName);
builder.setComparator(KeywordSort.defaultLabelSorter(SortDirection.DESC));
KeywordSearchParams params = builder.build();
searcher.search(params);
session.setProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT, searcher);
addSearchResults(thesaurusName, keywords, searcher, !thesaurusName.equals(NON_VALID_THESAURUS_NAME));
}
sortResults(keywords, null);
return keywords;
}
private void addSearchResults(String thesaurusName, Element keywords, KeywordsSearcher searcher, boolean
validated) throws Exception {
for (KeywordBean bean : searcher.getResults()) {
Element e = new Element(REPORT_ELEMENT);
StringBuilder uriBuilder = new StringBuilder();
uriBuilder.append(XLink.LOCAL_PROTOCOL);
uriBuilder.append("thesaurus.admin?thesaurus=");
uriBuilder.append(thesaurusName);
uriBuilder.append("&id=");
uriBuilder.append(URLEncoder.encode(bean.getUriCode(), "UTF-8"));
uriBuilder.append("&lang=");
uriBuilder.append(bean.getDefaultLang());
Utils.addChild(e, REPORT_ID, createKeywordId(bean));
Utils.addChild(e, REPORT_URL, uriBuilder.toString());
Utils.addChild(e, REPORT_TYPE, "keyword");
final String xlinkHref = createXlinkHRefImpl(bean, validateName(bean.getThesaurusKey()));
Utils.addChild(e, REPORT_XLINK, xlinkHref);
String desc = bean.getDefaultValue();
if (desc == null || desc.isEmpty()) {
for (String word : bean.getValues().values()) {
if (desc != null && !desc.isEmpty()) {
break;
}
desc = word;
}
}
Utils.addChild(e, REPORT_DESC, desc);
Utils.addChild(e, REPORT_VALIDATED, "" + validated);
Utils.addChild(e, REPORT_SEARCH, bean.getThesaurusKey() + bean.getUriCode() + bean.getDefaultValue());
keywords.addContent(e);
}
}
private String createKeywordId(KeywordBean bean) {
return "thesaurus=" + bean.getThesaurusKey() + "&id=" + bean.getUriCode();
}
@Override
public Element search(UserSession session, String validated, String search, String language, int maxResults) throws Exception {
Element results = new Element(REPORT_ELEMENT);
KeywordsSearcher searcher = new KeywordsSearcher(this._isoLanguagesMapper, _thesaurusMan);
for (Thesaurus thesaurus : _thesaurusMan.getThesauriMap().values()) {
final String thesaurusKey = thesaurus.getKey();
if (!GEOCAT_THESAURUS_NAME.equalsIgnoreCase(thesaurusKey) && !NON_VALID_THESAURUS_NAME.equalsIgnoreCase(thesaurusKey)) {
doSearch(session, search, results, searcher, thesaurusKey, true, maxResults);
}
}
doSearch(session, search, results, searcher, GEOCAT_THESAURUS_NAME, true, maxResults);
doSearch(session, search, results, searcher, NON_VALID_THESAURUS_NAME, false, maxResults);
sortResults(results, search);
return results;
}
private void doSearch(UserSession session, String search, Element results, KeywordsSearcher searcher, String thesaurusKey, boolean
validated, int maxResults) throws Exception {
if (maxResults >= results.getContentSize()) {
KeywordSearchParamsBuilder builder = new KeywordSearchParamsBuilder(this._isoLanguagesMapper);
builder.addLang("eng").addLang("fre").addLang("ger").addLang("ita").addLang("roh").keyword(search, KeywordSearchType.CONTAINS, false);
builder.addThesaurus(thesaurusKey);
builder.maxResults(maxResults - results.getContentSize());
builder.setComparator(KeywordSort.defaultLabelSorter(SortDirection.DESC));
KeywordSearchParams params = builder.build();
searcher.search(params);
session.setProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT, searcher);
addSearchResults(thesaurusKey, results, searcher, validated);
}
}
public String createXlinkHref(String id, UserSession session, String thesaurusName) throws Exception {
String thesaurus = validateName(thesaurusName);
KeywordBean concept = lookup(id);
return createXlinkHRefImpl(concept, thesaurus);
}
public static String createXlinkHRefImpl(KeywordBean concept, String thesaurus) throws UnsupportedEncodingException {
String uri = concept.getUriCode();
return XLink.LOCAL_PROTOCOL + "xml.keyword.get?thesaurus=" + thesaurus + "&id=" + URLEncoder.encode(uri, "utf-8") +
"&multiple=false&lang=fre,eng,ger,ita,roh&textgroupOnly";
}
public void performDelete(String[] ids, UserSession session, String thesaurusName) throws Exception {
for (String id : ids) {
try {
// A test to see if id is from a previous search or
KeywordBean concept = lookup(id);
Thesaurus thesaurus = _thesaurusMan.getThesaurusByName(concept.getThesaurusKey());
thesaurus.removeElement(concept);
} catch (NumberFormatException e) {
Thesaurus thesaurus = _thesaurusMan.getThesaurusByName(validateName(thesaurusName));
thesaurus.removeElement(NAMESPACE, extractCode(id));
}
}
}
private static String validateName(String thesaurusName) {
if (thesaurusName == null) {
return NON_VALID_THESAURUS_NAME;
} else {
return thesaurusName;
}
}
private KeywordBean lookup(String id) {
final KeywordSearchParamsBuilder paramsBuilder = new KeywordSearchParamsBuilder(_isoLanguagesMapper);
paramsBuilder.addLang("eng").addLang("fre").addLang("ger").addLang("ita");
final Pair<String, String> idPair = splitUriAndThesaurusName(id);
String uri = idPair.one();
String thesaurusName = idPair.two();
paramsBuilder.addThesaurus(thesaurusName).uri(uri);
final KeywordSearchParams build = paramsBuilder.build();
final List<KeywordBean> keywords;
try {
keywords = build.search(_thesaurusMan);
return keywords.get(0);
} catch (Throwable e) {
return null;
}
}
public Pair<String, String> splitUriAndThesaurusName(String id) {
String[] idParts = id.split("\\&|=");
String uri = null, thesaurusName = null;
if (idParts[0].equalsIgnoreCase("id")) {
uri = idParts[1];
} else {
thesaurusName = idParts[1];
}
if (idParts[2].equalsIgnoreCase("id")) {
uri = idParts[3];
} else {
thesaurusName = idParts[3];
}
return Pair.read(uri, thesaurusName);
}
public String updateHrefId(String oldHref, String uriCodeAndThesaurusName, UserSession session)
throws UnsupportedEncodingException {
final KeywordBean concept = lookup(uriCodeAndThesaurusName);
String base = oldHref.substring(0, oldHref.indexOf('?'));
String encoded = URLEncoder.encode(concept.getUriCode(), "utf-8");
return base + "?thesaurus=" + GEOCAT_THESAURUS_NAME + "&id=" + encoded + "&locales=en,it,de,fr";
}
public Map<String, String> markAsValidated(String[] ids, UserSession session) throws Exception {
Thesaurus geocatThesaurus = _thesaurusMan.getThesaurusByName(GEOCAT_THESAURUS_NAME);
Thesaurus nonValidThesaurus = _thesaurusMan.getThesaurusByName(NON_VALID_THESAURUS_NAME);
Map<String, String> idMap = new HashMap<>();
for (String uriCodeAndThesaurusName : ids) {
KeywordBean concept = lookup(uriCodeAndThesaurusName);
idMap.put(uriCodeAndThesaurusName, createKeywordId(concept));
geocatThesaurus.addElement(concept);
nonValidThesaurus.removeElement(concept);
}
return idMap;
}
private Element xlinkIt(String thesaurus, String keywordUri, boolean validated) throws UnsupportedEncodingException {
String encoded = URLEncoder.encode(keywordUri, "UTF-8");
Element descriptiveKeywords = new Element("descriptiveKeywords", Geonet.Namespaces.GMD);
descriptiveKeywords.setAttribute(XLink.HREF,
XLink.LOCAL_PROTOCOL + "xml.keyword.get?thesaurus=" + thesaurus +
"&id=" + encoded + "&multiple=false&lang=fre,eng,ger,ita,roh&textgroupOnly&skipdescriptivekeywords", XLink.NAMESPACE_XLINK);
if (!validated) {
descriptiveKeywords.setAttribute(XLink.ROLE, ReusableObjManager.NON_VALID_ROLE,
XLink.NAMESPACE_XLINK);
}
descriptiveKeywords.setAttribute(XLink.SHOW, XLink.SHOW_EMBED, XLink.NAMESPACE_XLINK);
return descriptiveKeywords;
}
public Collection<Element> add(Element placeholder, Element originalElem, String metadataLang)
throws Exception {
String nonValidThesaurusName = NON_VALID_THESAURUS_NAME;
String code = UUID.randomUUID().toString();
URI uri = doUpdateKeyword(originalElem, nonValidThesaurusName, code, metadataLang, false);
if (uri == null) {
return Collections.emptyList();
} else {
return Collections.singleton(xlinkIt(NON_VALID_THESAURUS_NAME, uri.toString(), false));
}
}
private URI doUpdateKeyword(Element originalElem, String nonValidThesaurusName, String code, String metadataLang,
boolean update) throws Exception, AccessDeniedException {
@SuppressWarnings("unchecked")
List<Element> xml = Xml.transform((Element) originalElem.clone(), _styleSheet).getChildren("keyword");
Thesaurus thesaurus = _thesaurusMan.getThesaurusByName(nonValidThesaurusName);
KeywordBean bean = new KeywordBean(this._isoLanguagesMapper).
setNamespaceCode(NAMESPACE).
setRelativeCode(code);
for (Element keywordElement : xml) {
String keyword = keywordElement.getTextTrim();
String locale = keywordElement.getAttributeValue("locale");
if (locale == null || locale.trim().length() < 2) {
locale = metadataLang;
} else {
locale = locale.toLowerCase();
}
locale = locale.toLowerCase().substring(0, 2);
bean.setValue(keyword, locale);
bean.setDefinition(keyword, locale);
}
URI uri;
if (update) {
uri = thesaurus.updateElement(bean, true);
} else {
uri = thesaurus.addElement(bean);
}
return uri;
}
public Collection<Element> updateObject(Element xlink, String metadataLang) throws Exception {
String thesaurusName = Utils.extractUrlParam(xlink, "thesaurus");
if (!NON_VALID_THESAURUS_NAME.equals(thesaurusName)) {
return Collections.emptySet();
}
String id = Utils.extractUrlParam(xlink, "id");
String code = extractCode(id);
doUpdateKeyword(xlink, thesaurusName, code, metadataLang, true);
return Collections.emptySet();
}
private String extractCode(String code) throws UnsupportedEncodingException {
code = URLDecoder.decode(code, "UTF-8");
int hashIndex = code.indexOf("#", 1) + 1;
if (hashIndex > 2) {
code = code.substring(hashIndex);
}
return code;
}
public boolean isValidated(String href) throws Exception {
return !href.contains("thesaurus=local._none_.non_validated");
}
@Override
public String toString() {
return "Reusable Keyword";
}
@Override
public String getInvalidXlinkLuceneField() {
return "invalid_xlink_keyword";
}
@Override
public String getValidXlinkLuceneField() {
return "valid_xlink_keyword";
}
@Override
public String createAsNeeded(String href, UserSession session) throws Exception {
String decodedHref = URLDecoder.decode(href, "UTF-8");
if (!decodedHref.toLowerCase().contains("thesaurus=" + NON_VALID_THESAURUS_NAME.toLowerCase())) {
return href;
}
String rawId = Utils.id(href);
if (rawId != null) {
String startId = URLDecoder.decode(rawId, "UTF-8");
if (startId.startsWith(NAMESPACE)) {
return href;
}
}
String code = UUID.randomUUID().toString();
Thesaurus thesaurus = _thesaurusMan.getThesaurusByName(NON_VALID_THESAURUS_NAME);
KeywordBean keywordBean = new KeywordBean(this._isoLanguagesMapper)
.setNamespaceCode(NAMESPACE)
.setRelativeCode(code)
.setValue("", Geocat.DEFAULT_LANG)
.setDefinition("", Geocat.DEFAULT_LANG);
String id = URLEncoder.encode(thesaurus.addElement(keywordBean).toString(), "UTF-8");
return XLink.LOCAL_PROTOCOL + "xml.keyword.get?thesaurus=" + NON_VALID_THESAURUS_NAME + "&id=" + id +
"&multiple=false&lang=fre,eng,ger,ita,roh&textgroupOnly";
}
@Override
public Function<String, String> numericIdToConcreteId(final UserSession session) {
return new Function<String, String>() {
public String apply(String id) {
if (!id.contains("=") && !id.contains("&")) {
return id;
}
try {
return URLEncoder.encode(splitUriAndThesaurusName(id).one(), "UTF-8");
} catch (UnsupportedEncodingException e) {
return id;
}
}
};
}
@Override
public Query createFindMetadataQuery(String field, String concreteId, boolean isValidated) {
BooleanQuery query = new BooleanQuery();
Term term = new Term(field, WILDCARD_STRING + concreteId + "," + WILDCARD_STRING);
Term term2 = new Term(field, WILDCARD_STRING + concreteId + "&" + WILDCARD_STRING);
query.add(new WildcardQuery(term), BooleanClause.Occur.SHOULD);
query.add(new WildcardQuery(term2), BooleanClause.Occur.SHOULD);
return query;
}
}
|
[
"[email protected]"
] | |
02f6246a3a72c5b0aa7afcc16a77dedc6a33ba1d
|
1c6d3bb92f64bdc8eda7e287cf1cfbb0a5044684
|
/frameworkx/dubbo-cluster/src/main/java/net/jahhan/spi/LoadBalance.java
|
a202f2f04a458076eceba751311170ca2cf35854
|
[
"Apache-2.0"
] |
permissive
|
zhaohq90/jahhan
|
59e36f7d7b353d64c777663b44109d2c3afd082b
|
370a1c090035ce19ec18bb8c5e13d35c33275e99
|
refs/heads/master
| 2020-03-23T19:43:10.462699 | 2018-04-08T13:11:53 | 2018-04-08T13:11:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,629 |
java
|
/*
* Copyright 1999-2011 Alibaba Group.
*
* 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 net.jahhan.spi;
import java.util.List;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.cluster.Directory;
import com.frameworkx.annotation.Adaptive;
import net.jahhan.common.extension.annotation.SPI;
import net.jahhan.exception.JahhanException;
import net.jahhan.extension.loadBalance.RandomLoadBalance;
/**
* LoadBalance. (SPI, Singleton, ThreadSafe)
*
* <a href="http://en.wikipedia.org/wiki/Load_balancing_(computing)">Load-Balancing</a>
*
* @see net.jahhan.spi.Cluster#join(Directory)
* @author qian.lei
* @author william.liangf
*/
@SPI(RandomLoadBalance.NAME)
public interface LoadBalance {
/**
* select one invoker in list.
*
* @param invokers invokers.
* @param url refer url
* @param invocation invocation.
* @return selected invoker.
*/
@Adaptive("loadbalance")
<T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws JahhanException;
}
|
[
"[email protected]"
] | |
36014032dbee3e888e84f383ef0dde76caf83bde
|
f5d0c510054ebae1c4ae6e47c92fd1d2f3f5b062
|
/src/test/java/User.java
|
94f809286ccd0c04ab3d81480d4cc484250a69d8
|
[] |
no_license
|
RodSav/training
|
bcde01cf3e2c1bb7eccd1656fb4bddba93ae52e1
|
17dd73aa95d825a8c17a65261dc467c1788f4a05
|
refs/heads/master
| 2021-01-21T10:46:55.409049 | 2017-08-31T09:59:47 | 2017-08-31T09:59:47 | 101,986,664 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 341 |
java
|
public class User {
private String username;
private String password;
public User (String username, String password) {
this.username = username;
this.password = password;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}
|
[
"[email protected]"
] | |
d20574bb7becda027da56e8b78ce9455d60f7a3d
|
3f6bf165b478450f64f0614e5fde312dd8dfa1ff
|
/vendor/github.com/zenoss/zing-proto/java/src/main/java/org/zenoss/zing/proto/model/TypedEntity.java
|
5db3728520c72302cb473f72f0da42652aa53516
|
[] |
no_license
|
fraibacas/zing-injector
|
b68f970091abdc27c767e6066e2ea5c46a3bc9a9
|
d8119599ee022f33d4f3faf29c90de0d81346c15
|
refs/heads/master
| 2021-05-11T14:44:06.076043 | 2018-01-16T16:58:06 | 2018-01-16T16:58:06 | 117,711,523 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | true | 35,621 |
java
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: model/model.proto
package org.zenoss.zing.proto.model;
/**
* <pre>
* domain TypedEntity struct.
* </pre>
*
* Protobuf type {@code model.TypedEntity}
*/
public final class TypedEntity extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:model.TypedEntity)
TypedEntityOrBuilder {
private static final long serialVersionUID = 0L;
// Use TypedEntity.newBuilder() to construct.
private TypedEntity(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private TypedEntity() {
id_ = "";
entityId_ = "";
schemaId_ = "";
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private TypedEntity(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
java.lang.String s = input.readStringRequireUtf8();
id_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
entityId_ = s;
break;
}
case 26: {
java.lang.String s = input.readStringRequireUtf8();
schemaId_ = s;
break;
}
case 34: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
fields_ = com.google.protobuf.MapField.newMapField(
FieldsDefaultEntryHolder.defaultEntry);
mutable_bitField0_ |= 0x00000008;
}
com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Any>
fields__ = input.readMessage(
FieldsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
fields_.getMutableMap().put(
fields__.getKey(), fields__.getValue());
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.zenoss.zing.proto.model.Model.internal_static_model_TypedEntity_descriptor;
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMapField(
int number) {
switch (number) {
case 4:
return internalGetFields();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.zenoss.zing.proto.model.Model.internal_static_model_TypedEntity_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.zenoss.zing.proto.model.TypedEntity.class, org.zenoss.zing.proto.model.TypedEntity.Builder.class);
}
private int bitField0_;
public static final int ID_FIELD_NUMBER = 1;
private volatile java.lang.Object id_;
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
}
}
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ENTITYID_FIELD_NUMBER = 2;
private volatile java.lang.Object entityId_;
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public java.lang.String getEntityId() {
java.lang.Object ref = entityId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
entityId_ = s;
return s;
}
}
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public com.google.protobuf.ByteString
getEntityIdBytes() {
java.lang.Object ref = entityId_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
entityId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int SCHEMAID_FIELD_NUMBER = 3;
private volatile java.lang.Object schemaId_;
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public java.lang.String getSchemaId() {
java.lang.Object ref = schemaId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
schemaId_ = s;
return s;
}
}
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public com.google.protobuf.ByteString
getSchemaIdBytes() {
java.lang.Object ref = schemaId_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
schemaId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int FIELDS_FIELD_NUMBER = 4;
private static final class FieldsDefaultEntryHolder {
static final com.google.protobuf.MapEntry<
java.lang.String, com.google.protobuf.Any> defaultEntry =
com.google.protobuf.MapEntry
.<java.lang.String, com.google.protobuf.Any>newDefaultInstance(
org.zenoss.zing.proto.model.Model.internal_static_model_TypedEntity_FieldsEntry_descriptor,
com.google.protobuf.WireFormat.FieldType.STRING,
"",
com.google.protobuf.WireFormat.FieldType.MESSAGE,
com.google.protobuf.Any.getDefaultInstance());
}
private com.google.protobuf.MapField<
java.lang.String, com.google.protobuf.Any> fields_;
private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Any>
internalGetFields() {
if (fields_ == null) {
return com.google.protobuf.MapField.emptyMapField(
FieldsDefaultEntryHolder.defaultEntry);
}
return fields_;
}
public int getFieldsCount() {
return internalGetFields().getMap().size();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public boolean containsFields(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
return internalGetFields().getMap().containsKey(key);
}
/**
* Use {@link #getFieldsMap()} instead.
*/
@java.lang.Deprecated
public java.util.Map<java.lang.String, com.google.protobuf.Any> getFields() {
return getFieldsMap();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public java.util.Map<java.lang.String, com.google.protobuf.Any> getFieldsMap() {
return internalGetFields().getMap();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public com.google.protobuf.Any getFieldsOrDefault(
java.lang.String key,
com.google.protobuf.Any defaultValue) {
if (key == null) { throw new java.lang.NullPointerException(); }
java.util.Map<java.lang.String, com.google.protobuf.Any> map =
internalGetFields().getMap();
return map.containsKey(key) ? map.get(key) : defaultValue;
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public com.google.protobuf.Any getFieldsOrThrow(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
java.util.Map<java.lang.String, com.google.protobuf.Any> map =
internalGetFields().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
}
if (!getEntityIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, entityId_);
}
if (!getSchemaIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, schemaId_);
}
com.google.protobuf.GeneratedMessageV3
.serializeStringMapTo(
output,
internalGetFields(),
FieldsDefaultEntryHolder.defaultEntry,
4);
unknownFields.writeTo(output);
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
}
if (!getEntityIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, entityId_);
}
if (!getSchemaIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, schemaId_);
}
for (java.util.Map.Entry<java.lang.String, com.google.protobuf.Any> entry
: internalGetFields().getMap().entrySet()) {
com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Any>
fields__ = FieldsDefaultEntryHolder.defaultEntry.newBuilderForType()
.setKey(entry.getKey())
.setValue(entry.getValue())
.build();
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, fields__);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof org.zenoss.zing.proto.model.TypedEntity)) {
return super.equals(obj);
}
org.zenoss.zing.proto.model.TypedEntity other = (org.zenoss.zing.proto.model.TypedEntity) obj;
boolean result = true;
result = result && getId()
.equals(other.getId());
result = result && getEntityId()
.equals(other.getEntityId());
result = result && getSchemaId()
.equals(other.getSchemaId());
result = result && internalGetFields().equals(
other.internalGetFields());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + getId().hashCode();
hash = (37 * hash) + ENTITYID_FIELD_NUMBER;
hash = (53 * hash) + getEntityId().hashCode();
hash = (37 * hash) + SCHEMAID_FIELD_NUMBER;
hash = (53 * hash) + getSchemaId().hashCode();
if (!internalGetFields().getMap().isEmpty()) {
hash = (37 * hash) + FIELDS_FIELD_NUMBER;
hash = (53 * hash) + internalGetFields().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static org.zenoss.zing.proto.model.TypedEntity parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static org.zenoss.zing.proto.model.TypedEntity parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static org.zenoss.zing.proto.model.TypedEntity parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(org.zenoss.zing.proto.model.TypedEntity prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* domain TypedEntity struct.
* </pre>
*
* Protobuf type {@code model.TypedEntity}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:model.TypedEntity)
org.zenoss.zing.proto.model.TypedEntityOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.zenoss.zing.proto.model.Model.internal_static_model_TypedEntity_descriptor;
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMapField(
int number) {
switch (number) {
case 4:
return internalGetFields();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
@SuppressWarnings({"rawtypes"})
protected com.google.protobuf.MapField internalGetMutableMapField(
int number) {
switch (number) {
case 4:
return internalGetMutableFields();
default:
throw new RuntimeException(
"Invalid map field number: " + number);
}
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.zenoss.zing.proto.model.Model.internal_static_model_TypedEntity_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.zenoss.zing.proto.model.TypedEntity.class, org.zenoss.zing.proto.model.TypedEntity.Builder.class);
}
// Construct using org.zenoss.zing.proto.model.TypedEntity.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
id_ = "";
entityId_ = "";
schemaId_ = "";
internalGetMutableFields().clear();
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.zenoss.zing.proto.model.Model.internal_static_model_TypedEntity_descriptor;
}
public org.zenoss.zing.proto.model.TypedEntity getDefaultInstanceForType() {
return org.zenoss.zing.proto.model.TypedEntity.getDefaultInstance();
}
public org.zenoss.zing.proto.model.TypedEntity build() {
org.zenoss.zing.proto.model.TypedEntity result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.zenoss.zing.proto.model.TypedEntity buildPartial() {
org.zenoss.zing.proto.model.TypedEntity result = new org.zenoss.zing.proto.model.TypedEntity(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
result.id_ = id_;
result.entityId_ = entityId_;
result.schemaId_ = schemaId_;
result.fields_ = internalGetFields();
result.fields_.makeImmutable();
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.zenoss.zing.proto.model.TypedEntity) {
return mergeFrom((org.zenoss.zing.proto.model.TypedEntity)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(org.zenoss.zing.proto.model.TypedEntity other) {
if (other == org.zenoss.zing.proto.model.TypedEntity.getDefaultInstance()) return this;
if (!other.getId().isEmpty()) {
id_ = other.id_;
onChanged();
}
if (!other.getEntityId().isEmpty()) {
entityId_ = other.entityId_;
onChanged();
}
if (!other.getSchemaId().isEmpty()) {
schemaId_ = other.schemaId_;
onChanged();
}
internalGetMutableFields().mergeFrom(
other.internalGetFields());
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.zenoss.zing.proto.model.TypedEntity parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.zenoss.zing.proto.model.TypedEntity) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object id_ = "";
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public Builder setId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
id_ = value;
onChanged();
return this;
}
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public Builder clearId() {
id_ = getDefaultInstance().getId();
onChanged();
return this;
}
/**
* <pre>
* The typedentity id
* </pre>
*
* <code>string id = 1;</code>
*/
public Builder setIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
id_ = value;
onChanged();
return this;
}
private java.lang.Object entityId_ = "";
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public java.lang.String getEntityId() {
java.lang.Object ref = entityId_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
entityId_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public com.google.protobuf.ByteString
getEntityIdBytes() {
java.lang.Object ref = entityId_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
entityId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public Builder setEntityId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
entityId_ = value;
onChanged();
return this;
}
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public Builder clearEntityId() {
entityId_ = getDefaultInstance().getEntityId();
onChanged();
return this;
}
/**
* <pre>
* The associated entity id
* </pre>
*
* <code>string entityId = 2;</code>
*/
public Builder setEntityIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
entityId_ = value;
onChanged();
return this;
}
private java.lang.Object schemaId_ = "";
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public java.lang.String getSchemaId() {
java.lang.Object ref = schemaId_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
schemaId_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public com.google.protobuf.ByteString
getSchemaIdBytes() {
java.lang.Object ref = schemaId_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
schemaId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public Builder setSchemaId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
schemaId_ = value;
onChanged();
return this;
}
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public Builder clearSchemaId() {
schemaId_ = getDefaultInstance().getSchemaId();
onChanged();
return this;
}
/**
* <pre>
* The associated schema id
* </pre>
*
* <code>string schemaId = 3;</code>
*/
public Builder setSchemaIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
schemaId_ = value;
onChanged();
return this;
}
private com.google.protobuf.MapField<
java.lang.String, com.google.protobuf.Any> fields_;
private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Any>
internalGetFields() {
if (fields_ == null) {
return com.google.protobuf.MapField.emptyMapField(
FieldsDefaultEntryHolder.defaultEntry);
}
return fields_;
}
private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Any>
internalGetMutableFields() {
onChanged();;
if (fields_ == null) {
fields_ = com.google.protobuf.MapField.newMapField(
FieldsDefaultEntryHolder.defaultEntry);
}
if (!fields_.isMutable()) {
fields_ = fields_.copy();
}
return fields_;
}
public int getFieldsCount() {
return internalGetFields().getMap().size();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public boolean containsFields(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
return internalGetFields().getMap().containsKey(key);
}
/**
* Use {@link #getFieldsMap()} instead.
*/
@java.lang.Deprecated
public java.util.Map<java.lang.String, com.google.protobuf.Any> getFields() {
return getFieldsMap();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public java.util.Map<java.lang.String, com.google.protobuf.Any> getFieldsMap() {
return internalGetFields().getMap();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public com.google.protobuf.Any getFieldsOrDefault(
java.lang.String key,
com.google.protobuf.Any defaultValue) {
if (key == null) { throw new java.lang.NullPointerException(); }
java.util.Map<java.lang.String, com.google.protobuf.Any> map =
internalGetFields().getMap();
return map.containsKey(key) ? map.get(key) : defaultValue;
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public com.google.protobuf.Any getFieldsOrThrow(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
java.util.Map<java.lang.String, com.google.protobuf.Any> map =
internalGetFields().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
public Builder clearFields() {
internalGetMutableFields().getMutableMap()
.clear();
return this;
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public Builder removeFields(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
internalGetMutableFields().getMutableMap()
.remove(key);
return this;
}
/**
* Use alternate mutation accessors instead.
*/
@java.lang.Deprecated
public java.util.Map<java.lang.String, com.google.protobuf.Any>
getMutableFields() {
return internalGetMutableFields().getMutableMap();
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public Builder putFields(
java.lang.String key,
com.google.protobuf.Any value) {
if (key == null) { throw new java.lang.NullPointerException(); }
if (value == null) { throw new java.lang.NullPointerException(); }
internalGetMutableFields().getMutableMap()
.put(key, value);
return this;
}
/**
* <pre>
* Fields associated with this fact.
* </pre>
*
* <code>map<string, .google.protobuf.Any> fields = 4;</code>
*/
public Builder putAllFields(
java.util.Map<java.lang.String, com.google.protobuf.Any> values) {
internalGetMutableFields().getMutableMap()
.putAll(values);
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:model.TypedEntity)
}
// @@protoc_insertion_point(class_scope:model.TypedEntity)
private static final org.zenoss.zing.proto.model.TypedEntity DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new org.zenoss.zing.proto.model.TypedEntity();
}
public static org.zenoss.zing.proto.model.TypedEntity getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<TypedEntity>
PARSER = new com.google.protobuf.AbstractParser<TypedEntity>() {
public TypedEntity parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new TypedEntity(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<TypedEntity> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<TypedEntity> getParserForType() {
return PARSER;
}
public org.zenoss.zing.proto.model.TypedEntity getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
|
[
"[email protected]"
] | |
497a6c51de29d1620e84b7af24767a90ffdf83dd
|
9d3f08e109c02ab0e7098b03e68b497bb6c3438f
|
/test/org/grayleaves/problem/UpdateTest.java
|
1277f92ad5b2ff305bc7d72bfb7d2b243a34a98e
|
[] |
no_license
|
nnoviello/statistics
|
99e3c92792dafda6981317253a1e4bec87eeca53
|
e19eaeb6881a4c4b46c6b32a856ed70d6716b3a6
|
HEAD
| 2016-09-16T16:26:44.955357 | 2014-01-15T21:19:11 | 2014-01-15T21:19:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 473 |
java
|
package org.grayleaves.problem;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class UpdateTest
{
private Update update;
@Before
public void setUp() throws Exception
{
update = new TestingUpdate(3, "testingStep");
}
@Test
public void verifyUpdateHasStepInformation() throws Exception
{
assertEquals("testingStep3", update.getStepSequenceId());
assertEquals("testingStep", update.getUpdateStep());
}
}
|
[
"[email protected]"
] | |
2cb605e97bcccb94de054e2202f70f5275f1066d
|
ad78185ea1e12e3ef6a808ccfbf0740ffb7573b9
|
/ARs/app/src/main/java/com/example/ars/MainActivity.java
|
9d8588b0957fa072a58e2e431f0d632facded229
|
[] |
no_license
|
ZixinZou/ARs
|
92e787d9eb52e44610017bb84d0845c445d6b779
|
02a1041e491210c3f0ee03242c8580ba9c34f9ae
|
refs/heads/master
| 2020-06-17T03:05:03.122061 | 2019-07-08T09:07:03 | 2019-07-08T09:07:03 | 195,775,725 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 470 |
java
|
package com.example.ars;
import androidx.appcompat.app.AppCompatActivity;
import android.opengl.GLES20;
import android.os.Bundle;
import com.example.ars.Model.OneGlSurfaceView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OneGlSurfaceView glSurfaceView = new OneGlSurfaceView(this);
setContentView(glSurfaceView);
}
}
|
[
"[email protected]"
] | |
be56f463982e0806d2b77d62f30e7c37fb2dd265
|
a4925d3d013290717a9cd737e980a78d6cc97b77
|
/app/src/main/java/sv/edu/ues/fia/eisi/grupo06tarea1/SolicitudPrimerRevision_Eliminar.java
|
cf7d8aee847037faa8d5c73826e62624ac74f4fc
|
[] |
no_license
|
chesterven/Grupo06Tarea1
|
5267e0f327d5aeb62878e6aba9c68fccebad0f2a
|
f6b2f5c49bd7b25f423e93d050775ff93fd3abf9
|
refs/heads/master
| 2020-05-20T10:52:09.359894 | 2019-06-17T08:40:02 | 2019-06-17T08:40:02 | 185,532,677 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,344 |
java
|
//CS16008 Castro Sánchez José Andrés
package sv.edu.ues.fia.eisi.grupo06tarea1;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class SolicitudPrimerRevision_Eliminar extends AppCompatActivity {
DBHelperInicial DBHelper;
EditText idSoli;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_solicitud_primer_revision__eliminar);
idSoli=(EditText)findViewById(R.id.idSolicitudPrimerRevisionEliminar);
DBHelper=new DBHelperInicial(this);
}
public void eliminarSolicitudPrimerRevision(View v){
if(idSoli.getText().toString().equals("")){
Toast.makeText(this, "Debe ingresar un id para poder eliminar", Toast.LENGTH_SHORT).show();
}
else{
DBHelper.abrir();
String msj=DBHelper.eliminarSolicitudPrimerRevision(idSoli.getText().toString());
DBHelper.cerrar();
limpiarTexto();
Toast.makeText(this, msj, Toast.LENGTH_SHORT).show();
}
}
public void limpiarTexto(View v){
idSoli.setText("");
}
public void limpiarTexto(){
idSoli.setText("");
}
}
|
[
"[email protected]"
] | |
8a6fdbb33995a36afa890b0fbaf5e655309d4c97
|
e1e0b13dc3b84cca8157894188b2402b691fbfe9
|
/src/com/gao/coder/myapp/activity/creditcard/CreditCardListActivity.java
|
7be05722aa2ea639688014f0e16e2299c77e9425
|
[] |
no_license
|
GaoJunLostInCode/MyApp
|
3040d1453972e750bfe503afcf99f99838830115
|
bee7e11919bbb811e66668aaff9135fc862e7a0c
|
refs/heads/master
| 2021-01-01T20:48:44.546536 | 2014-09-02T13:49:46 | 2014-09-02T13:49:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,542 |
java
|
package com.gao.coder.myapp.activity.creditcard;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.gao.coder.myapp.R;
import com.gao.coder.myapp.database.creditcard.SQLiteOperate;
import com.gao.coder.myapp.database.creditcard.SQLiteOperateIml;
import com.gao.coder.myapp.fragment.creditcard.CreditCardDetailFragment;
import com.gao.coder.myapp.fragment.creditcard.CreditCardListFragment;
import com.gao.coder.myapp.fragment.creditcard.CreditCardListFragment.ItemClickListener;
import com.gao.coder.myapp.model.creditcard.CreditCard;
public class CreditCardListActivity extends CreditCardBaseActivity
{
private CreditCardListFragment mFragmentList = null;
private CreditCardDetailFragment mFragmentDetail = null;
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings)
{
return true;
}
return super.onOptionsItemSelected(item);
}
static int count = 0;
public void addCreditCard(View view)
{
CreditCard card = new CreditCard();
card.setmBankName("xxxx" + count);
count++;
card.setmCardNum("8800");
SQLiteOperate mSqLiteOperate = new SQLiteOperateIml(
this.getApplicationContext());
mSqLiteOperate.addCreditCard(card);
mFragmentList.freshList();
}
@Override
protected String title()
{
return "信用卡";
}
@Override
protected View onCreateContentView()
{
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.activity_creditcard_list, null);
FragmentManager fragmentManager = getSupportFragmentManager();
mFragmentList = (CreditCardListFragment) fragmentManager
.findFragmentById(R.id.fragment_mainActivity_list);
mFragmentList.setItemClickListener(new ItemClickListener()
{
@Override
public void onItemClicked(CreditCard card)
{
mFragmentDetail.showCreditCard(card);
}
});
mFragmentDetail = (CreditCardDetailFragment) fragmentManager
.findFragmentById(R.id.fragment_mainActivity_detail);
return view;
}
}
|
[
"[email protected]"
] | |
7ea2342e1af01c6f3ceac1bf0608fbd62208dd85
|
fd4b3ed9e3c0504f55d380465df342b0d6186472
|
/springcloud2020/cloudalibaba-consumer-nacos-order84/src/main/java/com/lk/springcloud/service/PaymentService.java
|
fbe9fffef55b48222860c8d006b090158173cce8
|
[] |
no_license
|
ThinkingDream/springcloud
|
6d12c409d43c15436915eea97eaba2504c39825e
|
5124d6b0ae0972e558a5af4e94d63cb194fa4914
|
refs/heads/master
| 2023-02-26T15:48:46.623902 | 2021-02-04T08:07:39 | 2021-02-04T08:07:39 | 317,749,220 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 612 |
java
|
package com.lk.springcloud.service;
import com.lk.springcloud.entities.CommonResult;
import com.lk.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* @author lk
* @version 1.0
* @date 2021/1/15 16:13
*/
@FeignClient(value = "nacos-payment-provider",fallback = PaymentFallbackService.class)
public interface PaymentService
{
@GetMapping(value = "/paymentSQL/{id}")
public CommonResult<Payment> paymentSQL(@PathVariable("id") Long id);
}
|
[
"[email protected]"
] | |
ff93a66d59a52aafcbca2badef7494462467b2fc
|
239d59e541310e888bb3d597483dccf39bbed7e0
|
/VideoPlayer/app/src/androidTest/java/com/example/videoplayer/ExampleInstrumentedTest.java
|
2bfabaee2548c563eb3588747f83446affab89f1
|
[] |
no_license
|
shy-hill/Android
|
0ac64a997eca159d8caed3bc07a2ea8752a4cab8
|
c3be16163b4ac693abd64f243f629a29292efe47
|
refs/heads/master
| 2023-05-27T00:03:52.272779 | 2021-06-15T08:38:45 | 2021-06-15T08:38:45 | 377,077,541 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 785 |
java
|
package com.example.videoplayer;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.videoplayer", appContext.getPackageName());
}
}
|
[
"[email protected]"
] | |
67cfa350e4a72205986fb0269460a9c1e3646c72
|
1cc8364c9aa0166aea2356f792f7e14cddda08e1
|
/src/vehicles/Engine.java
|
99ac01d67213b95b390a3edb1e5c678fc8e24d22
|
[] |
no_license
|
LimorShavit1/City-Transportation-
|
93fb4ea4be4388fa4301bcf05c00e053be47be3f
|
7c486159e849551cc433570ac5060afee98452a3
|
refs/heads/master
| 2022-11-07T23:43:27.349842 | 2020-06-22T14:08:47 | 2020-06-22T14:08:47 | 274,153,214 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,384 |
java
|
package vehicles;
import javax.swing.Icon;
public abstract class Engine implements Cloneable {
private float fuel_Per_KM;
private int fuel_Tank;
/**
* Engine class constructor
*/
public Engine(float fuel_Per_KM,int fuel_Tank) {
this.fuel_Per_KM=fuel_Per_KM;
this.fuel_Tank=fuel_Tank;
}
/**
* function return vehicle fuel Per KM
* @return vehicle fuel_Per_KM
*/
public float getfuel_Per_KM() {
return fuel_Per_KM;
}
/**
* function set vehicle fuel Per KM data member
* @param fuel_Per_KM
* @return while set fuel success
*/
public boolean setFuel(float fuel_Per_KM) {
this.fuel_Per_KM = fuel_Per_KM;
return true;
}
/**
* function return vehicle max tank capacity
* @return fuel_Tank parameter
*/
public int getFuel_Tank() {
return fuel_Tank;
}
/**
* function set fuel tank max capacity
* @param fuel_Tank tank max capacity
* @return true if setting success
*/
public boolean setFuel_Tank(int fuel_Tank) {
this.fuel_Tank = fuel_Tank;
return true;
}
/**
* string of this data members
*/
public String toString() {
return "Fuel Per KM: "+this.fuel_Per_KM+ ", Fuel Tank: "+this.fuel_Tank+" ";
}
protected abstract Engine clone();
/**
* return vehicle name
*/
public String getVehicleName() {
return null;
}
}
|
[
"[email protected]"
] | |
75dd627ee8873c03eb833df12df29c6319e253f5
|
9307cd0898fd3490ca6ff007328028f1fd1c1ba4
|
/src/org/Projet/beans/etablisement/Chambre.java
|
9082224d3cd21da8efeddfc005279461359e2a42
|
[] |
no_license
|
Khedidja-assoul/SIH-application
|
9379e8b7adcd0f9d3f16d94f8e814ebb0a0f241b
|
86fc0b99d7007a98544777b87e67bfbbd98153e0
|
refs/heads/master
| 2023-01-13T07:46:22.779106 | 2020-11-18T13:13:13 | 2020-11-18T13:13:13 | 313,941,042 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,197 |
java
|
package org.Projet.beans.etablisement;
import org.Projet.beans.patient.Patient;
import java.util.ArrayList;
public class Chambre {
private int num;
private int etage;
private int nbLits; // chambre double triple ...etc
private boolean estReserver;
private ArrayList<Patient> listePatient;
public Chambre(int num, int etage, int nbLits) {
this.num = num;
this.etage = etage;
this.nbLits = nbLits;
this.estReserver = false;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getEtage() {
return etage;
}
public void setEtage(int etage) {
this.etage = etage;
}
public int getNbLits() {
return nbLits;
}
public void setNbLits(int nbLits) {
this.nbLits = nbLits;
}
public boolean isEstReserver() {
return estReserver;
}
public void setEstReserver(boolean estReserver) {
this.estReserver = estReserver;
}
@Override
public String toString() {
return Integer.toString(num) +" " +Integer.toString(etage)+ " "+Integer.toString(nbLits);
}
}
|
[
"[email protected]"
] | |
8258d3aaef6d2740223e8e18564c4aa38441bb4e
|
a0a0e4ea8dfe45b0d35194ddf020915e39ae3f24
|
/MyCismClient/src/test/java/org/mycmis/MyCismClient/AppTest.java
|
0a8a145060243682b7c28997016ff90820497b15
|
[] |
no_license
|
msen2000/mycmis
|
0b67e2d55b0201e16782127cbd00286b17d85962
|
ecd0afe41deef83099f83beef3218d24c54ff5c9
|
refs/heads/master
| 2021-01-10T18:41:30.860617 | 2015-03-02T19:59:39 | 2015-03-02T19:59:39 | 31,040,041 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 651 |
java
|
package org.mycmis.MyCismClient;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
|
[
"[email protected]"
] | |
3de25832be30664846389b28b83f15dcfd83d2b9
|
a10137b7f88eb5698a9bb93a794eda05938a0d01
|
/app/src/main/java/com/secure/news/fragement/technology_fragement.java
|
f019a32e491a0c6a8d2b6e9394eb397eb63ba5af
|
[] |
no_license
|
SatyamSoni23/News
|
367f6386339a16695214b395dd252a1ab62ca2ce
|
a9da4c0866687c008cfcc89b2d0e90f029e683cf
|
refs/heads/master
| 2023-07-11T05:10:03.431306 | 2021-08-13T15:00:28 | 2021-08-13T15:00:28 | 394,742,846 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,168 |
java
|
package com.secure.news.fragement;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.secure.news.MySingleton;
import com.secure.news.News;
import com.secure.news.NewsItemClicked;
import com.secure.news.adapter.NewsListAdapter;
import com.secure.news.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class technology_fragement extends Fragment implements NewsItemClicked {
RecyclerView recyclerView;
NewsListAdapter mAdapter;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.technology_fragement, null);
recyclerView = v.findViewById(R.id.technology_recylerView);
fetch_data();
mAdapter = new NewsListAdapter(this);
recyclerView.setAdapter(mAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
return v;
}
private void fetch_data(){
String url = "https://newsapi.org/v2/top-headlines?country=in&category=technology&apiKey=f25bd7cf2bf341fa8db0f6f426364335";
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest
(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray newsJsonArray = response.getJSONArray("articles");
ArrayList<News> newsArrayList = new ArrayList<News>();
for(int i=0; i<newsJsonArray.length(); i++){
JSONObject newsJsonObject = newsJsonArray.getJSONObject(i);
News news = new News(
newsJsonObject.getString("title"),
newsJsonObject.getString("author"),
newsJsonObject.getString("url"),
newsJsonObject.getString("urlToImage")
);
newsArrayList.add(news);
}
mAdapter.updatedNews(newsArrayList);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}){
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("User-Agent", "Mozilla/5.0");
return headers;
}
};
MySingleton.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
}
@Override
public void onItemClicked(News item) {
String url = item.url;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(ContextCompat.getColor(getContext(), R.color.design_default_color_primary));
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(getContext(), Uri.parse(url));
}
}
|
[
"[email protected]"
] | |
454ea066d1c4d063a77d538e4bfbf553a19f7a36
|
f17279cfa0faff7d3f70e33750c96b6a8120f6cd
|
/common/src/main/java/com/party/common/utils/FileUtils.java
|
26b79f76f1e14d2e840bb1b23708af23cc80e6ae
|
[] |
no_license
|
cenbow/party
|
2e6a40bc81ae461b7d18f5013f95f2ccae1762e3
|
c26f1cd0e819bcb3dcdcccfbdc56303d9a916787
|
refs/heads/master
| 2021-06-20T13:18:11.527548 | 2017-08-01T11:36:58 | 2017-08-01T11:36:59 | 116,683,505 | 0 | 1 | null | 2018-01-08T13:58:42 | 2018-01-08T13:58:41 | null |
UTF-8
|
Java
| false | false | 17,760 |
java
|
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.party.common.utils;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipFile;
import org.apache.tools.zip.ZipOutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.Enumeration;
/**
* 文件操作工具类
* 实现文件的创建、删除、复制、压缩、解压以及目录的创建、删除、复制、压缩解压等功能
* @author jeeplus
* @version 2013-06-21
*/
public class FileUtils extends org.apache.commons.io.FileUtils {
private static Logger log = LoggerFactory.getLogger(FileUtils.class);
/**
* 复制单个文件,如果目标文件存在,则不覆盖
* @param srcFileName 待复制的文件名
* @param descFileName 目标文件名
* @return 如果复制成功,则返回true,否则返回false
*/
public static boolean copyFile(String srcFileName, String descFileName) {
return FileUtils.copyFileCover(srcFileName, descFileName, false);
}
/**
* 复制单个文件
* @param srcFileName 待复制的文件名
* @param descFileName 目标文件名
* @param coverlay 如果目标文件已存在,是否覆盖
* @return 如果复制成功,则返回true,否则返回false
*/
public static boolean copyFileCover(String srcFileName,
String descFileName, boolean coverlay) {
File srcFile = new File(srcFileName);
// 判断源文件是否存在
if (!srcFile.exists()) {
log.debug("复制文件失败,源文件 " + srcFileName + " 不存在!");
return false;
}
// 判断源文件是否是合法的文件
else if (!srcFile.isFile()) {
log.debug("复制文件失败," + srcFileName + " 不是一个文件!");
return false;
}
File descFile = new File(descFileName);
// 判断目标文件是否存在
if (descFile.exists()) {
// 如果目标文件存在,并且允许覆盖
if (coverlay) {
log.debug("目标文件已存在,准备删除!");
if (!FileUtils.delFile(descFileName)) {
log.debug("删除目标文件 " + descFileName + " 失败!");
return false;
}
} else {
log.debug("复制文件失败,目标文件 " + descFileName + " 已存在!");
return false;
}
} else {
if (!descFile.getParentFile().exists()) {
// 如果目标文件所在的目录不存在,则创建目录
log.debug("目标文件所在的目录不存在,创建目录!");
// 创建目标文件所在的目录
if (!descFile.getParentFile().mkdirs()) {
log.debug("创建目标文件所在的目录失败!");
return false;
}
}
}
// 准备复制文件
// 读取的位数
int readByte = 0;
InputStream ins = null;
OutputStream outs = null;
try {
// 打开源文件
ins = new FileInputStream(srcFile);
// 打开目标文件的输出流
outs = new FileOutputStream(descFile);
byte[] buf = new byte[1024];
// 一次读取1024个字节,当readByte为-1时表示文件已经读取完毕
while ((readByte = ins.read(buf)) != -1) {
// 将读取的字节流写入到输出流
outs.write(buf, 0, readByte);
}
log.debug("复制单个文件 " + srcFileName + " 到" + descFileName
+ "成功!");
return true;
} catch (Exception e) {
log.debug("复制文件失败:" + e.getMessage());
return false;
} finally {
// 关闭输入输出流,首先关闭输出流,然后再关闭输入流
if (outs != null) {
try {
outs.close();
} catch (IOException oute) {
oute.printStackTrace();
}
}
if (ins != null) {
try {
ins.close();
} catch (IOException ine) {
ine.printStackTrace();
}
}
}
}
/**
* 复制整个目录的内容,如果目标目录存在,则不覆盖
* @param srcDirName 源目录名
* @param descDirName 目标目录名
* @return 如果复制成功返回true,否则返回false
*/
public static boolean copyDirectory(String srcDirName, String descDirName) {
return FileUtils.copyDirectoryCover(srcDirName, descDirName,
false);
}
/**
* 复制整个目录的内容
* @param srcDirName 源目录名
* @param descDirName 目标目录名
* @param coverlay 如果目标目录存在,是否覆盖
* @return 如果复制成功返回true,否则返回false
*/
public static boolean copyDirectoryCover(String srcDirName,
String descDirName, boolean coverlay) {
File srcDir = new File(srcDirName);
// 判断源目录是否存在
if (!srcDir.exists()) {
log.debug("复制目录失败,源目录 " + srcDirName + " 不存在!");
return false;
}
// 判断源目录是否是目录
else if (!srcDir.isDirectory()) {
log.debug("复制目录失败," + srcDirName + " 不是一个目录!");
return false;
}
// 如果目标文件夹名不以文件分隔符结尾,自动添加文件分隔符
String descDirNames = descDirName;
if (!descDirNames.endsWith(File.separator)) {
descDirNames = descDirNames + File.separator;
}
File descDir = new File(descDirNames);
// 如果目标文件夹存在
if (descDir.exists()) {
if (coverlay) {
// 允许覆盖目标目录
log.debug("目标目录已存在,准备删除!");
if (!FileUtils.delFile(descDirNames)) {
log.debug("删除目录 " + descDirNames + " 失败!");
return false;
}
} else {
log.debug("目标目录复制失败,目标目录 " + descDirNames + " 已存在!");
return false;
}
} else {
// 创建目标目录
log.debug("目标目录不存在,准备创建!");
if (!descDir.mkdirs()) {
log.debug("创建目标目录失败!");
return false;
}
}
boolean flag = true;
// 列出源目录下的所有文件名和子目录名
File[] files = srcDir.listFiles();
for (int i = 0; i < files.length; i++) {
// 如果是一个单个文件,则直接复制
if (files[i].isFile()) {
flag = FileUtils.copyFile(files[i].getAbsolutePath(),
descDirName + files[i].getName());
// 如果拷贝文件失败,则退出循环
if (!flag) {
break;
}
}
// 如果是子目录,则继续复制目录
if (files[i].isDirectory()) {
flag = FileUtils.copyDirectory(files[i]
.getAbsolutePath(), descDirName + files[i].getName());
// 如果拷贝目录失败,则退出循环
if (!flag) {
break;
}
}
}
if (!flag) {
log.debug("复制目录 " + srcDirName + " 到 " + descDirName + " 失败!");
return false;
}
log.debug("复制目录 " + srcDirName + " 到 " + descDirName + " 成功!");
return true;
}
/**
*
* 删除文件,可以删除单个文件或文件夹
*
* @param fileName 被删除的文件名
* @return 如果删除成功,则返回true,否是返回false
*/
public static boolean delFile(String fileName) {
File file = new File(fileName);
if (!file.exists()) {
log.debug(fileName + " 文件不存在!");
return true;
} else {
if (file.isFile()) {
return FileUtils.deleteFile(fileName);
} else {
return FileUtils.deleteDirectory(fileName);
}
}
}
/**
*
* 删除单个文件
*
* @param fileName 被删除的文件名
* @return 如果删除成功,则返回true,否则返回false
*/
public static boolean deleteFile(String fileName) {
File file = new File(fileName);
if (file.exists() && file.isFile()) {
if (file.delete()) {
log.debug("删除文件 " + fileName + " 成功!");
return true;
} else {
log.debug("删除文件 " + fileName + " 失败!");
return false;
}
} else {
log.debug(fileName + " 文件不存在!");
return true;
}
}
/**
*
* 删除目录及目录下的文件
*
* @param dirName 被删除的目录所在的文件路径
* @return 如果目录删除成功,则返回true,否则返回false
*/
public static boolean deleteDirectory(String dirName) {
String dirNames = dirName;
if (!dirNames.endsWith(File.separator)) {
dirNames = dirNames + File.separator;
}
File dirFile = new File(dirNames);
if (!dirFile.exists() || !dirFile.isDirectory()) {
log.debug(dirNames + " 目录不存在!");
return true;
}
boolean flag = true;
// 列出全部文件及子目录
File[] files = dirFile.listFiles();
for (int i = 0; i < files.length; i++) {
// 删除子文件
if (files[i].isFile()) {
flag = FileUtils.deleteFile(files[i].getAbsolutePath());
// 如果删除文件失败,则退出循环
if (!flag) {
break;
}
}
// 删除子目录
else if (files[i].isDirectory()) {
flag = FileUtils.deleteDirectory(files[i]
.getAbsolutePath());
// 如果删除子目录失败,则退出循环
if (!flag) {
break;
}
}
}
if (!flag) {
log.debug("删除目录失败!");
return false;
}
// 删除当前目录
if (dirFile.delete()) {
log.debug("删除目录 " + dirName + " 成功!");
return true;
} else {
log.debug("删除目录 " + dirName + " 失败!");
return false;
}
}
/**
* 创建单个文件
* @param descFileName 文件名,包含路径
* @return 如果创建成功,则返回true,否则返回false
*/
public static boolean createFile(String descFileName) {
File file = new File(descFileName);
if (file.exists()) {
log.debug("文件 " + descFileName + " 已存在!");
return false;
}
if (descFileName.endsWith(File.separator)) {
log.debug(descFileName + " 为目录,不能创建目录!");
return false;
}
if (!file.getParentFile().exists()) {
// 如果文件所在的目录不存在,则创建目录
if (!file.getParentFile().mkdirs()) {
log.debug("创建文件所在的目录失败!");
return false;
}
}
// 创建文件
try {
if (file.createNewFile()) {
log.debug(descFileName + " 文件创建成功!");
return true;
} else {
log.debug(descFileName + " 文件创建失败!");
return false;
}
} catch (Exception e) {
e.printStackTrace();
log.debug(descFileName + " 文件创建失败!");
return false;
}
}
/**
* 创建目录
* @param descDirName 目录名,包含路径
* @return 如果创建成功,则返回true,否则返回false
*/
public static boolean createDirectory(String descDirName) {
String descDirNames = descDirName;
if (!descDirNames.endsWith(File.separator)) {
descDirNames = descDirNames + File.separator;
}
File descDir = new File(descDirNames);
if (descDir.exists()) {
log.debug("目录 " + descDirNames + " 已存在!");
return false;
}
// 创建目录
if (descDir.mkdirs()) {
log.debug("目录 " + descDirNames + " 创建成功!");
return true;
} else {
log.debug("目录 " + descDirNames + " 创建失败!");
return false;
}
}
/**
* 写入文件
*/
public static void writeToFile(String fileName, String content, boolean append) {
try {
FileUtils.write(new File(fileName), content, "utf-8", append);
log.debug("文件 " + fileName + " 写入成功!");
} catch (IOException e) {
log.debug("文件 " + fileName + " 写入失败! " + e.getMessage());
}
}
/**
* 写入文件
*/
public static void writeToFile(String fileName, String content, String encoding, boolean append) {
try {
FileUtils.write(new File(fileName), content, encoding, append);
log.debug("文件 " + fileName + " 写入成功!");
} catch (IOException e) {
log.debug("文件 " + fileName + " 写入失败! " + e.getMessage());
}
}
/**
* 压缩文件或目录
* @param srcDirName 压缩的根目录
* @param fileName 根目录下的待压缩的文件名或文件夹名,其中*或""表示跟目录下的全部文件
* @param descFileName 目标zip文件
*/
public static void zipFiles(String srcDirName, String fileName,
String descFileName) {
// 判断目录是否存在
if (srcDirName == null) {
log.debug("文件压缩失败,目录 " + srcDirName + " 不存在!");
return;
}
File fileDir = new File(srcDirName);
if (!fileDir.exists() || !fileDir.isDirectory()) {
log.debug("文件压缩失败,目录 " + srcDirName + " 不存在!");
return;
}
String dirPath = fileDir.getAbsolutePath();
File descFile = new File(descFileName);
try {
ZipOutputStream zouts = new ZipOutputStream(new FileOutputStream(
descFile));
zouts.setEncoding("UTF-8");
if ("*".equals(fileName) || "".equals(fileName)) {
FileUtils.zipDirectoryToZipFile(dirPath, fileDir, zouts);
} else {
File file = new File(fileDir, fileName);
if (file.isFile()) {
FileUtils.zipFilesToZipFile(dirPath, file, zouts);
} else {
FileUtils
.zipDirectoryToZipFile(dirPath, file, zouts);
}
}
zouts.close();
log.debug(descFileName + " 文件压缩成功!");
} catch (Exception e) {
log.debug("文件压缩失败:" + e.getMessage());
e.printStackTrace();
}
}
public static void main(String[] args) {
zipFiles("F:\\test", "*", "F:\\test2/a.zip");
}
/**
* 解压缩ZIP文件,将ZIP文件里的内容解压到descFileName目录下
* @param zipFileName 需要解压的ZIP文件
* @param descFileName 目标文件
*/
public static boolean unZipFiles(String zipFileName, String descFileName) {
String descFileNames = descFileName;
if (!descFileNames.endsWith(File.separator)) {
descFileNames = descFileNames + File.separator;
}
try {
// 根据ZIP文件创建ZipFile对象
ZipFile zipFile = new ZipFile(zipFileName);
ZipEntry entry = null;
String entryName = null;
String descFileDir = null;
byte[] buf = new byte[4096];
int readByte = 0;
// 获取ZIP文件里所有的entry
@SuppressWarnings("rawtypes")
Enumeration enums = zipFile.getEntries();
// 遍历所有entry
while (enums.hasMoreElements()) {
entry = (ZipEntry) enums.nextElement();
// 获得entry的名字
entryName = entry.getName();
descFileDir = descFileNames + entryName;
if (entry.isDirectory()) {
// 如果entry是一个目录,则创建目录
new File(descFileDir).mkdirs();
continue;
} else {
// 如果entry是一个文件,则创建父目录
new File(descFileDir).getParentFile().mkdirs();
}
File file = new File(descFileDir);
// 打开文件输出流
OutputStream os = new FileOutputStream(file);
// 从ZipFile对象中打开entry的输入流
InputStream is = zipFile.getInputStream(entry);
while ((readByte = is.read(buf)) != -1) {
os.write(buf, 0, readByte);
}
os.close();
is.close();
}
zipFile.close();
log.debug("文件解压成功!");
return true;
} catch (Exception e) {
log.debug("文件解压失败:" + e.getMessage());
return false;
}
}
/**
* 将目录压缩到ZIP输出流
* @param dirPath 目录路径
* @param fileDir 文件信息
* @param zouts 输出流
*/
public static void zipDirectoryToZipFile(String dirPath, File fileDir,
ZipOutputStream zouts) {
if (fileDir.isDirectory()) {
File[] files = fileDir.listFiles();
// 空的文件夹
if (files.length == 0) {
// 目录信息
ZipEntry entry = new ZipEntry(getEntryName(dirPath, fileDir));
try {
zouts.putNextEntry(entry);
zouts.closeEntry();
} catch (Exception e) {
e.printStackTrace();
}
return;
}
for (int i = 0; i < files.length; i++) {
if (files[i].isFile()) {
// 如果是文件,则调用文件压缩方法
FileUtils
.zipFilesToZipFile(dirPath, files[i], zouts);
} else {
// 如果是目录,则递归调用
FileUtils.zipDirectoryToZipFile(dirPath, files[i],
zouts);
}
}
}
}
/**
* 将文件压缩到ZIP输出流
* @param dirPath 目录路径
* @param file 文件
* @param zouts 输出流
*/
public static void zipFilesToZipFile(String dirPath, File file,
ZipOutputStream zouts) {
FileInputStream fin = null;
ZipEntry entry = null;
// 创建复制缓冲区
byte[] buf = new byte[4096];
int readByte = 0;
if (file.isFile()) {
try {
// 创建一个文件输入流
fin = new FileInputStream(file);
// 创建一个ZipEntry
entry = new ZipEntry(getEntryName(dirPath, file));
// 存储信息到压缩文件
zouts.putNextEntry(entry);
// 复制字节到压缩文件
while ((readByte = fin.read(buf)) != -1) {
zouts.write(buf, 0, readByte);
}
zouts.closeEntry();
fin.close();
System.out
.println("添加文件 " + file.getAbsolutePath() + " 到zip文件中!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 获取待压缩文件在ZIP文件中entry的名字,即相对于跟目录的相对路径名
* @param file entry文件名
* @return
*/
private static String getEntryName(String dirPath, File file) {
String dirPaths = dirPath;
if (!dirPaths.endsWith(File.separator)) {
dirPaths = dirPaths + File.separator;
}
String filePath = file.getAbsolutePath();
// 对于目录,必须在entry名字后面加上"/",表示它将以目录项存储
if (file.isDirectory()) {
filePath += "/";
}
int index = filePath.indexOf(dirPaths);
return filePath.substring(index + dirPaths.length());
}
// /**
// * 修复路径,将 \\ 或 / 等替换为 File.separator
// * @param path
// * @return
// */
// public static String path(String path){
// String p = StringUtils.replace(path, "\\", "/");
// p = StringUtils.join(StringUtils.split(p, "/"), "/");
// if (!StringUtils.startsWithAny(p, "/") && StringUtils.startsWithAny(path, "\\", "/")){
// p += "/";
// }
// if (!StringUtils.endsWithAny(p, "/") && StringUtils.endsWithAny(path, "\\", "/")){
// p = p + "/";
// }
// return p;
// }
}
|
[
"易凤"
] |
易凤
|
00ea4d625277727e575089c5c59c0419e50cc039
|
535e5d97d44fd42fca2a6fc68b3b566046ffa6c2
|
/com/google/android/gms/internal/zzqf.java
|
f8f8f77b818bfaf4c2d0e55066bafd730c878cb0
|
[] |
no_license
|
eric-lanita/BigRoadTruckingLogbookApp_v21.0.12_source_from_JADX
|
47566c288bc89777184b73ef0eb199b61de39f82
|
fb84301d90ec083ce06c68a3828cf99d8855c007
|
refs/heads/master
| 2021-09-01T07:02:52.500068 | 2017-12-25T15:06:05 | 2017-12-25T15:06:05 | 115,346,008 | 0 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,640 |
java
|
package com.google.android.gms.internal;
import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import com.google.android.gms.C3176R;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.internal.zzab;
import com.google.android.gms.common.internal.zzai;
import com.google.android.gms.common.internal.zzz;
@Deprecated
public final class zzqf {
private static Object f11638a = new Object();
private static zzqf f11639b;
private final String f11640c;
private final String f11641d;
private final Status f11642e;
private final String f11643f;
private final String f11644g;
private final String f11645h;
private final boolean f11646i;
private final boolean f11647j;
zzqf(Context context) {
boolean z = true;
Resources resources = context.getResources();
int identifier = resources.getIdentifier("google_app_measurement_enable", "integer", resources.getResourcePackageName(C3176R.string.common_google_play_services_unknown_issue));
if (identifier != 0) {
boolean z2 = resources.getInteger(identifier) != 0;
if (z2) {
z = false;
}
this.f11647j = z;
z = z2;
} else {
this.f11647j = false;
}
this.f11646i = z;
zzai com_google_android_gms_common_internal_zzai = new zzai(context);
this.f11643f = com_google_android_gms_common_internal_zzai.getString("firebase_database_url");
this.f11645h = com_google_android_gms_common_internal_zzai.getString("google_storage_bucket");
this.f11644g = com_google_android_gms_common_internal_zzai.getString("gcm_defaultSenderId");
this.f11641d = com_google_android_gms_common_internal_zzai.getString("google_api_key");
Object zzcf = zzz.zzcf(context);
if (zzcf == null) {
zzcf = com_google_android_gms_common_internal_zzai.getString("google_app_id");
}
if (TextUtils.isEmpty(zzcf)) {
this.f11642e = new Status(10, "Missing google app id value from from string resources with name google_app_id.");
this.f11640c = null;
return;
}
this.f11640c = zzcf;
this.f11642e = Status.sq;
}
zzqf(String str, boolean z) {
this(str, z, null, null, null);
}
zzqf(String str, boolean z, String str2, String str3, String str4) {
this.f11640c = str;
this.f11641d = null;
this.f11642e = Status.sq;
this.f11646i = z;
this.f11647j = !z;
this.f11643f = str2;
this.f11644g = str4;
this.f11645h = str3;
}
private static zzqf m17503b(String str) {
zzqf com_google_android_gms_internal_zzqf;
synchronized (f11638a) {
if (f11639b == null) {
throw new IllegalStateException(new StringBuilder(String.valueOf(str).length() + 34).append("Initialize must be called before ").append(str).append(".").toString());
}
com_google_android_gms_internal_zzqf = f11639b;
}
return com_google_android_gms_internal_zzqf;
}
public static String zzaqo() {
return m17503b("getGoogleAppId").f11640c;
}
public static boolean zzaqp() {
return m17503b("isMeasurementExplicitlyDisabled").f11647j;
}
public static Status zzc(Context context, String str, boolean z) {
Status a;
zzab.zzb((Object) context, (Object) "Context must not be null.");
zzab.zzh(str, "App ID must be nonempty.");
synchronized (f11638a) {
if (f11639b != null) {
a = f11639b.m17504a(str);
} else {
f11639b = new zzqf(str, z);
a = f11639b.f11642e;
}
}
return a;
}
public static Status zzcb(Context context) {
Status status;
zzab.zzb((Object) context, (Object) "Context must not be null.");
synchronized (f11638a) {
if (f11639b == null) {
f11639b = new zzqf(context);
}
status = f11639b.f11642e;
}
return status;
}
Status m17504a(String str) {
if (this.f11640c == null || this.f11640c.equals(str)) {
return Status.sq;
}
String str2 = this.f11640c;
return new Status(10, new StringBuilder(String.valueOf(str2).length() + 97).append("Initialize was called with two different Google App IDs. Only the first app ID will be used: '").append(str2).append("'.").toString());
}
}
|
[
"[email protected]"
] | |
6868c5bfba7a79648bbebaecf4abb9ff0703bf13
|
d34c4e16e243e18bd1836c088f39407d6642a6e5
|
/src/main/java/com/marketing/smscampaing/services/implementations/DefaultClientService.java
|
721fe80a409c21f151da8c3721f5e6ab8a30f3ea
|
[] |
no_license
|
firmy90/SMSCampaing
|
0f88840b324098fe5db9f62e3198af19e731d5dd
|
54f951c3fcc925a0499171e1fdb3a48192b8d6bd
|
refs/heads/master
| 2022-12-08T04:38:57.562873 | 2020-09-02T18:04:47 | 2020-09-02T18:04:47 | 290,120,410 | 0 | 0 | null | 2020-09-05T08:30:44 | 2020-08-25T05:18:39 |
CSS
|
UTF-8
|
Java
| false | false | 1,380 |
java
|
package com.marketing.smscampaing.services.implementations;
import com.marketing.smscampaing.dtos.ClientDTO;
import com.marketing.smscampaing.model.domain.entity.Client;
import com.marketing.smscampaing.model.repositories.ClientRepository;
import com.marketing.smscampaing.services.interfaces.ClientService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
@AllArgsConstructor
public class DefaultClientService implements ClientService {
private final ClientRepository clientRepository;
@Override
public Page<ClientDTO> findPaginatedDTO(int pageNo, int pageSize) {
Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(Sort.Direction.DESC, "uid"));
Page<Client> all = clientRepository.findAll(paging);
log.debug("Page with clients: {}", all);
ModelMapper mapper = new ModelMapper();
Page<ClientDTO> clientDTOS = mapper.map(all, Page.class);
log.debug("Page of clients DTO after mapping: {}", clientDTOS);
return clientDTOS;
}
}
|
[
"[email protected]"
] | |
ff78ab61be9993a8be292aaf5c61021b6bbb0062
|
ee14649a7dc9055027e4891531b62244d94af05f
|
/tests/src/test/java/org/teavm/parsing/substitution/java/subpackage/SubPackageClass1.java
|
a45e2a17095a2d18bca3ad2584347ae48eca7248
|
[
"Apache-2.0",
"BSD-3-Clause",
"GPL-1.0-or-later"
] |
permissive
|
konsoletyper/teavm
|
02c3190e86d5837821fbd17979d6ea64a6b301d6
|
401fcabeae22689fb62307563cf8f20ae4ab16c3
|
refs/heads/master
| 2023-09-03T20:12:11.892017 | 2023-08-28T17:32:22 | 2023-08-28T17:32:22 | 13,045,763 | 2,320 | 285 |
Apache-2.0
| 2023-07-05T17:40:09 | 2013-09-23T20:04:15 |
Java
|
UTF-8
|
Java
| false | false | 768 |
java
|
/*
* Copyright 2020 adam.
*
* 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.teavm.parsing.substitution.java.subpackage;
public class SubPackageClass1 {
public String getIdentifier() {
return "SubPackageClass1";
}
}
|
[
"[email protected]"
] | |
c43e26ffd0f81e36c7896f25b63f848112572f4c
|
0a901cc03518fced0171efe70c8293c96450e2fe
|
/src/main/java/com/smart/crop/util/Crop.java
|
539cec9951b63bdf4c6dc11adac277d686c0d778
|
[] |
no_license
|
Feirty/smart-crop
|
24ac58aea978e027419d41f878a783ad5ea658a8
|
6b69a5cd7f42bebef2bc7686bcb1042a07f25aea
|
refs/heads/main
| 2023-06-12T05:06:20.368460 | 2021-07-08T04:02:07 | 2021-07-08T04:02:07 | 383,989,440 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 236 |
java
|
package com.smart.crop.util;
public class Crop {
public int x, y, width, height;
public Score score;
public Crop(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
|
[
"[email protected]"
] | |
e83897f623812ce0f07962baaee76345bcd9836b
|
007a52c769fa9326516548220d1127f3da058a1b
|
/coo/word_co-occurrence/src/stubs/WordCoMapper.java
|
6dc55f541f804be7d0f091644411db708612f7fe
|
[] |
no_license
|
astrd/hadoopHomework
|
dbd0e2b46905d0cfa16695510d9b3d7f152b708d
|
967cd8ef37442286169cd27e20fc02a880f5b340
|
refs/heads/master
| 2020-04-02T22:26:02.963217 | 2019-01-31T18:29:00 | 2019-01-31T18:29:00 | 154,833,259 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,059 |
java
|
package stubs;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class WordCoMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
@Override
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
String line = value.toString();
StringBuffer lastWord = new StringBuffer();
boolean firstIteration = true;
for(String word : line.split("\\W+"))
{
if (word.length() > 0)
{
if(firstIteration)
{
lastWord.append(word.toLowerCase());
firstIteration = false;
continue;
}
lastWord.append(',');
lastWord.append(word.toLowerCase());
context.write(new Text(lastWord.toString()), new IntWritable(1));
lastWord.delete(0, lastWord.length());
lastWord.append(word.toLowerCase());
}
}
/*
* TODO implement
*/
}
}
|
[
"[email protected]"
] | |
f23f2a6ef016dc62e3d70219c4a3108c2a50009e
|
d84e65ea07766b1e262f1a25f4d7ea3cb7aaf6dd
|
/target/generated-sources/xjc/org/fixprotocol/fixml_5_0_sp2/StreamAssignmentReportACKMessageT.java
|
ee0e66f4ad175a705e9bcef3469be30a9ba033f6
|
[] |
no_license
|
rinkigoyal/TestFPMLJaxb
|
4b4db73fa839c2272b1dc1f4f20b656cf8e1f827
|
f195b1ec274a22c1000eaad44edc4848789ea8c7
|
refs/heads/master
| 2021-01-11T12:28:13.271665 | 2019-08-27T04:18:28 | 2019-08-27T04:18:28 | 79,142,605 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,796 |
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.01.17 at 02:08:33 AM SGT
//
package org.fixprotocol.fixml_5_0_sp2;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
/**
* StreamAssignmentReportACK can be found in Volume 3 of the
* specification
*
* <p>Java class for StreamAssignmentReportACK_message_t complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="StreamAssignmentReportACK_message_t">
* <complexContent>
* <extension base="{http://www.fixprotocol.org/FIXML-5-0-SP2}Abstract_message_t">
* <sequence>
* <group ref="{http://www.fixprotocol.org/FIXML-5-0-SP2}StreamAssignmentReportACKElements"/>
* </sequence>
* <attGroup ref="{http://www.fixprotocol.org/FIXML-5-0-SP2}StreamAssignmentReportACKAttributes"/>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "StreamAssignmentReportACK_message_t")
public class StreamAssignmentReportACKMessageT
extends AbstractMessageT
implements Equals, HashCode, ToString
{
@XmlAttribute(name = "ActTyp", required = true)
protected BigInteger actTyp;
@XmlAttribute(name = "RptID", required = true)
protected String rptID;
@XmlAttribute(name = "RejRsn")
protected String rejRsn;
@XmlAttribute(name = "Txt")
protected String txt;
@XmlAttribute(name = "EncTxtLen")
protected BigInteger encTxtLen;
@XmlAttribute(name = "EncTxt")
protected String encTxt;
/**
* Gets the value of the actTyp property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getActTyp() {
return actTyp;
}
/**
* Sets the value of the actTyp property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setActTyp(BigInteger value) {
this.actTyp = value;
}
/**
* Gets the value of the rptID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRptID() {
return rptID;
}
/**
* Sets the value of the rptID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRptID(String value) {
this.rptID = value;
}
/**
* Gets the value of the rejRsn property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRejRsn() {
return rejRsn;
}
/**
* Sets the value of the rejRsn property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRejRsn(String value) {
this.rejRsn = value;
}
/**
* Gets the value of the txt property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTxt() {
return txt;
}
/**
* Sets the value of the txt property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTxt(String value) {
this.txt = value;
}
/**
* Gets the value of the encTxtLen property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getEncTxtLen() {
return encTxtLen;
}
/**
* Sets the value of the encTxtLen property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setEncTxtLen(BigInteger value) {
this.encTxtLen = value;
}
/**
* Gets the value of the encTxt property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEncTxt() {
return encTxt;
}
/**
* Sets the value of the encTxt property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEncTxt(String value) {
this.encTxt = value;
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof StreamAssignmentReportACKMessageT)) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final StreamAssignmentReportACKMessageT that = ((StreamAssignmentReportACKMessageT) object);
{
BigInteger lhsActTyp;
lhsActTyp = this.getActTyp();
BigInteger rhsActTyp;
rhsActTyp = that.getActTyp();
if (!strategy.equals(LocatorUtils.property(thisLocator, "actTyp", lhsActTyp), LocatorUtils.property(thatLocator, "actTyp", rhsActTyp), lhsActTyp, rhsActTyp)) {
return false;
}
}
{
String lhsRptID;
lhsRptID = this.getRptID();
String rhsRptID;
rhsRptID = that.getRptID();
if (!strategy.equals(LocatorUtils.property(thisLocator, "rptID", lhsRptID), LocatorUtils.property(thatLocator, "rptID", rhsRptID), lhsRptID, rhsRptID)) {
return false;
}
}
{
String lhsRejRsn;
lhsRejRsn = this.getRejRsn();
String rhsRejRsn;
rhsRejRsn = that.getRejRsn();
if (!strategy.equals(LocatorUtils.property(thisLocator, "rejRsn", lhsRejRsn), LocatorUtils.property(thatLocator, "rejRsn", rhsRejRsn), lhsRejRsn, rhsRejRsn)) {
return false;
}
}
{
String lhsTxt;
lhsTxt = this.getTxt();
String rhsTxt;
rhsTxt = that.getTxt();
if (!strategy.equals(LocatorUtils.property(thisLocator, "txt", lhsTxt), LocatorUtils.property(thatLocator, "txt", rhsTxt), lhsTxt, rhsTxt)) {
return false;
}
}
{
BigInteger lhsEncTxtLen;
lhsEncTxtLen = this.getEncTxtLen();
BigInteger rhsEncTxtLen;
rhsEncTxtLen = that.getEncTxtLen();
if (!strategy.equals(LocatorUtils.property(thisLocator, "encTxtLen", lhsEncTxtLen), LocatorUtils.property(thatLocator, "encTxtLen", rhsEncTxtLen), lhsEncTxtLen, rhsEncTxtLen)) {
return false;
}
}
{
String lhsEncTxt;
lhsEncTxt = this.getEncTxt();
String rhsEncTxt;
rhsEncTxt = that.getEncTxt();
if (!strategy.equals(LocatorUtils.property(thisLocator, "encTxt", lhsEncTxt), LocatorUtils.property(thatLocator, "encTxt", rhsEncTxt), lhsEncTxt, rhsEncTxt)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
BigInteger theActTyp;
theActTyp = this.getActTyp();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "actTyp", theActTyp), currentHashCode, theActTyp);
}
{
String theRptID;
theRptID = this.getRptID();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "rptID", theRptID), currentHashCode, theRptID);
}
{
String theRejRsn;
theRejRsn = this.getRejRsn();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "rejRsn", theRejRsn), currentHashCode, theRejRsn);
}
{
String theTxt;
theTxt = this.getTxt();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "txt", theTxt), currentHashCode, theTxt);
}
{
BigInteger theEncTxtLen;
theEncTxtLen = this.getEncTxtLen();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "encTxtLen", theEncTxtLen), currentHashCode, theEncTxtLen);
}
{
String theEncTxt;
theEncTxt = this.getEncTxt();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "encTxt", theEncTxt), currentHashCode, theEncTxt);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
BigInteger theActTyp;
theActTyp = this.getActTyp();
strategy.appendField(locator, this, "actTyp", buffer, theActTyp);
}
{
String theRptID;
theRptID = this.getRptID();
strategy.appendField(locator, this, "rptID", buffer, theRptID);
}
{
String theRejRsn;
theRejRsn = this.getRejRsn();
strategy.appendField(locator, this, "rejRsn", buffer, theRejRsn);
}
{
String theTxt;
theTxt = this.getTxt();
strategy.appendField(locator, this, "txt", buffer, theTxt);
}
{
BigInteger theEncTxtLen;
theEncTxtLen = this.getEncTxtLen();
strategy.appendField(locator, this, "encTxtLen", buffer, theEncTxtLen);
}
{
String theEncTxt;
theEncTxt = this.getEncTxt();
strategy.appendField(locator, this, "encTxt", buffer, theEncTxt);
}
return buffer;
}
}
|
[
"[email protected]"
] | |
96e53cc815042e1a8bff5549ad182d10919351df
|
fa3682bfd8808948834f6ff4a8118b22d6627eb1
|
/src/com/jayantkrish/jklol/cli/StandardizeFeatures.java
|
b680aca7f1833aaeb0c3c83e5308407a58dc9d4c
|
[
"BSD-2-Clause",
"MIT",
"Apache-2.0"
] |
permissive
|
matt-gardner/jklol
|
486ad71f14665e4a42e058897e2e20b8dfdcd352
|
70ba6e59aaf68408de1f79949536af544783b0a9
|
refs/heads/master
| 2021-01-15T22:20:32.548124 | 2016-03-22T19:58:58 | 2016-03-22T19:58:58 | 49,015,690 | 0 | 0 | null | 2016-01-04T18:39:11 | 2016-01-04T18:39:11 | null |
UTF-8
|
Java
| false | false | 2,874 |
java
|
package com.jayantkrish.jklol.cli;
import java.util.List;
import java.util.Set;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.jayantkrish.jklol.models.DiscreteFactor;
import com.jayantkrish.jklol.models.DiscreteVariable;
import com.jayantkrish.jklol.models.TableFactor;
import com.jayantkrish.jklol.models.VariableNumMap;
import com.jayantkrish.jklol.preprocessing.FeatureStandardizer;
import com.jayantkrish.jklol.util.Assignment;
import com.jayantkrish.jklol.util.IoUtils;
/**
* Standardizes a tensor of features, stored in a file and passed in on the command line. Reads a
* {@code TableFactor}s stored in a CSV file from the command line, and normalizes each feature in
* it (giving it zero mean and unit variance).
*
* <p> Features with zero variance are not renormalized. This prevents (e.g.,) bias features from
* being assigned NaN weights.
*/
public class StandardizeFeatures {
public static void main(String[] args) {
OptionParser parser = new OptionParser();
OptionSpec<String> inputFile = parser.accepts("input").withRequiredArg().ofType(String.class).required();
OptionSpec<String> delimiterOption = parser.accepts("delimiter").withOptionalArg().ofType(String.class).defaultsTo(",");
OptionSpec<Integer> featureColumn = parser.accepts("featureColumn").withOptionalArg().ofType(Integer.class).defaultsTo(-1);
OptionSet options = parser.parse(args);
// Compute VariableNumMaps for each of the variables in the TableFactor.
String inputFilename = options.valueOf(inputFile);
String delimiter = options.valueOf(delimiterOption);
int numColumns = IoUtils.getNumberOfColumnsInFile(inputFilename, delimiter);
List<VariableNumMap> variables = Lists.newArrayList();
for (int i = 0; i < numColumns - 1; i++) {
Set<String> variableNames = Sets.newHashSet(IoUtils
.readColumnFromDelimitedFile(inputFilename, i, delimiter));
int variableIndex = i + 1;
variables.add(VariableNumMap.singleton(variableIndex, String.valueOf(variableIndex),
new DiscreteVariable(String.valueOf(variableIndex), variableNames)));
}
// Read in the factor from the input file.
TableFactor factor = TableFactor.fromDelimitedFile(variables,
IoUtils.readLines(inputFilename), delimiter, false);
// Determine which variable contains the features.
int columnIndex = options.valueOf(featureColumn);
if (columnIndex < 0) {
columnIndex = numColumns + columnIndex;
}
FeatureStandardizer standardizer = FeatureStandardizer.estimateFrom(factor, columnIndex, Assignment.EMPTY, 1.0);
DiscreteFactor standardizedFeatures = standardizer.apply(factor);
System.out.println(standardizedFeatures.toCsv());
}
}
|
[
"[email protected]"
] | |
b6b4198a0f6b25470a91aee1e4f0170abfe4e750
|
6b27b495c8e36a72a72d7708f99aa84e804886c5
|
/src/main/java/diplom/blog/repo/PostVotesRepository.java
|
440b80df4e9eb125dfbe160e14c09df67313d9aa
|
[] |
no_license
|
Oleg181219/blog
|
e6aa4e4fffa391a2424efc637190a5e8aa841181
|
62da4c9d3c271fc4753ba21994d55c3f26827727
|
refs/heads/master
| 2023-06-13T08:34:53.314700 | 2021-07-06T10:21:37 | 2021-07-06T10:21:37 | 367,689,786 | 0 | 0 | null | 2021-07-06T10:20:41 | 2021-05-15T17:17:23 |
Java
|
UTF-8
|
Java
| false | false | 767 |
java
|
package diplom.blog.repo;
import diplom.blog.model.PostVotes;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface PostVotesRepository extends JpaRepository<PostVotes,Long> {
List<PostVotes> findAll();
@Query("SELECT pv " +
"FROM PostVotes pv " +
"WHERE pv.post.id = :id")
List<PostVotes> findAllVotes(@Param("id") Long id);
@Query("SELECT pv " +
"FROM PostVotes pv " +
"WHERE pv.value = :value")
List<PostVotes> findAllLikesAndDisLikes(@Param("value") Integer value);
}
|
[
"[email protected]"
] | |
3ae9524f2bff88f8b389541aa4aaa4e46119b839
|
c40b235589793ea971d44a75efad4a60ed318a6a
|
/src/controlador/TC.java
|
c7d8e9a5ba24c55749e613474dbcdfa3f117bf16
|
[] |
no_license
|
miguelarriba/DBCase
|
8604c5240b2e063454058c50d204594515c752a7
|
a6a756dc03fb231515169a73ec171794141830c6
|
refs/heads/master
| 2020-04-07T00:17:21.063137 | 2019-10-07T16:04:05 | 2019-10-07T16:04:05 | 157,897,503 | 0 | 1 | null | 2020-02-06T14:52:11 | 2018-11-16T17:02:49 |
Java
|
UTF-8
|
Java
| false | false | 20,160 |
java
|
package controlador;
public enum TC {
//---------------------------------------------------------------------------------
// Mensajes desde la GUIPrincipal al controlador
//---------------------------------------------------------------------------------
// Obtención de DBMS
GUIPrincipal_ObtenDBMSDisponibles,
// Actualizaciones de listas
GUIPrincipal_ActualizameLaListaDeEntidades,
GUIPrincipal_ActualizameLaListaDeAtributos,
GUIPrincipal_ActualizameLaListaDeRelaciones,
GUIPrincipal_ActualizameLaListaDeDominios,
//about
GUI_Principal_ABOUT,
// Click en la barra de menus y submenus
GUI_Principal_Click_Submenu_Salir,
GUI_Principal_Click_Imprimir,
GUI_Principal_Click_ModoProgramador,
GUI_Principal_Click_ModoDiseno,
GUI_Principal_Click_ModoVerTodo,
GUI_Principal_Click_Salir,
//GUI_Principal_Click_Submenu_SeleccionarWorkSpace,
GUI_Principal_Click_Submenu_Abrir,
GUI_Principal_Click_Submenu_Guardar,
GUI_Principal_Click_Submenu_Nuevo,
GUI_Principal_Click_Submenu_GuardarComo,
GUI_Principal_CambiarLenguaje,
GUI_Principal_CambiarTema,
// Generacion de codigo
GUI_Principal_Click_BotonLimpiarPantalla,
GUI_Principal_Click_BotonValidar,
GUI_Principal_Click_BotonGenerarScriptSQL,
GUI_Principal_Click_BotonGenerarArchivoScriptSQL,
GUI_Principal_Click_BotonGenerarArchivoModelo,
GUI_Principal_Click_BotonGenerarModeloRelacional,
GUI_Principal_Click_BotonEjecutarEnDBMS,
//---------------------------------------------------------------------------------
// Mensaje desde la GUI_WorkSpace al Controlador
//---------------------------------------------------------------------------------
GUI_WorkSpace_PrimeraSeleccion,
GUI_WorkSpace_Nuevo,
GUI_WorkSpace_Click_Abrir,
GUI_WorkSpace_Click_Guardar,
GUI_WorkSpace_ClickBotonCancelar,
GUI_WorkSpace_ERROR_CreacionFicherosXML,
//---------------------------------------------------------------------------------
// Mensajes desde las GUIs al controlador
//---------------------------------------------------------------------------------
// Entidades
GUIRenombrarEntidad_Click_BotonRenombrar,
GUIInsertarEntidad_Click_BotonInsertar,
GUIInsertarEntidadDebil_Click_BotonInsertar,
GUIInsertarEntidadDebil_Entidad_Relacion_Repetidos,
GUIAnadirAtributoEntidad_Click_BotonAnadir,
GUIAnadirAtributoEntidad_ActualizameLaListaDeDominios,
GUIRenombrarAtributo_Click_BotonRenombrar,
GUIEditarDominioAtributo_Click_BotonEditar,
GUIEditarDominioAtributo_ActualizameLaListaDeDominios,
GUIEditarCompuestoAtributo_Click_BotonAceptar,
GUIEditarMultivaloradoAtributo_Click_BotonAceptar,
GUIAnadirSubAtributoAtributo_Click_BotonAnadir,
GUIEditarClavePrimariaAtributo_ActualizameListaEntidades,
GUIEditarClavePrimariaAtributo_ActualizameListaAtributos,
GUIEditarClavePrimariaAtributo_Click_BotonAceptar,
GUIInsertarRelacion_Click_BotonInsertar,
GUIInsertarRelacionDebil_Click_BotonInsertar,
GUIRenombrarRelacion_Click_BotonRenombrar,
GUIPonerRestriccionesAEntidad_Click_BotonAceptar,
GUIPonerRestriccionesARelacion_Click_BotonAceptar,
GUIPonerRestriccionesAAtributo_Click_BotonAceptar,
GUIInsertarRestriccionAEntidad_Click_BotonAnadir,
GUIQuitarRestriccionAEntidad_Click_BotonAnadir,
GUIInsertarRestriccionAAtributo_Click_BotonAnadir,
GUIQuitarRestriccionAAtributo_Click_BotonAnadir,
GUIPonerUniquesAEntidad_Click_BotonAceptar,
GUIPonerUniquesARelacion_Click_BotonAceptar,
// Relaciones IsA
GUIEstablecerEntidadPadre_ActualizameListaEntidades,
GUIEstablecerEntidadPadre_ClickBotonAceptar,
GUIQuitarEntidadPadre_ClickBotonSi,
GUIAnadirEntidadHija_ActualizameListaEntidades,
GUIAnadirEntidadHija_ClickBotonAnadir,
GUIQuitarEntidadHija_ActualizameListaEntidades,
GUIQuitarEntidadHija_ClickBotonQuitar,
// Relaciones Normales
GUIAnadirEntidadARelacion_ActualizameListaEntidades,
GUIAnadirEntidadARelacion_ClickBotonAnadir,
GUIQuitarEntidadARelacion_ActualizameListaEntidades,
GUIQuitarEntidadARelacion_ClickBotonQuitar,
GUIEditarCardinalidadEntidad_ActualizameListaEntidades,
GUIEditarCardinalidadEntidad_ClickBotonEditar,
GUIAnadirAtributoRelacion_Click_BotonAnadir,
GUIAnadirAtributoRelacion_ActualizameLaListaDeDominios,
GUIInsertarRestriccionARelacion_Click_BotonAnadir,
GUIQuitarRestriccionARelacion_Click_BotonAnadir,
// Dominios
GUIInsertarDominio_Click_BotonInsertar,
GUIRenombrarDominio_Click_BotonRenombrar,
GUIModificarValoresDominio_Click_BotonEditar,
GUIModificarDominio_Click_BotonEditar,
GUIAnadirSubAtributoAtributo_ActualizameLaListaDeDominios,
// Conexión a DBMS
GUIConfigurarConexionDBMS_Click_BotonEjecutar,
GUIConexionDBMS_PruebaConexion,
//---------------------------------------------------------------------------------
// Mensajes desde el Panel de Diseño
//---------------------------------------------------------------------------------
// Fuera
PanelDiseno_Click_InsertarEntidad,
PanelDiseno_Click_InsertarAtributo,
PanelDiseno_Click_InsertarRelacionNormal,
PanelDiseno_Click_InsertarRelacionIsA,
PanelDiseno_Click_CrearDominio,
// Entidades
PanelDiseno_Click_RenombrarEntidad,
PanelDiseno_Click_DebilitarEntidad,
PanelDiseno_Click_EliminarEntidad,
PanelDiseno_Click_AnadirRestriccionAEntidad,
PanelDiseno_Click_TablaUniqueAEntidad,
PanelDiseno_Click_AnadirRestriccionAAtributo,
PanelDiseno_Click_AnadirAtributoEntidad,
PanelDiseno_Click_EliminarAtributo,
PanelDiseno_Click_RenombrarAtributo,
PanelDiseno_Click_EditarDominioAtributo,
PanelDiseno_Click_EditarCompuestoAtributo,
PanelDiseno_Click_EditarMultivaloradoAtributo,
PanelDiseno_Click_EditarNotNullAtributo,
PanelDiseno_Click_EditarUniqueAtributo,
PanelDiseno_Click_ModificarUniqueAtributo,
PanelDiseno_Click_EliminarReferenciasUniqueAtributo,
PanelDiseno_Click_AnadirAtributoRelacion,
PanelDiseno_Click_AnadirSubAtributoAAtributo,
PanelDiseno_Click_EditarClavePrimariaAtributo,
PanelDiseno_MoverEntidad,
PanelDiseno_MoverAtributo,
PanelDiseno_MoverRelacion,
// Relaciones IsA
PanelDiseno_Click_EstablecerEntidadPadre,
PanelDiseno_Click_QuitarEntidadPadre,
PanelDiseno_Click_AnadirEntidadHija,
PanelDiseno_Click_QuitarEntidadHija,
PanelDiseno_Click_EliminarRelacionIsA,
// Relaciones Normales
PanelDiseno_Click_RenombrarRelacion,
PanelDiseno_Click_DebilitarRelacion,
PanelDiseno_Click_EliminarRelacionNormal,
PanelDiseno_Click_AnadirEntidadARelacion,
PanelDiseno_Click_QuitarEntidadARelacion,
PanelDiseno_Click_EditarCardinalidadEntidad,
PanelDiseno_Click_AnadirRestriccionARelacion,
PanelDiseno_Click_TablaUniqueARelacion,
// Dominios
PanelDiseno_Click_RenombrarDominio,
PanelDiseno_Click_EliminarDominio,
// Mensajes de pulsación referentes al panel de información
PanelDiseno_LimpiarPanelInformacion,
PanelDiseno_MostrarDatosEnPanelDeInformacion,
// Mensajes desde AccionMenu
PanelDiseno_Click_ModificarDominio,
PanelDiseno_Click_OrdenarValoresDominio,
//---------------------------------------------------------------------------------
// Mensajes desde los Servicios de Entidades
//---------------------------------------------------------------------------------
// Insercion de entidades
SE_InsertarEntidad_HECHO,
SE_InsertarEntidad_ERROR_NombreDeEntidadEsVacio,
SE_InsertarEntidad_ERROR_NombreDeEntidadYaExiste,
SE_InsertarEntidad_ERROR_NombreDeEntidadYaExisteComoRelacion,
SE_InsertarEntidad_ERROR_DAO,
SE_ComprobarInsertarEntidad_HECHO,
SE_ComprobarInsertarEntidad_ERROR_NombreDeEntidadEsVacio,
SE_ComprobarInsertarEntidad_ERROR_NombreDeEntidadYaExiste,
SE_ComprobarInsertarEntidad_ERROR_NombreDeEntidadYaExisteComoRelacion,
SE_ComprobarInsertarEntidad_ERROR_DAO,
// Renombrar entidades
SE_RenombrarEntidad_HECHO,
SE_RenombrarEntidad_ERROR_DAOEntidades,
SE_RenombrarEntidad_ERROR_DAORelaciones,
SE_RenombrarEntidad_ERROR_NombreDeEntidadEsVacio,
SE_RenombrarEntidad_ERROR_NombreDeEntidadYaExiste,
SE_RenombrarEntidad_ERROR_NombreDeEntidadYaExisteComoRelacion,
// Modificar el caracter debil
SE_DebilitarEntidad_HECHO,
SE_DebilitarEntidad_ERROR_DAOEntidades,
// Eliminacion de entidades
SE_EliminarEntidad_HECHO,
SE_EliminarEntidad_ERROR_DAORelaciones,
SE_EliminarEntidad_ERROR_DAOEntidades,
// Consultar entidad
SE_ConsultarEntidad_HECHO,
SE_ConsultarEntidad_ERROR_DAOAtributos,
SE_ConsultarEntidad_ERROR_DAORelaciones,
SE_ConsultarEntidad_ERROR_DAOEntidades,
//Restricciones
SE_AnadirRestriccionAEntidad_HECHO,
SE_QuitarRestriccionAEntidad_HECHO,
SE_setRestriccionesAEntidad_HECHO,
//Uniques
SE_AnadirUniqueAEntidad_HECHO,
SE_QuitarUniqueAEntidad_HECHO,
SE_setUniquesAEntidad_HECHO,
SE_setUniqueUnitarioAEntidad_HECHO,
// Listar entidades
SE_ListarEntidades_HECHO,
// Mover posicion Entidad en el panel de diseño
SE_MoverPosicionEntidad_ERROR_DAOEntidades,
SE_MoverPosicionEntidad_HECHO,
// Anadir un atributo a una relacion
SE_AnadirAtributoAEntidad_ERROR_NombreDeAtributoVacio,
SE_AnadirAtributoAEntidad_ERROR_NombreDeAtributoYaExiste,
SE_AnadirAtributoAEntidad_ERROR_TamanoEsNegativo,
SE_AnadirAtributoAEntidad_ERROR_TamanoNoEsEntero,
SE_AnadirAtributoAEntidad_ERROR_DAOAtributos,
SE_AnadirAtributoAEntidad_ERROR_DAOEntidades,
SE_AnadirAtributoAEntidad_HECHO,
//---------------------------------------------------------------------------------
// Mensajes desde los Servicios de Atributos
//---------------------------------------------------------------------------------
// Añadir atributo a entidad
SA_AnadirAtributo_HECHO,
SA_AnadirAtributo_ERROR_NombreDeAtributoEsVacio,
SA_AnadirAtributo_ERROR_DAOAtributos,
// Listar atributos
SA_ListarAtributos_HECHO,
// Eliminar atributo
SA_EliminarAtributo_ERROR_DAOAtributos,
SA_EliminarAtributo_HECHO,
// Renombrar atributo
SA_RenombrarAtributo_ERROR_NombreDeAtributoEsVacio,
SA_RenombrarAtributo_ERROR_NombreDeAtributoYaExiste,
SA_RenombrarAtributo_ERROR_DAOAtributos,
SA_RenombrarAtributo_HECHO,
// Editar domnio de atributo
SA_EditarDominioAtributo_ERROR_DAOAtributos,
SA_EditarDominioAtributo_ERROR_TamanoNoEsEntero,
SA_EditarDominioAtributo_ERROR_TamanoEsNegativo,
SA_EditarDominioAtributo_HECHO,
// Editar el caracter de compuesto del atributo
SA_EditarCompuestoAtributo_ERROR_DAOAtributos,
SA_EditarCompuestoAtributo_HECHO,
// Editar el caracter de multivalorado del atributo
SA_EditarMultivaloradoAtributo_ERROR_DAOAtributos,
SA_EditarMultivaloradoAtributo_HECHO,
// Editar el caracter de not null del atributo
SA_EditarNotNullAtributo_ERROR_DAOAtributos,
SA_EditarNotNullAtributo_HECHO,
// Editar el caracter de unique del atributo
SA_EditarUniqueAtributo_ERROR_DAOAtributos,
SA_EditarUniqueAtributo_HECHO,
// Mover posicion Atributo en el panel de diseño
SA_MoverPosicionAtributo_ERROR_DAOAtributos,
SA_MoverPosicionAtributo_HECHO,
// Editar atributo como clave primaria de una entidad
SA_EditarClavePrimariaAtributo_ERROR_DAOEntidades,
SA_EditarClavePrimariaAtributo_HECHO,
// Añadir subatributo a un atributo
SA_AnadirSubAtributoAtributo_ERROR_NombreDeAtributoVacio,
SA_AnadirSubAtributoAtributo_ERROR_NombreDeAtributoYaExiste,
SA_AnadirSubAtributoAtributo_ERROR_TamanoEsNegativo,
SA_AnadirSubAtributoAtributo_ERROR_TamanoNoEsEntero,
SA_AnadirSubAtributoAtributo_ERROR_DAOAtributosHijo,
SA_AnadirSubAtributoAtributo_ERROR_DAOAtributosPadre,
SA_AnadirSubAtributoAtributo_HECHO,
//Restricciones
SA_AnadirRestriccionAAtributo_HECHO,
SA_QuitarRestriccionAAtributo_HECHO,
SA_setRestriccionesAAtributo_HECHO,
//---------------------------------------------------------------------------------
// Mensajes desde los Servicios de Relaciones
//---------------------------------------------------------------------------------
// Listar relaciones
SR_ListarRelaciones_HECHO,
// Insertar relacion
SR_InsertarRelacion_ERROR_NombreDeRelacionEsVacio,
SR_InsertarRelacion_ERROR_NombreDeRelacionYaExiste,
SR_InsertarRelacion_ERROR_NombreDeRelacionYaExisteComoEntidad,
SR_InsertarRelacion_ERROR_NombreDelRolYaExiste,
SR_InsertarRelacion_ERROR_NombreDeRolNecesario,
SR_InsertarRelacion_ERROR_DAORelaciones,
SR_InsertarRelacion_HECHO,
// Eliminar relacion
SR_EliminarRelacion_ERROR_DAORelaciones,
SR_EliminarRelacion_HECHO,
// Renombrar relacion
SR_RenombrarRelacion_ERROR_NombreDeRelacionEsVacio,
SR_RenombrarRelacion_ERROR_NombreDeRelacionYaExiste,
SR_RenombrarRelacion_ERROR_NombreDeRelacionYaExisteComoEntidad,
SR_RenombrarRelacion_ERROR_NombreIsA,
SR_RenombrarRelacion_ERROR_DAORelaciones,
SR_RenombrarRelacion_ERROR_DAOEntidades,
SR_RenombrarRelacion_HECHO,
// Mover posicion Relacion en el panel de diseño
SR_MoverPosicionRelacion_ERROR_DAORelaciones,
SR_MoverPosicionRelacion_HECHO,
/*
* Relaciones IsA
*/
// Establecer Entidad padre en una relacion IsA
SR_EstablecerEntidadPadre_ERROR_DAORelaciones,
SR_EstablecerEntidadPadre_HECHO,
// Quitar la entidad padre en una relacion IsA
SR_QuitarEntidadPadre_ERROR_DAORelaciones,
SR_QuitarEntidadPadre_HECHO,
// Anadir entidad hija a una relacion isA
SR_AnadirEntidadHija_ERROR_DAORelaciones,
SR_AnadirEntidadHija_HECHO,
// Quitar una entidad hija en una relacion IsA
SR_QuitarEntidadHija_ERROR_DAORelaciones,
SR_QuitarEntidadHija_HECHO,
// Eliminar una relacion IsA
SR_EliminarRelacionIsA_ERROR_DAORelaciones,
SR_EliminarRelacionIsA_HECHO,
// Insertar una relacion IsA
SR_InsertarRelacionIsA_ERROR_DAORelaciones,
SR_InsertarRelacionIsA_HECHO,
/*
* Relaciones Normales
*/
// Eliminar una relacion Normal
SR_EliminarRelacionNormal_ERROR_DAORelaciones,
SR_EliminarRelacionNormal_HECHO,
// Anadir una entidad a una relacion
SR_AnadirEntidadARelacion_ERROR_InicioNoEsEnteroOn,
SR_AnadirEntidadARelacion_ERROR_InicioEsNegativo,
SR_AnadirEntidadARelacion_ERROR_FinalNoEsEnteroOn,
SR_AnadirEntidadARelacion_ERROR_FinalEsNegativo,
SR_AnadirEntidadARelacion_ERROR_InicioMayorQueFinal,
SR_AnadirEntidadARelacion_ERROR_DAORelaciones,
SR_AnadirEntidadARelacion_HECHO,
// Quitar una entidad de una relacion
SR_QuitarEntidadARelacion_ERROR_DAORelaciones,
SR_QuitarEntidadARelacion_HECHO,
// Debilitar una relacion
SR_DebilitarRelacion_ERROR_DAORelaciones,
SR_DebilitarRelacion_HECHO,
// Editar aridad de una entidad en una relacion
SR_EditarCardinalidadEntidad_ERROR_InicioNoEsEnteroOn,
SR_EditarCardinalidadEntidad_ERROR_InicioEsNegativo,
SR_EditarCardinalidadEntidad_ERROR_FinalNoEsEnteroOn,
SR_EditarCardinalidadEntidad_ERROR_FinalEsNegativo,
SR_EditarCardinalidadEntidad_ERROR_InicioMayorQueFinal,
SR_EditarCardinalidadEntidad_ERROR_DAORelaciones,
SR_EditarCardinalidadEntidad_HECHO,
SR_AridadEntidadUnoUno_HECHO,
// Anadir un atributo a una relacion
SR_AnadirAtributoARelacion_ERROR_NombreDeAtributoVacio,
SR_AnadirAtributoARelacion_ERROR_TamanoEsNegativo,
SR_AnadirAtributoARelacion_ERROR_TamanoNoEsEntero,
SR_AnadirAtributoARelacion_ERROR_DAOAtributos,
SR_AnadirAtributoARelacion_ERROR_DAORelaciones,
SR_AnadirAtributoARelacion_ERROR_NombreDeAtributoYaExiste,
SR_AnadirAtributoARelacion_HECHO,
// Restricciones
SR_AnadirRestriccionARelacion_HECHO,
SR_QuitarRestriccionARelacion_HECHO,
SR_setRestriccionesARelacion_HECHO,
//Uniques
SR_AnadirUniqueARelacion_HECHO,
SR_QuitarUniqueARelacion_HECHO,
SR_setUniquesARelacion_HECHO,
SR_setUniqueUnitarioARelacion_HECHO,
//---------------------------------------------------------------------------------
// Mensajes desde los Servicios de Dominios
//---------------------------------------------------------------------------------
// Insercion de dominios
SD_InsertarDominio_HECHO,
SD_InsertarDominio_ERROR_NombreDeDominioEsVacio,
SD_InsertarDominio_ERROR_NombreDeDominioYaExiste,
SD_InsertarDominio_ERROR_ValorNoValido,
SD_InsertarDominio_ERROR_DAO,
// Renombrar dominios
SD_RenombrarDominio_HECHO,
SD_RenombrarDominio_ERROR_DAODominios,
SD_RenombrarDominio_ERROR_NombreDeDominioEsVacio,
SD_RenombrarDominio_ERROR_NombreDeDominioYaExiste,
// Eliminacion de Dominio
SD_EliminarDominio_HECHO,
SD_EliminarDominio_ERROR_DAORelaciones,
SD_EliminarDominio_ERROR_DAOEntidades,
SD_EliminarDominio_ERROR_DAODominios,
// Consultar dominio
SD_ConsultarDominio_HECHO,
SD_ConsultarDominio_ERROR_DAOAtributos,
SD_ConsultarDominio_ERROR_DAORelaciones,
SD_ConsultarDominio_ERROR_DAOEntidades,
// Modificar dominio
SD_ModificarTipoBaseDominio_ERROR_DAODominios,
SD_ModificarTipoBaseDominio_ERROR_TipoBaseDominioEsVacio,
SD_ModificarTipoBaseDominio_ERROR_ValorNoValido,
SD_ModificarTipoBaseDominio_HECHO,
// Modificar dominio
SD_ModificarElementosDominio_ERROR_DAODominios,
SD_ModificarElementosDominio_ERROR_ElementosDominioEsVacio,
SD_ModificarElementosDominio_ERROR_ValorNoValido,
SD_ModificarElementosDominio_HECHO,
// Listar dominios
SD_ListarDominios_HECHO,
//---------------------------------------------------------------------------------
// Mensajes desde los Servicios de Relaciones al Controlador
//---------------------------------------------------------------------------------
SS_ValidacionM,
SS_ValidacionC,
SS_GeneracionScriptSQL,
SS_GeneracionArchivoScriptSQL,
SS_GeneracionModeloRelacional,
//---------------------------------------------------------------------------------
// Mensajes desde el Controlador a la GUIPrincipal
//---------------------------------------------------------------------------------
Controlador_InsertarEntidad,
Controlador_RenombrarEntidad,
Controlador_DebilitarEntidad,
Controlador_EliminarEntidad,
Controlador_EliminarAtributo,
Controlador_EliminarDominio,
Controlador_AnadirAtributoAEntidad,
Controlador_RenombrarAtributo,
Controlador_InsertarRelacion,
Controlador_EditarDominioAtributo,
Controlador_EditarCompuestoAtributo,
Controlador_EditarMultivaloradoAtributo,
Controlador_EditarNotNullAtributo,
Controlador_EditarUniqueAtributo,
Controlador_MoverEntidad_ERROR,
Controlador_MoverEntidad_HECHO,
Controlador_MoverAtributo_ERROR,
Controlador_MoverAtributo_HECHO,
Controlador_MoverRelacion_ERROR,
Controlador_MoverRelacion_HECHO,
Controlador_MoverDominio_HECHO,
Controlador_RenombrarRelacion,
Controlador_AnadirAtributoARelacion,
Controlador_EliminarRelacion,
Controlador_AnadirSubAtributoAAtributo,
Controlador_EditarClavePrimariaAtributo,
Controlador_EstablecerEntidadPadre,
Controlador_QuitarEntidadPadre,
Controlador_AnadirEntidadHija,
Controlador_QuitarEntidadHija,
Controlador_EliminarRelacionIsA,
Controlador_EliminarRelacionNormal,
Controlador_InsertarRelacionIsA,
Controlador_AnadirEntidadARelacion,
Controlador_QuitarEntidadARelacion,
Controlador_DebilitarRelacion,
Controlador_EditarCardinalidadEntidad,
Controlador_CardinalidadUnoUno,
Controlador_MostrarDatosEnPanelDeInformacion,
Controlador_LimpiarPanelDominio,
Controlador_MostrarDatosEnPanelDominio,
Controlador_InsertarDominio,
Controlador_RenombrarDominio,
Controlador_ModificarTipoBaseDominio,
Controlador_ModificarValoresDominio,
Controlador_AnadirRestriccionEntidad,
Controlador_AnadirRestriccionRelacion,
Controlador_AnadirRestriccionAtributo,
Controlador_QuitarRestriccionEntidad,
Controlador_QuitarRestriccionRelacion,
Controlador_QuitarRestriccionAtributo,
Controlador_setRestriccionesEntidad,
Controlador_setRestriccionesAtributo,
Controlador_setRestriccionesRelacion,
Controlador_AnadirUniqueEntidad,
Controlador_QuitarUniqueEntidad,
Controlador_setUniquesEntidad,
Controlador_setUniqueUnitarioEntidad,
Controlador_AnadirUniqueRelacion,
Controlador_QuitarUniqueRelacion,
Controlador_setUniquesRelacion,
Controlador_setUniqueUnitarioRelacion,
PanelDiseno_MostrarDatosEnTablaDeVolumenes,
Controlador_MostrarDatosEnTablaDeVolumenes,
PanelDiseno_ActualizarDatosEnTablaDeVolumenes,
Controlador_ActualizarDatosEnTablaDeVolumenes,
GUI_Principal_NULLATTR,
GUI_Principal_IniciaFrames,
}
|
[
"[email protected]"
] | |
60001f4e4f9de6ee28f6cbb62e8ec50c2d25be30
|
1bddaadc39b87538c72d3e1b1435ae5556522b22
|
/Stacks_Lab_Students/src/interfaces/Stack.java
|
d8f1ac4a24dd643dba36930e10102e765644e847
|
[] |
no_license
|
pablo-santiago6/Lab_1
|
68be0df02f432469c83df12fe1de2715bf0fb8f1
|
4120759b8b7f82e028efcafe1b26c0290921a0e1
|
refs/heads/master
| 2021-01-24T02:22:25.809057 | 2018-04-26T03:19:44 | 2018-04-26T03:19:44 | 122,843,787 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,009 |
java
|
package interfaces;
public interface Stack<E> {
/**
* Accessor Method. Returns the size of the current instance.
* **/
int size();
/**
* Accessor Method. Returns true if the current instance is
* empty; false, if not.
**/
boolean isEmpty();
/**
* Accessor Method. Accesses element in the current instance of the
* stack. The affected element is the one that has been in the stack
* the least time among all its current element.
* @return reference to the element being accessed; if the stack is
* empty, it returns null.
**/
E top();
/**
* Mutator Method. Adds a new element to the stack.
* @param e the element to be added to the stack.
**/
void push(E e);
/**
* Mutator Method. Similar to the top method, but this time, the
* stack is altered since the accessed element is also removed from
* the stack.
* @return reference to the element being removed from the stack. If
* the stack is empty, it returns null.
**/
E pop();
}
|
[
"[email protected]"
] | |
db7664ece4c1f4e12489ed401d1c69821aa15e7f
|
e2356234858fdb96630890fc3d998995e4196177
|
/ylibrary/src/main/java/jy/cn/com/ylibrary/helper/LogCatHelper.java
|
85639e8313df56c17c7a00640e652adbcecadb63
|
[] |
no_license
|
jyfree/YFramework
|
ba440740748c0cedc35cbea9f78f5c2bb761c455
|
6911c412c27d0bf1c79872b98a0701a60cad6a76
|
refs/heads/master
| 2020-08-08T17:46:42.781121 | 2020-04-26T10:03:16 | 2020-04-26T10:03:16 | 213,881,236 | 6 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,816 |
java
|
package jy.cn.com.ylibrary.helper;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Environment;
import android.text.TextUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import jy.cn.com.ylibrary.util.YLogUtil;
/**
* Administrator
* created at 2019/10/18 17:00
* TODO:log收集
* 注:若path为空则保存到sdcard(需要访问权限)
*/
public class LogCatHelper {
private static LogCatHelper instance = null;
private static final String TAG = LogCatHelper.class.getSimpleName();
private String dirPath;//保存路径
private int appId;//应用pid
private Thread logThread;
/**
* @param path log日志保存根目录
*/
public static LogCatHelper getInstance(Context mContext, String path) {
if (instance == null) {
instance = new LogCatHelper(mContext, path);
}
return instance;
}
private LogCatHelper(Context mContext, String path) {
appId = android.os.Process.myPid();
if (TextUtils.isEmpty(path)) {
dirPath = Environment.getExternalStorageDirectory().getAbsolutePath()
+ File.separator + "seeker" + File.separator + mContext.getPackageName();
} else {
dirPath = path;
}
File dir = new File(dirPath);
if (!dir.exists()) {
dir.mkdirs();
}
}
/**
* 启动log日志保存
*/
public void start() {
if (!YLogUtil.SHOW_LOG) return;
if (logThread == null) {
logThread = new Thread(new LogRunnable(appId, dirPath));
}
logThread.start();
}
private static class LogRunnable implements Runnable {
private Process mProcess;
private FileOutputStream fos;
private BufferedReader mReader;
private String cmd;
private String mPid;
String dirPath;
String fileName;
LogRunnable(int pid, String dirPath) {
this.mPid = "" + pid;
this.dirPath = dirPath;
try {
fileName = FormatDate.getFormatDate();
File file = new File(dirPath, fileName + ".log");
if (!file.exists()) {
file.createNewFile();
}
fos = new FileOutputStream(file, true);
} catch (Exception e) {
e.printStackTrace();
}
cmd = "logcat *:v | grep \"(" + mPid + ")\"";
}
@Override
public void run() {
try {
filter(dirPath, fileName);
mProcess = Runtime.getRuntime().exec(cmd);
mReader = new BufferedReader(new InputStreamReader(mProcess.getInputStream()), 1024);
String line;
while ((line = mReader.readLine()) != null) {
if (line.length() == 0) {
continue;
}
if (fos != null && line.contains(mPid)) {
fos.write((FormatDate.getFormatTime() + " " + line + "\r\n").getBytes());
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (mProcess != null) {
mProcess.destroy();
mProcess = null;
}
try {
if (mReader != null) {
mReader.close();
mReader = null;
}
if (fos != null) {
fos.close();
fos = null;
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
private static void filter(String dirPath, String nowFileName) {
try {
int nowTime = 0;
if (null != nowFileName && !nowFileName.isEmpty()) {
nowTime = Integer.parseInt(nowFileName.substring(0, nowFileName.length() - 2));
YLogUtil.INSTANCE.iTag(TAG, "创建log文件", nowFileName, "当前时间", nowTime);
}
File root = new File(dirPath);
File[] fileList = root.listFiles();
if (fileList == null || fileList.length < 1) {
return;
}
YLogUtil.INSTANCE.iTag(TAG, "过滤旧log文件,只保留当天log");
for (File file : fileList) {
String name = file.getName();
if (!name.isEmpty() && name.endsWith(".log")) {
int time = Integer.parseInt(name.substring(0, name.length() - 6));
if (nowTime - time > 0) {
boolean success = file.delete();
YLogUtil.INSTANCE.iTag(TAG, "删除文件", name, "删除成功", success);
} else {
YLogUtil.INSTANCE.iTag(TAG, "保留文件", name);
}
}
}
} catch (Exception e) {
e.printStackTrace();
YLogUtil.INSTANCE.eTag(TAG, "过滤log失败", e.getMessage());
}
}
@SuppressLint("SimpleDateFormat")
private static class FormatDate {
static String getFormatDate() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
return sdf.format(System.currentTimeMillis());
}
static String getFormatTime() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(System.currentTimeMillis());
}
}
}
|
[
"jyabc024420"
] |
jyabc024420
|
d22115e344a8c7c664da443e4be9902e129a9d8f
|
3120a57747af50dc63fe10939248cf2883d50ac9
|
/MenuDrawer/app/src/main/java/com/example/menudrawer/ui/home/HomeFragment.java
|
b0c829e730d269977d4cacef30835c82822594d4
|
[] |
no_license
|
sieun-Bae/android-sample
|
194eecbff3824d2517511b4a86d44b6a66a4de59
|
97b39e4ab4a9deeb0b5fd532ddb9121cdeae3982
|
refs/heads/main
| 2023-06-09T04:20:07.774325 | 2021-07-05T09:32:04 | 2021-07-05T09:32:04 | 372,842,710 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,386 |
java
|
package com.example.menudrawer.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.example.menudrawer.R;
import com.example.menudrawer.databinding.FragmentHomeBinding;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
private FragmentHomeBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
new ViewModelProvider(this).get(HomeViewModel.class);
binding = FragmentHomeBinding.inflate(inflater, container, false);
View root = binding.getRoot();
final TextView textView = binding.textHome;
homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
|
[
"[email protected]"
] | |
2a0460bf9a0777e7637274cdf24d9418a7949e3a
|
f88bd5590c56ca7a92c16c04574af84dc18421ac
|
/src/main/java/com/zhiyou100/video/service/SpeakerService.java
|
787275166e3ffe605d3b1dfba330948caaa1a89d
|
[] |
no_license
|
SuYiyao/video
|
301109ed37d9470c4f4fe7c35ee29a303941116d
|
ad9848adcc0b37733036d17697b50369cfb850cb
|
refs/heads/master
| 2021-01-21T08:20:13.831418 | 2017-09-02T02:05:58 | 2017-09-02T02:05:58 | 101,957,118 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 446 |
java
|
package com.zhiyou100.video.service;
import java.util.List;
import com.zhiyou100.video.model.Speaker;
import com.zhiyou100.video.model.SpeakerVO;
import com.zhiyou100.video.utils.Page;
public interface SpeakerService {
Page loadPage(SpeakerVO sv);
void addSpeaker(Speaker speaker);
List<Speaker> findAllSpeaker();
Speaker findSpeakerById(int id);
void editSpeaker(Speaker sp);
void deleteSpeaker(int id);
}
|
[
"[email protected]"
] | |
80b245b605c64f0f9e597c64d7940837b24ad2f9
|
45bd47d5f2ae43621286963ebf8271c89d30ee9a
|
/Wikout/src/adapter/NavDrawerListAdapter.java
|
8c337e9d951715e34a083b40f764494c42e883df
|
[] |
no_license
|
Shezek/Repositorio
|
2b9bc129bb72096d0cb8698ce25fcd31088ff77c
|
161f94c1a33dc2c9d9dd8937503b92b585825c77
|
refs/heads/master
| 2016-09-06T12:38:46.802458 | 2014-10-27T13:14:08 | 2014-10-27T13:14:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,181 |
java
|
package adapter;
import java.util.ArrayList;
import model.NavDrawerItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.wikout.R;
public class NavDrawerListAdapter extends BaseAdapter {
private Context context;
private ArrayList<NavDrawerItem> navDrawerItems;
public NavDrawerListAdapter(Context context, ArrayList<NavDrawerItem> navDrawerItems ){
this.context = context;
this.navDrawerItems = navDrawerItems;
}
@Override
public int getCount() {
return navDrawerItems.size();
}
@Override
public Object getItem(int position) {
return navDrawerItems.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.drawer_list_item, null);
}
ImageView imView=(ImageView) convertView.findViewById(R.id.icon);
TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
TextView txtCount = (TextView) convertView.findViewById(R.id.counter);
txtTitle.setText(navDrawerItems.get(position).getTitle());
imView.setImageResource(navDrawerItems.get(position).getIcon());
// displaying count
// check whether it set visible or not
if(navDrawerItems.get(position).getCounterVisibility()){
txtCount.setText(navDrawerItems.get(position).getCount());
}else{
// hide the counter view
txtCount.setVisibility(View.GONE);
}
return convertView;
}
}
|
[
"[email protected]"
] | |
e92f4e3b9c089d6de34a7513a83a97ece39cc67a
|
09e2e9f5f12639f744c0f562548437d39848a09b
|
/src/main/java/org/qbi/seriescalendar/web/view/MBDayView.java
|
c7c459f0909857c89f113164b521d14f1c95bd21
|
[] |
no_license
|
czekla/SeriesCalendar
|
b0d07bf5d91f881a6c41146b0ae2698adbaec9c3
|
c4ed8044bb8bfbe6158865686f5bfe7c9c65d5df
|
refs/heads/master
| 2021-01-10T20:46:09.303966 | 2015-04-27T17:24:51 | 2015-04-27T17:24:51 | 25,249,753 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,752 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.qbi.seriescalendar.web.view;
import org.qbi.seriescalendar.web.session.MBWeekView;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import org.apache.log4j.Logger;
import org.qbi.seriescalendar.web.model.Series;
/**
*
* @author Qbi
*/
@ManagedBean(name = "mBDayView")
@ViewScoped
public class MBDayView implements Serializable {
private List<Series> seriesList;
private Series selectedSeries;
private String seriesDay;
@ManagedProperty("#{mBWeekView}")
private MBWeekView weekView;
final static Logger logger = Logger.getLogger(MBDayView.class);
@PostConstruct
public void init() {
}
public List<Series> getSeriesList() {
return seriesList;
}
public void setSeriesList(List<Series> seriesList) {
this.seriesList = seriesList;
}
public Series getSelectedSeries() {
return selectedSeries;
}
public void setSelectedSeries(Series selectedSeries) {
this.selectedSeries = selectedSeries;
}
public String getSeriesDay() {
return seriesDay;
}
public void setSeriesDay(String seriesDay) {
this.seriesDay = seriesDay;
}
public MBWeekView getWeekView() {
return weekView;
}
public void setWeekView(MBWeekView weekView) {
this.weekView = weekView;
}
}
|
[
"Porció László@192.168.10.104"
] |
Porció László@192.168.10.104
|
587ad181c216efb9a29d057e8091aae0c85ab947
|
465f2f75e665b651f89b7e691a698ee37dea1167
|
/src/Main/task4.java
|
b28f98ebc8b334355df5cb607e8d205b4325cde5
|
[] |
no_license
|
aizhan1393/javaClasses
|
6e170cfc3000e5a38349b4f7229898821a61384d
|
e174899aa97a6ddc37ba56e2feac6393b9fdeb87
|
refs/heads/master
| 2023-07-16T18:52:43.866336 | 2021-08-21T12:04:12 | 2021-08-21T12:04:12 | 390,836,586 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 432 |
java
|
package Main;
public class task4 {
static public void main(String[] args){
int sum = 0;
int product = 1;
for (String arg : args) {
sum = sum + Integer.parseInt(arg);
}
System.out.println("The sum is " + sum);
for(String arg : args){
product = product* Integer.parseInt(arg);
}
System.out.println("The product is " + product);
}
}
|
[
"[email protected]"
] | |
fc5072fb18a78c445280dd9410912da27a97ae0d
|
a8e84ec174e6360ab0b3e89449225c30aabddd3d
|
/src/main/java/PendingEmployee.java
|
86297237ef302496d84cdb95cc30f11e25ef6c95
|
[] |
no_license
|
HoustonKoester/Project-1
|
7308f35673629bf018788368bdc314836793d862
|
5bfe456f5c7de4f2680810c6ba718a051016e646
|
refs/heads/master
| 2023-06-22T23:12:25.549653 | 2021-07-23T17:37:45 | 2021-07-23T17:37:45 | 382,964,409 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,916 |
java
|
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
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 services.GenServiceImpl;
/**
* Servlet implementation class PendingEmployee
*/
@WebServlet("/PendingEmployee")
public class PendingEmployee extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public PendingEmployee() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
GenServiceImpl gen = new GenServiceImpl();
PrintWriter out = response.getWriter();
//System.out.println("Made it to the servlet2");
String td[] = request.getParameterValues("id");
ArrayList<String> information = new ArrayList<String>();
ArrayList<String> delete = new ArrayList<String>();
ArrayList<String> accept = new ArrayList<String>();
String[] col = {"0","1","2","3","4","5","6","7"};
int i = 0;
for(String ids: td) {
String decision = request.getParameter("decision"+ids);
System.out.println(decision);
if(decision.equals("Accepted")) {
for(String column: col) {
String val = request.getParameter("id"+ids+column);
accept.add(val);
i++;
}
}else if(decision.equals("Delete")){
for(String column: col) {
String val = request.getParameter("id"+ids+column);
delete.add(val);
i++;
}
}
}
System.out.println(delete);
System.out.println(accept);
if(accept.size() != 0) {
gen.addPendingEmployee(accept);
}
if(delete.size() != 0) {
gen.deletePendingEmployee(delete);
}
//gen.addPendingEmployee(i, getServletName(), getServletInfo(), getServletInfo(), getServletInfo(), getServletInfo(), getServletName(), getServletInfo())
//gen.updateDatabase(information);
RequestDispatcher rd=request.getRequestDispatcher("/Manager.jsp");
rd.forward(request, response);
}
}
|
[
"[email protected]"
] | |
c7ee01bde187579b3085512dc576f0071ac762ee
|
173a7e3c1d4b34193aaee905beceee6e34450e35
|
/kmzyc-common/src/main/java/com/pltfm/app/vobject/ProductRelation.java
|
aef19b0f31cc4ceba4c87119edf78daa23ea3315
|
[] |
no_license
|
jjmnbv/km_dev
|
d4fc9ee59476248941a2bc99a42d57fe13ca1614
|
f05f4a61326957decc2fc0b8e06e7b106efc96d4
|
refs/heads/master
| 2020-03-31T20:03:47.655507 | 2017-05-26T10:01:56 | 2017-05-26T10:01:56 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,675 |
java
|
package com.pltfm.app.vobject;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public class ProductRelation implements Serializable {
private static final long serialVersionUID = 3042545583627121561L;
private Long relationId; // 关联主表的id
private String relationName; // 关联的名称
private BigDecimal mainSkuId; // 主skuID
private BigDecimal mainSkuPrice;// 主产品价格
private BigDecimal skuMarkPrice;//sku的市场价
private BigDecimal totalRelationPrice; // 总的价格
private Short relationType; // 关联类型
private String remark; // 备注
private BigDecimal totalPrice ; //总的市场价
private List<ProductRelationView> relationViewList; //界面显示的详情信息
private boolean productStatusIsValid=true; // 判断关联的产品中有无没有上架的产品 即skuStatus为0,或者状态不为 3 (上架状态) 以及所关联的产品中的剩余数量是否大于零
private Short status; // 套餐状态
private Short delStatus;// 删除状态
private Date createDate; //创建时间
private Short editable; //可编辑
private String webSite;//所属站点
private Short supplierType;//供应商类型
private Short supplierId;//供应商id
private List<ProductRelationAndDetail> showProductCoutntList;
private Short allProCount;
private String supplierName;//供应商名称
private Short productSkuId;
private String productSkuCode;//sku编码
private BigDecimal pvValue;//套餐pv值
private List<ProductRelationDetail> productRelationDetails;
private BigDecimal costIncomeRatio;//合作收益百分比
/**
* 组方关联介绍(数据库Clob类型)
*/
private String relationIntroduce;
/**
* 组方关联视频地址
*/
private String relationVideo;
/**
* 主产品编号
*/
private String productNo;
/**
* 组方简介
*/
private String relationIntro;
/**
* 产品名称
*/
private String productName;
/**
* 组方关联介绍lazy(数据库Clob类型)
*/
private String relationIntroduceLazy;
public List<ProductRelationView> getRelationViewList() {
return relationViewList;
}
public void setRelationViewList(List<ProductRelationView> relationViewList) {
this.relationViewList = relationViewList;
}
public Long getRelationId() {
return relationId;
}
public void setRelationId(Long relationId) {
this.relationId = relationId;
}
public String getRelationName() {
return relationName;
}
public void setRelationName(String relationName) {
this.relationName = relationName;
}
public BigDecimal getMainSkuId() {
return mainSkuId;
}
public void setMainSkuId(BigDecimal mainSkuId) {
this.mainSkuId = mainSkuId;
}
public BigDecimal getMainSkuPrice() {
return mainSkuPrice;
}
public void setMainSkuPrice(BigDecimal mainSkuPrice) {
this.mainSkuPrice = mainSkuPrice;
}
public BigDecimal getTotalRelationPrice() {
return totalRelationPrice;
}
public void setTotalRelationPrice(BigDecimal totalRelationPrice) {
this.totalRelationPrice = totalRelationPrice;
}
public Short getRelationType() {
return relationType;
}
public void setRelationType(Short relationType) {
this.relationType = relationType;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public boolean isProductStatusIsValid() {
return productStatusIsValid;
}
public void setProductStatusIsValid(boolean productStatusIsValid) {
this.productStatusIsValid = productStatusIsValid;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public Short getDelStatus() {
return delStatus;
}
public void setDelStatus(Short delStatus) {
this.delStatus = delStatus;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Short getEditable() {
return editable;
}
public void setEditable(Short editable) {
this.editable = editable;
}
public String getWebSite() {
return webSite;
}
public void setWebSite(String webSite) {
this.webSite = webSite;
}
public Short getSupplierType() {
return supplierType;
}
public void setSupplierType(Short supplierType) {
this.supplierType = supplierType;
}
public Short getSupplierId() {
return supplierId;
}
public void setSupplierId(Short supplierId) {
this.supplierId = supplierId;
}
public List<ProductRelationAndDetail> getShowProductCoutntList() {
return showProductCoutntList;
}
public void setShowProductCoutntList(
List<ProductRelationAndDetail> showProductCoutntList) {
this.showProductCoutntList = showProductCoutntList;
}
public Short getAllProCount() {
return allProCount;
}
public void setAllProCount(Short allProCount) {
this.allProCount = allProCount;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public Short getProductSkuId() {
return productSkuId;
}
public void setProductSkuId(Short productSkuId) {
this.productSkuId = productSkuId;
}
public String getProductSkuCode() {
return productSkuCode;
}
public void setProductSkuCode(String productSkuCode) {
this.productSkuCode = productSkuCode;
}
public BigDecimal getPvValue() {
return pvValue;
}
public void setPvValue(BigDecimal pvValue) {
this.pvValue = pvValue;
}
public BigDecimal getCostIncomeRatio() {
return costIncomeRatio;
}
public void setCostIncomeRatio(BigDecimal costIncomeRatio) {
this.costIncomeRatio = costIncomeRatio;
}
public List<ProductRelationDetail> getProductRelationDetails() {
return productRelationDetails;
}
public void setProductRelationDetails(
List<ProductRelationDetail> productRelationDetails) {
this.productRelationDetails = productRelationDetails;
}
public String getRelationIntroduce() {
return relationIntroduce;
}
public void setRelationIntroduce(String relationIntroduce) {
this.relationIntroduce = relationIntroduce;
}
public String getRelationVideo() {
return relationVideo;
}
public void setRelationVideo(String relationVideo) {
this.relationVideo = relationVideo;
}
public String getProductNo() {
return productNo;
}
public void setProductNo(String productNo) {
this.productNo = productNo;
}
public String getRelationIntro() {
return relationIntro;
}
public void setRelationIntro(String relationIntro) {
this.relationIntro = relationIntro;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getRelationIntroduceLazy() {
return relationIntroduceLazy;
}
public void setRelationIntroduceLazy(String relationIntroduceLazy) {
this.relationIntroduceLazy = relationIntroduceLazy;
}
public BigDecimal getSkuMarkPrice() {
return skuMarkPrice;
}
public void setSkuMarkPrice(BigDecimal skuMarkPrice) {
this.skuMarkPrice = skuMarkPrice;
}
@Override
public String toString() {
return "ProductRelation{" +
"relationId=" + relationId +
", relationName='" + relationName + '\'' +
", mainSkuId=" + mainSkuId +
", mainSkuPrice=" + mainSkuPrice +
", skuMarkPrice=" + skuMarkPrice +
", totalRelationPrice=" + totalRelationPrice +
", relationType=" + relationType +
", remark='" + remark + '\'' +
", totalPrice=" + totalPrice +
", relationViewList=" + relationViewList +
", productStatusIsValid=" + productStatusIsValid +
", status=" + status +
", delStatus=" + delStatus +
", createDate=" + createDate +
", editable=" + editable +
", webSite='" + webSite + '\'' +
", supplierType=" + supplierType +
", supplierId=" + supplierId +
", showProductCoutntList=" + showProductCoutntList +
", allProCount=" + allProCount +
", supplierName='" + supplierName + '\'' +
", productSkuId=" + productSkuId +
", productSkuCode='" + productSkuCode + '\'' +
", pvValue=" + pvValue +
", productRelationDetails=" + productRelationDetails +
", costIncomeRatio=" + costIncomeRatio +
", relationIntroduce='" + relationIntroduce + '\'' +
", relationVideo='" + relationVideo + '\'' +
", productNo='" + productNo + '\'' +
", relationIntro='" + relationIntro + '\'' +
", productName='" + productName + '\'' +
", relationIntroduceLazy='" + relationIntroduceLazy + '\'' +
'}';
}
}
|
[
"[email protected]"
] | |
9b7197d46a54c30fe6be97fe26954e54f92e213b
|
7707e4b00b9f470d3377cc223ed86b26c0d2bbc1
|
/src/main/java/com/minecraftabnormals/allurement/core/mixin/ExperienceOrbEntityMixin.java
|
0bdda29b9dbc65f016ad63df933a89a62ce9ef1d
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
SakurasIsland/allurement
|
04c7dff85a15e8f36d3c084cb9fa50cd3aae4ec3
|
4303715372ba196aa3006045d0c3127482bf8b10
|
refs/heads/main
| 2023-07-18T07:04:57.999653 | 2021-08-23T01:00:34 | 2021-08-23T01:00:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,443 |
java
|
package com.minecraftabnormals.allurement.core.mixin;
import com.minecraftabnormals.allurement.core.AllurementConfig;
import com.minecraftabnormals.allurement.core.other.AllurementUtil;
import com.minecraftabnormals.allurement.core.registry.AllurementEnchantments;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ExperienceOrbEntity.class)
public class ExperienceOrbEntityMixin {
@Shadow
public int value;
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;take(Lnet/minecraft/entity/Entity;I)V", shift = At.Shift.AFTER), method = "playerTouch", cancellable = true)
private void onCollideWithPlayer(PlayerEntity player, CallbackInfo ci) {
int count = AllurementUtil.getTotalEnchantmentLevel(AllurementEnchantments.ALLEVIATING.get(), player, EquipmentSlotType.Group.ARMOR);
if (count > 0) {
float factor = AllurementConfig.COMMON.alleviatingHealingFactor.get() * count;
float i = Math.min(this.value * factor, player.getMaxHealth() - player.getHealth());
this.value -= Math.round(i / factor);
player.heal(i);
}
}
}
|
[
"[email protected]"
] | |
71f3724e3ca9782f693e496420e5695cef38abc7
|
ed3dbcd51cfa8e6549e39fd25f2f07f1fdab0d62
|
/app/src/main/java/cablevision/com/myappportfolio/MainActivity.java
|
32dcb2690cfcd2fb61f3f1c18a7348a45acd79c3
|
[] |
no_license
|
thiagolocatelli/UdacityAppPortfolio
|
f7ea438ca3d351b1ea4b5b3612df266b45d5012f
|
0bf1b7847ad53ced7e0faaab4bb93d5d21b83fcf
|
refs/heads/master
| 2021-01-01T03:57:00.908407 | 2016-04-19T01:20:46 | 2016-04-19T01:20:46 | 56,553,795 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,377 |
java
|
package cablevision.com.myappportfolio;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onBtnPopularMoviesClick(View view) {
Toast.makeText(this, "This Button will launch the Popular Movies app", Toast.LENGTH_SHORT).show();
}
public void onBtnStockHawkClick(View view) {
Toast.makeText(this, "This Button will launch the Stock Hawk app", Toast.LENGTH_SHORT).show();
}
public void onBtnBuildBiggerClick(View view) {
Toast.makeText(this, "This Button will launch the Build it Bigger app", Toast.LENGTH_SHORT).show();
}
public void onBtnMakeMaterialClick(View view) {
Toast.makeText(this, "This Button will launch the Make it Material app", Toast.LENGTH_SHORT).show();
}
public void onBtnUbiquitousClick(View view) {
Toast.makeText(this, "This Button will launch the Go Ubiquitous app", Toast.LENGTH_SHORT).show();
}
public void onBtnCapstoneClick(View view) {
Toast.makeText(this, "This Button will launch the Capstone app", Toast.LENGTH_SHORT).show();
}
}
|
[
"[email protected]"
] | |
d6b5757190147efc54ad84a689c82a4bb6e12dca
|
1aa62cf22aaaeb399d6af63f3c7219938686f158
|
/project/note-java-core/chapter3/YouKuanZeng/Retirement/src/Retirement.java
|
a3b0490139f4daff72f3f9f4d5d376d8401c1794
|
[
"Apache-2.0"
] |
permissive
|
mrzhqiang/studyjava-zz
|
ae2dbc2e8d2b3483f21d8c58ea394e3cb4d4809f
|
b80f263d2ed6cdd686808aba7f18aec9e03f117e
|
refs/heads/master
| 2021-10-24T09:54:04.134384 | 2019-03-25T01:54:17 | 2019-03-25T01:54:17 | 110,648,689 | 4 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 799 |
java
|
import java.util.Scanner;
public class Retirement {
public static void main(String[] args) {
// read input
Scanner in = new Scanner(System.in);
System.out.println("How much money do you need to retire?");
double goal = in.nextDouble();
System.out.println("How much money will you contribute every year?");
double payment = in.nextDouble();
System.out.println("Interest rate in %:");
double interestRate = in.nextDouble();
double balance = 0;
int years = 0;
// update account balance while goal isn't reached
while (balance < goal);
{
//add this year's payment and interest
balance += payment;
double interest = balance * interestRate/100;
balance += interest;
years++;
}
System.out.println("You can retire in" + years +"years.");
}
}
|
[
"[email protected]"
] | |
f312a54f2942c723be0a970d25239e2580a44888
|
b7bc39c604f7b83a7d7f0d750240fe86d8df7a5c
|
/java-basic/src/main/java/ch30/f/MyAdvice.java
|
4e83f7aa5e214ed1ec975889d3443a7730522eeb
|
[] |
no_license
|
ppappikko/bitcamp-java-2018-12
|
e79e023a00c579519ae67ba9f997b615fb539e5c
|
bd2a0b87c20a716d2b1e8cafc2a9cd54f683a37f
|
refs/heads/master
| 2021-08-06T17:31:37.187323 | 2019-07-19T04:55:07 | 2019-07-19T04:55:07 | 163,650,729 | 0 | 0 | null | 2020-04-30T16:14:59 | 2018-12-31T08:01:24 |
Java
|
UTF-8
|
Java
| false | false | 2,494 |
java
|
package ch30.f;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
// 지정된 객체의 메서드를 호출할 때,
// 메서드 호출 전이나 후에 어떤 작업을 수행하는 일을 한다.
// XML 설정을 사용할 때는 이 클래스의 객체 생성을 XML에서 했기 때문에
// @Component 애노테이션을 붇이지 않았다.
// 이제는 XML에서 이 클래스의 객체를 만들지 않기 때문에 이 애노테이션을 붙여야 한다.
@Component
// 이 클래스가 AOP 기능을 수행하는 클래스임을 표시해야 한다.
@Aspect
public class MyAdvice {
//Pointcut을 미리 정의한다.
// => 메서드 선언부에 붙여야 한다.
// => 메서드의 파라미터는 없고, 구현을 비워둔다.
// => 이 메서드는 pointcut을 지정하는 용도로만 사용한다.
@Pointcut("execution(* ch30.f.X.*(..))")
public void calculatorOperation() {}
/*
<aop:before
pointcut="execution(* ch30.e.X.*(..)) and args(p2, p3, p1)"
method="doBefore"/>
*/
@Before("calculatorOperation() and args(p2, p3, p1)")
public void doBefore(String p1, int p2, int p3) {
System.out.printf("%s.doBefore()\n", this.getClass().getName());
System.out.printf(" => %s %d %d\n", p1, p2, p3);
}
/*
<aop:after
pointcut-ref="pointcut1"
method="doAfter"/>
*/
@After("calculatorOperation()")
public void doAfter() {
System.out.printf("%s.doAfter()\n", this.getClass().getName());
}
/*
<aop:after-returning
pointcut-ref="pointcut1"
returning="rv"
method="doAfterReturning"/>
*/
@AfterReturning(
pointcut="calculatorOperation()",
returning="rv")
public void doAfterReturning(Object rv) {
System.out.printf("%s.doAfterReturning()\n", this.getClass().getName());
System.out.printf(" => %s\n", rv);
}
/*
<aop:after-throwing
pointcut-ref="pointcut1"
throwing="err"
method="doAfterThrowing"/>
*/
@AfterThrowing(
pointcut="calculatorOperation()",
throwing="err")
public void doAfterThrowing(Exception err) {
System.out.printf("%s.doAfterThrowing()\n", this.getClass().getName());
System.out.printf(" => %s\n", err.getMessage());
}
}
|
[
"[email protected]"
] | |
36c0115b8cc0c7e61a676e4d8c9f36c6187bb664
|
ea80be7c916654b2da85977d4876132f1e0fcd8c
|
/imal_admin_portal/src/reporting_services_common_src/com/path/vo/reporting/IRP_REP_ARG_CONSTRAINTSCO.java
|
77187e4693884184dd51f707d33c2da9a4fb243f
|
[] |
no_license
|
jenil-shah135/imal_admin_portal
|
1352b47aa38530d7ddcc56399f6f83b37d804d38
|
fa47f0f45d486999eb30d58e7da6c0a79c236b1b
|
refs/heads/master
| 2023-01-15T15:59:27.683025 | 2020-11-25T12:43:30 | 2020-11-25T12:43:30 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,522 |
java
|
package com.path.vo.reporting;
import java.io.Serializable;
import com.path.dbmaps.vo.IRP_REP_ARG_CONSTRAINTSVO;
import com.path.lib.vo.BaseVO;
public class IRP_REP_ARG_CONSTRAINTSCO extends BaseVO implements Serializable
{
private IRP_REP_ARG_CONSTRAINTSVO irpRepArgConstraintsVO = new IRP_REP_ARG_CONSTRAINTSVO();
private String CASE_SENSITIVITY;
private String MAX_LENGTH;
private String MAX_VAL;
private String MIN_VAL;
private String FORMAT;
private String CONDITION;
private String SHOW_EXPR;
private String HIDE_EXPR;
private String BTR_CONTROL_DISP;
public String getBTR_CONTROL_DISP()
{
return BTR_CONTROL_DISP;
}
public void setBTR_CONTROL_DISP(String bTRCONTROLDISP)
{
BTR_CONTROL_DISP = bTRCONTROLDISP;
}
public String getCASE_SENSITIVITY()
{
return CASE_SENSITIVITY;
}
public void setCASE_SENSITIVITY(String cASESENSITIVITY)
{
CASE_SENSITIVITY = cASESENSITIVITY;
}
public String getMAX_LENGTH()
{
return MAX_LENGTH;
}
public void setMAX_LENGTH(String mAXLENGTH)
{
MAX_LENGTH = mAXLENGTH;
}
public String getMAX_VAL()
{
return MAX_VAL;
}
public void setMAX_VAL(String mAXVAL)
{
MAX_VAL = mAXVAL;
}
public String getMIN_VAL()
{
return MIN_VAL;
}
public void setMIN_VAL(String mINVAL)
{
MIN_VAL = mINVAL;
}
public String getFORMAT()
{
return FORMAT;
}
public void setFORMAT(String fORMAT)
{
FORMAT = fORMAT;
}
public String getCONDITION()
{
return CONDITION;
}
public void setCONDITION(String cONDITION)
{
CONDITION = cONDITION;
}
public String getSHOW_EXPR()
{
return SHOW_EXPR;
}
public void setSHOW_EXPR(String sHOWEXPR)
{
SHOW_EXPR = sHOWEXPR;
}
public String getHIDE_EXPR()
{
return HIDE_EXPR;
}
public void setHIDE_EXPR(String hIDEEXPR)
{
HIDE_EXPR = hIDEEXPR;
}
public IRP_REP_ARG_CONSTRAINTSVO getIrpRepArgConstraintsVO()
{
return irpRepArgConstraintsVO;
}
public void setIrpRepArgConstraintsVO(IRP_REP_ARG_CONSTRAINTSVO irpRepArgConstraintsVO)
{
this.irpRepArgConstraintsVO = irpRepArgConstraintsVO;
}
}
|
[
"[email protected]"
] | |
8045c01fce2bff74aa44d59549c5d66431d629b1
|
d0727bb0d90cd794e8b50de3837cded32663cfb4
|
/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TraceQueryDAO.java
|
54cfb65e406712c169895566448752b81532cda8
|
[
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
shanika04/apache_skywalking
|
5c8a01b1af1fabfd3e83f77cbfa408ca0daee7a6
|
13172e3310719ee9c6a662e0c2a1f9ce85cada3c
|
refs/heads/master
| 2023-02-11T04:33:23.259931 | 2021-01-06T13:52:43 | 2021-01-06T13:52:43 | 327,318,338 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,428 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao;
import com.google.common.base.Strings;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import org.apache.skywalking.apm.util.StringUtil;
import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
import org.apache.skywalking.oap.server.core.query.entity.BasicTrace;
import org.apache.skywalking.oap.server.core.query.entity.QueryOrder;
import org.apache.skywalking.oap.server.core.query.entity.Span;
import org.apache.skywalking.oap.server.core.query.entity.TraceBrief;
import org.apache.skywalking.oap.server.core.query.entity.TraceState;
import org.apache.skywalking.oap.server.core.storage.query.ITraceQueryDAO;
import org.apache.skywalking.oap.server.library.client.jdbc.hikaricp.JDBCHikariCPClient;
import org.apache.skywalking.oap.server.library.util.BooleanUtils;
import org.elasticsearch.search.sort.SortOrder;
public class H2TraceQueryDAO implements ITraceQueryDAO {
private JDBCHikariCPClient h2Client;
public H2TraceQueryDAO(JDBCHikariCPClient h2Client) {
this.h2Client = h2Client;
}
@Override
public TraceBrief queryBasicTraces(long startSecondTB,
long endSecondTB,
long minDuration,
long maxDuration,
String endpointName,
String serviceId,
String serviceInstanceId,
String endpointId,
String traceId,
int limit,
int from,
TraceState traceState,
QueryOrder queryOrder) throws IOException {
StringBuilder sql = new StringBuilder();
List<Object> parameters = new ArrayList<>(10);
sql.append("from ").append(SegmentRecord.INDEX_NAME).append(" where ");
sql.append(" 1=1 ");
if (startSecondTB != 0 && endSecondTB != 0) {
sql.append(" and ").append(SegmentRecord.TIME_BUCKET).append(" >= ?");
parameters.add(startSecondTB);
sql.append(" and ").append(SegmentRecord.TIME_BUCKET).append(" <= ?");
parameters.add(endSecondTB);
}
if (minDuration != 0 || maxDuration != 0) {
if (minDuration != 0) {
sql.append(" and ").append(SegmentRecord.LATENCY).append(" >= ?");
parameters.add(minDuration);
}
if (maxDuration != 0) {
sql.append(" and ").append(SegmentRecord.LATENCY).append(" <= ?");
parameters.add(maxDuration);
}
}
if (!Strings.isNullOrEmpty(endpointName)) {
sql.append(" and ").append(SegmentRecord.ENDPOINT_NAME).append(" like '%" + endpointName + "%'");
}
if (StringUtil.isNotEmpty(serviceId)) {
sql.append(" and ").append(SegmentRecord.SERVICE_ID).append(" = ?");
parameters.add(serviceId);
}
if (StringUtil.isNotEmpty(serviceInstanceId)) {
sql.append(" and ").append(SegmentRecord.SERVICE_INSTANCE_ID).append(" = ?");
parameters.add(serviceInstanceId);
}
if (!Strings.isNullOrEmpty(endpointId)) {
sql.append(" and ").append(SegmentRecord.ENDPOINT_ID).append(" = ?");
parameters.add(endpointId);
}
if (!Strings.isNullOrEmpty(traceId)) {
sql.append(" and ").append(SegmentRecord.TRACE_ID).append(" = ?");
parameters.add(traceId);
}
switch (traceState) {
case ERROR:
sql.append(" and ").append(SegmentRecord.IS_ERROR).append(" = ").append(BooleanUtils.TRUE);
break;
case SUCCESS:
sql.append(" and ").append(SegmentRecord.IS_ERROR).append(" = ").append(BooleanUtils.FALSE);
break;
}
switch (queryOrder) {
case BY_START_TIME:
sql.append(" order by ").append(SegmentRecord.START_TIME).append(" ").append(SortOrder.DESC);
break;
case BY_DURATION:
sql.append(" order by ").append(SegmentRecord.LATENCY).append(" ").append(SortOrder.DESC);
break;
}
TraceBrief traceBrief = new TraceBrief();
try (Connection connection = h2Client.getConnection()) {
try (ResultSet resultSet = h2Client.executeQuery(connection, buildCountStatement(sql.toString()), parameters
.toArray(new Object[0]))) {
while (resultSet.next()) {
traceBrief.setTotal(resultSet.getInt("total"));
}
}
buildLimit(sql, from, limit);
try (ResultSet resultSet = h2Client.executeQuery(
connection, "select * " + sql.toString(), parameters.toArray(new Object[0]))) {
while (resultSet.next()) {
BasicTrace basicTrace = new BasicTrace();
basicTrace.setSegmentId(resultSet.getString(SegmentRecord.SEGMENT_ID));
basicTrace.setStart(resultSet.getString(SegmentRecord.START_TIME));
basicTrace.getEndpointNames().add(resultSet.getString(SegmentRecord.ENDPOINT_NAME));
basicTrace.setDuration(resultSet.getInt(SegmentRecord.LATENCY));
basicTrace.setError(BooleanUtils.valueToBoolean(resultSet.getInt(SegmentRecord.IS_ERROR)));
String traceIds = resultSet.getString(SegmentRecord.TRACE_ID);
basicTrace.getTraceIds().add(traceIds);
traceBrief.getTraces().add(basicTrace);
}
}
} catch (SQLException e) {
throw new IOException(e);
}
return traceBrief;
}
protected String buildCountStatement(String sql) {
return "select count(1) total from (select 1 " + sql + " )";
}
protected void buildLimit(StringBuilder sql, int from, int limit) {
sql.append(" LIMIT ").append(limit);
sql.append(" OFFSET ").append(from);
}
@Override
public List<SegmentRecord> queryByTraceId(String traceId) throws IOException {
List<SegmentRecord> segmentRecords = new ArrayList<>();
try (Connection connection = h2Client.getConnection()) {
try (ResultSet resultSet = h2Client.executeQuery(
connection, "select * from " + SegmentRecord.INDEX_NAME + " where " + SegmentRecord.TRACE_ID + " = ?",
traceId
)) {
while (resultSet.next()) {
SegmentRecord segmentRecord = new SegmentRecord();
segmentRecord.setSegmentId(resultSet.getString(SegmentRecord.SEGMENT_ID));
segmentRecord.setTraceId(resultSet.getString(SegmentRecord.TRACE_ID));
segmentRecord.setServiceId(resultSet.getString(SegmentRecord.SERVICE_ID));
segmentRecord.setServiceInstanceId(resultSet.getString(SegmentRecord.SERVICE_INSTANCE_ID));
segmentRecord.setEndpointName(resultSet.getString(SegmentRecord.ENDPOINT_NAME));
segmentRecord.setStartTime(resultSet.getLong(SegmentRecord.START_TIME));
segmentRecord.setEndTime(resultSet.getLong(SegmentRecord.END_TIME));
segmentRecord.setLatency(resultSet.getInt(SegmentRecord.LATENCY));
segmentRecord.setIsError(resultSet.getInt(SegmentRecord.IS_ERROR));
String dataBinaryBase64 = resultSet.getString(SegmentRecord.DATA_BINARY);
if (!Strings.isNullOrEmpty(dataBinaryBase64)) {
segmentRecord.setDataBinary(Base64.getDecoder().decode(dataBinaryBase64));
}
segmentRecord.setVersion(resultSet.getInt(SegmentRecord.VERSION));
segmentRecords.add(segmentRecord);
}
}
} catch (SQLException e) {
throw new IOException(e);
}
return segmentRecords;
}
@Override
public List<Span> doFlexibleTraceQuery(String traceId) {
return Collections.emptyList();
}
}
|
[
"[email protected]"
] | |
574501dd23a0b925db294342a62c190365a09169
|
e6a8b5b0ac0df772ec026fb8444326cc250be11c
|
/app/src/main/java/com/babbangona/mspalybookupgrade/transporter/data/room/tables/OperatingAreasTable.java
|
0ec65f8bc4b3c32480bc96196980b5d7472701d0
|
[] |
no_license
|
BabbanGonaDev/MsPlayBookUpgrade-backup
|
9d8f41710a977dc31cfaa5c801b089c252b697cc
|
78bb260d8c9b32c70c899f77467fb602ecca9239
|
refs/heads/master
| 2023-02-18T08:45:41.814887 | 2020-11-10T09:41:56 | 2020-11-10T09:41:56 | 329,027,697 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,621 |
java
|
package com.babbangona.mspalybookupgrade.transporter.data.room.tables;
import androidx.annotation.NonNull;
import androidx.room.Entity;
@Entity(tableName = "operating_areas_table", primaryKeys = {"phone_number", "cc_id"})
public class OperatingAreasTable {
@NonNull
private String phone_number;
@NonNull
private String cc_id;
private String staff_id;
private String imei;
private String app_version;
private String date_updated;
private Integer sync_flag;
public OperatingAreasTable(@NonNull String phone_number, @NonNull String cc_id, String staff_id, String imei, String app_version, String date_updated, Integer sync_flag) {
this.phone_number = phone_number;
this.cc_id = cc_id;
this.staff_id = staff_id;
this.imei = imei;
this.app_version = app_version;
this.date_updated = date_updated;
this.sync_flag = sync_flag;
}
@NonNull
public String getPhone_number() {
return phone_number;
}
@NonNull
public String getCc_id() {
return cc_id;
}
public String getStaff_id() {
return staff_id;
}
public String getImei() {
return imei;
}
public String getApp_version() {
return app_version;
}
public String getDate_updated() {
return date_updated;
}
public Integer getSync_flag() {
return sync_flag;
}
/**
* Tuple for sync_up response.
*/
public static class Response {
public String phone_number;
public String cc_id;
public Integer sync_flag;
}
}
|
[
"[email protected]"
] | |
990261ea24baf9ee6116862a3ab95edb407f2508
|
e658becd5542d6a3712779d3246a2c7fdc7e6869
|
/src/com/kdu/gui/Tempo.java
|
c67784c39d1025a4785c096019552cf6f03569bd
|
[] |
no_license
|
lasithaguruge/pitch-perfect
|
8295f5db47a4ebf40840529f22960d77bbc8b0f6
|
476fc6ede472cbe8e1d05d6865de4ef6443f71ea
|
refs/heads/master
| 2021-08-19T09:53:01.097787 | 2017-11-25T18:14:51 | 2017-11-25T18:14:51 | 100,109,261 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 15,742 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.kdu.gui;
import javax.swing.ImageIcon;
import com.kdu.test.AudioDrums;
import com.kdu.test.Beat;
import com.kdu.test.SimpleAnalysis;
import java.awt.FileDialog;
import java.awt.Frame;
import jm.music.data.Score;
import jm.util.Play;
import jm.util.Read;
/**
*
* @author Lasitha
*/
public class Tempo extends javax.swing.JFrame {
SimpleAnalysis ad;
static Score s = new Score();
static int scoreCount = 0;
static FileDialog fd;
static Frame f = new Frame();
public int tempo;
public Beat beat;
/**
* Creates new form MusicGenerate
*/
public Tempo() {
initComponents();
setLocationRelativeTo(null);
// fd = new FileDialog(f, "", FileDialog.LOAD);
// fd.show();
Read.midi(s, "34time8.mid");
//s.setTitle(fd.getFile());
//beat = new Beat(s);
//System.out.println("END "+s.getEndTime());
s = s.copy(20.25, 35.25);
Play.midiCycle(s);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
TempoWindowPanel = new javax.swing.JPanel();
cancelButton = new javax.swing.JLabel();
okButton = new javax.swing.JLabel();
tempoValue = new javax.swing.JLabel();
tempoHighBtn = new javax.swing.JLabel();
tempoLowBtn = new javax.swing.JLabel();
TempoWindowBack = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(467, 290));
TempoWindowPanel.setLayout(null);
cancelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/kdu/gui/images/cancel button.png"))); // NOI18N
cancelButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
cancelButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
cancelButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
cancelButtonMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
cancelButtonMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
cancelButtonMouseReleased(evt);
}
});
TempoWindowPanel.add(cancelButton);
cancelButton.setBounds(230, 200, 100, 40);
okButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/kdu/gui/images/ok button.PNG"))); // NOI18N
okButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
okButtonMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
okButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
okButtonMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
okButtonMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
okButtonMouseReleased(evt);
}
});
TempoWindowPanel.add(okButton);
okButton.setBounds(110, 200, 100, 40);
tempoValue.setFont(new java.awt.Font("Bookman Old Style", 1, 48)); // NOI18N
tempoValue.setForeground(new java.awt.Color(255, 153, 0));
tempoValue.setText("120");
TempoWindowPanel.add(tempoValue);
tempoValue.setBounds(160, 120, 130, 60);
tempoHighBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/kdu/gui/images/up tempo button.PNG"))); // NOI18N
tempoHighBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tempoHighBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
tempoHighBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
tempoHighBtnMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
tempoHighBtnMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
tempoHighBtnMouseReleased(evt);
}
});
TempoWindowPanel.add(tempoHighBtn);
tempoHighBtn.setBounds(310, 120, 60, 60);
tempoLowBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/kdu/gui/images/down tempo button.PNG"))); // NOI18N
tempoLowBtn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tempoLowBtnMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
tempoLowBtnMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
tempoLowBtnMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
tempoLowBtnMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
tempoLowBtnMouseReleased(evt);
}
});
TempoWindowPanel.add(tempoLowBtn);
tempoLowBtn.setBounds(70, 120, 60, 60);
TempoWindowBack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/kdu/gui/images/Tempo window.png"))); // NOI18N
TempoWindowPanel.add(TempoWindowBack);
TempoWindowBack.setBounds(0, 0, 450, 250);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(TempoWindowPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 450, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 38, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(TempoWindowPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 47, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void tempoHighBtnMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoHighBtnMouseEntered
ImageIcon hover = new ImageIcon(getClass().getResource("images/up tempo button hover.png"));
tempoHighBtn.setIcon(hover);
}//GEN-LAST:event_tempoHighBtnMouseEntered
private void tempoHighBtnMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoHighBtnMouseExited
ImageIcon normal = new ImageIcon(getClass().getResource("images/up tempo button.png"));
tempoHighBtn.setIcon(normal);
}//GEN-LAST:event_tempoHighBtnMouseExited
private void tempoHighBtnMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoHighBtnMousePressed
ImageIcon hover = new ImageIcon(getClass().getResource("images/up tempo button pressed.png"));
tempoHighBtn.setIcon(hover);
}//GEN-LAST:event_tempoHighBtnMousePressed
private void tempoHighBtnMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoHighBtnMouseReleased
ImageIcon normal = new ImageIcon(getClass().getResource("images/up tempo button.png"));
tempoHighBtn.setIcon(normal);
}//GEN-LAST:event_tempoHighBtnMouseReleased
private void tempoLowBtnMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoLowBtnMouseEntered
ImageIcon hover = new ImageIcon(getClass().getResource("images/down tempo button hover.png"));
tempoLowBtn.setIcon(hover);
}//GEN-LAST:event_tempoLowBtnMouseEntered
private void tempoLowBtnMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoLowBtnMouseExited
ImageIcon normal = new ImageIcon(getClass().getResource("images/down tempo button.png"));
tempoLowBtn.setIcon(normal);
}//GEN-LAST:event_tempoLowBtnMouseExited
private void tempoLowBtnMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoLowBtnMousePressed
ImageIcon hover = new ImageIcon(getClass().getResource("images/down tempo button pressed.png"));
tempoLowBtn.setIcon(hover);
}//GEN-LAST:event_tempoLowBtnMousePressed
private void tempoLowBtnMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoLowBtnMouseReleased
ImageIcon normal = new ImageIcon(getClass().getResource("images/down tempo button.png"));
tempoLowBtn.setIcon(normal);
}//GEN-LAST:event_tempoLowBtnMouseReleased
private void tempoHighBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoHighBtnMouseClicked
int value = Integer.parseInt(tempoValue.getText());
value = value + 1;
tempoValue.setText(Integer.toString(value));
this.setTempo(value);
s.setTempo(value);
Play.updateScore(s);
}//GEN-LAST:event_tempoHighBtnMouseClicked
private void tempoLowBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tempoLowBtnMouseClicked
int value = Integer.parseInt(tempoValue.getText());
value = value - 1;
tempoValue.setText(Integer.toString(value));
this.setTempo(value);
s.setTempo(value);
Play.updateScore(s);
}//GEN-LAST:event_tempoLowBtnMouseClicked
private void okButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okButtonMouseEntered
ImageIcon hover = new ImageIcon(getClass().getResource("images/ok button hover.png"));
okButton.setIcon(hover);
}//GEN-LAST:event_okButtonMouseEntered
private void okButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okButtonMouseExited
ImageIcon normal = new ImageIcon(getClass().getResource("images/ok button.png"));
okButton.setIcon(normal);
}//GEN-LAST:event_okButtonMouseExited
private void okButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okButtonMousePressed
ImageIcon hover = new ImageIcon(getClass().getResource("images/ok button pressed.png"));
okButton.setIcon(hover);
}//GEN-LAST:event_okButtonMousePressed
private void okButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okButtonMouseReleased
ImageIcon normal = new ImageIcon(getClass().getResource("images/ok button.png"));
okButton.setIcon(normal);
}//GEN-LAST:event_okButtonMouseReleased
private void cancelButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelButtonMouseEntered
ImageIcon hover = new ImageIcon(getClass().getResource("images/cancel button hover.png"));
cancelButton.setIcon(hover);
}//GEN-LAST:event_cancelButtonMouseEntered
private void cancelButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelButtonMouseExited
ImageIcon normal = new ImageIcon(getClass().getResource("images/cancel button.png"));
cancelButton.setIcon(normal);
}//GEN-LAST:event_cancelButtonMouseExited
private void cancelButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelButtonMousePressed
ImageIcon hover = new ImageIcon(getClass().getResource("images/cancel button pressed.png"));
cancelButton.setIcon(hover);
}//GEN-LAST:event_cancelButtonMousePressed
private void cancelButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelButtonMouseReleased
ImageIcon normal = new ImageIcon(getClass().getResource("images/cancel button.png"));
cancelButton.setIcon(normal);
}//GEN-LAST:event_cancelButtonMouseReleased
private void cancelButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelButtonMouseClicked
//dispose();
}//GEN-LAST:event_cancelButtonMouseClicked
private void okButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okButtonMouseClicked
dispose();
new MainWindow(this.getTempo()).setVisible(true);
Play.stopMidi();
}//GEN-LAST:event_okButtonMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Tempo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Tempo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Tempo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Tempo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Tempo().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel TempoWindowBack;
private javax.swing.JPanel TempoWindowPanel;
private javax.swing.JLabel cancelButton;
private javax.swing.JLabel okButton;
private javax.swing.JLabel tempoHighBtn;
private javax.swing.JLabel tempoLowBtn;
private javax.swing.JLabel tempoValue;
// End of variables declaration//GEN-END:variables
public int normalize(int bpm) {
int interval = 44100; // 1 beat per second, by default
return interval = ( bpm / 60 ) * 44100 ;
}
public int getTempo() {
return tempo;
}
public void setTempo(int tempo) {
this.tempo = tempo;
}
}
|
[
"[email protected]"
] | |
d351f5335d278dad0ea302384efb46fdd7dc11f7
|
2fc6dd81d26cbcb5db02e46e395ac89339b963f2
|
/SoftEng/SipCommunicator-Fall05/net/java/sip/communicator/media/AVTransmitter.java
|
848abd6fc48a326ea49f1a7c77079dd48bbe5d9e
|
[
"Apache-1.1"
] |
permissive
|
mrsk7/softeng
|
1fcd34c87b36ecbd2ba89f92414b6adc7d43ab00
|
4b3daf5f7e8369c8722c6e7de1214565bf5a975a
|
refs/heads/master
| 2020-06-04T04:37:46.494991 | 2015-05-29T01:39:41 | 2015-05-29T01:39:41 | 27,718,382 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 28,883 |
java
|
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [email protected].
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
*/
package net.java.sip.communicator.media;
/**
* <p>Title: SIP COMMUNICATOR</p>
* <p>Description:JAIN-SIP Audio/Video phone application</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr) </p>
* <p>Network Research Team (http://www-r2.u-strasbg.fr))</p>
* <p>Louis Pasteur University - Strasbourg - France</p>
* @author Emil Ivov (http://www.emcho.com)
* @author Paulo Pizzarro ( added support for media level connection parameter)
* @version 1.1
*
*/
import java.io.*;
import java.net.*;
import java.util.*;
import javax.media.*;
import javax.media.control.*;
import javax.media.format.*;
import javax.media.protocol.*;
import javax.media.rtp.*;
import javax.media.rtp.rtcp.*;
import java.awt.*;
import net.java.sip.communicator.common.*;
import net.java.sip.communicator.common.Console;
class AVTransmitter
{
protected static Console console = Console.getConsole(AVTransmitter.class);
// Input MediaLocator
// Can be a file or http or capture source
protected MediaLocator locator;
protected ArrayList ipAddresses = null;
protected Processor processor = null;
protected RTPManager rtpMgrs[];
//Used by mobility - keeps rtpMgrs[] corresponding addresses
protected SessionAddress sessionAddresses[] = null;
protected DataSource dataOutput = null;
protected ArrayList ports = null;
protected ArrayList formatSets = null;
protected MediaManager mediaManCallback = null;
public AVTransmitter(Processor processor,
ArrayList ipAddresses,
ArrayList ports,
ArrayList formatSets)
{
try {
console.logEntry();
this.processor = processor;
this.ipAddresses = ipAddresses;
this.ports = ports;
this.formatSets = formatSets;
if (console.isDebugEnabled()) {
console.debug(
"Created transmitter for: "
+ ipAddresses.toString()
+ " at ports: "
+ ports.toString()
+ " encoded as: "
+ formatSets.toString());
}
}
finally {
console.logExit();
}
}
void setMediaManagerCallback(MediaManager mediaManager)
{
this.mediaManCallback = mediaManager;
}
/**
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
*/
synchronized String start() throws MediaException
{
try {
console.logEntry();
String result;
configureProcessor();
// Create an RTP session to transmit the output of the
// processor to the specified IP address and port no.
try {
createTransmitter();
}
catch (MediaException ex) {
console.error("createTransmitter() failed", ex);
processor.close();
processor = null;
throw ex;
}
// Start the transmission
processor.start();
return null;
}
finally {
console.logExit();
}
}
/**
* Stops the transmission if already started
*/
void stop()
{
try {
console.logEntry();
synchronized (this) {
if (processor != null) {
processor.stop();
if (rtpMgrs != null) {
for (int i = 0; i < rtpMgrs.length; i++) {
if (rtpMgrs[i] == null) {
continue;
}
rtpMgrs[i].removeTargets("Session ended.");
rtpMgrs[i].dispose();
}
}
}
}
}
finally {
console.logExit();
}
}
protected void configureProcessor() throws MediaException
{
try {
console.logEntry();
if (processor == null) {
console.error("Processor is null.");
throw new MediaException("Processor is null.");
}
// Wait for the processor to configure
boolean result = true;
if (processor.getState() < Processor.Configured) {
result = waitForState(processor, Processor.Configured);
}
if (result == false) {
console.error("Couldn't configure processor");
throw new MediaException("Couldn't configure processor");
}
// Get the tracks from the processor
TrackControl[] tracks = processor.getTrackControls();
// Do we have atleast one track?
if (tracks == null || tracks.length < 1) {
console.error("Couldn't find tracks in processor");
throw new MediaException("Couldn't find tracks in processor");
}
// Set the output content descriptor to RAW_RTP
// This will limit the supported formats reported from
// Track.getSupportedFormats to only valid RTP formats.
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.
RAW_RTP);
processor.setContentDescriptor(cd);
Format supported[];
Format chosenFormat;
boolean atLeastOneTrack = false;
// Program the tracks.
for (int i = 0; i < tracks.length; i++) {
Format format = tracks[i].getFormat();
if (tracks[i].isEnabled()) {
supported = tracks[i].getSupportedFormats();
if (console.isDebugEnabled()) {
console.debug("Available encodings are:");
for (int j = 0; j < supported.length; j++) {
console.debug("track[" + (i + 1) + "] format[" +
(j + 1) + "]="
+ supported[j].getEncoding());
}
}
// We've set the output content to the RAW_RTP.
// So all the supported formats should work with RTP.
// We'll pick one that matches those specified by the constructor.
if (supported.length > 0) {
if (supported[0] instanceof VideoFormat) {
// For video formats, we should double check the
// sizes since not all formats work in all sizes.
int index = findFirstMatchingFormat(supported,
formatSets);
if (index != -1) {
chosenFormat = checkForVideoSizes(tracks[i].
getFormat(),
supported[index]);
tracks[i].setFormat(chosenFormat);
if (console.isDebugEnabled()) {
console.debug("Track " + i
+ " is set to transmit as: " +
chosenFormat);
}
atLeastOneTrack = true;
}
else {
tracks[i].setEnabled(false);
}
}
else {
int index = findFirstMatchingFormat(supported,
formatSets);
if (index != -1) {
tracks[i].setFormat(supported[index]);
if (console.isDebugEnabled()) {
console.debug("Track " + i +
" is set to transmit as: "
+ supported[index]);
}
atLeastOneTrack = true;
}
else {
tracks[i].setEnabled(false);
}
}
}
else {
tracks[i].setEnabled(false);
}
}
else {
tracks[i].setEnabled(false);
}
}
if (!atLeastOneTrack) {
console.error(
"Couldn't set any of the tracks to a valid RTP format");
throw new MediaException(
"Couldn't set any of the tracks to a valid RTP format");
}
// Realize the processor. This will internally create a flow
// graph and attempt to create an output datasource
result = waitForState(processor, Controller.Realized);
if (result == false) {
console.error("Couldn't realize processor");
throw new MediaException("Couldn't realize processor");
}
// Set the JPEG quality to .5.
//TODO set the jpeg quality through a property
setJPEGQuality(processor, 1f);
// Get the output data source of the processor
dataOutput = processor.getDataOutput();
}
finally {
console.logExit();
}
}
/**
* Use the RTPManager API to create sessions for each media
* track of the processor.
*/
protected void createTransmitter() throws MediaException
{
try {
console.logEntry();
PushBufferDataSource pbds = (PushBufferDataSource) dataOutput;
PushBufferStream pbss[] = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
//used by mobility
sessionAddresses = new SessionAddress[pbss.length];
SessionAddress localAddr, destAddr;
InetAddress remoteAddress;
SendStream sendStream;
SourceDescription srcDesList[];
console.debug("data sources - " + pbss.length);
int port = 0;
String format = null;
String ipAddress = null;
for_loop:
for (int i = 0; i < pbss.length; i++) {
try {
format = pbss[i].getFormat().getEncoding();
ipAddress = findIPAddressForFormat(format);
if(ipAddress == null) {
console.error("failed to find a format's ipAddress");
throw new MediaException(
"Internal error! AVTransmitter failed to find a"
+ " format's corresponding ipAddress");
}
remoteAddress = InetAddress.getByName(ipAddress);
}
catch (UnknownHostException ex) {
console.error("Failed to resolve remote address", ex);
throw new MediaException("Failed to resolve remote address",
ex);
}
port = findPortForFormat(format);
if (port == -1) {
console.error("failed to find a format's port");
throw new MediaException(
"Internal error! AVTransmitter failed to find a"
+ " format's corresponding port");
}
// first try to bind to same port we're talking to for firewall
// support if that fails go for a random one
// which will be randomly changed and retried retryCount times.
// (erroneous comment reported by Joe.Provino at Sun.COM)
boolean success = true;
boolean createdRtpManager = false;
int retries = 4; // 4 retries
do {
success = true;
int localPort = 0;
if(retries ==4)
localPort = port;
else
localPort = (int) (63976 * Math.random()) + 1024;
localAddr = new SessionAddress(mediaManCallback.
getLocalHost(), localPort);
destAddr = new SessionAddress(remoteAddress, port);
rtpMgrs[i] = mediaManCallback.getRtpManager(localAddr);
if(rtpMgrs[i] == null)
{
rtpMgrs[i] = RTPManager.newInstance();
createdRtpManager = true;
}
else
{
success = true;
break;
}
try {
rtpMgrs[i].initialize(localAddr);
console.debug("Just bond to port" + localAddr.getDataPort());
rtpMgrs[i].addTarget(destAddr);
sessionAddresses[i] = destAddr;
}
catch (InvalidSessionAddressException ex) {
//port was occupied
if (console.isDebugEnabled()) {
console.debug("Couldn't bind to local ports "
+ localAddr.getDataPort() + ", " +
localAddr.getControlPort()
+ " @ " +
localAddr.getControlHostAddress()
+ ".\n Exception message was: " +
ex.getMessage()
+ " Will try another pair!");
}
success = false;
}
catch (IOException ex) {
//we should just try to notify user and continue with other tracks
console.error(
"Failed to initialize an RTPManager for address pair:\n"
+ "Local address:" + localAddr.toString()
+ " data port:" + localAddr.getDataPort()
+ " control port:" + localAddr.getControlPort() +
"\n"
+ "Dest address:" + destAddr
+ " data port:" + destAddr.getDataPort()
+ " control port:" + destAddr.getControlPort(),
ex);
mediaManCallback.fireNonFatalMediaError(new
MediaException(
"Failed to initialize an RTPManager for address pair:\n"
+ "Local address:" + localAddr.toString()
+ " data port:" + localAddr.getDataPort()
+ " control port:" + localAddr.getControlPort() +
"\n"
+ "Dest address:" + destAddr
+ " data port:" + destAddr.getDataPort()
+ " control port:" + destAddr.getControlPort(),
ex));
success = false;
retries = 0;
}
}
while (!success && --retries > 0);
//notify user if we could bind at all
if (!success) {
if (console.isDebugEnabled()) {
console.error(
"Failed to initialise rtp manager for track " + i
+ " encoded as " + pbss[i].getFormat().getEncoding()
+ " @ [" + ipAddress + "]:" + port + "!");
}
mediaManCallback.fireNonFatalMediaError(
new MediaException(
"Failed to initialise rtp manager for track " + i
+ " encoded as " + pbss[i].getFormat().getEncoding()
+ " @ [" + ipAddress + "]:" + port + "!"));
continue;
}
if(createdRtpManager)
mediaManCallback.putRtpManager(localAddr, rtpMgrs[i]);
try {
console.debug("FMA\n");
sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
sendStream.start();
if (console.isDebugEnabled()) {
console.debug("Started transmitting track " + i
+ " encoded as " +
pbss[i].getFormat().getEncoding()
+ " @ [" + ipAddress + "]:" + port + "!");
}
}
catch (Exception ex) {
console.error("Session " + i +
" failed to start transmitting.");
throw new MediaException(
"Session " + i + " failed to start transmitting.");
}
}
}
finally {
console.logExit();
}
}
/**
* For JPEG and H263, we know that they only work for particular
* sizes. So we'll perform extra checking here to make sure they
* are of the right sizes.
*/
Format checkForVideoSizes(Format original, Format supported)
{
try {
console.logEntry();
int width, height;
Dimension size = ( (VideoFormat) original).getSize();
Format jpegFmt = new Format(VideoFormat.JPEG_RTP);
Format h263Fmt = new Format(VideoFormat.H263_RTP);
if (supported.matches(jpegFmt)) {
// For JPEG, make sure width and height are divisible by 8.
width = (size.width % 8 == 0 ? size.width :
(int) (size.width / 8) * 8);
height = (size.height % 8 == 0 ? size.height :
(int) (size.height / 8) * 8);
}
else if (supported.matches(h263Fmt)) {
// For H.263, we only support some specific sizes.
if (size.width < 128) {
width = 128;
height = 96;
}
else if (size.width < 176) {
width = 176;
height = 144;
}
else {
width = 352;
height = 288;
}
}
else {
// We don't know this particular format. We'll just
// leave it alone then.
return supported;
}
return (new VideoFormat(null,
new Dimension(width, height),
Format.NOT_SPECIFIED,
null,
Format.NOT_SPECIFIED)).intersects(supported);
}
finally {
console.logExit();
}
}
protected String findIPAddressForFormat(String format)
{
try {
console.logEntry();
for (int i = 0; i < formatSets.size(); i++) {
ArrayList currentSet = (ArrayList) formatSets.get(i);
for (int j = 0; j < currentSet.size(); j++) {
if ( ( (String) currentSet.get(j)).equals(format)) {
return (String) ipAddresses.get(i);
}
}
}
return null;
}
finally {
console.logExit();
}
}
protected int findPortForFormat(String format)
{
try {
console.logEntry();
for (int i = 0; i < formatSets.size(); i++) {
ArrayList currentSet = (ArrayList) formatSets.get(i);
for (int j = 0; j < currentSet.size(); j++) {
if ( ( (String) currentSet.get(j)).equals(format)) {
return ( (Integer) ports.get(i)).intValue();
}
}
}
return -1;
}
finally {
console.logExit();
}
}
/**
* Setting the encoding quality to the specified value on the JPEG encoder.
* 0.5 is a good default.
*/
void setJPEGQuality(Player p, float val)
{
try {
console.logEntry();
Control cs[] = p.getControls();
QualityControl qc = null;
VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
// Loop through the controls to find the Quality control for
// the JPEG encoder.
for (int i = 0; i < cs.length; i++) {
if (cs[i] instanceof QualityControl &&
cs[i] instanceof Owned) {
Object owner = ( (Owned) cs[i]).getOwner();
// Check to see if the owner is a Codec.
// Then check for the output format.
if (owner instanceof Codec) {
Format fmts[] = ( (Codec) owner).
getSupportedOutputFormats(null);
for (int j = 0; j < fmts.length; j++) {
if (fmts[j].matches(jpegFmt)) {
qc = (QualityControl) cs[i];
qc.setQuality(val);
if(console.isDebugEnabled())
console.debug("Setting quality to "
+ val + " on " + qc);
break;
}
}
}
if (qc != null) {
break;
}
}
}
}
finally {
console.logExit();
}
}
protected int findFirstMatchingFormat(Format[] hayStack, ArrayList needles)
{
try {
console.logEntry();
if (hayStack == null || needles == null) {
return -1;
}
for (int j = 0; j < needles.size(); j++) {
ArrayList currentSet = (ArrayList) needles.get(j);
for (int k = 0; k < currentSet.size(); k++) {
for (int i = 0; i < hayStack.length; i++) {
if (hayStack[i].getEncoding().equals( (String)
currentSet.get(k))) {
return i;
}
}
}
}
return -1;
}
finally {
console.logExit();
}
}
/****************************************************************
* Convenience methods to handle processor's state changes.
****************************************************************/
protected Integer stateLock = new Integer(0);
protected boolean failed = false;
Integer getStateLock()
{
return stateLock;
}
void setFailed()
{
failed = true;
}
protected synchronized boolean waitForState(Processor p, int state)
{
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
}
else if (state == Processor.Realized) {
p.realize();
}
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
}
catch (InterruptedException ie) {
return false;
}
}
}
if (failed) {
return false;
}
else {
return true;
}
}
/****************************************************************
* Inner Classes
****************************************************************/
class StateListener
implements ControllerListener
{
public void controllerUpdate(ControllerEvent ce)
{
try {
console.logEntry();
// If there was an error during configure or
// realize, the processor will be closed
if (ce instanceof ControllerClosedEvent) {
setFailed();
// All controller events, send a notification
// to the waiting thread in waitForState method.
}
if (ce instanceof ControllerEvent) {
synchronized (getStateLock()) {
getStateLock().notifyAll();
}
}
//Loop media files
if (ce instanceof EndOfMediaEvent) {
processor.setMediaTime(new Time(0));
processor.start();
}
}
finally {
console.logExit();
}
}
}
}
|
[
"[email protected]"
] | |
bf3c3b9553b6bb063c18367840a96497d1c935eb
|
d97fddf6fb6d3ac3cffe3afe1a650af4f6febaff
|
/app/src/main/java/com/example/pm01ejercicio1_3/List_Activity.java
|
20d27ef45a53f82f834f2d59ad8fc1a85bbda3b5
|
[] |
no_license
|
andyc98/PM01Ejercicio1.3
|
292e04e796e0bba55b7f21d8645fe3038119be73
|
c4440457b098a0d7907d96d83d6cdab2bc2f08cd
|
refs/heads/master
| 2023-08-27T23:33:47.148808 | 2021-10-28T15:56:03 | 2021-10-28T15:56:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,487 |
java
|
package com.example.pm01ejercicio1_3;
import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.example.pm01ejercicio1_3.Config.SQLiteConnection;
import com.example.pm01ejercicio1_3.Config.SQLiteConsult;
import com.example.pm01ejercicio1_3.Tables.Persons;
import java.util.ArrayList;
public class List_Activity extends AppCompatActivity {
SQLiteConnection conexion;
ListView listapersonas;
ArrayList<Persons> lista;
ArrayList<String> ArregloPersonas;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
conexion = new SQLiteConnection(this, SQLiteConsult.NameDatabase, null,1);
listapersonas = (ListView) findViewById(R.id.listado);
ObtenerListaPersonas();
ArrayAdapter adp = new ArrayAdapter(this , android.R.layout.simple_list_item_1, ArregloPersonas);
listapersonas.setAdapter(adp);
}
private void ObtenerListaPersonas()
{
SQLiteDatabase db = conexion.getReadableDatabase();
Persons list_personas = null;
lista = new ArrayList<Persons>();
//cursor de base de datos: nos apoya a recorrer la informacion de la tabla a la cual consultamos
Cursor cursor = db.rawQuery("SELECT * FROM " + SQLiteConsult.tablaPersonas, null);
// recorremos la informacion del cursor
while(cursor.moveToNext())
{
list_personas = new Persons();
list_personas.setId(cursor.getInt(0));
list_personas.setNombres(cursor.getString(1));
list_personas.setApellidos(cursor.getString(2));
list_personas.setEdad(cursor.getInt(3));
list_personas.setCorreo(cursor.getString(4));
list_personas.setDireccion(cursor.getString(5));
lista.add(list_personas);
}
cursor.close();
filllist();
}
private void filllist()
{
ArregloPersonas = new ArrayList<String>();
for(int i = 0; i < lista.size();i++) {
ArregloPersonas.add(lista.get(i).getId() + " | "
+lista.get(i).getNombres()+ " | "
+lista.get(i).getApellidos()+ " | "
+lista.get(i).getDireccion());
}
}
}
|
[
"[email protected]"
] | |
5b7fcb39af56fd65c9adf5262c350c5a5fcde6a1
|
c6e283e367fdd90400462762b5411e0fe639a2ec
|
/src/main/java/com/atos/library/service/BookServiceImpl.java
|
55b68427fef9a1bd4e6704aa0d86cadb94d10243
|
[] |
no_license
|
Exoo81/ATOSLibrary
|
8d423e5da85b1a2790dfe68dafb730a02502a35b
|
6a308009225d63da9580b9f1fbff204a38a5b704
|
refs/heads/master
| 2021-01-23T05:04:57.119053 | 2017-03-27T09:15:15 | 2017-03-27T09:15:15 | 86,276,570 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,686 |
java
|
package com.atos.library.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.atos.library.entity.Book;
import com.atos.library.entity.User;
import com.atos.library.repository.BookRepository;
import com.atos.library.repository.UserRepository;
@Service
public class BookServiceImpl implements BookService {
@Autowired
private BookRepository bookRepository;
@Autowired
private UserRepository userRepository;
public void addNewBookToLibrary(Book book) {
System.out.println("***************************");
System.out.println("Add new book to library");
bookRepository.save(book);
System.out.println("--> Book: " + book.toString() + " has been added to library.");
}
@Transactional
public void removeBookFromLibrary(Integer id) {
System.out.println("***************************");
System.out.println("Remove book from library");
if(bookRepository.exists(id)){
Book book = bookRepository.findOne(id);
if(!book.isLent()){
bookRepository.delete(book);
System.out.println("--> Book with id " + book.getId() + " has been removed.");
}else{
System.out.println("--> You can't remove this book because is currently lent by " + book.getLentByUser().getName());
}
}else{
System.out.println("--> The book with id: "+ id + " doesn't exist in library data base.");
}
}
public List<Book> findBookBy(String searchBy, String searchWord) {
List<Book> bookList = new ArrayList<Book>();
if(searchBy.equals("title")){
System.out.println("***************************");
System.out.println("Find by title");
bookList = bookRepository.findByTitle(searchWord);
}
if(searchBy == "author"){
System.out.println("***************************");
System.out.println("Find by author");
bookList = bookRepository.findByAuthor(searchWord);
}
if(searchBy == "year"){
System.out.println("***************************");
System.out.println("Find by year");
bookList = bookRepository.findByYear(searchWord);
}
if(!bookList.isEmpty()){
System.out.println("Search result: ");
for(Book book : bookList){
System.out.println("--> Book: " + book.getId() + " " + book.toString());
}
}else{
System.out.println("--> NO match - 0 results.");
}
return bookList;
}
public List<Book> findBookByTitleAndAuthor(String title, String author) {
List<Book> bookList = bookRepository.findByTitleAndAuthor(title, author);
System.out.println("***************************");
System.out.println("Find by title and author");
if(!bookList.isEmpty()){
System.out.println("Search result: ");
for(Book book : bookList){
System.out.println("--> Book: " + book.getId() + " " + book.toString());
}
}else{
System.out.println("--> NO match - 0 results.");
}
return bookList;
}
public List<Book> findBookByTitleAndYear(String title, String year) {
List<Book> bookList = bookRepository.findByTitleAndYear(title, year);
System.out.println("***************************");
System.out.println("Find by title and year");
if(!bookList.isEmpty()){
System.out.println("Search result: ");
for(Book book : bookList){
System.out.println("--> Book: " + book.getId() + " " + book.toString());
}
}else{
System.out.println("--> NO match - 0 results.");
}
return bookList;
}
public List<Book> findBookByAuthorAndYear(String author, String year) {
List<Book> bookList = bookRepository.findByAuthorAndYear(author, year);
System.out.println("***************************");
System.out.println("Find by author and year");
if(!bookList.isEmpty()){
System.out.println("Search result: ");
for(Book book : bookList){
System.out.println("--> Book: " + book.getId() + " " + book.toString());
}
}else{
System.out.println("--> NO match - 0 results.");
}
return bookList;
}
public List<String> findDistinctTitles() {
List<String> distTitlesList = bookRepository.findDistinctByTitle();
System.out.println("***************************");
System.out.println("Find Distinct Book");
if(!distTitlesList.isEmpty()){
for(String title : distTitlesList){
int countAll = bookRepository.countAllTitles(title);
int availableCount = bookRepository.countAvailableTitles(title);
System.out.println("--> Book: " + title + " || All titles in library: " +countAll + " || Available: " + availableCount);
}
}else{
System.out.println("--> NO match - 0 results.");
}
return distTitlesList;
}
@Transactional
public void lentBook(Integer id, User user) {
System.out.println("***************************");
System.out.println("Lent a book");
if(bookRepository.exists(id)){
Book book = bookRepository.findOne(id);
if(!book.isLent()){
book.setLent(true);
book.setLentByUser(user);
User userDB = userRepository.findOne(user.getId());
List<Book> newListOfBook = new ArrayList<Book>();
for(Book bookFromList : userDB.getBooks()){
newListOfBook.add(bookFromList);
}
newListOfBook.add(book);
userDB.setBooks(newListOfBook);
userRepository.save(userDB);
bookRepository.save(book);
System.out.println("--> Book " + book.getTitle() + " with ID: " + book.getId() + " has been lent by " + user.getName() +".");
}else{
System.out.println("--> The book with id: "+ id + " is already lent by " + book.getLentByUser().getName());
}
}else{
System.out.println("--> The book with id: "+ id + " doesn't exist in library data base.");
}
}
@Transactional
public Book showBookDetails(Integer id) {
System.out.println("***************************");
System.out.println("Book deatails");
if(bookRepository.exists(id)){
Book book = bookRepository.findOne(id);
if(book.isLent()){
System.out.println("--> Book: " + book.toString() + " Lent by: " + book.getLentByUser().getName() );
}else{
System.out.println("--> Book: " + book.toString() );
}
return book;
}else{
System.out.println("--> The book with id: "+ id + " doesn't exist in library data base.");
}
return null;
}
public List<Book> showAllListOfBook() {
List<Book> bookList = bookRepository.findAll();
return bookList;
}
}
|
[
"[email protected]"
] | |
76d9f21fa4d442392684ff9dc8b13737d911c2e0
|
8410aff8db0187586a3a064c976f0e0ce2ef1a6d
|
/Clecs/src/com/clecs/fragments/FragmentPostsMain.java
|
5435c9dbbbc280eeadb75b8b845cb8a4b9cb8f27
|
[] |
no_license
|
tmtariq/AndroidSample
|
1fbf3c45800c382107d053dd77d74125e8eb448d
|
d1ea26da5a51cd7d3dccf3f0864eb14a4ae6ef48
|
refs/heads/master
| 2021-01-10T02:40:18.121024 | 2015-10-15T11:24:42 | 2015-10-15T11:24:42 | 44,239,991 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,173 |
java
|
package com.clecs.fragments;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import com.clecs.MainActivity;
import com.clecs.R;
import com.clecs.adapters.AdapterPost;
import com.clecs.network.RequestHandler;
import com.clecs.network.RequestHandler.ServerResponseListner;
import com.clecs.objects.AppNotification;
import com.clecs.objects.Post;
import com.clecs.utils.AppStatics;
import com.clecs.utils.AppUtils;
import com.clecs.utils.Session;
import com.clecs.widget.PullAndLoadListView;
import com.clecs.widget.PullAndLoadListView.OnLoadMoreListener;
import com.clecs.widget.PullToRefreshListView.OnRefreshListener;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.PauseOnScrollListener;
public class FragmentPostsMain extends Fragment implements
ServerResponseListner {
final int REQ_ALL_POST = 100;
final int REQ_NOTIFICATION = 200;
final int REQ_LATEST_POSTS = 300;
final int REQ_LOAD_MORE = 400;
RequestHandler requestHandler;
AdapterPost adapter;
// int lastId = 0;
View root;
PullAndLoadListView lv;
ProgressDialog pd;
boolean isReloading;
public static FragmentPostsMain instance;
protected boolean pauseOnScroll = true;
protected boolean pauseOnFling = true;
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (root == null) {
root = inflater.inflate(R.layout.fragment_posts_main, container,
false);
instance = this;
initView();
AppUtils.setFont(getActivity(), (ViewGroup) root);
}
return root;
}
void initView() {
pd = new ProgressDialog(getActivity());
pd.setCancelable(false);
lv = (PullAndLoadListView) root.findViewById(R.id.fpmLv);
//pd.setMessage("Getting Posts...");
/// we are saying loading...
pd.setMessage("Llwytho...");
requestHandler = new RequestHandler(this, true);
//requestHandler.makeGetRequest(AppStatics.getAllNotificationsUrl(null), REQ_NOTIFICATION);
if (Session.listAllPost == null) {
pd.show();
requestHandler.makeGetRequest(
AppStatics.getAllPostsWithLinksUrl(getLastId()),
REQ_ALL_POST);
} else {
// if (adapter == null) {
adapter = new AdapterPost(getActivity(), Session.listAllPost);
// }
changeListViewVisibility();
lv.setAdapter(adapter);
notifyAdapter();
// adapter = new AdapterPost(getActivity(), Session.listAllPost);
// adapter.notifyDataSetChanged();
}
lv.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
refreshPosts();
}
});
lv.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore() {
requestHandler.makeGetRequest(
AppStatics.getAllPostsWithLinksUrl(getLastId()),
REQ_LOAD_MORE);
}
});
//lv.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll, pauseOnFling));
}
/*@Override
public void onAttach(Activity activity) {
MainActivity.mActivity.updateNotification();
requestHandler = new RequestHandler(this, true);
requestHandler.makeGetRequest(AppStatics.getAllNotificationsUrl(null), REQ_NOTIFICATION);
super.onAttach(activity);
}*/
@SuppressWarnings("unchecked")
@Override
public void onResponse(String response, long requestCode) {
if (requestCode == REQ_ALL_POST) {
ArrayList<Post> postList = new Gson().fromJson(response,
new TypeToken<List<Post>>() {
}.getType());
System.out.println(response);
if (postList != null)
Session.listAllPost = (ArrayList<Post>) postList.clone();
loadCashedList();
adapter = new AdapterPost(getActivity(), Session.listAllPost);
lv.setAdapter(adapter);
pd.dismiss();
changeListViewVisibility();
} else if (requestCode == REQ_NOTIFICATION) {
// "id":30176,"read":true,"notRead":false,"text":"New Smiley from TheGirl","date":"22 Jan","type":"Smiley"
ArrayList<AppNotification> list = new Gson().fromJson(response,
new TypeToken<List<AppNotification>>() {
}.getType());
//Session.listNotififs = (ArrayList<AppNotification>) list.clone();
Session.listNotififs = list;
//MainActivity.mActivity.updateNotification();
} else if (requestCode == REQ_LATEST_POSTS) {
// lastId += 1;
ArrayList<Post> postList = new Gson().fromJson(response,
new TypeToken<List<Post>>() {
}.getType());
if (postList.size() > 0) {
Session.listAllPost.addAll(0, postList);
notifyAdapter();
changeListViewVisibility();
}
lv.onRefreshComplete();
} else if (requestCode == REQ_LOAD_MORE) {
ArrayList<Post> postList = new Gson().fromJson(response,
new TypeToken<List<Post>>() {
}.getType());
Session.listAllPost.addAll(postList);
// adapter = new AdapterPost(getActivity(), Session.listAllPost);
// lv.setAdapter(adapter);
notifyAdapter();
lv.onLoadMoreComplete();
changeListViewVisibility();
}
}
private void loadCashedList() {
if (Session.listAllPost != null)
if (Session.listAllPost.size() == 0
&& Session.listAllPostsLocal != null)
Session.listAllPost = (ArrayList<Post>) Session.listAllPostsLocal
.clone();
notifyAdapter();
}
void notifyAdapter() {
if (adapter != null)
synchronized (adapter) {
changeListViewVisibility();
adapter.notifyDataSetChanged();
}
}
private void changeListViewVisibility() {
if (Session.listAllPost.size() == 0)
lv.setVisibility(View.INVISIBLE);
else
lv.setVisibility(View.VISIBLE);
}
@Override
public void onError(String error, String reason, long requestCode) {
if (pd != null)
pd.dismiss();
if (requestCode == REQ_LOAD_MORE)
lv.onLoadMoreComplete();
else if (requestCode == REQ_LATEST_POSTS)
lv.onRefreshComplete();
else if (requestCode == REQ_ALL_POST)
loadCashedList();
}
@Override
public void onNoInternet() {
if (pd != null)
pd.dismiss();
if (lv != null) {
lv.onLoadMoreComplete();
lv.onRefreshComplete();
}
loadCashedList();
}
long getLastId() {
if (Session.listAllPost != null) {
int size = Session.listAllPost.size();
if (size > 0)
return Session.listAllPost.get(size - 1).getPostId();
}
return 0;
}
long getLatestId() {
if (Session.listAllPost != null) {
int size = Session.listAllPost.size();
if (size > 0)
return Session.listAllPost.get(0).getPostId();
}
return 0;
}
public void refreshPosts() {
if (getLastId() > 0)
requestHandler.makeGetRequest(
AppStatics.getLatestPostWithLinksUrl(getLatestId()),
REQ_LATEST_POSTS);
else {
pd.show();
requestHandler.makeGetRequest(
AppStatics.getAllPostsWithLinksUrl(getLastId()),
REQ_ALL_POST);
}
}
/*@Override
public void onResume() {
updateList();
super.onResume();
}*/
public void updateList() {
notifyAdapter();
if (Session.listAllPost == null)
Session.listAllPost = new ArrayList<Post>();
if (adapter == null)
adapter = new AdapterPost(getActivity(), Session.listAllPost);
refreshPosts();
if (Session.listAllPost != null)
if (Session.listAllPost.size() == 0)
lv.setVisibility(View.INVISIBLE);
}
public void reloadList() {
if (AppUtils.isInternetConeected(getActivity())) {
isReloading = true;
if (Session.listAllPost != null && Session.listAllPost.size() > 0) {
Session.listAllPostsLocal = (ArrayList<Post>) Session.listAllPost
.clone();
Session.listAllPost.clear();
}
updateList();
} else
{
//AppUtils.showToast("No internet");
AppUtils.showToast("Credwch eich bod yn all-lein");
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (root != null) {
ViewGroup parentViewGroup = (ViewGroup) root.getParent();
if (parentViewGroup != null) {
parentViewGroup.removeAllViews();
}
}
}
}
|
[
"[email protected]"
] | |
cc10b448c9f3398cb3cdea3a07013586ddd185a0
|
52b5ce7881aed7de127a95dbf136d080d3b2a215
|
/src/main/java/com/edgequery/core/utils/AssertEx.java
|
633193af746773e4f113aa1192a35ae657b5e503
|
[] |
no_license
|
caoym/edge-query-core
|
a6984a3b1a8418cb7ef811f3abb727f3986d37d6
|
0115b99b5f629f31944b608f1b552366785a543b
|
refs/heads/master
| 2020-03-06T22:34:43.751939 | 2018-04-03T13:41:09 | 2018-04-03T13:41:09 | 127,106,692 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 785 |
java
|
package com.edgequery.core.utils;
import java.lang.reflect.InvocationTargetException;
public class AssertEx {
public static<T extends Exception> void isTrue(boolean expression, String message, Class<T> exception) throws T {
if (!expression) {
try {
throw exception.getDeclaredConstructor(String.class).newInstance(message);
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}
}
|
[
"[email protected]"
] | |
a2135582bac7ce33e835c440b4821f11addd73cd
|
77832ce0e78450c4023efc220ed5efefcf7421b9
|
/app/src/main/java/com/inoueken/handspinner/models/MainActivityModel.java
|
cfcc656df3f1a01fcbd6a5e02b9925c5e5543e64
|
[] |
no_license
|
maxfie1d/SpinnerMeijin
|
f8a1fa669fac6cebe8badd63d18138c3ecca2bca
|
c436b7ae19f3ab490d99c6fefe357c14cb89dea6
|
refs/heads/master
| 2021-03-16T08:45:29.359417 | 2017-09-13T06:05:41 | 2017-09-13T06:05:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,334 |
java
|
package com.inoueken.handspinner.models;
import com.inoueken.handspinner.CountChangedEventArgs;
import com.inoueken.handspinner.Handspinner;
import rx.Subscription;
import rx.functions.Action1;
public class MainActivityModel {
private GameManager _gameManager;
public MainActivityModel() {
this._gameManager = new GameManager();
}
public Subscription subscribeHandspinnerChanged(Action1<Handspinner> action) {
return this._gameManager.getPlayer().subscribeHandspinnerChanged(action);
}
public Subscription subscribeCoinCountChanged(Action1<CountChangedEventArgs> action) {
return this._gameManager.getPlayer().subscribeCoinCountChanged(action);
}
public Subscription subscribeRotationAngleChanged(Action1<Float> action) {
return this._gameManager.subscribeHandspinnerRotationAngleChanged(action);
}
public void stopSimulation() {
this._gameManager.getPlayer().getCurrentHandspinner().finishRotationTask();
}
public Handspinner getCurrentHandspinner() {
return this._gameManager.getPlayer().getCurrentHandspinner();
}
/**
* View側の準備ができたら呼び出す
*/
public void getReady() {
this._gameManager.start();
}
public void onStop() {
this._gameManager.save();
}
}
|
[
"[email protected]"
] | |
a1cca1564bf7e358177f779603ea120f0f841f82
|
2e7782eb12c486380b6bbbcad4b319485ac37dde
|
/Recycler/app/src/main/java/practices/com/recycler/data/JeansRepository.java
|
7bb07f0ea811f992c36c3aaa9816a77005cb6432
|
[] |
no_license
|
NoeCutz/android_guides
|
9d8bede3708ddbc05898b1bdfd2bb1d8d96b3a64
|
4b508a75fd16c4c3005e9ef468a1a2a5e713a998
|
refs/heads/master
| 2020-04-15T03:53:07.725150 | 2019-01-08T22:09:47 | 2019-01-08T22:09:47 | 164,363,991 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,020 |
java
|
package practices.com.recycler.data;
import java.util.ArrayList;
import java.util.List;
import practices.com.recycler.domain.model.Jean;
public class JeansRepository {
//region Member variables
private List<Jean> jeans;
//endregion
//region Constructors
public JeansRepository() {
jeans = new ArrayList<>();
}
//endregion
//region Helper methods
private void initializeJeans(){
jeans = new ArrayList<>();
Jean jean1 = new Jean("Pantalon Verde", "XS", 203.99);
Jean jean2 = new Jean("Pantalon Azul", "S", 199.99);
Jean jean3 = new Jean("Pantalon Rojo", "XS", 159.99);
Jean jean4 = new Jean("Pantalon Verde", "M", 149.99);
Jean jean5 = new Jean("Pantalon AzuL", "L", 99.99);
jeans.add(jean1);
jeans.add(jean2);
jeans.add(jean3);
jeans.add(jean4);
jeans.add(jean5);
}
public List<Jean> getJeans(){
initializeJeans();
return jeans;
}
//endregion
}
|
[
"[email protected]"
] | |
c7eddd46846ffbabadb2ec4539316a208452a84d
|
f59d76f53b0288be95198c4c62f889acb150a143
|
/app/src/main/java/com/example/adesina/checkgithub/DevelopersAdapter.java
|
a5415b9fc918688031f159035c6e6573b1199e23
|
[] |
no_license
|
adesinamukaila2017/checkgithub_master
|
1a476c7ccc36c06d17185c1bd2fcaa13b084e70d
|
8f95aec479a39a526ed859df0cff2f7475b3fd54
|
refs/heads/master
| 2021-07-06T10:40:17.516195 | 2017-09-30T21:07:57 | 2017-09-30T21:07:57 | 105,400,969 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,916 |
java
|
package com.example.adesina.checkgithub;
/**
* Created by adesina on 9/16/2017.
*/
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import java.util.List;
public class DevelopersAdapter extends RecyclerView.Adapter<DevelopersAdapter.ViewHolder> {
public static final String KEY_NAME = "name";
public static final String KEY_IMAGE = "image";
public static final String KEY_URL = "url";
private List<DevelopersList> developersLists;
private Context context;
public DevelopersAdapter(List<DevelopersList> developersLists, Context context) {
this.developersLists = developersLists;
this.context = context;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.developers_list, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final DevelopersList developersList = developersLists.get(position);
holder.login.setText(developersList.getLogin());
Picasso.with(context)
.load(developersList.getAvatar_url())
.into(holder.avatar_url);
holder.linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DevelopersList developersList1 = developersLists.get(position);
Intent skipIntent = new Intent(v.getContext(), ProfileActivity.class);
skipIntent.putExtra(KEY_NAME, developersList1.getLogin());
skipIntent.putExtra(KEY_URL, developersList1.getHtml_url());
skipIntent.putExtra(KEY_IMAGE, developersList1.getAvatar_url());
v.getContext().startActivity(skipIntent);
}
});
}
@Override
public int getItemCount() {
return developersLists.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView login;
public ImageView avatar_url;
public TextView html_url;
public LinearLayout linearLayout;
public ViewHolder(View itemView) {
super(itemView);
login = (TextView) itemView.findViewById(R.id.username);
avatar_url = (ImageView) itemView.findViewById(R.id.imageView);
html_url = (TextView) itemView.findViewById(R.id.htmUrl);
linearLayout = (LinearLayout) itemView.findViewById(R.id.linearLayout);
}
}
}
|
[
"[email protected]"
] | |
26851b19b19b44763c87bad41770fa622b395cf9
|
7577eb6504b5c9541ac1407ad222269b6494aa0e
|
/Test2.java
|
97c3a1c58afe309e3fc01268995c364a93ef382f
|
[] |
no_license
|
Cindy-Cheng/LX1
|
849bd9af962061758533262d9b13ca78ff2f73f4
|
14600b14b5b426b4b758c9e12b9aaa7362df4b51
|
refs/heads/master
| 2021-01-19T05:25:29.091963 | 2016-07-01T14:28:48 | 2016-07-01T14:28:48 | 62,395,675 | 0 | 0 | null | null | null | null |
WINDOWS-1252
|
Java
| false | false | 670 |
java
|
package com.dy.cy.main;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class Test2 {
public static void main(String[] args){
try {
FileInputStream input = new FileInputStream("/D:/À¶Å¸ÊµÑµ/a.txt");
String hello = "ÄãºÃ";
byte[] bs = hello.getBytes();
byte[] newbs = new byte[bs.length];
input.read(newbs);
String str = new String(newbs);
System.out.println(str);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.