blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cda036b3cbc8fa72825e349f09b151e925ef5315 | 953269c1eb31a37563c8859b8585e539dd5f7180 | /spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.javajava | e98b94e4bff890ea6b667c27b8a6442c252414dd | [
"Apache-2.0"
] | permissive | rvaldron/spring-social-facebook | a2545007fdbc26062ee5d40e7a606c52f91ab2d5 | 134997272bafbdcaac260ae909376c226d7be1c6 | refs/heads/master | 2020-12-11T07:25:55.184408 | 2014-04-26T02:07:36 | 2014-04-26T02:07:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,895 | javajava | /*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.social.facebook.api;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Represents a single result item from an FQL query.
* Given to an {@link FqlResultMapper}, in a way that is analogous to how a ResultSet is given to a RowMapper in Spring's JdbcTemplate.
* @author habuma
*/
public class FqlResult {
private final Map<String, Object> resultMap;
/**
* Constructs an FqlResult instance from a map.
*/
public FqlResult(Map<String, Object> resultMap) {
this.resultMap = resultMap;
}
/**
* Returns the value of the identified field as a String.
* @param fieldName the name of the field
* @return the value of the field as a String
*/
public String getString(String fieldName) {
return hasValue(fieldName) ? String.valueOf(resultMap.get(fieldName)) : null;
}
/**
* Returns the value of the identified field as an Integer.
* @param fieldName the name of the field
* @return the value of the field as an Integer
* @throws FqlException if the field cannot be expressed as an Integer
*/
public Integer getInteger(String fieldName) {
try {
return hasValue(fieldName) ? Integer.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
}
/**
* Returns the value of the identified field as a Long.
* @param fieldName the name of the field
* @return the value of the field as a Long
* @throws FqlException if the field cannot be expressed as an Long
*/
public Long getLong(String fieldName) {
try {
return hasValue(fieldName) ? Long.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
}
/**
* Returns the value of the identified field as a Float.
* @param fieldName the name of the field
* @return the value of the field as a Float
* @throws FqlException if the field cannot be expressed as an Float
*/
public Float getFloat(String fieldName) {
try {
return hasValue(fieldName) ? Float.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
}
/**
* Returns the value of the identified field as a Boolean.
* @param fieldName the name of the field
* @return the value of the field as a Boolean
*/
public Boolean getBoolean(String fieldName) {
return hasValue(fieldName) ? Boolean.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
}
/**
* Returns the value of the identified field as a Date.
* Time fields returned from an FQL query are expressed in terms of seconds since midnight, January 1, 1970 UTC.
* @param fieldName the name of the field
* @return the value of the field as a Date
* @throws FqlException if the field's value cannot be expressed as a long value from which a Date object can be constructed.
*/
public Date getTime(String fieldName) {
try {
if (hasValue(fieldName)) {
return new Date(Long.valueOf(String.valueOf(resultMap.get(fieldName))) * 1000);
} else {
return null;
}
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a time.", e);
}
}
/**
* Returns the value of the identified field as a simple Object.
* @param fieldName the name of the field
* @return the value of the field as an Object
*/
public Object getObject(String fieldName) {
return resultMap.get(fieldName);
}
/**
* Returns the value of the identified field as an object mapped by a given {@link FqlResultMapper}.
* @param fieldName the name of the field
* @param mapper an {@link FqlResultMapper} used to map the object date into a specific type.
* @return the value of the field as an object of a type the same as the parameterized type of the given {@link FqlResultMapper}.
* @throws FqlException if the value of the field is not a nested object.
*/
public <T> T getObject(String fieldName, FqlResultMapper<T> mapper) {
if (!hasValue(fieldName)) {
return null;
}
try {
@SuppressWarnings("unchecked")
Map<String, Object> value = (Map<String, Object>) resultMap.get(fieldName);
return mapper.mapObject(new FqlResult(value));
} catch (ClassCastException e) {
throw new FqlException("Field '" + fieldName +"' is not an object.", e);
}
}
/**
* Returns the value of the identified field as an object mapped by a given {@link FqlResultMapper}.
* @param fieldName the name of the field
* @param mapper an {@link FqlResultMapper} used to map the object date into a specific type.
* @return the value of the field as list of objects whose type is the same as the parameterized type of the given {@link FqlResultMapper}.
* @throws FqlException if the value of the field is not a list.
*/
public <T> List<T> getList(String fieldName, FqlResultMapper<T> mapper) {
if (!hasValue(fieldName)) {
return null;
}
try {
List<T> response = new ArrayList<T>();
@SuppressWarnings("unchecked")
List<Map<String, Object>> arrayItems = (List<Map<String, Object>>) resultMap.get(fieldName);
for (Map<String, Object> arrayItem : arrayItems) {
response.add(mapper.mapObject(new FqlResult(arrayItem)));
}
return response;
} catch (ClassCastException e) {
throw new FqlException("Field '" + fieldName +"' is not a list.", e);
}
}
/**
* Checks for the existence of a field in the result set, whether null or non-null.
* @param fieldName the name of the field to check existence of.
* @return true if the field exists in the result set, even if the value is null; false if the field is not in the result set.
*/
public boolean hasField(String fieldName) {
return resultMap.containsKey(fieldName);
}
/**
* Checks that a field exists and contains a non-null value.
* @param fieldName the name of the field to check existence/value of.
* @return true if the field exists in the result set and has a non-null value; false otherwise.
*/
public boolean hasValue(String fieldName) {
return resultMap.containsKey(fieldName) && resultMap.get(fieldName) != null;
}
}
| [
"[email protected]"
] | |
6c3ea026676efc0169fea3849eb94fe5c3375ed2 | 90102877125d3a00a7f3b03add566bf31b18300a | /src/renderer/Vector3D.java | 42194d26a7cc2a7b5d264a897bddfed7e5f22455 | [] | no_license | HarrisonBacordo/3DRenderer | 46282e73436848e3c56da7a8dfd64ceb6a31ae66 | a76b6be21a8a667e48f15378ec7e03609b2360f1 | refs/heads/master | 2020-03-27T08:09:44.062900 | 2018-09-11T07:55:28 | 2018-09-11T07:55:28 | 146,225,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,164 | java | package renderer;
/**
* An immutable 3D vector or position. Note that it is safe to make the fields
* public because they are final and cannot be modified.
*
* @author Pondy
*/
public class Vector3D {
public final float x;
public final float y;
public final float z;
public final float mag;
/**
* Construct a new vector, with the specified x, y, z components computes
* and caches the magnitude.
*/
public Vector3D(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
this.mag = (float) Math.sqrt(x * x + y * y + z * z);
}
/** A private constructor, used only within this class */
private Vector3D(float x, float y, float z, float mag) {
this.x = x;
this.y = y;
this.z = z;
this.mag = mag;
}
/**
* Constructs and returns a unit vector in the same direction as this
* vector.
*/
public Vector3D unitVector() {
if (mag <= 0.0)
return new Vector3D(1.0f, 0.0f, 0.0f, 1.0f);
else
return new Vector3D(x / mag, y / mag, z / mag, 1.0f);
}
/** Returns the new vector that is this vector minus the other vector. */
public Vector3D minus(Vector3D other) {
return new Vector3D(x - other.x, y - other.y, z - other.z);
}
/** Returns the new vector that is this vector plus the other vector. */
public Vector3D plus(Vector3D other) {
return new Vector3D(x + other.x, y + other.y, z + other.z);
}
/**
* Returns the float that is the dot product of this vector and the other
* vector.
*/
public float dotProduct(Vector3D other) {
return x * other.x + y * other.y + z * other.z;
}
/**
* Returns the vector that is the cross product of this vector and the other
* vector. Note that the resulting vector is perpendicular to both this and
* the other vector.
*/
public Vector3D crossProduct(Vector3D other) {
float x = this.y * other.z - this.z * other.y;
float y = this.z * other.x - this.x * other.z;
float z = this.x * other.y - this.y * other.x;
return new Vector3D(x, y, z);
}
/**
* Returns the cosine of the angle between this vector and the other vector.
*/
public float cosTheta(Vector3D other) {
return (x * other.x + y * other.y + z * other.z) / mag / other.mag;
}
@Override
public String toString() {
StringBuilder ans = new StringBuilder("Vect:");
ans.append('(').append(x).append(',').append(y).append(',').append(z)
.append(')');
return ans.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Float.floatToIntBits(mag);
result = prime * result + Float.floatToIntBits(x);
result = prime * result + Float.floatToIntBits(y);
result = prime * result + Float.floatToIntBits(z);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Vector3D other = (Vector3D) obj;
if (Math.abs(mag - other.mag) > 0.00001)
return false;
if (Math.abs(x - other.x) > 0.00001)
return false;
if (Math.abs(y - other.y) > 0.00001)
return false;
return !(Math.abs(z - other.z) > 0.00001);
}
}
// code for comp261 assignments
| [
"[email protected]"
] | |
e16bc037b17e16ee189b2fe9817190d7aef64a04 | 685b4240bd43cbbed0b18ad8f2e8fecc3d9cec9c | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/FindFocalLengthCustom.java | 0d8d80fdb0b28e7c28e0ca21d9ee5f06c72e763e | [
"BSD-3-Clause"
] | permissive | saikrishbalaji/FtcRobotController_UltimateGoal | 99a687f6895196ce8c234dd35cfa47546a195a88 | 782ed7d3bcee497a23c3edc6a2d039d3ea484d1f | refs/heads/master | 2023-05-14T07:01:53.208318 | 2021-03-13T22:39:44 | 2021-03-13T22:39:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,163 | java | /* Copyright (c) 2019 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.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import org.firstinspires.ftc.robotcore.external.ClassFactory;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
import java.util.List;
/**
* This 2020-2021 OpMode illustrates the basics of using the TensorFlow Object Detection API to
* determine the position of the Ultimate Goal game elements.
*
* Use Android Studio 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.
*
* IMPORTANT: In order to use this OpMode, you need to obtain your own Vuforia license key as
* is explained below.
*/
@TeleOp(name = "FindFocalLengthCustomModule", group = "Concept")
//@Disabled
public class FindFocalLengthCustom extends LinearOpMode {
private static final String TFOD_MODEL_ASSET = "UltimateGoalCustom.tflite";
private static final String LABEL_FIRST_ELEMENT = "FourRings";
private static final String LABEL_SECOND_ELEMENT = "OneRing";
public static final double KNOWN_LENGTH_OF_OBJECT = 5.0;
public static final double KNOWN_DISTANCE_TO_OBJECT = 12.0;
/*
* IMPORTANT: You need to obtain your own license key to use Vuforia. The string below with which
* 'parameters.vuforiaLicenseKey' is initialized is for illustration only, and will not function.
* A Vuforia 'Development' license key, can be obtained free of charge from the Vuforia developer
* web site at https://developer.vuforia.com/license-manager.
*
* Vuforia license keys are always 380 characters long, and look as if they contain mostly
* random data. As an example, here is a example of a fragment of a valid key:
* ... yIgIzTqZ4mWjk9wd3cZO9T1axEqzuhxoGlfOOI2dRzKS4T0hQ8kT ...
* Once you've obtained a license key, copy the string from the Vuforia web site
* and paste it in to your code on the next line, between the double quotes.
*/
private static final String VUFORIA_KEY =
"ASaQAYH/////AAABmZRz9hYLmkPytLD5aoLRx68g+hNJkSRzf+Rg0CWPU9iRe1WfGfuNAHReaJ/gzwyVMqKf4VFNTeiMbH6JIYHS2Fzp7aYaCFAU8Zw2zbI8Wa4yV3IP2S7PI9Qdzash8dCuXcaLqU/AHhptdayNn28GsPnsI1YIrYxLlv5i9AkvSokhGZhvABPYtUxWPi7bnQk1JX6ZCNHBz76MhHq1zP24Ce8tIuD/0vWrCt+ZG8cMpxxdRx3Bo85Otq41TIZvjbYM86rsWlGnbeUXJRQfDwYz6zQxMbuY/BGFKZwiXHmmQXaWeIwslAggm+CBA9zGi9x1zbSJEy5MIgVkWJaCCLjx/XOW5z21of9Y+IdIqL0A6qVw";
/**
* {@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 TensorFlow Object
* Detection engine.
*/
private TFObjectDetector tfod;
@Override
public void runOpMode() {
// The TFObjectDetector uses the camera frames from the VuforiaLocalizer, so we create that
// first.
initVuforia();
initTfod();
/**
* Activate TensorFlow Object Detection before we wait for the start command.
* Do it here so that the Camera Stream window will have the TensorFlow annotations visible.
**/
if (tfod != null) {
tfod.activate();
// The TensorFlow software will scale the input images from the camera to a lower resolution.
// This can result in lower detection accuracy at longer distances (> 55cm or 22").
// If your target is at distance greater than 50 cm (20") you can adjust the magnification value
// to artificially zoom in to the center of image. For best results, the "aspectRatio" argument
// should be set to the value of the images used to create the TensorFlow Object Detection model
// (typically 1.78 or 16/9).
// Uncomment the following line if you want to adjust the magnification and/or the aspect ratio of the input images.
//tfod.setZoom(2.5, 1.78);
}
/** Wait for the game to begin */
telemetry.addData(">", "Press Play to start op mode");
telemetry.update();
waitForStart();
if (opModeIsActive()) {
while (opModeIsActive()) {
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());
// step through the list of recognitions and display boundary info.
int i = 0;
for (Recognition recognition : updatedRecognitions) {
if(recognition.estimateAngleToObject(AngleUnit.DEGREES) >= 5.0 || recognition.estimateAngleToObject(AngleUnit.DEGREES) <= -5) {
telemetry.addData("Error:", "Angle too severe. Please align your camera to the center of the object and make sure angle is as close to zero as possible.");
}
else {
telemetry.addData("Focal Length", this.getFocalLength(recognition));
}
telemetry.update();
}
}
}
}
}
if (tfod != null) {
tfod.shutdown();
}
}
/**
* Initialize the Vuforia localization engine.
*/
private void initVuforia() {
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
*/
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
parameters.vuforiaLicenseKey = VUFORIA_KEY;
parameters.cameraName = hardwareMap.get(WebcamName.class, "Webcam 1");
// Instantiate the Vuforia engine
vuforia = ClassFactory.getInstance().createVuforia(parameters);
// Loading trackables is not necessary for the TensorFlow Object Detection engine.
}
/**
* Initialize the TensorFlow Object Detection engine.
*/
private void initTfod() {
int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(
"tfodMonitorViewId", "id", hardwareMap.appContext.getPackageName());
TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);
tfodParameters.minResultConfidence = 0.8f;
tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);
tfod.loadModelFromAsset(TFOD_MODEL_ASSET, LABEL_FIRST_ELEMENT, LABEL_SECOND_ELEMENT);
}
public double getFocalLength(Recognition recognition) {
return (recognition.getHeight() * this.KNOWN_DISTANCE_TO_OBJECT)/ this.KNOWN_LENGTH_OF_OBJECT;
}
}
| [
"[email protected]"
] | |
dc70ec871e89059bece9a2251aefc0ec6f748ef6 | 2f3d0f0907f61594674f00352890e71f55c713b8 | /src/com/niit/demo/ShowSession.java | 5beff6f582b9a3ad1f3dde8f50ca1990caea48a1 | [] | no_license | GauravC8/Maven | ddc97a60b0d07904f9a767b9c734c33138e6aed9 | a7c5f4b8e6962b348ec29982356f6c2b2b3e6424 | refs/heads/master | 2020-04-28T08:35:42.987038 | 2019-03-19T17:40:33 | 2019-03-19T17:40:33 | 175,134,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,818 | java | package com.niit.demo;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class ShowSession
*/
@WebServlet("/ShowSession")
public class ShowSession extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ShowSession() {
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());
HttpSession session = request.getSession();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
//String title = "Searching in the web";
String heading;
Integer accessCount = new Integer(0);
if(session.isNew())
{
heading = "Welcome , Newbies";
}else {
heading="Welcome Back baby";
Integer oldAccessCount=(Integer)session.getAttribute("accessCount");
if(oldAccessCount != null)
{
accessCount = new Integer(oldAccessCount.intValue()+1);
}
}
session.setAttribute("accessCount", accessCount);
out.println(
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + heading + "</H1>\n" +
"<H2>Information on Your Session:</H2>\n" +
"<TABLE BORDER=1 ALIGN=CENTER>\n" +
"<TR BGCOLOR=\"#FFAD00\">\n" +
" <TH>Info Type<TH>Value\n" +
"<TR>\n" +
" <TD>ID\n" +
" <TD>" + session.getId() + "\n" +
"<TR>\n" +
" <TD>Creation Time\n" +
" <TD>" + new Date(session.getCreationTime()) + "\n" +
"<TR>\n" +
" <TD>Time of Last Access\n" +
" <TD>" + new Date(session.getLastAccessedTime()) + "\n" +
"<TR>\n" +
" <TD>Number of Previous Accesses\n" +
" <TD>" + accessCount + "\n" +
"</TABLE>\n" +
"</BODY></HTML>");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
2a9045cb0e17b03d2d7564a46712eb3ed25958f5 | a8bfd702ac2866f3063aa6eefcd980e5c8e0e325 | /app/src/main/java/ru/artyomov/dmitry/weatheryola/database/WeatherDatabase.java | 2085e4aecd5aae8f431184c76f32191dd71288ae | [] | no_license | DimsProg/WeatherYola | ac514d73854da612edfafecbfe009237f6f677bb | d2112755bfdc66cbc990155ad7339e56371ff144 | refs/heads/master | 2021-08-10T20:53:55.772756 | 2020-06-08T14:32:04 | 2020-06-08T14:32:04 | 189,885,817 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,029 | java | package ru.artyomov.dmitry.weatheryola.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import ru.artyomov.dmitry.weatheryola.common.Common;
import ru.artyomov.dmitry.weatheryola.model.WeatherData;
public class WeatherDatabase extends SQLiteOpenHelper {
private static final String TAG = WeatherDatabase.class.getSimpleName();
private static final String TABLE_NAME = WeatherDatabase.class.getName();
public WeatherDatabase(Context context) {
super(context, Common.WeatherDatabaseTable.DB_NAME, null, Common.WeatherDatabaseTable.DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(Common.WeatherDatabaseTable.CREATE_TABLE_QUERY);
} catch (SQLException ex) {
Log.d(TAG, ex.getMessage());
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(Common.WeatherDatabaseTable.DROP_QUERY);
this.onCreate(db);
db.close();
}
public boolean isTableNotEmpty(){
SQLiteDatabase db = getWritableDatabase();
Cursor mCursor = db.rawQuery("SELECT * FROM " + Common.WeatherDatabaseTable.TABLE_NAME, null);
Boolean rowExists;
if (mCursor.moveToFirst()) {
mCursor.close();
rowExists = true;
db.close();
} else {
mCursor.close();
rowExists = false;
db.close();
}
db.close();
return rowExists;
}
public void addDataInDB(String icon, String temp, String time, String humidity, String wind, String pressure,
String sunrise, String sunset){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(Common.WeatherDatabaseTable.ICON,icon);
values.put(Common.WeatherDatabaseTable.TEMP,temp);
values.put(Common.WeatherDatabaseTable.HUMIDITY,humidity);
values.put(Common.WeatherDatabaseTable.WIND,wind);
values.put(Common.WeatherDatabaseTable.PRESSURE,pressure);
values.put(Common.WeatherDatabaseTable.SUNRISE,sunrise);
values.put(Common.WeatherDatabaseTable.SUNSET,sunset);
values.put(Common.WeatherDatabaseTable.TIME,time);
try {
db.insert(Common.WeatherDatabaseTable.TABLE_NAME, null, values);
} catch (Exception e) {
Log.d(TAG, e.getMessage());
}
db.close();
}
public void updateData(String keyId, String icon, String temp, String time, String humidity, String wind, String pressure, String sunrise, String sunset){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(Common.WeatherDatabaseTable.ICON,icon);
values.put(Common.WeatherDatabaseTable.TEMP,temp);
values.put(Common.WeatherDatabaseTable.HUMIDITY,humidity);
values.put(Common.WeatherDatabaseTable.WIND,wind);
values.put(Common.WeatherDatabaseTable.PRESSURE,pressure);
values.put(Common.WeatherDatabaseTable.SUNRISE,sunrise);
values.put(Common.WeatherDatabaseTable.SUNSET,sunset);
values.put(Common.WeatherDatabaseTable.TIME,time);
db.update(Common.WeatherDatabaseTable.TABLE_NAME, values, Common.WeatherDatabaseTable.KEY_ID + " = ?",
new String[]{String.valueOf(keyId)});
db.close();
}
public WeatherData getData(){
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(Common.WeatherDatabaseTable.GET_ITEMS_QUERY, null);
WeatherData weatherData = new WeatherData();
if (cursor.moveToFirst()) {
do {
weatherData.setIcon(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.ICON)));
weatherData.setTemp(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.TEMP)));
weatherData.setHumidity(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.HUMIDITY)));
weatherData.setTime(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.TIME)));
weatherData.setWind(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.WIND)));
weatherData.setSunrise(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.SUNRISE)));
weatherData.setPressure(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.PRESSURE)));
weatherData.setSunset(cursor.getString(cursor.getColumnIndex(Common.WeatherDatabaseTable.SUNSET)));
} while (cursor.moveToNext());
}
cursor.close();
db.close();
return weatherData;
}
}
| [
"[email protected]"
] | |
3e9420a9e7f387904fd9a28a505f5561a11c7c6d | df547aa862446e754f957a931678e49fe46df7b7 | /current/template/ThreadPoolJob.java | dc53f49dc1dea05dcb2d327a9d79f6620bb4b7d3 | [
"BSD-3-Clause-LBNL"
] | permissive | virtualparadox/BBMap | 17e35fcf4913519942563bdc6e69819eabc32d04 | ea57dba1a1a112de3060793de600da91fa32fbc0 | refs/heads/master | 2023-03-02T21:57:26.095489 | 2021-02-10T22:26:51 | 2021-02-10T22:26:51 | 337,868,295 | 0 | 0 | NOASSERTION | 2021-02-10T22:26:51 | 2021-02-10T22:13:20 | null | UTF-8 | Java | false | false | 959 | java | package template;
import java.util.concurrent.ArrayBlockingQueue;
import shared.KillSwitch;
/**
*
* @author Brian Bushnell
* @date August 26, 2019
*
*/
public class ThreadPoolJob<X, Y> {
public ThreadPoolJob(X x_, ArrayBlockingQueue<X> dest_){
x=x_;
dest=dest_;
}
/** Process a job */
final void doJob(){
result=doWork();
cleanup();
}
/** Do whatever specific work needs to be done for this job */
public Y doWork(){
KillSwitch.kill("Unimplemented Method");
return null;
}
/** Retire the job to the destination queue */
final void cleanup(){
boolean success=false;
while(!success) {
try {
dest.put(x);
success=true;
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
final boolean isPoison(){return x==null;}
public final X x;
final ArrayBlockingQueue<X> dest;
public Y result;
}
| [
"[email protected]"
] | |
3f5a015c60970b19228d201712957ce4a2eda7da | 0f2995f34925962bf50f52de05e32ba8a983e568 | /src/main/java/com/zis/purchase/bean/TempImportDetail.java | bff447f2e55b25a63a89dc590c8d67f21448b83f | [] | no_license | xabaohui/zis | b1e5e092cab2fadef3e499eff27df745ae34a09e | 709285bfffeb078ee34e82d6a07214adc5d6c2de | refs/heads/master | 2020-02-26T14:48:37.707325 | 2017-06-13T17:09:23 | 2017-06-13T17:09:23 | 61,361,127 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,834 | java | package com.zis.purchase.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
/**
* TempImportDetail entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name="temp_import_detail")
public class TempImportDetail {
// Fields
@Id
@GeneratedValue
@Column(name = "id")
private Integer id;
@Column(name = "isbn")
private String isbn;
@Column(name = "orig_isbn", nullable=false)
private String origIsbn;
@Column(name = "data", nullable=false)
private String data;
@Column(name = "book_id", nullable=false)
private Integer bookId;
@Column(name = "task_id", nullable=false)
private Integer taskId;
@Column(name = "status", nullable=false)
private String status;
@Column(name = "additional_info")
private String additionalInfo;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "gmt_create", nullable=false, updatable=false)
private Date gmtCreate;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "gmt_modify", nullable=false)
private Date gmtModify;
@Version
@Column(name = "version", nullable=false)
private Integer version;
// Constructors
/** default constructor */
public TempImportDetail() {
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getIsbn() {
return this.isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getOrigIsbn() {
return this.origIsbn;
}
public void setOrigIsbn(String origIsbn) {
this.origIsbn = origIsbn;
}
public Integer getBookId() {
return this.bookId;
}
public void setBookId(Integer bookId) {
this.bookId = bookId;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public Integer getTaskId() {
return this.taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getGmtCreate() {
return this.gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModify() {
return this.gmtModify;
}
public void setGmtModify(Date gmtModify) {
this.gmtModify = gmtModify;
}
public Integer getVersion() {
return this.version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getAdditionalInfo() {
return additionalInfo;
}
public void setAdditionalInfo(String additionalInfo) {
this.additionalInfo = additionalInfo;
}
} | [
"[email protected]"
] | |
98bdaeddadb9611e6248780f4fe776721f5ced2b | d5d2659f0d63c4c658129544e837c43a068dfdaa | /aireline/src/com/bhanu/airline/entities/User.java | a82afbb82ee3d4279f475554eadc244b895b8d27 | [] | no_license | bhanusiddhannagari/java | 5ab3d1adeaca571ce63731bf967e156c2dacb74e | cb834c40299554689dc713cfcd1b6d2a6867c6f5 | refs/heads/master | 2023-07-08T13:36:32.168308 | 2021-08-13T04:08:34 | 2021-08-13T04:08:34 | 394,533,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package com.bhanu.airline.entities;
public class User {
private String uid;
private String name;
private String email;
private long mbno;
private String pswd;
private String role;
public void setUid(String uid) {
if (uid == null) {
this.uid = uid;
}
else
{
System.out.println("invalied operation");
}
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public long getMbno() {
return mbno;
}
public void setMbno(long mbno) {
this.mbno = mbno;
}
public String getPswd() {
return pswd;
}
public void setPswd(String pswd) {
this.pswd = pswd;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
}
| [
"bhanu@Bhanu"
] | bhanu@Bhanu |
d854261e21cc43ec905c3a78c955f6d60bad8173 | 6bdc07ed48cd61cbcf25d1738ee5ea78a1ce43de | /app/src/main/java/edu/incense/android/datatask/data/AudioData.java | 83525808e294b1c8f2421a825f2a178b89b66451 | [
"Apache-2.0"
] | permissive | luizcaztro/incense-2 | 5086e8613d4324781cb51296f4ea4d5fc31631de | de67d0adf36bbbadd748b7fe641f9d0007546dbe | refs/heads/master | 2021-12-16T04:43:39.291504 | 2017-09-14T05:08:00 | 2017-09-14T05:08:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package edu.incense.android.datatask.data;
public class AudioData extends Data {
private byte[] audioFrame;
public AudioData() {
super(DataType.AUDIO);
}
/**
* @param audioFrame the audioFrame to set
*/
public void setAudioFrame(byte[] audioFrame) {
this.audioFrame = audioFrame;
}
/**
* @return the audioFrame
*/
public byte[] getAudioFrame() {
return audioFrame;
}
}
| [
"[email protected]"
] | |
f9b431ab62ae8a968b6103568096affb4284fa12 | e5a2c9c32c779a435db44e6f6e48275ba7c7fa62 | /first/workspace/src/test/cafe/Test_Hello.java | 3e39e9830d7b7fa7c842a53daa69b2283f80277b | [] | no_license | KimYongMin2/BitJava | 150d88647edc98bb610afc9aa78f1a0aec2431d4 | 66d24b4f954a46e0303359b8bc3a738f7fe96a3c | refs/heads/main | 2023-04-20T01:19:18.846697 | 2021-05-24T06:14:21 | 2021-05-24T06:14:21 | 359,307,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package test.cafe;
public class Test_Hello {
public static void main(String[] args) {
System.out.println("Hello");
}
}
| [
"[email protected]"
] | |
1227d5de0fe26a31c2b8994b3d7c682ace21275e | 541f9e5dc6d0d95ce3c2b5f3b86f7fef37f4a9b9 | /PostgresJSONB/src/main/java/org/thoughts/on/java/model/MyEntity.java | 2376b20175385b4cfc0ae34efe3ca4c682f9caf0 | [] | no_license | sarateanud2/HibernateJSONBSupport | b49a636b1f14185801619724585e5997fc53e3c1 | 96d9ca0ecb9bd09a38d55ca17dc5972daf9ae016 | refs/heads/master | 2021-05-08T12:47:10.566787 | 2016-05-31T19:54:06 | 2016-05-31T19:54:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,759 | java | package org.thoughts.on.java.model;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import org.hibernate.annotations.Type;
@Entity
public class MyEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private Long id;
@Column
@Type(type = "MyJsonType")
private MyJson jsonProperty;
public Long getId() {
return this.id;
}
public void setId(final Long id) {
this.id = id;
}
public MyJson getJsonProperty() {
return jsonProperty;
}
public void setJsonProperty(MyJson jsonProperty) {
this.jsonProperty = jsonProperty;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof MyEntity)) {
return false;
}
MyEntity other = (MyEntity) obj;
if (id != null) {
if (!id.equals(other.id)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public String toString() {
String result = getClass().getSimpleName() + " ";
if (jsonProperty != null)
result += "jsonProperty: " + jsonProperty.toString();
return result;
}
} | [
"[email protected]"
] | |
6d6e593ddb661ffb8a035af36dc5a5dca8f8b619 | bb45ca5f028b841ca0a08ffef60cedc40090f2c1 | /app/src/main/java/com/MCWorld/framework/base/db/DbContext.java | f7060b4e0fdb13217c5ef6ab315dc2c8acd6227d | [] | no_license | tik5213/myWorldBox | 0d248bcc13e23de5a58efd5c10abca4596f4e442 | b0bde3017211cc10584b93e81cf8d3f929bc0a45 | refs/heads/master | 2020-04-12T19:52:17.559775 | 2017-08-14T05:49:03 | 2017-08-14T05:49:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.MCWorld.framework.base.db;
public interface DbContext {
void closeDbHelper();
void createDbHelper(String str);
DbHelper getDbHelper();
void open();
void sendCommand(DbCommand dbCommand);
DbResult syncCommnad(DbSyncCommand dbSyncCommand);
}
| [
"[email protected]"
] | |
295be9df52093abfc02540e1280a4db0d171f3a8 | 17e8438486cb3e3073966ca2c14956d3ba9209ea | /dso/tags/4.1.5_fix2/dso-common/src/main/java/com/tc/object/msg/ServerEventSerializableContext.java | b6fe77a67f83777265000ae12417cfe496d5a6fe | [] | no_license | sirinath/Terracotta | fedfc2c4f0f06c990f94b8b6c3b9c93293334345 | 00a7662b9cf530dfdb43f2dd821fa559e998c892 | refs/heads/master | 2021-01-23T05:41:52.414211 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,554 | java | package com.tc.object.msg;
import com.tc.io.TCByteBufferInput;
import com.tc.io.TCByteBufferOutput;
import com.tc.io.TCSerializable;
import com.tc.object.dna.api.DNAEncoding;
import com.tc.object.dna.impl.SerializerDNAEncodingImpl;
import com.tc.object.dna.impl.UTF8ByteDataHolder;
import com.tc.server.BasicServerEvent;
import com.tc.server.CustomLifespanVersionedServerEvent;
import com.tc.server.ServerEvent;
import com.tc.server.ServerEventType;
import com.tc.server.VersionedServerEvent;
import java.io.IOException;
/**
* @author Eugene Shelestovich
*/
class ServerEventSerializableContext implements TCSerializable {
private static final DNAEncoding serializer = new SerializerDNAEncodingImpl();
private ServerEvent event;
public ServerEventSerializableContext() {
}
public ServerEventSerializableContext(final ServerEvent event) {
this.event = event;
}
@Override
public void serializeTo(final TCByteBufferOutput out) {
serializer.encode(event.getType().ordinal(), out);
serializer.encode(event.getCacheName(), out);
serializer.encode(event.getKey(), out);
serializer.encode(event.getValue(), out);
// Note: This is an ugly hack, but it will work for now. Should fix it soon.
// Currently every event is a VersionedServerEvent, there is no implementation for ServerEvent
serializer.encode(((VersionedServerEvent) event).getVersion(), out);
boolean customLifespanEvent = (event instanceof CustomLifespanVersionedServerEvent);
serializer.encode(customLifespanEvent, out);
if (customLifespanEvent) {
CustomLifespanVersionedServerEvent customLifespanVersionedServerEvent = (CustomLifespanVersionedServerEvent) event;
serializer.encode(customLifespanVersionedServerEvent.getCreationTimeInSeconds(), out);
serializer.encode(customLifespanVersionedServerEvent.getTimeToIdle(), out);
serializer.encode(customLifespanVersionedServerEvent.getTimeToLive(), out);
}
}
@Override
public Object deserializeFrom(TCByteBufferInput in) throws IOException {
try {
int index = (Integer) serializer.decode(in);
final ServerEventType type = ServerEventType.values()[index];
final String destination = (String) serializer.decode(in);
final Object key = serializer.decode(in);
final byte[] value = (byte[]) serializer.decode(in);
final long version = (Long) serializer.decode(in);
final VersionedServerEvent versionedEvent = new BasicServerEvent(type, extractStringIfNecessary(key),
value, version, destination);
boolean customLifespanEvent = (Boolean) serializer.decode(in);
if (customLifespanEvent) {
final int creationTime = (Integer) serializer.decode(in);
final int timeToIdle = (Integer) serializer.decode(in);
final int timeToLive = (Integer) serializer.decode(in);
event = new CustomLifespanVersionedServerEvent(versionedEvent, creationTime, timeToIdle, timeToLive);
} else {
event = versionedEvent;
}
} catch (ClassNotFoundException e) {
throw new AssertionError(e);
}
return this;
}
/**
* Transform a key from internal representation to a string, if necessary.
*/
private static Object extractStringIfNecessary(final Object key) {
final Object normalizedKey;
if (key instanceof UTF8ByteDataHolder) {
normalizedKey = ((UTF8ByteDataHolder) key).asString();
} else {
normalizedKey = key;
}
return normalizedKey;
}
public ServerEvent getEvent() {
return event;
}
}
| [
"speddir@7fc7bbf3-cf45-46d4-be06-341739edd864"
] | speddir@7fc7bbf3-cf45-46d4-be06-341739edd864 |
ed78119950ae6ea40b51210558c092cc9a9a1721 | 51954380527e47154c629930e826d446704679cd | /app/src/main/java/com/canopus/MapDataParser/DataParser.java | 5cbab24c95d61d60fca1e4fb9c52d09f04b8e6f5 | [] | no_license | dpk-edunomics/myCanopusNavSystem | 16ae6739fbe3bb2029659a986a5ad6c7f1eea558 | e903e371b0a44308f50b80772199153f05d06c3c | refs/heads/main | 2023-04-29T19:55:31.898108 | 2021-05-18T11:04:46 | 2021-05-18T11:04:46 | 365,330,465 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,949 | java | package com.canopus.MapDataParser;
import com.google.android.gms.maps.model.LatLng;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class DataParser {
public List<List<HashMap<String, String>>> parse(JSONObject jObject) {
List<List<HashMap<String, String>>> mRoutes = new ArrayList<List<HashMap<String, String>>>();
JSONArray jRoutes = null;
JSONArray jLegs = null;
JSONArray jSteps = null;
try {
jRoutes = jObject.getJSONArray("routes");
for (int i = 0; i < jRoutes.length(); i++) {
jLegs = ((JSONObject) jRoutes.get(i)).getJSONArray("legs");
List path = new ArrayList<HashMap<String, String>>();
for (int j = 0; j < jLegs.length(); j++) {
jSteps = ((JSONObject) jLegs.get(j)).getJSONArray("steps");
for (int k = 0; k < jSteps.length(); k++) {
String polyline = "";
polyline = (String) ((JSONObject) ((JSONObject) jSteps.get(k)).get("polyline")).get("points");
List list = decodePoly(polyline);
for (int l = 0; l < list.size(); l++) {
HashMap<String, String> hm = new HashMap<String, String>();
hm.put("lat", Double.toString(((LatLng) list.get(l)).latitude));
hm.put("lng", Double.toString(((LatLng) list.get(l)).longitude));
path.add(hm);
}
}
mRoutes.add(path);
}
}
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e) { }
return mRoutes;
}
private List decodePoly(String encoded) {
List mList = new ArrayList();
int index = 0, len = encoded.length();
int lat = 0, lng = 0;
while (index < len) {
int mInt, mShift = 0, mResult = 0;
do {
mInt = encoded.charAt(index++) - 63;
mResult |= (mInt & 0x1f) << mShift;
mShift += 5;
} while (mInt >= 0x20);
int dlat = ((mResult & 1) != 0 ? ~(mResult >> 1) : (mResult >> 1));
lat += dlat;
mShift = 0;
mResult = 0;
do {
mInt = encoded.charAt(index++) - 63;
mResult |= (mInt & 0x1f) << mShift;
mShift += 5;
} while (mInt >= 0x20);
int mLng = ((mResult & 1) != 0 ? ~(mResult >> 1) : (mResult >> 1));
lng += mLng;
LatLng mLatLng = new LatLng((((double) lat / 1E5)),
(((double) lng / 1E5)));
mList.add(mLatLng);
}
return mList;
}
} | [
"[email protected]"
] | |
e39d08a538873ee740d9519d3ec8c960549a0873 | 39ec4ed9ec8d7c2d7b1ebf8446837605392c4891 | /src/main/java/edu/infsci2560/services/enemyFleetService.java | 550309be3a422ca8c82946f8b0598cb371779a09 | [] | no_license | infsci2560sp17/full-stack-web-LeMU-Haruka | e8d628b90753c1af41ea5954e3fe27bf66025e57 | 41952511ef0d09bca691cc994ca84ad1213a73f7 | refs/heads/master | 2021-01-11T21:31:37.297714 | 2017-04-26T15:25:15 | 2017-04-26T15:25:15 | 78,795,384 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | 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 edu.infsci2560.services;
import edu.infsci2560.models.enemyFleet;
import edu.infsci2560.repositories.enemyFleetRepository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
* @author kolobj
*/
@RestController
@RequestMapping("enemyFleet/apijson")
public class enemyFleetService {
@Autowired
private enemyFleetRepository repository;
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<Iterable<enemyFleet>> list() {
HttpHeaders headers = new HttpHeaders();
return new ResponseEntity<>(repository.findAll(), headers, HttpStatus.OK);
}
// @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
//public ResponseEntity<Kancolle> list(@PathVariable("id") Long id) {
// HttpHeaders headers = new HttpHeaders();
// return new ResponseEntity<>(repository.findOne(id), headers, HttpStatus.OK);
//}
@RequestMapping(method = RequestMethod.POST, consumes="application/json", produces = "application/json")
public ResponseEntity<enemyFleet> create(@RequestBody enemyFleet ef) {
HttpHeaders headers = new HttpHeaders();
return new ResponseEntity<>(repository.save(ef), headers, HttpStatus.OK);
}
} | [
"[email protected]"
] | |
35666c0b1be7ef35d70c2d19dfa511f05eec37c3 | 63a7c84904049c23ee9a31fdfa5a8f650ca3e0e6 | /src/champions/Rengar.java | 9cb182cf5c277df7b05ff490bb7c24e4d8ad1e87 | [] | no_license | Cangr3j0/PicksyBans | b2e80c8136401c0a4b87b60598f21d718c98c7e5 | d588fa885b30dbb166243cccdd958b9b75083bb1 | refs/heads/master | 2023-04-03T02:51:35.735229 | 2021-04-17T22:24:05 | 2021-04-17T22:24:05 | 358,987,791 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,872 | java |
package champions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.SerializedName;
public class Rengar {
@SerializedName("version")
private String version;
@SerializedName("id")
private String id;
@SerializedName("key")
private String key;
@SerializedName("name")
private String name;
@SerializedName("title")
private String title;
@SerializedName("blurb")
private String blurb;
@SerializedName("info")
private Info__95 info;
@SerializedName("image")
private Image__95 image;
@SerializedName("tags")
private List<String> tags = new ArrayList<String>();
@SerializedName("partype")
private String partype;
@SerializedName("stats")
private Stats__95 stats;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@SerializedName("version")
public String getVersion() {
return version;
}
@SerializedName("version")
public void setVersion(String version) {
this.version = version;
}
@SerializedName("id")
public String getId() {
return id;
}
@SerializedName("id")
public void setId(String id) {
this.id = id;
}
@SerializedName("key")
public String getKey() {
return key;
}
@SerializedName("key")
public void setKey(String key) {
this.key = key;
}
@SerializedName("name")
public String getName() {
return name;
}
@SerializedName("name")
public void setName(String name) {
this.name = name;
}
@SerializedName("title")
public String getTitle() {
return title;
}
@SerializedName("title")
public void setTitle(String title) {
this.title = title;
}
@SerializedName("blurb")
public String getBlurb() {
return blurb;
}
@SerializedName("blurb")
public void setBlurb(String blurb) {
this.blurb = blurb;
}
@SerializedName("info")
public Info__95 getInfo() {
return info;
}
@SerializedName("info")
public void setInfo(Info__95 info) {
this.info = info;
}
@SerializedName("image")
public Image__95 getImage() {
return image;
}
@SerializedName("image")
public void setImage(Image__95 image) {
this.image = image;
}
@SerializedName("tags")
public List<String> getTags() {
return tags;
}
@SerializedName("tags")
public void setTags(List<String> tags) {
this.tags = tags;
}
@SerializedName("partype")
public String getPartype() {
return partype;
}
@SerializedName("partype")
public void setPartype(String partype) {
this.partype = partype;
}
@SerializedName("stats")
public Stats__95 getStats() {
return stats;
}
@SerializedName("stats")
public void setStats(Stats__95 stats) {
this.stats = stats;
}
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(Rengar.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("version");
sb.append('=');
sb.append(((this.version == null)?"<null>":this.version));
sb.append(',');
sb.append("id");
sb.append('=');
sb.append(((this.id == null)?"<null>":this.id));
sb.append(',');
sb.append("key");
sb.append('=');
sb.append(((this.key == null)?"<null>":this.key));
sb.append(',');
sb.append("name");
sb.append('=');
sb.append(((this.name == null)?"<null>":this.name));
sb.append(',');
sb.append("title");
sb.append('=');
sb.append(((this.title == null)?"<null>":this.title));
sb.append(',');
sb.append("blurb");
sb.append('=');
sb.append(((this.blurb == null)?"<null>":this.blurb));
sb.append(',');
sb.append("info");
sb.append('=');
sb.append(((this.info == null)?"<null>":this.info));
sb.append(',');
sb.append("image");
sb.append('=');
sb.append(((this.image == null)?"<null>":this.image));
sb.append(',');
sb.append("tags");
sb.append('=');
sb.append(((this.tags == null)?"<null>":this.tags));
sb.append(',');
sb.append("partype");
sb.append('=');
sb.append(((this.partype == null)?"<null>":this.partype));
sb.append(',');
sb.append("stats");
sb.append('=');
sb.append(((this.stats == null)?"<null>":this.stats));
sb.append(',');
sb.append("additionalProperties");
sb.append('=');
sb.append(((this.additionalProperties == null)?"<null>":this.additionalProperties));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}
@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.image == null)? 0 :this.image.hashCode()));
result = ((result* 31)+((this.partype == null)? 0 :this.partype.hashCode()));
result = ((result* 31)+((this.title == null)? 0 :this.title.hashCode()));
result = ((result* 31)+((this.blurb == null)? 0 :this.blurb.hashCode()));
result = ((result* 31)+((this.version == null)? 0 :this.version.hashCode()));
result = ((result* 31)+((this.tags == null)? 0 :this.tags.hashCode()));
result = ((result* 31)+((this.stats == null)? 0 :this.stats.hashCode()));
result = ((result* 31)+((this.name == null)? 0 :this.name.hashCode()));
result = ((result* 31)+((this.id == null)? 0 :this.id.hashCode()));
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
result = ((result* 31)+((this.key == null)? 0 :this.key.hashCode()));
result = ((result* 31)+((this.info == null)? 0 :this.info.hashCode()));
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Rengar) == false) {
return false;
}
Rengar rhs = ((Rengar) other);
return (((((((((((((this.image == rhs.image)||((this.image!= null)&&this.image.equals(rhs.image)))&&((this.partype == rhs.partype)||((this.partype!= null)&&this.partype.equals(rhs.partype))))&&((this.title == rhs.title)||((this.title!= null)&&this.title.equals(rhs.title))))&&((this.blurb == rhs.blurb)||((this.blurb!= null)&&this.blurb.equals(rhs.blurb))))&&((this.version == rhs.version)||((this.version!= null)&&this.version.equals(rhs.version))))&&((this.tags == rhs.tags)||((this.tags!= null)&&this.tags.equals(rhs.tags))))&&((this.stats == rhs.stats)||((this.stats!= null)&&this.stats.equals(rhs.stats))))&&((this.name == rhs.name)||((this.name!= null)&&this.name.equals(rhs.name))))&&((this.id == rhs.id)||((this.id!= null)&&this.id.equals(rhs.id))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.key == rhs.key)||((this.key!= null)&&this.key.equals(rhs.key))))&&((this.info == rhs.info)||((this.info!= null)&&this.info.equals(rhs.info))));
}
}
| [
"[email protected]"
] | |
0cc0b2c99e4b8d0107a7408cb450010bb6584d6e | 2e7b8f740dc4660fccf7551e8224199e6e35a909 | /NewFirst/app/src/main/java/com/example/newfirst/util/Utils.java | 4768e6421615b6a2f8710d0a695b2a8cabb4e7ac | [] | no_license | Biyb/smartphone-18990091 | 3c4017f081857ead8da11e61807d830b98ef0f33 | 7279f127caed5c372fc08689d447635b94ea1e1f | refs/heads/master | 2023-01-31T00:25:49.123534 | 2020-12-17T18:18:45 | 2020-12-17T18:18:45 | 319,491,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | package com.example.newfirst.util;
import android.content.Context;
public class Utils {
//根据手机的分辨率从 dp 的单位 转成为 px(像素)
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
//从px转换成dp
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
}
| [
"15093006704.com"
] | 15093006704.com |
add79579b444caf67a511a8cb586e64443c66ab9 | 500b5fec60d17e4e2a79ff4995abba87e1bb5623 | /chapter_004/src/main/java/gc/GCDemo.java | d44c505cf34040b005bd6030ec9c3d075aec8a69 | [] | no_license | TurboGoose/job4j_design | a5cc67479b17333bc5f9827633d4309029355090 | 34e63f48fbc0d522f7b19f7c679b1ab89be77f98 | refs/heads/master | 2023-03-01T10:49:57.301394 | 2021-02-12T17:32:36 | 2021-02-12T17:32:36 | 292,356,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java | package gc;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
// VM arguments: -Xmx100m -Xms100m -XX:+UseSerialGC -XX:SurvivorRatio=3
public class GCDemo {
private static final Runtime env = Runtime.getRuntime();
private static final List<Object> objectStorage = new ArrayList<>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("\nOptions:");
System.out.println("1) Create 5 mb of garbage");
System.out.println("2) Create 2 mb of live objects");
System.out.println("3) Collect garbage");
System.out.println("4) Print info");
System.out.println("5) Exit");
int option = sc.nextInt();
if (option == 1) {
allocateMemory(5);
System.out.println("5 mb of garbage has been allocated");
} else if (option == 2) {
objectStorage.add(allocateMemory(2));
System.out.println("2 mb of live objects has been allocated");
} else if (option == 3) {
System.gc();
} else if (option == 4) {
info();
} else if (option == 5) {
break;
} else {
System.out.println("Wrong input");
}
}
}
public static byte[] allocateMemory(int mb) {
return new byte[1048576 * mb - 16];
}
public static void info() {
long free = env.freeMemory();
long total = env.totalMemory();
long max = env.maxMemory();
System.out.printf("[free: %d bytes (%.2f mb)] [total: %d bytes (%.2f mb)] [max: %d bytes (%.2f mb)]%n",
free, mb(free), total, mb(total), max, mb(max)
);
}
public static double mb(long bytes) {
return bytes / 1048576.0;
}
}
| [
"[email protected]"
] | |
44e3cb821812380e196fa454a2d154899d113062 | d942cc7203a2de4815ce1c17a555ec32523c649b | /src/main/java/br/com/treinaweb/twprojetos/web/controller/ClienteControle.java | eb268f23330018212a656219b972c6eaad44c320 | [] | no_license | dsouzarogerio/treinaweb-spring | 1b315a11b9955a604e99b9518682cf878571bc7d | 55322c581e137d8e4f93f7761eef5f637b705221 | refs/heads/master | 2023-08-22T13:52:30.977720 | 2021-10-10T16:41:14 | 2021-10-10T16:41:14 | 398,652,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,606 | java | package br.com.treinaweb.twprojetos.web.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import br.com.treinaweb.twprojetos.dto.AlertDTO;
import br.com.treinaweb.twprojetos.entidades.Cliente;
import br.com.treinaweb.twprojetos.servicos.ClienteServico;
import br.com.treinaweb.twprojetos.validadores.ClienteValidador;
import br.com.treinaweb.twprojetos.web.excecoes.ClientePossuiProjetosException;
@Controller
@RequestMapping("/clientes")
public class ClienteControle {
@Autowired
private ClienteServico clienteServico;
@Autowired
private ClienteValidador clienteValidador;
@InitBinder("cliente")
public void initBinder(WebDataBinder binder) {
binder.addValidators(clienteValidador);
}
@GetMapping
public ModelAndView home() {
ModelAndView modelAndView = new ModelAndView("cliente/home");
modelAndView.addObject("clientes", clienteServico.buscarTodos());
return modelAndView;
}
@GetMapping("/{id}")
public ModelAndView detalhes(@PathVariable Long id) {
ModelAndView modelAndView = new ModelAndView("cliente/detalhes");
modelAndView.addObject("cliente", clienteServico.buscarPorId(id));
return modelAndView;
}
@GetMapping("/cadastrar")
public ModelAndView cadastrar() {
ModelAndView modelAndView = new ModelAndView("cliente/formulario");
modelAndView.addObject("cliente", new Cliente());
return modelAndView;
}
@GetMapping("/{id}/editar")
public ModelAndView editar(@PathVariable Long id) {
ModelAndView modelAndView = new ModelAndView("cliente/formulario");
modelAndView.addObject("cliente", clienteServico.buscarPorId(id));
return modelAndView;
}
@PostMapping({"/cadastrar", "/{id}/editar"})
public String salvar(@Valid Cliente cliente, BindingResult resultado,
RedirectAttributes attr, @PathVariable(required = false) Long id) {
if(resultado.hasErrors()) {
return "cliente/formulario";
}
if(cliente.getId() == null) {
clienteServico.cadastrar(cliente);
attr.addFlashAttribute("alert", new AlertDTO("Cliente cadastrado com sucesso!", "alert-success"));
} else {
clienteServico.atualizar(cliente, id);
attr.addFlashAttribute("alert", new AlertDTO("Cliente editado com sucesso!", "alert-success"));
}
return "redirect:/clientes";
}
@GetMapping("/{id}/excluir")
public String excluir(@PathVariable Long id, RedirectAttributes attr) {
try {
clienteServico.excluirPorId(id);
attr.addFlashAttribute("alert", new AlertDTO("Cliente excluído com sucesso!", "alert-success"));
} catch(ClientePossuiProjetosException e) {
attr.addFlashAttribute("alert", new AlertDTO("Cliente não pode ser excluído, pois possui projeto(s) relacionado(s).", "alert-danger"));
}
return "redirect:/clientes";
}
} | [
"[email protected]"
] | |
0034e5cdb7b7eb9eadb20becc818d9c9cca54b18 | 6c80be74bf020b3df8f57240383e64d5cff68653 | /src/model/Worker.java | d5fb489129206839407986723d4d3fa220c9078f | [] | no_license | lukasgal/Task-manager | 50e548b2497af20da918d617b64d0cd5f020d96f | a5689f600387e7b434cc4dca08e08cee6285a079 | refs/heads/master | 2018-12-28T11:18:48.506871 | 2015-04-14T06:58:42 | 2015-04-14T06:58:42 | 33,839,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,541 | java | package model;
import java.io.Serializable;
/**
*
* @author Lukáš Gál
*/
public class Worker implements Serializable{
private String name;
private Integer hoursWorked;
private int priority;
private int totalHours;
public Worker(String name) {
this.name = name;
this.hoursWorked = 0;
this.totalHours = 0;
this.priority = 0;
}
public void emptyHours() {
this.hoursWorked = 0;
}
public boolean isFinished() {
return (hoursWorked == Workers.MAX_DAILY_WORKING_HOURS);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int canWorkYet() {
return Workers.MAX_DAILY_WORKING_HOURS - hoursWorked;
}
public Integer getHoursWorked() {
return hoursWorked;
}
public void setHoursWorked(Integer hoursWorked) {
this.hoursWorked += hoursWorked;
this.totalHours += hoursWorked;
}
public int getTotalHours() {
return totalHours;
}
public void setTotalHours(int totalHours) {
this.totalHours = totalHours;
}
@Override
public String toString() {
return String.format("%-20s %5d %5d\n", getName(), getHoursWorked(), getTotalHours());
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
}
| [
"[email protected]"
] | |
cf25547624cf80423122980b71f9614431169fda | 4ee3cd8dfe996bf6ce42a1b4327e1cc421a7439a | /src/main/java/usermanager/factory/student/StudentSosPasswordFactory.java | a2e3585726b8c7040a942247c691014c51217376 | [] | no_license | Morneoconnor/finalassignment | 3ef1f3d8f7aba12b3831447e8157d90537f6c1a3 | e8d95557e5a9b295889a5ebe4d2c6babd704338b | refs/heads/master | 2020-08-09T05:46:07.796243 | 2019-10-16T06:01:30 | 2019-10-16T06:01:30 | 214,012,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package usermanager.factory.student;
import usermanager.domain.student.StudentSosPassword;
public class StudentSosPasswordFactory {
public static StudentSosPassword buildStudentSosPassword(String id, String username, String password) {
return new StudentSosPassword.Builder()
.id(id)
.username(username)
.password(password)
.build();
}
}
| [
"[email protected]"
] | |
d545da09d712c18e0c79cbba57cbf6bbcefd6ebd | 72cfa68807e0676c683e6346ba4d51b1087682ef | /src/main/java/org/dmonix/timex/gui/Resources.java | 273a978a655ea3ce0a8ffc9b51ee4f9f0db7d554 | [] | no_license | pnerg/timex | ba5bd27c93dbc2f68cf79ab97baa0d928660cd3f | 507d5d80820f1b0167dfe0a1dbe2b9714c5e7e70 | refs/heads/master | 2019-01-19T13:30:38.422279 | 2015-08-13T07:40:29 | 2015-08-13T07:40:29 | 40,469,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,872 | java | package org.dmonix.timex.gui;
import java.awt.Image;
import java.io.FileNotFoundException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import org.dmonix.gui.ResourceHandler;
/**
* Utility for loading resources
*
* @author Peter Nerg
* @version 1.0
*/
public abstract class Resources extends ResourceHandler {
public static final String pathTimex = "META-INF/img/";
public static final String pathDmonix = "img/";
private static final Logger log = Logger.getLogger(Resources.class.getName());
public static Image getTimexLogo() {
return new ImageIcon(Resources.class.getResource("/META-INF/img/timex-logo-256x256.png")).getImage();
}
public static ImageIcon getIcon(String name) {
try {
return ResourceHandler.getIcon(name);
} catch (FileNotFoundException ex) {
log.log(Level.CONFIG, "Missing resource : " + name + "\n" + ex.getMessage());
return null;
}
}
/**
* Returns a 24 by 24 ImageIcon
*
* @param name
* @return
*/
public static ImageIcon getIconLarge(String name) {
try {
return ResourceHandler.getIcon(name, 24);
} catch (FileNotFoundException ex) {
log.log(Level.CONFIG, "Missing resource : " + name + "\n" + ex.getMessage());
return null;
}
}
/**
* Returns a 16 by 16 ImageIcon
*
* @param name
* @return
*/
public static ImageIcon getIconSmall(String name) {
try {
return ResourceHandler.getIcon(name, 16);
} catch (FileNotFoundException ex) {
log.log(Level.CONFIG, "Missing resource : " + name + "\n" + ex.getMessage());
return null;
}
}
} | [
"[email protected]"
] | |
0683bac12217614a99226214bd176980b51843ec | 4e0b27a16c7573ee86cd2a86ab1926f4e849544b | /src/test/java/DummyTest.java | 51cc08be7fb6c7134fdd31a3b8937ab38557bc88 | [] | no_license | AbhiPat90/APIAutomationFramework | 797dfeafd2d1566ca668d4d12fa986090c18d110 | 4c59d4f41104f84d29bd5e3df1ac904d8f9c6eb8 | refs/heads/main | 2023-02-06T00:08:13.087601 | 2021-01-03T13:53:14 | 2021-01-03T13:53:14 | 326,101,762 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,890 | java | import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
// Written this DummyTest class for the new bee/layman person to API Automation
public class DummyTest {
public static void main(String[] args) {
// Very basic test cases, without use of testNG Annotation
// This will help you to understand that why we need a Test Automation framework to automate our test cases
// Also helps you to know why we need to streamline the execution if we do not bring Automation framework into the picture
RestAssured.baseURI = "https://rahulshettyacademy.com";
String key = "qaclick123";
//POST
String responsePost = given().log().all().header("Content-Type","application/json")
.queryParam("key",key)
.body("{\n" +
" \"location\": {\n" +
" \"lat\": -43.383494,\n" +
" \"lng\": 56.427362\n" +
" },\n" +
" \"accuracy\": 55,\n" +
" \"name\": \"AutomationTest\",\n" +
" \"phone_number\": \"(+91) 123 893 4656\",\n" +
" \"address\": \"13, side layout, India\",\n" +
" \"types\": [\n" +
" \"shoe park\",\n" +
" \"practice\"\n" +
" ],\n" +
" \"website\": \"http://google.com\",\n" +
" \"language\": \"English-EN\"\n" +
"}")
.when().post("/maps/api/place/add/json")
.then().log().all().assertThat().statusCode(200).header("Connection", "Keep-Alive")
.extract().body().asString();
JsonPath jp1 = new JsonPath(responsePost);
String place_id = jp1.getString("place_id");
//PUT --> Update Address
String expectedAddress = "New Delhi, India";
given().log().all()
.header("Content-Type","application/json")
.queryParam("key",key)
.body("{\n" +
"\"place_id\":\""+place_id+"\",\n" +
"\"address\":\""+expectedAddress+"\",\n" +
"\"key\":\""+key+"\"\n" +
"}")
.when().put("/maps/api/place/update/json")
.then().log().all().assertThat().statusCode(200).body("msg",equalTo("Address successfully updated"));
//GET --> Retrieve data to verify
given().log().all()
.queryParam("key",key).queryParam("place_id",place_id)
.when().get("/maps/api/place/get/json")
.then().log().all().assertThat().statusCode(200).body("address",equalTo(expectedAddress));
//DELETE --> To remove the entry of the record from the server
given().log().all()
.header("Content-Type","application/json")
.queryParam("key",key)
.body("{\n" +
" \"place_id\":\""+place_id+"\"\n" +
"}")
.when().delete("/maps/api/place/delete/json")
.then().log().all().assertThat().statusCode(200).body("status",equalTo("OK"));
//GET --> to verify the entry actually got removed
given().log().all()
.queryParam("key",key)
.queryParam("place_id", place_id)
.when().get("/maps/api/place/get/json")
.then().log().all().assertThat().statusCode(404).body("msg",equalTo("Get operation failed, looks like place_id doesn't exists"));
//404 = Request resource could not be found but may get available in future
}
}
| [
"[email protected]"
] | |
eb107ee60cda87b10617dc24f75b9c3b66fbf6b2 | 6f991c8959fc9f09cc31c8608ecef89e436d17bc | /src/test/java/es/upm/miw/apaw_microservice_themes_suggestion/TestConfig.java | dace1a8c59e1469ffcd934f8db261ff23fd78f9f | [
"MIT"
] | permissive | melasimb/apaw-microservice-themes-suggestion | 8ec7dfb4f7c9e74a15c17664ed6e004e662e809b | b1c584167a877f2647884da04eca55f7f2711b50 | refs/heads/master | 2022-02-14T23:32:27.229058 | 2019-09-02T22:07:59 | 2019-09-02T22:07:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package es.upm.miw.apaw_microservice_themes_suggestion;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@ExtendWith(SpringExtension.class)
@SpringBootTest
@TestPropertySource(locations = "classpath:test.properties")
@ActiveProfiles("dev")
public @interface TestConfig {
}
| [
"[email protected]"
] | |
88eb9816aa03fe0ac6cf6eb2b969a77b4554d0f3 | e7b9c2c3683f94bec59ae09b0909a8b351b0dbc1 | /app/src/main/java/app/dkh/interviewapplication/models/FoodItemsListModel.java | 514ec0c94e57a9b0c47ba70af0207f53c7102d22 | [] | no_license | nayra/FoodListProject | 3aa687ae0de1b4c3a3034149fa3ee59e0cd24712 | 3815e37540b58e39061ec134ca3a6685b77bbcbe | refs/heads/master | 2020-03-12T18:50:57.751589 | 2018-04-24T02:13:55 | 2018-04-24T02:13:55 | 130,771,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | package app.dkh.interviewapplication.models;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class FoodItemsListModel {
@SerializedName("items")
private ArrayList<FoodItem> items = null;
public ArrayList<FoodItem> getItems() {
return items;
}
public void setItems(ArrayList<FoodItem> items) {
this.items = items;
}
@Override
public String toString() {
return "FoodItemsListModel{" +
"items=" + items +
'}';
}
}
| [
"123nany"
] | 123nany |
f17373aca1c282c165cff701e5055b600b3021e2 | 2ac30a2065e56864959130db56aa0d02b721d1d0 | /src/main/java/com/yundao/common/controller/tenant/TenantController.java | 1acd264be2078dbe39a71bef0002092b332ae153 | [] | no_license | wucaiqiang/yundao-common | 9b43e3bbb3d63c037ca7a60b32c069f31f2d3504 | 956d681e02e5d735393c2bdaf65058c7b1aeb737 | refs/heads/master | 2021-09-06T20:54:28.000404 | 2017-12-19T11:33:53 | 2017-12-19T11:33:53 | 114,587,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,646 | java | package com.yundao.common.controller.tenant;
import com.yundao.common.dto.BasePageDto;
import com.yundao.common.dto.tenant.TenantReqDto;
import com.yundao.common.model.base.DomainNameModel;
import com.yundao.common.model.base.TenantModel;
import com.yundao.common.service.domainname.DomainNameService;
import com.yundao.common.service.tenant.TenantService;
import com.yundao.core.code.Result;
import com.yundao.core.pagination.PaginationSupport;
import com.yundao.core.utils.ObjectCopyUtil;
import com.yundao.core.validator.group.Update;
import com.yundao.core.validator.spring.BindingResultHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/tenant/")
@ResponseBody
@Api("租户表")
public class TenantController {
@Autowired
private TenantService tenantService;
@Autowired
private DomainNameService domainNameService;
@RequestMapping(value = "get_page", method = RequestMethod.GET)
@ApiOperation(value = "分页查询租户表")
public Result<PaginationSupport<TenantModel>> getPage(@ModelAttribute TenantReqDto dto, @ModelAttribute BasePageDto pageDto) throws Exception {
TenantModel model = new TenantModel();
BeanUtils.copyProperties(dto, model);
return tenantService.selectPage(model, pageDto);
}
@RequestMapping(value = "add", method = RequestMethod.POST)
@ApiOperation(value = "新增租户表", notes = "根据Tenant对象创建租户表")
public Result<Integer> add(@Validated @ModelAttribute TenantReqDto dto, BindingResult bindingResult) throws Exception {
BindingResultHandler.handleByException(bindingResult);
TenantModel model = ObjectCopyUtil.copyObject(dto, TenantModel.class);
return tenantService.insert(model);
}
@RequestMapping(value = "update", method = RequestMethod.POST)
@ApiOperation(value = "编辑租户表信息")
public Result<Integer> update(@Validated(value = {Update.class}) @ModelAttribute TenantReqDto dto, BindingResult bindingResult) throws Exception {
BindingResultHandler.handleByException(bindingResult);
TenantModel model = new TenantModel();
BeanUtils.copyProperties(dto, model);
return tenantService.update(model);
}
@RequestMapping(value = "get", method = RequestMethod.GET)
@ApiOperation(value = "获取租户表详细信息")
public Result<TenantModel> get(@RequestParam Long id) throws Exception {
return tenantService.select(id);
}
@RequestMapping(value = "gets_by_account_id", method = RequestMethod.GET)
@ApiOperation(value = "根据帐号ID获取租户信息")
public Result<List<TenantModel>> getsByAccountId(@RequestParam Long accountId) throws Exception {
return tenantService.selectListByAccountId(accountId);
}
@RequestMapping(value = "gets_by_account", method = RequestMethod.GET)
@ApiOperation(value = "根据帐号(用户名或手机号)获取租户信息")
public Result<List<TenantModel>> getsByAccount(@RequestParam String account) throws Exception {
return tenantService.selectListByAccount(account);
}
@RequestMapping(value = "get_by_code", method = RequestMethod.GET)
@ApiOperation(value = "根据租户code获取租户信息")
public Result<TenantModel> getByCode(@RequestParam String code) throws Exception {
return tenantService.selectByCode(code);
}
@RequestMapping(value = "get_by_code_and_type", method = RequestMethod.GET)
@ApiOperation(value = "根据租户code获取租户信息")
public Result<DomainNameModel> getByCode(@RequestParam String code, @RequestParam String platformCode) throws Exception {
return domainNameService.selectByCodeAndType(code, platformCode);
}
@RequestMapping(value = "delete", method = RequestMethod.POST)
@ApiOperation(value = "删除租户表信息")
public Result<Integer> delete(@RequestParam Long id) throws Exception {
return tenantService.delete(id);
}
@RequestMapping(value = "get_limit_employee_count", method = RequestMethod.GET)
@ApiOperation(value = "获取租户的限制员工数")
public Result<Integer> getLimitEmployeeCount(@RequestParam Long tenantId) throws Exception {
return tenantService.getLimitEmployeeCount(tenantId);
}
}
| [
"[email protected]"
] | |
2781be300dc2e1cb92e4899c7e0d8da5e433c589 | 03656e736e2e13af09670b7aea093ba9cd6027cc | /src/start/Main.java | 619caa77d88052c20423278e8e8f5fe0308dbd4c | [] | no_license | antonfifindik/OOAD_v2 | 0a095442ae3e79b64409a99b0be9830fd0be126b | 068bd5b106fdd9050dbe8ac2fd2c3f0472c092e7 | refs/heads/master | 2021-01-25T06:56:36.633086 | 2017-06-07T12:14:22 | 2017-06-07T12:14:22 | 93,631,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package start;
import functions.Binary.Addition;
import functions.Binary.Multiplication;
import functions.Constant.Constant;
import functions.Logarithm.DecimalLogarithm;
import functions.Unary.Sinus;
/**
* Created by Антон on 04.06.2017.
*/
public class Main {
public static void main(String[] args) {
Addition addition = new Addition("30", "50");
addition.print();
addition.saveToXml();
Sinus sinus = new Sinus("90");
sinus.print();
System.out.println(sinus.derivative());
Multiplication multiplication = new Multiplication("100", "100");
multiplication.print();
Constant constant = new Constant("3,141592653589793238462643");
constant.print();
DecimalLogarithm logarithm = new DecimalLogarithm("1000");
logarithm.print();
}
}
| [
"[email protected]"
] | |
9dfb9af730284724ba7f98c65ab4272910c8df1e | ffc878367d48b59cd7486746d009845ed3f5eed1 | /src/main/java/com/example/demo/service/impl/PayServiceImpl.java | fbb6cc44d58e50f802c27d4f03c154c7649f5c37 | [] | no_license | Cloud-ink/bookstore-manage | 7da909ce25166e6a1c5e20c0ebc1e8d706deeba6 | 98630d41a3a1fc085c9d45be4058e2233906a693 | refs/heads/main | 2023-05-09T10:14:58.232296 | 2021-06-04T08:17:05 | 2021-06-04T08:17:05 | 364,207,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.example.demo.service.impl;
import com.alipay.api.AlipayApiException;
import com.example.demo.pojo.font.AlipayBean;
import com.example.demo.service.PayService;
import org.springframework.stereotype.Service;
@Service
public class PayServiceImpl implements PayService {
@Override
public String aliPay(AlipayBean alipayBean) throws AlipayApiException {
return null;
}
}
| [
"[email protected]"
] | |
72c4f81bdbb22f45f752c0098fc77baa7229f3da | b4d822b60c6c5635ad33362f7bf91ed4c7ad793f | /app/src/androidTest/java/com/example/conelshop/ExampleInstrumentedTest.java | 91244b532eba5e3a0972fb1d2a5aaf8f84ab9d8d | [] | no_license | menkotoglou/conel-android | 41225b2a124f6cfb2830cf14805e6afa4c40388f | 259cb869542750afbbeb5f3cb6f549396c08eac8 | refs/heads/main | 2023-04-26T02:38:03.840958 | 2021-05-23T17:59:32 | 2021-05-23T17:59:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.example.conelshop;
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.conelshop", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
9f5990c0b7450c4c5e942d871d4cfc2ecfb495bf | 5d8e51c5509f941c48d6e9c2267d465155be8698 | /stax/SmartTaxiDriver/src/com/smarttaxi/driver/interfaces/HttpProgressListener.java | 74534b1aa11a1d10efd4f29ce6fb579e9ff06765 | [] | no_license | mazharhasan/stax | de376b58faa4ff96603f7361335a065d50210d54 | 8af3eb1aa8a1c9463c2ba3a060d9b99669f754a8 | refs/heads/master | 2020-05-30T04:16:44.734167 | 2014-09-19T14:55:19 | 2014-09-19T14:55:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 126 | java | package com.smarttaxi.driver.interfaces;
public interface HttpProgressListener {
public void onProgress(Object value);
}
| [
"[email protected]"
] | |
e55fc4bff02eff0ac122a80f62dbabc3f3ef1d4a | 581b1060e2b225b2b4db2cac6fc2a30ff5c26ab4 | /FlashCardP1/src/com/controller/dao/VocabularyDao_v1.java | 4d6074d12021184701f3251d09ca4998277fb688 | [] | no_license | willliu1981/prac-flashcard | 6b89bc63ef1c2e01d2b8adc9ccfa61d2132a0b8f | f2863ff7b9fc7d51033bf8eb7b51cff52a9a43ef | refs/heads/main | 2023-03-07T11:11:15.175447 | 2021-02-18T06:44:55 | 2021-02-18T06:44:55 | 324,293,372 | 0 | 0 | null | 2020-12-27T12:47:53 | 2020-12-25T05:21:31 | Java | UTF-8 | Java | false | false | 3,866 | java | package com.controller.dao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.controller.conn.Conn;
import com.controller.dao.deprecate.VocabularyDao;
import com.model.main.Vocabulary;
public class VocabularyDao_v1 extends Dao<Vocabulary> {
//設type 用於取得currExecute ,實作於 DataProcess 的 setCurrExecute()
//修飾詞必需要public, 否則 DaoFactory 會無法建立物件
public VocabularyDao_v1(String type) {
super(type);
}
@Override
public Vocabulary query(int id) throws ClassNotFoundException, SQLException {
String sql = "select * from vocabulary where id=?";
Vocabulary m = null;
try (Connection conn = Conn.instance().getConn(); PreparedStatement st = conn.prepareStatement(sql);) {
st.setInt(1, id);
ResultSet rs = st.executeQuery();
if (rs.next()) {
m = new Vocabulary();
m.setId(rs.getInt("id"));
m.setEn_word(rs.getString("en_word"));
m.setCt_word(rs.getString("ct_word"));
m.setExam_times(rs.getInt("exam_times"));
m.setExam_time(rs.getDate("exam_time"));
m.setCreate_time(rs.getDate("create_time"));
m.setUpdate_time(rs.getDate("update_time"));
rs.close();
}else {
System.out.println("Query failed");
}
}
return m;
}
@Override
public void add(Vocabulary t) throws SQLException, ClassNotFoundException {
String sql = "insert into vocabulary (en_word,ct_word,create_time)values(?,?,?)";
try (Connection conn = Conn.instance().getConn(); PreparedStatement st = conn.prepareStatement(sql);) {
st.setString(1, t.getEn_word());
st.setString(2, t.getCt_word());
st.setDate(3, new Date(new java.util.Date().getTime()));
int count = st.executeUpdate();
if (count == 0) {
System.out.println("Add failed");
} else {
System.out.println("Add successfully");
}
}
}
@Override
public List<Vocabulary> queryAll() throws SQLException, ClassNotFoundException {
String sql = "select * from vocabulary";
Vocabulary m = null;
List<Vocabulary> list = new ArrayList<>();
try (Connection conn = Conn.instance().getConn();
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);) {
while (rs.next()) {
m = new Vocabulary();
m.setId(rs.getInt("id"));
m.setEn_word(rs.getString("en_word"));
m.setCt_word(rs.getString("ct_word"));
m.setExam_times(rs.getInt("exam_times"));
m.setExam_time(rs.getDate("exam_time"));
m.setCreate_time(rs.getDate("create_time"));
m.setUpdate_time(rs.getDate("update_time"));
list.add(m);
}
}
if(list.isEmpty()) {
System.out.println("Query list is empty");
}
return list;
}
@Override
public void update(Vocabulary t, int id) throws SQLException, ClassNotFoundException {
String sql = "update vocabulary set en_word=?,ct_word=?,update_time=? where id=?";
try (Connection conn = Conn.instance().getConn(); PreparedStatement st = conn.prepareStatement(sql);) {
st.setString(1, t.getEn_word());
st.setString(2, t.getCt_word());
st.setDate(3, new Date(new java.util.Date().getTime()));
st.setInt(4, id);
int count = st.executeUpdate();
if (count == 0) {
System.out.println("Not any data Updated");
} else {
System.out.println("Update successfully");
}
}
}
@Override
public void delete(int id) throws SQLException, ClassNotFoundException {
String sql = "delete from vocabulary where id=?";
try (Connection conn = Conn.instance().getConn(); PreparedStatement st = conn.prepareStatement(sql);) {
st.setInt(1, id);
int count =st.executeUpdate();
if (count == 0) {
System.out.println("Not any data deleted");
} else {
System.out.println("Delete successfully");
}
}
}
}
| [
"[email protected]"
] | |
b50d2300e62e2215d63dd941d283e56b0e6946dd | 167bf59b08b4a62109359f97ab62df6cea28b979 | /JAVA09/src/Text7/EGoods.java | e797916952f3fefb2ba137101c84970b681fa1c6 | [] | no_license | PMDGJJW/JAVAwork | 583e6cee45c3baecf52115dacdd7d6d5f5da0bc8 | ac1f7d60ec29afec1f0caae56b85765dd1ce18c1 | refs/heads/master | 2020-12-14T09:15:43.178008 | 2020-01-18T06:42:42 | 2020-01-18T06:42:42 | 234,688,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package Text7;
public class EGoods extends Goods {
public EGoods() {
}
public EGoods(String id, String name, double price) {
super(id, name, price);
}
}
| [
"[email protected]"
] | |
88a877e7c39a961d2851682f62def7eb46aa1e0e | da2e0b128c4d875beb6b6a516ecfd50c96ba5a9b | /oa_interface/src/main/java/com/friends/service/MfMyCollectionService.java | d781e80d0eaf82ad4360ddef9673f20c840f7e2d | [] | no_license | shanghuxiaozi/oa | 2fbb9a276cfe2f6f4cb3f5b031a45462e9d256f0 | 78165217b1632138bda5edc940b26f4727243a1f | refs/heads/master | 2021-01-20T01:44:30.956910 | 2018-07-14T11:00:31 | 2018-07-14T11:00:31 | 89,322,913 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.friends.service;
import java.util.List;
import org.springframework.data.domain.PageRequest;
import com.friends.entity.MfMyCollection;
import com.friends.entity.vo.MfMyCollectionDynamicQueryVo;
import com.friends.utils.Result;
public interface MfMyCollectionService {
public Result queryDynamic(MfMyCollectionDynamicQueryVo mfMyCollectionDynamicQueryVo);
public MfMyCollection add(MfMyCollection t);
public void delete(String id);
public MfMyCollection update(MfMyCollection t);
public MfMyCollection queryById(String id);
public List<MfMyCollection> queryByExample(MfMyCollection t);
public List<MfMyCollection> queryByExamplePageable(MfMyCollection t,PageRequest pageRequest);
public void batchAdd(List<MfMyCollection> ts);
public void batchDelete(List<MfMyCollection> ts);
// 根据用户ID 连表(活动回顾表)查询活动数据.
public Result queryByUserId(String id,PageRequest pageRequest);
// 根据用户ID 连表(交友课堂表)查询课堂视频数据
public Result queryClassroomById(String id,PageRequest pageRequest);
}
| [
"[email protected]"
] | |
fdde02e36eede971a1b5473e92a3204e94c3bf0d | e9d189753f588dffc181cd551846513a3d739602 | /igor-web/src/test/java/com/netflix/spinnaker/igor/RedisConfig.java | e437a306c59b780a019309d2c6ff4a513b9ab140 | [
"Apache-2.0"
] | permissive | claymccoy/igor | bb6656f3a3decf1e16b31aae36d8ca5d17dd510d | 58c70c4c85e2d74679eb23c782933dc2a3a40a2e | refs/heads/master | 2020-05-16T23:08:46.591429 | 2019-04-25T03:50:00 | 2019-04-25T03:50:00 | 183,355,455 | 0 | 0 | Apache-2.0 | 2019-04-25T04:20:40 | 2019-04-25T04:20:40 | null | UTF-8 | Java | false | false | 1,473 | java | /*
* Copyright 2019 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.netflix.spinnaker.igor;
import com.netflix.spinnaker.kork.jedis.EmbeddedRedis;
import com.netflix.spinnaker.kork.jedis.JedisClientDelegate;
import com.netflix.spinnaker.kork.jedis.RedisClientDelegate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import redis.clients.jedis.Jedis;
@Configuration
public class RedisConfig {
@Bean(destroyMethod = "destroy")
@Primary
EmbeddedRedis redisServer() {
EmbeddedRedis redis = EmbeddedRedis.embed();
try (Jedis jedis = redis.getJedis()) {
jedis.flushAll();
}
return redis;
}
@Bean
@Primary
RedisClientDelegate redisClientDelegate(EmbeddedRedis redisServer) {
return new JedisClientDelegate(redisServer.getPool());
}
}
| [
"[email protected]"
] | |
6b18ab9c4eeba7cd5d87008d4963a18b2584f9cd | d9a62920bb002bbf504a9d5e149a503d4298a656 | /itopener-parent/demo-parent/demo-zipkin-parent/demo-zipkin2/src/main/java/com/itopener/demo/zipkin2/config/RestTemplateClientConfiguration.java | d992260b17d47be86193ee87890a8d820c5d0eb4 | [] | no_license | dengfuwei/springboot | c7c096ac301dadc032dd264e253de059cf307a01 | 1f9845fbf93605b9b69ee13ddcaf807023578d9b | refs/heads/master | 2021-08-18T23:57:18.521574 | 2017-11-24T08:03:32 | 2017-11-24T08:03:32 | 111,880,303 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,330 | java | package com.itopener.demo.zipkin2.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4;
/**
* @author fuwei.deng
* @date 2017年6月14日 下午4:55:27
* @version 1.0.0
*/
@Configuration
public class RestTemplateClientConfiguration {
/**
* 1.使用RestTemplateBuilder来实例化RestTemplate对象,spring默认已经注入了RestTemplateBuilder实例
* 2.restTemplate如果不依赖有json messageConverter的包(如:jackson),会出现消息头为text/html无法转换成对象的异常,
* 原因是因为restTemplate检查有jackson的messageConverters会自动加载(详见RestTemplate.class构造方法),
* restTemplate请求的时候会将messageConverters里的mediaType拼装后放入http消息头的contentType(详见RestTemplate.doWithRequest方法)
* 如果messageConverters里的mediaType拼装后为空,则会按照text/html来处理,导致转换成对象出现异常
*/
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
// FastJsonHttpMessageConverter4默认的mediaType是*/*,restTemplate请求不允许请求头信息中的ContentType为*,所以需要修改mediaType
FastJsonHttpMessageConverter4 fastJsonHttpMessageConverter4 = new FastJsonHttpMessageConverter4();
List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
supportedMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
// fastJsonHttpMessageConverter4.getSupportedMediaTypes()方法获取的list不允许修改,所以只能使用set方法进行修改
fastJsonHttpMessageConverter4.setSupportedMediaTypes(supportedMediaTypes);
// 设置messageConverters,此方法会删掉原来的messageConverters,即只保留手动设置的messageConverters,并且是新创建restTemplateBuilder对象,所以需要接收
restTemplateBuilder = restTemplateBuilder.messageConverters(fastJsonHttpMessageConverter4);
return restTemplateBuilder.build();
}
}
| [
"[email protected]"
] | |
aa2ae1f318e4adf06da8c95cfdca9ad724806d30 | 78fc7aec01088cc706c1463bf294399826b40378 | /YDYYMH/src/com/ideal/zsyy/activity/PersonalCenterActivity.java | bdc01f31a049ac69a2ba2dd6c0a33e66ff71006f | [] | no_license | RayMonChina/SBASAPP | df5e6f82641c4e004c59891d9207305960e5c42b | ba0f8a4f998e5d163ed8a87cf62a8680e2b32655 | refs/heads/master | 2020-12-03T00:25:58.750002 | 2017-07-02T14:59:06 | 2017-07-02T14:59:06 | 96,029,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,439 | java | package com.ideal.zsyy.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.ideal.wdm.tools.DataCache;
import com.ideal.zsyy.Config;
import com.fang.sbas.R;
import com.ideal.zsyy.adapter.CommonlyPatientListAdapter;
import com.ideal.zsyy.adapter.MyViewPagerAdapter;
import com.ideal.zsyy.adapter.PersonalCenterListAdapter;
import com.ideal.zsyy.entity.PhCommonContactInfo;
import com.ideal.zsyy.entity.PhUser;
import com.ideal.zsyy.entity.TopVisitResInfo;
import com.ideal.zsyy.request.CommonContactListReq;
import com.ideal.zsyy.request.SelectTopVisitReq;
import com.ideal.zsyy.response.CommonContactListRes;
import com.ideal.zsyy.response.SelectTopVisistRes;
import com.ideal.zsyy.utils.DataUtils;
import com.ideal2.base.gson.GsonServlet;
import com.ideal2.base.gson.GsonServlet.OnResponseEndListening;
public class PersonalCenterActivity extends Activity implements
OnPageChangeListener {
private LinearLayout pc_ll_yuyue;
private TextView pc_tv_yuyue;
private ImageView pc_im_yuyue;
private LinearLayout pc_ll_cancel;
private TextView pc_tv_cancel;
private ImageView pc_im_cancel;
private PhUser phUsers;
private ViewPager pc_viewpager;
private TextView user_name;
private TextView user_sex;
// private List<PersonalCenter> list_yuyue;
// private List<PersonalCenter> list_cancel;
private List<TopVisitResInfo> list_yuyue;
private List<TopVisitResInfo> list_cancel;
private PersonalCenterListAdapter listAdapter_yuyue;
private ListView lv_pc_yuyue;
private ListView lv_pc_cancel;
private ListView lv_person_center_list;
private List<PhCommonContactInfo> painte_list;
private AlertDialog alert;
private CommonlyPatientListAdapter commonlyPatientListAdapter;
private List<Map<String, String>> product_type_list = new ArrayList<Map<String, String>>();
private LinearLayout login_dialog_list;
private ListView login_dialog_listview;
private int pastdue = 0;
private int nopastdue = 0; //预约成功次数
private Handler mHandler = new Handler() {
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case 1:
queryData();
break;
case 2:
int count = list_yuyue.size();
ll_level.removeAllViews();
if (count > 5) {
nopastdue = (int) Math.ceil((nopastdue * 5.0) / 10);
pastdue = 5 - nopastdue;
}
for (int i = 0; i < nopastdue; i++) {
ImageView view = new ImageView(PersonalCenterActivity.this);
view.setBackgroundResource(R.drawable.solid_star);
ll_level.addView(view);
}
for (int i = 0; i < pastdue; i++) {
ImageView view = new ImageView(PersonalCenterActivity.this);
view.setBackgroundResource(R.drawable.sky_star);
ll_level.addView(view);
}
break;
case 3:
ll_level.setVisibility(View.VISIBLE);
tv_xydj.setVisibility(View.GONE);
break;
case 4:
onResume();
queryPaintData();
break;
case 5:
SimpleAdapter adapter = new SimpleAdapter(
getApplicationContext(), product_type_list,
R.layout.login_dialog_window,
new String[] { "contactInfo_name" },
new int[] { R.id.login_dialog_item, });
login_dialog_listview.setAdapter(adapter);
AlertDialog.Builder radio = new AlertDialog.Builder(
PersonalCenterActivity.this);
radio.setTitle("请选择常用就诊人");
radio.setView(login_dialog_list);
alert = radio.create();
break;
default:
break;
}
};
};
private TextView pc_tv_content;
private ImageView pc_im_content;
private LinearLayout pc_ll_content;
private BroadCast skinBroadCast;
private LinearLayout ll_level;
private LinearLayout ll_xydj;
private TextView tv_xydj;
private TextView tv_person_center_editPersn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.personal_center1);
phUsers = Config.phUsers;
boolean isFirst = getIntent().getBooleanExtra("isFirst", false);
if (isFirst) {
Intent intent = new Intent(PersonalCenterActivity.this,
EditPersonInfoActivity.class);
intent.putExtra("isFirst", isFirst);
startActivity(intent);
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("change_contact");
skinBroadCast = new BroadCast();
registerReceiver(skinBroadCast, intentFilter);
list_yuyue = new ArrayList<TopVisitResInfo>();
list_cancel = new ArrayList<TopVisitResInfo>();
initView();
}
private void initView() {
pc_viewpager = (ViewPager) findViewById(R.id.pc_viewpager);
pc_viewpager.setOnPageChangeListener(this);
ArrayList<View> aViews = new ArrayList<View>();
LayoutInflater lf = LayoutInflater.from(this);
View main_viewpager_button_yuyue = lf.inflate(
R.layout.pc_viewpager_page1, null);
View main_viewpager_button_cancel = lf.inflate(
R.layout.pc_viewpager_page2, null);
View main_viewpager_button_content = lf.inflate(
R.layout.pc_viewpager_page3, null);
aViews.add(main_viewpager_button_yuyue);
aViews.add(main_viewpager_button_cancel);
aViews.add(main_viewpager_button_content);
MyViewPagerAdapter myViewPagerAdapter = new MyViewPagerAdapter(aViews);
pc_viewpager.setAdapter(myViewPagerAdapter);
// 预约成功listview
lv_pc_yuyue = (ListView) main_viewpager_button_yuyue
.findViewById(R.id.lv_pc_yuyue);
Button bt_pc_yuyue = (Button) main_viewpager_button_yuyue
.findViewById(R.id.bt_pc_yuyue);
bt_pc_yuyue.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (product_type_list.size() > 0) {
if (alert != null) {
alert.show();
}
} else {
Toast.makeText(v.getContext(), "无常用就诊人", 0).show();
}
}
});
// 取消预约listview
lv_pc_cancel = (ListView) main_viewpager_button_cancel
.findViewById(R.id.lv_pc_cancel);
Button bt_pc_yuyue1 = (Button) main_viewpager_button_cancel
.findViewById(R.id.bt_pc_yuyue);
bt_pc_yuyue1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (product_type_list.size() > 0) {
if (alert != null) {
alert.show();
}
} else {
Toast.makeText(v.getContext(), "无常用就诊人", 0).show();
}
}
});
ll_xydj = (LinearLayout) findViewById(R.id.ll_xydj);
ll_level = (LinearLayout) findViewById(R.id.ll_level);
tv_xydj = (TextView) findViewById(R.id.tv_xydj);
ll_xydj.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
tv_xydj.setVisibility(View.VISIBLE);
ll_level.setVisibility(View.GONE);
tv_xydj.setText("亲,您已成功挂号" + nopastdue + "次,失约" + pastdue + "次");
mHandler.sendEmptyMessageDelayed(3, 3000);
}
});
// /////////
user_name = (TextView) findViewById(R.id.user_name);
user_sex = (TextView) findViewById(R.id.user_sex);
if (phUsers != null) {
user_name.setText(phUsers.getName());
String sex = phUsers.getSex();
if (Config.man.equals(sex)) {
sex = "男";
} else if (Config.woman.equals(sex)) {
sex = "女";
} else {
sex = "";
}
user_sex.setText(sex);
}
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
login_dialog_list = (LinearLayout) inflater.inflate(
R.layout.login_dialog_list, null);
login_dialog_listview = (ListView) login_dialog_list
.findViewById(R.id.login_dialog_listview);
login_dialog_listview.setLayoutParams(new LinearLayout.LayoutParams(
android.widget.LinearLayout.LayoutParams.FILL_PARENT,
android.widget.LinearLayout.LayoutParams.WRAP_CONTENT));
login_dialog_listview.setOnItemClickListener(new OnItemClickListener() {
private Map<String, String> map;
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) {
if (alert != null) {
alert.dismiss();
}
map = product_type_list.get(position);
// String contactInfo_id = map.get("contactInfo_id");
// String contactInfo_zjtype = map.get("contactInfo_zjtype");
String contactInfo_zjnumber = map.get("contactInfo_zjnumber");
String contactInfo_name = map.get("contactInfo_name");
String medical_cardnum = map.get("medical_cardnum");
Bundle bundle = new Bundle();
// bundle.putString("contactInfo_id", contactInfo_id);
// bundle.putString("contactInfo_zjtype", contactInfo_zjtype);
bundle.putString("contactInfo_zjnumber", contactInfo_zjnumber);
bundle.putString("contactInfo_name", contactInfo_name);
bundle.putString("medical_cardnum", medical_cardnum);
Intent intent = new Intent(PersonalCenterActivity.this,
CyContactYYListActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
pc_tv_yuyue = (TextView) findViewById(R.id.pc_tv_yuyue);
pc_im_yuyue = (ImageView) findViewById(R.id.pc_im_yuyue);
pc_ll_yuyue = (LinearLayout) findViewById(R.id.pc_ll_yuyue);
pc_ll_yuyue.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setYuyue();
pc_viewpager.setCurrentItem(0);
}
});
pc_tv_cancel = (TextView) findViewById(R.id.pc_tv_cancel);
pc_im_cancel = (ImageView) findViewById(R.id.pc_im_cancel);
pc_ll_cancel = (LinearLayout) findViewById(R.id.pc_ll_cancel);
pc_ll_cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setCancel();
pc_viewpager.setCurrentItem(1);
}
});
pc_tv_content = (TextView) findViewById(R.id.pc_tv_content);
pc_im_content = (ImageView) findViewById(R.id.pc_im_content);
pc_ll_content = (LinearLayout) findViewById(R.id.pc_ll_content);
pc_ll_content.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
setContent();
pc_viewpager.setCurrentItem(2);
}
});
Button edit_info = (Button) findViewById(R.id.edit_info);
edit_info.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(),
EditPersonInfoActivity.class);
startActivity(intent);
}
});
TextView edit_tv_info = (TextView) findViewById(R.id.edit_tv_info);
edit_tv_info.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(),
EditPersonInfoActivity.class);
startActivity(intent);
}
});
// 联系人lv
lv_person_center_list = (ListView) main_viewpager_button_content
.findViewById(R.id.lv_person_center_list);
tv_person_center_editPersn = (TextView) main_viewpager_button_content.findViewById(R.id.tv_person_center_editPersn);
tv_person_center_editPersn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
commonlyPatientListAdapter.setEdit(true);
commonlyPatientListAdapter.notifyDataSetChanged();
}
});
lv_person_center_list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
PhCommonContactInfo phCommonContactInfo = painte_list
.get(position);
Bundle bundle = new Bundle();
bundle.putString("use_id", phCommonContactInfo.getId());
bundle.putString("str_ep_name",
phCommonContactInfo.getContact_name());
bundle.putString("str_ep_sex",
phCommonContactInfo.getContact_sex());
bundle.putString("str_ep_tel_no",
phCommonContactInfo.getContact_phone());
bundle.putString("str_ep_id_card",
phCommonContactInfo.getZj_number());
bundle.putString("str_ep_tv_card_type",
phCommonContactInfo.getZj_type());
bundle.putString("str_ep_birthday",
phCommonContactInfo.getContact_brithday());
bundle.putString("str_contact_add", phCommonContactInfo.getContact_add());
bundle.putString("str_contact_person_name", phCommonContactInfo.getContact_person_name());
bundle.putString("str_contact_person_phone", phCommonContactInfo.getContact_person_phone());
bundle.putString("str_medical_cardnum", phCommonContactInfo.getMedical_cardnum());
Intent intent = new Intent(view.getContext(),
CommonlyPatientChangeActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
TextView lv_person_center_addPersn = (TextView) main_viewpager_button_content
.findViewById(R.id.lv_person_center_addPersn);
lv_person_center_addPersn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(v.getContext(),
CommonlyPatientEditActivity.class);
intent.putParcelableArrayListExtra("painte_list",(ArrayList<PhCommonContactInfo>)painte_list);
startActivity(intent);
}
});
pc_tv_cancel = (TextView) findViewById(R.id.pc_tv_cancel);
pc_im_cancel = (ImageView) findViewById(R.id.pc_im_cancel);
queryPaintData();
Button btn_back = (Button) findViewById(R.id.btn_back);
btn_back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private void setYuyue() {
pc_tv_yuyue.setTextColor(Color.parseColor("#FFFFFF"));
pc_im_yuyue.setVisibility(View.VISIBLE);
pc_tv_cancel.setTextColor(Color.parseColor("#ededed"));
pc_im_cancel.setVisibility(View.INVISIBLE);
pc_tv_content.setTextColor(Color.parseColor("#ededed"));
pc_im_content.setVisibility(View.INVISIBLE);
}
private void setCancel() {
pc_tv_yuyue.setTextColor(Color.parseColor("#ededed"));
pc_im_yuyue.setVisibility(View.INVISIBLE);
pc_tv_cancel.setTextColor(Color.parseColor("#FFFFFF"));
pc_im_cancel.setVisibility(View.VISIBLE);
pc_tv_content.setTextColor(Color.parseColor("#ededed"));
pc_im_content.setVisibility(View.INVISIBLE);
}
private void setContent() {
pc_tv_yuyue.setTextColor(Color.parseColor("#ededed"));
pc_im_yuyue.setVisibility(View.INVISIBLE);
pc_tv_cancel.setTextColor(Color.parseColor("#ededed"));
pc_im_cancel.setVisibility(View.INVISIBLE);
pc_tv_content.setTextColor(Color.parseColor("#FFFFFF"));
pc_im_content.setVisibility(View.VISIBLE);
}
private void setYuyueList() {
listAdapter_yuyue = new PersonalCenterListAdapter(this, list_yuyue,
true, mHandler, phUsers.getUser_Account());
lv_pc_yuyue.setAdapter(listAdapter_yuyue);
}
private void setCancelList() {
listAdapter_yuyue = new PersonalCenterListAdapter(this, list_cancel,
false, mHandler, phUsers.getUser_Account());
lv_pc_cancel.setAdapter(listAdapter_yuyue);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
login_dialog_list = (LinearLayout) inflater.inflate(
R.layout.login_dialog_list, null);
login_dialog_listview = (ListView) login_dialog_list
.findViewById(R.id.login_dialog_listview);
login_dialog_listview.setLayoutParams(new LinearLayout.LayoutParams(
android.widget.LinearLayout.LayoutParams.FILL_PARENT,
android.widget.LinearLayout.LayoutParams.WRAP_CONTENT));
login_dialog_listview.setOnItemClickListener(new OnItemClickListener() {
private Map<String, String> map;
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) {
if (alert != null) {
alert.dismiss();
}
map = product_type_list.get(position);
// String contactInfo_id = map.get("contactInfo_id");
// String contactInfo_zjtype = map.get("contactInfo_zjtype");
String contactInfo_zjnumber = map.get("contactInfo_zjnumber");
String contactInfo_name = map.get("contactInfo_name");
String medical_cardnum = map.get("medical_cardnum");
Bundle bundle = new Bundle();
// bundle.putString("contactInfo_id", contactInfo_id);
// bundle.putString("contactInfo_zjtype", contactInfo_zjtype);
bundle.putString("contactInfo_zjnumber", contactInfo_zjnumber);
bundle.putString("contactInfo_name", contactInfo_name);
bundle.putString("medical_cardnum", medical_cardnum);
Intent intent = new Intent(PersonalCenterActivity.this,
CyContactYYListActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
queryData();
}
@Override
protected void onRestart() {
// TODO Auto-generated method stub
super.onRestart();
phUsers = Config.phUsers;
if (phUsers != null) {
user_name.setText(phUsers.getName());
String sex = phUsers.getSex();
if (Config.man.equals(sex)) {
sex = "男";
} else if (Config.woman.equals(sex)) {
sex = "女";
} else {
sex = "";
}
user_sex.setText(sex);
// user_sex.setText(phUsers.getSex().equals("01") ? "男" : "女");
}
}
@Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void onPageSelected(int item) {
// TODO Auto-generated method stub
switch (item) {
case 0:
setYuyue();
// setYuyueList();
break;
case 1:
setCancel();
// setCancelList();
break;
case 2:
setContent();
// setCancelList();
break;
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item
.getMenuInfo();
// Toast.makeText(getApplicationContext(),"id="+info.id, 0).show();
return super.onContextItemSelected(item);
}
public void queryData() {
list_yuyue.clear();
list_cancel.clear();
pastdue = 0;
nopastdue = 0;
SelectTopVisitReq selectreq = new SelectTopVisitReq();
/*selectreq.setPat_name(phUsers.getName());
selectreq.setVst_card_no(phUsers.getMedical_cardnum());*/
selectreq.setId_card(phUsers.getId_Card());
selectreq.setOperType("33");
GsonServlet<SelectTopVisitReq, SelectTopVisistRes> gsonServlet = new GsonServlet<SelectTopVisitReq, SelectTopVisistRes>(
this);
gsonServlet.request(selectreq, SelectTopVisistRes.class);
gsonServlet
.setOnResponseEndListening(new GsonServlet.OnResponseEndListening<SelectTopVisitReq, SelectTopVisistRes>() {
@Override
public void onResponseEnd(SelectTopVisitReq commonReq,
SelectTopVisistRes commonRes, boolean result,
String errmsg, int responseCode) {
// TODO Auto-generated method stub
}
@Override
public void onResponseEndSuccess(
SelectTopVisitReq commonReq,
SelectTopVisistRes commonRes, String errmsg,
int responseCode) {
// TODO Auto-generated method stub
if (commonRes != null) {
List<TopVisitResInfo> visitInfo = commonRes
.getVisitInfo();
for (TopVisitResInfo topVisitResInfo : visitInfo) {
// if (topVisitResInfo.getStatus().equals("0")) {
// list_yuyue.add(topVisitResInfo);
// } else if (topVisitResInfo.getStatus().equals(
// "1")) {
// list_cancel.add(topVisitResInfo);
// }
String convertString = DataUtils.convertString(topVisitResInfo.getReg_time(),topVisitResInfo.getReg_locate());
convertString = convertString.substring(6);
String compare_date = topVisitResInfo.getReg_date() + " " + convertString;
boolean flag = DataUtils.compare_date(compare_date);
if (topVisitResInfo.getStatus().equals("1") || flag) {
list_cancel.add(topVisitResInfo);
} else if(topVisitResInfo.getStatus().equals("0") && flag){
list_cancel.add(topVisitResInfo);
}else {
list_yuyue.add(topVisitResInfo);
if (flag) { //超过日期 -- 过期预约单
pastdue++;
} else {
if (topVisitResInfo.getStatus().equals("2")) {//预约成功次数
nopastdue++;
} else if (topVisitResInfo.getStatus().equals("3")) {
nopastdue++;
}
}
}
}
}
setYuyueList();
setCancelList();
Message msg = mHandler.obtainMessage(2);
mHandler.sendMessage(msg);
}
@Override
public void onResponseEndErr(SelectTopVisitReq commonReq,
SelectTopVisistRes commonRes, String errmsg,
int responseCode) {
// TODO Auto-generated method stub
}
});
}
private class BroadCast extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("change_contact")) {
queryPaintData();
}
}
}
private void queryPaintData() {
DataCache datacache = DataCache.getCache(this);
datacache.setUrl(Config.url);
CommonContactListReq req = new CommonContactListReq();
req.setOperType("44");
req.setUser_id(Config.phUsers.getId());
GsonServlet<CommonContactListReq, CommonContactListRes> gServlet = new GsonServlet<CommonContactListReq, CommonContactListRes>(
this);
gServlet.request(req, CommonContactListRes.class);
gServlet.setOnResponseEndListening(new OnResponseEndListening<CommonContactListReq, CommonContactListRes>() {
@Override
public void onResponseEnd(CommonContactListReq commonReq,
CommonContactListRes commonRes, boolean result,
String errmsg, int responseCode) {
// TODO Auto-generated method stub
}
@Override
public void onResponseEndSuccess(CommonContactListReq commonReq,
CommonContactListRes commonRes, String errmsg,
int responseCode) {
// TODO Auto-generated method stub
if (commonRes != null) {
painte_list = commonRes.getContactList();
for (PhCommonContactInfo phCommonContactInfo : painte_list) {
Map<String, String> map2 = new HashMap<String, String>();
map2.put("contactInfo_id", phCommonContactInfo.getId());
map2.put("contactInfo_name",
phCommonContactInfo.getContact_name());
map2.put("contactInfo_zjtype",
phCommonContactInfo.getZj_type());
map2.put("contactInfo_zjnumber",
phCommonContactInfo.getZj_number());
map2.put("medical_cardnum", phCommonContactInfo.getMedical_cardnum());
product_type_list.add(map2);
}
Message msg = mHandler.obtainMessage(5);
mHandler.sendMessage(msg);
/*SimpleAdapter adapter = new SimpleAdapter(
getApplicationContext(), product_type_list,
R.layout.login_dialog_window,
new String[] { "contactInfo_name" },
new int[] { R.id.login_dialog_item, });
login_dialog_listview.setAdapter(adapter);
AlertDialog.Builder radio = new AlertDialog.Builder(
PersonalCenterActivity.this);
radio.setTitle("请选择常用就诊人");
radio.setView(login_dialog_list);
alert = radio.create();*/
commonlyPatientListAdapter = new CommonlyPatientListAdapter(
PersonalCenterActivity.this, painte_list,mHandler);
lv_person_center_list
.setAdapter(commonlyPatientListAdapter);
}
}
@Override
public void onResponseEndErr(CommonContactListReq commonReq,
CommonContactListRes commonRes, String errmsg,
int responseCode) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), errmsg,
Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"[email protected]"
] | |
737c6aad2303a269d2c2bda1aec21d09f820138c | 9fcb7f0969e3f36e9449f01b91c95d49759a6202 | /library/src/main/java/com/tranetech/infocity/rendering/HeaderRenderer.java | b905bb17a1c735c8c56f4347d358ba5ddbd9c192 | [
"Apache-2.0"
] | permissive | HIREN4131KINAL/Recycle-adapting | b8173b3934e146078f4f0889d6eb336d6b58b8bd | 9ba9fd0be983d1d14e94203990b22351df0185ea | refs/heads/master | 2020-12-25T15:08:27.640455 | 2016-09-09T09:46:22 | 2016-09-09T09:46:22 | 66,904,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,437 | java | package com.tranetech.infocity.rendering;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import com.tranetech.infocity.calculation.DimensionCalculator;
import com.tranetech.infocity.util.OrientationProvider;
/**
* Responsible for drawing headers to the canvas provided by the item decoration
*/
public class HeaderRenderer {
private final DimensionCalculator mDimensionCalculator;
private final OrientationProvider mOrientationProvider;
/**
* The following field is used as a buffer for internal calculations. Its sole purpose is to avoid
* allocating new Rect every time we need one.
*/
private final Rect mTempRect = new Rect();
public HeaderRenderer(OrientationProvider orientationProvider) {
this(orientationProvider, new DimensionCalculator());
}
private HeaderRenderer(OrientationProvider orientationProvider,
DimensionCalculator dimensionCalculator) {
mOrientationProvider = orientationProvider;
mDimensionCalculator = dimensionCalculator;
}
/**
* Draws a header to a canvas, offsetting by some x and y amount
*
* @param recyclerView the parent recycler view for drawing the header into
* @param canvas the canvas on which to draw the header
* @param header the view to draw as the header
* @param offset a Rect used to define the x/y offset of the header. Specify x/y offset by setting
* the {@link Rect#left} and {@link Rect#top} properties, respectively.
*/
public void drawHeader(RecyclerView recyclerView, Canvas canvas, View header, Rect offset) {
canvas.save();
if (recyclerView.getLayoutManager().getClipToPadding()) {
// Clip drawing of headers to the padding of the RecyclerView. Avoids drawing in the padding
initClipRectForHeader(mTempRect, recyclerView, header);
canvas.clipRect(mTempRect);
}
canvas.translate(offset.left, offset.top);
header.draw(canvas);
canvas.restore();
}
/**
* Initializes a clipping rect for the header based on the margins of the header and the padding of the
* recycler.
* FIXME: Currently right margin in VERTICAL orientation and bottom margin in HORIZONTAL
* orientation are clipped so they look accurate, but the headers are not being drawn at the
* correctly smaller width and height respectively.
*
* @param clipRect {@link Rect} for clipping a provided header to the padding of a recycler view
* @param recyclerView for which to provide a header
* @param header for clipping
*/
private void initClipRectForHeader(Rect clipRect, RecyclerView recyclerView, View header) {
mDimensionCalculator.initMargins(clipRect, header);
if (mOrientationProvider.getOrientation(recyclerView) == LinearLayout.VERTICAL) {
clipRect.set(
recyclerView.getPaddingLeft(),
recyclerView.getPaddingTop(),
recyclerView.getWidth() - recyclerView.getPaddingRight() - clipRect.right,
recyclerView.getHeight() - recyclerView.getPaddingBottom());
} else {
clipRect.set(
recyclerView.getPaddingLeft(),
recyclerView.getPaddingTop(),
recyclerView.getWidth() - recyclerView.getPaddingRight(),
recyclerView.getHeight() - recyclerView.getPaddingBottom() - clipRect.bottom);
}
}
}
| [
"[email protected]"
] | |
e70acce6c0029b3e3c582d76c727ff7cd77257ed | 8b07cff46fe3a2fdb4ecdf903403229fa327ac1f | /BaseAnimation/src/com/duguang/baseanimation/ui/listivew/sortlistview/SortAdapter.java | 3ba1f0fab6e085972fa476b14caef3bbaecf52f9 | [] | no_license | lwugang/animationLib | ef9481fe2cfc15640175a2cd93e11928681d7817 | 85384a1aadf786f9a354b5ac75f6663a4cbda6a5 | refs/heads/master | 2021-01-01T04:33:52.038088 | 2016-05-07T06:46:39 | 2016-05-07T06:46:39 | 58,253,431 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,092 | java | package com.duguang.baseanimation.ui.listivew.sortlistview;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.SectionIndexer;
import android.widget.TextView;
import com.duguang.baseanimation.R;
public class SortAdapter extends BaseAdapter implements SectionIndexer{
private List<SortModel> list = null;
private Context mContext;
public SortAdapter(Context mContext, List<SortModel> list) {
this.mContext = mContext;
this.list = list;
}
/**
* 当ListView数据发生变化时,调用此方法来更新ListView
* @param list
*/
public void updateListView(List<SortModel> list){
this.list = list;
notifyDataSetChanged();
}
public int getCount() {
return this.list.size();
}
public Object getItem(int position) {
return list.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View view, ViewGroup arg2) {
ViewHolder viewHolder = null;
final SortModel mContent = list.get(position);
if (view == null) {
viewHolder = new ViewHolder();
view = LayoutInflater.from(mContext).inflate(R.layout.item_sort_listview, null);
viewHolder.tvTitle = (TextView) view.findViewById(R.id.title);
viewHolder.tvLetter = (TextView) view.findViewById(R.id.catalog);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
//根据position获取分类的首字母的Char ascii值
int section = getSectionForPosition(position);
//如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现
if(position == getPositionForSection(section)){
viewHolder.tvLetter.setVisibility(View.VISIBLE);
viewHolder.tvLetter.setText(mContent.getSortLetters());
}else{
viewHolder.tvLetter.setVisibility(View.GONE);
}
viewHolder.tvTitle.setText(this.list.get(position).getName());
return view;
}
final static class ViewHolder {
TextView tvLetter;
TextView tvTitle;
}
/**
* 根据ListView的当前位置获取分类的首字母的Char ascii值
*/
public int getSectionForPosition(int position) {
return list.get(position).getSortLetters().charAt(0);
}
/**
* 根据分类的首字母的Char ascii值获取其第一次出现该首字母的位置
*/
public int getPositionForSection(int section) {
for (int i = 0; i < getCount(); i++) {
String sortStr = list.get(i).getSortLetters();
char firstChar = sortStr.toUpperCase().charAt(0);
if (firstChar == section) {
return i;
}
}
return -1;
}
/**
* 提取英文的首字母,非英文字母用#代替。
*
* @param str
* @return
*/
private String getAlpha(String str) {
String sortStr = str.trim().substring(0, 1).toUpperCase();
// 正则表达式,判断首字母是否是英文字母
if (sortStr.matches("[A-Z]")) {
return sortStr;
} else {
return "#";
}
}
@Override
public Object[] getSections() {
return null;
}
} | [
"[email protected]"
] | |
5a9f3185116e3309e6bc92610d91c80cd0d91c22 | 9d299f232e03e6da1e521f3ed92a42024bb8c236 | /Kwetter/src/main/java/boundary/rest/dto/UserDTO.java | 3d9ed82041ac7eee466a05a40f02252506f2367b | [] | no_license | Luxulicious/Kwetter | 9c5593262a4ea042a145c80ca6098978ad2b81cb | 0feb1fdfccacda635ad31738d8727cfaa1b2082a | refs/heads/master | 2021-03-16T07:56:40.954208 | 2018-05-14T10:48:30 | 2018-05-14T10:48:30 | 121,982,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | 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 boundary.rest.dto;
import domain.User;
import java.util.List;
/**
*
* @author Tom
* @email
* @version 0.0.1
*/
public class UserDTO {
public long id;
public String username;
//TODO Remove password(?)
//public String password;
public String bio;
public String location;
public String website;
public String icon;
public RoleDTO role;
public LinkDTO postsUri;
public List<LinkDTO> postUris;
public LinkDTO followersUri;
public List<LinkDTO> followerUris;
public LinkDTO followingsUri;
public List<LinkDTO> followingUris;
public LinkDTO roleUri;
public UserDTO(User user) {
this.id = user.getId();
this.username = user.getUsername();
//this.password = user.getPassword();
this.bio = user.getBio();
this.location = user.getLocation();
this.website = user.getWebsite();
this.icon = user.getIcon();
this.role = new RoleDTO(user.getRole());
}
public UserDTO() {
}
}
| [
"[email protected]"
] | |
a093fc819198f37da6ecdcfba5a26cc3bb9ca450 | 38402546eabe625ab0b57d5b2c7b3e0d7a3d18e2 | /src/main/java/com/bosssoft/platform/datav/mapper/infra/SliderMapper.java | f8199e94d1e2f5775ab2e4e382383376b94ada48 | [] | no_license | 105032013072/datav-rest | 3ccc90bf0e97555f35182ecbff0ee99941283088 | 784901f6a4ce993005bba10adc54a5f9ca2b2454 | refs/heads/master | 2022-12-18T16:08:28.442922 | 2020-09-23T09:56:04 | 2020-09-23T09:56:04 | 297,665,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.bosssoft.platform.datav.mapper.infra;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.bosssoft.platform.datav.domain.Slider;
import com.bosssoft.platform.datav.dto.DataViewSearchDTO;
import com.bosssoft.platform.microservice.framework.dal.common.Mapper;
public interface SliderMapper extends Mapper<Slider> {
List<Slider> selectSliderByCondition(@Param("search") DataViewSearchDTO sliderSearch);
} | [
"[email protected]"
] | |
1c4d7079618cbdf9eb49192afc395c21643c0d98 | ee8d225e46dfe56e8d48cdcb41ab6a8be4cfdb6a | /src/test/java/com/spp/pages/UploadaDocument.java | c8d27f0a86903d481a7d2a8670b0b65ae9a8371f | [] | no_license | chandra-relyon/NewSPP | 11f43cef4f87ed4cbe5148a4a7bb5813ab9cb66f | ff66bdb85b3c1c9c42f0e0d41179f3127745c4c2 | refs/heads/master | 2020-07-04T12:40:29.002189 | 2019-08-14T06:26:56 | 2019-08-14T06:26:56 | 202,288,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,552 | java | package com.spp.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.spp.common.BasePage;
public class UploadaDocument extends BasePage{
@FindBy(id="master")
WebElement ClickOnMaster;
@FindBy(xpath="//*[@id=\"menu\"]/li[3]/div/div[1]/ul/li[1]/a")
WebElement ClickOnCompany;
@FindBy(xpath="//*[@id=\"ui-accordion-accordion-panel-0\"]/li[3]/a")
WebElement ClickOnDocuments;
@FindBy(xpath="//*[@id='main']/div[1]/span/a")
WebElement AddNewDocument;
@FindBy(id="company_document_file_path")
WebElement UploadFile;
@FindBy(id="company_document_remarks")
WebElement EnterRemarks;
@FindBy(xpath="//*[@id=\"company_document_save\"]/fieldset/div[3]/input")
WebElement UploadNewDocument;
@FindBy(xpath="//*[@id=\"main\"]/div[1]/strong")
WebElement successfullmessage;
public UploadaDocument(WebDriver driver) {
super(driver);
PageFactory.initElements(driver, this);
}
public void clickonmaster() {
ClickOnMaster.click();
}
public void clickoncompany() {
ClickOnCompany.click();
}
public void clickondocument() {
ClickOnDocuments.click();
}
public void addnewdocument() {
AddNewDocument.click();
}
public void uploadfile(String value) {
UploadFile.sendKeys(value);
}
public void enterremarks(String value) {
EnterRemarks.sendKeys(value);
}
public void uploadnewdocument() {
UploadNewDocument.click();
}
public String getMessage() {
return successfullmessage.getText();
}
} | [
"RSL@Lenovo430"
] | RSL@Lenovo430 |
d311abf9f3d15253ed5e8475159d380c6e459746 | fc6c869ee0228497e41bf357e2803713cdaed63e | /weixin6519android1140/src/sourcecode/com/tencent/mm/plugin/sns/ui/SnsTagDetailUI.java | 1319a0433e4eb9f6c222e628987977d73ec2a3f2 | [] | no_license | hyb1234hi/reverse-wechat | cbd26658a667b0c498d2a26a403f93dbeb270b72 | 75d3fd35a2c8a0469dbb057cd16bca3b26c7e736 | refs/heads/master | 2020-09-26T10:12:47.484174 | 2017-11-16T06:54:20 | 2017-11-16T06:54:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,158 | java | package com.tencent.mm.plugin.sns.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import com.tencent.gmtrace.GMTrace;
import com.tencent.mm.ad.k;
import com.tencent.mm.ad.n;
import com.tencent.mm.g.b.af;
import com.tencent.mm.kernel.b;
import com.tencent.mm.plugin.sns.i.j;
import com.tencent.mm.plugin.sns.i.m;
import com.tencent.mm.plugin.sns.model.ae;
import com.tencent.mm.plugin.sns.model.ai;
import com.tencent.mm.plugin.sns.model.u;
import com.tencent.mm.plugin.sns.model.v;
import com.tencent.mm.plugin.sns.storage.s;
import com.tencent.mm.pluginsdk.ui.applet.ContactListExpandPreference;
import com.tencent.mm.pluginsdk.ui.applet.ContactListExpandPreference.a;
import com.tencent.mm.pluginsdk.ui.applet.g;
import com.tencent.mm.pluginsdk.ui.applet.i.b;
import com.tencent.mm.sdk.e.m.b;
import com.tencent.mm.sdk.platformtools.bg;
import com.tencent.mm.storage.ar;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.base.preference.MMPreference;
import com.tencent.mm.ui.base.preference.Preference;
import com.tencent.mm.ui.base.preference.f;
import com.tencent.mm.ui.base.r;
import com.tencent.mm.ui.p;
import com.tencent.mm.ui.p.b;
import com.tencent.mm.y.q;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class SnsTagDetailUI
extends MMPreference
implements com.tencent.mm.ad.e, m.b
{
protected String eDW;
protected r hsU;
protected f htU;
protected ContactListExpandPreference jNs;
protected long psT;
protected List<String> qfY;
protected String qfZ;
private boolean qga;
protected ContactListExpandPreference.a qgb;
protected int scene;
public SnsTagDetailUI()
{
GMTrace.i(8499203407872L, 63324);
this.hsU = null;
this.qfY = new ArrayList();
this.qfZ = "";
this.eDW = "";
this.qga = false;
this.scene = 0;
this.qgb = new ContactListExpandPreference.a()
{
public final void anE()
{
GMTrace.i(8433705156608L, 62836);
if (SnsTagDetailUI.this.jNs != null) {
SnsTagDetailUI.this.jNs.bLL();
}
GMTrace.o(8433705156608L, 62836);
}
public final void ma(int paramAnonymousInt)
{
GMTrace.i(8433302503424L, 62833);
String str = SnsTagDetailUI.this.jNs.zk(paramAnonymousInt);
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "roomPref del " + paramAnonymousInt + " userName : " + str);
com.tencent.mm.kernel.h.xz();
if (bg.aq((String)com.tencent.mm.kernel.h.xy().xh().get(2, null), "").equals(str))
{
com.tencent.mm.ui.base.h.h(SnsTagDetailUI.this.vKB.vKW, i.j.dSV, i.j.cUG);
GMTrace.o(8433302503424L, 62833);
return;
}
SnsTagDetailUI.this.uT(str);
if (((SnsTagDetailUI.this.qfZ + " " + bg.c(SnsTagDetailUI.this.qfY, ",")).equals(SnsTagDetailUI.this.eDW)) && (SnsTagDetailUI.this.psT != 0L))
{
SnsTagDetailUI.this.lf(false);
GMTrace.o(8433302503424L, 62833);
return;
}
SnsTagDetailUI.this.lf(true);
GMTrace.o(8433302503424L, 62833);
}
public final void mb(int paramAnonymousInt)
{
GMTrace.i(8433570938880L, 62835);
String str = SnsTagDetailUI.this.jNs.zk(paramAnonymousInt);
Intent localIntent = new Intent();
localIntent.putExtra("Contact_User", str);
com.tencent.mm.plugin.sns.c.a.hnH.d(localIntent, SnsTagDetailUI.this);
GMTrace.o(8433570938880L, 62835);
}
public final void mc(int paramAnonymousInt)
{
GMTrace.i(8433436721152L, 62834);
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "roomPref add " + paramAnonymousInt);
SnsTagDetailUI.a(SnsTagDetailUI.this);
GMTrace.o(8433436721152L, 62834);
}
};
GMTrace.o(8499203407872L, 63324);
}
private void bpu()
{
GMTrace.i(8500545585152L, 63334);
Preference localPreference = this.htU.VG("settings_tag_name");
if (localPreference != null)
{
if (this.qfZ.length() > 20) {
this.qfZ = this.qfZ.substring(0, 20);
}
localPreference.setSummary(this.qfZ);
this.htU.notifyDataSetChanged();
}
GMTrace.o(8500545585152L, 63334);
}
protected final void MP()
{
GMTrace.i(8500814020608L, 63336);
this.htU = this.wky;
this.jNs = ((ContactListExpandPreference)this.htU.VG("roominfo_contact_anchor"));
if (this.jNs != null)
{
this.jNs.a(this.htU, this.jNs.hiu);
this.jNs.kf(true).kg(true);
this.jNs.m(null, this.qfY);
this.jNs.a(new i.b()
{
public final boolean lZ(int paramAnonymousInt)
{
GMTrace.i(8349819076608L, 62211);
ContactListExpandPreference localContactListExpandPreference = SnsTagDetailUI.this.jNs;
if (localContactListExpandPreference.txK != null) {}
for (boolean bool = localContactListExpandPreference.txK.twX.zi(paramAnonymousInt);; bool = true)
{
if (!bool) {
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "onItemLongClick " + paramAnonymousInt);
}
GMTrace.o(8349819076608L, 62211);
return true;
}
}
});
this.jNs.a(this.qgb);
}
getIntent().getIntExtra("k_sns_from_settings_about_sns", 0);
a(new MenuItem.OnMenuItemClickListener()
{
public final boolean onMenuItemClick(MenuItem paramAnonymousMenuItem)
{
GMTrace.i(8339350093824L, 62133);
if (((SnsTagDetailUI.this.qfZ + " " + bg.c(SnsTagDetailUI.this.qfY, ",")).equals(SnsTagDetailUI.this.eDW)) && (SnsTagDetailUI.this.psT != 0L))
{
SnsTagDetailUI.this.finish();
GMTrace.o(8339350093824L, 62133);
return true;
}
com.tencent.mm.ui.base.h.a(SnsTagDetailUI.this, i.j.pkD, i.j.cUG, new DialogInterface.OnClickListener()
{
public final void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
{
GMTrace.i(8599329832960L, 64070);
SnsTagDetailUI.this.finish();
GMTrace.o(8599329832960L, 64070);
}
}, null);
GMTrace.o(8339350093824L, 62133);
return true;
}
});
a(0, getString(i.j.cTh), new MenuItem.OnMenuItemClickListener()
{
public final boolean onMenuItemClick(MenuItem paramAnonymousMenuItem)
{
GMTrace.i(8494505787392L, 63289);
SnsTagDetailUI.this.aLm();
GMTrace.o(8494505787392L, 63289);
return true;
}
}, p.b.vLG);
GMTrace.o(8500814020608L, 63336);
}
public final int QI()
{
GMTrace.i(8500008714240L, 63330);
int i = i.m.plK;
GMTrace.o(8500008714240L, 63330);
return i;
}
public void a(int paramInt1, int paramInt2, String paramString, k paramk)
{
GMTrace.i(8501753544704L, 63343);
com.tencent.mm.sdk.platformtools.w.i("MicroMsg.SnsTagDetailUI", "onSceneEnd: errType = " + paramInt1 + " errCode = " + paramInt2 + " errMsg = " + paramString);
if (this.hsU != null) {
this.hsU.dismiss();
}
switch (paramk.getType())
{
}
for (;;)
{
GMTrace.o(8501753544704L, 63343);
return;
finish();
GMTrace.o(8501753544704L, 63343);
return;
finish();
GMTrace.o(8501753544704L, 63343);
return;
if ((this.jNs != null) && (this.qga) && (!(this instanceof SnsBlackDetailUI)))
{
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "update form net");
paramString = (u)paramk;
this.eDW = (this.qfZ + " " + bg.c(paramString.dE(this.psT), ","));
new LinkedList();
paramString = this.qfY;
this.qfY = bow();
if (paramString != null)
{
paramString = paramString.iterator();
while (paramString.hasNext())
{
paramk = (String)paramString.next();
if (!this.qfY.contains(paramk)) {
this.qfY.add(paramk);
}
}
}
this.jNs.aQ(this.qfY);
this.jNs.notifyChanged();
}
}
}
public final void a(int paramInt, com.tencent.mm.sdk.e.m paramm, Object paramObject)
{
GMTrace.i(8499874496512L, 63329);
GMTrace.o(8499874496512L, 63329);
}
public final boolean a(f paramf, Preference paramPreference)
{
GMTrace.i(8500277149696L, 63332);
paramf = paramPreference.hiu;
if ((paramf.equals("settings_tag_name")) && ((this.psT >= 6L) || (this.psT == 0L)))
{
paramPreference = new Intent();
paramPreference.putExtra("Contact_mode_name_type", 3);
paramPreference.putExtra("Contact_Nick", bg.aq(this.qfZ, " "));
com.tencent.mm.plugin.sns.c.a.hnH.a(paramPreference, this);
}
if (paramf.equals("delete_tag_name")) {
com.tencent.mm.ui.base.h.a(this, i.j.pig, i.j.cUG, new DialogInterface.OnClickListener()new DialogInterface.OnClickListener
{
public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
GMTrace.i(8492089868288L, 63271);
SnsTagDetailUI.this.bov();
GMTrace.o(8492089868288L, 63271);
}
}, new DialogInterface.OnClickListener()
{
public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
GMTrace.i(8563627917312L, 63804);
GMTrace.o(8563627917312L, 63804);
}
});
}
GMTrace.o(8500277149696L, 63332);
return false;
}
protected void aLm()
{
GMTrace.i(8501082456064L, 63338);
if (((this.qfZ + " " + bg.c(this.qfY, ",")).equals(this.eDW)) && (this.psT != 0L))
{
finish();
GMTrace.o(8501082456064L, 63338);
return;
}
if (ae.bjj().p(this.psT, this.qfZ))
{
com.tencent.mm.ui.base.h.b(this, getString(i.j.pkE, new Object[] { this.qfZ }), getString(i.j.cUG), true);
GMTrace.o(8501082456064L, 63338);
return;
}
final v localv = new v(3, this.psT, this.qfZ, this.qfY.size(), this.qfY, this.scene);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(localv, 0);
getString(i.j.cUG);
this.hsU = com.tencent.mm.ui.base.h.a(this, getString(i.j.pkM), true, new DialogInterface.OnCancelListener()
{
public final void onCancel(DialogInterface paramAnonymousDialogInterface)
{
GMTrace.i(8468870201344L, 63098);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.c(localv);
GMTrace.o(8468870201344L, 63098);
}
});
GMTrace.o(8501082456064L, 63338);
}
protected final void anv()
{
GMTrace.i(8500411367424L, 63333);
sq(this.qfZ + "(" + this.qfY.size() + ")");
GMTrace.o(8500411367424L, 63333);
}
protected void bF(List<String> paramList)
{
GMTrace.i(8501485109248L, 63341);
ar localar = ae.biR();
String str1 = q.zE();
paramList = paramList.iterator();
while (paramList.hasNext())
{
String str2 = (String)paramList.next();
if ((!this.qfY.contains(str2)) && (com.tencent.mm.l.a.eE(localar.TE(str2).field_type)) && (!str1.equals(str2))) {
this.qfY.add(str2);
}
}
if (this.jNs != null)
{
this.jNs.aQ(this.qfY);
this.jNs.notifyChanged();
}
if (this.qfY.size() > 0) {
this.jNs.kf(true).kg(true);
}
for (;;)
{
anv();
GMTrace.o(8501485109248L, 63341);
return;
this.jNs.kf(true).kg(false);
}
}
protected void bot()
{
GMTrace.i(8499337625600L, 63325);
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "Base __onCreate");
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(290, this);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(291, this);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(292, this);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(293, this);
com.tencent.mm.kernel.h.xz();
((com.tencent.mm.plugin.messenger.foundation.a.h)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.messenger.foundation.a.h.class)).yK().a(this);
if (ae.bjj().bmA().size() == 0)
{
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(new u(1), 0);
this.qga = true;
}
GMTrace.o(8499337625600L, 63325);
}
protected void bou()
{
GMTrace.i(8499606061056L, 63327);
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "Base __onDestroy");
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.b(290, this);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.b(291, this);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.b(292, this);
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.b(293, this);
com.tencent.mm.kernel.h.xz();
if (com.tencent.mm.kernel.h.xw().wL())
{
com.tencent.mm.kernel.h.xz();
((com.tencent.mm.plugin.messenger.foundation.a.h)com.tencent.mm.kernel.h.h(com.tencent.mm.plugin.messenger.foundation.a.h.class)).yK().b(this);
}
GMTrace.o(8499606061056L, 63327);
}
protected void bov()
{
GMTrace.i(8500679802880L, 63335);
if (this.psT != 0L)
{
com.tencent.mm.kernel.h.xz();
com.tencent.mm.kernel.h.xx().fYr.a(new com.tencent.mm.plugin.sns.model.w(this.psT, this.qfZ), 0);
}
getString(i.j.cUG);
this.hsU = com.tencent.mm.ui.base.h.a(this, getString(i.j.pkM), true, new DialogInterface.OnCancelListener()
{
public final void onCancel(DialogInterface paramAnonymousDialogInterface)
{
GMTrace.i(8514101575680L, 63435);
GMTrace.o(8514101575680L, 63435);
}
});
GMTrace.o(8500679802880L, 63335);
}
protected List<String> bow()
{
GMTrace.i(8501216673792L, 63339);
LinkedList localLinkedList = new LinkedList();
s locals = ae.bjj().dW(this.psT);
Object localObject = localLinkedList;
if (locals.field_memberList != null)
{
localObject = localLinkedList;
if (!locals.field_memberList.equals("")) {
localObject = bg.g(locals.field_memberList.split(","));
}
}
GMTrace.o(8501216673792L, 63339);
return (List<String>)localObject;
}
public boolean dispatchKeyEvent(KeyEvent paramKeyEvent)
{
GMTrace.i(8500948238336L, 63337);
if ((paramKeyEvent.getKeyCode() == 4) && (paramKeyEvent.getAction() == 0))
{
if (((this.qfZ + " " + bg.c(this.qfY, ",")).equals(this.eDW)) && (this.psT != 0L)) {
finish();
}
for (;;)
{
GMTrace.o(8500948238336L, 63337);
return true;
com.tencent.mm.ui.base.h.a(this, i.j.pkD, i.j.cUG, new DialogInterface.OnClickListener()
{
public final void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
GMTrace.i(8315593555968L, 61956);
SnsTagDetailUI.this.finish();
GMTrace.o(8315593555968L, 61956);
}
}, null);
}
}
boolean bool = super.dispatchKeyEvent(paramKeyEvent);
GMTrace.o(8500948238336L, 63337);
return bool;
}
protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
{
GMTrace.i(8501619326976L, 63342);
super.onActivityResult(paramInt1, paramInt2, paramIntent);
if (paramInt2 != -1)
{
GMTrace.o(8501619326976L, 63342);
return;
}
switch (paramInt1)
{
default:
GMTrace.o(8501619326976L, 63342);
return;
case 1:
if (paramIntent == null)
{
GMTrace.o(8501619326976L, 63342);
return;
}
paramIntent = paramIntent.getStringExtra("Select_Contact");
if (bg.nl(q.zE()).equals(paramIntent)) {
paramInt2 = 1;
}
while (paramInt2 != 0)
{
com.tencent.mm.ui.base.h.b(this, getString(i.j.cQz, new Object[] { Integer.valueOf(0), Integer.valueOf(0) }), getString(i.j.cUG), true);
GMTrace.o(8501619326976L, 63342);
return;
if (this.qfY == null)
{
paramInt2 = 0;
}
else
{
Iterator localIterator = this.qfY.iterator();
paramInt1 = 0;
paramInt2 = paramInt1;
if (localIterator.hasNext())
{
if (!((String)localIterator.next()).equals(paramIntent)) {
break label376;
}
paramInt1 = 1;
}
}
}
}
label376:
for (;;)
{
break;
paramIntent = bg.g(paramIntent.split(","));
if (paramIntent == null)
{
GMTrace.o(8501619326976L, 63342);
return;
}
bF(paramIntent);
while (((this.qfZ + " " + bg.c(this.qfY, ",")).equals(this.eDW)) && (this.psT != 0L))
{
lf(false);
GMTrace.o(8501619326976L, 63342);
return;
paramIntent = paramIntent.getStringExtra("k_sns_tag_name");
if (paramIntent != null) {
this.qfZ = paramIntent;
}
anv();
com.tencent.mm.sdk.platformtools.w.d("MicroMsg.SnsTagDetailUI", "updateName " + this.qfZ);
}
lf(true);
GMTrace.o(8501619326976L, 63342);
return;
}
}
public void onCreate(Bundle paramBundle)
{
GMTrace.i(8499471843328L, 63326);
super.onCreate(paramBundle);
bot();
this.scene = getIntent().getIntExtra("k_tag_detail_sns_block_scene", 0);
this.psT = getIntent().getLongExtra("k_sns_tag_id", 0L);
if (this.psT == 4L) {
this.qfZ = getString(i.j.pkH);
}
while (this.psT == 0L)
{
Object localObject = getIntent().getStringExtra("k_sns_tag_list");
this.qfZ = bg.aq(getIntent().getStringExtra("k_sns_tag_name"), "");
paramBundle = ae.biR();
String str1 = q.zE();
localObject = bg.g(((String)localObject).split(","));
if (localObject == null) {
break label266;
}
localObject = ((List)localObject).iterator();
while (((Iterator)localObject).hasNext())
{
String str2 = (String)((Iterator)localObject).next();
if ((!this.qfY.contains(str2)) && (com.tencent.mm.l.a.eE(paramBundle.TE(str2).field_type)) && (!str1.equals(str2))) {
this.qfY.add(str2);
}
}
if (this.psT == 5L) {
this.qfZ = getString(i.j.pkP);
} else {
this.qfZ = ae.bjj().dW(this.psT).field_tagName;
}
}
this.qfY = bow();
label266:
if ((this.qfZ == null) || (this.qfZ.equals("")))
{
this.qfZ = getString(i.j.pkG);
this.qfZ = ai.Hw(getString(i.j.pkG));
}
MP();
bpu();
anv();
if (this.psT < 6L)
{
this.htU.VH("delete_tag_name");
this.htU.VH("delete_tag_name_category");
if (this.psT > 0L)
{
this.htU.VH("settings_tag_name");
this.htU.VH("settings_tag_name_category");
}
}
if (this.psT == 4L)
{
this.htU.VH("black");
this.htU.VH("group");
if (this.psT != 0L) {
break label562;
}
lf(true);
}
for (;;)
{
this.eDW = (this.qfZ + " " + bg.c(this.qfY, ","));
GMTrace.o(8499471843328L, 63326);
return;
if (this.psT == 5L)
{
this.htU.VH("outside");
this.htU.VH("group");
break;
}
this.htU.VH("black");
this.htU.VH("outside");
break;
label562:
lf(false);
}
}
public void onDestroy()
{
GMTrace.i(8499740278784L, 63328);
if (this.hsU != null) {
this.hsU.dismiss();
}
bou();
super.onDestroy();
GMTrace.o(8499740278784L, 63328);
}
public void onResume()
{
GMTrace.i(8500142931968L, 63331);
super.onResume();
bpu();
GMTrace.o(8500142931968L, 63331);
}
protected void uT(String paramString)
{
GMTrace.i(8501350891520L, 63340);
if ((paramString == null) || (paramString.equals("")))
{
GMTrace.o(8501350891520L, 63340);
return;
}
this.qfY.remove(paramString);
if (this.jNs != null)
{
this.jNs.aQ(this.qfY);
this.jNs.notifyChanged();
}
if ((this.qfY.size() == 0) && (this.jNs != null))
{
this.jNs.bLL();
this.jNs.kf(true).kg(false);
this.htU.notifyDataSetChanged();
}
for (;;)
{
anv();
GMTrace.o(8501350891520L, 63340);
return;
if (this.jNs != null) {
this.jNs.kf(true).kg(true);
}
}
}
}
/* Location: D:\tools\apktool\weixin6519android1140\jar\classes4-dex2jar.jar!\com\tencent\mm\plugin\sns\ui\SnsTagDetailUI.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
4d546080d494f88da645cd92b0d23ab4cfdc7031 | 8a45d252ea45ee2f3dee06d1318a6f7c8605f4ba | /tp-spring-jersey/src/main/java/com/wetic/jersey/web/rest/errors/ExceptionTranslator.java | ee124090fcb846f82782208605a4524613a98c64 | [] | no_license | Zelyos/Bolphis-javadev-repo | 6d701c344e2ff6a5855e2328fe53de1a2f239455 | e2f3c36537aed35aff23654ebee6a12e82c91159 | refs/heads/master | 2022-12-27T12:00:56.127019 | 2019-08-28T18:36:00 | 2019-08-28T18:36:00 | 204,979,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,332 | java | package com.wetic.jersey.web.rest.errors;
import io.github.jhipster.web.util.HeaderUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.NativeWebRequest;
import org.zalando.problem.DefaultProblem;
import org.zalando.problem.Problem;
import org.zalando.problem.ProblemBuilder;
import org.zalando.problem.Status;
import org.zalando.problem.spring.web.advice.ProblemHandling;
import org.zalando.problem.violations.ConstraintViolationProblem;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.stream.Collectors;
/**
* Controller advice to translate the server side exceptions to client-friendly json structures.
* The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807).
*/
@ControllerAdvice
public class ExceptionTranslator implements ProblemHandling {
private static final String FIELD_ERRORS_KEY = "fieldErrors";
private static final String MESSAGE_KEY = "message";
private static final String PATH_KEY = "path";
private static final String VIOLATIONS_KEY = "violations";
@Value("${jhipster.clientApp.name}")
private String applicationName;
/**
* Post-process the Problem payload to add the message key for the front-end if needed.
*/
@Override
public ResponseEntity<Problem> process(@Nullable ResponseEntity<Problem> entity, NativeWebRequest request) {
if (entity == null) {
return entity;
}
Problem problem = entity.getBody();
if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) {
return entity;
}
ProblemBuilder builder = Problem.builder()
.withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType())
.withStatus(problem.getStatus())
.withTitle(problem.getTitle())
.with(PATH_KEY, request.getNativeRequest(HttpServletRequest.class).getRequestURI());
if (problem instanceof ConstraintViolationProblem) {
builder
.with(VIOLATIONS_KEY, ((ConstraintViolationProblem) problem).getViolations())
.with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION);
} else {
builder
.withCause(((DefaultProblem) problem).getCause())
.withDetail(problem.getDetail())
.withInstance(problem.getInstance());
problem.getParameters().forEach(builder::with);
if (!problem.getParameters().containsKey(MESSAGE_KEY) && problem.getStatus() != null) {
builder.with(MESSAGE_KEY, "error.http." + problem.getStatus().getStatusCode());
}
}
return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode());
}
@Override
public ResponseEntity<Problem> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) {
BindingResult result = ex.getBindingResult();
List<FieldErrorVM> fieldErrors = result.getFieldErrors().stream()
.map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode()))
.collect(Collectors.toList());
Problem problem = Problem.builder()
.withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE)
.withTitle("Method argument not valid")
.withStatus(defaultConstraintViolationStatus())
.with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION)
.with(FIELD_ERRORS_KEY, fieldErrors)
.build();
return create(ex, problem, request);
}
@ExceptionHandler
public ResponseEntity<Problem> handleNoSuchElementException(NoSuchElementException ex, NativeWebRequest request) {
Problem problem = Problem.builder()
.withStatus(Status.NOT_FOUND)
.with(MESSAGE_KEY, ErrorConstants.ENTITY_NOT_FOUND_TYPE)
.build();
return create(ex, problem, request);
}
@ExceptionHandler
public ResponseEntity<Problem> handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) {
return create(ex, request, HeaderUtil.createFailureAlert(applicationName, false, ex.getEntityName(), ex.getErrorKey(), ex.getMessage()));
}
@ExceptionHandler
public ResponseEntity<Problem> handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) {
Problem problem = Problem.builder()
.withStatus(Status.CONFLICT)
.with(MESSAGE_KEY, ErrorConstants.ERR_CONCURRENCY_FAILURE)
.build();
return create(ex, problem, request);
}
}
| [
"[email protected]"
] | |
c3be110353fa0245cd22a65fcdc375b4342807b8 | 0f93d303663473adf794f9dc535e6f890cc76cc2 | /src/main/java/ec/research/gp/statistics/LayeredGPStatistics.java | a736846e5a27481020af577a93cd38e79a4e332b | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | burks-pub/gecco2015 | 853e895e2bbc40ff0d45ed05cb6b83947018d6a5 | 2a7e32381d2e978e52c824d8348cf106619bb795 | refs/heads/master | 2021-01-25T10:29:52.980766 | 2015-06-15T13:44:39 | 2015-06-15T13:44:39 | 26,822,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,537 | java | package ec.research.gp.statistics;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import java.util.Vector;
import ec.research.gp.simple.representation.Individual;
import ec.research.gp.simple.util.Config;
import ec.research.gp.util.Utils;
/**
* Similar to the SimpleGPStatistics class, but customized to handle a layered
* population structure.
*
*/
public class LayeredGPStatistics extends Statistics {
// Holds the layered population.
private List<Vector<Individual>> population;
// Holds the total number of layers that will be populated during the run.
private int totalLayers;
// The path to the layer fitness stats file.
private static final String LAYER_FITNESS_FILE = "fitness";
// The writer responsible for writing the layer fitness stats file.
private BufferedWriter layerFitnessOutput;
/**
* Convenience method to save the seed to file so we can have it if we need
* to re-run this again.
*
* @param timestamp
* the timestamp to append to the file name.
*
* @throws IOException
*/
private void saveSeed(String timestamp) throws IOException {
BufferedWriter seedFile = new BufferedWriter(new FileWriter(
config.getOutputDir() + "/" + "seed" + timestamp + ".txt"));
seedFile.write(Long.toString(this.config.getSeed()));
seedFile.close();
}
/**
* Convenience method to setup all the (many) writers needed for the
* different output files. This is done to hide all the ugliness from the
* constructor.
*
* @param timestamp
* the timestamp to append to the end of the filename
*
* @throws IOException
*/
private void setupOutput(String timestamp) throws IOException {
// Just initialize all the writers.
this.layerFitnessOutput = new BufferedWriter(new FileWriter(
config.getOutputDir() + "/" + LAYER_FITNESS_FILE + timestamp));
}
/**
* Creates a new LayeredGPStatistics object, using the given layered
* population.
*
* @param population
* the layered population on which to collect statistics.
* @throws IOException
*/
public LayeredGPStatistics(List<Vector<Individual>> population,
Config config) throws IOException {
super(config);
// Get the current time so we can organize our output with a timestamp.
String timestamp = TIMESTAMP_FORMAT.format(this.startTime);
this.population = population;
this.totalLayers = config.getNumLayers();
// Setup all the writers.
setupOutput(timestamp);
// Save the seed to file to make life easier if we need to re-run
saveSeed(timestamp);
}
/**
* Convenience method to collect stats on the fitness in each layer. We
* collect the average and max fitness for each layer.
*
* @param generation
* the current generation number
*/
public void layerFitnessStats(int generation) {
// Output the generation number first
StringBuilder output = new StringBuilder();
output.append(String
.format("%s\t%s", generation, this.totalEvaluations));
// For each layer, output the max (for now) fitness.
for (int i = 0; i < population.size(); i++) {
Vector<Individual> layer = population.get(i);
if (!layer.isEmpty()) {
// Find the average and max fitness for the layer.
double avgFitness = 0, maxFitness = 0;
for (Individual individual : layer) {
double fitness = individual.getFitness();
avgFitness += fitness;
if (fitness > maxFitness) {
maxFitness = fitness;
}
}
avgFitness /= layer.size();
output.append(String.format("\t%f:%f", avgFitness, maxFitness));
} else {
output.append("\t0:0");
}
}
// Fill zeroes for non-existent layers.
for (int i = population.size(); i < totalLayers; i++) {
output.append("\t0:0");
}
// Write the record
Utils.writeOutput(output.toString(), this.layerFitnessOutput);
}
@Override
public void preGenerationStats(int generation) {
}
@Override
public void postEvaluationStats(int generation) {
// Do the layer fitness stats.
layerFitnessStats(generation);
// Output the tree stats
treeStats(generation);
}
@Override
public void postGenerationStats(int generation) {
}
@Override
public void postEvolutionStats(int generation) {
// Do a final post-eval stats since it wouldn't get called otherwise.
postEvaluationStats(generation);
}
}
| [
"[email protected]"
] | |
16a2af131f63719611af93ec86578caf7a7ab55d | 39dbead843405f0e2536a581bf10aed6cb08c2f4 | /Monopoly/src/gui/NewGamePanel.java | 23521795d85d7661cc1dca983872a482b53288e2 | [] | no_license | MacedoRAC/LPOO | 4de0d508a8b7efbbaaa2819ff82f47232fe773be | a753679e359710ec047c41f551612f7551bf880e | refs/heads/master | 2021-01-15T11:43:42.664665 | 2014-06-09T04:55:42 | 2014-06-09T04:55:42 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 4,669 | java | /**
*
*/
package gui;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JSpinner;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JLabel;
import javax.swing.SpinnerNumberModel;
import javax.swing.JButton;
/**
* @author André
*
*/
public class NewGamePanel extends JPanel{
/**
*
*/
private static final long serialVersionUID = 1L;
private BufferedImage background;
private JComboBox<String> gameMode;
private JSpinner numbPlayersSpinner;
private JLabel lblNumberOfPlayers;
private JButton btnPlay;
private JButton btnBack;
public NewGamePanel(){
setSize(416,416);
setEnabled(true);
requestFocus(true);
gameMode = new JComboBox<String>();
gameMode.setModel(new DefaultComboBoxModel<String>(new String[] {"Local Mode", "LAN Mode"}));
gameMode.setMaximumRowCount(2);
gameMode.setForeground(new Color(255, 255, 255));
gameMode.setBackground(new Color(153, 0, 0));
numbPlayersSpinner = new JSpinner();
numbPlayersSpinner.setModel(new SpinnerNumberModel(2, 2, 4, 1));
numbPlayersSpinner.setForeground(new Color(255, 255, 255));
numbPlayersSpinner.setBackground(new Color(153, 0, 0));
lblNumberOfPlayers = new JLabel("Number of Players");
lblNumberOfPlayers.setForeground(new Color(255, 255, 255));
btnPlay = new JButton("Play");
btnPlay.setBackground(new Color(153, 0, 0));
btnPlay.setForeground(new Color(255, 255, 255));
btnBack = new JButton("Back");
btnBack.setForeground(new Color(255, 255, 255));
btnBack.setBackground(new Color(153, 0, 0));
setupButtons();
layoutConfig();
try {
background = ImageIO.read(new File("src/Images/initial.jpg")) ;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void layoutConfig() {
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(btnPlay)
.addGap(18)
.addComponent(btnBack))
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(gameMode, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(lblNumberOfPlayers)
.addGap(4)
.addComponent(numbPlayersSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
.addContainerGap(280, Short.MAX_VALUE))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(gameMode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNumberOfPlayers)
.addComponent(numbPlayersSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(btnPlay)
.addComponent(btnBack))
.addContainerGap(325, Short.MAX_VALUE))
);
setLayout(groupLayout);
}
private void setupButtons() {
//PLAY BUTTON
btnPlay.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String mode = (String) gameMode.getSelectedItem();
int np = (int)numbPlayersSpinner.getValue();
GameConfigPanel panel = new GameConfigPanel(mode, np);
getRootPane().setContentPane(panel);
}
});
//BACK BUTTON
btnBack.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
getRootPane().setContentPane(new InitialPanel());
}
});
}
/**
* Print images
*/
protected void paintComponent(Graphics g){
requestFocus(true);
setFocusable(true);
g.drawImage(background, 0, 0, this.getWidth(), this.getHeight(), Color.WHITE, null);
}
}
| [
"[email protected]"
] | |
2fc7a610767fc8b8216e827a688e434189cff2c0 | 567df04d5e8fad2a89f4d7a30464c17a42fc76f9 | /src/main/java/com/selfboot/chandao/service/PermissionService.java | 3f40e78b72e702c2fd762062fb8c30d85ab3ea14 | [] | no_license | xianluyanchen/chandao | a0af6404ef9d9d9a4762e8b021ee4ebc76ad29ee | 48a563af62071b88bbbea220c7e65728672fa21f | refs/heads/master | 2020-04-30T13:11:29.585503 | 2019-03-20T15:09:24 | 2019-03-20T15:09:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 120 | java | package com.selfboot.chandao.service;
/**
* Created by 87570 on 2019/3/18.
*/
public interface PermissionService {
}
| [
"[email protected]"
] | |
1d673063c8aadea0c74baa9f8c2070057a753523 | 4fab44e9f3205863c0c4e888c9de1801919dc605 | /AL-Game/data/scripts/system/handlers/quest/steel_rake/_3208ThePuzzlingBlueprint.java | 01460bf3685f5690e16f3649241e6b56e7a4edd6 | [] | no_license | YggDrazil/AionLight9 | fce24670dcc222adb888f4a5d2177f8f069fd37a | 81f470775c8a0581034ed8c10d5462f85bef289a | refs/heads/master | 2021-01-11T00:33:15.835333 | 2016-07-29T19:20:11 | 2016-07-29T19:20:11 | 70,515,345 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | /**
* This file is part of Aion-Lightning <aion-lightning.org>.
*
* Aion-Lightning 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.
*
* Aion-Lightning 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 Aion-Lightning.
* If not, see <http://www.gnu.org/licenses/>.
*/
package quest.steel_rake;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
/**
* @author vlog TODO: implement
*/
public class _3208ThePuzzlingBlueprint extends QuestHandler {
private static final int questId = 3208;
public _3208ThePuzzlingBlueprint() {
super(questId);
}
/*
* (non-Javadoc)
* @see com.aionemu.gameserver.questEngine.handlers.QuestHandler#register()
*/
@Override
public void register() {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
4f769c43d32168745e31d5e84ba5fb0ed845ef55 | bae56479cd4b43641564ab57ffe05fdcecfce064 | /AndroidStudioProjects/FAW/app/src/main/java/com/example/faw/ui/dashboard/DashboardViewModel.java | 311982fdbef9b347e6aba4c8aa400bfe3c66a74b | [] | no_license | flynnm20/SE-Project-Group-7 | 94a1911b95a2020b0b0e605f30f1d41abd9cba89 | 0731232f3840f94bd525a162b72aa613e1356d6f | refs/heads/master | 2020-12-29T18:18:30.527436 | 2020-04-17T15:20:38 | 2020-04-17T15:20:38 | 238,696,720 | 2 | 1 | null | 2020-03-13T14:15:56 | 2020-02-06T13:35:56 | Java | UTF-8 | Java | false | false | 458 | java | package com.example.faw.ui.dashboard;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class DashboardViewModel extends ViewModel {
private MutableLiveData<String> mText;
public DashboardViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"[email protected]"
] | |
baf7fe5959add79b7447d74ec1168ccea4afd49a | 8bfab603e87d2aa378985c9fde64ba26c08fec15 | /src/main/java/com/cch/seckill/config/UserArgumentResolver.java | da700a4f1b26da7dabad19db9934bbc1f3c3b6d3 | [] | no_license | chenghaochen1993/seckill | a37ac48d5137278aa96ff9180bd221c8e395802b | 728ec8608bd8d3da06bebdc2bbef6afa0dbd1689 | refs/heads/master | 2021-09-09T16:52:03.574340 | 2018-03-18T10:20:45 | 2018-03-18T10:20:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,362 | java | package com.cch.seckill.config;
import com.cch.seckill.access.UserContext;
import com.cch.seckill.domain.MiaoshaUser;
import com.cch.seckill.service.MiaoshaUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by [email protected]
* 2018-03-03 23:23.
*/
@Service
public class UserArgumentResolver implements HandlerMethodArgumentResolver {
public boolean supportsParameter(MethodParameter parameter) {
Class<?> clazz = parameter.getParameterType();
return clazz==MiaoshaUser.class;
}
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
return UserContext.getUser();
}
}
| [
"[email protected]"
] | |
6ef9bf0e70de38caa3c688a3ecf6bb2d0c9c0fe0 | 4a744003d8992800cf38bc6c73afaf7fc6839742 | /sources/okhttp3/internal/cache/CacheInterceptor.java | f7f712933a0b876bd2e3ec337d5a1d420531be26 | [] | no_license | M-Ash2209/base_source_from_JADX | 97332cdbb197f37a0ed398a2d6c8f6e7c086393b | ad92a77393d4b6c61fe0b65ede9dfb495ca44a7e | refs/heads/main | 2023-02-02T11:27:36.336750 | 2020-12-19T08:06:35 | 2020-12-19T08:06:35 | 322,803,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,396 | java | package okhttp3.internal.cache;
import com.silkimen.http.HttpRequest;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.Internal;
import okhttp3.internal.Util;
import okhttp3.internal.cache.CacheStrategy;
import okhttp3.internal.http.HttpHeaders;
import okhttp3.internal.http.HttpMethod;
import okhttp3.internal.http.RealResponseBody;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.Okio;
import okio.Sink;
import okio.Source;
import okio.Timeout;
public final class CacheInterceptor implements Interceptor {
final InternalCache cache;
public CacheInterceptor(InternalCache internalCache) {
this.cache = internalCache;
}
public Response intercept(Interceptor.Chain chain) throws IOException {
InternalCache internalCache = this.cache;
Response response = internalCache != null ? internalCache.get(chain.request()) : null;
CacheStrategy cacheStrategy = new CacheStrategy.Factory(System.currentTimeMillis(), chain.request(), response).get();
Request request = cacheStrategy.networkRequest;
Response response2 = cacheStrategy.cacheResponse;
InternalCache internalCache2 = this.cache;
if (internalCache2 != null) {
internalCache2.trackResponse(cacheStrategy);
}
if (response != null && response2 == null) {
Util.closeQuietly((Closeable) response.body());
}
if (request == null && response2 == null) {
return new Response.Builder().request(chain.request()).protocol(Protocol.HTTP_1_1).code(504).message("Unsatisfiable Request (only-if-cached)").body(Util.EMPTY_RESPONSE).sentRequestAtMillis(-1).receivedResponseAtMillis(System.currentTimeMillis()).build();
}
if (request == null) {
return response2.newBuilder().cacheResponse(stripBody(response2)).build();
}
try {
Response proceed = chain.proceed(request);
if (proceed == null && response != null) {
}
if (response2 != null) {
if (proceed.code() == 304) {
Response build = response2.newBuilder().headers(combine(response2.headers(), proceed.headers())).sentRequestAtMillis(proceed.sentRequestAtMillis()).receivedResponseAtMillis(proceed.receivedResponseAtMillis()).cacheResponse(stripBody(response2)).networkResponse(stripBody(proceed)).build();
proceed.body().close();
this.cache.trackConditionalCacheHit();
this.cache.update(response2, build);
return build;
}
Util.closeQuietly((Closeable) response2.body());
}
Response build2 = proceed.newBuilder().cacheResponse(stripBody(response2)).networkResponse(stripBody(proceed)).build();
if (this.cache != null) {
if (HttpHeaders.hasBody(build2) && CacheStrategy.isCacheable(build2, request)) {
return cacheWritingResponse(this.cache.put(build2), build2);
}
if (HttpMethod.invalidatesCache(request.method())) {
try {
this.cache.remove(request);
} catch (IOException unused) {
}
}
}
return build2;
} finally {
if (response != null) {
Util.closeQuietly((Closeable) response.body());
}
}
}
private static Response stripBody(Response response) {
return (response == null || response.body() == null) ? response : response.newBuilder().body((ResponseBody) null).build();
}
private Response cacheWritingResponse(final CacheRequest cacheRequest, Response response) throws IOException {
Sink body;
if (cacheRequest == null || (body = cacheRequest.body()) == null) {
return response;
}
final BufferedSource source = response.body().source();
final BufferedSink buffer = Okio.buffer(body);
C04691 r2 = new Source() {
boolean cacheRequestClosed;
public long read(Buffer buffer, long j) throws IOException {
try {
long read = source.read(buffer, j);
if (read == -1) {
if (!this.cacheRequestClosed) {
this.cacheRequestClosed = true;
buffer.close();
}
return -1;
}
buffer.copyTo(buffer.buffer(), buffer.size() - read, read);
buffer.emitCompleteSegments();
return read;
} catch (IOException e) {
if (!this.cacheRequestClosed) {
this.cacheRequestClosed = true;
cacheRequest.abort();
}
throw e;
}
}
public Timeout timeout() {
return source.timeout();
}
public void close() throws IOException {
if (!this.cacheRequestClosed && !Util.discard(this, 100, TimeUnit.MILLISECONDS)) {
this.cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
return response.newBuilder().body(new RealResponseBody(response.header(HttpRequest.HEADER_CONTENT_TYPE), response.body().contentLength(), Okio.buffer((Source) r2))).build();
}
private static Headers combine(Headers headers, Headers headers2) {
Headers.Builder builder = new Headers.Builder();
int size = headers.size();
for (int i = 0; i < size; i++) {
String name = headers.name(i);
String value = headers.value(i);
if ((!"Warning".equalsIgnoreCase(name) || !value.startsWith("1")) && (isContentSpecificHeader(name) || !isEndToEnd(name) || headers2.get(name) == null)) {
Internal.instance.addLenient(builder, name, value);
}
}
int size2 = headers2.size();
for (int i2 = 0; i2 < size2; i2++) {
String name2 = headers2.name(i2);
if (!isContentSpecificHeader(name2) && isEndToEnd(name2)) {
Internal.instance.addLenient(builder, name2, headers2.value(i2));
}
}
return builder.build();
}
static boolean isEndToEnd(String str) {
return !"Connection".equalsIgnoreCase(str) && !"Keep-Alive".equalsIgnoreCase(str) && !"Proxy-Authenticate".equalsIgnoreCase(str) && !HttpRequest.HEADER_PROXY_AUTHORIZATION.equalsIgnoreCase(str) && !"TE".equalsIgnoreCase(str) && !"Trailers".equalsIgnoreCase(str) && !"Transfer-Encoding".equalsIgnoreCase(str) && !"Upgrade".equalsIgnoreCase(str);
}
static boolean isContentSpecificHeader(String str) {
return HttpRequest.HEADER_CONTENT_LENGTH.equalsIgnoreCase(str) || HttpRequest.HEADER_CONTENT_ENCODING.equalsIgnoreCase(str) || HttpRequest.HEADER_CONTENT_TYPE.equalsIgnoreCase(str);
}
}
| [
"[email protected]"
] | |
22fd496fefdc091d890322887f62917ca610153a | b4e56be79cbfe9e0bb0e5c2c7c69272cfdda82e9 | /src/com/redmintie/fractals/NineTriangles.java | 120c21630abe829bc27f001935be91b1788ce080 | [
"MIT"
] | permissive | matanui159/Fractals | 6afb22070bcb380ebf3674e8e76099372d22cf07 | d5945efca45cff8c994384e10d9421f2d8cb9ab1 | refs/heads/master | 2021-01-10T07:16:09.122943 | 2016-02-20T04:09:56 | 2016-02-20T04:09:56 | 51,628,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,748 | java | package com.redmintie.fractals;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
/*
* Used for my Maths C assignment to demonstrate how you can split up a triangle into 9 smaller triangles.
*/
public class NineTriangles {
public static final int IMAGE_SIZE = 1000;
public static final int TRIANGLE_SIZE = 900;
public static final double TRIANGLE_HEIGHT = Math.sqrt(0.75);
public static final int LINE_THICKNESS = 2;
public static void main(String[] args) {
System.out.println("Creating Image...");
double halfImage = IMAGE_SIZE / 2.0;
double halfSide = TRIANGLE_SIZE / 2.0;
double halfHeight = halfSide * TRIANGLE_HEIGHT;
double x1 = halfImage;
double y1 = halfImage - halfHeight;
double x2 = halfImage - halfSide;
double y2 = halfImage + halfHeight;
double x3 = halfImage + halfSide;
double y3 = halfImage + halfHeight;
double m1 = x1 + (x2 - x1) / 3;
double n1 = y1 + (y2 - y1) / 3;
double z1 = x1 + (x2 - x1) / 3 * 2;
double w1 = y1 + (y2 - y1) / 3 * 2;
double m2 = x2 + (x3 - x2) / 3;
double n2 = y2 + (y3 - y2) / 3;
double z2 = x2 + (x3 - x2) / 3 * 2;
double w2 = y2 + (y3 - y2) / 3 * 2;
double m3 = x3 + (x1 - x3) / 3;
double n3 = y3 + (y1 - y3) / 3;
double z3 = x3 + (x1 - x3) / 3 * 2;
double w3 = y3 + (y1 - y3) / 3 * 2;
double cx = (x1 + x2 + x3) / 3;
double cy = (y1 + y2 + y3) / 3;
BufferedImage img = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = img.createGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setBackground(Color.WHITE);
g.setColor(Color.BLACK);
g.setStroke(new BasicStroke(LINE_THICKNESS));
g.clearRect(0, 0, IMAGE_SIZE, IMAGE_SIZE);
g.drawLine((int)x1, (int)y1, (int)x2, (int)y2);
g.drawLine((int)x2, (int)y2, (int)x3, (int)y3);
g.drawLine((int)x3, (int)y3, (int)x1, (int)y1);
g.drawLine((int)cx, (int)cy, (int)m1, (int)n1);
g.drawLine((int)cx, (int)cy, (int)z1, (int)w1);
g.drawLine((int)cx, (int)cy, (int)m2, (int)n2);
g.drawLine((int)cx, (int)cy, (int)z2, (int)w2);
g.drawLine((int)cx, (int)cy, (int)m3, (int)n3);
g.drawLine((int)cx, (int)cy, (int)z3, (int)w3);
g.drawLine((int)z1, (int)w1, (int)m2, (int)n2);
g.drawLine((int)z2, (int)w2, (int)m3, (int)n3);
g.drawLine((int)z3, (int)w3, (int)m1, (int)n1);
try {
ImageIO.write(img, "PNG", Util.createFile("fractals/triangles.png"));
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println("Done!");
}
} | [
"[email protected]"
] | |
c0d0e0de2d8b36ff8501ee0d92e76c6a96ef2b7d | f1b39c85dfa176c82a241fb0da39c482ce5e5725 | /src/jp/nichicom/ac/lib/care/claim/servicecode/SC_15313_201204.java | ccd0a0baea2918684975e00ce5091d4f9dfb4edc | [] | no_license | linuxmaniajp/qkan | 114bb9665a6b2e6b278d2fd7ed5619d74e5c2337 | 30c0513399e49828ca951412e21a22a058868729 | refs/heads/master | 2021-05-23T18:48:48.477599 | 2018-04-23T04:27:09 | 2018-04-23T04:27:09 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 19,655 | java | package jp.nichicom.ac.lib.care.claim.servicecode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import jp.nichicom.ac.lang.ACCastUtilities;
import jp.nichicom.ac.sql.ACDBManager;
import jp.nichicom.vr.util.VRArrayList;
import jp.nichicom.vr.util.VRList;
import jp.nichicom.vr.util.VRMap;
import jp.or.med.orca.qkan.QkanCommon;
/**
* 介護療養型医療施設(老人性認知症疾患療養病棟を有する病院)
*
* @since V6.0.0
* @author Masahiko.Higuchi
*
*/
public class SC_15313_201204 extends Qkan10011_ServiceUnitGetter {
private int _1530358 = 0;
private final String PATH_UNIT_ROOM = "1530312";
private final String PATH_UNIT_SEMI_ROOM = "1530313";
private final String PATH_NORMAL_ROOM = "1530314";
private final String PATH_TASHO_ROOM = "1530315";
public String getServiceName() {
return "介護療養型医療施設(老人性認知症疾患療養病棟を有する病院)";
}
public String getServiceCodeKind() {
return "53";
}
public String getSystemServiceKindDetail() {
return "15313";
}
public ArrayList<HashMap<String, String>> getSystemServiceCodeItem(
Map<String, String> map) {
ArrayList<HashMap<String, String>> sysSvcCdItems = new ArrayList<HashMap<String, String>>();
// パラメータ抽出
// =========================================================================
// 1530301 施設区分
int _1530301 = getIntValue(map, "1530301");
// 1530316 病院区分
int _1530316 = getIntValue(map, "1530316");
// 1530302 人員配置区分
int _1530302 = getIntValue(map, "1530302");
// 1530303 病室区分(従来型)
int _1530303 = getIntValue(map, "1530303");
// 1530304 病室区分(ユニット型)
int _1530304 = getIntValue(map, "1530304");
// 病室区分
int byoshitsu = 1;
switch (_1530301) {
case 1:
case 3:
byoshitsu = convertByoshitsuKbn(_1530303, false);
break;
case 2:
byoshitsu = convertByoshitsuKbn(_1530304, true);
break;
}
// 1 要介護度
int _1 = convertYokaigodo(getIntValue(map, "1"));
// 1530355 人員減算
int _1530355 = getIntValue(map, "1530355");
// 1530313 ユニットケアの整備
int _1530313 = getIntValue(map, "1530313");
// 1530314 身体拘束廃止未実施減算
int _1530314 = getIntValue(map, "1530314");
// 1530305 外泊加算
int _1530305 = getIntValue(map, "1530305");
// 1530307 他科受診加算
int _1530307 = getIntValue(map, "1530307");
// 1530306 初期加算
int _1530306 = getIntValue(map, "1530306");
// 3020105 退所時指導加算
int _3020105 = getIntValue(map, "3020105");
// 3020106 退所時情報提供加算
int _3020106 = getIntValue(map, "3020106");
// 3020107 退所前連携加算
int _3020107 = getIntValue(map, "3020107");
// 3020108 老人訪問看護指示加算
int _3020108 = getIntValue(map, "3020108");
// 1530309 栄養マネジメント加算
int _1530309 = getIntValue(map, "1530309");
// 1530310 経口移行加算
int _1530310 = getIntValue(map, "1530310");
// 1530312 経口維持加算
int _1530312 = getIntValue(map, "1530312");
// 1530311 療養食加算
int _1530311 = getIntValue(map, "1530311");
// 1530315 在宅復帰支援機能加算
int _1530315 = getIntValue(map, "1530315");
// 1530356 食事提供
int _1530356 = getIntValue(map, "1530356");
// 1530358 食費
this._1530358 = getIntValue(map, "1530358");
// 1530359 口腔機能維持管理加算
int _1530359 = getIntValue(map, "1530359");
// 1530360 サービス提供体制強化加算
int _1530360 = getIntValue(map, "1530360");
// 1530361 口腔機能維持管理体制加算
int _1530361 = getIntValue(map, "1530361");
// 3020109 退所(院)前訪問指導加算
int _3020109 = getIntValue(map, "3020109", 1);
// 3020110 退所(院)後訪問指導加算
int _3020110 = getIntValue(map, "3020110", 1);
// 17 介護職員処遇改善加算
int _17 = getIntValue(map,
Qkan10011_ServiceUnitGetter.SYOGUKAIZEN_KASAN, 1);
// 単独加算
int _9 = getIntValue(map, "9");
// 単独加算のみ---------------------------------------------------------------
// 単独加算サービス
if (_9 == 2) {
// 退所(院)後訪問指導加算
if (_3020110 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4856");
}
// 介護職員処遇改善を返却
switch (_17) {
case 2:
putSystemServiceCodeItem(sysSvcCdItems, "Z4711");
break;
case 3:
putSystemServiceCodeItem(sysSvcCdItems, "Z4712");
break;
case 4:
putSystemServiceCodeItem(sysSvcCdItems, "Z4713");
break;
}
return sysSvcCdItems;
}
// 独自コード生成
// ===========================================================================
StringBuilder sb = new StringBuilder();
// 施設区分
sb.append(CODE_CHAR[_1530301]);
// 病院区分(大学/一般病院)
sb.append(CODE_CHAR[_1530316]);
// 人員配置区分
sb.append(CODE_CHAR[_1530302]);
// 病室区分(従来型個室/多床室)
sb.append(CODE_CHAR[_1530303]);
// 病室区分(ユニット型個室/ユニット型準個室)
sb.append(CODE_CHAR[_1530304]);
// 要介護度
sb.append(CODE_CHAR[_1]);
// 人員減算
sb.append(CODE_CHAR[_1530355]);
// ユニットケアの整備
switch (_1530301) {
case 1: //認知症疾患型
case 3: //経過型
sb.append(DEFAULT_CHAR);
break;
case 2: //ユニット型
if (_1530313 > 1) {
sb.append(DEFAULT_CHAR);
} else {
sb.append(CODE_CHAR[2]);
}
break;
}
putSystemServiceCodeItem(sysSvcCdItems, sb.toString());
// 加算
// ============================================================================
// 身体拘束廃止未実施減算
if (_1530314 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4834");
}
// 外泊加算
if (_1530305 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4830");
}
// 他科受診加算
if (_1530307 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4831");
}
// 初期加算
if (_1530306 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4840");
}
// 退所(院)前訪問指導加算
if (_3020109 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4851");
}
// 退所(院)後訪問指導加算
if (_3020110 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4856");
}
// 退所時指導加算
if (_3020105 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4852");
}
// 退所時情報提供加算
if (_3020106 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4854");
}
// 退所前連携加算
if (_3020107 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4855");
}
// 老人訪問看護指示加算
if (_3020108 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4853");
}
// 栄養マネジメント加算
if (_1530309 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4773");
}
// 経口移行加算
if (_1530310 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4774");
}
// 経口維持加算
switch (_1530312) {
case 2:
putSystemServiceCodeItem(sysSvcCdItems, "Z4780");
break;
case 3:
putSystemServiceCodeItem(sysSvcCdItems, "Z4781");
break;
}
// 口腔機能維持管理体制加算
if (_1530361 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4707");
}
// 口腔機能維持管理加算
if (_1530359 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4710");
}
// 療養食加算
if (_1530311 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4775");
}
// 在宅復帰支援機能加算
if (_1530315 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, "Z4778");
}
switch (_1530360) {
case 2:
// Z4701 認知症型サービス提供体制加算I
putSystemServiceCodeItem(sysSvcCdItems, "Z4701");
break;
case 3:
// Z4702 認知症型サービス提供体制加算II
putSystemServiceCodeItem(sysSvcCdItems, "Z4702");
break;
case 4:
// Z4703 認知症型サービス提供体制加算III
putSystemServiceCodeItem(sysSvcCdItems, "Z4703");
break;
}
// 介護職員処遇改善を返却
switch (_17) {
case 2:
putSystemServiceCodeItem(sysSvcCdItems, "Z4711");
break;
case 3:
putSystemServiceCodeItem(sysSvcCdItems, "Z4712");
break;
case 4:
putSystemServiceCodeItem(sysSvcCdItems, "Z4713");
break;
}
// 特定入所者チェックがついていた場合は個室の単位数を追加
if (!new Integer(1).equals(map.get("7")) && !"1".equals(map.get("7"))) {
// 食事提供
if (_1530356 > 1) {
putSystemServiceCodeItem(sysSvcCdItems, SERVICE_CODE_SHOKUHI);
}
// 外泊である場合は初期化する
if (_1530305 > 1) {
sysSvcCdItems = new ArrayList<HashMap<String, String>>();
}
// 滞在費 --------
putSystemServiceCodeItem(sysSvcCdItems,
getSystemServiceCodeOfRoom(byoshitsu));
}// チェックがついていない場合は何も返さない
// 他科受信があった場合は一律他科受信のコードを返す
// 念のため外泊より優先する。
if (_1530307 > 1) {
// 内部サービスコードを初期化
// 栄養マネジメント加算・栄養管理体制加算・食費・ホテルコスト以外は削除する。
for (int i = sysSvcCdItems.size() - 1; i >= 0; i--) {
Map<String, String> serviceMap = new HashMap<String, String>();
// レコード取得
serviceMap = sysSvcCdItems.get(i);
// 算定可能なレコードである場合は削除しない
// 他科受診加算算定時に削除対象外とする加算に、経口移行加算・療養食加算・経口維持加算を追加する。
String tempItem = ACCastUtilities.toString(
serviceMap.get("SYSTEM_SERVICE_CODE_ITEM"), "");
if (!"Z4771".equals(tempItem) && !"Z4772".equals(tempItem)
&& !"Z4773".equals(tempItem)
&& !SERVICE_CODE_SHOKUHI.equals(tempItem)
&& !SERVICE_CODE_NORMAL_ROOM.equals(tempItem)
&& !SERVICE_CODE_TASHO_ROOM.equals(tempItem)
&& !SERVICE_CODE_UNIT_ROOM.equals(tempItem)
&& !SERVICE_CODE_UNIT_SEMI_ROOM.equals(tempItem)
&& !"Z4774".equals(tempItem)
&& !"Z4775".equals(tempItem)
&& !"Z4780".equals(tempItem)
&& !"Z4781".equals(tempItem)) {
sysSvcCdItems.remove(i);
}
}
// 他科受信にあたるサービスコードを追加
putSystemServiceCodeItem(sysSvcCdItems, "Z4831");
// 介護職員処遇改善を返却
switch (_17) {
case 2:
putSystemServiceCodeItem(sysSvcCdItems, "Z4711");
break;
case 3:
putSystemServiceCodeItem(sysSvcCdItems, "Z4712");
break;
case 4:
putSystemServiceCodeItem(sysSvcCdItems, "Z4713");
break;
}
// 値を返す
return sysSvcCdItems;
}
// 外泊がありだった場合は一律外泊のコードを返す
if (_1530305 > 1) {
// 特定施設入所以外の場合は初期化処理
if (new Integer(1).equals(map.get("7")) || "1".equals(map.get("7"))) {
// 内部サービスコードを初期化
sysSvcCdItems = new ArrayList<HashMap<String, String>>();
}
// 外泊にあたるサービスコードを追加
putSystemServiceCodeItem(sysSvcCdItems, "Z4830");
// 介護職員処遇改善を返却
switch (_17) {
case 2:
putSystemServiceCodeItem(sysSvcCdItems, "Z4711");
break;
case 3:
putSystemServiceCodeItem(sysSvcCdItems, "Z4712");
break;
case 4:
putSystemServiceCodeItem(sysSvcCdItems, "Z4713");
break;
}
}
return sysSvcCdItems;
}
public ArrayList<VRMap> getServiceCode(Map<String, String> map,
ACDBManager dbm) {
ArrayList<VRMap> al = super.getServiceCode(map, dbm);
Map<String, Integer> mp = null;
// 特定入所者チェックがついてなかった場合は食費を上書きせずに返す
//[ID:0000749][Shin Fujihara] 2012/10 edit begin 2012年度対応 特定入所者の履歴管理機能
// if (new Integer(1).equals(map.get("7")) || "1".equals(map.get("7"))) {
// // 食費は必要ないためデータを消す
// return al;
// }
if (ACCastUtilities.toInt(map.get("7"), 1) != 2) {
//食費は必要ないためデータを消す
return al;
}
//[ID:0000749][Shin Fujihara] 2012/10 edit end 2012年度対応 特定入所者の履歴管理機能
// 事業所情報の取得
VRList temp = new VRArrayList();
try {
temp = QkanCommon.getProviderServiceDetail(dbm,
ACCastUtilities.toString(map.get("PROVIDER_ID")),
ACCastUtilities.toInt(getSystemServiceKindDetail(), 0));
} catch (Exception e) {
return al;
}
VRMap providerInfo = (VRMap) temp.get(0);
for (int i = 0; i < al.size(); i++) {
mp = (Map<String, Integer>) al.get(i);
String val = ACCastUtilities.toString(
mp.get("SYSTEM_SERVICE_CODE_ITEM"), "");
if (SERVICE_CODE_SHOKUHI.equals(val)) {
// 食費のレコード
if (this._1530358 <= 0) {
// 食費が0円以下の場合
// 該当レコードを削除する。
al.remove(i);
// 削除したためインデックスを1つ戻す。
i--;
} else {
// 食費が0円以下でない場合
// 食費を業務から渡された値で上書きする。
mp.put("SERVICE_UNIT", new Integer(this._1530358));
}
} else if (SERVICE_CODE_UNIT_ROOM.equals(val)) {
// ユニット型個室のレコード
// 費用単価が0以下で設定されている場合、戻り値から削除
// ユニット型個室の費用単価を取得
int unitRoom = ACCastUtilities.toInt(
providerInfo.get(this.PATH_UNIT_ROOM), 0);
if (unitRoom <= 0) {
// 該当レコードを削除する。
al.remove(i);
// 削除したためインデックスを1つ戻す。
i--;
}
} else if (SERVICE_CODE_UNIT_SEMI_ROOM.equals(val)) {
// ユニット型準個室のレコード
// 費用単価が0以下で設定されている場合、戻り値から削除
// ユニット型準個室の費用単価を取得
int unitSemiRoom = ACCastUtilities.toInt(
providerInfo.get(this.PATH_UNIT_SEMI_ROOM), 0);
if (unitSemiRoom <= 0) {
// 該当レコードを削除する。
al.remove(i);
// 削除したためインデックスを1つ戻す。
i--;
}
} else if (SERVICE_CODE_NORMAL_ROOM.equals(val)) {
// 従来型個室のレコード
// 費用単価が0以下で設定されている場合、戻り値から削除
// 従来型個室の費用単価を取得
int normalRoom = ACCastUtilities.toInt(
providerInfo.get(this.PATH_NORMAL_ROOM), 0);
if (normalRoom <= 0) {
// 該当レコードを削除する。
al.remove(i);
// 削除したためインデックスを1つ戻す。
i--;
}
} else if (SERVICE_CODE_TASHO_ROOM.equals(val)) {
// 多床室のレコード
// 費用単価が0以下で設定されている場合、戻り値から削除
// 多床室の費用単価を取得
int tashoRoom = ACCastUtilities.toInt(
providerInfo.get(this.PATH_TASHO_ROOM), 0);
if (tashoRoom <= 0) {
// 該当レコードを削除する。
al.remove(i);
// 削除したためインデックスを1つ戻す。
i--;
}
}
}
return al;
}
}
| [
"[email protected]"
] | |
71709f0cb3a567d13cd6d992936d9fede9cd8706 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project110/src/main/java/org/gradle/test/performance/largejavamultiproject/project110/p554/Production11084.java | bb274b9a62e64bde22a35b74c78378de79be1f01 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,889 | java | package org.gradle.test.performance.largejavamultiproject.project110.p554;
public class Production11084 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"[email protected]"
] | |
8451428ac43db71339f0a313c6e9cebf103560d7 | 2deeebb97ec482e7edfcc889f0f8aaa0b5adb2dc | /src/test/java/com/sachin/GraphQLOrder/GraphQlOrderApplicationTests.java | 88a9a54907369e472d6de672d1d572a4a04d37cb | [
"MIT"
] | permissive | sachinp97/GraphQLSpringBootAPI | c3893a44698251b746135cb15d87fcc37c1bc916 | 0125b194ddf1e1d9705d3ca69360028cb7f61d7d | refs/heads/main | 2023-04-03T11:49:40.697106 | 2021-03-30T21:20:05 | 2021-03-30T21:20:05 | 353,139,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.sachin.GraphQLOrder;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class GraphQlOrderApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
e37ceb06cd9bda3411c6f33e464c11878dfb4d19 | 920e37fbb02ca9575d8b4d4efb237d57b70a9da8 | /src/org/jgrapht/alg/AbstractPathElementList.java | 18dd126c48afbad9f52775f568db40aaed87f8c0 | [] | no_license | ryanleong/acoustic-localization | 04b0d1c6233c520e7f6a365d7ce677ab6b0affdf | 860292aa92f44e7bb17688d12017200505ac15b1 | refs/heads/master | 2021-05-26T14:49:45.448817 | 2013-10-26T01:06:22 | 2013-10-26T01:06:22 | 13,875,525 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,329 | java | /*
* ==========================================
* JGraphT : a free Java graph-theory library
* ==========================================
*
* Project Info: http://jgrapht.sourceforge.net/
* Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
*
* (C) Copyright 2003-2010, by Barak Naveh and Contributors.
*
* 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.
*/
/*
* -------------------------
* AbstractPathElementList.java
* -------------------------
* (C) Copyright 2007-2010, by France Telecom
*
* Original Author: Guillaume Boulmier and Contributors.
* Contributor(s): John V. Sichi
*
* $Id: AbstractPathElementList.java 742 2011-03-12 23:06:31Z perfecthash $
*
* Changes
* -------
* 05-Jun-2007 : Initial revision (GB);
* 05-Jul-2007 : Added support for generics (JVS);
* 06-Dec-2010 : Bugfixes (GB);
*/
package org.jgrapht.alg;
import java.util.*;
import org.jgrapht.*;
/**
* List of paths <code>AbstractPathElement</code> with same target vertex.
*
* @author Guillaume Boulmier
* @since July 5, 2007
*/
abstract class AbstractPathElementList<V, E, T extends AbstractPathElement<V, E>> extends AbstractList<T>
{
// ~ Instance fields --------------------------------------------------------
protected Graph<V, E> graph;
/**
* Max number of stored paths.
*/
protected int maxSize;
/**
* Stored paths, list of <code>AbstractPathElement</code>.
*/
protected ArrayList<T> pathElements = new ArrayList<T> ();
/**
* Target vertex of the paths.
*/
protected V vertex;
// ~ Constructors -----------------------------------------------------------
/**
* Creates paths obtained by concatenating the specified edge to the
* specified paths.
*
* @param maxSize maximum number of paths the list is able to store.
* @param elementList paths, list of <code>AbstractPathElement</code>.
* @param edge edge reaching the end vertex of the created paths.
*
* @throws NullPointerException if the specified prevPathElementList or edge
* is <code>null</code>.
* @throws IllegalArgumentException if <code>maxSize</code> is negative or
* 0.
*/
protected AbstractPathElementList (Graph<V, E> graph, int maxSize, AbstractPathElementList<V, E, T> elementList, E edge)
{
if (maxSize <= 0)
{
throw new IllegalArgumentException ("maxSize is negative or 0");
}
if (elementList == null)
{
throw new NullPointerException ("elementList is null");
}
if (edge == null)
{
throw new NullPointerException ("edge is null");
}
this.graph = graph;
this.maxSize = maxSize;
this.vertex = Graphs.getOppositeVertex (graph, edge, elementList.getVertex ());
}
/**
* Creates a list with an empty path. The list size is 1.
*
* @param maxSize maximum number of paths the list is able to store.
*
* @throws NullPointerException if the specified path-element is <code>
* null</code>.
* @throws IllegalArgumentException if <code>maxSize</code> is negative or
* 0.
* @throws IllegalArgumentException if <code>pathElement</code> is not
* empty.
*/
protected AbstractPathElementList (Graph<V, E> graph, int maxSize, T pathElement)
{
if (maxSize <= 0)
{
throw new IllegalArgumentException ("maxSize is negative or 0");
}
if (pathElement == null)
{
throw new NullPointerException ("pathElement is null");
}
if (pathElement.getPrevEdge () != null)
{
throw new IllegalArgumentException ("path must be empty");
}
this.graph = graph;
this.maxSize = maxSize;
this.vertex = pathElement.getVertex ();
this.pathElements.add (pathElement);
}
/**
* Creates an empty list. The list size is 0.
*
* @param maxSize maximum number of paths the list is able to store.
*
* @throws IllegalArgumentException if <code>maxSize</code> is negative or
* 0.
*/
protected AbstractPathElementList (Graph<V, E> graph, int maxSize, V vertex)
{
if (maxSize <= 0)
{
throw new IllegalArgumentException ("maxSize is negative or 0");
}
this.graph = graph;
this.maxSize = maxSize;
this.vertex = vertex;
}
// ~ Methods ----------------------------------------------------------------
/**
* Returns path <code>AbstractPathElement</code> stored at the specified
* index.
*/
public T get(int index)
{
return this.pathElements.get (index);
}
/**
* Returns target vertex.
*/
public V getVertex()
{
return this.vertex;
}
/**
* Returns the number of paths stored in the list.
*/
public int size()
{
return this.pathElements.size ();
}
}
// End AbstractPathElementList.java
| [
"[email protected]"
] | |
9555a62fddaf271cd5b8e045cd17cb369c70a7a3 | 54e9a40aaf9f4193b1ee9e111a4d126c3e373948 | /final-framework-testng/src/com/training/pom/ProdchkPOMUFM_32.java | 574ee4f7a65e0bceae74dade2aef2fe5a4572434 | [] | no_license | gururkul/SeleniumProject | 0f6d4f333ace53301bc91a141b64230a16ae894f | a31bbe5099d9a9f2701c35e253e1410b8885d636 | refs/heads/master | 2022-07-15T17:41:25.741841 | 2019-10-31T12:40:28 | 2019-10-31T12:40:28 | 216,477,505 | 0 | 0 | null | 2022-06-29T17:43:18 | 2019-10-21T04:28:22 | Java | UTF-8 | Java | false | false | 1,681 | java | package com.training.pom;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;
public class ProdchkPOMUFM_32 {
private WebDriver driver;
public ProdchkPOMUFM_32(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
@FindBy(xpath="//div[@id='banner0']//div//img[@class='img-responsive']")
private WebElement PreSchUniform;
@FindBy(xpath="//div[@class='box-content']//div[2]//div[1]//div[1]//div[1]//a[1]//img[1]")
private WebElement Productclick;
//Royal blue T-shirt is not present,So selected Yellow Tshirt
@FindBy(xpath="//select[@id='input-option376']")
private WebElement Selsize;
@FindBy(xpath="//button[@id='button-cart']")
private WebElement AddToCart;
/*@FindBy(xpath="//button[@id='button-cart']")
private WebElement ChkCartItem;*/
@FindBy(xpath="//strong[contains(text(),'Checkout')]")
private WebElement Checkout;
public void ClickPreSchUniform() {
this.PreSchUniform.click();
}
public void Uniform() {
this.Productclick.click();
}
public void Selctsize() {
Select sel= new Select(Selsize);
sel.selectByVisibleText("42");
Selsize.click();
}
public void AddToCart() {
this.AddToCart.click();
}
public void ChkCartItem() {
WebElement Item= driver.findElement(By.xpath("//button[@class='btn btn-inverse btn-block btn-lg dropdown-toggle']"));
Item.click();
}
public void Checkout() {
this.Checkout.click();
}
}
| [
"[email protected]"
] | |
bf537e719f2529506798facdd30851a06ead444a | 000a4b227d970cdc6c8db192f4437698cb782721 | /plugins/kotlin/idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UseKotlinSubclassesOfMappedTypes.java | ae60682d178fe6cf7a0c18b54386b967420ddf86 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | trinhanhngoc/intellij-community | 2eb2f66a2a3a9456e7a0c5e7be1eaba03c38815d | 1d4a962cfda308a73e0a7ef75186aaa4b15d1e17 | refs/heads/master | 2022-11-03T21:50:47.859675 | 2022-10-19T16:39:57 | 2022-10-19T23:25:35 | 205,765,945 | 1 | 0 | Apache-2.0 | 2019-09-02T02:55:15 | 2019-09-02T02:55:15 | null | UTF-8 | Java | false | false | 202 | java | class UseKotlinSubclassesOfMappedTypes {
void test() {
Iterable<String> iterable = new KotlinIterableTraitTest();
Comparable<Integer> comparable = new KotlinComparableTest();
}
} | [
"[email protected]"
] | |
352f82e3cceeddb2436a84d1a289ca317ca0b483 | 7e483c1a0aca694734fe38b3f7bf3bed5775d17d | /webStudy03_framework/src/main/java/kr/or/ddit/board/dao/IBoardDAO.java | 1261d7966aaa266992e6e27a3e8add3c59d6719d | [] | no_license | NiniToto/JSP-Servlet | a247359069454957097e5b5923c5f0226ca20977 | 6073e4cc827879dfe973a5f8ffc2f2e931cb14c6 | refs/heads/master | 2023-06-15T00:32:34.310725 | 2020-09-29T08:28:18 | 2020-09-29T08:28:18 | 291,041,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package kr.or.ddit.board.dao;
import java.util.List;
import kr.or.ddit.enumpkg.ServiceResult;
import kr.or.ddit.vo.BoardVO;
import kr.or.ddit.vo.PagingVO;
public interface IBoardDAO {
public int createBoard(BoardVO board);
public int selectBoardCount(PagingVO<BoardVO> pagingVO);
public List<BoardVO> selectBoardList(PagingVO<BoardVO> pagingVO);
public BoardVO selectBoard(int bo_no);
public void incrementHit(int bo_no);
}
| [
"[email protected]"
] | |
2eee32534cb876490c73b27f1c8c1abb35fdaa63 | f66ccdfecf9a9d53a44c64a8d7b2693cdd08f36f | /shopping/src/com/util/JdbcUtil.java | 41a0eaeb0a959e3879db6af4f6c68a4e3a67bb96 | [] | no_license | wyxdream0211/MyProject | 334d831926243a452632c6f123a3d633d2728d98 | 0c495408e1ff27fd5e902b200b75ba3560f834a7 | refs/heads/master | 2021-01-20T03:54:27.030241 | 2017-04-27T14:39:27 | 2017-04-27T14:39:27 | 89,606,534 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,124 | java | package com.util;
import java.sql.*;
import java.util.List;
public class JdbcUtil {
private static String driver = "com.mysql.jdbc.Driver";
private String url = "jdbc:mysql://localhost:3306/shopping";
private String username = "hr";
private String password = "admin";
//private static Context context;
//private static DataSource ds;
private Connection connection;
private PreparedStatement pstm;
private ResultSet rs;
//加载数据库驱动
static{
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
/*static{
try {
context = new InitialContext();
ds = (DataSource)context.lookup("java:/comp/env/jdbc/mysqlds");
} catch (Exception e) {
e.printStackTrace();
}
}*/
//获取数据库连接对象
public Connection getConnection(){
try {
connection=DriverManager.getConnection(url,username,password);
//connection = ds.getConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return connection;
}
//对数据库增、删,改操作
public boolean updateByPrearedStatement(String sql,List<Object> params){
boolean flag=false;
try {
pstm=connection.prepareStatement(sql);
if(params!=null && params.size()>0){
for(int i=0;i<params.size();i++){
pstm.setObject(i+1, params.get(i));
}
}
int rownum=pstm.executeUpdate();
if(rownum > 0){
flag=true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return flag;
}
//查询数据库
public ResultSet queryByPreparedStatement(String sql,List<Object> params){
try {
pstm=connection.prepareStatement(sql);
if(params!=null && params.size()>0){
for(int i=0;i<params.size();i++){
pstm.setObject(i+1, params.get(i));
}
}
rs=pstm.executeQuery();
} catch (SQLException e) {
e.printStackTrace();
}
return rs;
}
//关闭数据库资源
public void close(){
if(connection!=null){
try {
if(rs!=null){
rs.close();
}
if(pstm!=null){
pstm.close();
}
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
0840fd6fca781704bfad8854707333268ef273f6 | 15c168ae0c0b5b738ef764e62bf94ce80ff5bb4c | /RecursionWithArrayList/GetSubsequence.java | 5d5534c4db95bf86f2c8bac655968599b8a1b451 | [] | no_license | devender1409/Data-Structures-And-Algo | e8cb27b1b53556997cd1b104c65b22e871c43baa | cfe9e55c970999c6e381fb6e3e1e7bced8d59828 | refs/heads/master | 2023-03-21T03:07:52.450415 | 2021-03-15T18:06:15 | 2021-03-15T18:06:15 | 348,112,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | import java.util.*;
public class GetSubsequence {
public static void main(String[] args) throws Exception {
Scanner scn = new Scanner(System.in);
String str = scn.next();
ArrayList<String> ans = gss((str));
System.out.print(ans);
}
public static ArrayList<String> gss(String str) { //lets say str =abc
if(str.length()==0){
ArrayList<String> bres = new ArrayList<>();
bres.add("");
return bres;
}
// for(int i =0;i<str.length();i++){
char ch = str.charAt(0); //a
String s = str.substring(1);//bc
ArrayList<String> rres = gss(s); //recursive call
ArrayList<String> mres = new ArrayList<>();
for(String a : rres){
mres.add("" + a);
}
for(String a : rres){
mres.add(ch + a);
}
return mres;
// }
// return mres;
}
} | [
"[email protected]"
] | |
9b6a5d60432a26241f2fc2940edf2795fb10c1f0 | b2d11356e295ca373f57f67f076a8f937b4dfb31 | /src/com/Dinesh/Profiletwo.java | 3531f422dafd9a0efed7b339246d329f5b813d22 | [] | no_license | PARTH2000-max/Servlet | 4870a0c6d804610ce3d373a5ed4e90e8ed28a0ab | 3879689998a198178367b3c6751db0c9a4306cf0 | refs/heads/main | 2023-03-08T05:57:47.215404 | 2021-02-20T08:27:59 | 2021-02-20T08:27:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,482 | java | package com.Dinesh;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/profiletwo")
public class Profiletwo extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String opt=req.getParameter("option");
String value=req.getParameter("num");
String url="jdbc:mysql://localhost:3306/java_prac_new";
String user="root";
String pass="Dinesh@9725";
Connection conn;
PrintWriter write=resp.getWriter();
resp.setContentType("text/html");
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Driver Loaded.");
conn=DriverManager.getConnection(url, user, pass);
System.out.println("DataBase Connected..");
System.out.println(opt+" "+value);
PreparedStatement prep;
ResultSet rs;
if(!value.isEmpty()) {
if(opt.equals("enroll")) {
String qenroll="select * from User where enrollno=?";
prep=conn.prepareStatement(qenroll);
prep.setInt(1,Integer.parseInt(value));
rs=prep.executeQuery();
if(rs.next()) {
req.setAttribute("rnum", String.valueOf(rs.getInt("rollno")));
req.setAttribute("enum", String.valueOf(rs.getInt("enrollno")));
req.setAttribute("fname", rs.getString("FirstName"));
req.setAttribute("lname", rs.getString("LastName"));
req.setAttribute("email", rs.getString("Email"));
req.setAttribute("city", rs.getString("city"));
req.getRequestDispatcher("WEB-INF/jsp/profile.jsp").include(req, resp);
}else {
write.println("<script type=\"text/javascript\">");
// write.println("alert('");
write.println("alert('"+opt.toUpperCase()+" number "+value+" Not Found');");
write.println("location='Finduser-2.html';");
write.println("</script>");
}
}else {
String qenroll="select * from User where rollno=?";
prep=conn.prepareStatement(qenroll);
prep.setInt(1,Integer.parseInt(value));
rs=prep.executeQuery();
if(rs.next()) {
req.setAttribute("rnum", String.valueOf(rs.getInt("rollno")));
req.setAttribute("enum", String.valueOf(rs.getInt("enrollno")));
req.setAttribute("fname", rs.getString("FirstName"));
req.setAttribute("lname", rs.getString("LastName"));
req.setAttribute("email", rs.getString("Email"));
req.setAttribute("city", rs.getString("city"));
req.getRequestDispatcher("WEB-INF/jsp/profile.jsp").include(req, resp);
}else {
write.println("<script type=\"text/javascript\">");
// write.println("alert('");
write.println("alert('"+opt.toUpperCase()+" number "+value+" Not Found');");
write.println("location='Finduser-2.html';");
write.println("</script>");
}
}
}else {
write.println("<script type=\"text/javascript\">");
write.println("alert('Enter Number');");
write.println("location='Finduser-2.html';");
write.println("</script>");
}
}catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
edef8390d1556f75e906c4c724a692e245c613fd | 0588928f630bfaed68f76b63837687addd2b298f | /SeparateDigits.java | 4909ad6c0fb9f3ba15a0f4696e46825b51347f10 | [] | no_license | XavierScor/COMP1022P-LAB | 32f505bc604d832639c8e903f60fa9d3784312c1 | 42fa7d2ba31a9c3b7102b3fab9d91f8fd76bd904 | refs/heads/master | 2021-04-09T10:33:51.511964 | 2018-03-29T01:02:12 | 2018-03-29T01:02:12 | 125,301,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | import java.util.Scanner;
public class SeparateDigits
{
public static void main(String[] args)
{
int number;
int firstDigit;
int secondDigit;
int thirdDigit;
int forthDigit;
int fifthDigit;
Scanner sc = new Scanner(System.in);
System.out.print("Please enter FIVE digits: ");
number = sc.nextInt();
firstDigit = number % 10;
secondDigit = number / 10 % 10;
thirdDigit = number / 100 % 10;
forthDigit = number / 1000 % 10;
fifthDigit = number / 10000;
sc.close();
System.out.println(fifthDigit + "\t" + forthDigit + "\t" + thirdDigit + "\t" + secondDigit + "\t" + firstDigit);
}
}
| [
"[email protected]"
] | |
d1a1a0cbe23ff37ee902a774f7c2aaf4463b73cb | 97c8c84a464d76efff0e6db7f21f8f50852fc63f | /Algorithms/Java/src/CountPrimes/CountPrimes.java | e9850432a0f6a252cc6748465636c3ad8f337d0a | [
"MIT"
] | permissive | TongqiLiu/leetcode | 1bf2200e6453b85340dfe9972ca138237baabe58 | f6eaba04cfa776c1671b2a8a742e5424ddbb4792 | refs/heads/master | 2022-09-26T20:15:19.028570 | 2022-09-04T15:44:47 | 2022-09-04T15:44:47 | 87,930,606 | 2 | 0 | MIT | 2018-08-02T13:30:05 | 2017-04-11T12:19:43 | Java | UTF-8 | Java | false | false | 713 | java | package src.CountPrimes;
import java.util.Arrays;
import java.util.stream.Stream;
/**
* @author mingqiao
* @Date 2020/2/23
*/
public class CountPrimes {
/**
* 埃氏筛选法
*
* @param n
* @return
*/
public int countPrimes(int n) {
if (n <= 1) {
return 0;
}
Boolean[] vis = new Boolean[n + 1];
Arrays.fill(vis, true);
for (int i = 2; i * i < n; i++) {
if (vis[i]) {
for (int j = i * i; j < n; j += i) {
vis[j] = false;
}
}
}
//减去多余的0,1还有N+1
return (int)Stream.of(vis).filter(v -> v).count() - 3;
}
}
| [
"[email protected]"
] | |
47bb4c8eafc1af4a276843d24e22d22ba710973d | 7785cae58aa8b0de00dc93ca24c627713872007d | /src/cn/edu/sdut/jackson/write/TestJson.java | f9a99a204b39967a4ec81d48d026528cb4b82791 | [] | no_license | GaoZiqiang/JsonDemo | 619d4eac1fdb8d75b2e3b5de7f5aa52fce383142 | 91bc1a9b5cea41b2269ee6de2147a3cf78d8bb56 | refs/heads/master | 2021-01-25T11:14:40.460155 | 2017-06-10T05:24:50 | 2017-06-10T05:24:50 | 93,917,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package cn.edu.sdut.jackson.write;
import net.sf.json.JSONObject;
public class TestJson {
static String json_str="{\"total\":920,\"data\":[{\"ID\":\"634\",\"Name\":\"于东\"},{\"ID\":\"822\",\"Name\":\"于祎\"},{\"ID\":\"782\",\"Name\":\"于燕\"},{\"ID\":\"636\",\"Name\":\"于玲\"},{\"ID\":\"841\",\"Name\":\"于浩\"},{\"ID\":\"383\",\"Name\":\"于娟\"}]}";
public static void main(String[] args) {
System.out.println(json_str);
JSONObject jsonObject=JSONObject.fromObject(json_str);
System.out.println(jsonObject.get("total"));
}
} | [
"[email protected]"
] | |
a5dd82d2c83e352cd62b1191ba71762d6fbe2143 | b770df1acd1fad2530e05fdc88df15b103ca4676 | /blog-webapp/src/main/java/com/ripple/blog/util/VerifyCodeUtils.java | da5d5bf95232b9134fe8271b731c093e09ffd722 | [] | no_license | wlstone119/ripple-blog | f637635892cf6dffbd414b12e12e35b8eaa72aa0 | 8d301cb0eeadd03760b2518d2ed1aeaefef6e204 | refs/heads/master | 2022-09-16T06:54:54.443276 | 2020-01-21T05:54:42 | 2020-01-21T05:54:42 | 234,287,323 | 0 | 0 | null | 2022-09-01T23:19:09 | 2020-01-16T09:48:54 | Java | UTF-8 | Java | false | false | 8,257 | java | package com.ripple.blog.util;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.ripple.blog.domain.model.Result;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Random;
public class VerifyCodeUtils {
// 使用到Algerian字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符
public static final String VERIFY_CODES = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
private static Random random = new Random();
/**
* 使用系统默认字符源生成验证码
*
* @param verifySize 验证码长度
* @return
*/
public static String generateVerifyCode(int verifySize) {
return generateVerifyCode(verifySize, VERIFY_CODES);
}
/**
* 使用指定源生成验证码
*
* @param verifySize 验证码长度
* @param sources 验证码字符源
* @return
*/
public static String generateVerifyCode(int verifySize, String sources) {
if (sources == null || sources.length() == 0) {
sources = VERIFY_CODES;
}
int codesLen = sources.length();
Random rand = new Random(System.currentTimeMillis());
StringBuilder verifyCode = new StringBuilder(verifySize);
for (int i = 0; i < verifySize; i++) {
verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1)));
}
return verifyCode.toString();
}
/**
* 生成随机验证码文件,并返回验证码值
*
* @param w
* @param h
* @param outputFile
* @param verifySize
* @return
* @throws IOException
*/
public static String outputVerifyImage(int w, int h, File outputFile, int verifySize) throws IOException {
String verifyCode = generateVerifyCode(verifySize);
outputImage(w, h, outputFile, verifyCode);
return verifyCode;
}
/**
* 输出随机验证码图片流,并返回验证码值
*
* @param w
* @param h
* @param os
* @param verifySize
* @return
* @throws IOException
*/
public static String outputVerifyImage(int w, int h, OutputStream os, int verifySize) throws IOException {
String verifyCode = generateVerifyCode(verifySize);
outputImage(w, h, os, verifyCode);
return verifyCode;
}
/**
* 生成指定验证码图像文件
*
* @param w
* @param h
* @param outputFile
* @param code
* @throws IOException
*/
public static void outputImage(int w, int h, File outputFile, String code) throws IOException {
if (outputFile == null) {
return;
}
File dir = outputFile.getParentFile();
if (!dir.exists()) {
dir.mkdirs();
}
try {
outputFile.createNewFile();
FileOutputStream fos = new FileOutputStream(outputFile);
outputImage(w, h, fos, code);
fos.close();
} catch (IOException e) {
throw e;
}
}
/**
* 输出指定验证码图片流
*
* @param w
* @param h
* @param os
* @param code
* @throws IOException
*/
public static void outputImage(int w, int h, OutputStream os, String code) throws IOException {
int verifySize = code.length();
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Random rand = new Random();
Graphics2D g2 = image.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color[] colors = new Color[5];
Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA,
Color.ORANGE, Color.PINK, Color.YELLOW };
float[] fractions = new float[colors.length];
for (int i = 0; i < colors.length; i++) {
colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)];
fractions[i] = rand.nextFloat();
}
Arrays.sort(fractions);
g2.setColor(Color.GRAY);// 设置边框色
g2.fillRect(0, 0, w, h);
Color c = getRandColor(200, 250);
g2.setColor(c);// 设置背景色
g2.fillRect(0, 2, w, h - 4);
// 绘制干扰线
Random random = new Random();
g2.setColor(getRandColor(160, 200));// 设置线条的颜色
for (int i = 0; i < 20; i++) {
int x = random.nextInt(w - 1);
int y = random.nextInt(h - 1);
int xl = random.nextInt(6) + 1;
int yl = random.nextInt(12) + 1;
g2.drawLine(x, y, x + xl + 40, y + yl + 20);
}
// 添加噪点
float yawpRate = 0.05f;// 噪声率
int area = (int) (yawpRate * w * h);
for (int i = 0; i < area; i++) {
int x = random.nextInt(w);
int y = random.nextInt(h);
int rgb = getRandomIntColor();
image.setRGB(x, y, rgb);
}
shear(g2, w, h, c);// 使图片扭曲
g2.setColor(getRandColor(100, 160));
int fontSize = h - 4;
Font font = new Font("Algerian", Font.ITALIC, fontSize);
g2.setFont(font);
char[] chars = code.toCharArray();
for (int i = 0; i < verifySize; i++) {
AffineTransform affine = new AffineTransform();
affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1),
(w / verifySize) * i + fontSize / 2, h / 2);
g2.setTransform(affine);
g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10);
}
g2.dispose();
ImageIO.write(image, "jpg", os);
}
private static Color getRandColor(int fc, int bc) {
if (fc > 255) {
fc = 255;
}
if (bc > 255) {
bc = 255;
}
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
private static int getRandomIntColor() {
int[] rgb = getRandomRgb();
int color = 0;
for (int c : rgb) {
color = color << 8;
color = color | c;
}
return color;
}
private static int[] getRandomRgb() {
int[] rgb = new int[3];
for (int i = 0; i < 3; i++) {
rgb[i] = random.nextInt(255);
}
return rgb;
}
private static void shear(Graphics g, int w1, int h1, Color color) {
shearX(g, w1, h1, color);
shearY(g, w1, h1, color);
}
private static void shearX(Graphics g, int w1, int h1, Color color) {
int period = random.nextInt(2);
boolean borderGap = true;
int frames = 1;
int phase = random.nextInt(2);
for (int i = 0; i < h1; i++) {
double d = (double) (period >> 1)
* Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(0, i, w1, 1, (int) d, 0);
if (borderGap) {
g.setColor(color);
g.drawLine((int) d, i, 0, i);
g.drawLine((int) d + w1, i, w1, i);
}
}
}
private static void shearY(Graphics g, int w1, int h1, Color color) {
int period = random.nextInt(40) + 10; // 50;
boolean borderGap = true;
int frames = 20;
int phase = 7;
for (int i = 0; i < w1; i++) {
double d = (double) (period >> 1)
* Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(i, 0, 1, h1, 0, (int) d);
if (borderGap) {
g.setColor(color);
g.drawLine(i, (int) d, i, 0);
g.drawLine(i, (int) d + h1, i, h1);
}
}
}
public static Result validImage(String code, Object verCode, HttpServletRequest request, HttpSession session,
String varCodeKey, String varCodeTime) {
if (null == verCode) {
request.setAttribute("error", "验证码已失效,请重新输入");
return Result.error(-1, "验证码已失效,请重新输入");
}
String verCodeStr = verCode.toString();
LocalDateTime localDateTime = (LocalDateTime) session.getAttribute(varCodeTime);
long past = localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
long now = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
if (verCodeStr == null || code == null || code.isEmpty() || !verCodeStr.equalsIgnoreCase(code)) {
request.setAttribute("error", "验证码错误");
return Result.error(-1, "验证码错误");
} else if ((now - past) / 1000 / 60 > 2) {// 两分钟
request.setAttribute("error", "验证码已过期,重新获取");
return Result.error(-1, "验证码已过期,重新获取");
} else {
// 验证成功,删除存储的验证码
session.removeAttribute(varCodeKey);
return Result.ok();
}
}
} | [
"[email protected]"
] | |
de4271025fd879427b9741e7d573e3672a7fc43d | 2a3182072a737e50981752b024a4a8e9e4ccf349 | /src/GameState.java | e69986b1229c9e9a86443df1bd3b989be3aafd57 | [
"MIT"
] | permissive | BlueManCZ/TetrisFX | 41cd1325cc7252d3d52425373b9deb4ab062f529 | d69d1b0515ca1fccff576e848edc2e9db2c9ed2b | refs/heads/master | 2023-04-29T03:15:14.139225 | 2021-05-02T12:16:55 | 2021-05-02T12:16:55 | 286,496,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,682 | java | package tetris;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
public class GameState {
public static final int ROWS = 16;
public static final int COLUMNS = 10;
public static final int DEFAULT_X = COLUMNS / 2 - 1;
public static final int DEFAULT_Y = 0;
private Cube cube = new Cube(DEFAULT_Y, DEFAULT_X);
private Cube predictedCube = cube.makeClone();
private int gameGrid[][] = new int[ROWS][COLUMNS];
private BooleanProperty active = new SimpleBooleanProperty(false);
private boolean updateNeeded = false;
public GameState() {
reinitialize();
}
public void reinitialize() {
setDefaultValues();
updatePredictedCube();
}
private void setDefaultValues() {
resetCube();
for (int w = 0; w < COLUMNS; w++) {
for (int h = 0; h < ROWS; h++) {
gameGrid[h][w] = 0;
}
}
}
synchronized public boolean update() {
boolean result = checkCollisions(cube, 0, 1, false);
if (cube.getRow() + cube.getOffset(1) + cube.getHeight() > ROWS - 1) result = false;
if (result) cube.moveDown();
else {
if (cube.getRow() == 0) {
setActive(false);
return true;
}
saveCube(cube);
removeFullRows();
resetCube();
}
return false;
}
public boolean skipFalling() {
if (cube.getRow() > 0) {
boolean result = saveCube(predictedCube);
removeFullRows();
resetCube();
return result;
} else return false;
}
private boolean saveCube(Cube cube) {
for (int w = 0; w < cube.getWidth(); w++) {
for (int h = 0; h < cube.getHeight(); h++) {
if (cube.getMatrix()[h][w] != 0) {
gameGrid[cube.getRow() + cube.getOffset(1) + h]
[cube.getColumn() + cube.getOffset(0) + w] = cube.getMatrix()[h][w];
updateNeeded = true;
}
}
}
return updateNeeded;
}
private void recalculatePrediction() {
predictedCube.setRow(cube.getRow());
while (checkCollisions(predictedCube, 0, 1, false)) {
predictedCube.setRow(predictedCube.getRow() + 1);
}
}
private void removeFullRows() {
for (int h = 0; h < gameGrid.length; h++) {
int counter = 0;
for (int w = 0; w < gameGrid[0].length; w++) {
if (gameGrid[h][w] != 0) counter++;
}
if (counter == COLUMNS) {
for (int h2 = h; h2 > 0; h2--) {
for (int i = 0; i < gameGrid[0].length; i++) {
gameGrid[h2][i] = gameGrid[h2 - 1][i];
}
}
for (int i = 0; i < gameGrid[0].length; i++) {
gameGrid[0][i] = 0;
}
}
}
}
public void resetCube() {
cube.randomize();
cube.setColumn(DEFAULT_X);
cube.setRow(DEFAULT_Y);
updatePredictedCube();
}
public void updatePredictedCube() {
predictedCube = cube.makeClone();
predictedCube.setColumnProperty(cube.columnProperty());
recalculatePrediction();
}
private boolean checkRotation(Cube cube) {
if (cube.getColumn() + cube.getFutureOffset(0) < 0) return false;
if (cube.getColumn() + cube.getFutureWidth() + cube.getFutureOffset(0) > COLUMNS) return false;
if (cube.getRow() + cube.getFutureHeight() + cube.getFutureOffset(1) > ROWS) return false;
return checkCollisions(cube, 0, 0, true);
}
private boolean checkCollisions(Cube cube, int factorX, int factorY, boolean factorR) {
int[][] matrix = factorR ? cube.getNextMatrix() : cube.getMatrix();
int offsetX = factorR ? cube.getFutureOffset(0) : cube.getOffset(0);
int offsetY = factorR ? cube.getFutureOffset(1) : cube.getOffset(1);
for (int w = 0; w < matrix[0].length; w++) {
for (int h = 0; h < matrix.length; h++) {
int row = cube.getRow() + h + offsetY + factorY;
int column = cube.getColumn() + w + offsetX + factorX;
if (row < ROWS && row >= 0 && column < COLUMNS && column >= 0) {
if (gameGrid[row][column] != 0 && matrix[h][w] != 0) {
return false;
}
} else return false;
}
}
return true;
}
public boolean checkUpdate() {
boolean result = updateNeeded;
if (result) updateNeeded = false;
return result;
}
public void moveLeft() {
moveCube(-1);
}
public void moveRight() {
moveCube(1);
}
private void moveCube(int x) {
if (!isActive() || !checkCollisions(cube, x, 0, false)) return;
int cubePos = cube.getColumn();
if ((x > 0) ? cubePos + cube.getWidth() + cube.getOffset(0) < COLUMNS : cubePos + cube.getOffset(0) > 0) {
cube.setColumn(cubePos + x);
updatePredictedCube();
}
}
public void rotateCube() {
if (checkRotation(cube)) {
cube.rotate();
updatePredictedCube();
}
}
public Cube getCube() {
return cube;
}
public Cube getPredictedCube() { return predictedCube; }
public int[][] getGameGrid() {
return gameGrid;
}
public final BooleanProperty activeProperty() { return this.active; }
public final boolean isActive() { return this.activeProperty().get(); }
public final void setActive(final boolean active) { this.activeProperty().set(active); }
}
| [
"[email protected]"
] | |
4e1de8e1574afa6beeec841c3296188271c77eff | e5b71af443089b92f387565d6860e03621dd8355 | /src/com/wsl/leetcode/algorithm/MajorityElementAlgorithm.java | e028258792802a819e29a46869d792a26dfe40c2 | [] | no_license | wushaolin1520/leetcode-algorithm | 4827fec3b6256e9fbe440372b68a629bab48cc29 | 80cc75988514d833fd9fc4d274bb8fe400f0e081 | refs/heads/master | 2023-01-29T05:27:51.594566 | 2020-12-10T09:59:31 | 2020-12-10T09:59:31 | 298,176,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package com.wsl.leetcode.algorithm;
import java.util.HashMap;
import java.util.Map;
/**
* 多数元素
*
* 给定一个大小为 n 的数组,找到其中的多数元素。多数元素是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。
*
* 你可以假设数组是非空的,并且给定的数组总是存在多数元素。
*
*
*
* 示例 1:
*
* 输入: [3,2,3] 输出: 3 示例 2:
*
* 输入: [2,2,1,1,1,2,2] 输出: 2
*
* 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/majority-element 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class MajorityElementAlgorithm {
/**
* 基于hash表
*
* @param nums
* @return
*/
public int majorityElement(int[] nums) {
Map<Integer, Integer> map = new HashMap<>();
int maxNum = 0, maxCnt = 0;
for (int num : nums) {
int cnt = map.getOrDefault(num, 0) + 1;
map.put(num, cnt);
if (cnt > maxCnt) {
maxCnt = cnt;
maxNum = num;
}
}
return maxNum;
}
}
| [
"[email protected]"
] | |
365c06fe8cd24a8fb9a7b09ba6a7935e37f145ac | 8c4864184a9d300cc65f9e10f036187c029932f9 | /Flash-It-User/app/src/main/java/com/flashitdelivery/flash_it/event/PhotoPickedEvent.java | aaabb45c1d684285cfaba68523291d6949b7f689 | [] | no_license | lindan4/Project1617 | 9903bde340bffe6f07277cf5cf0a7f4937ff2d55 | 05de6752111bb841b76fbdea25cd5f9169fa5b3b | refs/heads/master | 2022-05-13T17:10:26.411063 | 2018-02-19T02:59:21 | 2018-02-19T02:59:21 | 121,821,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.flashitdelivery.flash_it.event;
/**
* Created by yon on 19/08/16.
*/
public class PhotoPickedEvent {
public String photoUrl;
public PhotoPickedEvent(String photoUrl) {
this.photoUrl = photoUrl;
}
}
| [
"[email protected]"
] | |
df0c246a89c89e8014285e71966613174f583af2 | e5d808f6c4f78d17d0887da6b4a5c263a06b83ab | /krishnaweb/krishnawebfulfilmentprocess/src/com/krishnaweb/fulfilmentprocess/actions/order/SendOrderCompletedNotificationAction.java | 73fa6616a7ea34855a7040c5a99c6c0fad5286dc | [] | no_license | krishnavamshimallarapu/krishnakrishna | 7a7e605d459c5582a1d145c6609fba8cedf40912 | 3d05384e3e8499935fce5c104bfc91a451ab8b57 | refs/heads/master | 2021-01-23T05:25:48.184776 | 2017-03-27T20:29:57 | 2017-03-27T20:29:57 | 86,307,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,566 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.krishnaweb.fulfilmentprocess.actions.order;
import de.hybris.platform.orderprocessing.events.OrderCompletedEvent;
import de.hybris.platform.orderprocessing.model.OrderProcessModel;
import de.hybris.platform.processengine.action.AbstractProceduralAction;
import de.hybris.platform.servicelayer.event.EventService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Required;
/**
* Send event representing the completion of an order process.
*/
public class SendOrderCompletedNotificationAction extends AbstractProceduralAction<OrderProcessModel>
{
private static final Logger LOG = Logger.getLogger(SendOrderCompletedNotificationAction.class);
private EventService eventService;
@Override
public void executeAction(final OrderProcessModel process)
{
getEventService().publishEvent(new OrderCompletedEvent(process));
if (LOG.isInfoEnabled())
{
LOG.info("Process: " + process.getCode() + " in step " + getClass());
}
}
protected EventService getEventService()
{
return eventService;
}
@Required
public void setEventService(final EventService eventService)
{
this.eventService = eventService;
}
}
| [
"vamsikrishna mallarapu"
] | vamsikrishna mallarapu |
09e7c0a506533ccd10f0bf2ace06ba8cc4c42334 | e5ba4a33c601e278834b800658969640d458d895 | /WebSecurityServer/src/com/pitaya/bookingnow/message/OrderMessage.java | ae85887aa5446375bc88b0b0eef618a9f4cf56d9 | [] | no_license | drad944/bookingnow | a1a0f347463b24cd123070b00518cd50ffd942b1 | 37640452966806285daf198cd12e184e50d6327a | refs/heads/master | 2021-01-23T06:39:19.530318 | 2013-10-12T09:10:09 | 2013-10-12T09:10:09 | 33,586,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,803 | java | package com.pitaya.bookingnow.message;
import com.pitaya.bookingnow.entity.Order;
import com.pitaya.bookingnow.util.Constants;
public class OrderMessage extends Message{
private static final long serialVersionUID = -2448833662538683270L;
private Long orderId;
private String action;
private int status;
//For welcome_new or waiting order info
private String customer;
private String phone;
private int peopleCount;
private Long timestamp;
public OrderMessage(){
super(Constants.ORDER_MESSAGE);
}
public OrderMessage(String action, Order order){
super(Constants.ORDER_MESSAGE);
this.orderId = order.getId();
this.status = order.getStatus();
this.customer = order.getCustomer().getName();
this.phone = order.getCustomer().getPhone();
this.peopleCount = order.getCustomer_count();
this.timestamp = order.getSubmit_time();
this.action = action;
}
public void setAction(String act){
this.action = act;
}
public String getAction(){
return this.action;
}
public void setOrderId(Long id){
this.orderId = id;
}
public Long getOrderId(){
return this.orderId;
}
public void setStatus(int s){
this.status = s;
}
public int getStatus(){
return this.status;
}
public void setCustomer(String name){
this.customer = name;
}
public String getCustomer(){
return this.customer;
}
public void setPhone(String p){
this.phone =p;
}
public String getPhone(){
return this.phone;
}
public void setPeopleCount(int count){
this.peopleCount = count;
}
public int getPeopleCount(){
return this.peopleCount;
}
public void setTimestamp(Long t){
this.timestamp = t;
}
public Long getTimestamp(){
return this.timestamp;
}
}
| [
"[email protected]@658d62ce-3a00-bcee-73d7-f3445d85faba"
] | [email protected]@658d62ce-3a00-bcee-73d7-f3445d85faba |
7817404e7fedbf048393fd6b4b489e1ae88e6b16 | d1f01be48984c75c6d5abe48d6242ee0cc677328 | /redwarfare-arcade/src/me/libraryaddict/arcade/game/searchanddestroy/kits/KitTrooper.java | 41753fea0c28a806a621a021a806c0c0e65523a5 | [] | no_license | devBuzzy/RedWarfare | 01f23137e9b4bdff1e8f837a85a27df6e8edce02 | 61a1e002e5f4c2ebc576c9442773326aeb8059d6 | refs/heads/master | 2021-07-20T16:21:05.422737 | 2017-10-30T00:02:25 | 2017-10-30T00:02:25 | 109,839,610 | 1 | 0 | null | 2017-11-07T13:32:10 | 2017-11-07T13:32:10 | null | UTF-8 | Java | false | false | 1,136 | java | package me.libraryaddict.arcade.game.searchanddestroy.kits;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.arcade.kits.Ability;
import me.libraryaddict.core.inventory.utils.ItemBuilder;
public class KitTrooper extends SnDKit
{
public KitTrooper()
{
super("Trooper", new String[]
{
"The kit that sets the standards for all others. It receives a set of iron armor and an iron sword, along with five golden apples with which it can quickly recover from fights."
}, new Ability[0]);
setItems(new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).build(),
new ItemStack(Material.GOLDEN_APPLE, 3));
}
@Override
public Material[] getArmorMats()
{
return new Material[]
{
Material.IRON_BOOTS, Material.IRON_LEGGINGS, Material.IRON_CHESTPLATE, Material.IRON_HELMET
};
}
@Override
public Material getMaterial()
{
return Material.IRON_SWORD;
}
}
| [
"[email protected]"
] | |
fd0ea0cf05974ea4623e6909e486e3d3300e1457 | 2984cd33191964fd051f994ac36d03079e7529e6 | /Design Pattern/src/builderpattern/Packing.java | 83c1c1c4ddaac4eb1a3b0910ca2e8cc6690c4235 | [] | no_license | sandyius59/demo | 607edf3f1f5451f0e39d8945613cd3f72a13983f | e71a039923930d05c986c50b47320445fa18cb11 | refs/heads/master | 2022-07-23T00:09:37.994378 | 2020-05-22T18:34:49 | 2020-05-22T18:34:49 | 263,310,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 81 | java | package builderpattern;
public interface Packing
{
public String pack();
}
| [
"user@user-PC"
] | user@user-PC |
a9e70ba75ecf23886600ea9bd636ee0888071aee | d00ca4b1162058fd95f478eb4065bee35eb0e295 | /product/src/main/java/com/example/product/Exeception/RecordNotFoundException.java | 8c95a9c2d7e3f38d298a040179d2567b047575ee | [] | no_license | pdmsk99/Agriculture-Crop-System | daf3b88a5f315152eb022eaafc22ec740eef9367 | 4e8d37b9e7216f00ecd0b60f6745bf96a96142b5 | refs/heads/master | 2023-06-02T21:05:43.120273 | 2021-06-28T12:58:09 | 2021-06-28T12:58:09 | 374,572,530 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package com.example.product.Exeception;
public class RecordNotFoundException extends RuntimeException{
private static final long serialVersionUID = 1L;
public RecordNotFoundException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
5b25746b4b6e8049f391563d7f28c786e1764ea3 | 482a32cf4344d6c8b577648d772b3d23f4eec2d6 | /src/types/FloatType.java | 0fddb0dc09dbfcccd263dc8192465fc13bde0988 | [] | no_license | EkardNT/CS142A | 29935f9694a987a3745b8fb3357fe805a973ceae | f97277442994d0baf8da4b898400eb7ef2bed609 | refs/heads/master | 2021-01-10T19:09:24.417287 | 2014-05-27T16:28:48 | 2014-05-27T16:28:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,299 | java | package types;
public class FloatType extends Type
{
@Override
public String toString()
{
return "float";
}
@Override
public Type add(Type that)
{
return equivalent(that)
? new FloatType()
: super.add(that);
}
@Override
public Type sub(Type that)
{
return equivalent(that)
? new FloatType()
: super.sub(that);
}
@Override
public Type mul(Type that)
{
return equivalent(that)
? new FloatType()
: super.mul(that);
}
@Override
public Type div(Type that)
{
return equivalent(that)
? new FloatType()
: super.div(that);
}
@Override
public Type compare(Type that)
{
return equivalent(that)
? new BoolType()
: super.compare(that);
}
@Override
public Type assign(Type source)
{
return equivalent(source)
? new FloatType()
: super.assign(source);
}
@Override
public boolean equivalent(Type that)
{
return that instanceof FloatType
|| (that instanceof FuncType && equivalent(((FuncType)that).returnType()));
}
@Override
public boolean isPrimitive() {
return true;
}
}
| [
"[email protected]"
] | |
5882824a99abca648683b8032bad8183c066fdbf | 2e05902104c40d56b90138ae3125f592f813b934 | /src/main/java/jasmin/ScannerUtils.java | 52f8bdd6d11add876854e3795ca6012f47b4b972 | [] | no_license | tasubo/maven-jasmin-plugin | 7efad9d38ba5afaeab768a594196746761625437 | e1da5c2d5a9e7c59b54b4a90cad12dfc9b18d6d4 | refs/heads/master | 2021-01-22T13:57:05.235767 | 2014-01-21T19:22:36 | 2014-01-21T19:22:36 | 8,540,181 | 3 | 1 | null | 2014-01-21T19:22:39 | 2013-03-03T18:12:24 | Java | UTF-8 | Java | false | false | 6,753 | java | /* --- Copyright Jonathan Meyer 1997. All rights reserved. -----------------
> File: jasmin/src/jasmin/ScannerUtils.java
> Purpose: Various static methods utilized to breakdown strings
> Author: Jonathan Meyer, 8 Feb 1997
*/
package jasmin;
abstract class ScannerUtils {
//
// Converts a string to a number (int, float, long, or double).
// (uses smallest format that will hold the number)
//
public static Number convertNumber(String str) throws NumberFormatException {
str = str.toUpperCase();
if (str.startsWith("0X")) {// hex
switch (str.charAt(str.length() - 1)) {
case 'L':
return Long.parseLong(str.substring(2, str.length() - 1), 16);
default:
return Integer.parseInt(str.substring(2), 16);
}
}
if (str.startsWith("0N") || str.startsWith("0P")) {
if (str.equals("0NAN_F")) {
return Float.NaN;
} else if (str.equals("0NAN_D")) {
return Double.NaN;
} else if (str.equals("0NEG_INFI_F")) {
return Float.NEGATIVE_INFINITY;
} else if (str.equals("0NEG_INFI_D")) {
return Double.NEGATIVE_INFINITY;
} else if (str.equals("0POS_INFI_F")) {
return Float.POSITIVE_INFINITY;
} else if (str.equals("0POS_INFI_D")) {
return Double.POSITIVE_INFINITY;
}
throw new IllegalArgumentException("malformed number : " + str);
} else {
switch (str.charAt(str.length() - 1)) {
case 'D':
return Double.parseDouble(str.substring(0, str.length() - 1));
case 'L':
return Long.parseLong(str.substring(0, str.length() - 1));
case 'F':
return Float.parseFloat(str.substring(0, str.length() - 1));
default:
if (str.indexOf('.') >= 0) {
return Double.parseDouble(str);
}
return Integer.parseInt(str);
}
}
}
//
// Maps '.' characters to '/' characters in a string
//
public static String convertDots(String orig_name)
{
return convertChars(orig_name, ".", '/');
}
//
// Maps chars to toChar in a given String
//
public static String convertChars(String orig_name,
String chars, char toChar)
{
StringBuffer tmp = new StringBuffer(orig_name);
int i;
for (i = 0; i < tmp.length(); i++) {
if (chars.indexOf(tmp.charAt(i)) != -1) {
tmp.setCharAt(i, toChar);
}
}
return new String(tmp);
}
//
// Splits a string like:
// "a/b/c/d(xyz)v"
// into three strings:
// "a/b/c", "d", "(xyz)v"
//
public static String[] splitClassMethodSignature(String name) {
String result[] = new String[3];
int i, pos = 0, sigpos = 0;
for (i = 0; i < name.length(); i++) {
char c = name.charAt(i);
if (c == '.' || c == '/') pos = i;
else if (c == '(') {sigpos = i; break; }
}
try {
result[0] = convertDots(name.substring(0, pos));
result[1] = name.substring(pos + 1, sigpos);
result[2] = convertDots(name.substring(sigpos));
} catch(StringIndexOutOfBoundsException e) {
throw new IllegalArgumentException("malformed signature : "+name);
}
return result;
}
//
// Splits a string like:
// "java/lang/System/out"
// into two strings:
// "java/lang/System" and "out"
//
public static String[] splitClassField(String name)
{
String result[] = new String[2];
int i, pos = -1, sigpos = 0;
for (i = 0; i < name.length(); i++) {
char c = name.charAt(i);
if (c == '.' || c == '/') pos = i;
}
if (pos == -1) { // no '/' in string
result[0] = null;
result[1] = name;
} else {
result[0] = convertDots(name.substring(0, pos));
result[1] = name.substring(pos + 1);
}
return result;
}
// Splits a string like:
// "main(Ljava/lang/String;)V
// into two strings:
// "main" and "(Ljava/lang/String;)V"
//
public static String[] splitMethodSignature(String name)
{
String result[] = new String[2];
int i, sigpos = 0;
for (i = 0; i < name.length(); i++) {
char c = name.charAt(i);
if (c == '(') {sigpos = i; break; }
}
result[0] = name.substring(0, sigpos);
result[1] = convertDots(name.substring(sigpos));
return result;
}
/**
* Computes the size of the arguments and of the return value of a method.
*
* @param desc the descriptor of a method.
* @return the size of the arguments of the method (plus one for the
* implicit this argument), argSize, and the size of its return
* value, retSize, packed into a single int i =
* <tt>(argSize << 2) | retSize</tt> (argSize is therefore equal
* to <tt>i >> 2</tt>, and retSize to <tt>i & 0x03</tt>).
*/
public static int getArgumentsAndReturnSizes(final String desc) {
int n = 1;
int c = 1;
while (true) {
char car = desc.charAt(c++);
if (car == ')') {
car = desc.charAt(c);
return n << 2
| (car == 'V' ? 0 : (car == 'D' || car == 'J' ? 2 : 1));
} else if (car == 'L') {
while (desc.charAt(c++) != ';') {
}
n += 1;
} else if (car == '[') {
while ((car = desc.charAt(c)) == '[') {
++c;
}
if (car == 'D' || car == 'J') {
n -= 1;
}
} else if (car == 'D' || car == 'J') {
n += 2;
} else {
n += 1;
}
}
}
}
/* --- Revision History ---------------------------------------------------
--- Panxiaobo, Feb 15 2012
add support to ldc infinity and Nan
--- Panxiaobo, Feb 14 2012
'D'/'F'/'L' in real constant, force double/float/long mode.
--- Iouri Kharon, May 07 2010
'd' in real constant, force double mode.
*/
| [
"[email protected]"
] | |
1741c80e3009741599d6f453ea7eb249f5d363eb | a93974da52deba9771f07868aedb62c735911226 | /3.JavaMultithreading/src/com/javarush/task/task27/task2712/DirectorTablet.java | b8e9ff72d189f45038e7e27a4e90bd8c13466009 | [] | no_license | Domadin/JavaRushTasks | 8edbcf980e09aeee9d5eef417ae8a4bd222e9336 | 74d038120f2145d212f265dba1323888531c74b2 | refs/heads/master | 2020-09-09T23:50:55.134509 | 2017-06-25T07:37:19 | 2017-06-25T07:37:19 | 94,447,352 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,253 | java | package com.javarush.task.task27.task2712;
import com.javarush.task.task27.task2712.ad.Advertisement;
import com.javarush.task.task27.task2712.ad.StatisticAdvertisementManager;
import com.javarush.task.task27.task2712.statistic.StatisticManager;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
public class DirectorTablet {
private SimpleDateFormat format = new SimpleDateFormat("dd-MMM-YYYY", Locale.ENGLISH);
public void printAdvertisementProfit() { //какую сумму заработали на рекламе, сгруппировать по дням;
Map<Date, Long> data = StatisticManager.getInstance().getAdvertisementData();
BigDecimal totalProfit = BigDecimal.ZERO;
for (Map.Entry<Date, Long> pair : data.entrySet()) {
BigDecimal profInRubs = BigDecimal.valueOf(pair.getValue()).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP);
ConsoleHelper.writeMessage(format.format(pair.getKey()) + " - " + profInRubs);
totalProfit = totalProfit.add(profInRubs);
}
ConsoleHelper.writeMessage("Total - " + totalProfit);
}
public void printCookWorkloading() { //загрузка (рабочее время) повара, сгруппировать по дням;
Map<Date, TreeMap<String, Integer>> data = StatisticManager.getInstance().getCookData();
for (Map.Entry<Date, TreeMap<String, Integer>> outPair : data.entrySet()) {
String date = format.format(outPair.getKey());
ConsoleHelper.writeMessage(date);
for (Map.Entry<String, Integer> inPair : outPair.getValue().entrySet()) {
Integer timeInMins = (int) Math.ceil(inPair.getValue() / 60.0);
ConsoleHelper.writeMessage(inPair.getKey() + " - " + timeInMins + " min");
}
ConsoleHelper.writeMessage("");
}
}
public void printActiveVideoSet() { //список активных роликов и оставшееся количество показов по каждому;
List<Advertisement> activeVideos = StatisticAdvertisementManager.getInstance().getActiveVideos();
activeVideos.sort(new Comparator<Advertisement>() {
@Override
public int compare(Advertisement o1, Advertisement o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
for (Advertisement ad : activeVideos) {
ConsoleHelper.writeMessage(ad.getName() + " - " + ad.getHits());
}
}
public void printArchivedVideoSet() { //список неактивных роликов (с оставшемся количеством показов равным нулю).
List<Advertisement> inactiveVideos = StatisticAdvertisementManager.getInstance().getInactiveVideos();
inactiveVideos.sort(new Comparator<Advertisement>() {
@Override
public int compare(Advertisement o1, Advertisement o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
for (Advertisement ad : inactiveVideos) {
ConsoleHelper.writeMessage(ad.getName());
}
}
}
| [
"[email protected]"
] | |
5d0bc335921fb78ce8e275d830a26697a89f1a46 | 64abfc0130cfa0aeb85c2c0a7d2f95037a80271f | /ECO_EmployeeManagement-portlet/docroot/WEB-INF/src/vn/com/ecopharma/emp/util/VNCharacterUtils.java | bca03d9232544cbf3dbc5b1dfb07fdfd491a3e14 | [] | no_license | taotran/eco | 8c962eb918ad4675b535d775f7b8af99cfaab31b | 22620bc21ceb8da83e06c402cfa7bd5a0ea05cee | refs/heads/master | 2021-01-10T02:48:29.194619 | 2016-04-14T11:00:58 | 2016-04-14T11:00:58 | 44,424,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,366 | java | package vn.com.ecopharma.emp.util;
import java.util.Arrays;
import vn.com.ecopharma.emp.service.ResourceConfigLocalServiceUtil;
/**
* Lop tien ich xu ly ky tu tieng Viet
*
* @author quyetdv
*
*/
public class VNCharacterUtils {
// Using String instead of char array to avoid [Invalid character] with
// Vietnamese characters when ant build
private static final String SOURCE_CHARACTERS_STRING = "ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝýỸỹàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯưẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰự";
//
private static final String DEST_CHARACTERS_STRING = "AAAAEEEIIOOOOUUYyYyaaaaeeeiioooouuyAaDdIiUuOoUuAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUu";
/**
* Bo dau 1 ky tu
*
* @param ch
* @return
*/
public static char removeAccent(char ch) {
String sourceString = ResourceConfigLocalServiceUtil.findByKey(
"src_characters_string").toString();
String destString = ResourceConfigLocalServiceUtil.findByKey(
"dest_characters_string").toString();
// char[] SOURCE_CHARACTERS = sourceString.toCharArray();
// char[] DESTINATION_CHARACTERS = destString.toCharArray();
char[] SOURCE_CHARACTERS = SOURCE_CHARACTERS_STRING.toCharArray();
char[] DESTINATION_CHARACTERS = DEST_CHARACTERS_STRING.toCharArray();
int index = Arrays.binarySearch(SOURCE_CHARACTERS, ch);
if (index >= 0) {
ch = DESTINATION_CHARACTERS[index];
}
return ch;
}
/**
* Bo dau 1 chuoi
*
* @param s
* @return
*/
public static String removeAccent(String s) {
// TODO figure out why these 2 characters are not able to replace
// s = s.replaceAll(
// ResourceConfigLocalServiceUtil
// .findByKey("special_char_string1").toString(), "y");
// s = s.replaceAll(
// ResourceConfigLocalServiceUtil
// .findByKey("special_char_string2").toString(), "y");
s = s.replaceAll("ỹ", "y");
s = s.replaceAll("ỳ", "y");
StringBuilder sb = new StringBuilder(s);
for (int i = 0; i < sb.length(); i++) {
sb.setCharAt(i, removeAccent(sb.charAt(i)));
}
return sb.toString();
}
} | [
"[email protected]"
] | |
8df6eddd529d040e6cd080715bc5fbf975068092 | 5482a18a5613ded25aefdacaeebc865c0517ee5d | /src/main/java/in/teamnexus/excelenium/suite/SuiteConfig.java | a67f11e32d452abfb97a0418c53903044124be4e | [
"Apache-2.0"
] | permissive | teamnexus-in/excelenium | 8c8dc8f640e6761461f24390369c08a0fa837cb0 | 13794305c8fd06500e3f53891bf2d0bb4988f6a1 | refs/heads/master | 2022-11-09T23:54:00.910866 | 2020-07-01T21:35:42 | 2020-07-01T21:35:42 | 275,012,723 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,048 | java | /*
* Copyright (C) 2017 - Present. NEXUS. All rights reserved.
*
* https://teamnexus.in
*
* This software is released under the Apache 2.0 License.
*
*
*/
package in.teamnexus.excelenium.suite;
import java.util.List;
import in.teamnexus.excelenium.service.ServiceResponse;
import in.teamnexus.excelenium.suite.script.Script;
/**
* The Class that holds the suite information including scripts and settings
*/
public class SuiteConfig
{
/** The name. */
String name;
/** The settings. */
SuiteSettings settings;
/** The scripts. */
List<Script> scripts;
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Gets the settings.
*
* @return the settings
*/
public SuiteSettings getSettings()
{
return settings;
}
/**
* Sets the settings.
*
* @param settings the new settings
*/
public void setSettings(SuiteSettings settings)
{
this.settings = settings;
}
/**
* Gets the scripts.
*
* @return the scripts
*/
public List<Script> getScripts()
{
return scripts;
}
/**
* Sets the scripts.
*
* @param scripts the new scripts
*/
public void setScripts(List<Script> scripts)
{
this.scripts = scripts;
}
public ServiceResponse validate()
{
ServiceResponse response = new ServiceResponse();
response.setStatus(ServiceResponse.STATUS_SUCCESS);
if(name == null || name.isEmpty())
{
response.setStatus(ServiceResponse.STATUS_FAILURE);
}
settings.validate(response);
for (Script script : scripts)
{
script.validate(response);
}
return response;
}
}
| [
"[email protected]"
] | |
8032d71627f106a8c2bd1ca77ba0ee0e7c9886ab | 82279282f38a45a8196a30e846603e906124b0e1 | /src/main/java/nsu/manasyan/linesort/exceptions/LineSortException.java | 439ae775ac2ae36520dd9df2146516a0f87fc9aa | [] | no_license | tigrulya-exe/LineSort | 1361ea9ae7bfdb7d8677744755ffd4bc8b040672 | ec9ce9e7a573d21e10ebcf4ecc2c07e3f0387960 | refs/heads/master | 2020-06-20T18:35:45.039228 | 2019-07-25T09:36:41 | 2019-07-25T09:36:41 | 197,209,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package nsu.manasyan.linesort.exceptions;
public class LineSortException extends RuntimeException {
public LineSortException(String message){
super(message);
}
}
| [
"[email protected]"
] | |
5459748987dbc27c5829e7c400b0a6aeec3931f9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/15/15_2809ad3a8b63edb9f4b241ca5c0d2b3bb0364c3e/JoglBatchRenderBackendCoreProfile/15_2809ad3a8b63edb9f4b241ca5c0d2b3bb0364c3e_JoglBatchRenderBackendCoreProfile_s.java | 7e3e17521afa0a03a8ca728612599cc1eda53bbf | [] | 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 | 17,416 | java | package de.lessvoid.nifty.renderer.jogl.render.batch;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.opengl.GL;
import javax.media.opengl.GLContext;
import com.jogamp.common.nio.Buffers;
import de.lessvoid.nifty.batch.spi.BatchRenderBackend;
import de.lessvoid.nifty.render.BlendMode;
import de.lessvoid.nifty.renderer.jogl.math.Mat4;
import de.lessvoid.nifty.renderer.jogl.render.JoglMouseCursor;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreElementVBO;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreMatrixFactory;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreRender;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreShader;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreTexture2D;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreTexture2D.ColorFormat;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreTexture2D.ResizeFilter;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreVAO;
import de.lessvoid.nifty.renderer.jogl.render.batch.core.CoreVBO;
import de.lessvoid.nifty.renderer.jogl.render.io.ImageData;
import de.lessvoid.nifty.renderer.jogl.render.io.ImageIOImageData;
import de.lessvoid.nifty.renderer.jogl.render.io.TGAImageData;
import de.lessvoid.nifty.spi.render.MouseCursor;
import de.lessvoid.nifty.tools.Color;
import de.lessvoid.nifty.tools.ObjectPool;
import de.lessvoid.nifty.tools.ObjectPool.Factory;
import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader;
/**
* BatchRenderBackend Implementation for OpenGL Core Profile.
* @author void
*/
public class JoglBatchRenderBackendCoreProfile implements BatchRenderBackend {
private static Logger log = Logger.getLogger(JoglBatchRenderBackendCoreProfile.class.getName());
private static IntBuffer viewportBuffer = Buffers.newDirectIntBuffer(4*4);
private NiftyResourceLoader resourceLoader;
private int viewportWidth = -1;
private int viewportHeight = -1;
private CoreTexture2D texture;
private final CoreShader niftyShader;
private Mat4 modelViewProjection;
private final ObjectPool<Batch> batchPool;
private Batch currentBatch;
private final List<Batch> batches = new ArrayList<Batch>();
private ByteBuffer initialData;
private boolean fillRemovedTexture =
Boolean.parseBoolean(System.getProperty(JoglBatchRenderBackendCoreProfile.class.getName() + ".fillRemovedTexture", "false"));
private static final int PRIMITIVE_SIZE = 4*8; // 4 vertices per quad and 8 vertex attributes per vertex (2xpos, 2xtexture, 4xcolor)
private float[] primitiveBuffer = new float[PRIMITIVE_SIZE];
private int[] elementIndexBuffer = new int[6];
public JoglBatchRenderBackendCoreProfile() {
modelViewProjection = CoreMatrixFactory.createOrtho(0, getWidth(), getHeight(), 0);
niftyShader = CoreShader.newShaderWithVertexAttributes("aVertex", "aColor", "aTexture");
final GL gl = GLContext.getCurrentGL();
if (gl.isGLES2()) {
niftyShader.fragmentShader("nifty-es2.fs");
niftyShader.vertexShader("nifty-es2.vs");
} else {
niftyShader.fragmentShader("nifty-gl3.fs");
niftyShader.vertexShader("nifty-gl3.vs");
}
niftyShader.link();
niftyShader.activate();
niftyShader.setUniformMatrix4f("uModelViewProjectionMatrix", modelViewProjection);
niftyShader.setUniformi("uTex", 0);
batchPool = new ObjectPool<Batch>(2, new Factory<Batch>() {
@Override
public Batch createNew() {
return new Batch();
}
});
}
@Override
public void setResourceLoader(final NiftyResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}
@Override
public int getWidth() {
getViewport();
return viewportWidth;
}
@Override
public int getHeight() {
getViewport();
return viewportHeight;
}
@Override
public void beginFrame() {
log.fine("beginFrame()");
modelViewProjection = CoreMatrixFactory.createOrtho(0, getWidth(), getHeight(), 0);
niftyShader.activate();
niftyShader.setUniformMatrix4f("uModelViewProjectionMatrix", modelViewProjection);
for (int i=0; i<batches.size(); i++) {
batchPool.free(batches.get(i));
}
batches.clear();
}
@Override
public void endFrame() {
log.fine("endFrame");
checkGLError();
}
@Override
public void clear() {
log.fine("clear()");
final GL gl = GLContext.getCurrentGL();
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
}
@Override
public MouseCursor createMouseCursor(final String filename, final int hotspotX, final int hotspotY) throws IOException {
return new JoglMouseCursor(loadMouseCursor(filename, hotspotX, hotspotY));
}
@Override
public void enableMouseCursor(final MouseCursor mouseCursor) {
}
@Override
public void disableMouseCursor() {
}
@Override
public void createAtlasTexture(final int width, final int height) {
try {
createAtlasTexture(width, height, GL.GL_RGBA);
initialData = Buffers.newDirectByteBuffer(width*height*4);
for (int i=0; i<width*height; i++) {
initialData.put((byte) 0x00);
initialData.put((byte) 0xff);
initialData.put((byte) 0x00);
initialData.put((byte) 0xff);
}
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
}
}
@Override
public void clearAtlasTexture(final int width, final int height) {
initialData.rewind();
texture.updateTextureData(initialData);
}
@Override
public Image loadImage(final String filename) {
ImageData loader = createImageLoader(filename);
try {
ByteBuffer image = loader.loadImageDirect(resourceLoader.getResourceAsStream(filename));
image.rewind();
int width = loader.getWidth();
int height = loader.getHeight();
return new ImageImpl(width, height, image);
} catch (Exception e) {
log.log(Level.WARNING, "problems loading image [" + filename + "]", e);
return new ImageImpl(0, 0, null);
}
}
@Override
public void addImageToTexture(final Image image, final int x, final int y) {
ImageImpl imageImpl = (ImageImpl) image;
if (imageImpl.getWidth() == 0 ||
imageImpl.getHeight() == 0) {
return;
}
final GL gl = GLContext.getCurrentGL();
gl.glTexSubImage2D(
GL.GL_TEXTURE_2D,
0,
x,
y,
image.getWidth(),
image.getHeight(),
GL.GL_RGBA,
GL.GL_UNSIGNED_BYTE,
imageImpl.byteBuffer);
}
@Override
public void beginBatch(final BlendMode blendMode) {
batches.add(batchPool.allocate());
currentBatch = batches.get(batches.size() - 1);
currentBatch.begin(blendMode);
}
@Override
public void addQuad(
final float x,
final float y,
final float width,
final float height,
final Color color1,
final Color color2,
final Color color3,
final Color color4,
final float textureX,
final float textureY,
final float textureWidth,
final float textureHeight) {
if (!currentBatch.canAddQuad()) {
beginBatch(currentBatch.getBlendMode());
}
currentBatch.addQuadInternal(x, y, width, height, color1, color2, color3, color4, textureX, textureY, textureWidth, textureHeight);
}
@Override
public int render() {
niftyShader.activate();
bind();
for (int i=0; i<batches.size(); i++) {
Batch batch = batches.get(i);
batch.render();
}
return batches.size();
}
@Override
public void removeFromTexture(final Image image, final int x, final int y, final int w, final int h) {
// Since we clear the whole texture when we switch screens it's not really necessary to remove data from the
// texture atlas when individual textures are removed. If necessary this can be enabled with a system property.
if (!fillRemovedTexture) {
return;
}
ByteBuffer initialData = Buffers.newDirectByteBuffer(image.getWidth()*image.getHeight()*4);
for (int i=0; i<image.getWidth()*image.getHeight(); i++) {
initialData.put((byte) 0xff);
initialData.put((byte) 0x00);
initialData.put((byte) 0x00);
initialData.put((byte) 0xff);
}
initialData.rewind();
final GL gl = GLContext.getCurrentGL();
gl.glTexSubImage2D(
GL.GL_TEXTURE_2D,
0,
x,
y,
w,
h,
GL.GL_RGBA,
GL.GL_UNSIGNED_BYTE,
initialData);
}
private void getViewport() {
final GL gl = GLContext.getCurrentGL();
gl.glGetIntegerv(GL.GL_VIEWPORT, viewportBuffer);
viewportWidth = viewportBuffer.get(2);
viewportHeight = viewportBuffer.get(3);
if (log.isLoggable(Level.FINE)) {
log.fine("Viewport: " + viewportWidth + ", " + viewportHeight);
}
}
// internal implementations
private void checkGLError() {
final GL gl = GLContext.getCurrentGL();
int error= gl.glGetError();
if (error != GL.GL_NO_ERROR) {
log.warning("Error: (" + error + ") ");
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private Cursor loadMouseCursor(final String name, final int hotspotX, final int hotspotY) throws IOException {
ImageData imageLoader = createImageLoader(name);
BufferedImage image = imageLoader.loadMouseCursorImage(resourceLoader.getResourceAsStream(name));
return Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(hotspotX,hotspotY), name);
}
private ImageData createImageLoader(final String name) {
if (name.endsWith(".tga")) {
return new TGAImageData();
}
return new ImageIOImageData();
}
private void createAtlasTexture(final int width, final int height, final int srcPixelFormat) throws Exception {
ByteBuffer initialData = Buffers.newDirectByteBuffer(width*height*4);
for (int i=0; i<width*height*4; i++) {
initialData.put((byte) 0x80);
}
initialData.rewind();
texture = new CoreTexture2D(ColorFormat.RGBA, width, height, initialData, ResizeFilter.Nearest);
}
private void bind() {
texture.bind();
}
/**
* Simple BatchRenderBackend.Image implementation that will transport the dimensions of an image as well as the
* actual bytes from the loadImage() to the addImageToTexture() method.
*
* @author void
*/
private static class ImageImpl implements BatchRenderBackend.Image {
private final int width;
private final int height;
private final ByteBuffer byteBuffer;
public ImageImpl(final int width, final int height, final ByteBuffer byteBuffer) {
this.width = width;
this.height = height;
this.byteBuffer = byteBuffer;
}
@Override
public int getWidth() {
return width;
}
@Override
public int getHeight() {
return height;
}
}
/**
* This class helps us to manage the batch data. We'll keep a bunch of instances of this class around that will be
* reused when needed. Each Batch instance provides room for a certain amount of vertices and we'll use a new Batch
* when we exceed this amount of data.
*
* @author void
*/
private class Batch {
// 4 vertices per quad and 8 vertex attributes per vertex:
// - 2 x pos
// - 2 x texture
// - 4 x color
private final static int PRIMITIVE_SIZE = 4*8;
private final int SIZE = 64*1024; // 64k
private BlendMode blendMode = BlendMode.BLEND;
private int primitiveCount;
private final CoreVAO vao;
private final CoreVBO vbo;
private final CoreElementVBO elementVbo;
private int globalIndex;
private int triangleVertexCount;
private Batch() {
vao = new CoreVAO();
vao.bind();
elementVbo = CoreElementVBO.createStream(new int[SIZE]);
elementVbo.bind();
vbo = CoreVBO.createStream(new float[SIZE]);
vbo.bind();
vao.enableVertexAttributef(niftyShader.getAttribLocation("aVertex"), 2, 8, 0);
vao.enableVertexAttributef(niftyShader.getAttribLocation("aColor"), 4, 8, 2);
vao.enableVertexAttributef(niftyShader.getAttribLocation("aTexture"), 2, 8, 6);
primitiveCount = 0;
globalIndex = 0;
triangleVertexCount = 0;
vao.unbind();
}
public void begin(final BlendMode blendMode) {
vao.bind();
vbo.bind();
vbo.getBuffer().clear();
elementVbo.bind();
elementVbo.getBuffer().clear();
primitiveCount = 0;
globalIndex = 0;
triangleVertexCount = 0;
vao.unbind();
}
public BlendMode getBlendMode() {
return blendMode;
}
public void render() {
final GL gl = GLContext.getCurrentGL();
if (blendMode.equals(BlendMode.BLEND)) {
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
} else if (blendMode.equals(BlendMode.MULIPLY)) {
gl.glBlendFunc(GL.GL_DST_COLOR, GL.GL_ZERO);
}
vao.bind();
vbo.getBuffer().flip();
vbo.bind();
vbo.send();
elementVbo.getBuffer().flip();
elementVbo.bind();
elementVbo.send();
CoreRender.renderTrianglesIndexed(triangleVertexCount);
}
public boolean canAddQuad() {
return ((primitiveCount + 1) * PRIMITIVE_SIZE) < SIZE;
}
private void addQuadInternal(
final float x,
final float y,
final float width,
final float height,
final Color color1,
final Color color2,
final Color color3,
final Color color4,
final float textureX,
final float textureY,
final float textureWidth,
final float textureHeight) {
int bufferIndex = 0;
primitiveBuffer[bufferIndex++] = x;
primitiveBuffer[bufferIndex++] = y;
primitiveBuffer[bufferIndex++] = color1.getRed();
primitiveBuffer[bufferIndex++] = color1.getGreen();
primitiveBuffer[bufferIndex++] = color1.getBlue();
primitiveBuffer[bufferIndex++] = color1.getAlpha();
primitiveBuffer[bufferIndex++] = textureX;
primitiveBuffer[bufferIndex++] = textureY;
primitiveBuffer[bufferIndex++] = x + width;
primitiveBuffer[bufferIndex++] = y;
primitiveBuffer[bufferIndex++] = color2.getRed();
primitiveBuffer[bufferIndex++] = color2.getGreen();
primitiveBuffer[bufferIndex++] = color2.getBlue();
primitiveBuffer[bufferIndex++] = color2.getAlpha();
primitiveBuffer[bufferIndex++] = textureX + textureWidth;
primitiveBuffer[bufferIndex++] = textureY;
primitiveBuffer[bufferIndex++] = x + width;
primitiveBuffer[bufferIndex++] = y + height;
primitiveBuffer[bufferIndex++] = color4.getRed();
primitiveBuffer[bufferIndex++] = color4.getGreen();
primitiveBuffer[bufferIndex++] = color4.getBlue();
primitiveBuffer[bufferIndex++] = color4.getAlpha();
primitiveBuffer[bufferIndex++] = textureX + textureWidth;
primitiveBuffer[bufferIndex++] = textureY + textureHeight;
primitiveBuffer[bufferIndex++] = x;
primitiveBuffer[bufferIndex++] = y + height;
primitiveBuffer[bufferIndex++] = color3.getRed();
primitiveBuffer[bufferIndex++] = color3.getGreen();
primitiveBuffer[bufferIndex++] = color3.getBlue();
primitiveBuffer[bufferIndex++] = color3.getAlpha();
primitiveBuffer[bufferIndex++] = textureX;
primitiveBuffer[bufferIndex++] = textureY + textureHeight;
int elementIndexBufferIndex = 0;
elementIndexBuffer[elementIndexBufferIndex++] = globalIndex + 0;
elementIndexBuffer[elementIndexBufferIndex++] = globalIndex + 1;
elementIndexBuffer[elementIndexBufferIndex++] = globalIndex + 2;
elementIndexBuffer[elementIndexBufferIndex++] = globalIndex + 2;
elementIndexBuffer[elementIndexBufferIndex++] = globalIndex + 3;
elementIndexBuffer[elementIndexBufferIndex++] = globalIndex + 0;
triangleVertexCount += 6;
globalIndex += 4;
vbo.getBuffer().put(primitiveBuffer);
elementVbo.getBuffer().put(elementIndexBuffer);
primitiveCount++;
}
}
}
| [
"[email protected]"
] | |
fa7a4b63a23cc3cce3393b7c04671d212c2e57ad | e0685286cc1ddd3d8105f090233c9b7cbcf17f7d | /JavaConcentration/src/AutoResetEvent.java | e83176565c828fe1d63826ea5a4d854ad8614df5 | [] | no_license | dgsmith77/Concentration-nation | 0e2e7c63405c8585d2a3cea59edf93c089f73483 | 76ca8edff95639209cb82844e6aa04b41d6e7978 | refs/heads/master | 2021-01-10T12:01:36.732503 | 2018-01-19T00:35:28 | 2018-01-19T00:35:28 | 49,285,055 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | public class AutoResetEvent
{
private final Object _monitor = new Object();
private volatile boolean _isOpen = false;
public AutoResetEvent(boolean open)
{
_isOpen = open;
}
public void waitOne() throws InterruptedException
{
synchronized (_monitor) {
while (!_isOpen) {
_monitor.wait();
}
_isOpen = false;
}
}
public void waitOne(long timeout) throws InterruptedException
{
synchronized (_monitor) {
long t = System.currentTimeMillis();
while (!_isOpen) {
_monitor.wait(timeout);
// Check for timeout
if (System.currentTimeMillis() - t >= timeout)
break;
}
_isOpen = false;
}
}
public void set()
{
synchronized (_monitor) {
_isOpen = true;
_monitor.notify();
}
}
public void reset()
{
_isOpen = false;
}
} | [
"[email protected]"
] | |
6c4ed96f9a5a53d625548dd7fa51a2b76693a272 | 01291f18ffd7e35d3d481c987ad6eace2eff9795 | /src/test/java/solvd/com/carina/demo/WebMultipleBrowserTest.java | 955e242070c7a2c22d62c2bca9188be018033338 | [
"Apache-2.0"
] | permissive | SergeiZagriychuk/webinar-ta-tmp | 834364b646c98ffd6ab5cd105eeb05486fa4c85b | 25715ea9dae79823cb465827fa20a247bff4cfa2 | refs/heads/master | 2023-05-09T17:20:16.876584 | 2021-06-02T20:39:16 | 2021-06-02T20:39:16 | 373,261,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | /*
* Copyright 2013-2021 QAPROSOFT (http://qaprosoft.com/).
*
* 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 solvd.com.carina.demo;
import com.qaprosoft.carina.core.foundation.AbstractTest;
import com.qaprosoft.carina.core.foundation.utils.ownership.MethodOwner;
import com.qaprosoft.carina.core.foundation.webdriver.Screenshot;
import com.qaprosoft.carina.core.foundation.webdriver.core.capability.impl.desktop.ChromeCapabilities;
import com.qaprosoft.carina.core.foundation.webdriver.core.capability.impl.desktop.FirefoxCapabilities;
import solvd.com.carina.demo.gui.components.NewsItem;
import solvd.com.carina.demo.gui.pages.HomePage;
import solvd.com.carina.demo.gui.pages.NewsPage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.List;
/**
* This sample shows how initialize multiple drivers and run the tests on different browsers.
*
* @author qpsdemo
*/
public class WebMultipleBrowserTest extends AbstractTest {
@Test
@MethodOwner(owner = "qpsdemo")
public void multipleBrowserTest() {
HomePage chromeHomePage = new HomePage(getDriver("chrome", new ChromeCapabilities().getCapability("Chrome Test")));
chromeHomePage.open();
Assert.assertTrue(chromeHomePage.isPageOpened(), "Chrome home page is not opened!");
HomePage firefoxHomePage = new HomePage(getDriver("firefox", new FirefoxCapabilities().getCapability("Firefox Test")));
firefoxHomePage.open();
Assert.assertTrue(firefoxHomePage.isPageOpened(), "Firefox home page is not opened!");
Assert.assertEquals(firefoxHomePage.getDriver().getTitle(), "GSMArena.com - mobile phone reviews, news, specifications and more...");
Screenshot.capture(firefoxHomePage.getDriver(), "Firefox capture!");
NewsPage newsPage = chromeHomePage.getFooterMenu().openNewsPage();
final String searchQ = "iphone";
List<NewsItem> news = newsPage.searchNews(searchQ);
Screenshot.capture(chromeHomePage.getDriver(), "Chrome capture!");
Assert.assertFalse(CollectionUtils.isEmpty(news), "News not found!");
for(NewsItem n : news) {
System.out.println(n.readTitle());
Assert.assertTrue(StringUtils.containsIgnoreCase(n.readTitle(), searchQ), "Invalid search results!");
}
}
} | [
"[email protected]"
] | |
3f56ae18d209a56a70723ac70147281b45d50ae2 | be21463c6844cb1b384423a5360ad1ca64584dc7 | /java/JSP & Servlet学习笔记(第3版)——labs/CH09/JDBC/src/cc/openhome/GuestBookBean.java | ba90703cddfef80b3d14ea773ff3f32ca992f3aa | [] | no_license | issyHe/test | 0232c40e692a1b6289cd96f9a639461224cd4257 | fe1e3e2c1c9289778ca4d8a10ed16a838a9427c1 | refs/heads/master | 2023-01-21T11:31:23.936968 | 2021-01-11T14:53:49 | 2021-01-11T14:53:49 | 243,975,448 | 0 | 0 | null | 2023-01-12T13:47:52 | 2020-02-29T13:40:01 | JavaScript | UTF-8 | Java | false | false | 597 | java | package cc.openhome;
import java.sql.*;
import java.util.*;
import java.io.*;
public class GuestBookBean implements Serializable {
private String jdbcUri = "jdbc:h2:tcp://localhost/c:/workspace/JDBC/demo";
private String username = "caterpillar";
private String password = "12345678";
public GuestBookBean() {
try {
Class.forName("org.h2.Driver");
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
}
public void setMessage(Message message) {
}
public List<Message> getMessages() {
}
}
| [
"[email protected]"
] | |
6b20dd540e8ee707ec87085376a164eddd58d264 | b9daf9e14c3f1cbf2fd78e5532dd4000b716e3b0 | /src/main/java/com/jacaranda/model/DietCategory.java | 5adfe6434054157254708960319110c516446e37 | [] | no_license | alvarodachez/DietTogetherJava | 44f81eb790c37fbb66276fde3e6df9079e19a27a | 91dd0683477e1ca0c326326cf35d3d410ea8d6b2 | refs/heads/master | 2023-05-17T08:54:49.338982 | 2021-06-04T15:56:59 | 2021-06-04T15:56:59 | 335,050,660 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package com.jacaranda.model;
public enum DietCategory {
DAYRY, MEAT, FISH, EGG, VEGETABLE, NUT, POTATO, FRUIT, CEREAL
}
| [
"[email protected]"
] | |
1abc8e66811dcce237ce64828d64a3377f3c4e4b | 14192eb1854422e4d386858ec596b568822f1a80 | /src/main/java/net/minecraft/hopper/Util.java | a9e892ac8903f0a3e154e02216d1811d68af9337 | [] | no_license | samoyloff/MCFreedomLauncher | 855667a281d20e81286e2fb7acaec8421274c18a | 3e74c30b4b55487ef8e28eb62e6887705e88a6d8 | refs/heads/master | 2023-04-15T23:05:47.220043 | 2021-04-14T07:22:57 | 2021-04-14T07:22:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,934 | java | package net.minecraft.hopper;
import org.apache.commons.io.IOUtils;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URL;
import static java.nio.charset.StandardCharsets.UTF_8;
public class Util {
public static String performPost(final URL url, final String parameters, final Proxy proxy, final String contentType, final boolean returnErrorPage) throws IOException {
final HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);
final byte[] paramAsBytes = parameters.getBytes(UTF_8);
connection.setConnectTimeout(15000);
connection.setReadTimeout(15000);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", contentType + "; charset=utf-8");
connection.setRequestProperty("Content-Length", "" + paramAsBytes.length);
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
final DataOutputStream writer = new DataOutputStream(connection.getOutputStream());
writer.write(paramAsBytes);
writer.flush();
writer.close();
InputStream stream;
try {
stream = connection.getInputStream();
} catch (IOException e) {
if (!returnErrorPage) {
throw e;
}
stream = connection.getErrorStream();
if (stream == null) {
throw e;
}
}
return IOUtils.toString(stream, UTF_8);
}
public static URL constantURL(final String input) {
try {
return new URL(input);
} catch (MalformedURLException e) {
throw new Error(e);
}
}
}
| [
"[email protected]"
] | |
e78b88c7dd36e961543bf0c48943aa6a2b0cacdf | 36aeef892701f1ec50e31ed4cb4d1cb330076fc6 | /eu.kdot.twitch.kbot/src/main/java/eu/kdot/twitch/kbot/model/BotManager.java | e10664773659e2b0fd22cae79612d411c56124fa | [] | no_license | kdoteu/eu.kdot.twitch | 4b04b0896e284dabb8d0ad6e28b2a4c11c460632 | a724d74c4534110f5bb248bde11ab7a052d1ff70 | refs/heads/master | 2020-03-27T04:57:37.368555 | 2015-03-10T21:58:32 | 2015-03-10T21:58:32 | 31,983,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | /**
*
*/
package eu.kdot.twitch.kbot.model;
import java.util.ArrayList;
import java.util.List;
/**
* @author kdot
*
*/
public class BotManager {
private List<Bot> bots;
public BotManager() {
bots = new ArrayList<Bot>();
}
public void addBot(BotConfiguration configuration){
getBots().add(new Bot(configuration));
}
/**
* @return the bots
*/
public List<Bot> getBots() {
return bots;
}
}
| [
"[email protected]"
] | |
8e6333045e9bf462798c8c22d11411d046a8f928 | 395ecc17877f2524710334ad290c71898838f0d1 | /src/observerpattern/messagepublishing/observers/Observer.java | 24296312da400ff82a23e2b5f087040d26647b94 | [] | no_license | chiamakacha/DesignPatterns | 1e8550d5eea7a6655d165a62c496986ce08161b1 | bde265aab7ed5e27a65811bf01a02de95f322cae | refs/heads/master | 2022-11-14T23:22:36.458625 | 2020-07-14T15:29:46 | 2020-07-14T15:29:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package observerpattern.messagepublishing.observers;
import observerpattern.messagepublishing.Message;
import observerpattern.messagepublishing.subject.Subject;
public interface Observer {
void update(Subject subject, Message m);
}
| [
"[email protected]"
] | |
a48795f69159e3f8ec83867c434dc6698b482113 | 69077023d6ddbfc2d488122e91e626c82d72f5be | /play2-providers/play2-provider-play22/src/main/java/com/google/code/play2/provider/play22/Play22RoutesCompiler.java | c63abe1e009800dc370ee3fbb27d7e1541132ecf | [
"Apache-2.0"
] | permissive | mabrcosta/play2-maven-plugin | 20111ccd353b4740db1fc3485efe382796e0ea3f | eb3baf1d95d648ed7cedddb295b25836c73dec3a | refs/heads/master | 2020-05-18T08:23:38.076641 | 2019-04-30T16:18:47 | 2019-04-30T17:55:09 | 184,292,984 | 0 | 0 | null | 2019-04-30T16:07:11 | 2019-04-30T16:07:11 | null | UTF-8 | Java | false | false | 2,998 | java | /*
* Copyright 2013-2019 Grzegorz Slowikowski (gslowikowski at gmail dot com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.google.code.play2.provider.play22;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import scala.collection.JavaConversions;
import play.router.RoutesCompiler;
import com.google.code.play2.provider.api.Play2RoutesCompiler;
import com.google.code.play2.provider.api.RoutesCompilationException;
public class Play22RoutesCompiler
implements Play2RoutesCompiler
{
private static final String[] javaAdditionalImports = new String[] { "play.libs.F" };
private static final String[] scalaAdditionalImports = new String[] {};
private static final String[] supportedGenerators = new String[] { "static" };
private File outputDirectory;
private List<String> additionalImports;
@Override
public String getCustomOutputDirectoryName()
{
return null;
}
@Override
public String getDefaultNamespace()
{
return null;
}
@Override
public String getMainRoutesFileName()
{
return "routes_routing.scala";
}
@Override
public String[] getSupportedGenerators()
{
return supportedGenerators;
}
@Override
public List<String> getDefaultJavaImports()
{
return Arrays.asList( javaAdditionalImports );
}
@Override
public List<String> getDefaultScalaImports()
{
return Arrays.asList( scalaAdditionalImports );
}
@Override
public void setOutputDirectory( File outputDirectory )
{
this.outputDirectory = outputDirectory;
}
@Override
public void setGenerator( String generator )
{
// Not supported
}
@Override
public void setAdditionalImports( List<String> additionalImports )
{
this.additionalImports = additionalImports;
}
@Override
public void compile( File routesFile )
throws RoutesCompilationException
{
try
{
RoutesCompiler.compile( routesFile, outputDirectory, JavaConversions.asScalaBuffer( additionalImports ),
true, false );
}
catch ( RoutesCompiler.RoutesCompilationError e )
{
throw new RoutesCompilationException( e.source(), e.message(), (Integer) e.line().get(),
(Integer) e.column().get() );
}
}
}
| [
"[email protected]"
] | |
7c6d0294f6ad18cf278480bb245e7740789f1a16 | 284ccfa51259577e33cc90a2473bbbe860f57720 | /src/main/java/com/maikun/service/buyer/products/ProductVOService.java | 169a2d283e8a02bed3f39a5020aa80ae6b4bd8e0 | [] | no_license | threeoldman/com.maikun.service.product | fb01e61fc74efb17794b682fddb794b88fe3581b | d6d10c7ef3d1cb17416eeebfad690b85d14ab76e | refs/heads/master | 2020-03-31T17:38:39.801616 | 2018-09-17T13:42:35 | 2018-09-17T13:42:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,769 | java | package com.maikun.service.buyer.products;
import com.maikun.service.buyer.productcategory.ProductCategory;
import com.maikun.service.buyer.productinfo.ProductInfo;
import com.maikun.service.buyer.productinfo.ProductInfoVO;
import java.util.List;
/**
* @program: products
* @Description: 提供产品图示逻辑服务
* @author: Mr.Cheng
* @date: 2018/9/15 下午3:43
*/
public interface ProductVOService {
/**
* @Description: 从产品详情转换成产品图示
* @Param: [productInfo]
* @return: com.maikun.service.buyer.productinfo.ProductInfoVO
* @Author: Mr.Cheng
* @Date: 2018/9/15 下午4:28
*/
ProductInfoVO makeProductInfoVOFromProductInfo(ProductInfo productInfo);
/**
* @Description: 从产品详情列表转换成产品图示列表
* @Param: [productInfoList]
* @return: java.util.List<com.maikun.service.buyer.productinfo.ProductInfoVO>
* @Author: Mr.Cheng
* @Date: 2018/9/15 下午4:28
*/
List<ProductInfoVO> makeProductInfoVOListFromProductInfo(List<ProductInfo> productInfoList);
/**
* @Description: 根据产品类别产生产品列表
* @Param: [productCategory]
* @return: java.util.List<com.maikun.service.buyer.productinfo.ProductInfoVO>
* @Author: Mr.Cheng
* @Date: 2018/9/15 下午9:39
*/
List<ProductInfoVO> makeProductInfoVOListByCategory(Integer categoryId);
/**
* @Description: 给用户展示产品列表
* @Param: [productCategoryList, productInfoVOList]
* @return: java.util.List<com.maikun.service.buyer.products.ProductVO>
* @Author: Mr.Cheng
* @Date: 2018/9/15 下午9:16
*/
List<ProductVO> makeProductVOList(List<ProductCategory> productCategoryList,List<ProductInfoVO> productInfoVOList);
}
| [
"[email protected]"
] | |
8358abd345b2613a5b369015882c574311dbe751 | 55f36d7eca1794655ba475f403872196ea10ad25 | /src/VerticalLine.java | e187cabd0dda4fc11543473db6c431f61a6a103b | [] | no_license | bhawnasingla/ProgrammingAssignment | ba880974190d7c70e379502d6760d775de090af8 | 2e59d525e6b996f1ffacf16d76eae01e38eb0ff8 | refs/heads/master | 2021-01-10T14:09:18.001355 | 2016-03-09T04:45:29 | 2016-03-09T04:45:29 | 53,468,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | /**
* Created by bhawnasingla on 07/02/16.
*/
public class VerticalLine {
public static void main(String[] args) {
int n=8;
PrintLine(n);
}
private static void PrintLine(int n) {
for(int i = 0; i<n; i++)
System.out.println("*");
}
}
| [
"[email protected]"
] | |
2ea51f061235ae9388655768edde84a82cba2b30 | dba220abb6992d9adf73ac00f3eb0d0c793dcb27 | /src/main/java/com/library/rowmappers/ReadersRowMapper.java | d2a13cd3e7ad70fb88c55ac55920149c151b4184 | [] | no_license | leonidFure/LibraryServer | 1a1542d7579ab6119059ce10848894299d81cebf | 2bd6ed095c30aee19325384c1d2ff85eb8c77c12 | refs/heads/master | 2020-05-15T18:33:35.667081 | 2019-05-13T06:25:59 | 2019-05-13T06:25:59 | 182,430,059 | 0 | 0 | null | 2019-05-13T06:26:00 | 2019-04-20T16:39:21 | Java | UTF-8 | Java | false | false | 837 | java | package com.library.rowmappers;
import com.library.models.Reader;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ReadersRowMapper implements RowMapper<Reader> {
@Override
public Reader mapRow(ResultSet resultSet, int i) throws SQLException {
return new Reader(resultSet.getInt("reader_id"),
resultSet.getString("name"),
resultSet.getString("second_name"),
resultSet.getString("patronymic"),
resultSet.getDate("birth_date"),
resultSet.getDate("registration_date"),
resultSet.getInt("debt"),
resultSet.getString("status_short"),
resultSet.getString("email"),
resultSet.getString("phone_number"));
}
}
| [
"[email protected]"
] | |
3d71585922bde97640c54051a9509ea36f1f1cf1 | ee2e5f70beebad883df767bc63c77884cee5389e | /MergeSort With Threads/MergePanel.java | 1f2f1af59148d96ef387a6ba2f31955641a1b73f | [] | no_license | YaroslavMiloslavsky/Java-Learning | f8c2a3f4d328c08e53566a0f2b3b1834d8897787 | 3ec7a9f1bb9b69bfdd65506d3a3386e6335754b4 | refs/heads/master | 2022-11-08T11:03:08.246988 | 2020-06-16T09:30:00 | 2020-06-16T09:30:00 | 235,999,467 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,152 | java | import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class MergePanel extends JPanel {
private ThreadMonitor monitor;
private JTextField txtN, txtM;
private JButton btnGenerate, btnMerge, btnClear;
private JLabel lblN, lblM;
private JTextArea mainArea;
private Integer[] unsortedArray;
private int numberOfThreads;
public MergePanel() {
txtN = new JTextField(10);
lblN = new JLabel("Array size: ");
lblM = new JLabel("Threads number: ");
txtM = new JTextField(10);
mainArea = new JTextArea();
mainArea.setEditable(false);
mainArea.setFont(mainArea.getFont().deriveFont(Font.BOLD, 14f));
JScrollPane scrollPanel = new JScrollPane(mainArea);
btnGenerate = new JButton("Generate array");
btnMerge = new JButton("Merge-sort");
btnClear = new JButton("Clear");
ButtonListener listener = new ButtonListener();
btnGenerate.addActionListener(listener);
btnMerge.addActionListener(listener);
btnClear.addActionListener(listener);
//south panel
JPanel southPanel = new JPanel();
southPanel.add(lblN);
southPanel.add(txtN);
southPanel.add(lblM);
southPanel.add(txtM);
// north panel
JPanel northPanel = new JPanel();
northPanel.add(btnGenerate);
northPanel.add(btnMerge);
northPanel.add(btnClear);
this.setLayout(new BorderLayout());
this.add(scrollPanel , BorderLayout.CENTER);
this.add(northPanel , BorderLayout.NORTH);
this.add(southPanel , BorderLayout.SOUTH);
mainArea.append("Please enter array size and threads number\n");
}
private class ButtonListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btnGenerate) {
mainArea.setText(null);
if(txtN.getText().length()<1 || txtM.getText().length()<1) {
JOptionPane.showMessageDialog(MergePanel.this, "Please fill the fields on the buttom of the panel");
return;
}
try {
Integer n = Integer.parseInt(txtN.getText());
Integer m = Integer.parseInt(txtM.getText());
unsortedArray = new Integer[n];
numberOfThreads = m ;
// Generate array with random values from 1 .. 100
for(int i=0; i<n ;i++)
unsortedArray[i] = (int)(1 + Math.random()*100);
// Print the array
for(Integer x : unsortedArray)
mainArea.append(String.format("%d ", x));
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(MergePanel.this, "The fields must contain numbers");
}
}
if(e.getSource() == btnMerge) {
mainArea.append("\n");
monitor = new ThreadMonitor(unsortedArray, numberOfThreads);
for(int i=0; i<numberOfThreads; i++)
(new Compute(monitor)).start();
Integer[] temp = monitor.sortedArray();
for(Integer x : temp)
mainArea.append(String.format("%d ", x));
}
if(e.getSource() == btnClear) {
mainArea.setText(null);
}
}
}
}
| [
"[email protected]"
] | |
4a0bc933998fd58f07466f979551d002fb919599 | 10b85e6d68708cb85810f6bf6bdc157f88c5dcb1 | /src/com/ebao/aig/sg/fulfillment/rules/upload/staging/data/dao/StgCampaignMappingConfigDaoFactory.java | e80b59a9cf86b7ccfb3c713a23654ad30f91a65c | [] | no_license | karthik-sr87/FulfillmentRulesUpload | d374d3a755d712950f020216336fb6450abeaf9e | be9199ff643c722921fcac266f8a88343b12ba42 | refs/heads/master | 2021-01-16T18:29:38.406022 | 2015-06-22T13:04:48 | 2015-06-22T13:04:48 | 37,633,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package com.ebao.aig.sg.fulfillment.rules.upload.staging.data.dao;
import com.ebao.aig.sg.fulfillment.rules.upload.staging.data.dao.impl.StgCampaignMappingConfigDaoOracleImpl;
import com.ebao.aig.sg.fulfillment.rules.upload.staging.data.mysql.dao.impl.StgCampaignMappingConfigDaoMysqlImpl;
import com.ebao.foundation.common.config.Env;
public class StgCampaignMappingConfigDaoFactory {
private static StgCampaignMappingConfigDao dao=new StgCampaignMappingConfigDaoOracleImpl();
public static StgCampaignMappingConfigDao getStgCampaignMappingConfigDao(){
String databaseType = Env.getValue("DATABASE_TYPE");
System.out.println("Database Name : "+databaseType);
if(databaseType.equalsIgnoreCase("MYSQL"))
dao = new StgCampaignMappingConfigDaoMysqlImpl();
return dao;
}
} | [
"[email protected]"
] | |
aaca032a1d0f421dde0314226120195aca7e40c5 | 207546688353f61854d85ec3e66f75d1b6f2dbda | /app/src/main/java/com/bagevent/activity_manager/manager_fragment/manager_interface/presenter/ConfirmOrderPresenter.java | cbaf6b0903a6078d620f393b4a0e99f6da9e3694 | [] | no_license | sun-liqun/bagevents | 03cf096adc5a636c47f44721ce3895d910002b34 | 2d1830bec29fc2a5d5effb0a85081d3a3bfc8191 | refs/heads/master | 2021-01-14T05:52:42.543999 | 2020-03-02T10:05:59 | 2020-03-02T10:06:24 | 242,617,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,358 | java | package com.bagevent.activity_manager.manager_fragment.manager_interface.presenter;
import com.bagevent.activity_manager.manager_fragment.manager_interface.ConfirmOrderInterface;
import com.bagevent.activity_manager.manager_fragment.manager_interface.impls.ConfirmOrderImpl;
import com.bagevent.activity_manager.manager_fragment.manager_interface.manager_listener.OnConfirmOrderListener;
import com.bagevent.activity_manager.manager_fragment.manager_interface.view.ConfirmOrderView;
/**
* Created by WenJie on 2017/11/1.
*/
public class ConfirmOrderPresenter {
private ConfirmOrderInterface confirmOrder;
private ConfirmOrderView confirmOrderView;
public ConfirmOrderPresenter(ConfirmOrderView confirmOrderView) {
this.confirmOrder = new ConfirmOrderImpl();
this.confirmOrderView = confirmOrderView;
}
public void confirm() {
confirmOrder.confirmOrder(confirmOrderView.mContext(), confirmOrderView.eventId(), confirmOrderView.orderId(), new OnConfirmOrderListener() {
@Override
public void showConfirmSuccess(String response) {
confirmOrderView.showConfirmSuccess(response);
}
@Override
public void showConfirmFailed(String errInfo) {
confirmOrderView.showConfirmFailed(errInfo);
}
});
}
}
| [
"[email protected]"
] | |
215cd0613ba13be56a4e37de2ac0bd0ef3dd6fa1 | 9cefeefb572ff66c9dfc7569dd36946d20acff1f | /src/main/java/life/genny/qwandautils/KeycloakService.java | 8ab1d8210b2c43ea2daa991f802f4d1091cc7bd4 | [
"Apache-2.0"
] | permissive | genny-project/qwanda-utils | 5b52314f2271ae20ee8508cc1e558ecaab494d82 | db097d2eb4b29d30b11d536129c7e3b2180a6632 | refs/heads/9.13.1 | 2023-04-01T23:33:45.092115 | 2023-03-28T02:09:56 | 2023-03-28T02:09:56 | 99,695,799 | 1 | 0 | Apache-2.0 | 2023-03-28T02:10:30 | 2017-08-08T13:26:12 | Java | UTF-8 | Java | false | false | 5,910 | java | package life.genny.qwandautils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
// import org.apache.http.HttpEntity;
// import org.apache.http.HttpResponse;
// import org.apache.http.NameValuePair;
// import org.apache.http.client.HttpClient;
// import org.apache.http.client.entity.UrlEncodedFormEntity;
// import org.apache.http.client.methods.HttpGet;
// import org.apache.http.client.methods.HttpPost;
// import org.apache.http.impl.client.DefaultHttpClient;
// import org.apache.http.message.BasicNameValuePair;
//// import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.common.util.KeycloakUriBuilder;
import org.keycloak.constants.ServiceUrlConstants;
import org.keycloak.representations.AccessTokenResponse;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.util.JsonSerialization;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
public class KeycloakService {
String keycloakUrl = null;
String realm = null;
String username = null;
String password = null;
String clientid = null;
String secret = null;
AccessTokenResponse accessToken = null;
Keycloak keycloak = null;
public KeycloakService(final String keycloakUrl, final String realm, final String username,
final String password, final String clientid, final String secret) throws IOException {
this.keycloakUrl = keycloakUrl;
this.realm = realm;
this.username = username;
this.password = password;
this.clientid = clientid;
this.secret = secret;
accessToken = getToken();
}
public KeycloakService(final String keycloakUrl, final String realm, final String username,
final String password, final String clientid) throws IOException {
this.keycloakUrl = keycloakUrl;
this.realm = realm;
this.username = username;
this.password = password;
this.clientid = clientid;
this.secret = "public"; // public mode
accessToken = getToken();
}
//
private AccessTokenResponse getToken() throws IOException {
final HttpClient httpClient = new DefaultHttpClient();
try {
final HttpPost post = new HttpPost(KeycloakUriBuilder.fromUri(keycloakUrl + "/auth")
.path(ServiceUrlConstants.TOKEN_PATH).build(realm));
post.addHeader("Content-Type", "application/x-www-form-urlencoded");
final List<NameValuePair> formParams = new ArrayList<NameValuePair>();
formParams.add(new BasicNameValuePair("username", username));
formParams.add(new BasicNameValuePair("password", password));
formParams.add(new BasicNameValuePair(OAuth2Constants.GRANT_TYPE, "password"));
formParams.add(new BasicNameValuePair(OAuth2Constants.CLIENT_ID, "admin-cli"));
if (!this.secret.equals("public")) {
formParams.add(new BasicNameValuePair(OAuth2Constants.CLIENT_SECRET, secret));
}
final UrlEncodedFormEntity form = new UrlEncodedFormEntity(formParams, "UTF-8");
post.setEntity(form);
final HttpResponse response = httpClient.execute(post);
final int statusCode = response.getStatusLine().getStatusCode();
final HttpEntity entity = response.getEntity();
String content = null;
if (statusCode != 200) {
content = getContent(entity);
throw new IOException("" + statusCode);
}
if (entity == null) {
throw new IOException("Null Entity");
} else {
content = getContent(entity);
}
return JsonSerialization.readValue(content, AccessTokenResponse.class);
} finally {
httpClient.getConnectionManager().shutdown();
}
}
public static String getContent(final HttpEntity httpEntity) throws IOException {
if (httpEntity == null)
return null;
final InputStream is = httpEntity.getContent();
try {
final ByteArrayOutputStream os = new ByteArrayOutputStream();
int c;
while ((c = is.read()) != -1) {
os.write(c);
}
final byte[] bytes = os.toByteArray();
final String data = new String(bytes);
return data;
} finally {
try {
is.close();
} catch (final IOException ignored) {
}
}
}
public List<LinkedHashMap> fetchKeycloakUsers() {
final HttpClient client = new DefaultHttpClient();
try {
final HttpGet get =
new HttpGet(this.keycloakUrl + "/auth/admin/realms/" + this.realm + "/users");
get.addHeader("Authorization", "Bearer " + this.accessToken.getToken());
try {
final HttpResponse response = client.execute(get);
if (response.getStatusLine().getStatusCode() != 200) {
throw new IOException();
}
final HttpEntity entity = response.getEntity();
final InputStream is = entity.getContent();
try {
return JsonSerialization.readValue(is, (new ArrayList<UserRepresentation>()).getClass());
} finally {
is.close();
}
} catch (final IOException e) {
throw new RuntimeException(e);
}
} finally {
client.getConnectionManager().shutdown();
}
}
/**
* @return the keycloak
*/
public Keycloak getKeycloak() {
return keycloak;
}
/**
* @param keycloak the keycloak to set
*/
public void setKeycloak(final Keycloak keycloak) {
this.keycloak = keycloak;
}
}
| [
"[email protected]"
] | |
38b30f72603272d5369980d46f92b9bee8bfbf64 | 4a819b256834f7107fe3aaca4f07c214c0bb8c78 | /basetest/src/main/java/reflex/ReflexTest2.java | 3b6f4c726d38af8c85bc54cea612cf444e6835d2 | [] | no_license | tangkui/mytest | c987da13e1dabfa3a1b08a3e7ad052900f466444 | 38a4770931acd230ac4610c0c19dc359db68700a | refs/heads/master | 2021-01-13T14:38:53.833223 | 2019-01-19T17:01:26 | 2019-01-19T17:01:26 | 76,717,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | package reflex;
import org.w3c.dom.events.Event;
import java.io.Serializable;
/**
* Created by tanghao on 2017/3/6.
*/
public class ReflexTest2 implements Serializable {
private static final long serialVersionUID = 4647571441144086606L;
public static void main(String[] args) throws Exception{
Class<?> c1 = Class.forName("reflex.ReflexTest2");
System.out.println("类名:"+c1.getName());
// 取得父类
Class<?> parentClass = c1.getSuperclass();
System.out.println("父类名称:"+parentClass.getName());
//获得该类实现的所有接口
Class<?> intes[] = c1.getInterfaces();
System.out.println("该类实现的所有接口有:");
for(int i=0;i<intes.length;i++){
System.out.println(intes[i].getName());
}
}
}
| [
"[email protected]"
] | |
601b398e6689a335624a0ddf53746478bb61297f | f1e423e89d070ff0fae448109f99dc3bbf32d474 | /src/main/java/com/policysystem/entities/CustomerEntity.java | 706b41cb2edf942bad13bee9606921ddee1c0d7c | [] | no_license | Roshan1130/PolicySystem | ccf27db1f45dce6620f9c70913e716f0395ac7dd | 92a9f4ffe2bab95124c2ff836b495d1d35a93317 | refs/heads/master | 2022-07-24T05:31:47.697813 | 2020-01-06T03:41:51 | 2020-01-06T03:41:51 | 228,897,514 | 0 | 1 | null | 2019-12-23T22:15:14 | 2019-12-18T18:18:39 | Java | UTF-8 | Java | false | false | 2,469 | java | package com.policysystem.entities;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "customers")
public class CustomerEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name="name")
private String name;
@Column(name="email")
private String email;
@Column(name="phone")
private String phone;
@Column(name="gender")
private String gender;
@Column(name="last_four_ssn")
private String lastFourSsn;
@Column(name="dateOfBirth")
private Date date;
@OneToMany(mappedBy = "customer", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<AddressEntity> addresses;
@OneToMany(mappedBy = "customer", fetch = FetchType.LAZY)
private List<PolicyEntity> policies;
public List<PolicyEntity> getPolicies() {
return policies;
}
public void setPolicies(List<PolicyEntity> policies) {
this.policies = policies;
}
public List<AddressEntity> getAddresses() {
return addresses;
}
public void setAddresses(List<AddressEntity> addresses) {
this.addresses = addresses;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getLastFourSsn() {
return lastFourSsn;
}
public void setLastFourSsn(String lastFourSsn) {
this.lastFourSsn = lastFourSsn;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@Override
public String toString() {
return "CustomerEntity [id=" + id + ", name=" + name + ", email=" + email + ", phone=" + phone + ", gender="
+ gender + ", lastFourSsn=" + lastFourSsn + ", date=" + date + "\n , addresses=" + addresses
+ "]";
}
}
| [
"[email protected]"
] | |
d57d842d0fb30105b4bf9f463e6b21ff4ae5b502 | ed66cdd8a3a698d06017520c51ad34fbfa6401ff | /src/main/java/com/lohika/atf/core/web/elements/Span.java | 47092fedc121739c33dd13da974d9db084138420 | [] | no_license | yChistov/atf | 4c685c236a1752a204cd81308eb243cd76fc8c2b | 1d63d6a640b09f1bf308957d39a22bb593c3c304 | refs/heads/master | 2021-07-02T12:59:56.254772 | 2015-09-14T15:30:06 | 2015-09-14T15:30:06 | 42,456,715 | 0 | 0 | null | 2021-06-05T06:42:26 | 2015-09-14T15:17:24 | HTML | UTF-8 | Java | false | false | 303 | java | package com.lohika.atf.core.web.elements;
import com.lohika.atf.core.web.WebComponent;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class Span extends WebComponent<Span>{
public Span(WebDriver driver, By findByMethod) {
super(driver, findByMethod);
}
}
| [
"[email protected]"
] | |
06d47aadef289f98aa3f0b929e02fcbf6d38265f | 5be269b7ce5f53d881c052defa21267c337a0daa | /src/Experiments/Bullion_Modify_Panel.java | fd9d83f35e5b498a919533dc8b64e599eacd75a3 | [] | no_license | BharadwajGK/View-Portfolio-Details | 6442b732e14f86aa24c814321eebf55b62aac5c8 | a1ffce3906d13ea34bb390c14e9994a38921943e | refs/heads/master | 2020-03-26T19:48:44.118670 | 2011-06-29T02:01:19 | 2011-06-29T02:01:19 | 1,970,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,249 | java | package Experiments;
import Sample.HorsPool;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import database.*;
import java.util.*;
public class Bullion_Modify_Panel extends JPanel{
String shares_name,date[],type,brokers;
Date dat1;
String qty;
String amt;
public final mdpanel md;
Bullion_Modify_Panel ref=this;
final JTextField loc=new JTextField(5);
final JTextField latest=new JTextField(5);
final JTextField pur_price=new JTextField(5);
final JTextField dates=new JTextField(5);
final JTextField agent=new JTextField(5);
final JComboBox jcb1=new JComboBox(); final JButton jbcancel=new JButton("Cancel");
public Bullion_Modify_Panel(mdpanel md){
this.md=md;
md.proceed.setEnabled(false);
//this.setTitle("Stocks_Modify");
this.setSize(600,400);
this.setLocation(200,200);
this.setLayout(new BorderLayout());
JPanel jp4=new JPanel();
JPanel jp5=new JPanel();
jp5.setLayout(new BorderLayout(10,10)); //TabbedPane Layout
jp4.setLayout(new GridLayout(6,6,15,15)); //Sub layout 1
jp4.setBorder(BorderFactory.createEmptyBorder(50,50,50,50));
jp4.add(new JLabel("Quantity:"));
jp4.add(loc);
jp4.add(new JLabel("Pur. Price:"));
jp4.add(pur_price);
jp4.add(new JLabel("Date [dd/mm/yyyy]"));
jp4.add(dates);
JPanel jp6=new JPanel();
jp6.setLayout(new FlowLayout()); //Sub layout 2
final JButton jbsave=new JButton("Confrim");
jp6.add(jbsave);
jp6.add(jbcancel);
jbcancel.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
ref.setVisible(false);
}
});
this.add(jp4,BorderLayout.CENTER);
this.add(jp6,BorderLayout.SOUTH);
//this.setVisible(true);
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
}catch(Exception ie){
}
}//
public static void main(String [] args){
new Bullion_Modify_Panel(new mdpanel());//.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}//main
}
| [
"rishabh@localhost.(none)"
] | rishabh@localhost.(none) |
bd5dac1a33d50bf92d960dc0161a09ef2175056d | 98e72e0225c4a7245e5df1b2d2926ea400c7cc7b | /app/src/main/java/com/keertech/regie_phone/Activity/XZFW/Fragment/FWJHMainFragment.java | 2b46554227466dc7e358b0d7364961c3e14dc699 | [] | no_license | soupsueapple/Regie_Phone | 8c66f4e44b2e737480b3a2e2a69e66c2de9e1765 | baba526638338cf4cbafbc7d69fe170b0aa450bb | refs/heads/master | 2021-01-20T04:11:56.612603 | 2017-06-12T07:41:29 | 2017-06-12T07:41:29 | 89,657,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,291 | java | package com.keertech.regie_phone.Activity.XZFW.Fragment;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.DatePicker;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.keertech.regie_phone.Activity.XZFW.ServicePlan.ServicePlanInfoActivity;
import com.keertech.regie_phone.BaseFragment;
import com.keertech.regie_phone.Constant.Constant;
import com.keertech.regie_phone.Listener.ViewClickVibrate;
import com.keertech.regie_phone.Network.HttpClient;
import com.keertech.regie_phone.R;
import com.keertech.regie_phone.Utility.DateTimeUtil;
import com.keertech.regie_phone.Utility.KeerAlertDialog;
import com.keertech.regie_phone.Utility.StringUtility;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import static com.keertech.regie_phone.R.id.recycler_view;
/**
* Created by soup on 2017/5/3.
*/
public class FWJHMainFragment extends BaseFragment{
ArrayList<JSONObject> dateDatas = new ArrayList<>();
private LinearLayout monthLl;
private TextView month_tv;
private RecyclerView recyclerView;
Calendar calendar = Calendar.getInstance();
RecyclerAdapter datesRecyclerAdapter = new RecyclerAdapter();
boolean isThisWeek;
boolean isPreviouslyWeek;
private void assignViews(View convertView) {
monthLl = (LinearLayout) convertView.findViewById(R.id.month_ll);
month_tv = (TextView) convertView.findViewById(R.id.month_tv);
recyclerView = (RecyclerView) convertView.findViewById(recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(datesRecyclerAdapter);
month_tv.setText(DateTimeUtil.getFormatDate(new Date(), DateTimeUtil.MONTHFORMAT));
monthLl.setOnClickListener(new ViewClickVibrate(){
@Override
public void onClick(View view) {
super.onClick(view);
DatePickerDialog dp = new DatePickerDialog(getActivity(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
String month = "";
monthOfYear += 1;
if (monthOfYear < 10) month = "0" + monthOfYear;
else month = monthOfYear + "";
String date = year + "" + month;
month_tv.setText(date);
weekList();
}
},
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH));
dp.show();
}
});
weekList();
}
private void weekList(){
final KeerAlertDialog pd = showKeerAlertDialog(R.string.loading);
pd.show();
RequestParams requestParams = new RequestParams();
requestParams.put("data", "{\"postHandler\":[],\"preHandler\":[],\"executor\":{\"url\":\""+ Constant.MWB_Base_URL+"inspectWeekPlan!weekList.action?yearMonth="+month_tv.getText().toString()+"\",\"type\":\"WebExecutor\"},\"app\":\"1001\"}");
HttpClient.post(Constant.EXEC, requestParams, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
super.onSuccess(statusCode, headers, response);
System.out.println("response: " + response.toString());
pd.dismiss();
try {
if (StringUtility.isSuccess(response)) {
String messageSting = response.getString("message");
JSONObject message = new JSONObject(messageSting);
if (StringUtility.isSuccess(message)) {
JSONArray data = message.optJSONArray("data");
if(dateDatas.size() > 0) dateDatas.clear();
for(int i=0;i<data.length();i++){
JSONObject object = data.optJSONObject(i);
dateDatas.add(object);
}
datesRecyclerAdapter.notifyDataSetChanged();
} else {
showToast(response.getString("message"), getActivity());
}
} else {
showToast(response.getString("message"), getActivity());
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
pd.dismiss();
showNetworkError(getActivity());
super.onFailure(statusCode, headers, responseString, throwable);
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
pd.dismiss();
showNetworkError(getActivity());
super.onFailure(statusCode, headers, throwable, errorResponse);
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONArray errorResponse) {
pd.dismiss();
showNetworkError(getActivity());
super.onFailure(statusCode, headers, throwable, errorResponse);
}
});
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View convertView = inflater.inflate(R.layout.fragment_service_plan, null);
assignViews(convertView);
return convertView;
}
class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.RecyclerHolder>{
@Override
public RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerHolder holder = new RecyclerHolder(LayoutInflater.from(FWJHMainFragment.this.getActivity()).inflate(R.layout.fragment_service_plan_recyclerview_item, parent, false));
return holder;
}
@Override
public void onBindViewHolder(RecyclerHolder holder, int position) {
final JSONObject object = dateDatas.get(position);
try {
final String id = object.getString("id");
final String startDate = object.getString("startDate").substring(0, 10);
final String endDate = object.getString("endDate").substring(0, 10);
final String name = object.getString("name");
final String currenWeek = object.getString("startDate").substring(0, 10) + " --- " + object.getString("endDate").substring(0, 10);
holder.weekNameTv.setText(name);
holder.weekScopeTv.setText(currenWeek);
holder.weekInfoTv.setOnClickListener(new ViewClickVibrate() {
@Override
public void onClick(View v) {
super.onClick(v);
Date currentDate = DateTimeUtil.getFormatDate(DateTimeUtil.getCurrDateStr());
if(currentDate.getTime() > DateTimeUtil.getFormatDate(endDate).getTime()){
isPreviouslyWeek = true;
}else{
isPreviouslyWeek = false;
}
if(currentDate.getTime() >= DateTimeUtil.getFormatDate(startDate).getTime() && currentDate.getTime() <= DateTimeUtil.getFormatDate(endDate).getTime()){
isThisWeek = true;
}else{
isThisWeek = false;
}
boolean isAddPlan;
if(isThisWeek || isPreviouslyWeek){
isAddPlan = false;
}else{
isAddPlan = true;
}
Intent intent = new Intent(getActivity(), ServicePlanInfoActivity.class);
intent.putExtra("yearMonth", month_tv.getText().toString());
intent.putExtra("id", id);
intent.putExtra("isAddPlan", isAddPlan);
intent.putExtra("weekname", name + " " + currenWeek);
getActivity().startActivity(intent);
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public int getItemCount() {
return dateDatas.size();
}
class RecyclerHolder extends RecyclerView.ViewHolder{
private TextView weekNameTv;
private TextView weekScopeTv;
private TextView weekInfoTv;
private void assignViews(View itemView) {
weekNameTv = (TextView) itemView.findViewById(R.id.week_name_tv);
weekScopeTv = (TextView) itemView.findViewById(R.id.week_scope_tv);
weekInfoTv = (TextView) itemView.findViewById(R.id.week_info_tv);
}
public RecyclerHolder(View itemView) {
super(itemView);
assignViews(itemView);
}
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.