blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
aa6bb6db92999e0203bea1ea3d1063fc6877abba
b034b8623d340bdacf0ab0cf274a6a4e357074cb
/app/src/main/java/college/edu/tomer/animationspart2/LoginActivity.java
6e924c0f58c5cfd5bb0ac397cabc19288a1eafd2
[]
no_license
appswebdev/AnimationsPart2
13061ee38663712c65bbb5578a2bda5aa01e1369
8966f8502481dda1924abd620fc72a37a1451a10
refs/heads/master
2021-01-20T21:01:02.834120
2016-07-24T17:32:28
2016-07-24T17:32:28
64,070,587
0
0
null
null
null
null
UTF-8
Java
false
false
2,522
java
package college.edu.tomer.animationspart2; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.os.Bundle; import android.support.design.widget.TextInputLayout; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.LinearInterpolator; import android.widget.Button; import android.widget.ImageView; import java.util.Random; public class LoginActivity extends AppCompatActivity { TextInputLayout tilEmail; TextInputLayout tilPassword; ImageView bgSunny; ImageView cloud1, cloud2, cloud3, cloud4; Button btnLogin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); bgSunny = (ImageView) findViewById(R.id.bgSunny); tilPassword = (TextInputLayout) findViewById(R.id.tilPassword); tilEmail = (TextInputLayout) findViewById(R.id.tilEmail); btnLogin = (Button) findViewById(R.id.btnLogin); cloud1 = (ImageView) findViewById(R.id.cloud1); cloud2 = (ImageView) findViewById(R.id.cloud2); cloud3 = (ImageView) findViewById(R.id.cloud3); cloud4 = (ImageView) findViewById(R.id.cloud4); // animate(); } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); animate(cloud1); animate(cloud2); animate(cloud3); animate(cloud4); } private void animate(View v) { Random rand = new Random(); ObjectAnimator animator = ObjectAnimator.ofFloat( v, "X", 0 - v.getWidth(), bgSunny.getWidth() ); /* animator.setPropertyName("translationX"); animator.setFloatValues(0-cloud1.getWidth(), bgSunny.getWidth() + cloud1.getWidth() );*/ animator.setRepeatCount(ValueAnimator.INFINITE); animator.setRepeatMode(ValueAnimator.REVERSE); animator.setDuration(3 * (rand.nextInt(2000) + 1000)); animator.setInterpolator(new LinearInterpolator()); animator.setStartDelay(rand.nextInt(400)); //animator.setTarget(cloud1); animator.start(); Animator slide = AnimatorInflater.loadAnimator(this, R.animator.slide_in); slide.setTarget(tilEmail); slide.setStartDelay(400); slide.start(); } }
[ "collegeandroid2015@gmail.com" ]
collegeandroid2015@gmail.com
9774a95a36afd9427b972fb28dbe8e8f72cae3c5
33ead68b26f9decf5aa84a6ecfad8bb82152ee93
/src/TwoPointNineteen.java
badbe5f59e1f8202fae58280c30dd257d65e5813
[]
no_license
jingtingofkirkland/JavaEssential
084c6fa59d933259b56aa7857e263889949057dc
598922698491f1070e03d44f458b6f913df3e65d
refs/heads/master
2021-01-25T11:14:31.776290
2017-08-02T03:51:30
2017-08-02T03:51:30
93,917,047
0
0
null
null
null
null
UTF-8
Java
false
false
1,105
java
/** * Created by Administrator on 2017/6/24. */ import java.util.Scanner; public class TwoPointNineteen { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.print("Enter three point for a triangle: "); double x1 = input.nextDouble(); double y1 = input.nextDouble(); double x2 = input.nextDouble(); double y2 = input.nextDouble(); double x3 = input.nextDouble(); double y3 = input.nextDouble(); double s11 = Math.pow((x1 - x2), 2); double s12 = Math.pow((y1 - y2), 2); double s1 = Math.pow((s11 + s12), 0.5); double s21 = Math.pow((x1 - x3), 2); double s22 = Math.pow((y1 - y3), 2); double s2 = Math.pow((s21 + s22), 0.5); double s31 = Math.pow((x2 - x3), 2); double s32 = Math.pow((y2 - y3), 2); double s3 = Math.pow((s31 + s32), 0.5); double s = (s1 + s2 + s3) / 2; double area = Math.pow((s * (s - s1) * (s - s2) * (s - s3)), 0.5); System.out.print("The area of the triangle is " + area); } }
[ "fengshahuang@gmail.com" ]
fengshahuang@gmail.com
4ca768876ef996dd259b5a5be84e30fa980c8684
a00326c0e2fc8944112589cd2ad638b278f058b9
/src/main/java/000/132/775/CWE197_Numeric_Truncation_Error__int_Environment_to_byte_22b.java
2fdc2dcbff442c8d2b63fc7ea09b261f3fc87729
[]
no_license
Lanhbao/Static-Testing-for-Juliet-Test-Suite
6fd3f62713be7a084260eafa9ab221b1b9833be6
b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68
refs/heads/master
2020-08-24T13:34:04.004149
2019-10-25T09:26:00
2019-10-25T09:26:00
216,822,684
0
1
null
2019-11-08T09:51:54
2019-10-22T13:37:13
Java
UTF-8
Java
false
false
3,315
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE197_Numeric_Truncation_Error__int_Environment_to_byte_22b.java Label Definition File: CWE197_Numeric_Truncation_Error__int.label.xml Template File: sources-sink-22b.tmpl.java */ /* * @description * CWE: 197 Numeric Truncation Error * BadSource: Environment Read data from an environment variable * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: to_byte * BadSink : Convert data to a byte * Flow Variant: 22 Control flow: Flow controlled by value of a public static variable. Sink functions are in a separate file from sources. * * */ import java.util.logging.Level; public class CWE197_Numeric_Truncation_Error__int_Environment_to_byte_22b { public int badSource() throws Throwable { int data; if (CWE197_Numeric_Truncation_Error__int_Environment_to_byte_22a.badPublicStatic) { data = Integer.MIN_VALUE; /* Initialize data */ /* get environment variable ADD */ /* POTENTIAL FLAW: Read data from an environment variable */ { String stringNumber = System.getenv("ADD"); if (stringNumber != null) // avoid NPD incidental warnings { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } return data; } /* goodG2B1() - use goodsource and badsink by setting the static variable to false instead of true */ public int goodG2B1Source() throws Throwable { int data; if (CWE197_Numeric_Truncation_Error__int_Environment_to_byte_22a.goodG2B1PublicStatic) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } else { /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; } return data; } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if in the sink function */ public int goodG2B2Source() throws Throwable { int data; if (CWE197_Numeric_Truncation_Error__int_Environment_to_byte_22a.goodG2B2PublicStatic) { /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } return data; } }
[ "anhtluet12@gmail.com" ]
anhtluet12@gmail.com
73e854d8cb8d578600cee5d47bc865a1de152fa2
716ae9391a8eec5c5274aae8fa915e23f008ff7b
/app/src/main/java/com/example/junyeop_imaciislab/keeping/adapter/inventoryListAdapter.java
dcd9cd3d1a81afa007a877d56b10d2e4d1c2d51c
[]
no_license
JunYeopLee/Keeping
660d766a32a6a594204f52b8f2bf05ade7c641af
2004e021679c62a279d64ca6198ae7d394a04885
refs/heads/master
2021-01-10T16:40:00.324996
2015-12-04T04:52:21
2015-12-04T04:52:21
46,000,310
1
0
null
null
null
null
UTF-8
Java
false
false
7,263
java
package com.example.junyeop_imaciislab.keeping.adapter; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ArrayAdapter; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.example.junyeop_imaciislab.keeping.R; import com.example.junyeop_imaciislab.keeping.util.inventoryListDAO; import java.util.ArrayList; /** * Created by LeeJunYeop on 2015-11-11. */ public class inventoryListAdapter extends ArrayAdapter<inventoryListDAO> { private final Activity context; private ArrayList<inventoryListDAO> inventoryListDAOArrayList; private float scale; public inventoryListAdapter(Activity context, ArrayList<inventoryListDAO> inventoryListDAOArrayList) { super(context, R.layout.listview_item_inventorylist, inventoryListDAOArrayList); this.context = context; this.inventoryListDAOArrayList = inventoryListDAOArrayList; } @Override public View getView(int position, View view, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); if(view==null) { view = inflater.inflate(R.layout.listview_item_inventorylist,null); } scale = context.getResources().getDisplayMetrics().density; int dp = (int) (scale + 0.5f); AbsListView.LayoutParams lp = new AbsListView.LayoutParams(320 * dp, 60 * dp); view.setLayoutParams(lp); //((LinearLayout)view).setLayoutParams(lp); final inventoryListDAO inventoryListDAO = inventoryListDAOArrayList.get(position); TextView cardNumberTextView = (TextView)view.findViewById(R.id.txt_card_number); cardNumberTextView.setText(inventoryListDAO.getCardNumber()); TextView dateTextView = (TextView)view.findViewById(R.id.txt_date); dateTextView.setText(inventoryListDAO.getDonationDate()); LinearLayout layoutBackground = (LinearLayout)view.findViewById(R.id.layout_listview_inven); if(inventoryListDAO.getIsGiven()) { layoutBackground.setBackground(context.getResources().getDrawable(R.drawable.cabinet_list_certif2_head_new)); } else { layoutBackground.setBackground(context.getResources().getDrawable(R.drawable.cabinet_list_certif_head_new)); } view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RelativeLayout donationCardLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card); TextView cardNumberOncardTextview = (TextView)context.findViewById(R.id.txt_card_number_oncard); TextView nameTextview = (TextView)context.findViewById(R.id.txt_name); TextView birthdayTextview = (TextView)context.findViewById(R.id.txt_birthday); TextView donationDateTextview = (TextView)context.findViewById(R.id.txt_donation_date); TextView donationLocaTextview = (TextView)context.findViewById(R.id.txt_donation_location); TextView idTextview = (TextView)context.findViewById(R.id.txt_id); TextView donationCateTextview = (TextView)context.findViewById(R.id.txt_donation_category); TextView genderTextview = (TextView)context.findViewById(R.id.txt_gender); TextView givingDateTextview = (TextView)context.findViewById(R.id.txt_giving_date); ImageButton messageOnCardButton = (ImageButton)context.findViewById(R.id.btn_message_oncard); RelativeLayout invenCardLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card); RelativeLayout invenCardMessageLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card_message); if(invenCardLayout.getVisibility()==View.GONE) { invenCardLayout.setVisibility(View.VISIBLE); invenCardLayout.invalidate(); invenCardMessageLayout.setVisibility(View.GONE); invenCardMessageLayout.invalidate(); } if(inventoryListDAO.getIsGiven()) { donationCardLayout.setBackground(context.getResources().getDrawable(R.drawable.cabinet_certif2)); givingDateTextview.setVisibility(View.VISIBLE); givingDateTextview.invalidate(); messageOnCardButton.setVisibility(View.VISIBLE); messageOnCardButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { RelativeLayout invenCardLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card); invenCardLayout.setVisibility(View.GONE); RelativeLayout invenCardMessageLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card_message); invenCardMessageLayout.setVisibility(View.VISIBLE); TextView messageTextView = (TextView)context.findViewById(R.id.txt_donation_message); messageTextView.setText(inventoryListDAO.getMessage()); } }); } else { donationCardLayout.setBackground(context.getResources().getDrawable(R.drawable.cabinet_certif)); givingDateTextview.setVisibility(View.GONE); messageOnCardButton.setVisibility(View.GONE); givingDateTextview.setText(inventoryListDAO.getGivingDate()); } cardNumberOncardTextview.setText(inventoryListDAO.getCardNumber()); nameTextview.setText(inventoryListDAO.getName()); birthdayTextview.setText(inventoryListDAO.getBirthDay()); donationDateTextview.setText(inventoryListDAO.getDonationDate()); donationLocaTextview.setText(inventoryListDAO.getDonationLocation()); idTextview.setText(inventoryListDAO.getId()); donationCateTextview.setText(inventoryListDAO.getDonationCategory()); genderTextview.setText(inventoryListDAO.getGender()); donationCardLayout.invalidate(); } }); ImageButton backToCardButton = (ImageButton)context.findViewById(R.id.btn_back); backToCardButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { RelativeLayout invenCardLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card); invenCardLayout.setVisibility(View.VISIBLE); RelativeLayout invenCardMessageLayout = (RelativeLayout)context.findViewById(R.id.layout_inven_card_message); invenCardMessageLayout.setVisibility(View.GONE); } }); return view; } }
[ "duql2072@gmail.com" ]
duql2072@gmail.com
851f3199f92876850050669857df00d2345c7a6f
a4274173d09a7f39ac041280f32b882d29f62913
/core_ui/src/test/java/ru/iandreyshev/coreui/ExampleUnitTest.java
21c0493dfb89b62d6241fd60068fa29441d7f569
[]
no_license
iandreyshev/sleepynotepad
c3dd273e9f082a627ae71348441d1d1c071a1b21
c767f103c328551dc180f2a6975de2ee47395a41
refs/heads/master
2020-04-13T00:36:16.689278
2018-12-31T12:15:04
2018-12-31T12:15:04
162,849,832
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package ru.iandreyshev.coreui; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "ivan.andreyshev@gmail.com" ]
ivan.andreyshev@gmail.com
0b5422924937ad61440828272e0a15f463b95c3c
ee14649a7dc9055027e4891531b62244d94af05f
/core/src/main/java/org/teavm/backend/lowlevel/transform/CoroutineTransformation.java
1be2a83f35e9affe588b8d7b17cfaa2c80d1e2d8
[ "Apache-2.0", "BSD-3-Clause", "GPL-1.0-or-later" ]
permissive
konsoletyper/teavm
02c3190e86d5837821fbd17979d6ea64a6b301d6
401fcabeae22689fb62307563cf8f20ae4ab16c3
refs/heads/master
2023-09-03T20:12:11.892017
2023-08-28T17:32:22
2023-08-28T17:32:22
13,045,763
2,320
285
Apache-2.0
2023-07-05T17:40:09
2013-09-23T20:04:15
Java
UTF-8
Java
false
false
22,078
java
/* * Copyright 2018 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.teavm.backend.lowlevel.transform; import com.carrotsearch.hppc.IntHashSet; import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.IntSet; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.teavm.common.Graph; import org.teavm.common.GraphSplittingBackend; import org.teavm.common.GraphUtils; import org.teavm.model.BasicBlock; import org.teavm.model.ClassReader; import org.teavm.model.ClassReaderSource; import org.teavm.model.Incoming; import org.teavm.model.Instruction; import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodReader; import org.teavm.model.MethodReference; import org.teavm.model.Program; import org.teavm.model.TextLocation; import org.teavm.model.ValueType; import org.teavm.model.Variable; import org.teavm.model.instructions.BranchingCondition; import org.teavm.model.instructions.BranchingInstruction; import org.teavm.model.instructions.DoubleConstantInstruction; import org.teavm.model.instructions.ExitInstruction; import org.teavm.model.instructions.FloatConstantInstruction; import org.teavm.model.instructions.InitClassInstruction; import org.teavm.model.instructions.IntegerConstantInstruction; import org.teavm.model.instructions.InvocationType; import org.teavm.model.instructions.InvokeInstruction; import org.teavm.model.instructions.JumpInstruction; import org.teavm.model.instructions.LongConstantInstruction; import org.teavm.model.instructions.MonitorEnterInstruction; import org.teavm.model.instructions.NullConstantInstruction; import org.teavm.model.instructions.SwitchInstruction; import org.teavm.model.instructions.SwitchTableEntry; import org.teavm.model.optimization.RedundantJumpElimination; import org.teavm.model.util.BasicBlockMapper; import org.teavm.model.util.BasicBlockSplitter; import org.teavm.model.util.DefinitionExtractor; import org.teavm.model.util.LivenessAnalyzer; import org.teavm.model.util.PhiUpdater; import org.teavm.model.util.ProgramUtils; import org.teavm.model.util.TypeInferer; import org.teavm.model.util.UsageExtractor; import org.teavm.model.util.VariableType; import org.teavm.runtime.Fiber; public class CoroutineTransformation { private static final MethodReference FIBER_SUSPEND = new MethodReference(Fiber.class, "suspend", Fiber.AsyncCall.class, Object.class); private static final String ASYNC_CALL = Fiber.class.getName() + "$AsyncCall"; private ClassReaderSource classSource; private LivenessAnalyzer livenessAnalysis = new LivenessAnalyzer(); private TypeInferer variableTypes = new TypeInferer(); private Set<MethodReference> asyncMethods; private Program program; private Variable fiberVar; private BasicBlockSplitter splitter; private SwitchInstruction resumeSwitch; private int parameterCount; private ValueType returnType; private boolean hasThreads; public CoroutineTransformation(ClassReaderSource classSource, Set<MethodReference> asyncMethods, boolean hasThreads) { this.classSource = classSource; this.asyncMethods = asyncMethods; this.hasThreads = hasThreads; } public void apply(Program program, MethodReference methodReference) { if (methodReference.getClassName().equals(Fiber.class.getName())) { return; } ClassReader cls = classSource.get(methodReference.getClassName()); if (cls != null && cls.getInterfaces().contains(ASYNC_CALL)) { return; } boolean hasJob = false; for (BasicBlock block : program.getBasicBlocks()) { if (hasSplitInstructions(block)) { hasJob = true; break; } } if (!hasJob) { return; } this.program = program; parameterCount = methodReference.parameterCount(); returnType = methodReference.getReturnType(); variableTypes.inferTypes(program, methodReference); livenessAnalysis.analyze(program, methodReference.getDescriptor()); splitter = new BasicBlockSplitter(program); int basicBlockCount = program.basicBlockCount(); createSplitPrologue(); for (int i = 1; i <= basicBlockCount; ++i) { processBlock(program.basicBlockAt(i)); } splitter.fixProgram(); processIrreducibleCfg(); RedundantJumpElimination.optimize(program); } private void createSplitPrologue() { fiberVar = program.createVariable(); fiberVar.setLabel("fiber"); BasicBlock firstBlock = program.basicBlockAt(0); BasicBlock continueBlock = splitter.split(firstBlock, null); BasicBlock switchStateBlock = program.createBasicBlock(); TextLocation location = continueBlock.getFirstInstruction().getLocation(); InvokeInstruction getFiber = new InvokeInstruction(); getFiber.setType(InvocationType.SPECIAL); getFiber.setMethod(new MethodReference(Fiber.class, "current", Fiber.class)); getFiber.setReceiver(fiberVar); getFiber.setLocation(location); firstBlock.add(getFiber); InvokeInstruction isResuming = new InvokeInstruction(); isResuming.setType(InvocationType.SPECIAL); isResuming.setMethod(new MethodReference(Fiber.class, "isResuming", boolean.class)); isResuming.setInstance(fiberVar); isResuming.setReceiver(program.createVariable()); isResuming.setLocation(location); firstBlock.add(isResuming); BranchingInstruction jumpIfResuming = new BranchingInstruction(BranchingCondition.NOT_EQUAL); jumpIfResuming.setOperand(isResuming.getReceiver()); jumpIfResuming.setConsequent(switchStateBlock); jumpIfResuming.setAlternative(continueBlock); firstBlock.add(jumpIfResuming); InvokeInstruction popInt = new InvokeInstruction(); popInt.setType(InvocationType.SPECIAL); popInt.setMethod(new MethodReference(Fiber.class, "popInt", int.class)); popInt.setInstance(fiberVar); popInt.setReceiver(program.createVariable()); popInt.setLocation(location); switchStateBlock.add(popInt); resumeSwitch = new SwitchInstruction(); resumeSwitch.setDefaultTarget(continueBlock); resumeSwitch.setCondition(popInt.getReceiver()); resumeSwitch.setLocation(location); switchStateBlock.add(resumeSwitch); } private void processBlock(BasicBlock block) { Map<Instruction, BitSet> splitInstructions = collectSplitInstructions(block); List<Instruction> instructionList = new ArrayList<>(splitInstructions.keySet()); Collections.reverse(instructionList); for (Instruction instruction : instructionList) { BasicBlock intermediate = splitter.split(block, instruction.getPrevious()); BasicBlock next = splitter.split(intermediate, instruction); createSplitPoint(block, intermediate, next, splitInstructions.get(instruction)); block = next; } } private Map<Instruction, BitSet> collectSplitInstructions(BasicBlock block) { if (!hasSplitInstructions(block)) { return Collections.emptyMap(); } BitSet live = livenessAnalysis.liveOut(block.getIndex()); Map<Instruction, BitSet> result = new LinkedHashMap<>(); UsageExtractor use = new UsageExtractor(); DefinitionExtractor def = new DefinitionExtractor(); for (Instruction instruction = block.getLastInstruction(); instruction != null; instruction = instruction.getPrevious()) { instruction.acceptVisitor(def); if (def.getDefinedVariables() != null) { for (Variable var : def.getDefinedVariables()) { live.clear(var.getIndex()); } } instruction.acceptVisitor(use); if (use.getUsedVariables() != null) { for (Variable var : use.getUsedVariables()) { live.set(var.getIndex()); } } if (isSplitInstruction(instruction)) { result.put(instruction, (BitSet) live.clone()); } } return result; } private boolean hasSplitInstructions(BasicBlock block) { for (Instruction instruction : block) { if (isSplitInstruction(instruction)) { return true; } } return false; } private boolean isSplitInstruction(Instruction instruction) { if (instruction instanceof InvokeInstruction) { InvokeInstruction invoke = (InvokeInstruction) instruction; MethodReference method = findRealMethod(invoke.getMethod()); if (method.equals(FIBER_SUSPEND)) { return true; } if (method.getClassName().equals(Fiber.class.getName())) { return false; } return asyncMethods.contains(method); } else if (instruction instanceof InitClassInstruction) { return isSplittingClassInitializer(((InitClassInstruction) instruction).getClassName()); } else { return hasThreads && instruction instanceof MonitorEnterInstruction; } } private void createSplitPoint(BasicBlock block, BasicBlock intermediate, BasicBlock next, BitSet liveVars) { int stateNumber = resumeSwitch.getEntries().size(); Instruction splitInstruction = intermediate.getFirstInstruction(); JumpInstruction jumpToIntermediate = new JumpInstruction(); jumpToIntermediate.setTarget(intermediate); jumpToIntermediate.setLocation(splitInstruction.getLocation()); block.add(jumpToIntermediate); BasicBlock restoreBlock = program.createBasicBlock(); BasicBlock saveBlock = program.createBasicBlock(); SwitchTableEntry switchTableEntry = new SwitchTableEntry(); switchTableEntry.setCondition(stateNumber); switchTableEntry.setTarget(restoreBlock); resumeSwitch.getEntries().add(switchTableEntry); InvokeInstruction isSuspending = new InvokeInstruction(); isSuspending.setType(InvocationType.SPECIAL); isSuspending.setMethod(new MethodReference(Fiber.class, "isSuspending", boolean.class)); isSuspending.setInstance(fiberVar); isSuspending.setReceiver(program.createVariable()); isSuspending.setLocation(splitInstruction.getLocation()); intermediate.add(isSuspending); BranchingInstruction branchIfSuspending = new BranchingInstruction(BranchingCondition.NOT_EQUAL); branchIfSuspending.setOperand(isSuspending.getReceiver()); branchIfSuspending.setConsequent(saveBlock); branchIfSuspending.setAlternative(next); branchIfSuspending.setLocation(splitInstruction.getLocation()); intermediate.add(branchIfSuspending); restoreBlock.addAll(restoreState(liveVars)); JumpInstruction doneRestoring = new JumpInstruction(); doneRestoring.setTarget(intermediate); restoreBlock.add(doneRestoring); for (Instruction instruction : restoreBlock) { instruction.setLocation(splitInstruction.getLocation()); } for (Instruction instruction : saveState(liveVars)) { instruction.setLocation(splitInstruction.getLocation()); saveBlock.add(instruction); } for (Instruction instruction : saveStateNumber(stateNumber)) { instruction.setLocation(splitInstruction.getLocation()); saveBlock.add(instruction); } createReturnInstructions(splitInstruction.getLocation(), saveBlock); } private List<Instruction> saveState(BitSet vars) { List<Instruction> instructions = new ArrayList<>(); for (int var = vars.nextSetBit(0); var >= 0; var = vars.nextSetBit(var + 1)) { saveVariable(var, instructions); } return instructions; } private List<Instruction> saveStateNumber(int number) { IntegerConstantInstruction constant = new IntegerConstantInstruction(); constant.setReceiver(program.createVariable()); constant.setConstant(number); InvokeInstruction invoke = new InvokeInstruction(); invoke.setType(InvocationType.SPECIAL); invoke.setMethod(new MethodReference(Fiber.class, "push", int.class, void.class)); invoke.setInstance(fiberVar); invoke.setArguments(constant.getReceiver()); return Arrays.asList(constant, invoke); } private List<Instruction> restoreState(BitSet vars) { List<Instruction> instructions = new ArrayList<>(); int[] varArray = new int[vars.cardinality()]; int j = 0; for (int i = vars.nextSetBit(0); i >= 0; i = vars.nextSetBit(i + 1)) { varArray[j++] = i; } for (int i = varArray.length - 1; i >= 0; --i) { restoreVariable(varArray[i], instructions); } return instructions; } private void saveVariable(int var, List<Instruction> instructions) { VariableType type = variableTypes.typeOf(var); InvokeInstruction invoke = new InvokeInstruction(); invoke.setType(InvocationType.SPECIAL); invoke.setInstance(fiberVar); invoke.setArguments(program.variableAt(var)); switch (type) { case INT: invoke.setMethod(new MethodReference(Fiber.class, "push", int.class, void.class)); break; case LONG: invoke.setMethod(new MethodReference(Fiber.class, "push", long.class, void.class)); break; case FLOAT: invoke.setMethod(new MethodReference(Fiber.class, "push", float.class, void.class)); break; case DOUBLE: invoke.setMethod(new MethodReference(Fiber.class, "push", double.class, void.class)); break; default: invoke.setMethod(new MethodReference(Fiber.class, "push", Object.class, void.class)); break; } instructions.add(invoke); } private void restoreVariable(int var, List<Instruction> instructions) { VariableType type = variableTypes.typeOf(var); InvokeInstruction invoke = new InvokeInstruction(); invoke.setType(InvocationType.SPECIAL); invoke.setInstance(fiberVar); invoke.setReceiver(program.variableAt(var)); switch (type) { case INT: invoke.setMethod(new MethodReference(Fiber.class, "popInt", int.class)); break; case LONG: invoke.setMethod(new MethodReference(Fiber.class, "popLong", long.class)); break; case FLOAT: invoke.setMethod(new MethodReference(Fiber.class, "popFloat", float.class)); break; case DOUBLE: invoke.setMethod(new MethodReference(Fiber.class, "popDouble", double.class)); break; default: invoke.setMethod(new MethodReference(Fiber.class, "popObject", Object.class)); break; } instructions.add(invoke); } private boolean isSplittingClassInitializer(String className) { ClassReader cls = classSource.get(className); if (cls == null) { return false; } MethodReader method = cls.getMethod(new MethodDescriptor("<clinit>", ValueType.VOID)); return method != null && asyncMethods.contains(method.getReference()); } private MethodReference findRealMethod(MethodReference method) { String clsName = method.getClassName(); while (clsName != null) { ClassReader cls = classSource.get(clsName); if (cls == null) { break; } MethodReader methodReader = cls.getMethod(method.getDescriptor()); if (methodReader != null) { return new MethodReference(clsName, method.getDescriptor()); } clsName = cls.getParent(); if (clsName != null && clsName.equals(cls.getName())) { break; } } return method; } private void createReturnInstructions(TextLocation location, BasicBlock block) { ExitInstruction exit = new ExitInstruction(); exit.setLocation(location); if (returnType == ValueType.VOID) { block.add(exit); return; } exit.setValueToReturn(program.createVariable()); Instruction returnValue = createReturnValueInstruction(exit.getValueToReturn()); returnValue.setLocation(location); block.add(returnValue); block.add(exit); } private Instruction createReturnValueInstruction(Variable target) { if (returnType instanceof ValueType.Primitive) { switch (((ValueType.Primitive) returnType).getKind()) { case BOOLEAN: case BYTE: case CHARACTER: case SHORT: case INTEGER: { IntegerConstantInstruction instruction = new IntegerConstantInstruction(); instruction.setReceiver(target); return instruction; } case LONG: { LongConstantInstruction instruction = new LongConstantInstruction(); instruction.setReceiver(target); return instruction; } case FLOAT: { FloatConstantInstruction instruction = new FloatConstantInstruction(); instruction.setReceiver(target); return instruction; } case DOUBLE: { DoubleConstantInstruction instruction = new DoubleConstantInstruction(); instruction.setReceiver(target); return instruction; } } } NullConstantInstruction instruction = new NullConstantInstruction(); instruction.setReceiver(target); return instruction; } private void processIrreducibleCfg() { Graph graph = ProgramUtils.buildControlFlowGraph(program); if (!GraphUtils.isIrreducible(graph)) { return; } SplittingBackend splittingBackend = new SplittingBackend(); int[] weights = new int[graph.size()]; for (int i = 0; i < program.basicBlockCount(); ++i) { weights[i] = program.basicBlockAt(i).instructionCount(); } GraphUtils.splitIrreducibleGraph(graph, weights, splittingBackend); new PhiUpdater().updatePhis(program, parameterCount + 1); } class SplittingBackend implements GraphSplittingBackend { @Override public int[] split(int[] domain, int[] nodes) { int[] copies = new int[nodes.length]; var map = new IntIntHashMap(); IntSet nodeSet = IntHashSet.from(nodes); var outputs = ProgramUtils.getPhiOutputs(program); for (int i = 0; i < nodes.length; ++i) { int node = nodes[i]; BasicBlock block = program.basicBlockAt(node); BasicBlock blockCopy = program.createBasicBlock(); ProgramUtils.copyBasicBlock(block, blockCopy); copies[i] = blockCopy.getIndex(); map.put(node, copies[i] + 1); } var copyBlockMapper = new BasicBlockMapper((int block) -> { int mappedIndex = map.get(block); return mappedIndex == 0 ? block : mappedIndex - 1; }); for (int copy : copies) { copyBlockMapper.transform(program.basicBlockAt(copy)); } for (int domainNode : domain) { copyBlockMapper.transformWithoutPhis(program.basicBlockAt(domainNode)); } var domainSet = IntHashSet.from(domain); for (int i = 0; i < nodes.length; ++i) { int node = nodes[i]; BasicBlock blockCopy = program.basicBlockAt(copies[i]); for (Incoming output : outputs.get(node)) { if (!nodeSet.contains(output.getPhi().getBasicBlock().getIndex())) { Incoming outputCopy = new Incoming(); outputCopy.setSource(blockCopy); outputCopy.setValue(output.getValue()); output.getPhi().getIncomings().add(outputCopy); } } var block = program.basicBlockAt(node); for (var phi : block.getPhis()) { phi.getIncomings().removeIf(incoming -> domainSet.contains(incoming.getSource().getIndex())); } for (var phi : blockCopy.getPhis()) { phi.getIncomings().removeIf(incoming -> !domainSet.contains(incoming.getSource().getIndex())); } } return copies; } } }
[ "konsoletyper@gmail.com" ]
konsoletyper@gmail.com
772e301ce236fb44b96ed197ef88dee996719378
eefbb79b36ea98d452ab190730200e9c051e588c
/src/test/java/com/xwq/spider/SpiderApplicationTests.java
fabe08689c235106305f46a76b08198f76066180
[]
no_license
xiawq87/spider
684ca6687d1853fc1167f3bcd8f2a90859c71afb
d5fbdf18878da0eff26463a6cecf60cebed2e8f4
refs/heads/master
2020-07-31T20:43:36.624725
2019-09-30T09:39:16
2019-09-30T09:39:16
210,747,823
2
0
null
null
null
null
UTF-8
Java
false
false
488
java
package com.xwq.spider; import com.xwq.spider.sp.yousuu.YousuuTask; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpiderApplicationTests { @Autowired YousuuTask yousuuTask; @Test public void test() { yousuuTask.doTask(); } }
[ "xiaweiqiang@yunzhangfang.com" ]
xiaweiqiang@yunzhangfang.com
161829ab3b254a4aedb2dfb082aff00c699f0f00
94d54066bf951ab95e3ba0dcc7d890e1907e8c38
/lib/source/org/jfree/data/time/Year.java
a806eb3d1f9d81774fb16ec275734ec3342db7bc
[]
no_license
DieterDeSchuiteneer/practicum-1-Simulatie-van-Scheduling-Algoritmes
fdd5ca895caea7ea915f93830aa8617efba8997e
b6d64b6b89e97b6e66554cfcb6f890428b525ee4
refs/heads/master
2021-04-27T09:17:26.264759
2018-04-17T07:39:57
2018-04-17T07:39:57
122,509,581
0
0
null
null
null
null
UTF-8
Java
false
false
9,655
java
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * --------- * Year.java * --------- * (C) Copyright 2001-2005, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * * $Id: Year.java,v 1.9.2.1 2005/10/25 21:35:24 mungady Exp $ * * Changes * ------- * 11-Oct-2001 : Version 1 (DG); * 14-Nov-2001 : Override for toString() method (DG); * 19-Dec-2001 : Added a new constructor as suggested by Paul English (DG); * 29-Jan-2002 : Worked on parseYear() method (DG); * 14-Feb-2002 : Fixed bug in Year(Date) constructor (DG); * 26-Feb-2002 : Changed getStart(), getMiddle() and getEnd() methods to * evaluate with reference to a particular time zone (DG); * 19-Mar-2002 : Changed API for TimePeriod classes (DG); * 10-Sep-2002 : Added getSerialIndex() method (DG); * 04-Oct-2002 : Fixed errors reported by Checkstyle (DG); * 10-Jan-2003 : Changed base class and method names (DG); * 05-Mar-2003 : Fixed bug in getFirstMillisecond() picked up in JUnit * tests (DG); * 13-Mar-2003 : Moved to com.jrefinery.data.time package, and implemented * Serializable (DG); * 21-Oct-2003 : Added hashCode() method (DG); * */ package org.jfree.data.time; import org.jfree.date.MonthConstants; import org.jfree.date.SerialDate; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; /** * Represents a year in the range 1900 to 9999. This class is immutable, which * is a requirement for all {@link RegularTimePeriod} subclasses. */ public class Year extends RegularTimePeriod implements Serializable { /** For serialization. */ private static final long serialVersionUID = -7659990929736074836L; /** The year. */ private int year; /** * Creates a new <code>Year</code>, based on the current system date/time. */ public Year() { this(new Date()); } /** * Creates a time period representing a single year. * * @param year the year. */ public Year(int year) { // check arguments... if ((year < SerialDate.MINIMUM_YEAR_SUPPORTED) || (year > SerialDate.MAXIMUM_YEAR_SUPPORTED)) { throw new IllegalArgumentException( "Year constructor: year (" + year + ") outside valid range."); } // initialise... this.year = year; } /** * Creates a new <code>Year</code>, based on a particular instant in time, * using the default time zone. * * @param time the time. */ public Year(Date time) { this(time, RegularTimePeriod.DEFAULT_TIME_ZONE); } /** * Constructs a year, based on a particular instant in time and a time zone. * * @param time the time. * @param zone the time zone. */ public Year(Date time, TimeZone zone) { Calendar calendar = Calendar.getInstance(zone); calendar.setTime(time); this.year = calendar.get(Calendar.YEAR); } /** * Returns the year. * * @return The year. */ public int getYear() { return this.year; } /** * Returns the year preceding this one. * * @return The year preceding this one (or <code>null</code> if the * current year is 1900). */ public RegularTimePeriod previous() { if (this.year > SerialDate.MINIMUM_YEAR_SUPPORTED) { return new Year(this.year - 1); } else { return null; } } /** * Returns the year following this one. * * @return The year following this one (or <code>null</code> if the current * year is 9999). */ public RegularTimePeriod next() { if (this.year < SerialDate.MAXIMUM_YEAR_SUPPORTED) { return new Year(this.year + 1); } else { return null; } } /** * Returns a serial index number for the year. * <P> * The implementation simply returns the year number (e.g. 2002). * * @return The serial index number. */ public long getSerialIndex() { return this.year; } /** * Returns the first millisecond of the year, evaluated using the supplied * calendar (which determines the time zone). * * @param calendar the calendar. * * @return The first millisecond of the year. */ public long getFirstMillisecond(Calendar calendar) { Day jan1 = new Day(1, MonthConstants.JANUARY, this.year); return jan1.getFirstMillisecond(calendar); } /** * Returns the last millisecond of the year, evaluated using the supplied * calendar (which determines the time zone). * * @param calendar the calendar. * * @return The last millisecond of the year. */ public long getLastMillisecond(Calendar calendar) { Day dec31 = new Day(31, MonthConstants.DECEMBER, this.year); return dec31.getLastMillisecond(calendar); } /** * Tests the equality of this <code>Year</code> object to an arbitrary * object. Returns <code>true</code> if the target is a <code>Year</code> * instance representing the same year as this object. In all other cases, * returns <code>false</code>. * * @param object the object. * * @return <code>true</code> if the year of this and the object are the * same. */ public boolean equals(Object object) { if (object != null) { if (object instanceof Year) { Year target = (Year) object; return (this.year == target.getYear()); } else { return false; } } else { return false; } } /** * Returns a hash code for this object instance. The approach described by * Joshua Bloch in "Effective Java" has been used here: * <p> * <code>http://developer.java.sun.com/developer/Books/effectivejava * /Chapter3.pdf</code> * * @return A hash code. */ public int hashCode() { int result = 17; int c = this.year; result = 37 * result + c; return result; } /** * Returns an integer indicating the order of this <code>Year</code> object * relative to the specified object: * * negative == before, zero == same, positive == after. * * @param o1 the object to compare. * * @return negative == before, zero == same, positive == after. */ public int compareTo(Object o1) { int result; // CASE 1 : Comparing to another Year object // ----------------------------------------- if (o1 instanceof Year) { Year y = (Year) o1; result = this.year - y.getYear(); } // CASE 2 : Comparing to another TimePeriod object // ----------------------------------------------- else if (o1 instanceof RegularTimePeriod) { // more difficult case - evaluate later... result = 0; } // CASE 3 : Comparing to a non-TimePeriod object // --------------------------------------------- else { // consider time periods to be ordered after general objects result = 1; } return result; } /** * Returns a string representing the year.. * * @return A string representing the year. */ public String toString() { return Integer.toString(this.year); } /** * Parses the string argument as a year. * <P> * The string format is YYYY. * * @param s a string representing the year. * * @return <code>null</code> if the string is not parseable, the year * otherwise. */ public static Year parseYear(String s) { // parse the string... int y; try { y = Integer.parseInt(s.trim()); } catch (NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } // create the year... try { return new Year(y); } catch (IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } } }
[ "1161968@isep.ipp.pt" ]
1161968@isep.ipp.pt
cc743259eabcc8ed463e2487fde0c2d3bb999ed4
57fece2a9e1229e23b51e4b9fdab93bf5701a701
/src/main/java/com/chenjh/util/DateUtil.java
57693b011447a9eaedd3b5a32af09d06d2cb1e77
[]
no_license
chenjhone/nvd_collect
919077a74e26a8be18d83d08db35739cba1a676b
8839abbde08db4f1c095847b3b5c5c989b72d186
refs/heads/master
2022-09-20T06:37:04.308052
2019-06-28T08:46:39
2019-06-28T08:46:39
194,239,170
0
0
null
2022-09-01T23:09:07
2019-06-28T08:42:05
Java
UTF-8
Java
false
false
23,957
java
package com.chenjh.util; import java.security.InvalidParameterException; import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; /** * @author chenjh * @version V1.0 * @since 2018年12月27日 */ public abstract class DateUtil { /** * 一天的毫秒数 */ public static final long ONE_DATE_TIME_MILLIS = 3600 * 24 * 1000; /** 时间短格式 */ public static final String PATTERN_YYYY_MM_DD = "yyyy-MM-dd"; /** 时间短格式 */ public static final String PATTERN_YYYY_MM = "yyyy-MM"; /** 时间短格式 */ public static final String PATTERN_YYYYMM = "yyyyMM"; /** 月份位数 */ public static final int NUM2 = 2; /** 月份位数 */ public static final int NUM5 = 5; /** 月份位数 */ public static final int NUM10 = 10; /** 月份位数 */ public static final int NUM11 = 11; /** 月份位数 */ public static final int NUM12 = 12; /** 月份位数 */ public static final int NUM31 = 31; /** 时间格式无间隔 */ public static final String PATTERN_YMDHMS = "yyyyMMddHHmmss"; /** 默认时间格式 */ private static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss"; /** 最大月份 */ private static final int MAX_MONTH = 12; /** * 日志 */ private static final Logger LOG = Logger.getLogger(DateUtil.class); /** * 格式化日期 * @param date date * @return 格式化之后的日期字符串 * @author chenjh */ public static String format(Date date) { if (null == date) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_PATTERN); return sdf.format(date); } /** * 短格式化日期 * @param date date * @return 格式化之后的日期字符串 * @author chenjh */ public static String shortFormat(Date date) { if (null == date) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); return sdf.format(date); } /** * 格式化日期 * @param date Date * @param locale Locale * @return 格式化后日期 * @author chenjh */ public static String format(Date date, Locale locale) { return format(date, locale, DEFAULT_DATE_PATTERN); } /** * 格式化日期 * @param date Date * @param locale Locale * @param formatPattern 格式化模式 * @return 格式化后日期 * @author chenjh */ public static String format(Date date, Locale locale, String formatPattern) { String dateStr; if (null == date) { dateStr = null; } else { String pattern; if (null == formatPattern) { pattern = DEFAULT_DATE_PATTERN; } else { pattern = formatPattern; } SimpleDateFormat dateFormat = null; if (null == locale) { dateFormat = new SimpleDateFormat(pattern); } else { dateFormat = new SimpleDateFormat(pattern, locale); } dateStr = dateFormat.format(date); } return dateStr; } /** * 获取当前时间 * @return 当前时间 * @author chenjh */ public static Timestamp getTimeStamp() { return new Timestamp(System.currentTimeMillis()); } /** * 获取当前时间 * @return java.sql.date当前时间 * @author chenjh */ public static java.sql.Date getCurrentDate() { return new java.sql.Date(System.currentTimeMillis()); } public static Date getCurrentUtilDate() { return new Date(); } /** * 复制 * @param input 输入日期 * @return 输出日期 * @author chenjh */ public static Date cloneDate(Date input) { return input == null ? null : new Date(input.getTime()); } /** * 字符串转换为日期型 * @param strDate 字符串日期值 * @return 日期 * @author chenjh */ public static Date parse(String strDate) { return parse(strDate, DEFAULT_DATE_PATTERN); } /** * 基础时间上添加或减去指定的时间量 * @param date 基础时间 * @param amount 天数 * @return 返回当前时间往前或往后移动天数的时间 * @author chenjh */ public static Date addDay(Date date, int amount) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DAY_OF_MONTH, amount); return calendar.getTime(); } /** * 基础时间上添加或减去指定的时间量 * @param date 基础时间 * @param amount 月份数量,可以为负数 * @return 返回当前时间往前或往后移动月数的时间 * @author chenjh */ public static Date addMonth(Date date, int amount) { if (null == date) { return null; } Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, amount); return calendar.getTime(); } /** * 字符串转换成日期 * @param strDate 字符型日期 * @param patter 日期格式 * @return 日期型日期 * @author chenjh */ public static Date parse(String strDate, String patter) { if (StringUtils.isEmpty(strDate)) { return null; } SimpleDateFormat sdf = new SimpleDateFormat(patter);//小写的mm表示的是分钟 try { return sdf.parse(strDate); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 比较日期 * @param d1 前者 * @param d2 后者 * @return 前者大于等于后者返回true 反之false * @author chenjh */ public static boolean compareDate(Date d1, Date d2) { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTime(d1); c2.setTime(d2); int result = c1.compareTo(c2); return result >= 0; } /** * 根据给定的日期,获取日期的当前月的第一天 * @param date date * @return date * @author chenjh */ public static Date getFirstDay(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; String ym = year + StringUtils.leftPad(month + "", NUM2, "0"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的日期,获取本次周期开始时间(每年11月1日为周期开始时间,10月31日为周期结束时间) * @param date date * @return date * @author chenjh */ public static Date getCycleStartTime(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; if (month < NUM11) { year = year - 1; } String ym = year + StringUtils.leftPad(NUM11 + "", NUM2, "0"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的日期,获取本次周期结束时间(每年11月1日为周期开始时间,10月31日为周期结束时间) * @param date date * @return date * @author chenjh */ public static Date getCycleEndTime(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; if (month > NUM10) { year = year + 1; } String ym = year + StringUtils.leftPad(NUM10 + "", NUM2, "0") + StringUtils.leftPad(NUM31 + "", NUM2, "0"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的日期,获取自然年开始时间(开始时间为1月1日,结束时间为12.31日) * @param date date * @return date * @author chenjh */ public static Date getNaturalStartTime(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); int year = ca.get(Calendar.YEAR); String ym = String.valueOf(year); SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的日期,获取自然年结束时间(开始时间为1月1日,结束时间为12.31日) * @param date date * @return date * @author chenjh */ public static Date getNaturalEndTime(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); int year = ca.get(Calendar.YEAR); String ym = year + StringUtils.leftPad(NUM12 + "", NUM2, "0") + StringUtils.leftPad(NUM31 + "", NUM2, "0"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的日期,获取日期的上月的第一天 * @param date date * @return date * @author chenjh */ public static Date getLastMonthFirstDay(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.MONTH, -1); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; String ym = year + StringUtils.leftPad(month + "", NUM2, "0"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的日期,获取日期的下月的第一天 * @param date date * @return date * @author chenjh */ public static Date getNextMonthFirstDay(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.MONTH, 1); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; String ym = year + StringUtils.leftPad(month + "", NUM2, "0"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); try { return sdf.parse(ym); } catch (ParseException e) { LOG.error("date conv error", e); } return null; } /** * 根据给定的时间,获取日期所在半年度,上半年度和下半年度 * 如:2016年3月19日,得到2016年01月01日 0:00:00 * 如:2016年9月19日,得到2016年07月01日 0:00:00 * @param date 日期 * @return 日期 * @author chenjh */ public static Date getHalfYearDate(Date date) { if (null == date) { return null; } Calendar cal = Calendar.getInstance(); cal.setTime(date); int year = cal.get(Calendar.YEAR); //获取月份 0 , 1, 2,,,,11 int month = cal.get(Calendar.MONTH); if (month <= Calendar.JUNE) { month = Calendar.JANUARY; } if (month >= Calendar.JULY) { month = Calendar.JULY; } month++; SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); try { return sdf.parse(year + StringUtils.leftPad(month + "", NUM2, "0")); } catch (ParseException e) { LOG.error("Date Parse Error", e); } return null; } /** * 根据给定的时间,获取日期所在半年度的结束时间 * 如:2016年3月19日,得到2016年06月31日 0:00:00 * 如:2016年9月19日,得到2016年12月31日 0:00:00 * @param date 日期 * @return 日期 * @author chenjh */ public static Date getHalfYearEndDate(Date date) { if (null == date) { return null; } Calendar cal = Calendar.getInstance(); cal.setTime(date); int year = cal.get(Calendar.YEAR); //获取月份 0 , 1, 2,,,,11 int month = cal.get(Calendar.MONTH); if (month <= Calendar.JUNE) { month = Calendar.JUNE; } if (month >= Calendar.JULY) { month = Calendar.DECEMBER; } month++; SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); try { return sdf.parse(year + StringUtils.leftPad(month + "", NUM2, "0") + StringUtils.leftPad(NUM31 + "", NUM2, "0")); } catch (ParseException e) { LOG.error("Date Parse Error", e); } return null; } /** * 根据给定的月份获取从1月开始到给定月份的月集合 * @param date 给定日期 * @return 月集合 */ public static List<Date> getMonthList(Date date) { List<Date> months = new ArrayList<Date>(); Calendar ca = Calendar.getInstance(); months.add(date); ca.setTime(date); for (int i = 1; i <= MAX_MONTH; i++) { ca.add(Calendar.MONTH, -1); months.add(0, ca.getTime()); } return months; } /** * 判断当天是否为当月第一天 * @param date 当天 * @return true、false * @author chenjh */ public static boolean isFisrtDayOfMonth(Date date) { Calendar ca = Calendar.getInstance(); ca.setTime(date); int day = ca.get(Calendar.DAY_OF_MONTH); return day == 1; } /** * 获取上月字符串 * @param date date * @return yyyyMM * @author y00305001 * @date 2016年4月1日 */ public static String getLastMonthStr(Date date) { Date d = getLastMonthFirstDay(date); return format(d, null, PATTERN_YYYYMM); } /** * 获取昨天日期 * @return yesterday * @author chenjh */ public static Date getYesterday() { Date result = null; Calendar ca = Calendar.getInstance(); ca.add(Calendar.DATE, -1); result = ca.getTime(); return result; } /** * 获取给定月最后一天 * @param date date * @return 最后一天date * @author chenjh */ public static Date getLastDayOfMonth(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.MONTH, 1); ca.set(Calendar.DAY_OF_MONTH, 1); ca.add(Calendar.DATE, -1); return ca.getTime(); } /** * 获取下月第一天 * @param date date * @return 第一天date * @author chenjh */ public static Date getNextMonthDay(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.MONTH, 1); ca.set(Calendar.DAY_OF_MONTH, 1); return ca.getTime(); } /** * 去年 * @param date 输入时间 * @return 去年 * @author chenjh */ public static Date getLastYearDay(Date date) { if (date == null) { return null; } Calendar ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.YEAR, -1); return ca.getTime(); } /** * 转换日期格式 * @param dateVal 日志字符串值 * @param oldPattern 旧格式 * @param newPattern 新格式 * @return 转换日期格式 * @author chenjh */ public static String getPatterTime(String dateVal, String oldPattern, String newPattern) { Date date = parse(dateVal, oldPattern); SimpleDateFormat sdf = new SimpleDateFormat(newPattern); return sdf.format(date); } /** * 获取当前日时间(时分秒置0) * @param patter 日期格式 * @return 获取当前日时间 * @author chenjh */ public static Date getCurrentDay(String patter) { Date date = new Date(); DateFormat df = new SimpleDateFormat(patter); String time = df.format(date); return DateUtil.parse(time, patter); } /** * 根据指定结束时间,返回12个月份 yyyyMM * @param endDate endDate * @return list * @author chenjh */ public static List<String> getLastTwelveYearMonthList(Date endDate) { if (endDate == null) { throw new InvalidParameterException(); } List<String> monthList = new ArrayList<String>(NUM12); Calendar ca = Calendar.getInstance(); ca.setTime(endDate); SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYYMM); for (int i = 0; i < NUM12; i++) { Date d = ca.getTime(); monthList.add(0, sdf.format(d)); ca.add(Calendar.MONTH, -1); } return monthList; } /** * 根据指定开始时间和结束时间返回开始到结束时间的月份(不带横杠,CODEX使用) * @param beginDate 开始时间 时间格式为短日期格式 * @param endDate 结束时间 时间格式为短日期格式 * @return 获取时间段的年和月份 * @author chenjh */ public static List<String> getByBeginAndEndDate(Date beginDate, Date endDate) { if (null == beginDate || null == endDate) { return new ArrayList<String>(0); } List<String> dateList = new ArrayList<String>(); Date startDate = beginDate; while (compareDate(endDate, startDate)) { Calendar ca = Calendar.getInstance(); ca.setTime(startDate); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; StringBuilder dateString = new StringBuilder(); dateString.append(year); dateString.append(StringUtils.leftPad(month + "", NUM2, "0")); dateList.add(dateString.toString()); startDate = addMonth(startDate, 1); } return dateList; } /** * 根据指定开始时间和结束时间返回开始到结束时间的月份 * @param beginDate 开始时间 时间格式为短日期格式 * @param endDate 结束时间 时间格式为短日期格式 * @return 获取时间段的年和月份 * @author chenjh */ public static List<String> getYearMonthByBeginAndEndDate(Date beginDate, Date endDate) { if (null == beginDate || null == endDate) { return new ArrayList<String>(0); } List<String> dateList = new ArrayList<String>(); Date startDate = beginDate; while (compareDate(endDate, startDate)) { Calendar ca = Calendar.getInstance(); ca.setTime(startDate); int year = ca.get(Calendar.YEAR); int month = ca.get(Calendar.MONTH) + 1; StringBuilder dateStr = new StringBuilder(); dateStr.append(year); dateStr.append('-'); dateStr.append(StringUtils.leftPad(month + "", NUM2, "0")); dateList.add(dateStr.toString()); startDate = addMonth(startDate, 1); } return dateList; } /** * 获取当前日期上月yyyyMM * @return 获取当前日期上月yyyyMM * @author chenjh */ public static String getLastMonth() { SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYYMM); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.MONTH, -1); return sdf.format(cal.getTime()); } /** * 获取年份集合 * @param yearStr yearStr * @return 年份集合 * @author chenjh */ public static List<String> getYearListAfter(String yearStr) { List<String> yearList = new ArrayList<String>(); Calendar ca = Calendar.getInstance(); int endYear = ca.get(Calendar.YEAR); int beginYear; try { beginYear = Integer.parseInt(yearStr); } catch (NumberFormatException e) { beginYear = endYear; } int param = beginYear; while (param <= endYear) { yearList.add(String.valueOf(param)); param = param + 1; } return yearList; } }
[ "331708624@qq.com" ]
331708624@qq.com
94a455886fd2dd4f90751d7cab320a4a6eedad0b
fb7fabc423d937334cd106f2a2a0c174ceaf207f
/src/com/design/hackerrank/Main.java
067133b2ce6da875b30c9a198b18072a082976f4
[]
no_license
jurelmp/design-patterns-training
6813b84eff72cf2463e259de48a61f266cef0b52
dfdddd3658881d70c644a06dba0da2ba3ecfde7e
refs/heads/master
2021-11-12T14:52:12.514823
2017-07-20T14:04:54
2017-07-20T14:04:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,264
java
package com.design.hackerrank; /** * Created by Jurel on 10/26/2015. */ public class Main { public static void main(String args[]) { int numbers[] = {1, 3, 1, 2, 3, 4, 5}; sort(numbers); // for (int n : numbers) { // System.out.println(n); // } System.out.println(check(1, numbers)); } public static int countDuplicates(int numbers[]) { int count = 0; boolean flag = false; while (!flag) { } return 0; } public static int check(int startIndex, int numbers[]) { int index = 0; int count = 0; for (int i = startIndex; i < numbers.length; i++) { if (numbers[i] != numbers[i - 1]) { index = i; check(index, numbers); count++; break; } } return count; } public static void sort(int numbers[]) { for (int i = 0; i < numbers.length; i++) { for (int j = 0; j < i; j++) { if (numbers[i] < numbers[j]) { int temp = numbers[j]; numbers[j] = numbers[i]; numbers[i] = temp; } } } } }
[ "patocjurel@gmail.com" ]
patocjurel@gmail.com
4299f79a93b9c4494e45bf458d4dc11614a05290
e6a5e625aec9fbf56238cf7a78a12fe7bdcb0efc
/src/com/storeworld/mainui/WestPart.java
30290814144564d48ef797c752e3464e0d2ef93d
[]
no_license
dingzhoubing/storeworld
1b2d3c3f7ad79a0371daa6b6b2e32a97301ee9d3
b0e3f67932ffcbdaf0d15e14d750a5729a4a7f28
refs/heads/master
2021-01-19T21:52:11.071369
2014-07-05T11:16:59
2014-07-05T11:16:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
package com.storeworld.mainui; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; public class WestPart extends UIComposite { public WestPart(Composite parent, int style) { super(parent, style); } public WestPart(Composite parent, int style, Image image) { super(parent, style); if(image == null){//by default image = new Image(getDisplay(), "icon/west.png"); } setImage(image); } }
[ "xiongued@gmail.com" ]
xiongued@gmail.com
100400a458560285c10c5a527311fda313d3c5d6
0ffe3496de135d09acf06481719ba3fee2c73ab5
/app/src/main/java/com/txd/hzj/wjlp/bean/commodity/GroupRankBean.java
393fdcfcd171a8c06ee673296ee3ac575d981428
[]
no_license
sengeiou/wujie_android
45268d83592b5ae5e959eb82de2924eebee56db9
20f726d364685e9a8b6b01c3ce1b0ef1e97ab12b
refs/heads/master
2021-10-24T22:15:17.091035
2019-03-25T09:20:53
2019-03-25T09:20:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,700
java
package com.txd.hzj.wjlp.bean.commodity; import java.io.Serializable; import java.util.List; /** * 创建者:zhangyunfei * 创建时间:2018/12/25 9:44 * 功能描述: */ public class GroupRankBean implements Serializable{ /** * user_info : {"rank":"1","user_id":"100","user_name":"cold","head_pic":"http://img.wujiemall.com/Public/Pc/img/default.png","user_count":"0"} * rank_list : [{"rank":"1","user_id":"100","user_name":"cold","head_pic":"http://img.wujiemall.com/Public/Pc/img/default.png","user_count":"0"},{"rank":"2","user_id":"22","user_name":"Cyf","head_pic":"http://img.wujiemall.com/Public/Pc/img/default.png","user_count":"0"}] */ private UserInfoBean user_info; private List<RankBean> rank_list; public UserInfoBean getUser_info() { return user_info; } public void setUser_info(UserInfoBean user_info) { this.user_info = user_info; } public List<RankBean> getRank_list() { return rank_list; } public void setRank_list(List<RankBean> rank_list) { this.rank_list = rank_list; } public class UserInfoBean implements Serializable{ /** * rank : 1 * user_id : 100 * user_name : cold * head_pic : http://img.wujiemall.com/Public/Pc/img/default.png * user_count : 0 */ private String rank; private String user_id; private String user_name; private String head_pic; private String user_count; public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } public String getUser_id() { return user_id; } public void setUser_id(String user_id) { this.user_id = user_id; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } public String getHead_pic() { return head_pic; } public void setHead_pic(String head_pic) { this.head_pic = head_pic; } public String getUser_count() { return user_count; } public void setUser_count(String user_count) { this.user_count = user_count; } } public class RankBean implements Serializable{ /** * rank : 1 * user_id : 100 * user_name : cold * head_pic : http://img.wujiemall.com/Public/Pc/img/default.png * user_count : 0 */ private String rank; private String user_id; private String user_name; private String head_pic; private String user_count; public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } public String getUser_id() { return user_id; } public void setUser_id(String user_id) { this.user_id = user_id; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } public String getHead_pic() { return head_pic; } public void setHead_pic(String head_pic) { this.head_pic = head_pic; } public String getUser_count() { return user_count; } public void setUser_count(String user_count) { this.user_count = user_count; } } }
[ "32457127@qq.com" ]
32457127@qq.com
d03aa97dbed8bf330b78fc813276783c3e0a8487
4f6941a3a02d8b8062c5456e82e742f68c0e5384
/minuteKernel/src/main/java/net/sf/minuteProject/configuration/bean/presentation/PresentationBlock.java
70b8a685a8c8679d224f8691dfeb877c60add46c
[]
no_license
based2/minuteProject
ee77362088e0e1e7a288248235d084a160d2cff0
70ec408bb76351efaf68c782a5c64786b4524479
refs/heads/master
2021-07-19T23:59:59.730524
2021-02-09T17:40:01
2021-02-09T17:40:01
6,311,816
5
0
null
null
null
null
UTF-8
Java
false
false
1,398
java
package net.sf.minuteProject.configuration.bean.presentation; import java.util.ArrayList; import java.util.List; import net.sf.minuteProject.configuration.bean.AbstractConfiguration; public class PresentationBlock extends AbstractConfiguration{ private Presentation presentation; private String type; private List <EntityBlocks> entityBlockss; private List <FieldBlocks> fieldBlockss; public Presentation getPresentation() { return presentation; } public void setPresentation(Presentation presentation) { this.presentation = presentation; } public void addEntityBlocks (EntityBlocks entityBlocks) { entityBlocks.setPresentationBlock(this); if (entityBlockss==null) entityBlockss = new ArrayList(); entityBlockss.add(entityBlocks); } public void addFieldBlocks (FieldBlocks fieldBlocks) { if (fieldBlockss==null) fieldBlockss = new ArrayList(); fieldBlockss.add(fieldBlocks); } public String getType() { return type; } public void setType(String type) { this.type = type; } public List<EntityBlocks> getEntityBlockss() { return entityBlockss; } public void setEntityBlockss(List<EntityBlocks> entityBlockss) { this.entityBlockss = entityBlockss; } public List<FieldBlocks> getFieldBlockss() { return fieldBlockss; } public void setFieldBlockss(List<FieldBlocks> fieldBlockss) { this.fieldBlockss = fieldBlockss; } }
[ "based@free.fr" ]
based@free.fr
8432a4c9e909119722826d7c7c62b0537d0e98f6
60be0bf2090b34585b33ec2bcb13fecc4ca95ae1
/app/src/main/java/com/xuhao/gank/activitys/MainActivity.java
a9475d91b9cd30c65325ea32e42bdb5dd37be558
[ "Apache-2.0" ]
permissive
haoXu1990/GanK
81de17b9863f6b71eb7c764374428136a5eb0837
1c8d4bb9117b24ea80ef3c7356586df57afb816e
refs/heads/master
2020-03-19T05:45:05.258981
2018-06-27T09:04:23
2018-06-27T09:04:23
135,959,226
0
0
null
null
null
null
UTF-8
Java
false
false
8,713
java
package com.xuhao.gank.activitys; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.blankj.utilcode.util.ConvertUtils; import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CircleCrop; import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.request.RequestOptions; import com.google.gson.reflect.TypeToken; import com.mikepenz.fontawesome_typeface_library.FontAwesome; import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.iconics.typeface.IIcon; import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic; import com.wuhenzhizao.titlebar.utils.AppUtils; import com.wuhenzhizao.titlebar.widget.CommonTitleBar; import com.xuhao.gank.R; import com.xuhao.gank.bean.GanHuo; import com.xuhao.gank.fragments.AllFragment; import com.xuhao.gank.http.HttpRespons; import com.xuhao.gank.http.RequstManger; import com.xuhao.gank.utils.ThemeUtils; import com.xuhao.gank.widget.ResideLayout; import java.util.ArrayList; import java.util.List; import javax.crypto.Mac; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; public class MainActivity extends AppCompatActivity { @BindView(R.id.all) TextView mAll; @BindView(R.id.fuli) TextView mFuli; @BindView(R.id.android) TextView mAndroid; @BindView(R.id.ios) TextView mIos; @BindView(R.id.video) TextView mVideo; @BindView(R.id.front) TextView mFront; @BindView(R.id.resource) TextView mResource; @BindView(R.id.app) TextView mApp; @BindView(R.id.more) TextView mMore; @BindView(R.id.about) TextView mAbout; @BindView(R.id.icon_titlebar) ImageView mIcon; @BindView(R.id.tv_titlebar) TextView mTtitlebar; @BindView(R.id.resideLayout) ResideLayout mResideLayout; @BindView(R.id.iv_main_avatar) ImageView mAvatar; @BindView(R.id.tv_main_desc) TextView mDesc; private ArrayList<GanHuo> mGanhuos = new ArrayList<>(); private String typeStr = "福利"; // 管理器 private FragmentManager mFragmentManager; String mCurrentFragmentTag; RequestOptions mOptions; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 绑定View ButterKnife.bind(this); initView(); mIcon.setImageDrawable(new IconicsDrawable(this) .color(Color.WHITE) .icon(MaterialDesignIconic.Icon.gmi_view_comfy) .sizeDp(20)); mTtitlebar.setText("干货集中营"); switchFragment("all"); } public void initView(){ // 获取Fragment管理器 mFragmentManager = getSupportFragmentManager(); mOptions = new RequestOptions().circleCrop() .transforms(new CircleCrop(), new RoundedCorners(40)); RequstManger.shareManager().getData(getUrl(), new HttpRespons<List<GanHuo>>(new TypeToken<ArrayList<GanHuo>>(){}.getType()) { @Override public void onError(String msg) { } @Override public void onSuccess(List<GanHuo> ganHuo) { mDesc.setText(ganHuo.get(0).getDesc()); Glide.with(MainActivity.this) .load(ganHuo.get(0).getUrl()) .apply(mOptions) .transition(withCrossFade()) .into(mAvatar); } }); setIconDrawable(mAll, MaterialDesignIconic.Icon.gmi_view_comfy); setIconDrawable(mFuli, MaterialDesignIconic.Icon.gmi_mood); setIconDrawable(mAndroid, MaterialDesignIconic.Icon.gmi_android); setIconDrawable(mIos, MaterialDesignIconic.Icon.gmi_apple); setIconDrawable(mVideo, MaterialDesignIconic.Icon.gmi_collection_video); setIconDrawable(mFront, MaterialDesignIconic.Icon.gmi_language_javascript); setIconDrawable(mResource, FontAwesome.Icon.faw_location_arrow); setIconDrawable(mApp, MaterialDesignIconic.Icon.gmi_apps); setIconDrawable(mAbout, MaterialDesignIconic.Icon.gmi_account); setIconDrawable(mMore, MaterialDesignIconic.Icon.gmi_more); } public String getUrl(){ return "http://gank.io/api/data/" + typeStr + "/" + String.valueOf(1) + "/" + String.valueOf(1); } public void switchFragment(String name){ // 检查参数 , 如果当前 tag 为空或则传入的参数名和当前tag相同的话就返回 if (mCurrentFragmentTag != null && mCurrentFragmentTag.equals(name)){ return; } // 设置转场动画 FragmentTransaction ft = mFragmentManager.beginTransaction(); // 设置转场动画样式 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); // 根据tag 找到当前显示的Fragment Fragment currentFragment = mFragmentManager.findFragmentByTag(mCurrentFragmentTag); // 根据tag 找到将要显示的Fragment Fragment foundFragment = mFragmentManager.findFragmentByTag(name); if (foundFragment == null) { foundFragment = new AllFragment(); } if (foundFragment.isAdded()) { // 显示Fragment ft.show(foundFragment); } else { // 把找到的Fragment 放入到FragmentManger中 //ft.add(R.id.container, foundFragment, name); ft.replace(R.id.container, foundFragment, name); } ft.commit(); mCurrentFragmentTag = name; } @OnClick({R.id.icon_titlebar, R.id.all,R.id.fuli, R.id.android, R.id.ios, R.id.video, R.id.front, R.id.resource}) public void onClick(View view){ switch (view.getId()){ case R.id.icon_titlebar: mResideLayout.openPane(); break; case R.id.all: mResideLayout.closePane(); mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_mood).sizeDp(20)); mTtitlebar.setText("干货集中营"); switchFragment("all"); break; case R.id.fuli: mResideLayout.closePane(); mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_mood).sizeDp(20)); mTtitlebar.setText("福利"); switchFragment("福利"); break; case R.id.android: mResideLayout.closePane(); mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_android).sizeDp(20)); mTtitlebar.setText("Android"); switchFragment("Android"); break; case R.id.ios: mResideLayout.closePane(); mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_apple).sizeDp(20)); mTtitlebar.setText("iOS"); switchFragment("iOS"); break; case R.id.video: mResideLayout.closePane(); mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_collection_video).sizeDp(20)); mTtitlebar.setText("休息视频"); switchFragment("休息视频"); break; } } @Override public void onBackPressed() { if (mResideLayout.isOpen()) { mResideLayout.closePane(); } else { super.onBackPressed(); } } private void setIconDrawable(TextView view, IIcon icon) { view.setCompoundDrawablesWithIntrinsicBounds(new IconicsDrawable(this) .icon(icon) .color(Color.WHITE) .sizeDp(16), null, null, null); view.setCompoundDrawablePadding(ConvertUtils.dp2px(5)); } }
[ "286089659@qq.com" ]
286089659@qq.com
8e44fadd0b7f3b985d417c9e058c1e10b521c711
96d993c211f0419a6a560f3d64bbff8dcc6c2dc7
/src/main/java/com/cjw/demo/lambda/AgainAdvanceLambda.java
09af9a4557d80194740db24c0d1723da87acdc86
[]
no_license
chujinwang/itExpre
96e8bd2864c5c87975ef97e1c96da632c060ad6e
ec0e376e1457937b4079b48bcf756b59125e10da
refs/heads/master
2022-11-30T16:21:47.780958
2020-08-11T05:31:14
2020-08-11T05:31:14
285,785,895
1
0
null
null
null
null
UTF-8
Java
false
false
969
java
package com.cjw.demo.lambda; import java.util.ArrayList; public class AgainAdvanceLambda { public static void main(String[] args){ //不是用treeset的原因,如果相邻的id都是9的话 他会以为他们是相同的自动去重 ArrayList<Student> arrayList = new ArrayList<Student>(); arrayList.add(new Student(1,"小1")); arrayList.add(new Student(2,"小2")); arrayList.add(new Student(3,"小3")); arrayList.add(new Student(4,"小4")); arrayList.add(new Student(5,"小5")); arrayList.add(new Student(6,"小6")); arrayList.add(new Student(7,"小7")); arrayList.add(new Student(8,"小8")); arrayList.add(new Student(9,"小9")); arrayList.add(new Student(10,"小10")); arrayList.add(new Student(11,"小11")); System.out.println(arrayList); arrayList.sort((o1,o2)->o2.getId()-o1.getId()); System.out.println(arrayList); } }
[ "379177616@qq.com" ]
379177616@qq.com
f5832c1995fd7813936ef5d40a2e5fbfba5937d0
87873856a23cd5ebdcd227ef39386fb33f5d6b13
/java-best-of/src/main/java/io/jsd/training/designpattern/combining/ducks/bird/DecoyDuck.java
9a5ac0cff1d80a765e79df41c131c71061a510c8
[]
no_license
jsdumas/java-training
da204384223c3e7871ccbb8f4a73996ae55536f3
8df1da57ea7a5dd596fea9b70c6cd663534d9d18
refs/heads/master
2022-06-28T16:08:47.529631
2019-06-06T07:49:30
2019-06-06T07:49:30
113,677,424
0
0
null
2022-06-20T23:48:24
2017-12-09T14:55:56
Java
UTF-8
Java
false
false
185
java
package io.jsd.training.designpattern.combining.ducks.bird; public class DecoyDuck implements Quackable { @Override public void quack() { System.out.println("<< Silence >>"); } }
[ "jsdumas@free.fr" ]
jsdumas@free.fr
1f8eaaa5b5902af35c42e8cb9a4061c69b1f3f23
c2d782fc19a27ce8b6c2f5a924d6f3c66f85e013
/Theory_Questions/Theory_questions/FavoriteSortingAlgo.java
5119d674a6e18ab6941699c7c9aac29b5ab40ffd
[]
no_license
ravicode/github
5fe94e553e2a6c953bde484ee4458a35602820bc
9e97a9655212456bd1149229a8d6b0a38c4f3f3a
refs/heads/master
2021-01-01T04:40:16.943559
2016-04-23T20:20:01
2016-04-23T20:20:01
56,939,062
0
1
null
null
null
null
UTF-8
Java
false
false
536
java
package Theory_questions; /* my favorite sorting algorithm. My favorite is insertion sort but I told him merge sort because I knew a lot about merge sort so I wanted to drive the interview towards merge sort and as expected he asked many questions on merge sort and I gave him all the answers. He asked me to build a tree from given preorder and postorder traversal of tree, I said it is impossible to build from only these 2 traversals , you have to give me inorder to build a unique tree. */ public class FavoriteSortingAlgo { }
[ "ravi.ters@gmail.com" ]
ravi.ters@gmail.com
bebfd4f6eb45305b6caba0986a1a73bddde75ffb
429f484bb567de8413d047e52eb90bb7d16d1ba2
/app/src/androidTest/java/com/android/newvid/ApplicationTest.java
634575e2a7cd654b4916c174ca28fe03f5aecfe7
[ "Apache-2.0" ]
permissive
Aluisyo/newvid
ee24d4eb1ed38c1dd32ad382716f85c7476a021b
3d4c2a479c6164448373a2feb18e7d0aedc36f86
refs/heads/master
2021-01-09T05:41:21.359095
2018-01-12T09:35:20
2018-01-12T09:35:20
80,811,256
3
0
null
null
null
null
UTF-8
Java
false
false
349
java
package com.android.newvid; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "suzyoeliasnyirenda@gmail.com" ]
suzyoeliasnyirenda@gmail.com
be8b492fde3af59cb804cf941a9646a7f7c393dc
6dcc806cecf316e98b7ba6f1aec396c47845c446
/src/Controler/ClientesDialogController.java
70360afffdcd47db066b2060ce7dff44e4ad7c0c
[]
no_license
matheuskid/concessionaria-java
b056f08bdd6aee11e57dcf5a93765be6eff4b111
f28f676c9db2f3c81798cd5ec80a539352bf65e7
refs/heads/main
2023-01-24T08:54:38.283038
2020-12-09T16:53:32
2020-12-09T16:53:32
320,018,681
0
0
null
null
null
null
UTF-8
Java
false
false
4,458
java
package Controler; import Model.Cliente; import Model.Mascaras; import Model.Promocao; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.stage.Stage; /** * FXML Controller class * * @author pedro */ public class ClientesDialogController implements Initializable { @FXML private TextField tf_nome; @FXML private TextField tf_email; @FXML private TextField tf_telefone; @FXML private TextField tf_cidade; @FXML private TextField tf_estado; @FXML private TextField tf_senha; @FXML private TextField tf_cnh; @FXML private Button buttonCancelar; @FXML private Button buttonConfirmar; private Stage dialogStage; private boolean buttonConfirmarClicked = false; private Cliente cliente; @Override public void initialize(URL url, ResourceBundle rb) { Mascaras.maskString(tf_nome); Mascaras.maskString(tf_cidade); Mascaras.maskTel(tf_telefone); Mascaras.maskString(tf_estado); Mascaras.maskNumeros(tf_cnh); } public Stage getDialogStage() { return dialogStage; } public void setDialogStage(Stage dialogStage) { this.dialogStage = dialogStage; } public boolean isButtonConfirmarClicked() { return buttonConfirmarClicked; } public void setButtonConfirmarClicked(boolean buttonConfirmarClicked) { this.buttonConfirmarClicked = buttonConfirmarClicked; } public Cliente getCliente() { return cliente; } public void setCliente(Cliente cliente) { this.cliente = cliente; this.tf_nome.setText(cliente.getNome()); this.tf_senha.setText(String.valueOf(cliente.getCod_login())); this.tf_email.setText(cliente.getEmail()); this.tf_telefone.setText(cliente.getTelefone()); this.tf_cidade.setText(cliente.getCidade()); this.tf_estado.setText(cliente.getEstado()); this.tf_cnh.setText(cliente.getCNH()); } @FXML private void handleButtonConfirmar(ActionEvent event) { if (validarEntradaDeDados()) { cliente.setNome(tf_nome.getText()); cliente.setCod_login(Integer.parseInt(tf_senha.getText())); cliente.setEmail(tf_email.getText()); cliente.setTelefone(tf_telefone.getText()); cliente.setCidade(tf_cidade.getText()); cliente.setEstado(tf_estado.getText()); cliente.setCNH(tf_cnh.getText()); buttonConfirmarClicked = true; dialogStage.close(); } } @FXML private void handleButtonCancelar(ActionEvent event) { dialogStage.close(); } private boolean validarEntradaDeDados() { String errorMessage = ""; if (tf_nome.getText() == null || tf_nome.getText().length() == 0) { errorMessage += "Nome inválido!\n"; } if (tf_senha.getText() == null || tf_senha.getText().length() == 0) { errorMessage += "Senha inválida!\n"; } if (tf_email.getText() == null || tf_email.getText().length() == 0){ errorMessage += "Email inválido!\n"; } if (tf_telefone.getText() == null || tf_telefone.getText().length() == 0){ errorMessage += "Telefone inválido!\n"; } if (tf_cidade.getText() == null || tf_cidade.getText().length() == 0){ errorMessage += "Cidade inválida!\n"; } if (tf_estado.getText() == null || tf_estado.getText().length() == 0){ errorMessage += "Estado inválido!\n"; } if (tf_cnh.getText() == null || tf_cnh.getText().length() == 0){ errorMessage += "CNH inválida!\n"; } if (errorMessage.length() == 0) { return true; } else { // Mostrando a mensagem de erro Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Erro no cadastro"); alert.setHeaderText("Campos inválidos, por favor, corrija..."); alert.setContentText(errorMessage); alert.show(); return false; } } }
[ "“matheuskindrow@gmail.com”" ]
“matheuskindrow@gmail.com”
dea321cc7162309b8307633481d1eae01fb07c3c
2897ab0ed65334cbc4309c3dd819bf526d79aa48
/gae/stockyou/StockService/src/com/stockyou/data/yahoo/YahooPortfolio.java
675eb3d697d24325833e64968019630316c71ca5
[]
no_license
icarusin/styu
fd36d42d547c38eaccafb77762983a56e7c7ecc0
b32f1e554a710093c77c81de6f26defb3084cfe3
refs/heads/master
2020-06-02T11:25:58.633755
2013-04-16T21:42:25
2013-04-16T21:42:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
246
java
package com.stockyou.data.yahoo; public class YahooPortfolio { private YahooPortfolioQuery query; public YahooPortfolioQuery getQuery() { return query; } public void setQuery(YahooPortfolioQuery query) { this.query = query; } }
[ "pr.arun@gmail.com" ]
pr.arun@gmail.com
09a99d038eb9faa8a421076ede444081ce36e696
9f93a27c299a1b9ba8714554f32e83f3814b88d0
/week02/jwt/src/main/java/com/org/srm/jwt/configuration/CustomJwtAuthenticationFilter.java
ea6588218a161b5c19f97750425507640b4cd307
[]
no_license
lattavenkat/SrmB1SpringExercises
cae036f8b3d71665e0c6907f6394af21bb19b58b
ddf85e484b5b3d0caba2643524e198dddd3ded5f
refs/heads/master
2023-06-25T17:48:47.255114
2021-07-31T09:24:29
2021-07-31T09:24:29
390,943,317
0
0
null
null
null
null
UTF-8
Java
false
false
4,668
java
package com.org.srm.jwt.configuration; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.web.filter.OncePerRequestFilter; import io.jsonwebtoken.ExpiredJwtException; @Component public class CustomJwtAuthenticationFilter extends OncePerRequestFilter { @Autowired private JwtUtil jwtTokenUtil; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { try{ // JWT Token is in the form "Bearer token". Remove Bearer word and // get only the Token String jwtToken = extractJwtFromRequest(request); if (StringUtils.hasText(jwtToken) && jwtTokenUtil.validateToken(jwtToken)) { UserDetails userDetails = new User(jwtTokenUtil.getUsernameFromToken(jwtToken), "", jwtTokenUtil.getRolesFromToken(jwtToken)); UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken( userDetails, null, userDetails.getAuthorities()); // After setting the Authentication in the context, we specify // that the current user is authenticated. So it passes the // Spring Security Configurations successfully. SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); //request.setAttribute("claims", jwtTokenUtil.getClaimsFromJWT(jwtToken)); } else { System.out.println("Cannot set the Security Context"); } }catch(ExpiredJwtException ex) { String isRefreshToken = request.getHeader("isRefreshToken"); System.out.println("=====================" + isRefreshToken); String requestURL = request.getRequestURL().toString(); // allow for Refresh Token creation if following conditions are true. if (isRefreshToken != null && isRefreshToken.equals("true") && requestURL.contains("refreshtoken")) { allowForRefreshToken(ex, request); } else request.setAttribute("exception", ex); } catch(BadCredentialsException ex) { request.setAttribute("exception", ex); } chain.doFilter(request, response); } private void allowForRefreshToken(ExpiredJwtException ex, HttpServletRequest request) { // create a UsernamePasswordAuthenticationToken with null values. UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken( null, null, null); // After setting the Authentication in the context, we specify // that the current user is authenticated. So it passes the // Spring Security Configurations successfully. SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); // Set the claims so that in controller we will be using it to create // new JWT System.out.println("=======setting claims====" + ex.getClaims()); request.setAttribute("claims", ex.getClaims()); } // private void allowForRefreshToken(HttpServletRequest request,String token) { // // // create a UsernamePasswordAuthenticationToken with null values. // UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken( // null, null, null); // // After setting the Authentication in the context, we specify // // that the current user is authenticated. So it passes the // // Spring Security Configurations successfully. // SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); // // Set the claims so that in controller we will be using it to create // // new JWT // //System.out.println("=======setting claims====" + ex.getClaims()); // request.setAttribute("claims", jwtTokenUtil.getClaimsFromJWT(token)); // // } private String extractJwtFromRequest(HttpServletRequest request) { String bearerToken = request.getHeader("Authorization"); if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { return bearerToken.substring(7, bearerToken.length()); } return null; } }
[ "lattanaidu@gmail.com" ]
lattanaidu@gmail.com
690de5d7777f986f10a0a5967a7a7886441ac15e
7951b011669b2347cad79d74811df5c0e7f812e4
/VladKornieiev/src/ACO/week1/students/comparators/ByAgeComparator.java
54a3b314f1681e6dd02828d1ec356451e39a351a
[]
no_license
gorobec/ACO18TeamProject
77c18e12cefb4eda3186dc6f7b84aed14040a691
ae48c849915c8cb41aab637d001d2b492cc53432
refs/heads/master
2021-01-11T15:20:56.092695
2017-02-18T14:22:11
2017-02-18T14:22:11
80,338,687
1
1
null
2017-02-22T20:10:45
2017-01-29T09:48:23
Java
UTF-8
Java
false
false
421
java
package ACO.week1.students.comparators; import ACO.week1.students.Student; import java.util.Comparator; /** * Created by v21k on 28.01.17. */ public class ByAgeComparator implements Comparator { @Override public int compare(Object o1, Object o2) { Student student1 = (Student) o1; Student student2 = (Student) o2; return Integer.compare(student1.getAge(), student2.getAge()); } }
[ "vlad.kornieiev@gmail.com" ]
vlad.kornieiev@gmail.com
37cf3c487c96a38321392a8734235e89ae3f6a2a
28f11a9a39436c2213f65ca36a3534ae4086a082
/archive-core/src/test/java/org/archenroot/integration/commons/archive_service/core/compress/AbstractArchiverTest.java
33cb8a171b9b6160b2e4f8c2ded5a8f2d675427e
[]
no_license
archenroot/integration-commons_archive-service
4d21d8d3eaba26efae46f80a365dd9fc9e895ba4
5fa7e70dccb3079e688feecca3541943441cab1e
refs/heads/master
2021-05-08T07:12:14.604572
2017-10-12T19:18:57
2017-10-12T19:18:57
106,712,660
1
0
null
null
null
null
UTF-8
Java
false
false
10,735
java
/** * Copyright 2013 Thomas Rausch * * 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.archenroot.integration.commons.archive_service.core.compress; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Date; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; public abstract class AbstractArchiverTest extends AbstractResourceTest { private Archiver archiver; private File archive; @Before public void setUp() { archiver = getArchiver(); archive = getArchive(); } @After public void tearDown() { archiver = null; archive = null; } protected abstract Archiver getArchiver(); protected abstract File getArchive(); @Test public void extract_properlyExtractsArchive() throws Exception { archiver.extract(archive, ARCHIVE_EXTRACT_DIR); assertExtractionWasSuccessful(); } @Test public void extract_properlyExtractsArchiveStream() throws Exception { InputStream archiveAsStream = null; try { archiveAsStream = new FileInputStream(archive); archiver.extract(archiveAsStream, ARCHIVE_EXTRACT_DIR); assertExtractionWasSuccessful(); } finally { IOUtils.closeQuietly(archiveAsStream); } } @Test public void create_recursiveDirectory_withFileExtension_properlyCreatesArchive() throws Exception { String archiveName = archive.getName(); File createdArchive = archiver.create(archiveName, ARCHIVE_CREATE_DIR, ARCHIVE_DIR); assertTrue(createdArchive.exists()); assertEquals(archiveName, createdArchive.getName()); archiver.extract(createdArchive, ARCHIVE_EXTRACT_DIR); assertExtractionWasSuccessful(); } @Test public void create_multipleSourceFiles_properlyCreatesArchive() throws Exception { String archiveName = archive.getName(); File createdArchive = archiver.create(archiveName, ARCHIVE_CREATE_DIR, ARCHIVE_DIR.listFiles()); assertTrue(createdArchive.exists()); assertEquals(archiveName, createdArchive.getName()); archiver.extract(createdArchive, ARCHIVE_EXTRACT_DIR); assertDirectoryStructureEquals(ARCHIVE_DIR, ARCHIVE_EXTRACT_DIR); } @Test public void create_recursiveDirectory_withoutFileExtension_properlyCreatesArchive() throws Exception { String archiveName = archive.getName(); File archive = archiver.create("archive", ARCHIVE_CREATE_DIR, ARCHIVE_DIR); assertTrue(archive.exists()); assertEquals(archiveName, archive.getName()); archiver.extract(archive, ARCHIVE_EXTRACT_DIR); assertExtractionWasSuccessful(); } @Test(expected = FileNotFoundException.class) public void create_withNonExistingSource_fails() throws Exception { archiver.create("archive", ARCHIVE_CREATE_DIR, NON_EXISTING_FILE); } @Test(expected = FileNotFoundException.class) public void create_withNonReadableSource_fails() throws Exception { archiver.create("archive", ARCHIVE_CREATE_DIR, NON_READABLE_FILE); } @Test(expected = IllegalArgumentException.class) public void create_withFileAsDestination_fails() throws Exception { archiver.create("archive", NON_READABLE_FILE, ARCHIVE_DIR); } @Test(expected = IllegalArgumentException.class) public void create_withNonWritableDestination_fails() throws Exception { archiver.create("archive", NON_WRITABLE_DIR, ARCHIVE_DIR); } @Test(expected = FileNotFoundException.class) public void extract_withNonExistingSource_fails() throws Exception { archiver.extract(NON_EXISTING_FILE, ARCHIVE_EXTRACT_DIR); } @Test(expected = IllegalArgumentException.class) public void extract_withNonReadableSource_fails() throws Exception { archiver.extract(NON_READABLE_FILE, ARCHIVE_EXTRACT_DIR); } @Test(expected = IllegalArgumentException.class) public void extract_withFileAsDestination_fails() throws Exception { archiver.extract(archive, NON_READABLE_FILE); } @Test(expected = IllegalArgumentException.class) public void extract_withNonWritableDestination_fails() throws Exception { archiver.extract(archive, NON_WRITABLE_DIR); } @Test public void stream_returnsCorrectEntries() throws IOException { ArchiveStream stream = null; try { stream = archiver.stream(archive); ArchiveEntry entry; List<String> entries = new ArrayList<String>(); while ((entry = stream.getNextEntry()) != null) { entries.add(entry.getName().replaceAll("/$", "")); // remove trailing slashes for test compatibility } assertEquals(11, entries.size()); assertTrue(entries.contains("file.txt")); assertTrue(entries.contains("folder")); assertTrue(entries.contains("folder/folder_file.txt")); assertTrue(entries.contains("folder/subfolder/subfolder_file.txt")); assertTrue(entries.contains("folder/subfolder")); assertTrue(entries.contains("permissions")); assertTrue(entries.contains("permissions/executable_file.txt")); assertTrue(entries.contains("permissions/private_executable_file.txt")); assertTrue(entries.contains("permissions/readonly_file.txt")); assertTrue(entries.contains("permissions/private_folder")); assertTrue(entries.contains("permissions/private_folder/private_file.txt")); } finally { IOUtils.closeQuietly(stream); } } @Test public void entry_isDirectory_behavesCorrectly() throws Exception { ArchiveStream stream = null; try { stream = archiver.stream(archive); ArchiveEntry entry; while ((entry = stream.getNextEntry()) != null) { String name = entry.getName().replaceAll("/$", ""); // remove trailing slashes for test compatibility if (name.endsWith("folder") || name.endsWith("subfolder") || name.endsWith("permissions") || name.endsWith("private_folder")) { assertTrue(entry.getName() + " is a directory", entry.isDirectory()); } else { assertFalse(entry.getName() + " is not a directory", entry.isDirectory()); } } } finally { IOUtils.closeQuietly(stream); } } @Test public void entry_geSize_behavesCorrectly() throws Exception { ArchiveStream stream = null; try { stream = archiver.stream(archive); ArchiveEntry entry; while ((entry = stream.getNextEntry()) != null) { String name = entry.getName().replaceAll("/$", ""); // remove trailing slashes for test compatibility if (name.endsWith("folder") || name.endsWith("subfolder") || name.endsWith("permissions") || name.endsWith("private_folder")) { assertEquals(0, entry.getSize()); } else { assertNotEquals(0, entry.getSize()); } } } finally { IOUtils.closeQuietly(stream); } } @Test public void entry_getLastModifiedDate_behavesCorrectly() throws Exception { ArchiveStream stream = null; try { stream = archiver.stream(archive); ArchiveEntry entry; while ((entry = stream.getNextEntry()) != null) { assertNotNull(entry.getLastModifiedDate()); assertTrue("modification date should be before now", new Date().after(entry.getLastModifiedDate())); } } finally { IOUtils.closeQuietly(stream); } } @Test public void stream_extractEveryEntryWorks() throws Exception { ArchiveStream stream = null; try { stream = archiver.stream(archive); ArchiveEntry entry; while ((entry = stream.getNextEntry()) != null) { entry.extract(ARCHIVE_EXTRACT_DIR); } } finally { IOUtils.closeQuietly(stream); } assertExtractionWasSuccessful(); } @Test(expected = IllegalStateException.class) public void stream_extractPassedEntry_throwsException() throws Exception { ArchiveStream stream = null; try { stream = archiver.stream(archive); ArchiveEntry entry = null; try { entry = stream.getNextEntry(); stream.getNextEntry(); } catch (IllegalStateException e) { fail("Illegal state exception caugth to early"); } entry.extract(ARCHIVE_EXTRACT_DIR); } finally { IOUtils.closeQuietly(stream); } } @Test(expected = IllegalStateException.class) public void stream_extractOnClosedStream_throwsException() throws Exception { ArchiveEntry entry = null; ArchiveStream stream = null; try { stream = archiver.stream(archive); entry = stream.getNextEntry(); } catch (IllegalStateException e) { fail("Illegal state exception caugth too early"); } finally { IOUtils.closeQuietly(stream); } entry.extract(ARCHIVE_EXTRACT_DIR); } protected static void assertExtractionWasSuccessful() throws Exception { assertDirectoryStructureEquals(ARCHIVE_DIR, ARCHIVE_EXTRACT_DIR); assertFilesEquals(ARCHIVE_DIR, ARCHIVE_EXTRACT_DIR); } }
[ "archenroot@gmail.com" ]
archenroot@gmail.com
87be4f7d883baec61c188d670e50542691095dba
4787dd3c6d7f0dd336fd092a4e218b1124d13d3b
/listnerexample2/app/src/test/java/com/jubayir/ExampleUnitTest.java
a57c888931d8fe118905081d64ebbc2955faef99
[]
no_license
jubayirhossain4448/Jubayir_Android
38733ec2ccb3dd8264bf3fd9221d1a5d68c8af6e
dc610f65233d385eab72473a6f08ffd19725277a
refs/heads/master
2020-06-12T21:39:02.748276
2019-10-16T16:46:41
2019-10-16T16:46:41
194,433,293
2
0
null
null
null
null
UTF-8
Java
false
false
372
java
package com.jubayir; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "jubayirhossain4448@gmail.com" ]
jubayirhossain4448@gmail.com
59a2b41f9dee44b0174df0d9dc1887adcb9f41d6
19425eb55eca330a105eded1c0b4c3cee3233aed
/src/main/java/com/codeup/springblogapp/controllers/RollDiceController.java
08ea24f0e11e7b4979dcb3577290517acbf6c1d1
[]
no_license
rubentrevino95/codeup-spring-blog
54e9cfd8935fcb791070c3c79e3cd6167aa4967d
beefd2b03b0f8edffacfd81ccc6d3ead436664aa
refs/heads/master
2022-07-09T00:26:02.015608
2020-05-19T20:56:21
2020-05-19T20:56:21
263,067,681
0
0
null
null
null
null
UTF-8
Java
false
false
935
java
package com.codeup.springblogapp.controllers; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.Random; @Controller public class RollDiceController { @GetMapping("/roll-dice") public String startGame() { return "rollDice"; } @PostMapping("/roll-dice/{num}") public String test (@RequestParam(name = "guess") int guess, Model model) { Boolean match = false; Random r = new Random(); int diceRoll = 0; model.addAttribute("dice-roll", diceRoll); model.addAttribute("guess", guess); for (int i = 0; i < 50; i++) { diceRoll = r.nextInt(6); diceRoll++; } String response; if (guess == diceRoll) { response = "You rolled the matching number of " + guess; } return "diceResults"; } }
[ "rubentrevino95@gmail.com" ]
rubentrevino95@gmail.com
18888dc8dd89ef3196eba65e4edf6790ce2d0520
9d88eed02ace5f25d1695306596c1fa039b00c17
/SPOJ/HISTOGRA.java
d88c958360416427607d6143b8ff8c7d0b66d9fd
[]
no_license
sjsupersumit/Algo
67c73be9fd437253f15b95f334d991fadd4db720
d7e875fc13d3db43a6567d3bce608fa4ae73769e
refs/heads/master
2021-01-17T04:10:13.782023
2017-02-02T06:16:46
2017-02-02T06:16:46
44,055,747
0
0
null
null
null
null
UTF-8
Java
false
false
1,261
java
package spoj; import java.io.PrintWriter; import java.util.Stack; /** * Created by sumit.jha on 9/20/16. */ public class HISTOGRA { public static void main(String args[]) throws Exception{ Reader in = new Reader(); PrintWriter out = new PrintWriter(System.out, true); int n = in.nextInt(); while (n!=0){ long arr[] = new long[n]; for(int i=0;i<n;i++){ arr[i] = in.nextLong(); } out.println(getMaxHeight(arr)); n = in.nextInt(); } } static long getMaxHeight(long[] arr){ Stack<Integer> s = new Stack<Integer>(); long area=0,maxArea=0; int i=0; for(; i<arr.length;){ if(s.empty() || arr[s.peek()] <= arr[i] ){ s.push(i); i++; } else { int index = s.pop(); int len = s.empty() ? i : (i - s.peek()-1) ; area = Math.max(area, arr[index]*len ); } } while (!s.empty()){ int index = s.pop(); int len = s.empty() ? i : (i - s.peek() -1) ; area = Math.max(area, arr[index]*len ); } return area; } }
[ "sjsupersumit@gmail.com" ]
sjsupersumit@gmail.com
b9c2fe2815cfd87e8fda4c0d28a35bc8a8f7cea2
542f352614185ea134355b61a8ee11d5e7d713af
/dlfc-zfgj-V1.5.0/dlfc-zfgj-core/src/main/java/com/dlfc/zfgj/service/SysOperateLogService.java
ae87375cc16faa9faa4839ff46673f44e689e32a
[]
no_license
iversonwuwei/zfgj-spring-boot-1.0.0
1798d3af99bd8a658e206f12627deef04d016ec9
2a28568290edd17ac557b878e095e824d8b5d1ed
refs/heads/master
2021-01-25T09:31:51.563362
2017-06-09T10:08:33
2017-06-09T10:10:08
93,845,536
0
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
/** * @name: OperateLogService.java * * @Copyright: (c) 2015 DLFC. All rights reserved. * * @description: * * @version: 1.0 * @date : 2015年9月21日 * @author: Sun.Zhi * * @Modification History:<br> * Date Author Version Discription * 2015年9月21日 Sun.Zhi 1.0 <修改原因描述> */ package com.dlfc.zfgj.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.dlfc.zfgj.entity.SysOperateLog; import com.dlfc.zfgj.mapper.SysOperateLogMapper; /** * @name: OperateLogService * @description: 操作日志Service * @version 1.0 * @author Sun.Zhi */ @Service("sysOperateLogService") public class SysOperateLogService { /**操作日志mapper*/ @Autowired private SysOperateLogMapper sysOperateLogMapper; /** * 新插入log * * @param log log对象 */ public void save(SysOperateLog log) { sysOperateLogMapper.insert(log); } /** * 更新log * * @param record log对象 */ public void update(SysOperateLog record) { sysOperateLogMapper.updateByPrimaryKeySelective(record); } }
[ "wuwei@housecenter.cn" ]
wuwei@housecenter.cn
dbfb52b65e2ca54e5e58210274b4fdcbf4af4d4f
8b48f8a4707784c6ffd9561a92dda27f5a96416d
/gulimall-order/src/main/java/com/fbw/gulimall/order/controller/OrderSettingController.java
cb9ccf77f8ce259856db091bb0ded7ca960cb36c
[]
no_license
Sirloingit/gulimall-sirloin
3404127c0b08697e49e67641c50b41e821a366fa
aba8833c5b484e2f666f538bb29e32f9b95c57f6
refs/heads/main
2023-03-25T17:04:21.615683
2021-03-16T08:29:55
2021-03-16T08:29:55
335,526,656
0
0
null
null
null
null
UTF-8
Java
false
false
2,343
java
package com.fbw.gulimall.order.controller; import java.util.Arrays; import java.util.Map; //import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.fbw.gulimall.order.entity.OrderSettingEntity; import com.fbw.gulimall.order.service.OrderSettingService; import com.fbw.common.utils.PageUtils; import com.fbw.common.utils.R; /** * 订单配置信息 * * @author sirloin * @email sunlightcs@gmail.com * @date 2021-02-04 11:36:51 */ @RestController @RequestMapping("order/ordersetting") public class OrderSettingController { @Autowired private OrderSettingService orderSettingService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("order:ordersetting:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = orderSettingService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") //@RequiresPermissions("order:ordersetting:info") public R info(@PathVariable("id") Long id){ OrderSettingEntity orderSetting = orderSettingService.getById(id); return R.ok().put("orderSetting", orderSetting); } /** * 保存 */ @RequestMapping("/save") //@RequiresPermissions("order:ordersetting:save") public R save(@RequestBody OrderSettingEntity orderSetting){ orderSettingService.save(orderSetting); return R.ok(); } /** * 修改 */ @RequestMapping("/update") //@RequiresPermissions("order:ordersetting:update") public R update(@RequestBody OrderSettingEntity orderSetting){ orderSettingService.updateById(orderSetting); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("order:ordersetting:delete") public R delete(@RequestBody Long[] ids){ orderSettingService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
[ "19210300021@fudan.edu.cn" ]
19210300021@fudan.edu.cn
67600071fc3c1ee0cb4062e18d172efe6d908e6a
fcd4c352e03870681b9cce9702f9424d2e3da7da
/src/com/google/zxing/client/android/MessageId.java
212cd8a7de4eecbfe8a297bead0d4f0f167b6946
[ "Apache-2.0" ]
permissive
xendk/BooksApp
c1d864d4daf754a60ae6fa9289ccb832b195cc9e
085ec9e184f95d9dd7f9a263c92f415024ad57e1
refs/heads/master
2021-01-15T15:57:19.263585
2012-12-30T20:39:12
2012-12-30T20:39:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package com.google.zxing.client.android; final class MessageId { // CaptureActivityHandler <-> DecodeThread public static final int DECODE = 0; public static final int QUIT = 1; public static final int DECODE_SUCCEEDED = 2; public static final int DECODE_FAILED = 3; // CaptureActivityHandler <-> CameraManager public static final int AUTO_FOCUS = 4; // BarcodeScanActivity <-> CaptureActivityHandler public static final int RESTART_PREVIEW = 5; }
[ "jonas.b@gmail.com" ]
jonas.b@gmail.com
56bd44bb5c5fce5ed42321160c46efc54257846b
8aea1a167c8cabd16847696a006b8471ccb9e2bc
/src/main/java/com/appgate/iplocator/rest/dto/Meta.java
0a319d5f03a2b4ea290a9544cbd02c3e2f757b30
[]
no_license
accusor/iplocator
7a43ec0ab92dd63814b4f8e3023a30e9393086aa
dd85f487c6ac86461e880de38954a5c46f884825
refs/heads/main
2023-02-23T05:43:23.313554
2021-01-25T17:11:37
2021-01-25T17:11:37
332,087,478
1
1
null
null
null
null
UTF-8
Java
false
false
383
java
package com.appgate.iplocator.rest.dto; import java.util.Date; import java.util.UUID; public class Meta { private String rsUid; private Date date; public Meta(){ UUID uuid = UUID.randomUUID(); this.rsUid = uuid.toString(); this.date = new Date(); } public Date getDate() { return date; } public String getRsUid() { return rsUid; } }
[ "hjdiazl@unal.edu.co" ]
hjdiazl@unal.edu.co
d40a8baaf495e4eb610c58949a263b92b54766ee
525a1acee62a698ce2241faf7111c7a56d3f9aad
/plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/dict/DB2TablePartitionStatus.java
33980baf8dd75a63a3ede8bb2c0f04499f8888bc
[ "EPL-2.0", "Apache-2.0" ]
permissive
Arkirka/DBeaver
3822e4687bd9151465f49f7e3ea40363129934c6
c1c33d3af5bf26027f3b33f9214100a4d4351e06
refs/heads/master
2022-12-27T20:12:31.948594
2020-06-08T19:00:27
2020-06-08T19:00:27
270,016,933
0
1
Apache-2.0
2020-10-14T00:30:27
2020-06-06T15:09:18
Java
UTF-8
Java
false
false
1,631
java
/* * DBeaver - Universal Database Manager * Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com) * Copyright (C) 2010-2020 DBeaver Corp and others * * 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.jkiss.dbeaver.ext.db2.model.dict; import org.jkiss.code.NotNull; import org.jkiss.dbeaver.model.DBPNamedObject; /** * DB2 Table Partition Status * * @author Denis Forveille */ public enum DB2TablePartitionStatus implements DBPNamedObject { A("Newly Attached"), D("Detached"), I("Detached maintained only during async. index cleanup"), L("Logically Detached"); private String name; // ----------- // Constructor // ----------- private DB2TablePartitionStatus(String name) { this.name = name; } // ----------------------- // Display @Property Value // ----------------------- @Override public String toString() { return name; } // ---------------- // Standard Getters // ---------------- @NotNull @Override public String getName() { return name; } }
[ "denis.vorobyov.00@gmail.com" ]
denis.vorobyov.00@gmail.com
78fbb2f70f4eb1bcf630ad85c34d0b6f7b0965be
fc961c69f31d28fb41c4b4130cc2a355b20016ea
/sms-platform-interface/src/main/java/com/qianfeng/smsplatform/userinterface/log/ReceiveLog.java
057cae9ecfe908d43bca12fe79ddd6c967c4cca7
[]
no_license
SquirrelMaSaKi/sms-platform
62df207251093d0ff6188b4c4ad204c346c243cb
a858ea7a727a26495015f91d8615424a9582c8e7
refs/heads/master
2022-07-11T19:47:03.645163
2019-12-12T12:11:30
2019-12-12T12:11:30
227,598,231
1
0
null
2022-06-21T02:25:58
2019-12-12T12:09:42
JavaScript
UTF-8
Java
false
false
216
java
package com.qianfeng.smsplatform.userinterface.log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ReceiveLog { public static Logger logger = LoggerFactory.getLogger(ReceiveLog.class); }
[ "seahorser@163.com" ]
seahorser@163.com
569b5108afb8621b871cd0bfb55ec303c317102c
df4539abf5d521be6fddd25734ccd7d7ac461428
/01-JavaSE/day12-内部类&API/案例/学员练习代码/myMath/src/com/itheima/MathDemo.java
2467562428fd4bba03aa9cd910ea09075c91c49e
[]
no_license
muzierixao/Learning-Java
c9bf6d1d020fd5b6e55d99c50172c465ea06fec0
893d9a730d6429626d1df5613fa7f81aca5bdd84
refs/heads/master
2023-04-18T06:48:46.280665
2020-12-27T05:32:02
2020-12-27T05:32:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
package com.itheima; /* Math类的常用方法 */ public class MathDemo { public static void main(String[] args) { //public static int abs​(int a):返回参数的绝对值 //public static double ceil​(double a):返回大于或等于参数的最小double值,等于一个整数 //public static double floor​(double a):返回小于或等于参数的最大double值,等于一个整数 //public static int round​(float a):按照四舍五入返回最接近参数的int //public static int max​(int a,int b):返回两个int值中的较大值 //public static int min​(int a,int b):返回两个int值中的较小值(自学) //public static double pow​(double a,double b):返回a的b次幂的值 //public static double random​():返回值为double的正值,[0.0,1.0) } }
[ "157514367@qq.com" ]
157514367@qq.com
d184d2e41897f8fdff91797c283ffb6399e0655a
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/plugin/multitalk/ui/widget/s.java
966acbf06aa18ead0203c0c4216de0bdb58cc3c3
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
2,626
java
package com.tencent.mm.plugin.multitalk.ui.widget; import android.content.Context; import androidx.recyclerview.widget.RecyclerView.a; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.pluginsdk.e.b; import java.util.ArrayList; import java.util.Iterator; import kotlin.Metadata; @Metadata(d1={""}, d2={"Lcom/tencent/mm/plugin/multitalk/ui/widget/SmallAvatarLayoutAdapter;", "Landroidx/recyclerview/widget/RecyclerView$Adapter;", "Lcom/tencent/mm/plugin/multitalk/ui/widget/SmallAvatarLayoutHolder;", "context", "Landroid/content/Context;", "(Landroid/content/Context;)V", "avatarItems", "Ljava/util/ArrayList;", "", "Lkotlin/collections/ArrayList;", "getContext", "()Landroid/content/Context;", "setContext", "addMember", "", "userName", "index", "", "checkIsExists", "", "getItemCount", "getMarginWidth", "onBindViewHolder", "holder", "position", "onCreateViewHolder", "parent", "Landroid/view/ViewGroup;", "plugin-multitalk_release"}, k=1, mv={1, 5, 1}, xi=48) public final class s extends RecyclerView.a<t> { public ArrayList<String> LwT; private Context context; public s(Context paramContext) { AppMethodBeat.i(178991); this.context = paramContext; this.LwT = new ArrayList(); AppMethodBeat.o(178991); } public final boolean aNI(String paramString) { AppMethodBeat.i(178987); kotlin.g.b.s.u(paramString, "userName"); Iterator localIterator = ((Iterable)this.LwT).iterator(); Object localObject; do { if (!localIterator.hasNext()) { break; } localObject = localIterator.next(); } while (!kotlin.g.b.s.p((String)localObject, paramString)); for (paramString = localObject; paramString != null; paramString = null) { AppMethodBeat.o(178987); return true; } AppMethodBeat.o(178987); return false; } public final int getItemCount() { AppMethodBeat.i(178989); int i = (int)Math.ceil(this.LwT.size() / e.b.XNz); AppMethodBeat.o(178989); return i; } public final void gi(String paramString, int paramInt) { AppMethodBeat.i(178986); kotlin.g.b.s.u(paramString, "userName"); if (this.LwT.size() <= paramInt) { this.LwT.add(paramString); AppMethodBeat.o(178986); return; } this.LwT.set(paramInt, paramString); AppMethodBeat.o(178986); } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes3.jar * Qualified Name: com.tencent.mm.plugin.multitalk.ui.widget.s * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
4cb72493b57c6deefc38aa4f2e1707e051a8bd11
a5d1e976fe51d2ce8f2add3a94b35b1b2be3c54e
/src/main/java/gov/noaa/ncdc/wct/decoders/cdm/DecodeRadialDatasetSweep.java
d4a891d58633466a2d6f4238303d38a4014cd0a0
[]
no_license
gss2002/wct
cc4ee9aa684db0941eaefe2fbd04642967f6d3f6
f242d36d074ff024eb55e8f6cbd626ac7072ad74
refs/heads/master
2020-12-24T07:19:45.685966
2016-12-26T20:48:28
2016-12-26T20:48:28
59,535,643
4
0
null
null
null
null
UTF-8
Java
false
false
58,937
java
package gov.noaa.ncdc.wct.decoders.cdm; import gov.noaa.ncdc.nexrad.NexradEquations; import gov.noaa.ncdc.wct.WCTFilter; import gov.noaa.ncdc.wct.WCTUtils; import gov.noaa.ncdc.wct.decoders.DecodeException; import gov.noaa.ncdc.wct.decoders.DecodeHintNotSupportedException; import gov.noaa.ncdc.wct.decoders.StreamingProcess; import gov.noaa.ncdc.wct.decoders.StreamingProcessException; import gov.noaa.ncdc.wct.decoders.nexrad.StreamingRadialDecoder; import gov.noaa.ncdc.wct.decoders.nexrad.WCTProjections; import gov.noaa.ncdc.wct.event.DataDecodeEvent; import gov.noaa.ncdc.wct.event.DataDecodeListener; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TimeZone; import java.util.Vector; import java.util.logging.Logger; import org.geotools.ct.MathTransform; import org.geotools.data.shapefile.shp.JTSUtilities; import org.geotools.feature.AttributeType; import org.geotools.feature.AttributeTypeFactory; import org.geotools.feature.Feature; import org.geotools.feature.FeatureCollection; import org.geotools.feature.FeatureCollections; import org.geotools.feature.FeatureType; import org.geotools.feature.FeatureTypeFactory; import org.geotools.pt.CoordinatePoint; import ucar.nc2.Attribute; import ucar.nc2.dt.RadialDatasetSweep; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LinearRing; import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Polygon; public class DecodeRadialDatasetSweep implements StreamingRadialDecoder { private static final Logger logger = Logger.getLogger(DecodeRadialDatasetSweep.class.getName()); private WCTProjections nexradProjection = new WCTProjections(); private GeometryFactory geoFactory = new GeometryFactory(); private FeatureType schema, display_schema, poly_schema, point_schema, all_point_schema; private final FeatureCollection fc = FeatureCollections.newCollection(); private Map<String, Object> hintsMap; private double lastDecodedElevationAngle = -999.0; /** * Description of the Field */ public final static AttributeType[] DISPLAY_POLY_ATTRIBUTES = { AttributeTypeFactory.newAttributeType("geom", Geometry.class), AttributeTypeFactory.newAttributeType("value", Float.class, true, 5), AttributeTypeFactory.newAttributeType("colorIndex", Integer.class, true, 4) }; /** * Description of the Field */ public final static AttributeType[] EXPORT_POLY_ATTRIBUTES = { AttributeTypeFactory.newAttributeType("geom", Geometry.class), AttributeTypeFactory.newAttributeType("sweep", Integer.class, true, 3), AttributeTypeFactory.newAttributeType("sweepTime", String.class, true, 21), AttributeTypeFactory.newAttributeType("elevAngle", Float.class, true, 6), AttributeTypeFactory.newAttributeType("value", Float.class, true, 5), AttributeTypeFactory.newAttributeType("radialAng", Float.class, true, 8), AttributeTypeFactory.newAttributeType("begGateRan", Float.class, true, 9), AttributeTypeFactory.newAttributeType("endGateRan", Float.class, true, 9), AttributeTypeFactory.newAttributeType("heightRel", Float.class, true, 9), AttributeTypeFactory.newAttributeType("heightASL", Float.class, true, 9) }; /** * Description of the Field */ public final static AttributeType[] EXPORT_POINT_ATTRIBUTES = { AttributeTypeFactory.newAttributeType("geom", Geometry.class), AttributeTypeFactory.newAttributeType("sweep", Integer.class, true, 3), AttributeTypeFactory.newAttributeType("sweepTime", String.class, true, 21), AttributeTypeFactory.newAttributeType("elevAngle", Float.class, true, 6), AttributeTypeFactory.newAttributeType("value", Float.class, true, 5), AttributeTypeFactory.newAttributeType("radialAng", Float.class, true, 8), AttributeTypeFactory.newAttributeType("surfaceRan", Float.class, true, 8), AttributeTypeFactory.newAttributeType("heightRel", Float.class, true, 9), AttributeTypeFactory.newAttributeType("heightASL", Float.class, true, 9) }; // The list of event listeners. private Vector<DataDecodeListener> listeners = new Vector<DataDecodeListener>(); private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); private RadialDatasetSweep.RadialVariable radialVar; private DecodeRadialDatasetSweepHeader header; private Date[] sweepDateTime; private double[] classificationValues = new double[] { -200.0 }; private double lastDecodedMinValue = 99999; private double lastDecodedMaxValue = -99999; public DecodeRadialDatasetSweep(DecodeRadialDatasetSweepHeader header) { this.header = header; init(); } /** * Sets the radial variable volume that will be decoded. * @param radialVar */ public void setRadialVariable(RadialDatasetSweep.RadialVariable radialVar) { this.radialVar = radialVar; } public FeatureType getFeatureType() { return schema; } /** * Initialize the FeatureType schemas and the hints map */ private void init() { try { display_schema = FeatureTypeFactory.newFeatureType(DISPLAY_POLY_ATTRIBUTES, "Display Radial Attributes"); poly_schema = FeatureTypeFactory.newFeatureType(EXPORT_POLY_ATTRIBUTES, "Radial Polygon Attributes"); point_schema = FeatureTypeFactory.newFeatureType(EXPORT_POINT_ATTRIBUTES, "Radial Point Attributes"); } catch (Exception e) { e.printStackTrace(); } hintsMap = new HashMap<String, Object>(); hintsMap.put("startSweep", new Integer(0)); hintsMap.put("endSweep", new Integer(0)); hintsMap.put("attributes", EXPORT_POLY_ATTRIBUTES); // TODO: instead of using the NexradFilter object, use the hints map // to define the attributes managed by the NexradFilter class // default NexradFilter for Level-II data WCTFilter nxfilter = new WCTFilter(); nxfilter.setMinValue(-500.0); hintsMap.put("nexradFilter", nxfilter); // TODO: instead of using preset classifications, allow user // to input custom classification values hintsMap.put("classify", new Boolean(false)); // ignore the range folded values? hintsMap.put("ignoreRF", new Boolean(true)); hintsMap.put("downsample-numGates", new Integer(1)); hintsMap.put("downsample-numRays", new Integer(1)); // Use JTS Geometry.buffer(0.0) to combine adjacent polygons // hintsMap.put("reducePolygons", new Boolean(false)); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); } /** * Set a decodeHint. To get a list of supported hints and default values, * use 'getDecodeHints()'. The currently supported hints are as follows: <br><br> * <ol> * <li> <b>startSweep</b>: * integer zero-based sweep number. If less than 0, it is set to 0. If * startSweep > totalNumSweeps, then startSweep is set to the last sweep present.</li> * <li> <b>endSweep</b>: * integer zero-based sweep number. If endSweep < startSweep, then endSweep is * set to the value of startSweep. If endSweep = startSweep, then only that one * sweep is decoded. If endSweep > totalNumSweeps, then endSweep is set to the * last sweep present. An easy catch-all to decode all sweeps for any NEXRAD VCP * would be to set the startSweep = 0 and endSweep = 1000 (for example). </li> * <li> <b>attributes</b>: * AttributeType[] object that determines which set of attributes to produce. * Use the static arrays in this class - they are the only ones supported. * <li> <b>nexradFilter</b>: * WCTFilter object that defines filtering options on range, azimuth, * height and geographic bounds. * <li> <b>classify</b>: * Boolean object to determine if Level-III NEXRAD classification levels * should be used. Classifying can reduce the rasterization time and number of features because * range bins with the same classification (ex: 5-10 dBZ) are combined into a single polygon. * <li> <b>ignoreRF</b>: * Ignore the Range-Folded values (only present in doppler moments) * @param hintsMap */ public void setDecodeHint(String hintKey, Object hintValue) throws DecodeHintNotSupportedException { if (! hintsMap.keySet().contains(hintKey)) { throw new DecodeHintNotSupportedException(this.getClass().toString(), hintKey, hintsMap); } hintsMap.put(hintKey, hintValue); } /** * Get the key-value pairs for the current decode hints. * If no hints have been set, this will return the supported * hints with default values. * @return */ public Map<String, Object> getDecodeHints() { return hintsMap; } /** * Get the array of sweep starting date/times - * the size will correspond to the number of sweeps decoded. <br> * dateTime[0] = dateTime of 'startSweep' decode hint. <br> * dateTime[dateTime.length-1] = dateTime of 'endSweep' decode hint. <br> * @return */ public Date[] getSweepDateTime() { return sweepDateTime; } /** * Decodes data and stores with in-memory FeatureCollection * @return * @throws DecodeException */ // @Override public void decodeData() throws DecodeException { fc.clear(); StreamingProcess process = new StreamingProcess() { public void addFeature(Feature feature) throws StreamingProcessException { fc.add(feature); } public void close() throws StreamingProcessException { logger.info("STREAMING PROCESS close() ::: fc.size() = "+fc.size()); } }; decodeData(new StreamingProcess[] { process } ); } /** * @param streamingProcessArray Array of StreamingProcess objects. */ public void decodeData(StreamingProcess[] streamingProcessArray) throws DecodeException { decodeData(streamingProcessArray, true); } /** * @param streamingProcessArray Array of StreamingProcess objects. * @param autoClose Do we call .close() on each StreamingProcess after decoding has finished. * Set to false, if aggregation of many files is needed and the process will be closed outside * of this decoder. */ public void decodeData(StreamingProcess[] streamingProcessArray, boolean autoClose) throws DecodeException { // System.out.println(header.getLat()+" "+header.getLon()+" ::: "); DataDecodeEvent event = new DataDecodeEvent(this); try { WCTFilter nxfilter = (WCTFilter)hintsMap.get("nexradFilter"); boolean classify = (Boolean)hintsMap.get("classify"); boolean useRFvalues = ! (Boolean)hintsMap.get("ignoreRF"); AttributeType[] attTypes = (AttributeType[])hintsMap.get("attributes"); // set up classification values based on Level-III scheme setUpClassifications(); String units = "N/A"; double rangeFoldedValue = Double.NEGATIVE_INFINITY; List<Attribute> attList = radialVar.getAttributes(); for (Attribute a : attList) { if (a.getName().equals("range_folded_value")) { rangeFoldedValue = a.getNumericValue().doubleValue(); } if (a.getName().equals("units")) { units = a.getStringValue(); } } // System.out.println("attributes read: units="+units+" range_folded_value="+rangeFoldedValue); double RF_VALUE = -200.0; double SNR_VALUE = -999.0; // Use Geotools Proj4 implementation to get MathTransform object MathTransform nexradTransform = nexradProjection.getRadarTransform(header.getLon(), header.getLat()); //List attributes = radialVar.getAttributes(); // Start decode // -------------- for (int i = 0; i < listeners.size(); i++) { event.setProgress(0); listeners.get(i).decodeStarted(event); } // set the current schema FeatureType if (attTypes == DISPLAY_POLY_ATTRIBUTES) { schema = display_schema; } else if (attTypes == EXPORT_POLY_ATTRIBUTES) { schema = poly_schema; } else if (attTypes == EXPORT_POINT_ATTRIBUTES) { schema = point_schema; } else { throw new DecodeException("Supplied AttributeType array doesn't not match"); } int startSweep = (Integer)hintsMap.get("startSweep"); int endSweep = (Integer)hintsMap.get("endSweep"); if (startSweep < 0) { startSweep = 0; } if (startSweep >= radialVar.getNumSweeps()) { startSweep = radialVar.getNumSweeps()-1; } if (endSweep < 0) { endSweep = 0; } if (endSweep < startSweep) { endSweep = startSweep; } if (endSweep >= radialVar.getNumSweeps()) { endSweep = radialVar.getNumSweeps()-1; } logger.info("UNITS = '"+units+"'"); logger.info("DESCRIPTION::::: "+radialVar.getDescription()); sweepDateTime = new Date[endSweep - startSweep + 1]; int geoIndex = 0; for (int s=startSweep; s<endSweep+1; s++) { RadialDatasetSweep.Sweep sweep = radialVar.getSweep(s); // System.err.println(sweep.getStartingTime() + " " + sweep.getEndingTime()); // int numGates = (Integer)hintsMap.get("downsample-numGates"); // int numRays = (Integer)hintsMap.get("downsample-numRays"); // // only do this if we really need to // if (numGates > 0 || numRays > 0) { // SweepPyramid sweepPyramid = new SweepPyramid(sweep); // sweep = sweepPyramid.getDownsampledSweep(numGates, numRays); // } for (Attribute att: radialVar.getAttributes()) { logger.fine("ATT LIST: "+att.toString()); } float meanElev = sweep.getMeanElevation(); int nrays = sweep.getRadialNumber(); float beamWidth = sweep.getBeamWidth(); int ngates = sweep.getGateNumber(); float gateSize = sweep.getGateSize(); double range_to_first_gate = sweep.getRangeToFirstGate(); // sweepDateTime[endSweep-s] = sweep.getStartingTime(); sweepDateTime[endSweep-s] = new Date(sweep.getStartingTime().getTime() + (int)sweep.getTime(0)); logger.fine("getTime: "+(int)sweep.getTime(0)); // represents the LOWER LEFT CORNER of the range bin Coordinate[][] indexedCoordArray = new Coordinate[nrays+1][ngates+1]; logger.fine("startSweep = "+startSweep+" ----- endSweep = "+endSweep); logger.fine("meanElev = "+meanElev); logger.fine("nrays = "+nrays); logger.fine("beamWidth = "+beamWidth); logger.fine("ngates = "+ngates); logger.fine("gateSize = "+gateSize); logger.fine("rangeToFirstGate = "+range_to_first_gate); this.lastDecodedElevationAngle = meanElev; double range_step = sweep.getGateSize(); // go 1 extra to complete the gate double[] range = new double[sweep.getGateNumber()+1]; // check that each ray has the same elevation angle within the sweep double sweepElev = sweep.getElevation(0); logger.fine("sweepElev = "+sweepElev); for (int i = 1; i < nrays; i++) { if (sweepElev != sweep.getElevation(i)) { // throw new DecodeException("ELEVATION ANGLE CHANGES WITHIN SWEEP - THIS DATA STRUCTURE IS NOT SUPPORTED\n"+ // "VALUES: "+sweepElev+" and "+sweep.getElevation(i)+" at i="+i, null); logger.fine("ELEVATION ANGLE CHANGES WITHIN SWEEP - THIS DATA STRUCTURE MAY NOT BE SUPPORTED\n"+ "VALUES: "+sweepElev+" and "+sweep.getElevation(i)+" at i="+i); sweepElev = sweep.getElevation(i); } } logger.info("sweepElev = "+sweepElev); sweepElev = meanElev; // TODO remove this workaround for bug in NCJ if (sweep.getsweepVar().getFullNameEscaped().equals("DigitalInstantaneousPrecipitationRate")) { sweepElev = 0; } // precalculate the range values in our 3-d Albers coordinate system (simple x-y-z in meters) // Adjust range_step for elevation angle // find actual distance on surface (instead of range from radar at specified elevation angle) range_step = range_step * Math.cos(Math.toRadians(sweepElev)); range[0] = (range_to_first_gate * Math.cos(Math.toRadians(sweepElev))) - range_step / 2.0; // find actual distance on surface (instead of range from radar at specified elevation angle) for (int i = 1; i < range.length; i++) { range[i] = (double) (range[i - 1] + range_step); } // adjust for first bin at 500m with gate size of 1000m if (range[0] < 0) { range[0] = 1; } logger.info(" elevation: " + sweepElev); logger.info(" number of range gates: " + sweep.getGateNumber()); logger.info(" range_step: " + range_step); logger.info(" range_to_first_gate: " + range_to_first_gate); logger.info(" RANGE[0]: " + range[0]); // Add distance filter to decoder - find starting and ending bin numbers int startbin; // Add distance filter to decoder - find starting and ending bin numbers int endbin; if (nxfilter != null) { startbin = (int) (((nxfilter.getMinDistance() * 1000.0 - range[0]) / range_step) + 0.01); endbin = (int) (((nxfilter.getMaxDistance() * 1000.0 - range[0]) / range_step) + 0.01); if (startbin < 0 || nxfilter.getMinDistance() == WCTFilter.NO_MIN_DISTANCE) { startbin = 0; } if (endbin > range.length || nxfilter.getMaxDistance() == WCTFilter.NO_MAX_DISTANCE) { endbin = range.length-1; } } else { startbin = 0; endbin = sweep.getGateNumber(); } // For each radial in the cut, read all of the bin data int value; double[] geoXY = new double[2]; double xpos; double ypos; double angle1 = 0.0; double angle2 = 0.0; double range_in_nmi; double height; double elevation_sin; double elevation_cos; double last_azimuth; double next_azimuth; double first_azimuth; double last_azimuth_diff; double next_azimuth_diff; double deg_used = 0.0f; double angle1_sin; double angle1_cos; double angle2_sin; double angle2_cos; double azimuth_sin; double azimuth_cos; boolean first = true; int startgate; float[] data; ArrayList<Coordinate> leftCoordinates = new ArrayList<Coordinate>(); ArrayList<Coordinate> rightCoordinates = new ArrayList<Coordinate>(); ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>(); // General estimate for azimuth difference // double hold_last_azimuth_diff = 1.0; // double hold_next_azimuth_diff = 1.0; double hold_last_azimuth_diff = sweep.getBeamWidth(); double hold_next_azimuth_diff = sweep.getBeamWidth(); double minValue = Double.POSITIVE_INFINITY; double maxValue = Double.NEGATIVE_INFINITY; /* data variable at radial level */ for (int i = 0; i < nrays; i++) { float azimuth = sweep.getAzimuth(i); float elevation = sweep.getElevation(i); data = sweep.readData(i); // System.out.print("azim["+i+"] = "+azimuth); // System.out.print(" elev["+i+"] = "+elevation); // logger.fine(" data["+i+"].length = "+data.length + " ::: sweep.getGateNumber()="+sweep.getGateNumber()); // System.exit(1); try { /* * Get the azimuth angle from the table created when the file was * * opened. A negative azimuth indicates the record did not contain * * digital radar data so it should be skipped. */ if (i == 0) { last_azimuth = azimuth - hold_last_azimuth_diff; } else { last_azimuth = sweep.getAzimuth(i-1); } if (i == nrays-1) { next_azimuth = azimuth + hold_next_azimuth_diff; } else { next_azimuth = sweep.getAzimuth(i+1); } // Break out of decoder if if (Double.isNaN(next_azimuth) || Double.isNaN(last_azimuth)) { continue; } /* * Determine the azimuth angles (in 0.5 degree increments) that * * define the bounds for the beam. */ // add 360 to both angles if we cross 0 if (azimuth < last_azimuth) { azimuth += 360; next_azimuth += 360; } // add 360 only to the next_azimuth angle if (next_azimuth < azimuth) { next_azimuth += 360; } last_azimuth_diff = Math.abs(azimuth - last_azimuth); next_azimuth_diff = Math.abs(next_azimuth - azimuth); if (last_azimuth_diff > 2*sweep.getBeamWidth()) { last_azimuth_diff = hold_last_azimuth_diff; } else { hold_last_azimuth_diff = last_azimuth_diff; } if (next_azimuth_diff > 2*sweep.getBeamWidth()) { next_azimuth_diff = hold_next_azimuth_diff; } else { hold_next_azimuth_diff = next_azimuth_diff; } angle1 = azimuth - last_azimuth_diff / 2.0; angle2 = azimuth + next_azimuth_diff / 2.0; if (angle1 % 90 == 0) { angle1 += 0.00001; } if (angle2 % 90 == 0) { angle2 += 0.00001; } // logger.fine("bin azimuth extent: "+angle1+" - "+angle2); angle1 = Math.toRadians(angle1); angle2 = Math.toRadians(angle2); angle1_sin = Math.sin(angle1); angle1_cos = Math.cos(angle1); angle2_sin = Math.sin(angle2); angle2_cos = Math.cos(angle2); azimuth_sin = Math.sin(Math.toRadians(azimuth)); azimuth_cos = Math.cos(Math.toRadians(azimuth)); boolean foundNonZero = false; elevation_sin = Math.sin(Math.toRadians(elevation)); elevation_cos = Math.cos(Math.toRadians(elevation)); //for (int j = 0; j < bins; j++) { for (int j = startbin; j < endbin; j++) { double dvalue; if (Float.isNaN(data[j])) { dvalue = Double.NaN; } else { dvalue = (double)data[j]; } int colorCode; if (useRFvalues && dvalue == RF_VALUE) { ; } else if (nxfilter != null && !nxfilter.accept(dvalue)) { dvalue = SNR_VALUE; } // colorCode = getColorCode(dvalue); // colorCode = (int)dvalue; // ============================= BEGIN POLYGON CREATION ===================================== // value of 0 == below signal to noise ratio // value of 1 == ambiguous //if (dvalue != SNR_VALUE) { // if (dvalue != Double.NaN) { if (! Double.isNaN(dvalue) && dvalue > -250.0) { //if (colorCode > 0) { // logger.fine(radialVar.getAttributes().g); // convert to knots if units are m/s // if (radialVar.getUnitsString().equals("m/s")) { if (dvalue == rangeFoldedValue) { // System.out.println(dvalue); dvalue = 800; } else if (units.equals("m/s")) { dvalue *= 1.9438445; } colorCode = getColorCode(dvalue); // System.out.println(colorCode+" ::: "+dvalue); if (dvalue != 800 && dvalue > maxValue) { maxValue = dvalue; } if (dvalue != 800 && dvalue < minValue) { minValue = dvalue; } if (attTypes == EXPORT_POINT_ATTRIBUTES) { xpos = (range[j]+range_step/2) * azimuth_sin; ypos = (range[j]+range_step/2) * azimuth_cos; geoXY = (nexradTransform.transform(new CoordinatePoint(xpos, ypos), null)).getCoordinates(); Point point = geoFactory.createPoint(new Coordinate(geoXY[0], geoXY[1])); // // Using Radar Beam Propagation Equation (Range-Height Equation) // range_in_nmi = (range[j]+range_step/2) * 0.000539957 / Math.cos(Math.toRadians(elevation)); // // get beam height at current range in nmi // height = ((Math.pow(range_in_nmi, 2) * Math.pow(elevation_cos, 2)) / 9168.66 + range_in_nmi * elevation_sin) * 6076.115; // // convert to meters // height *= 0.3048; height = NexradEquations.getRelativeBeamHeight(elevation_cos, elevation_sin, range[j]+range_step/2); // add height of radar site in meters double heightASL = height + header.getAlt()/3.28083989501312; if (nxfilter == null || //nxfilter.accept(poly, dvalue, azimuth, range[j], range[j] + range_step)) { nxfilter.accept(point, dvalue, azimuth, height)) { if (nxfilter != null) { point = (Point) (nxfilter.clipToExtentFilter(point)); } if (point != null) { if (dvalue < lastDecodedMinValue) { lastDecodedMinValue = dvalue; } if (dvalue > lastDecodedMaxValue) { lastDecodedMaxValue = dvalue; } // create the feature Feature feature = point_schema.create(new Object[]{ point, new Integer(s), dateFormat.format(sweep.getStartingTime()), new Float(elevation), new Float((double) dvalue), new Float(azimuth), new Float(range[j]+range_step/2), new Float(height), new Float(heightASL) }, new Integer(geoIndex++).toString()); // add to streaming processes for (int n=0; n<streamingProcessArray.length; n++) { streamingProcessArray[n].addFeature(feature); } } } } else { leftCoordinates.clear(); rightCoordinates.clear(); coordinates.clear(); double dwork; boolean inRun = false; int nextColorCode = colorCode; startgate = j; while (colorCode == nextColorCode && j < endbin) { if (indexedCoordArray[i][j] == null) { xpos = (range[j]) * angle1_sin; ypos = (range[j]) * angle1_cos; geoXY = (nexradTransform.transform(new CoordinatePoint(xpos, ypos), null)).getCoordinates(); // geoXY = (nexradTransform.transform(new DirectPosition2D(xpos, ypos), null)).getCoordinates(); indexedCoordArray[i][j] = new Coordinate(geoXY[0], geoXY[1]); } // leftCoordinates.add(new Coordinate(geoXY[0], geoXY[1])); if (! inRun) { leftCoordinates.add(indexedCoordArray[i][j]); } if (indexedCoordArray[i][j+1] == null) { xpos = (range[j] + range_step) * angle1_sin; ypos = (range[j] + range_step) * angle1_cos; geoXY = (nexradTransform.transform(new CoordinatePoint(xpos, ypos), null)).getCoordinates(); indexedCoordArray[i][j+1] = new Coordinate(geoXY[0], geoXY[1]); } // leftCoordinates.add(new Coordinate(geoXY[0], geoXY[1])); leftCoordinates.add(indexedCoordArray[i][j+1]); if (indexedCoordArray[i+1][j] == null) { xpos = (range[j]) * angle2_sin; ypos = (range[j]) * angle2_cos; geoXY = (nexradTransform.transform(new CoordinatePoint(xpos, ypos), null)).getCoordinates(); indexedCoordArray[i+1][j] = new Coordinate(geoXY[0], geoXY[1]); } // rightCoordinates.add(new Coordinate(geoXY[0], geoXY[1])); if (! inRun) { rightCoordinates.add(indexedCoordArray[i+1][j]); } if (indexedCoordArray[i+1][j+1] == null) { xpos = (range[j] + range_step) * angle2_sin; ypos = (range[j] + range_step) * angle2_cos; geoXY = (nexradTransform.transform(new CoordinatePoint(xpos, ypos), null)).getCoordinates(); indexedCoordArray[i+1][j+1] = new Coordinate(geoXY[0], geoXY[1]); } // rightCoordinates.add(new Coordinate(geoXY[0], geoXY[1])); rightCoordinates.add(indexedCoordArray[i+1][j+1]); if (classify) { if (j+1 == endbin) { break; } // Get color code for next bin dwork = (double)data[j+1]; if (units.equals("m/s")) { dwork *= 1.9438445; } nextColorCode = getColorCode(dwork); // System.out.println("classifying - start: "+dvalue+" colorCode="+colorCode+ // " nextVal="+dwork+" nextColorCode="+nextColorCode+" ("+i+","+j+")"); // logger.fine("classifying - start: "+dvalue+" colorCode="+colorCode+ // " nextVal="+dwork+" nextColorCode="+nextColorCode+" ("+i+","+j+")"); // If color code is same then continue polygon to next bin if (nextColorCode == colorCode) { // nextColorCode = colorCode+1; j++; inRun = true; } // Set bin value to classification value // if (colorCode == 0) { // colorCode++; // } try { if (colorCode >= 0 && colorCode < classificationValues.length) { dvalue = classificationValues[colorCode]; // dvalue = colorCode; } } catch (Exception e) { e.printStackTrace(); } } else { // Break out of loop if we are not classifying (could also set nextColorCode = colorCode + 1) break; } } // Add coordinates in this order: // 1 2 3 4 5 6 // 12 11 10 9 8 7 for (int n = 0; n < leftCoordinates.size(); n++) { // if (n < leftCoordinates.size()-1 && leftCoordinates.get(n).equals(leftCoordinates.get(n+1))) { coordinates.add(leftCoordinates.get(n)); // } } for (int n = rightCoordinates.size() - 1; n >= 0; n--) { // if (n > 0 && ! rightCoordinates.get(n).equals(rightCoordinates.get(n-1))) { coordinates.add(rightCoordinates.get(n)); // } } // Add first point to close polygon coordinates.add(leftCoordinates.get(0)); // Create polygon Coordinate[] coordArray = null; try { //Coordinate[] cArray = new Coordinate[coordinates.size()]; coordArray = new Coordinate[coordinates.size()]; LinearRing lr = geoFactory.createLinearRing((Coordinate[]) (coordinates.toArray(coordArray))); Polygon poly = JTSUtilities.makeGoodShapePolygon(geoFactory.createPolygon(lr, null)); // Polygon poly = JTSUtilities.makeGoodShapePolygon(geoFactory.createPolygon(lr, null)); //Geometry poly = JTSUtilities.makeGoodShapePolygon(geoFactory.createPolygon(lr, null)); // logger.fine(poly); leftCoordinates.clear(); rightCoordinates.clear(); coordinates.clear(); coordArray = null; // Using Radar Beam Propagation Equation (Range-Height Equation) range_in_nmi = range[startgate] * 0.000539957 / Math.cos(Math.toRadians(elevation)); // get beam height at current range in nmi height = ((Math.pow(range_in_nmi, 2) * Math.pow(elevation_cos, 2)) / 9168.66 + range_in_nmi * elevation_sin) * 6076.115; // convert to meters height *= 0.3048; // // add height of radar site in meters double heightASL = height + header.getAlt()/3.28083989501312; if (nxfilter == null || //nxfilter.accept(poly, dvalue, azimuth, range[j], range[j] + range_step)) { nxfilter.accept(poly, dvalue, azimuth, height)) { if (nxfilter != null) { poly = (Polygon) (nxfilter.clipToExtentFilter(poly)); } if (poly != null) { if (dvalue < lastDecodedMinValue) { lastDecodedMinValue = dvalue; } if (dvalue > lastDecodedMaxValue) { lastDecodedMaxValue = dvalue; } if (attTypes == DISPLAY_POLY_ATTRIBUTES) { // create the feature Feature feature = display_schema.create(new Object[]{ poly, new Float((double) dvalue), new Integer(colorCode) }, new Integer(geoIndex++).toString()); // add to streaming processes for (int n=0; n<streamingProcessArray.length; n++) { streamingProcessArray[n].addFeature(feature); } } else if (attTypes == EXPORT_POLY_ATTRIBUTES) { // create the feature Feature feature = poly_schema.create(new Object[]{ poly, new Integer(s), dateFormat.format(sweep.getStartingTime()), new Float(elevation), new Float((double) dvalue), // new Integer(colorCode), new Float(azimuth), new Float(range[startgate]), // start range new Float(range[j + 1]), // end range new Float(height), new Float(heightASL) }, new Integer(geoIndex++).toString()); // add to streaming processes for (int n=0; n<streamingProcessArray.length; n++) { streamingProcessArray[n].addFeature(feature); } } } } //polyVector[colorCode].addElement((Object) poly); } catch (Exception e) { e.printStackTrace(); logger.fine("================================================================"); for (int ii = 0; ii < coordArray.length; ii++) { logger.fine(coordArray[ii].toString()); } logger.fine("================================================================"); return; } } } } // Decode progress // -------------- for (int n = 0; n < listeners.size(); n++) { // event.setProgress((int) (((((double) i) / nrays) * 100.0) * 1/(double)(endSweep+1-startSweep)) + (int)(s*100.0/(double)(endSweep+1-startSweep))); // event.setProgress((int) (((((double) i) / nrays) * 100.0) * s/(double)(endSweep+1-startSweep)) ); int percent = (int)Math.round(100*WCTUtils.progressCalculator(new int[] { s, i }, new int[] { endSweep+1-startSweep, nrays })); event.setProgress(percent); listeners.get(n).decodeProgress(event); // System.out.println(startSweep+" / "+endSweep+" "+event.getProgress()); } if (WCTUtils.getSharedCancelTask().isCancel()) { s = endSweep+1; i = nrays+1; } } catch (Exception e) { System.err.println("LEVEL2 DECODE EXCEPTION: RADIAL NUMBER=" + i + " AZIMUTH=" + azimuth); e.printStackTrace(); } } header.setMinValue(minValue); header.setMaxValue(maxValue); } if (autoClose) { for (int i=0; i<streamingProcessArray.length; i++) { streamingProcessArray[i].close(); } } } catch (Exception e) { e.printStackTrace(); throw new DecodeException(e.toString(), null); } finally { // End of decode // -------------- for (int i = 0; i < listeners.size(); i++) { event.setProgress(0); listeners.get(i).decodeEnded(event); } } } public FeatureType[] getFeatureTypes() { return new FeatureType[]{ schema }; } public java.awt.geom.Rectangle2D.Double getLastDecodedExtent() { // TODO Auto-generated method stub return null; } public FeatureCollection getFeatures() { return fc; } public double getLastDecodedCutElevation() { return lastDecodedElevationAngle; } public String getLastDecodedMoment() { return radialVar.getName().toUpperCase(); } /** * Adds a DataDecodeListener to the list. * * @param listener The feature to be added to the DataDecodeListener attribute */ public void addDataDecodeListener(DataDecodeListener listener) { if (!listeners.contains(listener)) { listeners.add(listener); } } /** * Removes a DataDecodeListener from the list. * * @param listener DataDecodeListener to remove. */ public void removeDataDecodeListener(DataDecodeListener listener) { listeners.remove(listener); } public String[] getSupplementalDataArray() throws IOException { // TODO Auto-generated method stub return null; } /** * Gets the classification value for the raw data based on Level-III classification schemes. * * @param dvalue Description of the Parameter * @return The colorCode value */ private int getColorCode(double dvalue) { boolean useRfValues = true; // return (int)dvalue; // logger.fine(dvalue); if (dvalue < -900.0 || Double.isNaN(dvalue)) { return -1; //return 0; } int colorCode = 0; if (radialVar.getName().contains("Reflectivity")) { if (header.getVCP() == 31 || header.getVCP() == 32) { if (dvalue > 28) { colorCode = 15; } else { colorCode = (int) ((dvalue + 28) / 4.0) + 1; } } else { if (dvalue > 75) { colorCode = 15; } else if (dvalue < 0) { colorCode = 0; } else { colorCode = (int) (dvalue / 5.0) + 1; } } } else if (radialVar.getName().contains("Velocity")) { if (dvalue == 100) { if (useRfValues) { colorCode = 16; } else { colorCode = 0; } } else if (dvalue < -60) { colorCode = 1; } else if (dvalue > 60) { colorCode = 15; } else if (dvalue <= 0) { colorCode = (int) ((dvalue + 60) / 10.0) + 2; } else { colorCode = (int) ((dvalue + 60) / 10.0) + 3; } } // Spectrum width else { if (dvalue == 100) { if (useRfValues) { colorCode = 7; } else { colorCode = 0; } } else if (dvalue > 30) { colorCode = 6; } else { colorCode = (int) (dvalue / 6.0) + 1; } } return colorCode; } private void setUpClassifications() { boolean classify = (Boolean)hintsMap.get("classify"); String[] dataThresholdArray = null; if (radialVar.getName().contains("Reflectivity")) { if (classify && (header.getVCP() == 31 || header.getVCP() == 32)) { dataThresholdArray = new String[]{ "SNR", "<= - 28", "- 24", "- 20", "- 16", "- 12", "- 8", "- 4", " 0", "+ 4", "+ 8", "+ 12", "+ 16", "+ 20", "+ 24", ">= + 28" }; this.classificationValues = new double[] { -200.0, -24.0, -20.0, -16.0, -12.0, -8.0, -4.0, 0.0, 4.0, 8.0, 12.0, 16.0, 20.0, 24.0, 28.0, 32.0 }; } else if (classify) { dataThresholdArray = new String[]{ "SNR", "<= 0", "+ 5", "+ 10", "+ 15", "+ 20", "+ 25", "+ 30", "+ 35", "+ 40", "+ 45", "+ 50", "+ 55", "+ 60", "+ 65", "+ 70", ">= + 75" }; this.classificationValues = new double[16]; for (int i = 0; i < 16; i++) { classificationValues[i] = 5.0 * i; } } else { dataThresholdArray = new String[]{ "SNR", "<= - 20", "- 15", "- 10", "- 5", " 0", "+ 5", "+ 10", "+ 15", "+ 20", "+ 25", "+ 30", "+ 35", "+ 40", "+ 45", "+ 50", "+ 55", "+ 60", "+ 65", "+ 70", ">= + 75" }; this.classificationValues = new double[16]; for (int i = 0; i < 16; i++) { classificationValues[i] = 5.0 * i; } } } else if (radialVar.getName().contains("Velocity")) { logger.fine("FOUND VELOCITY ==========="); dataThresholdArray = new String[]{ "SNR", "< - 60", "- 60", "- 50", "- 40", "- 30", "- 20", "- 10", " 0", "+ 10", "+ 20", "+ 30", "+ 40", "+ 50", "+ 60", "> + 60", // "SNR", "< - 50", "- 50", "- 40", "- 30", "- 20", "- 10", " 0", "+ 10", // "+ 20", "+ 30", "+ 40", "+ 50", "> 50", "RF" }; this.classificationValues = new double[] { -200.0, -60.0, -50.0, -40.0, -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 200.0 }; } else if (radialVar.getName().contains("SpectrumWidth")) { logger.fine("FOUND SPECTRUM WIDTH ==========="); dataThresholdArray = new String[]{ // "SNR", "0", "6", "12", "18", "24", "30", "RF", "", "", "", "", "", "" // "SNR", "0", "6", "12", "18", "24", "30", "", "", "", "", "", "", "" "SNR", "0", "6", "12", "18", "24", "30", "" }; this.classificationValues = new double[] { // -200.0, 0.0, 6.0, 12.0, 18.0, 24.0, 30.0, 200.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 -200.0, 0.0, 6.0, 12.0, 18.0, 24.0, 30.0, 200.0 }; // classificationValues = new double[16]; // for (int i = 0; i < 7; i++) { // classificationValues[i] = (6.0 * i) - 6.0; // } // classificationValues[7] = -200.0; // for (int i = 8; i < 16; i++) { // classificationValues[i] = 0.0; // } } else { String[] categories = new String[16]; for (int n=0; n<categories.length; n++) { categories[n] = String.valueOf( lastDecodedMinValue + n*(lastDecodedMaxValue - lastDecodedMinValue)/categories.length ); } dataThresholdArray = categories; } if (classify) { for (int n=0; n<dataThresholdArray.length; n++) { dataThresholdArray[n] = dataThresholdArray[n]+" ("+n+")"; } } header.setDataThresholdStringArray(dataThresholdArray); } }
[ "gsenia@apache.org" ]
gsenia@apache.org
ac299469d92fd9955fe080f7256c558350658d68
5cb49d3b77daeb7165038cf710534fcf628dd6de
/PODProject/iptms-UIportal/src/main/java/com/cts/portal/model/LoginData.java
cd48044bf47c33fb14253db87e8c78953e765caf
[]
no_license
Vineet2408/IPTMS
996a3d67361565be6ec0a0ec8fdb2b4bee17fe90
d9c1502905db2615a6a7fed67e11191ac84502d2
refs/heads/master
2023-03-23T23:37:41.822933
2021-03-15T09:53:33
2021-03-15T09:53:33
347,914,883
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package com.cts.portal.model; public class LoginData { static UserData userData; public static UserData getUserData() { if(userData==null) { userData=new UserData(); } return userData; } public static void setUserData(UserData userData) { LoginData.userData = userData; } }
[ "vineetd84@gmail.com" ]
vineetd84@gmail.com
f851392694fdc52e07e0b97bbdd9eb27c98e20c8
4399729983ec5a8987e059e3b99e55351189fc7c
/app/src/main/java/com/wmm1995/smartbutler/utils/L.java
bcb7226a372c99a1c759ee77b603a3d544f6cfd0
[ "Apache-2.0" ]
permissive
wmm387/SmartButler-study-
26d98fef6d7e8c02721d19a3e24e70d8fc2c34b4
6fc9c45b8a34f2cf6d02861036c8c2d872004ce1
refs/heads/master
2021-01-20T03:41:49.345797
2017-02-16T06:53:52
2017-02-16T06:53:52
81,546,339
0
0
null
null
null
null
UTF-8
Java
false
false
715
java
package com.wmm1995.smartbutler.utils; import android.util.Log; /** * Created by Administrator on 2017/2/10. */ public class L { //开关 public static final boolean DEBUG = true; //TAG public static final String TAG = "Smartbutler"; //5个等级 D I W E public static void d(String text) { if (DEBUG) { Log.d(TAG, text); } } public static void i(String text) { if (DEBUG) { Log.i(TAG, text); } } public static void w(String text) { if (DEBUG) { Log.w(TAG, text); } } public static void e(String text) { if (DEBUG) { Log.e(TAG, text); } } }
[ "wangyuanwmm@163.com" ]
wangyuanwmm@163.com
cc257328aa9d1a3392c3398a0159358d4c2d461f
987066c1967db748921c47c091e0c6fae6188c2c
/src/main/java/org/n52/gfz/riesgos/cmdexecution/package-info.java
6a93b7461fdfc7d9b64ce3be9df648b5662fdda8
[ "Apache-2.0" ]
permissive
riesgos/gfz-command-line-tool-repository
df2f03116e97948c4db5a707144aa4a7d6191b07
09ee6112a6feaee609e461325f90aae26257010f
refs/heads/master
2023-06-22T00:59:42.050744
2022-09-08T11:18:17
2022-09-08T11:18:17
176,963,979
0
1
Apache-2.0
2023-06-14T22:24:43
2019-03-21T14:39:05
Java
UTF-8
Java
false
false
764
java
/* * Copyright (C) 2019 GFZ German Research Centre for Geosciences * * 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://apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ /** * Classes and sub packages for dealing with the execution of * command line processes. */ package org.n52.gfz.riesgos.cmdexecution;
[ "matthias.ruester@gfz-potsdam.de" ]
matthias.ruester@gfz-potsdam.de
aef23e7cde9432c631ca871604925bf12de422e5
ea42eff9b9bf83b1e32b9021dc2472a9b8d8d55f
/jorchestra-core/src/main/java/br/com/jorchestra/controller/JOrchestraWebSocketTemplate.java
fc4fc7f1c353b69f5178eab83339f4caaa2dd464
[]
no_license
JimSP/jorchestra
f13eff1c46d33efc87630e7ce498228570517857
c001ae398b042ac5ed66ef1dc0b7aeaccf316b9f
refs/heads/master
2021-05-14T18:21:55.650759
2018-04-21T03:59:06
2018-04-21T03:59:06
116,070,223
2
0
null
null
null
null
UTF-8
Java
false
false
4,861
java
package br.com.jorchestra.controller; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.TextWebSocketHandler; import com.hazelcast.core.ITopic; import br.com.jorchestra.canonical.JOrchestraHandle; import br.com.jorchestra.canonical.JOrchestraStateCall; import br.com.jorchestra.configuration.JOrchestraConfigurationProperties; public abstract class JOrchestraWebSocketTemplate extends TextWebSocketHandler { private static final Logger LOGGER = LoggerFactory.getLogger(JOrchestraWebSocketTemplate.class); protected final JOrchestraHandle jOrchestraHandle; protected final Map<String, WebSocketSession> webSocketSessionMap = Collections.synchronizedMap(new HashMap<>()); protected final Map<String, List<String>> jOrchestraSessionMap = Collections.synchronizedMap(new HashMap<>()); protected final ITopic<JOrchestraStateCall> jOrchestraStateCallTopic; protected final JOrchestraConfigurationProperties jOrchestraConfigurationProperties; protected JOrchestraWebSocketTemplate(final JOrchestraHandle jOrchestraHandle, final ITopic<JOrchestraStateCall> jOrchestraStateCallTopic, final JOrchestraConfigurationProperties jOrchestraConfigurationProperties) { super(); this.jOrchestraHandle = jOrchestraHandle; this.jOrchestraStateCallTopic = jOrchestraStateCallTopic; this.jOrchestraConfigurationProperties = jOrchestraConfigurationProperties; } @Override public boolean supportsPartialMessages() { return true; } @Override public void afterConnectionEstablished(final WebSocketSession webSocketSession) throws Exception { final JOrchestraStateCall jOrchestraStateCall = JOrchestraStateCall.createJOrchestraStateCall_OPEN( jOrchestraConfigurationProperties.getClusterName(), jOrchestraConfigurationProperties.getName(), webSocketSession.getUri().getPath(), webSocketSession.getId()); LOGGER.debug("m=afterConnectionEstablished, jOrchestraStateCall=" + jOrchestraStateCall); webSocketSessionMap.put(webSocketSession.getId(), webSocketSession); jOrchestraSessionMap.put(webSocketSession.getId(), Collections.synchronizedList(new ArrayList<>())); jOrchestraStateCallTopic.publish(jOrchestraStateCall); } @Override public void handleTextMessage(final WebSocketSession webSocketSession, final TextMessage textMessage) throws Exception { final String payload = textMessage.getPayload(); final JOrchestraStateCall jOrchestraStateCallWaiting = JOrchestraStateCall.createJOrchestraStateCall_WAITING( jOrchestraConfigurationProperties.getClusterName(), jOrchestraConfigurationProperties.getName(), webSocketSession.getUri().getPath(), webSocketSession.getId(), payload); LOGGER.debug("m=handleTextMessage, jOrchestraStateCall=" + jOrchestraStateCallWaiting + ", payload=" + textMessage.getPayload()); jOrchestraSessionMap.get(webSocketSession.getId()).add(jOrchestraStateCallWaiting.getId()); jOrchestraStateCallTopic.publish(jOrchestraStateCallWaiting); onMessage(webSocketSession, textMessage, jOrchestraStateCallWaiting); } @Override public void afterConnectionClosed(final WebSocketSession webSocketSession, final CloseStatus closeStatus) throws Exception { final JOrchestraStateCall jOrchestraStateCallClose = JOrchestraStateCall.createJOrchestraStateCall_CLOSE( jOrchestraConfigurationProperties.getClusterName(), jOrchestraConfigurationProperties.getName(), webSocketSession.getUri().getPath(), webSocketSession.getId()); LOGGER.debug("m=afterConnectionClosed, jOrchestraStateCall=" + jOrchestraStateCallClose + ", closeStatus=" + closeStatus); jOrchestraSessionMap.get(webSocketSession.getId()).clear(); jOrchestraSessionMap.remove(webSocketSession.getId()); webSocketSessionMap.remove(webSocketSession.getId()); jOrchestraStateCallTopic.publish(jOrchestraStateCallClose); } @Override public void handleTransportError(final WebSocketSession webSocketSession, final Throwable e) throws Exception { final JOrchestraStateCall jOrchestraStateCall = JOrchestraStateCall.createJOrchestraStateCall_ERROR( webSocketSession.getId(), jOrchestraConfigurationProperties.getClusterName(), jOrchestraConfigurationProperties.getName(), webSocketSession.getUri().getPath()); LOGGER.error("m=handleTransportError, jOrchestraStateCall=" + jOrchestraStateCall, e); jOrchestraStateCallTopic.publish(jOrchestraStateCall); } protected void onMessage(final WebSocketSession webSocketSession, final TextMessage textMessage, final JOrchestraStateCall jOrchestraStateCallWaiting) throws Exception { } }
[ "alexandre.msl@gmail.com" ]
alexandre.msl@gmail.com
e6aeb3e307766ddb2df401bf66c8ad927a9f93ea
512d7058882649b5762b23579a2a78cbf3e282aa
/src/main/java/com/bookMyDoctor/model/bindingModel/EditDoctorPictureModel.java
4b19ce80ff7759b622f20e19ca5a1e0f2e487e52
[]
no_license
meet63380/BookMyDoctor
bc77448c820705c5111e826ea9d3a890b6e3623f
385376085e5f55c8ebb3d0a113ddaedc43861a02
refs/heads/master
2023-08-11T18:36:52.513704
2021-09-14T06:17:55
2021-09-14T06:17:55
405,843,370
0
1
null
2021-09-13T12:10:39
2021-09-13T05:25:04
Java
UTF-8
Java
false
false
426
java
package com.bookMyDoctor.model.bindingModel; public class EditDoctorPictureModel { private long id; private String picturePath; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getPicturePath() { return picturePath; } public void setPicturePath(String picturePath) { this.picturePath = picturePath; } }
[ "shah.meet6338@gmail.com" ]
shah.meet6338@gmail.com
db6119a1e19ca5c7f98d7fe2b8d42ef2b10617dc
2f255d2fab78076fe5791401f3c061b61bcba22a
/PhoneListen-webapp/src/com/farsunset/pmmp/dao/RecordDaoImpl.java
05f7c40296bccd34b25354f32e612dc3af31407f
[]
no_license
comsince/IntegrateShareAndroid
1f109c11951ba3e18cc6f9e7bec238488a2655b9
18077da28edddfa6440bd25193294536a4f4bffc
refs/heads/master
2021-01-15T21:44:46.799503
2019-12-03T08:05:27
2019-12-03T08:05:27
9,512,149
14
9
null
null
null
null
UTF-8
Java
false
false
2,102
java
package com.farsunset.pmmp.dao; import java.util.List; import org.hibernate.Criteria; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import com.farsunset.framework.hibernate.HibernateBaseDao; import com.farsunset.framework.tools.StringUtil; import com.farsunset.framework.web.Page; import com.farsunset.pmmp.model.Record; public class RecordDaoImpl extends HibernateBaseDao<Record>{ public Page queryRecordList(Record record, Page page) { Criteria criteria = mapingParam( record); criteria.setFirstResult((page.getCurrentPage() - 1) * page.size); criteria.setMaxResults(page.size); criteria.addOrder(Order.desc("endTime")); page.setDataList(criteria.list()); return page; } public int queryRecordAmount(Record model) { Criteria criteria = mapingParam( model); return Integer.valueOf(criteria.setProjection(Projections.rowCount()).uniqueResult().toString()); } private Criteria mapingParam(Record model) { Criteria criteria = getSession().createCriteria(Record.class); if (!StringUtil.isEmpty(model.getType())) { criteria.add(Restrictions.eq("type", model.getType() )); } if (!StringUtil.isEmpty(model.getStatus())) { criteria.add(Restrictions.eq("status", model.getStatus() )); } if (!StringUtil.isEmpty(model.getMenumber())) { criteria.add(Restrictions.eq("menumber", model.getMenumber() )); } if (!StringUtil.isEmpty(model.getHenumber())) { criteria.add(Restrictions.eq("henumber", model.getHenumber() )); } return criteria; } public List<Record> queryRecordList(Record record) { Criteria criteria = mapingParam( record); criteria.addOrder(Order.desc("endTime")); return criteria.list(); } public Record queryByName(String name) { Criteria c = getSession().createCriteria(Record.class); c.add(Restrictions.eq("hename", name)); return (Record) c.uniqueResult(); } }
[ "ljlong_2008@126.com" ]
ljlong_2008@126.com
08de606b5991787ed1d888653d36d6c279a9237d
44a074f0b0d56d017f83a75984e4ce0002b0d82a
/src/refactoring_gilbut/chap02/after_break/FindIntBreak.java
a9ffa2ddd5599a12b6f3aaeb817042ebfb2a8d1e
[]
no_license
mia94/refactoring_gilbut
0f777fbcd35e3b3b8b9b0cb7da859ddaf2869b05
93b5bceb1d325a6e2d2b531226aa7a5be777dc8b
refs/heads/master
2020-04-18T01:54:07.910820
2019-02-08T07:20:39
2019-02-08T07:20:39
167,138,832
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package refactoring_gilbut.chap02.after_break; public class FindIntBreak { public static boolean find(int[] data, int target) { boolean found = false; for(int i=0;i<data.length ; i++) { if (data[i] == target) { found = true; break; } } return found; } }
[ "mia_3@hanmail.net" ]
mia_3@hanmail.net
3f1533136789e6d1bc77a12ef5c6929e60c5e0ee
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_1/src/b/i/d/c/Calc_1_1_18326.java
9ad048981f7ab7b0c35f77884cca639170b9db7d
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package b.i.d.c; public class Calc_1_1_18326 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
[ "christian.halstrick@sap.com" ]
christian.halstrick@sap.com
3fa497cd96fd2d5ba90b6b8894a810e864c50d40
2787d314e41ddc4f5a4ac3cd29a5e9b9696358f5
/Strategy/SMC_RAN/src/ProcessQuery.java
f1a8a70fcbd9bc0c7328d732faf6280b33fe8a95
[]
no_license
NikhilAnand95/HStrat
ac140d1aa9f217d13a06b1e5ff0049042196b22d
9c8f3440113bc3c436bde2acd546daf73eeb5793
refs/heads/master
2020-04-08T04:34:06.234125
2018-11-16T07:13:17
2018-11-16T07:13:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,778
java
import java.util.StringTokenizer; public class ProcessQuery { private int[] query_data = new int [15]; private String query ="(TRUE) Untill(<=9) (numInfected(2)>=420)"; //"(isSuscepted(6445)) Untill(<=20) (numInfected(4)>=270)"; /*parse the whole query */ public void parse_sub_query(String query2, int portion) { if(query2.contains("is")) { if(portion == 1) query_data[4] = 0; else query_data[9] = 0; if(query2.contains("isSuscepted")) { if(portion == 1) { query_data[6] = 0; query_data[7] = 0; query_data[8] = 0; } else { query_data[11] = 0; query_data[12] = 0; query_data[13] = 0; } query2 = query2.replace("isSuscepted", ""); } else if(query2.contains("isInfected")) { if(portion == 1) { query_data[6] = 0; query_data[7] = 1; } else { query_data[11] = 0; query_data[12] = 1; } query2 = query2.replace("isInfected", ""); } else if(query2.contains("isRecovered")) { if(portion == 1) { query_data[6] = 0; query_data[7] = 2; } else { query_data[11] = 0; query_data[12] = 2; } query2 = query2.replace("isRecovered", ""); } else { System.out.println("\nQuery Is Not in the Expected Format. It must contain (is or num) prefix"); } parse_agent_data(query2, portion); } else if(query2.contains("num")) { if(portion == 1) query_data[4] = 1; else query_data[9] = 1; if(query2.contains("numSuscepted")) { if(portion == 1) { query_data[6] = 1; } else { query_data[11] = 1; } query2 = query2.replace("numSuscepted", ""); } else if(query2.contains("numInfected")) { if(portion == 1) { query_data[6] = 2; } else { query_data[11] = 2; } query2 = query2.replace("numInfected", ""); } else if(query2.contains("numRecovered")) { if(portion == 1) { query_data[6] = 3; } else { query_data[11] = 3; } query2 = query2.replace("numRecovered", ""); } else { System.out.println("\nQuery Is Not in the Expected Format. It must contain (is or num) prefix"); } parse_city_data(query2, portion); } else { System.out.println("\nQuery Is Not in the Expected Format. It must contain (is or num) prefix"); } } public void parse_agent_data(String query2, int portion) { System.out.println("1. Portion " + portion +" : "+ query2); query2 = query2.replace("(",""); query2 = query2.replace(")",""); query2 = query2.replace(" ",""); if(portion == 1) { query_data[5] = Integer.parseInt(query2); System.out.println("2. Portion " + portion +" : "+ query_data[5]); } else { query_data[10] = Integer.parseInt(query2); System.out.println("2. Portion " + portion +" : "+ query_data[10]); } } public void parse_city_data(String query2, int portion) { System.out.println("3. Portion " + portion +" : "+ query2); query2 = query2.replace("(", ""); query2 = query2.replace(")", ""); System.out.println("4. Portion " + portion +" : "+ query2); String[] split_second; if(query2.contains("<=")) { split_second = query2.split("<=", 2); if(portion == 1) query_data[8] = 1; else query_data[13] = 1; } else { split_second = query2.split(">=", 2); if(portion == 1) query_data[8] = 2; else query_data[13] = 2; } split_second[0] = split_second[0].replace(" ", ""); split_second[1] = split_second[1].replace(" ", ""); System.out.println("Portion " + portion +" : "+ split_second[0] + " " + split_second[1]); if(portion == 1) { query_data[5] = Integer.parseInt(split_second[0]); query_data[7] = Integer.parseInt(split_second[1]); System.out.println("7. Portion " + portion +" : "+ query_data[5]+ " " + query_data[7]); } else { query_data[10] = Integer.parseInt(split_second[0]); query_data[12] = Integer.parseInt(split_second[1]); System.out.println("12.Portion " + portion +" : "+ query_data[10]+ " " + query_data[12]); } //System.out.println("Portion " + portion +" : "+ split_second[0] + " " + split_second[1]); } /*parse the sub part of the query */ public void parse_data(String substr) { String sub_first = ""; String sub_second = ""; StringTokenizer st2 = new StringTokenizer(substr, "<="); sub_first = st2.nextToken(); sub_second = st2.nextToken(); System.out.println(sub_first + " " + sub_second); } /*Reads query */ public int read_query() { String query2 = query; String query_first = ""; String query_second = ""; String dup_query = query2; if(query2.contains("Untill")) { query_data[0] = 0; dup_query = dup_query.replace("(<=", ""); String[] split_query = dup_query.split("Untill",2); query_first = new String(split_query[0]); query_second = new String(split_query[1]); if(query_second.contains(")")) { String[] split_second = query_second.split(" ", 2); split_second[0] = split_second[0].replace(")",""); query_data[1] = Integer.parseInt(split_second[0]); System.out.println(split_second[0] + " -- " + query_data[1]+ " --- " + split_second[1]); query_second = split_second[1]; } if(query_first.contains("TRUE")) { query_data[2] = 1; } else { System.out.println("5: " + query_first); parse_sub_query(query_first, 1); } if(query_second.contains("TRUE")) { query_data[3] = 1; } else { System.out.println("6: " + query_second); parse_sub_query(query_second, 2); } } else if(query2.contains("Next") ) { query_data[0] = 1; query_data[1] = 1; } else { System.out.println("\nQuery Is Not in the Expected Format. It must contain (Untill or Next) Operator"); } for(int i=0; i<=13; i++) System.out.println(i + " :" + query_data[i]); return query_data[1]; //query_data[5] = agent; //query_data[10] = city; } public void evaluate_sub_query(int index, int [] curr_state_people, int [] num_suscepted_city, int [] num_infected_city, int [] num_recovered_city ) { int dup_infected_city[] = new int[50]; if(query_data[index+2] == 2) { int id = (query_data[index+1]); dup_infected_city[(id)] = num_infected_city[(id)] + num_recovered_city[(id)]; System.out.print("\n duplicate value : " + dup_infected_city[(id)] + " id : " + id); } switch(query_data[index+2]) { case 0 :check_sub_query(index, curr_state_people); break; case 1 :check_sub_query(index, num_suscepted_city); break; case 2 :check_sub_query(index, dup_infected_city); break; case 3 :check_sub_query(index, num_recovered_city); break; } } public int check_sub_query_satisfied(int op, int id, int val, int [] array) { switch(op) { case 0 : if(array[id] == val) return 1; else return 0; case 1 : if(array[id] <= val) return 1; else return 0; case 2 : if(array[id] >= val) return 1; else return 0; default : return 0; } } public void check_sub_query(int index, int [] array) { int isValid = check_sub_query_satisfied(query_data[index+4], query_data[index+1], query_data[index+3], array); if(index == 4) query_data[2] = isValid; else query_data[3] = isValid; } public void evaluate_query(int [] curr_state_people, int [] num_suscepted_city, int [] num_infected_city, int [] num_recovered_city) { evaluate_sub_query(4, curr_state_people, num_suscepted_city, num_infected_city, num_recovered_city); evaluate_sub_query(9, curr_state_people, num_suscepted_city, num_infected_city, num_recovered_city); } public boolean check_query_satisfied(int [] curr_state_people, int [] num_suscepted_city, int [] num_infected_city, int [] num_recovered_city) { evaluate_query(curr_state_people, num_suscepted_city, num_infected_city, num_recovered_city); if((query_data[2]==1) &&(query_data[3]==1)) return true; else return false; } /*public static void main(String args[]) { String query = "(isInfected(10)) Untill(<=10) (numInfected(15)>=30)"; ProcessQuery pq = new ProcessQuery(); pq.read_query(query); int[] curr_state_people; int[] num_suscepted_city; int[] num_infected_city; int[] num_recovered_city; if(pq.check_query_satisfied(curr_state_people, num_suscepted_city, num_infected_city, num_recovered_city)) System.out.println("Yes Satisfied"); else System.out.println("Not Satisfied"); } */ }
[ "cs16resch11005@iith.ac.in" ]
cs16resch11005@iith.ac.in
1283623fb72764c20e4535e449a171f5df1d120f
fc4701591408d5f1b059931c052fcab1b0a3c855
/3.JavaMultithreading/src/com/javarush/task/task22/task2207/Solution.java
a4c09c942c6ce534a56038563fda18bfbf357163
[]
no_license
VictorLeonidovich/JavaRushCourses_professionalLevel
483779d9d8f40c1f32023deb146cceda676494d2
b2685930ffac81499129a935dbcfb0ecf37321ce
refs/heads/master
2021-08-19T08:16:02.643180
2017-11-25T12:05:57
2017-11-25T12:05:57
84,752,119
0
0
null
null
null
null
UTF-8
Java
false
false
4,108
java
package com.javarush.task.task22.task2207; import java.io.*; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Scanner; /* Обращенные слова В методе main с консоли считать имя файла, который содержит слова, разделенные пробелами. Найти в тексте все пары слов, которые являются обращением друг друга. Добавить их в result. Использовать StringBuilder. Пример содержимого файла рот тор торт о о тот тот тот Вывод: рот тор о о тот тот Требования: 1. Метод main должен считывать имя файла с клавиатуры. 2. В методе main должен быть использован StringBuilder 3. Список result должен быть заполнен корректными парами согласно условию задачи. 4. В классе Solution должен содержаться вложенный класс Pair. 5. В классе Pair должен быть объявлен конструктор без параметров (или конструктор по умолчанию). */ public class Solution { public static List<Pair> result = new LinkedList<>(); public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); BufferedReader reader1 = new BufferedReader(new FileReader(reader.readLine())); //Scanner scanner = new Scanner(new File(reader.readLine())); String line; StringBuilder stringBuilder = new StringBuilder(); while((line = reader1.readLine()) != null){ stringBuilder.append(line).append(" "); } reader1.close(); reader.close(); //System.out.println(stringBuilder.toString()); String[] splittedLine = stringBuilder.toString().trim().split(" "); for (int i = 0; i < splittedLine.length - 1; i++) { for (int j = i + 1; j < splittedLine.length; j++) { String splittedLineReverse = new StringBuilder(splittedLine[j]).reverse().toString(); //System.out.println(splittedLine[i] + " -- " + splittedLineReverse); if (splittedLine[i].equals(splittedLineReverse)) { Pair pair = new Pair(); pair.first = splittedLine[i]; pair.second = splittedLine[j]; int count = 0; for (Pair rez : result){ if (pair.equals(rez)){count = 1;} } if (count == 0){result.add(pair);} //System.out.println("add: " + pair); } } } for (Pair rez : result){ System.out.println(rez.first + " " + rez.second); } } public static class Pair { String first; String second; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Pair pair = (Pair) o; if (first != null ? !first.equals(pair.first) : pair.first != null) return false; return second != null ? second.equals(pair.second) : pair.second == null; } @Override public int hashCode() { int result = first != null ? first.hashCode() : 0; result = 31 * result + (second != null ? second.hashCode() : 0); return result; } @Override public String toString() { return first == null && second == null ? "" : first == null && second != null ? second : second == null && first != null ? first : first.compareTo(second) < 0 ? first + " " + second : second + " " + first; } } }
[ "k-v-l@tut.by" ]
k-v-l@tut.by
bfa82450d77f344e38ae74659ea0ecb174dd60e1
23fb8302e11d87c6d125646985c7e8d73802ac2b
/DrinkApp/app/src/main/java/com/example/shailendra/drinkapp/Adapter/CartAdapter.java
adbebe0b6254ccd74112ca12b496201e08905cad
[]
no_license
shailendraweb8/Drink-Shop-Android-App-with-Admin
e85aca6490718bc6ea1cbc19e4b0d558797a744c
cf553a1828a781728a736b2fe7b2bd08de9ea044
refs/heads/master
2021-06-15T13:57:33.360935
2021-03-08T05:22:23
2021-03-08T05:22:23
164,019,714
1
0
null
null
null
null
UTF-8
Java
false
false
4,409
java
package com.example.shailendra.drinkapp.Adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton; import com.example.shailendra.drinkapp.Database.ModelDB.Cart; import com.example.shailendra.drinkapp.Database.ModelDB.Favorite; import com.example.shailendra.drinkapp.R; import com.example.shailendra.drinkapp.Utils.Common; import com.squareup.picasso.Picasso; import java.util.List; import static com.example.shailendra.drinkapp.R.id.parent; /** * Created by shailendra on 6/16/2018. */ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.CartViewHolder>{ Context context; List<Cart> cartList; public CartAdapter(Context context, List<Cart> cartList) { this.context = context; this.cartList = cartList; } @NonNull @Override public CartViewHolder onCreateViewHolder(ViewGroup parent, int i) { View itemview = LayoutInflater.from(context).inflate(R.layout.cart_item_layout ,parent , false); return new CartViewHolder(itemview); } @Override public void onBindViewHolder(final CartViewHolder holder, final int position) { Picasso.with(context) .load(cartList.get(position).link) .into(holder.img_product); holder.txt_amount.setNumber(String.valueOf(cartList.get(position).amount)); holder.txt_price.setText(new StringBuilder("₹").append(cartList.get(position).price)); holder.txt_product_name.setText(new StringBuilder(cartList.get(position).name) .append(" x") .append(cartList.get(position).amount) .append(cartList.get(position).size == 0 ? " Size M":"Size L")); holder.txt_sugar_ice.setText(new StringBuilder("Sugar: ") .append(cartList.get(position).sugar).append("%").append("\n") .append("Ice: ").append(cartList.get(position).ice) .append("%").toString()); //Get Price of one Cup final double priceOneCup = cartList.get(position).price / cartList.get(position).amount; //Auto Save item when user change amount holder.txt_amount.setOnValueChangeListener(new ElegantNumberButton.OnValueChangeListener() { @Override public void onValueChange(ElegantNumberButton view, int oldValue, int newVaue) { Cart cart = cartList.get(position); cart.amount = newVaue; cart.price = priceOneCup*newVaue; Common.cartRepository.updateCart(cart); //After amount change holder.txt_price.setText(new StringBuilder("₹").append(cartList.get(position).price)); } }); } @Override public int getItemCount() { return cartList.size(); } public class CartViewHolder extends RecyclerView.ViewHolder { ImageView img_product; TextView txt_product_name , txt_sugar_ice , txt_price ; ElegantNumberButton txt_amount; public RelativeLayout view_background; public LinearLayout view_foreground; public CartViewHolder(View itemView) { super(itemView); img_product = (ImageView)itemView.findViewById(R.id.img_product); txt_amount = (ElegantNumberButton)itemView.findViewById(R.id.txt_amount); txt_product_name = (TextView)itemView.findViewById(R.id.txt_product_name); txt_sugar_ice = (TextView)itemView.findViewById(R.id.txt_sugar_ice); txt_price = (TextView)itemView.findViewById(R.id.txt_price); view_background = (RelativeLayout)itemView.findViewById(R.id.view_background); view_foreground = (LinearLayout)itemView.findViewById(R.id.view_foreground); } } //swipe to delete public void removeItem(int position) { cartList.remove(position); notifyItemRemoved(position); } public void restoreItem(Cart item , int position) { cartList.add(position,item); notifyItemInserted(position); } }
[ "admin@shailendraweb.com" ]
admin@shailendraweb.com
fc6ac89a4472da2acd79cc58d7df5d317304d4c0
f7c6debaa18ba2f9f136ceceded10e6b8b9a2104
/app/src/main/java/lrb/com/wuziqi/utils/runtimePermission/DefaultPermission.java
8dcfd274413bc075e67495aaa92980b693b0a225
[]
no_license
fcq599301283/Wuziqi
3852af8d61fa41aea7c0e428632fa47fe108dd03
d62e395bfe1bff6a8340de694339b6682ff7bccb
refs/heads/master
2020-06-19T05:49:19.687232
2017-06-13T06:32:21
2017-06-13T06:32:21
94,177,910
0
0
null
null
null
null
UTF-8
Java
false
false
6,686
java
/* * Copyright 2016 Yan Zhenjie * * 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 lrb.com.wuziqi.utils.runtimePermission; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.util.Log; import java.util.ArrayList; import java.util.List; /** * Created by Yan Zhenjie on 2016/9/9. */ class DefaultPermission implements Permission { private static final String TAG = "AndPermission"; private String[] permissions; private String[] deniedPermissions; private int requestCode; private Object object; private RationaleListener listener; DefaultPermission(Object o) { if (o == null) throw new IllegalArgumentException("The object can not be null."); this.object = o; } @NonNull @Override public Permission permission(String... permissions) { if (permissions == null) throw new IllegalArgumentException("The permissions can not be null."); this.permissions = permissions; return this; } @NonNull @Override public Permission requestCode(int requestCode) { this.requestCode = requestCode; return this; } @NonNull @Override public Permission rationale(RationaleListener listener) { this.listener = listener; return this; } /** * Rationale. */ private Rationale rationale = new Rationale() { @Override public void cancel() { int[] results = new int[permissions.length]; Context context = PermissionUtils.getContext(object); for (int i = 0; i < results.length; i++) { results[i] = ActivityCompat.checkSelfPermission(context, permissions[i]); } onRequestPermissionsResult(object, requestCode, permissions, results); } @Override public void resume() { requestPermissions(object, requestCode, deniedPermissions); } }; @Override public void send() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { Context context = PermissionUtils.getContext(object); final int[] grantResults = new int[permissions.length]; PackageManager packageManager = context.getPackageManager(); String packageName = context.getPackageName(); final int permissionCount = permissions.length; for (int i = 0; i < permissionCount; i++) { grantResults[i] = packageManager.checkPermission(permissions[i], packageName); } onRequestPermissionsResult(object, requestCode, permissions, grantResults); } else { deniedPermissions = getDeniedPermissions(object, permissions); // Denied permissions size > 0. if (deniedPermissions.length > 0) { // Remind users of the purpose of permissions. boolean showRationale = PermissionUtils.shouldShowRationalePermissions(object, deniedPermissions); if (showRationale && listener != null) listener.showRequestPermissionRationale(requestCode, rationale); else rationale.resume(); } else { // All permission granted. final int[] grantResults = new int[permissions.length]; final int permissionCount = permissions.length; for (int i = 0; i < permissionCount; i++) { grantResults[i] = PackageManager.PERMISSION_GRANTED; } onRequestPermissionsResult(object, requestCode, permissions, grantResults); } } } private static String[] getDeniedPermissions(Object o, String... permissions) { Context context = PermissionUtils.getContext(o); List<String> deniedList = new ArrayList<>(1); for (String permission : permissions) if (!AndPermission.hasPermission(context, permission)) deniedList.add(permission); return deniedList.toArray(new String[deniedList.size()]); } @TargetApi(Build.VERSION_CODES.M) private static void requestPermissions(Object o, int requestCode, String... permissions) { if (o instanceof Activity) ActivityCompat.requestPermissions(((Activity) o), permissions, requestCode); else if (o instanceof android.support.v4.app.Fragment) ((android.support.v4.app.Fragment) o).requestPermissions(permissions, requestCode); else if (o instanceof android.app.Fragment) { ((android.app.Fragment) o).requestPermissions(permissions, requestCode); Log.e(TAG, "The " + o.getClass().getName() + " is not support " + "requestPermissions()"); } } @TargetApi(Build.VERSION_CODES.M) private static void onRequestPermissionsResult(Object o, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (o instanceof Activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) ((Activity) o).onRequestPermissionsResult(requestCode, permissions, grantResults); else if (o instanceof ActivityCompat.OnRequestPermissionsResultCallback) ((ActivityCompat.OnRequestPermissionsResultCallback) o).onRequestPermissionsResult(requestCode, permissions, grantResults); else Log.e(TAG, "The " + o.getClass().getName() + " is not support " + "onRequestPermissionsResult()"); } else if (o instanceof android.support.v4.app.Fragment) { ((android.support.v4.app.Fragment) o).onRequestPermissionsResult(requestCode, permissions, grantResults); } else if (o instanceof android.app.Fragment) { ((android.app.Fragment) o).onRequestPermissionsResult(requestCode, permissions, grantResults); } } }
[ "599301283@qq.com" ]
599301283@qq.com
1bcd9f8688132cbd1cbbeec4f921c5d1b1e09b7e
45d5b4934436ee3f96c927562f3a0f4ea28643e5
/Rxjava2.0Demo/app/src/main/java/rx_retrofit_RetryWhen/bean/Translation.java
bda8d570b2cbbc6c8b0af8097a77cf1706c558bc
[]
no_license
979527040/Rxjava2.0
fea902c0973790e3365a825b409ce1b544803d94
aa05a3e27d09214120b8296cd0272036d44aca5d
refs/heads/master
2021-05-06T12:35:52.396387
2017-12-06T03:14:51
2017-12-06T03:14:51
113,161,677
0
0
null
null
null
null
UTF-8
Java
false
false
487
java
package rx_retrofit_RetryWhen.bean; import android.util.Log; /** * Created by 97952 on 2017/11/29. */ public class Translation { private int status; private content content; private static class content { private String from; private String to; private String vendor; private String out; private int errNo; } //定义 输出返回数据 的方法 public void show() { Log.d("RxJava", content.out ); } }
[ "979527040@qq.com" ]
979527040@qq.com
47fcef16fb38a7496182ccebd3afab095dbce812
1d6141abf3816101a3f5788c4843b180029e0025
/src/learning/maps/Maps.java
320e58f9a4d739c71e1ccb1e4e7fb53ab5a29485
[]
no_license
amarendermekala/LearningJava
5e8e05be58e53948dfe82bcd877036d68bdb5154
1e8b028b6a1b436e6f634a78375a792081e7cbc4
refs/heads/master
2020-03-21T18:56:57.234473
2019-07-09T16:27:27
2019-07-09T16:27:27
138,922,556
0
0
null
null
null
null
UTF-8
Java
false
false
4,662
java
package learning.maps; import learning.comparators.Person; import java.util.*; import java.util.stream.Collectors; public class Maps { public static void main(String[] args) { Map<String, String> m = new HashMap<>(); m.put("amar", "reddy"); m.forEach((key, value) -> System.out.println(key + " " + value)); // amar reddy String d = m.get("asd"); // d is null, but it could be that asd null is stored in the map System.out.println(d); // null String d1 = m.getOrDefault("asd", "defaultValue"); System.out.println(d1); // defaultValue // m.put("amar", "asd"); // will erase previous m.putIfAbsent("amar", "123123"); m.forEach((key, value) -> System.out.println(key + " " + value)); // amar reddy String s = m.computeIfAbsent("amar1", (key) -> key + "asdasasd"); System.out.println(s); // amar1asdasasd m.forEach((key, value) -> System.out.println(key + " " + value)); // amar reddy // amar1 amar1asdasasd m.replace("amar", "asasas"); m.forEach((key, value) -> System.out.println(key + " " + value)); // amar asasas // amar1 amar1asdasasd Map<String, Map<String, Person>> bimap = new HashMap<>(); bimap.computeIfAbsent("asd", key -> new HashMap<>()).put("asdasd", new Person(1, "asdas")); Map<String, Integer> prices = new HashMap<>(); System.out.println("Prices map: " + prices); // Prices map: {} // Integer::sum(a,b) is perfect two-argument // function (BiFunction) prices.merge("fruits", 3, Integer::sum); prices.merge("fruits", 5, Integer::sum); prices.merge("fruits1", 5, Integer::sum); prices.forEach((key, value) -> System.out.println(key + " " + value)); // fruits1 5 // fruits 8 List<Person> personList1 = new ArrayList<>(); personList1.add(new Person(1, "Amar")); personList1.add(new Person(2, "Redy")); personList1.add(new Person(1, "Mekala")); List<Person> personList2 = new ArrayList<>(); personList2.add(new Person(4, "abhi")); personList2.add(new Person(5, "jeet")); personList2.add(new Person(2, "pranit")); Map<Integer, List<Person>> m1 = mapByAge(personList1); Map<Integer, List<Person>> m2 = mapByAge(personList2); System.out.println(m1); // {1=[Person{age=1, name='Amar'}, Person{age=1, name='Mekala'}], 2=[Person{age=2, name='Redy'}]} System.out.println(m2); // {2=[Person{age=2, name='pranit'}], 4=[Person{age=4, name='abhi'}], 5=[Person{age=5, name='jeet'}]} m2.entrySet().stream() .forEach( entry -> m1.merge(entry.getKey(), entry.getValue(), (l1, l2) -> { l1.addAll(l2); return l1; }) ); System.out.println(m1); // { // 1=[Person{age=1, name='Amar'}, Person{age=1, name='Mekala'}], // 2=[Person{age=2, name='Redy'}, Person{age=2, name='pranit'}], // 4=[Person{age=4, name='abhi'}], // 5=[Person{age=5, name='jeet'}] // } // Bimap personList1 = new ArrayList<>(); personList1.add(new Person(1, "Amar")); personList1.add(new Person(1, "Amar")); personList1.add(new Person(2, "Redy")); personList1.add(new Person(1, "Mekala")); Map<Integer, Map<String, List<Person>>> bimap1 = new HashMap<>(); personList1.forEach( person -> bimap1.computeIfAbsent( person.getAge(), HashMap::new ).merge( person.getName(), new ArrayList<Person>(Arrays.asList(person)), (l1, l2) -> { l1.addAll(l2); return l1; }) ); System.out.println(bimap1); // {1={Amar=[Person{age=1, name='Amar'}, Person{age=1, name='Amar'}], Mekala=[Person{age=1, name='Mekala'}]}, 2={Redy=[Person{age=2, name='Redy'}]}} } private static Map<Integer, List<Person>> mapByAge(List<Person> persons) { Map<Integer, List<Person>> p = persons.stream().collect(Collectors.groupingBy(Person::getAge)); return p; } }
[ "amekala@luxoft.com" ]
amekala@luxoft.com
ce35253e4811c2793354a1650ca5344e244b87a8
7dcadd353e8a6f7573f26333931908b67d435387
/test/BoardBackground.java
1803acf8fb1d2dc1e7a8509f7179ea4842ebe6d0
[]
no_license
equilpoint/team04-Fanorona
029fa986833ca2ac252bac57b3603ca4f2003439
b3c6ef41fdb6ec6650674f8ad244a4859aa35000
refs/heads/master
2020-03-24T00:07:22.966767
2013-04-03T19:39:07
2013-04-03T19:39:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JPanel; class BoardBackground extends JPanel { public void paintComponent(Graphics g) { int x = getWidth(); int y = getHeight(); g.setColor(Color.black); g.fillRect(0, 0, x, y); Graphics2D g2 = (Graphics2D) g; int w = x/10; int h = y/10; g.setColor(Color.cyan); g2.setStroke(new BasicStroke(1)); for (int i = 1; i < 10; i++) { g2.drawLine(i*w, 0, i*w, y); } for (int i = 1; i < 10; i++) { g2.drawLine(0, i*h, x, i*h); } /* g2.setColor(Color.red); double rowH = getHeight() / 10.0; for (int i = 1; i < 10; i++) { Line2D line = new Line2D.Double(0.0, (double) i * rowH, (double) getWidth(), (double) i * rowH); g2.draw(line); }*/ } } /*Probably in FanoronaGame..: BufferedImage myImage = ImageIO.load(...); playingFieldPanel.setContentPane(new ImagePanel(myImage)); */
[ "patrickcasey2014@gmail.com" ]
patrickcasey2014@gmail.com
35861acf1e11a61dcd9460eeb57bfe4d94b0e8f7
e24c6c940689c19fdcc2e39dd80a5061e0b0b326
/org.eclipse.emf.refactor.metrics.uml24.compositional/src/org/eclipse/emf/refactor/metrics/uml24/umlcl/NAI.java
4d40a109d2aa7566ae1935c4941ed78e61a79c77
[]
no_license
ambrusthomas/MeDeR.refactor.examples
63cf443045be9907d237d543db3df93e93175752
66a35d6f9b2924f7c1172c0fff857badd0e41b8e
refs/heads/master
2021-01-22T19:09:18.404936
2017-03-29T16:24:23
2017-03-29T16:24:23
85,169,831
0
0
null
null
null
null
UTF-8
Java
false
false
1,215
java
package org.eclipse.emf.refactor.metrics.uml24.umlcl; import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.refactor.metrics.core.Metric; import org.eclipse.emf.refactor.metrics.interfaces.IMetricCalculator; import org.eclipse.emf.refactor.metrics.interfaces.IOperation; import org.eclipse.emf.refactor.metrics.operations.Operations; public class NAI implements IMetricCalculator { private List<EObject> context; private String metricID1 = "org.eclipse.emf.refactor.metrics.uml24.npubac"; private String metricID2 = "org.eclipse.emf.refactor.metrics.uml24.nproac"; IOperation operation = Operations.getOperation("Sum"); @Override public void setContext(List<EObject> context) { this.context = context; } @Override public double calculate() { Metric metric1 = Metric.getMetricInstanceFromId(metricID1); Metric metric2 = Metric.getMetricInstanceFromId(metricID2); IMetricCalculator calc1 = metric1.getCalculateClass(); IMetricCalculator calc2 = metric2.getCalculateClass(); calc1.setContext(this.context); calc2.setContext(this.context); return operation.calculate(calc1.calculate(),calc2.calculate()); } }
[ "tarendt" ]
tarendt
5d981aab3a75a89dfaf2b77d2886b64e7a5dfd02
c458407cbf17995a61fbc97ddb69e6ec9ccd8d05
/src/outlier/util/FilesOfFolderDelete.java
ad82cfeab96eece7fa63b396651a155d49aed771
[]
no_license
pmphjj/thucp
44a2da4e9e44a8553d8cf798058dfedb5415efa9
1c2283909cf745783d67f74605503cd01f3f36f1
refs/heads/master
2021-06-06T07:06:42.334372
2019-09-16T14:59:33
2019-09-16T14:59:33
95,528,388
0
0
null
2017-08-21T11:12:56
2017-06-27T07:07:58
Java
UTF-8
Java
false
false
1,667
java
package outlier.util; import java.io.File; //来源:http://blog.csdn.net/huaishuming/article/details/37757977 public class FilesOfFolderDelete { public static void main(String[] args) { String fileRoot = "data/OutlierDetection/corpus/"; delFolder(fileRoot); System.out.println("deleted"); } // // 删除完文件后删除文件夹 // // param folderPath 文件夹完整绝对路径 public static void delFolder(String folderPath) { try { delAllFile(folderPath); // 删除完里面所有内容 // 不想删除文佳夹隐藏下面 // String filePath = folderPath; // filePath = filePath.toString(); // java.io.File myFilePath = new java.io.File(filePath); // myFilePath.delete(); // 删除空文件夹 } catch (Exception e) { e.printStackTrace(); } } // 删除指定文件夹下所有文件 // param path 文件夹完整绝对路径 public static boolean delAllFile(String path) { boolean flag = false; File file = new File(path); if (!file.exists()) { return flag; } if (!file.isDirectory()) { return flag; } String[] tempList = file.list(); File temp = null; for (int i = 0; i < tempList.length; i++) { if (path.endsWith(File.separator)) { temp = new File(path + tempList[i]); } else { temp = new File(path + File.separator + tempList[i]); } if (temp.isFile()) { temp.delete(); } // if (temp.isDirectory()) { // delAllFile(path + "/" + tempList[i]);// 先删除文件夹里面的文件 // // delFolder(path + "/" + tempList[i]);// 再删除空文件夹 // flag = true; // } } return flag; } }
[ "weizhijie15@163.com" ]
weizhijie15@163.com
55839098cb9bd73536e926d57089f6b3ce577c55
e87e5bb5eba143880dabf5d66bc47681ac17df71
/pyg-sellgoods-service/src/main/java/com/bxg/pyg/sellgoods/service/impl/SellerServiceImpl.java
408ae6e9a6bda8d63c11dfca20f8059879616288
[]
no_license
jsycbxg/pyg
6e63a065736a2dd9923cb36daaf94c03fee4e63d
f9ecf27f030678f49ce1a3bda17dec6f4f9a0b8e
refs/heads/master
2022-11-25T05:10:57.928830
2019-08-28T14:11:17
2019-08-28T14:11:17
203,358,802
0
0
null
2022-11-16T12:26:18
2019-08-20T11:04:18
JavaScript
UTF-8
Java
false
false
5,430
java
package com.bxg.pyg.sellgoods.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.bxg.pyg.mapper.TbSellerMapper; import com.bxg.pyg.pojo.TbSeller; import com.bxg.pyg.pojo.TbSellerExample; import com.bxg.pyg.pojo.TbSellerExample.Criteria; import com.bxg.pyg.sellgoods.service.SellerService; import entity.PageResult; /** * 服务实现层 * @author Administrator * */ @Service public class SellerServiceImpl implements SellerService { @Autowired private TbSellerMapper sellerMapper; /** * 查询全部 */ @Override public List<TbSeller> findAll() { return sellerMapper.selectByExample(null); } /** * 按分页查询 */ @Override public PageResult findPage(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); Page<TbSeller> page= (Page<TbSeller>) sellerMapper.selectByExample(null); return new PageResult(page.getTotal(), page.getResult()); } /** * 增加 */ @Override public void add(TbSeller seller) { sellerMapper.insert(seller); } /** * 修改 */ @Override public void update(TbSeller seller){ sellerMapper.updateByPrimaryKey(seller); } /** * 根据ID获取实体 * @param id * @return */ @Override public TbSeller findOne(String id){ return sellerMapper.selectByPrimaryKey(id); } /** * 批量删除 */ @Override public void delete(String[] ids) { for(String id:ids){ sellerMapper.deleteByPrimaryKey(id); } } @Override public PageResult findPage(TbSeller seller, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); TbSellerExample example=new TbSellerExample(); Criteria criteria = example.createCriteria(); if(seller!=null){ if(seller.getSellerId()!=null && seller.getSellerId().length()>0){ criteria.andSellerIdLike("%"+seller.getSellerId()+"%"); } if(seller.getName()!=null && seller.getName().length()>0){ criteria.andNameLike("%"+seller.getName()+"%"); } if(seller.getNickName()!=null && seller.getNickName().length()>0){ criteria.andNickNameLike("%"+seller.getNickName()+"%"); } if(seller.getPassword()!=null && seller.getPassword().length()>0){ criteria.andPasswordLike("%"+seller.getPassword()+"%"); } if(seller.getEmail()!=null && seller.getEmail().length()>0){ criteria.andEmailLike("%"+seller.getEmail()+"%"); } if(seller.getMobile()!=null && seller.getMobile().length()>0){ criteria.andMobileLike("%"+seller.getMobile()+"%"); } if(seller.getTelephone()!=null && seller.getTelephone().length()>0){ criteria.andTelephoneLike("%"+seller.getTelephone()+"%"); } if(seller.getStatus()!=null && seller.getStatus().length()>0){ criteria.andStatusLike("%"+seller.getStatus()+"%"); } if(seller.getAddressDetail()!=null && seller.getAddressDetail().length()>0){ criteria.andAddressDetailLike("%"+seller.getAddressDetail()+"%"); } if(seller.getLinkmanName()!=null && seller.getLinkmanName().length()>0){ criteria.andLinkmanNameLike("%"+seller.getLinkmanName()+"%"); } if(seller.getLinkmanQq()!=null && seller.getLinkmanQq().length()>0){ criteria.andLinkmanQqLike("%"+seller.getLinkmanQq()+"%"); } if(seller.getLinkmanMobile()!=null && seller.getLinkmanMobile().length()>0){ criteria.andLinkmanMobileLike("%"+seller.getLinkmanMobile()+"%"); } if(seller.getLinkmanEmail()!=null && seller.getLinkmanEmail().length()>0){ criteria.andLinkmanEmailLike("%"+seller.getLinkmanEmail()+"%"); } if(seller.getLicenseNumber()!=null && seller.getLicenseNumber().length()>0){ criteria.andLicenseNumberLike("%"+seller.getLicenseNumber()+"%"); } if(seller.getTaxNumber()!=null && seller.getTaxNumber().length()>0){ criteria.andTaxNumberLike("%"+seller.getTaxNumber()+"%"); } if(seller.getOrgNumber()!=null && seller.getOrgNumber().length()>0){ criteria.andOrgNumberLike("%"+seller.getOrgNumber()+"%"); } if(seller.getLogoPic()!=null && seller.getLogoPic().length()>0){ criteria.andLogoPicLike("%"+seller.getLogoPic()+"%"); } if(seller.getBrief()!=null && seller.getBrief().length()>0){ criteria.andBriefLike("%"+seller.getBrief()+"%"); } if(seller.getLegalPerson()!=null && seller.getLegalPerson().length()>0){ criteria.andLegalPersonLike("%"+seller.getLegalPerson()+"%"); } if(seller.getLegalPersonCardId()!=null && seller.getLegalPersonCardId().length()>0){ criteria.andLegalPersonCardIdLike("%"+seller.getLegalPersonCardId()+"%"); } if(seller.getBankUser()!=null && seller.getBankUser().length()>0){ criteria.andBankUserLike("%"+seller.getBankUser()+"%"); } if(seller.getBankName()!=null && seller.getBankName().length()>0){ criteria.andBankNameLike("%"+seller.getBankName()+"%"); } } Page<TbSeller> page= (Page<TbSeller>)sellerMapper.selectByExample(example); return new PageResult(page.getTotal(), page.getResult()); } @Override public TbSeller findByusername(String username) { TbSellerExample example=new TbSellerExample(); example.createCriteria().andSellerIdEqualTo(username); List<TbSeller> tbUsers=sellerMapper.selectByExample(example); if(tbUsers.size()>0){ TbSeller tbUser=tbUsers.get(0); return tbUser; } return null; } }
[ "jsycbxg@qq.com" ]
jsycbxg@qq.com
0a7216e9abe7e1052b12bd70e5e7f9678f73848d
39b033b8a7c2a34b451e18ddaf5406b64f6ba839
/network/src/main/java/com/mushan/network/download/DownloadInterface.java
3d78ea466e00ae678b7600fa15096e9aa982c1cc
[]
no_license
liu-mushan/RetrofitClient
288861bd296802e857ea3beb6a23ec92b3a21110
68b024a974abf7185cae7b965e9a02a1e6ab7efc
refs/heads/master
2021-07-16T15:06:04.337549
2017-10-24T04:25:09
2017-10-24T04:25:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package com.mushan.network.download; import io.reactivex.Flowable; import okhttp3.ResponseBody; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Streaming; /** * @author : liujian * @since : 2017/10/4 */ public interface DownloadInterface { @Streaming @GET("{link}") Flowable<ResponseBody> startDownLoad(@Path("link") String fileUrl); }
[ "lj@webull.com" ]
lj@webull.com
d1416575d53ed53d7196183f3862555d784eee77
9a6172a3f1004b18be4422fb169b8dd271996fe4
/src/model/Cliente.java
36206931710c4418c87aa8ba8ebeae45a7726da3
[]
no_license
josegcmoraes/ProjetoComputacaoOrientadaAObjetos
1aa8b1ac382800ce07e5f888a623f7fba4741b71
d0d7ecf63507f7f5690bded6d83dd161b5f566a5
refs/heads/master
2023-01-04T08:22:46.671366
2020-11-04T07:41:21
2020-11-04T07:41:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,038
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 model; import java.util.ArrayList; /** * * @author josegcm */ public class Cliente { private String cpf; private String nome; private String email; private String endereco; private int codigo; ArrayList<String> listaendereco=new ArrayList<String>(); public String getCpf(){ return cpf; } public String getNome(){ return nome; } public String getEmail(){ return email; } public String getEndereco(){ return endereco; } public int getCodigo(){ return codigo; } public ArrayList<String> getListaendereco(){ return listaendereco; } public void setCpf(String cpf){ this.cpf=cpf; } public void setNome(String nome){ this.nome=nome; } public void setEmail(String email){ this.email=email; } public void setEndereco(String endereco){ this.endereco=endereco; } public void setCodigo(int codigo){ this.codigo=codigo; } public void setListaendereco(ArrayList<String> listaendereco){ this.listaendereco=listaendereco; } public void exibir(){ exibir1(); exibir2(); } public void exibir1(){ //Exibe os dados de um Cliente System.out.println("=================================="); System.out.println("Nome:"+getNome()); System.out.println("Cpf:"+getCpf()); System.out.println("Codigo:"+getCodigo()); System.out.println("E-mail:"+getEmail()); } public void exibir2(){ //Imprime a lista de enderecos do cliente for(int le=0;le<listaendereco.size();le++){ System.out.println("Endereco:"+listaendereco.get(le)); } } }
[ "josegcmoraes@gmail.com" ]
josegcmoraes@gmail.com
6612e510ad8f8f0cc3d928821e63f04e71f5a463
296ae7d7342d430ad4c18c10f1b49390a393f21a
/generated/Receiver4.java
40a0814dac46a639365313287ab1b20e0f204eb2
[]
no_license
tarcisiorocha/highframe
bedbd74107faf1fbc4fdea633fcfbfd6f81bc4f4
bebed6d843ab2e138dde0e8c0658ef69c064d908
refs/heads/master
2021-01-01T18:08:09.850879
2014-11-27T02:08:33
2014-11-27T02:08:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,886
java
package specific.comanche.fraclet; import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.io.PrintStream; import java.io.Reader; import java.net.ServerSocket; import java.net.Socket; import org.objectweb.fractal.api.control.BindingController; import org.objectweb.fractal.fraclet.annotations.Component; import org.objectweb.fractal.fraclet.annotations.Interface; import org.objectweb.fractal.fraclet.annotations.Requires; import comanche.fraclet.Request; import comanche.fraclet.Response; import comanche.fraclet.IScheduler; import comanche.fraclet.IAnalyzer; import OpenCOM.IConnections; import OpenCOM.ILifeCycle; import OpenCOM.IMetaInterface; import OpenCOM.IUnknown; import OpenCOM.OCM_SingleReceptacle; import OpenCOM.OpenCOMComponent; public class Receiver4 extends OpenCOMComponent implements IUnknown, ILifeCycle, IMetaInterface, IConnections , highframe.core.Runner { private OCM_SingleReceptacle<comanche.fraclet.IScheduler> s; private OCM_SingleReceptacle<comanche.fraclet.IAnalyzer> ia; private java.net.ServerSocket ss; public Receiver4 (IUnknown mpIOCM) { super(mpIOCM); this.s = new OCM_SingleReceptacle<comanche.fraclet.IScheduler>(comanche.fraclet.IScheduler.class); this.ia = new OCM_SingleReceptacle<comanche.fraclet.IAnalyzer>(comanche.fraclet.IAnalyzer.class); } public void run () { try { ss = new ServerSocket(8080); System.out.println("Comanche HTTP Server ready on port 8080."); while (true) { final Socket socket = ss.accept(); final Request r = new Request(); s.m_pIntf.schedule(new Runnable () { public void run () { try { Reader in = new InputStreamReader(socket.getInputStream()); PrintStream out = new PrintStream(socket.getOutputStream()); String rq = new LineNumberReader(in).readLine(); r.rq = rq; Response res = ia.m_pIntf.handleRequest(r); if (res != null) { out.print(res.message); out.write(res.data); } out.close(); socket.close(); } catch (Exception _) { } } }); } } catch (IOException e) { e.printStackTrace(); } } @Override public boolean startup(Object data) { return true; } @Override public boolean shutdown() { return true; } public boolean connect(IUnknown pSinkIntf, String riid, long provConnID) { if (riid.equals("comanche.fraclet.IScheduler")){ return this.s.connectToRecp(pSinkIntf, riid, provConnID); } if (riid.equals("comanche.fraclet.IAnalyzer")){ return this.ia.connectToRecp(pSinkIntf, riid, provConnID); } return false; } public boolean disconnect(String riid, long connID) { if (riid.equals("comanche.fraclet.IScheduler")){ return this.s.disconnectFromRecp(connID); } if (riid.equals("comanche.fraclet.IAnalyzer")){ return this.ia.disconnectFromRecp(connID); } return false; } }
[ "vanderson.sampaio@yahoo.com.br" ]
vanderson.sampaio@yahoo.com.br
d5ea2c3d122551416eb94a78619211c06400f83c
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/13/13_4913b95d772c220c3cc40c73c9d07dfa686a3e42/SdkUpdaterWindowImpl2/13_4913b95d772c220c3cc40c73c9d07dfa686a3e42_SdkUpdaterWindowImpl2_s.java
33711f6fc8ef149080997f9c114060251854d411
[]
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
27,811
java
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.sdkuilib.internal.repository.sdkman2; import com.android.sdklib.ISdkLog; import com.android.sdklib.SdkConstants; import com.android.sdklib.internal.repository.ITaskFactory; import com.android.sdkuilib.internal.repository.ISdkUpdaterWindow; import com.android.sdkuilib.internal.repository.ISettingsPage; import com.android.sdkuilib.internal.repository.MenuBarWrapper; import com.android.sdkuilib.internal.repository.SettingsController; import com.android.sdkuilib.internal.repository.UpdaterData; import com.android.sdkuilib.internal.repository.UpdaterPage; import com.android.sdkuilib.internal.repository.UpdaterPage.Purpose; import com.android.sdkuilib.internal.repository.icons.ImageFactory; import com.android.sdkuilib.internal.repository.sdkman2.PackagesPage.MenuAction; import com.android.sdkuilib.internal.tasks.ILogUiProvider; import com.android.sdkuilib.internal.tasks.ProgressView; import com.android.sdkuilib.internal.tasks.ProgressViewFactory; import com.android.sdkuilib.internal.widgets.ImgDisabledButton; import com.android.sdkuilib.internal.widgets.ToggleButton; import com.android.sdkuilib.repository.AvdManagerWindow.AvdInvocationContext; import com.android.sdkuilib.repository.ISdkChangeListener; import com.android.sdkuilib.repository.SdkUpdaterWindow.SdkInvocationContext; import com.android.sdkuilib.ui.GridDataBuilder; import com.android.sdkuilib.ui.GridLayoutBuilder; import com.android.sdkuilib.ui.SwtBaseDialog; import com.android.util.Pair; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; import java.util.ArrayList; /** * This is the private implementation of the UpdateWindow * for the second version of the SDK Manager. * <p/> * This window features only one embedded page, the combined installed+available package list. */ public class SdkUpdaterWindowImpl2 implements ISdkUpdaterWindow { private static final String APP_NAME = "Android SDK Manager"; private static final String SIZE_POS_PREFIX = "sdkman2"; //$NON-NLS-1$ private final Shell mParentShell; private final SdkInvocationContext mContext; /** Internal data shared between the window and its pages. */ private final UpdaterData mUpdaterData; /** A list of extra pages to instantiate. Each entry is an object array with 2 elements: * the string title and the Composite class to instantiate to create the page. */ private ArrayList<Pair<Class<? extends UpdaterPage>, Purpose>> mExtraPages; /** Sets whether the auto-update wizard will be shown when opening the window. */ private boolean mRequestAutoUpdate; // --- UI members --- protected Shell mShell; private PackagesPage mPkgPage; private ProgressBar mProgressBar; private Label mStatusText; private ImgDisabledButton mButtonStop; private ToggleButton mButtonShowLog; private SettingsController mSettingsController; private LogWindow mLogWindow; /** * Creates a new window. Caller must call open(), which will block. * * @param parentShell Parent shell. * @param sdkLog Logger. Cannot be null. * @param osSdkRoot The OS path to the SDK root. * @param context The {@link SdkInvocationContext} to change the behavior depending on who's * opening the SDK Manager. */ public SdkUpdaterWindowImpl2( Shell parentShell, ISdkLog sdkLog, String osSdkRoot, SdkInvocationContext context) { mParentShell = parentShell; mContext = context; mUpdaterData = new UpdaterData(osSdkRoot, sdkLog); } /** * Creates a new window. Caller must call open(), which will block. * <p/> * This is to be used when the window is opened from {@link AvdManagerWindowImpl1} * to share the same {@link UpdaterData} structure. * * @param parentShell Parent shell. * @param updaterData The parent's updater data. * @param context The {@link SdkInvocationContext} to change the behavior depending on who's * opening the SDK Manager. */ public SdkUpdaterWindowImpl2( Shell parentShell, UpdaterData updaterData, SdkInvocationContext context) { mParentShell = parentShell; mContext = context; mUpdaterData = updaterData; } /** * Opens the window. * @wbp.parser.entryPoint */ public void open() { if (mParentShell == null) { Display.setAppName(APP_NAME); //$hide$ (hide from SWT designer) } createShell(); preCreateContent(); createContents(); createMenuBar(); createLogWindow(); mShell.open(); mShell.layout(); if (postCreateContent()) { //$hide$ (hide from SWT designer) Display display = Display.getDefault(); while (!mShell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } dispose(); //$hide$ } private void createShell() { // The SDK Manager must use a shell trim when standalone // or a dialog trim when invoked from somewhere else. int style = SWT.SHELL_TRIM; if (mContext != SdkInvocationContext.STANDALONE) { style = SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL; } mShell = new Shell(mParentShell, style); mShell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { ShellSizeAndPos.saveSizeAndPos(mShell, SIZE_POS_PREFIX); onAndroidSdkUpdaterDispose(); //$hide$ (hide from SWT designer) } }); GridLayout glShell = new GridLayout(2, false); glShell.verticalSpacing = 0; glShell.horizontalSpacing = 0; glShell.marginWidth = 0; glShell.marginHeight = 0; mShell.setLayout(glShell); mShell.setMinimumSize(new Point(500, 300)); mShell.setSize(700, 500); mShell.setText(APP_NAME); ShellSizeAndPos.loadSizeAndPos(mShell, SIZE_POS_PREFIX); } private void createContents() { mPkgPage = new PackagesPage(mShell, SWT.NONE, mUpdaterData, mContext); mPkgPage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); Composite composite1 = new Composite(mShell, SWT.NONE); composite1.setLayout(new GridLayout(1, false)); composite1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); mProgressBar = new ProgressBar(composite1, SWT.NONE); mProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); mStatusText = new Label(composite1, SWT.NONE); mStatusText.setText("Status Placeholder"); //$NON-NLS-1$ placeholder mStatusText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Composite composite2 = new Composite(mShell, SWT.NONE); composite2.setLayout(new GridLayout(2, false)); mButtonStop = new ImgDisabledButton(composite2, SWT.NONE, getImage("stop_enabled_16.png"), //$NON-NLS-1$ getImage("stop_disabled_16.png"), //$NON-NLS-1$ "Click to abort the current task", ""); //$NON-NLS-1$ nothing to abort mButtonStop.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { onStopSelected(); } }); mButtonShowLog = new ToggleButton(composite2, SWT.NONE, getImage("log_off_16.png"), //$NON-NLS-1$ getImage("log_on_16.png"), //$NON-NLS-1$ "Click to show the log window", // tooltip for state hidden=>shown "Click to hide the log window"); // tooltip for state shown=>hidden mButtonShowLog.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { onToggleLogWindow(); } }); } @SuppressWarnings("unused") // MenuItem works using side effects private void createMenuBar() { Menu menuBar = new Menu(mShell, SWT.BAR); mShell.setMenuBar(menuBar); MenuItem menuBarPackages = new MenuItem(menuBar, SWT.CASCADE); menuBarPackages.setText("Packages"); Menu menuPkgs = new Menu(menuBarPackages); menuBarPackages.setMenu(menuPkgs); MenuItem showUpdatesNew = new MenuItem(menuPkgs, MenuAction.TOGGLE_SHOW_UPDATE_NEW_PKG.getMenuStyle()); showUpdatesNew.setText( MenuAction.TOGGLE_SHOW_UPDATE_NEW_PKG.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.TOGGLE_SHOW_UPDATE_NEW_PKG, showUpdatesNew); MenuItem showInstalled = new MenuItem(menuPkgs, MenuAction.TOGGLE_SHOW_INSTALLED_PKG.getMenuStyle()); showInstalled.setText( MenuAction.TOGGLE_SHOW_INSTALLED_PKG.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.TOGGLE_SHOW_INSTALLED_PKG, showInstalled); MenuItem showObsoletePackages = new MenuItem(menuPkgs, MenuAction.TOGGLE_SHOW_OBSOLETE_PKG.getMenuStyle()); showObsoletePackages.setText( MenuAction.TOGGLE_SHOW_OBSOLETE_PKG.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.TOGGLE_SHOW_OBSOLETE_PKG, showObsoletePackages); MenuItem showArchives = new MenuItem(menuPkgs, MenuAction.TOGGLE_SHOW_ARCHIVES.getMenuStyle()); showArchives.setText( MenuAction.TOGGLE_SHOW_ARCHIVES.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.TOGGLE_SHOW_ARCHIVES, showArchives); new MenuItem(menuPkgs, SWT.SEPARATOR); MenuItem sortByApi = new MenuItem(menuPkgs, MenuAction.SORT_API_LEVEL.getMenuStyle()); sortByApi.setText( MenuAction.SORT_API_LEVEL.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.SORT_API_LEVEL, sortByApi); MenuItem sortBySource = new MenuItem(menuPkgs, MenuAction.SORT_SOURCE.getMenuStyle()); sortBySource.setText( MenuAction.SORT_SOURCE.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.SORT_SOURCE, sortBySource); new MenuItem(menuPkgs, SWT.SEPARATOR); MenuItem reload = new MenuItem(menuPkgs, MenuAction.RELOAD.getMenuStyle()); reload.setText( MenuAction.RELOAD.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.RELOAD, reload); MenuItem menuBarTools = new MenuItem(menuBar, SWT.CASCADE); menuBarTools.setText("Tools"); Menu menuTools = new Menu(menuBarTools); menuBarTools.setMenu(menuTools); if (mContext == SdkInvocationContext.STANDALONE) { MenuItem manageAvds = new MenuItem(menuTools, SWT.NONE); manageAvds.setText("Manage AVDs..."); manageAvds.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { onAvdManager(); } }); } MenuItem manageSources = new MenuItem(menuTools, MenuAction.SHOW_ADDON_SITES.getMenuStyle()); manageSources.setText( MenuAction.SHOW_ADDON_SITES.getMenuTitle()); mPkgPage.registerMenuAction( MenuAction.SHOW_ADDON_SITES, manageSources); if (mContext == SdkInvocationContext.STANDALONE) { // Note: when invoked from an IDE, the SwtMenuBar library isn't // available. This means this source should not directly import // any of SwtMenuBar classes, otherwise the whole window class // would fail to load. The MenuBarWrapper below helps to make // that indirection. try { new MenuBarWrapper(APP_NAME, menuTools) { @Override public void onPreferencesMenuSelected() { showRegisteredPage(Purpose.SETTINGS); } @Override public void onAboutMenuSelected() { showRegisteredPage(Purpose.ABOUT_BOX); } @Override public void printError(String format, Object... args) { if (mUpdaterData != null) { mUpdaterData.getSdkLog().error(null, format, args); } } }; } catch (Exception e) { mUpdaterData.getSdkLog().error(e, "Failed to setup menu bar"); e.printStackTrace(); } } } private Image getImage(String filename) { if (mUpdaterData != null) { ImageFactory imgFactory = mUpdaterData.getImageFactory(); if (imgFactory != null) { return imgFactory.getImageByName(filename); } } return null; } /** * Creates the log window. * <p/> * If this is invoked from an IDE, we also define a secondary logger so that all * messages flow to the IDE log. This may or may not be what we want in the end * (e.g. a middle ground would be to repeat error, and ignore normal/verbose) */ private void createLogWindow() { mLogWindow = new LogWindow(mShell, mContext == SdkInvocationContext.IDE ? mUpdaterData.getSdkLog() : null); mLogWindow.open(); } // -- Start of internal part ---------- // Hide everything down-below from SWT designer //$hide>>$ // --- Public API ----------- /** * Registers an extra page for the updater window. * <p/> * Pages must derive from {@link Composite} and implement a constructor that takes * a single parent {@link Composite} argument. * <p/> * All pages must be registered before the call to {@link #open()}. * * @param pageClass The {@link Composite}-derived class that will implement the page. * @param purpose The purpose of this page, e.g. an about box, settings page or generic. */ @SuppressWarnings("unchecked") public void registerPage(Class<? extends UpdaterPage> pageClass, Purpose purpose) { if (mExtraPages == null) { mExtraPages = new ArrayList<Pair<Class<? extends UpdaterPage>, Purpose>>(); } Pair<?, Purpose> value = Pair.of(pageClass, purpose); mExtraPages.add((Pair<Class<? extends UpdaterPage>, Purpose>) value); } /** * Indicate the initial page that should be selected when the window opens. * This must be called before the call to {@link #open()}. * If null or if the page class is not found, the first page will be selected. */ public void setInitialPage(Class<? extends Composite> pageClass) { // Unused in this case. This window display only one page. } /** * Sets whether the auto-update wizard will be shown when opening the window. * <p/> * This must be called before the call to {@link #open()}. */ public void setRequestAutoUpdate(boolean requestAutoUpdate) { mRequestAutoUpdate = requestAutoUpdate; } /** * Adds a new listener to be notified when a change is made to the content of the SDK. */ public void addListener(ISdkChangeListener listener) { mUpdaterData.addListeners(listener); } /** * Removes a new listener to be notified anymore when a change is made to the content of * the SDK. */ public void removeListener(ISdkChangeListener listener) { mUpdaterData.removeListener(listener); } // --- Internals & UI Callbacks ----------- /** * Called before the UI is created. */ private void preCreateContent() { mUpdaterData.setWindowShell(mShell); // We need the UI factory to create the UI mUpdaterData.setImageFactory(new ImageFactory(mShell.getDisplay())); // Note: we can't create the TaskFactory yet because we need the UI // to be created first, so this is done in postCreateContent(). } /** * Once the UI has been created, initializes the content. * This creates the pages, selects the first one, setups sources and scans for local folders. * * Returns true if we should show the window. */ private boolean postCreateContent() { ProgressViewFactory factory = new ProgressViewFactory(); // This class delegates all logging to the mLogWindow window // and filters errors to make sure the window is visible when // an error is logged. ILogUiProvider logAdapter = new ILogUiProvider() { public void setDescription(String description) { mLogWindow.setDescription(description); } public void log(String log) { mLogWindow.log(log); } public void logVerbose(String log) { mLogWindow.logVerbose(log); } public void logError(String log) { mLogWindow.logError(log); // Run the window visibility check/toggle on the UI thread. // Note: at least on Windows, it seems ok to check for the window visibility // on a sub-thread but that doesn't seem cross-platform safe. We shouldn't // have a lot of error logging, so this should be acceptable. If not, we could // cache the visibility state. mShell.getDisplay().syncExec(new Runnable() { public void run() { if (!mLogWindow.isVisible()) { // Don't toggle the window visibility directly. // Instead use the same action as the log-toggle button // so that the button's state be kept in sync. onToggleLogWindow(); } } }); } }; factory.setProgressView( new ProgressView(mStatusText, mProgressBar, mButtonStop, logAdapter)); mUpdaterData.setTaskFactory(factory); setWindowImage(mShell); setupSources(); initializeSettings(); if (mUpdaterData.checkIfInitFailed()) { return false; } mUpdaterData.broadcastOnSdkLoaded(); if (mRequestAutoUpdate) { mUpdaterData.updateOrInstallAll_WithGUI( null /*selectedArchives*/, false /* includeObsoletes */, mContext == SdkInvocationContext.IDE ? UpdaterData.TOOLS_MSG_UPDATED_FROM_ADT : UpdaterData.TOOLS_MSG_UPDATED_FROM_SDKMAN); } // Tell the one page its the selected one mPkgPage.onPageSelected(); return true; } /** * Creates the icon of the window shell. * * @param shell The shell on which to put the icon */ private void setWindowImage(Shell shell) { String imageName = "android_icon_16.png"; //$NON-NLS-1$ if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_DARWIN) { imageName = "android_icon_128.png"; //$NON-NLS-1$ } if (mUpdaterData != null) { ImageFactory imgFactory = mUpdaterData.getImageFactory(); if (imgFactory != null) { shell.setImage(imgFactory.getImageByName(imageName)); } } } /** * Called by the main loop when the window has been disposed. */ private void dispose() { mLogWindow.close(); mUpdaterData.getSources().saveUserAddons(mUpdaterData.getSdkLog()); } /** * Callback called when the window shell is disposed. */ private void onAndroidSdkUpdaterDispose() { if (mUpdaterData != null) { ImageFactory imgFactory = mUpdaterData.getImageFactory(); if (imgFactory != null) { imgFactory.dispose(); } } } /** * Used to initialize the sources. */ private void setupSources() { mUpdaterData.setupDefaultSources(); } /** * Initializes settings. * This must be called after addExtraPages(), which created a settings page. * Iterate through all the pages to find the first (and supposedly unique) setting page, * and use it to load and apply these settings. */ private void initializeSettings() { mSettingsController = mUpdaterData.getSettingsController(); mSettingsController.loadSettings(); mSettingsController.applySettings(); } private void onToggleLogWindow() { // toggle visibility mLogWindow.setVisible(!mLogWindow.isVisible()); mButtonShowLog.setState(mLogWindow.isVisible() ? 1 : 0); } private void onStopSelected() { // TODO } private void showRegisteredPage(Purpose purpose) { if (mExtraPages == null) { return; } Class<? extends UpdaterPage> clazz = null; for (Pair<Class<? extends UpdaterPage>, Purpose> extraPage : mExtraPages) { if (extraPage.getSecond() == purpose) { clazz = extraPage.getFirst(); break; } } if (clazz != null) { PageDialog d = new PageDialog(mShell, clazz, purpose == Purpose.SETTINGS); d.open(); } } private void onAvdManager() { ITaskFactory oldFactory = mUpdaterData.getTaskFactory(); try { AvdManagerWindowImpl1 win = new AvdManagerWindowImpl1( mShell, mUpdaterData, AvdInvocationContext.SDK_MANAGER); for (Pair<Class<? extends UpdaterPage>, Purpose> page : mExtraPages) { win.registerPage(page.getFirst(), page.getSecond()); } win.open(); } catch (Exception e) { mUpdaterData.getSdkLog().error(e, "AVD Manager window error"); } finally { mUpdaterData.setTaskFactory(oldFactory); } } // End of hiding from SWT Designer //$hide<<$ // ----- /** * Dialog used to display either the About page or the Settings (aka Options) page * with a "close" button. */ private class PageDialog extends SwtBaseDialog { private final Class<? extends UpdaterPage> mPageClass; private final boolean mIsSettingsPage; protected PageDialog( Shell parentShell, Class<? extends UpdaterPage> pageClass, boolean isSettingsPage) { super(parentShell, SWT.APPLICATION_MODAL, null /*title*/); mPageClass = pageClass; mIsSettingsPage = isSettingsPage; } @Override protected void createContents() { Shell shell = getShell(); setWindowImage(shell); GridLayoutBuilder.create(shell).columns(2); UpdaterPage content = UpdaterPage.newInstance( mPageClass, shell, SWT.NONE, mUpdaterData.getSdkLog()); GridDataBuilder.create(content).fill().grab().hSpan(2); if (content.getLayout() instanceof GridLayout) { GridLayout gl = (GridLayout) content.getLayout(); gl.marginHeight = gl.marginWidth = 0; } if (mIsSettingsPage && content instanceof ISettingsPage) { mSettingsController.setSettingsPage((ISettingsPage) content); } getShell().setText( String.format("%1$s - %2$s", APP_NAME, content.getPageTitle())); Label filler = new Label(shell, SWT.NONE); GridDataBuilder.create(filler).hFill().hGrab(); Button close = new Button(shell, SWT.PUSH); close.setText("Close"); GridDataBuilder.create(close); close.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { close(); } }); } @Override protected void postCreate() { // pass } @Override protected void close() { if (mIsSettingsPage) { mSettingsController.setSettingsPage(null); } super.close(); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
0da62506af268ecce3d3aadce0abc4c5a8d8448b
8d95df7cf774ba1704d0091d13620bacdb3a5847
/src/test/java/leetcode/dsa/medium/Q15_3SumTest.java
ece7638e973c1da55f851844bfce6c98d40d35d2
[]
no_license
nilotpalsrkr/PracticeAlgorithms
c49a3f43be1abfaf28b3858892ac393c006e8a88
3a26a85bf93e75bdf4d3944a4f073a6e449686ed
refs/heads/master
2023-04-29T10:05:46.742671
2021-05-21T07:55:36
2021-05-21T07:55:36
307,281,944
1
0
null
null
null
null
UTF-8
Java
false
false
432
java
package leetcode.dsa.medium; import org.junit.jupiter.api.Test; import java.util.List; import static org.junit.jupiter.api.Assertions.*; class Q15_3SumTest { @Test void threeSum() { int[] nums = {-5,-1,-2,-2,1,2,-1,4}; Q15_3Sum q15_3Sum = new Q15_3Sum(); List<List<Integer>> actual = q15_3Sum.threeSum(nums); System.out.println(actual); assertEquals(2, actual.size()); } }
[ "nilotpalsarkar@Nilotpals-MacBook-Pro.local" ]
nilotpalsarkar@Nilotpals-MacBook-Pro.local
cce3a4e468159f463aa6eee4785cd5d1d67645a8
3c451cbdabc3565d6f4268a3a6baa2271472b073
/TestList/src/testcollection/TestCollections.java
29388c7fb54acf225440c10120cb4dfd6cefe96c
[]
no_license
Ning-chuan/LearnJava
07127d98cd78afe83cc150998ec0e6e55469e1c9
dedb5b387fb4b61924e67f7c7def020d766a6f0d
refs/heads/master
2022-12-21T14:59:40.914589
2021-02-19T11:06:19
2021-02-19T11:06:19
227,118,863
0
0
null
2022-12-16T15:35:19
2019-12-10T12:45:47
JavaScript
UTF-8
Java
false
false
1,285
java
package testcollection; import org.junit.Test; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class TestCollections { /** * Collection和Collections的区别: * Collection是单列集合接口,List、Set等集合接口都是实现与它 * Collections是操作集合的工具类,它里面都是一些操作集合的静态工具方法 */ @Test public void test(){ //测试Collections拷贝方法: //源List List srcList = new ArrayList(); srcList.add(1111); srcList.add(33); srcList.add(55); srcList.add(66); srcList.add(999); srcList.add(456); //目标List //这个方法需要目标List的元素个数大于等于原数组 如果采用下面的方式新建目标数组会出如下异常 //List destList = new ArrayList();//IndexOutOfBoundsException: Source does not fit in dest //正确且便捷的方式: List destList = Arrays.asList(new Object[srcList.size()]); System.out.println("destList = " + destList); Collections.copy(destList,srcList); System.out.println("destList = " + destList); } }
[ "395378476@qq.com" ]
395378476@qq.com
33640b7917cb44218136bbf123ba5065d3fef089
fbedbeba3d69f4012e72189f58d969e556ab484f
/src/_05_Synchronized_Swimming/RobotExample5.java
1f7fd4aa12687acff1e206d5b75de6eb967248e1
[]
no_license
League-level5-Student/level5-01-threads-katherine55
8fed3d72c7f71dec5cc74a04183de270b5aed589
0682aaf2ce4ffa4a7de4aafd2f2c711bbe913e9b
refs/heads/master
2020-07-16T03:59:15.050039
2019-11-17T19:31:13
2019-11-17T19:31:13
205,714,195
0
0
null
null
null
null
UTF-8
Java
false
false
2,792
java
package _05_Synchronized_Swimming; import org.jointheleague.graphical.robot.Robot; import java.awt.*; public class RobotExample5 { private static final Object talkingStick = new Object(); private Robot vic = new Robot("vic"); private Robot june = new Robot("june"); private Runnable vicsPart = () -> { vic.moveTo(300, 300); firstMovement(vic); vicIsDone(); waitForJune(); secondMovement(vic); waitForJune(); vic.setSpeed(5); vic.move(-200); vic.hide(); }; private Runnable junesPart = () -> { june.moveTo(600, 300); waitForVic(); firstMovement(june); june.sleep(500); juneIsDone(); secondMovement(june); june.turn(180); june.sleep(500); juneIsDone(); june.setSpeed(5); june.move(200); june.hide(); }; public static void main(String[] args) { new RobotExample5().play(); } private void play() { Robot.setWindowColor(Color.WHITE); new Thread(vicsPart).start(); new Thread(junesPart).start(); } private void firstMovement(Robot robot) { robot.setSpeed(2); robot.setPenColor(Color.GRAY); robot.penUp(); robot.move(-10); robot.penDown(); robot.move(20); robot.penUp(); robot.move(-10); robot.turn(90); robot.move(-10); robot.penDown(); robot.move(20); robot.penUp(); robot.move(-10); robot.setSpeed(10); robot.turn(-144); robot.move(123); robot.turn(144); } private void secondMovement(Robot robot) { robot.setPenWidth(8); robot.penDown(); for (int i = 0; i < 10; i++) { robot.setRandomPenColor(); robot.move(200); robot.turn(108); } robot.penUp(); } private void waitForJune() { synchronized (talkingStick) { try { talkingStick.wait(); } catch (InterruptedException e) { assert false; // No interrupts expected } } } private void juneIsDone() { synchronized (talkingStick) { talkingStick.notify(); } } private void waitForVic() { synchronized (talkingStick) { try { talkingStick.wait(); } catch (InterruptedException e) { assert false; // No interrupts expected } } } private void vicIsDone() { synchronized (talkingStick) { talkingStick.notify(); } } }
[ "league@iMac-3.local" ]
league@iMac-3.local
4a36f327a4f25a76b84d789615a64eb1143d727e
02f9d6b218933ee87cba627b30f9e6faeb55ec41
/src/main/java/priv/cyx/java/multithreading04_volatile/NoVolatileDemo.java
207052f5fc713d2a1fb82daa2c1456b0dacf7d8c
[]
no_license
xyzwc110120/multithreading
acd2aedd1be9f38e7cab40bcf06eefe06ab87989
fdf277f36b1b9d924137f7bcfdabfdd2ac6b329e
refs/heads/master
2022-12-17T18:24:16.598231
2020-09-20T12:36:13
2020-09-20T12:36:13
297,072,229
0
0
null
null
null
null
UTF-8
Java
false
false
861
java
package priv.cyx.java.multithreading04_volatile; public class NoVolatileDemo { public static void main(String[] args) { RunnableThread thread = new RunnableThread(); new Thread(thread).start(); while (true) { if (thread.isFlag()) { System.out.println("结束循环。"); break; } } } } class RunnableThread implements Runnable { private boolean flag = false; public boolean isFlag() { return flag; } @Override public void run() { // 让线程睡眠 0.2 秒,使问题更容易出现 try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } flag = true; System.out.println(Thread.currentThread().getName() + ":" + flag); } }
[ "chenyuanxu@foxmail.com" ]
chenyuanxu@foxmail.com
b9a8e4b5f621b47dd1ccb676f7ac1c5685deda51
6b9676c11dff925fa80489b740581762f0cf86cd
/Project/src/test/java/it/polimi/ingsw/networktests/communication/FakeSimpleListenerClient.java
0343a1793276ba07124d341e672b858ff3c09ab8
[]
no_license
BorghettiMatteo/ing-sw-2019-Armillotta-Anese-Borghetti
1b8f05f6119143c2e7a6a4a605383dd0170e5425
8a4d5bf0debd453f02ba9aa27ac46029af9ed097
refs/heads/master
2022-11-22T04:10:10.053642
2020-07-03T21:47:51
2020-07-03T21:47:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,980
java
package it.polimi.ingsw.networktests.communication; import java.io.*; import java.net.Socket; import java.util.Scanner; public class FakeSimpleListenerClient { private String ip; private int port; boolean gameRunning; public void setGameIsRunning(boolean gameIsRunning) { this.gameRunning = gameIsRunning; } public boolean running() { return gameRunning; } public FakeSimpleListenerClient(String ip, int port) { this.ip = ip; this.port = port; } public void startClient() throws IOException { setGameIsRunning(true); Socket socket = new Socket(ip, port); System.out.println("Connection established"); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); PrintWriter printWriter = new PrintWriter(socket.getOutputStream()); Scanner stdin = new Scanner(System.in); try { while (running()) { String inputLine = stdin.nextLine(); if(inputLine.equals("quit")) { setGameIsRunning(false); } else { if (inputLine.equals("coords")) { oos.writeObject(new FakeCoordsEvent(stdin.nextInt(), stdin.nextInt())); oos.flush(); System.out.println("Flushed"); } else if (inputLine.equals("string")) { /* oos.writeObject(new CoordsEvent(stdin.nextInt(), stdin.nextInt())); oos.flush(); System.out.println("Flushed"); */ } //Event event = (Event) ois.readObject(); //event.eventMethod(); } } } finally { oos.close(); ois.close(); socket.close(); } } }
[ "61920704+AneseMarco@users.noreply.github.com" ]
61920704+AneseMarco@users.noreply.github.com
73f7af4a488f9f990eaa369350fa4f021861aae1
9d32980f5989cd4c55cea498af5d6a413e08b7a2
/A1_7_1_1/src/main/java/android/secrecy/ISecrecyService.java
92783f37d7b22b5265d5941e121788fafadffb01
[]
no_license
liuhaosource/OppoFramework
e7cc3bcd16958f809eec624b9921043cde30c831
ebe39acabf5eae49f5f991c5ce677d62b683f1b6
refs/heads/master
2023-06-03T23:06:17.572407
2020-11-30T08:40:07
2020-11-30T08:40:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
25,124
java
package android.secrecy; import android.content.pm.ActivityInfo; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.RemoteException; /* JADX ERROR: NullPointerException in pass: ExtractFieldInit java.lang.NullPointerException at jadx.core.utils.BlockUtils.isAllBlocksEmpty(BlockUtils.java:546) at jadx.core.dex.visitors.ExtractFieldInit.getConstructorsList(ExtractFieldInit.java:221) at jadx.core.dex.visitors.ExtractFieldInit.moveCommonFieldsInit(ExtractFieldInit.java:121) at jadx.core.dex.visitors.ExtractFieldInit.visit(ExtractFieldInit.java:46) at jadx.core.dex.visitors.ExtractFieldInit.visit(ExtractFieldInit.java:42) at jadx.core.dex.visitors.ExtractFieldInit.visit(ExtractFieldInit.java:42) at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:12) at jadx.core.ProcessClass.process(ProcessClass.java:32) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) */ public interface ISecrecyService extends IInterface { public static abstract class Stub extends Binder implements ISecrecyService { private static final String DESCRIPTOR = "android.secrecy.ISecrecyService"; static final int TRANSACTION_generateCipherFromKey = 3; static final int TRANSACTION_getSecrecyKey = 2; static final int TRANSACTION_getSecrecyState = 1; static final int TRANSACTION_isInEncryptedAppList = 6; static final int TRANSACTION_isSecrecySupport = 5; static final int TRANSACTION_registerSecrecyServiceReceiver = 4; private static class Proxy implements ISecrecyService { private IBinder mRemote; /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e8 in method: android.secrecy.ISecrecyService.Stub.Proxy.<init>(android.os.IBinder):void, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e8 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ Proxy(android.os.IBinder r1) { /* // Can't load method instructions: Load method exception: bogus opcode: 00e8 in method: android.secrecy.ISecrecyService.Stub.Proxy.<init>(android.os.IBinder):void, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.<init>(android.os.IBinder):void"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e5 in method: android.secrecy.ISecrecyService.Stub.Proxy.asBinder():android.os.IBinder, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e5 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public android.os.IBinder asBinder() { /* // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: android.secrecy.ISecrecyService.Stub.Proxy.asBinder():android.os.IBinder, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.asBinder():android.os.IBinder"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.generateCipherFromKey(int):byte[], dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public byte[] generateCipherFromKey(int r1) throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.generateCipherFromKey(int):byte[], dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.generateCipherFromKey(int):byte[]"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.getSecrecyKey(byte[]):boolean, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public boolean getSecrecyKey(byte[] r1) throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.getSecrecyKey(byte[]):boolean, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.getSecrecyKey(byte[]):boolean"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.getSecrecyState(int):boolean, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public boolean getSecrecyState(int r1) throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.getSecrecyState(int):boolean, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.getSecrecyState(int):boolean"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.isInEncryptedAppList(android.content.pm.ActivityInfo, java.lang.String, int, int):boolean, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public boolean isInEncryptedAppList(android.content.pm.ActivityInfo r1, java.lang.String r2, int r3, int r4) throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.isInEncryptedAppList(android.content.pm.ActivityInfo, java.lang.String, int, int):boolean, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.isInEncryptedAppList(android.content.pm.ActivityInfo, java.lang.String, int, int):boolean"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.isSecrecySupport():boolean, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public boolean isSecrecySupport() throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.isSecrecySupport():boolean, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.isSecrecySupport():boolean"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.registerSecrecyServiceReceiver(android.secrecy.ISecrecyServiceReceiver):boolean, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 11 more */ public boolean registerSecrecyServiceReceiver(android.secrecy.ISecrecyServiceReceiver r1) throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.Proxy.registerSecrecyServiceReceiver(android.secrecy.ISecrecyServiceReceiver):boolean, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.Proxy.registerSecrecyServiceReceiver(android.secrecy.ISecrecyServiceReceiver):boolean"); } public String getInterfaceDescriptor() { return Stub.DESCRIPTOR; } } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.<init>():void, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 10 more */ public Stub() { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.<init>():void, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.<init>():void"); } /* JADX ERROR: Method load error jadx.core.utils.exceptions.DecodeException: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int):boolean, dex: at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:118) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:248) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:254) at jadx.core.ProcessClass.process(ProcessClass.java:29) at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51) at java.lang.Iterable.forEach(Iterable.java:75) at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51) at jadx.core.ProcessClass.process(ProcessClass.java:37) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292) at jadx.api.JavaClass.decompile(JavaClass.java:62) at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200) Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1227) at com.android.dx.io.OpcodeInfo.getName(OpcodeInfo.java:1234) at jadx.core.dex.instructions.InsnDecoder.decode(InsnDecoder.java:581) at jadx.core.dex.instructions.InsnDecoder.process(InsnDecoder.java:74) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:104) ... 10 more */ public boolean onTransact(int r1, android.os.Parcel r2, android.os.Parcel r3, int r4) throws android.os.RemoteException { /* // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: android.secrecy.ISecrecyService.Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int):boolean, dex: */ throw new UnsupportedOperationException("Method not decompiled: android.secrecy.ISecrecyService.Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int):boolean"); } public static ISecrecyService asInterface(IBinder obj) { if (obj == null) { return null; } IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (iin == null || !(iin instanceof ISecrecyService)) { return new Proxy(obj); } return (ISecrecyService) iin; } public IBinder asBinder() { return this; } } byte[] generateCipherFromKey(int i) throws RemoteException; boolean getSecrecyKey(byte[] bArr) throws RemoteException; boolean getSecrecyState(int i) throws RemoteException; boolean isInEncryptedAppList(ActivityInfo activityInfo, String str, int i, int i2) throws RemoteException; boolean isSecrecySupport() throws RemoteException; boolean registerSecrecyServiceReceiver(ISecrecyServiceReceiver iSecrecyServiceReceiver) throws RemoteException; }
[ "dstmath@163.com" ]
dstmath@163.com
9539a1d72d9f6d8915ed878ca4251b084ffeafe7
ddda0bb78c5c0c3197ed2df5e892799683e71e73
/src/anys/HelloWorld.java
0bae8b07e1fe2bef1fcd70a5a50950bbd8c4c14c
[]
no_license
anys8152/Hellow
40512a3c994803caca34b0abd03c9c42f7f18e4a
0228dffb0da98e0165a9b62611705ec8fa161508
refs/heads/master
2022-08-26T00:44:54.642107
2020-05-22T06:49:59
2020-05-22T06:49:59
266,031,114
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package anys; public class HelloWorld{ public static void main(String[] args) { System.out.print("Hello, World!!"); } }
[ "anys8152@naver.om" ]
anys8152@naver.om
c8f0b69042499b391fcc663028f277a62a49059c
12dc9622d2c2205b6c936fb2b74ad8dc1d099a88
/src/main/java/com/et/auditServer/common/utils/HttpUtils.java
5d88808097ca997987535fe60ada009a3b20f805
[]
no_license
suetmuiwong/audit_server
9e0cccd30d1bc10a2addec721d2bc37382a2386a
1c611b75b9a03943ac80b13ef55c8b6684b4d7c2
refs/heads/master
2023-01-12T06:12:37.018229
2020-11-18T08:10:18
2020-11-18T08:10:18
311,189,737
0
0
null
null
null
null
UTF-8
Java
false
false
6,889
java
package com.et.auditServer.common.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.apache.http.*; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.nio.charset.Charset; import java.util.Map; public class HttpUtils { private final static Logger log = LoggerFactory.getLogger(HttpUtils.class); /** * get方式 * url 请求地址 * */ public static JSONObject doGet(String url, StringBuffer params){ // 获得Http客户端 CloseableHttpClient httpClient = HttpClientBuilder.create().build(); // 参数 /*StringBuffer params = new StringBuffer(); try { // 字符数据最好encoding以下;这样一来,某些特殊字符才能传过去(如:某人的名字就是“&”,不encoding的话,传不过去) params.append("name=" + URLEncoder.encode("&", "utf-8")); params.append("&"); params.append("age=24"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); }*/ // 创建Get请求 HttpGet httpGet = new HttpGet(url+ "?" + params); // 响应模型 CloseableHttpResponse response = null; try { // 配置信息 RequestConfig requestConfig = RequestConfig.custom() // 设置连接超时时间(单位毫秒) .setConnectTimeout(5000) // 设置请求超时时间(单位毫秒) .setConnectionRequestTimeout(5000) // socket读写超时时间(单位毫秒) .setSocketTimeout(5000) // 设置是否允许重定向(默认为true) .setRedirectsEnabled(true).build(); // 将上面的配置信息 运用到这个Get请求里 httpGet.setConfig(requestConfig); // 由客户端执行(发送)Get请求 response = httpClient.execute(httpGet); // 从响应模型中获取响应实体 HttpEntity responseEntity = response.getEntity(); if (responseEntity == null) { // log.error("microfile no response!"); return null; } String result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8")); if (StringUtils.isBlank(result)) { return null; } JSONObject resultObj = JSON.parseObject(result); if (resultObj.getInteger("code") != 0) { // log.error("microfile upload failed!"); return null; } return resultObj.getJSONObject("data"); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { // 释放资源 if (httpClient != null) { httpClient.close(); } if (response != null) { response.close(); } } catch (IOException e) { e.printStackTrace(); } } return null; } /** * post方式 * url 请求地址 * map 请求参数 * */ public static JSONArray psotUpload(String url, Map<String, Object> map) { CloseableHttpClient httpClient = HttpClients.createDefault(); try { CloseableHttpResponse httpResponse; HttpPost httpPost = new HttpPost(url); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); multipartEntityBuilder.setCharset(Charset.forName("UTF-8")); String fileName = ""; for (String key : map.keySet()) { if (map.get(key) instanceof String) { if ("userId".equals(key)) { multipartEntityBuilder.addPart("userId", new StringBody(String.valueOf(map.get(key)), ContentType.create("text/plain", Consts.UTF_8))); } else { multipartEntityBuilder.addTextBody(key, String.valueOf(map.get(key))); } } else if (map.get(key) instanceof MultipartFile) { MultipartFile file = (MultipartFile) map.get(key); fileName = file.getOriginalFilename(); multipartEntityBuilder.addBinaryBody(key, file.getInputStream(), ContentType.MULTIPART_FORM_DATA, fileName); } else { continue; } } HttpEntity httpEntity = multipartEntityBuilder.build(); httpPost.setEntity(httpEntity); httpResponse = httpClient.execute(httpPost); HttpEntity responseEntity = httpResponse.getEntity(); if (responseEntity == null) { log.error("microfile no response!"); return null; } String result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8")); log.info("file[" + fileName + "] microfile upload response: " + result); if (StringUtils.isBlank(result)) { log.error("microfile no response!"); return null; } JSONObject resultObj = JSON.parseObject(result); if (resultObj.getInteger("code") != 0) { log.error("microfile upload failed!"); return null; } return resultObj.getJSONArray("data"); } catch (Exception e) { e.printStackTrace(); return null; } finally { try { httpClient.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "huangxuemei@etonetech.com" ]
huangxuemei@etonetech.com
de0db3a80ca346a4c3464dceabce1b685be2d6c0
b4372033ac94fb0b3be475656f580906224c3026
/src/task3/DocumentWorker.java
15e031a02adef7463a8392a2853694cd58118122
[]
no_license
Bozhokmaria/JavaEssential_lesson03
5797a04b48b22ee715f134bc7f4710b448e3c26c
e13f0252d21a94eb25615c208dbc20627363cf47
refs/heads/master
2023-01-19T14:50:35.682973
2020-11-26T09:34:54
2020-11-26T09:34:54
316,183,264
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package task3; public class DocumentWorker { void openDocument(){ System.out.println("Doc open"); } void editDocument(){ System.out.println("Doc editting is allowed in pro version"); } void saveDocument(){ System.out.println("Doc saving is allowed in pro version"); } }
[ "bozhokmaria@gmail.com" ]
bozhokmaria@gmail.com
67eb76da7ac459730650bd5e22958664b400b391
fe181ef45ffcb510c2afa59e18596b93f5760963
/src/question_35/CopyComplexListNodes.java
d797cebce967b9837a37b8ac1d1b7e1f06a0b4a8
[]
no_license
JJJJJJJiYun/ForOfferJavaVersion
1c2a94f61c66dcfe29768299a64f4f13e8404124
b54a49005d269a2640395d9ef13bfa0c53513881
refs/heads/master
2020-06-17T19:16:40.484916
2019-08-31T16:56:37
2019-08-31T16:56:37
196,021,421
0
0
null
null
null
null
UTF-8
Java
false
false
1,763
java
package question_35; import structure.ComplexListNode; public class CopyComplexListNodes { /** * 复制复杂链表 */ private static ComplexListNode copyComplexListNodes(ComplexListNode head) { if (head == null) return null; ComplexListNode node = head; while (node != null) { ComplexListNode copyOfNode = new ComplexListNode(node.value); copyOfNode.next = node.next; node.next = copyOfNode; node = node.next.next; } node = head; while (node != null) { if (node.sibling != null) node.next.sibling = node.sibling.next; node = node.next.next; } node = head; ComplexListNode newHead = head.next; while (node.next.next != null) { ComplexListNode nextNode = node.next.next; ComplexListNode nextNewNode = node.next.next.next; node.next = nextNode; node.next.next = nextNewNode; node = nextNode; } node.next = null; return newHead; } public static void main(String[] args) { ComplexListNode node1 = new ComplexListNode(1); ComplexListNode node2 = new ComplexListNode(2); ComplexListNode node3 = new ComplexListNode(3); ComplexListNode node4 = new ComplexListNode(4); ComplexListNode node5 = new ComplexListNode(5); node1.next = node2; node1.sibling = node3; node2.next = node3; node2.sibling = node5; node3.next = node4; node4.next = node5; node4.sibling = node2; ComplexListNode newHead = copyComplexListNodes(node1); System.out.println(newHead.value); } }
[ "jy07171009@outlook.com" ]
jy07171009@outlook.com
f684c57b11981c4dd1e3c44fdae2ea304207af84
3e91e71323a043bd404203bd4d5efd9aae15b18e
/MyEclipseProject/LoggerDemo/src/com/zrf/log/ex/MyBiConsumer.java
60fb3bd582f3cb473479ba0ac4adb7266238be80
[]
no_license
ZhanXiaoFeng/MyProject
f5dc60612a0c644f3837192f4298bad68c2d927a
61ecfb266173e5dc7b283cb4fd5bc4a40912b6cd
refs/heads/master
2022-07-17T15:41:49.300176
2018-08-23T10:53:07
2018-08-23T10:53:07
141,031,392
1
0
null
2022-06-29T16:45:38
2018-07-15T13:54:32
JavaScript
UTF-8
Java
false
false
265
java
package com.zrf.log.ex; import java.util.function.BiConsumer; public class MyBiConsumer implements BiConsumer<Object, Object> { @Override public void accept(Object key, Object value) { System.out.println("Key=" + key + "\tvalue=" + value); } }
[ "444591845@qq.com" ]
444591845@qq.com
0cae18d192fa194dab0640a9d32fe53c715accdf
bc511ab9a30e8aac590cb2f189a9e47bc46c55ba
/dubbo/src/main/java/io/seata/samples/dubbo/service/impl/StorageServiceImpl.java
278413d73b2a6b05f61b9874d985e10d52ad6156
[]
no_license
imuxin/seata-dubbo-nacos-example
1e1aa7bb8d785279e96caa526b9214e77bccdebe
c971bf9d91aa8e0c381334d8c356cc66b22bb05f
refs/heads/main
2023-07-06T04:28:25.069931
2021-08-09T07:57:42
2021-08-09T07:58:19
393,896,842
0
0
null
null
null
null
UTF-8
Java
false
false
2,206
java
/* * Copyright 1999-2018 Alibaba Group Holding Ltd. * * 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 io.seata.samples.dubbo.service.impl; import java.util.List; import io.seata.core.context.RootContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; import io.seata.samples.dubbo.Storage; import io.seata.samples.dubbo.service.StorageService; /** * Please add the follow VM arguments: * <pre> * -Djava.net.preferIPv4Stack=true * </pre> */ public class StorageServiceImpl implements StorageService { private static final Logger LOGGER = LoggerFactory.getLogger(StorageService.class); private JdbcTemplate jdbcTemplate; /** * Sets jdbc template. * * @param jdbcTemplate the jdbc template */ public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @Override public void deduct(String commodityCode, int count) { LOGGER.info("Storage Service Begin ... xid: " + RootContext.getXID()); LOGGER.info("Deducting inventory SQL: update storage_tbl set count = count - {} where commodity_code = {}", count, commodityCode); jdbcTemplate.update("update storage_tbl set count = count - ? where commodity_code = ?", new Object[] {count, commodityCode}); LOGGER.info("Storage Service End ... "); } @Override public List<Storage> list() { LOGGER.info("List Storage Begin"); List<Storage> storages = jdbcTemplate.query("select * from storage_tbl", new Storage()); LOGGER.info("List Storage End"); return storages; } }
[ "chengqinglin@icloud.com" ]
chengqinglin@icloud.com
d3ae90dc66ae211cb119c8569ef5d40733d6503a
9126f063ad067de82bd6d273274bd71a9cd5d6d3
/corba/src/main/java/jp/co/csk/vdm/toolbox/api/corba/ToolboxAPI/ModuleStatusHolder.java
b9ba61d3862f3c1f68b996f5d91ee2a9fc442128
[]
no_license
overturetool/vdmtools
1988f864077b6d3f33aa0a77d94fbe035bd8e2e8
05f7394124ad8888c45d81ad4491a95d9a473971
refs/heads/master
2021-01-18T15:14:36.563396
2014-08-21T11:45:57
2014-08-21T11:45:57
null
0
0
null
null
null
null
SHIFT_JIS
Java
false
false
1,058
java
package jp.co.csk.vdm.toolbox.api.corba.ToolboxAPI; /** * jp/co/csk/vdm/toolbox/api/corba/ToolboxAPI/ModuleStatusHolder.java . * IDL-to-Java コンパイラ (ポータブル), バージョン "3.1" で生成 * 生成元: corba_api.idl * 2009年3月16日 10時22分53秒 JST */ public final class ModuleStatusHolder implements org.omg.CORBA.portable.Streamable { public jp.co.csk.vdm.toolbox.api.corba.ToolboxAPI.ModuleStatus value = null; public ModuleStatusHolder () { } public ModuleStatusHolder (jp.co.csk.vdm.toolbox.api.corba.ToolboxAPI.ModuleStatus initialValue) { value = initialValue; } public void _read (org.omg.CORBA.portable.InputStream i) { value = jp.co.csk.vdm.toolbox.api.corba.ToolboxAPI.ModuleStatusHelper.read (i); } public void _write (org.omg.CORBA.portable.OutputStream o) { jp.co.csk.vdm.toolbox.api.corba.ToolboxAPI.ModuleStatusHelper.write (o, value); } public org.omg.CORBA.TypeCode _type () { return jp.co.csk.vdm.toolbox.api.corba.ToolboxAPI.ModuleStatusHelper.type (); } }
[ "lausdahl@2b2d4d09-c93c-414a-ad04-6e973f5c1cff" ]
lausdahl@2b2d4d09-c93c-414a-ad04-6e973f5c1cff
d9ba415b285b7c9017473ce15443b2e9e2344c26
3a262f52360261acb61635cdc52bb48acede16dd
/reflection/src/main/java/ru/kuznetsoviv/generics/GenericExample.java
5918f5fdab243b95fe650c6d832b04f7db074ce6
[]
no_license
kuznetsoviv/javawork
b22290688467d1f42fc9e77ed7728ed2c5aa8047
e7e11c5c7869e079507c3e2eee23591fbc112dd6
refs/heads/master
2022-07-02T00:42:38.517092
2021-09-16T14:32:57
2021-09-16T14:32:57
189,828,755
0
0
null
2022-06-20T22:45:31
2019-06-02T09:39:47
Java
UTF-8
Java
false
false
1,338
java
package ru.kuznetsoviv.generics; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Map; public class GenericExample { public static void main(String[] args) throws Exception { Class<?> cl = GenericSimple.class; Method[] methods = cl.getMethods(); for (Method method : methods) { System.out.println("method: " + method.getName()); Class<?>[] pts = method.getParameterTypes(); for (Class clazz : pts) { System.out.println(clazz.getCanonicalName()); } } System.out.println("------------------------------------"); Method method = cl.getMethod("findSomething", Map.class); System.out.println(method.getName()); Type[] pts = method.getGenericParameterTypes(); for (Type clazz : pts) { System.out.println(clazz.getTypeName()); if (clazz instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) clazz; System.out.println("Parameterized"); System.out.println(parameterizedType.getActualTypeArguments()[0]); System.out.println(parameterizedType.getActualTypeArguments()[1]); } } } }
[ "kuznetsoviv1992@yandex.ru" ]
kuznetsoviv1992@yandex.ru
ce0a6adf399de0f3e84390fc5f7a86a30b6ce74a
1a9c264c25de47734a2c121f8420fa46adbc8dce
/codetips/src/concurrent/q4/TPEUseCase.java
54475d7912e4f1a5c317e69a7425de177ab88796
[ "BSD-2-Clause" ]
permissive
phat-zhong24/study-prj
ee206e087253147112a448c33872dca28de8d4de
06310a46f5a7e632f05858e58684752a54cadbd3
refs/heads/master
2023-05-14T18:47:30.807611
2021-06-08T06:58:59
2021-06-08T06:58:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,727
java
package concurrent.q4; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; /** * 线程池及 Future 用例 * * @author samin * @date 2021-01-08 */ public class TPEUseCase { static AtomicInteger atomicInteger = new AtomicInteger(1); public static void main(String[] args) throws ExecutionException, InterruptedException { // Callable 接口任务 需要 FutureTask,本方式和普通的代码执行方式一样,不能体现出线程异步方式 Callable<String> task = new CallableWorker(1, 2); FutureTask<String> ft = new FutureTask<>(task); new Thread(ft).start(); System.out.println(ft.get()); // 线程池,注意阻塞队列的容量配置,如果不指定数量,会一直增长,线程池将一直使用corePoolSize ExecutorService threadPool = new ThreadPoolExecutor( 10, 50, 10, TimeUnit.SECONDS, new LinkedBlockingDeque<>(10), (ThreadFactory) Thread::new); System.out.println("-------------------------------------------------------------------"); // 借助列表完成循环遍历先完成的线程,只有当异步执行完成,才进行线程阻塞返回结果 List<Future<String>> resList = new ArrayList<>(); for (int i = 0; i < 100; i = i + 2) { Integer x = i; Integer y = i + 1; Future<String> res = threadPool.submit(new CallableWorker(x, y)); resList.add(res); } while (!resList.isEmpty()) { Iterator<Future<String>> iterator = resList.iterator(); while (iterator.hasNext()) { Future<String> future = iterator.next(); if (future.isDone()) { System.out.println(future.get()); iterator.remove(); } } } threadPool.shutdown(); } /** 模拟计算50个计算任务 */ private static class CallableWorker implements Callable<String> { private final Integer x; private final Integer y; public CallableWorker(Integer x, Integer y) { this.x = x; this.y = y; } @Override public String call() throws Exception { Thread.sleep(new Random().nextInt(5) * 100); int seq = atomicInteger.getAndAdd(1); return "seq:" + seq + " ,x:" + x + " ,y:" + y + " ,sum:" + (x + y); } } }
[ "822085977@qq.com" ]
822085977@qq.com
94a1e921a0e7179cd3ec4928ca8f60e77f2f57ad
059de3e11a6c7513efffa9e4d08c90a73b855fa0
/farmmall-user-web/src/main/java/lpy/farmmall/web/controller/ProductController.java
9f3f9f753932374d28b19eaec1be5b0ca34dcffb
[]
no_license
jacklon/FarmMall
92a9fc38524f027d228b04e26f4dfba361d8b060
bcf69ca2e54fc8d6f5ad43d46355d4e2c8577544
refs/heads/master
2022-06-10T09:31:44.357446
2020-05-02T15:14:53
2020-05-02T15:14:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,893
java
package lpy.farmmall.web.controller; import com.alibaba.dubbo.config.annotation.Reference; import lpy.farmmall.bean.PmsBaseAttrInfo; import lpy.farmmall.bean.PmsProductInfo; import lpy.farmmall.bean.PmsSkuInfo; import lpy.farmmall.service.AttrService; import lpy.farmmall.service.SkuService; import lpy.farmmall.service.SpuService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; /** * @Author:刘平远 * @Date:2020/4/18 10:49 * @verson 1.0 **/ @Controller @CrossOrigin public class ProductController { @Reference AttrService attrService; @Reference SpuService spuService; @Reference SkuService skuService; @RequestMapping("/api/getAllProduct") @ResponseBody public List<PmsProductInfo> getProductName(){ List<PmsProductInfo> pmsProductInfos = spuService.getAllpmsinfo(); return pmsProductInfos; } //根据商品的3级分类,获取具体商品属性 @RequestMapping("/api/getAttrinfoList") @ResponseBody public List<PmsBaseAttrInfo> getAttrinfoList(@RequestBody PmsProductInfo p){ System.out.println("ca3id"+p.getCatalog3Id()); List<PmsBaseAttrInfo> pmsBaseAttrInfos=attrService.getAttrinfoList(p.getCatalog3Id()); return pmsBaseAttrInfos; } //根据商品的3级分类,获取具体商品属性 @RequestMapping("/api/getProductinfoList") @ResponseBody public List<PmsProductInfo> spuList(@RequestBody PmsProductInfo p){ List<PmsProductInfo> pmsProductInfos = spuService.spuList(p.getCatalog3Id()); return pmsProductInfos; } //商品搜索,显示下拉列表可供选择的商品 @RequestMapping("/api/getProductName") @ResponseBody public List<PmsProductInfo> getProName(@RequestBody PmsProductInfo p){ System.out.println(p.getProductName()); List<PmsProductInfo> productInfos=spuService.getInfoByName(p); return productInfos; } //根据spuid获取商品sku具体属性 @RequestMapping("/api/getSkuInfoBySpuId") @ResponseBody public List<PmsSkuInfo> getSkuInfoBySpuId(@RequestBody PmsSkuInfo skuInfo){ System.out.println(skuInfo.getProductId()); List<PmsSkuInfo> skuInfoslist=skuService.getSkuInfoBySpuId(skuInfo); return skuInfoslist; } //根据spuid获取商品sku具体属性 @RequestMapping("/api/getSkuInfoBySkuId") @ResponseBody public PmsSkuInfo getSkuInfoBySkuId(@RequestBody PmsSkuInfo skuInfo){ System.out.println("skuid:"+skuInfo.getId()); PmsSkuInfo skuInfo1=skuService.getSkuInfoBySkuId(skuInfo); return skuInfo1; } }
[ "895180451@qq.com" ]
895180451@qq.com
b15f951bdec16174a2d5cc1882c352605892d8bc
70f726345725b1c7753c9d3b5648d6d3a739d584
/app/src/main/java/com/hezaijin/advance/ui/fragment/ListDataFragment.java
13abb412f825291b7c619dad661cb9879598031f
[]
no_license
HandHaoZhang/advance
10a99388ca1c392eb41423fbaa7aebfc9cdc4f5f
d44bf017eae2ea334b3d3e1db4eb18fcf2cfa7ab
refs/heads/master
2021-01-10T17:45:41.741816
2016-03-22T10:35:59
2016-03-22T10:35:59
50,562,692
0
0
null
null
null
null
UTF-8
Java
false
false
5,187
java
package com.hezaijin.advance.ui.fragment; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.hezaijin.advance.R; import com.hezaijin.advance.base.BaseFragment; import com.hezaijin.advance.rest.RESTClient; import com.hezaijin.advance.rest.RESTParamsBuilder; import com.hezaijin.advance.rest.modle.CustomEvent; import com.hezaijin.advance.rest.modle.RequestListEventParams; import com.hezaijin.advance.rest.modle.ResponseListEvent; import com.hezaijin.advance.ui.adapter.ListDataAdapter; import com.hezaijin.advance.utils.CalendarUtils; import com.hezaijin.advance.widgets.view.progress.IndicatorView; import com.hezaijin.advance.widgets.view.ptr.load.PtrFootView; import java.util.Arrays; import java.util.List; import rx.Observable; import rx.Subscriber; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; import rx.functions.Func1; import rx.schedulers.Schedulers; /** * 历史上的今天事件列表 */ public class ListDataFragment extends BaseFragment { private static final String TAG = "ListDataFragment"; private int mCurrentMonth = -1; private int mCurrentDay = -1; private ListDataAdapter mAdapter; private ListView mListView; private IndicatorView mIndicator; public ListDataFragment() { super(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_listdata, null, false); mIndicator = (IndicatorView) view.findViewById(R.id.indicatior); mIndicator.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mIndicator.setSelectIndex((mIndicator.getSelectIndex() + 1)%mIndicator.getCount()); } }); mListView = (ListView) view.findViewById(R.id.list_view); mListView.setAdapter(mAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mIndicator.setCount(mIndicator.getCount() + 1); } }); View header = inflater.inflate(R.layout.header_list_data, null, false); mListView.addHeaderView(header); View foot = inflater.inflate(R.layout.foot_list_data, null, false); PtrFootView footView = (PtrFootView) foot.findViewById(R.id.foot); footView.onLoadMoreBackground(); mListView.addFooterView(foot); return view; } @Override public void onAttach(Context context) { super.onAttach(context); mAdapter = new ListDataAdapter(ListDataFragment.this); } public Subscription initSubscription() { // 有时候params的创建涉及到数据库操作,这时候在主线程构建params就会有影响了。 Subscription subscription = Observable.create(new Observable.OnSubscribe<RequestListEventParams>() { @Override public void call(Subscriber<? super RequestListEventParams> subscriber) { // 创建params mCurrentMonth = CalendarUtils.getCurMonth(); mCurrentDay = CalendarUtils.getCurDay(); RequestListEventParams params = RESTParamsBuilder.buildRequestListEventParams(mCurrentMonth, mCurrentDay); subscriber.onNext(params); subscriber.onCompleted(); subscriber.unsubscribe(); } }) .subscribeOn(Schedulers.newThread()) .flatMap(new Func1<RequestListEventParams, Observable<ResponseListEvent>>() { @Override public Observable<ResponseListEvent> call(RequestListEventParams params) { return RESTClient.queryListEvent(params); } }) .observeOn(Schedulers.io()) .map(new Func1<ResponseListEvent, List<CustomEvent>>() { @Override public List<CustomEvent> call(ResponseListEvent responseListEvent) { CustomEvent[] result = responseListEvent.getResult(); return Arrays.asList(result); } }) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<CustomEvent>>() { @Override public void call(List<CustomEvent> customEvents) { mAdapter.refresh(customEvents); } }); return subscription; } @Override protected Subscription getSubscription() { return initSubscription(); } @Override public void onResume() { super.onResume(); startAsyncOperation(); } @Override public void onPause() { super.onPause(); } }
[ "1376277145@qq.com" ]
1376277145@qq.com
5e40f2c92bbd5fd654b130745f8cbe7690ffc8a3
3d2531a4b24eb4800d82efbffa4ebf6476b8f818
/JavaSource/src/main/java/cn/xiaowenjie/services/ConfigService.java
fe50c23cb3aa1c89bcdff9862c133f85ab2a74ab
[ "Apache-2.0" ]
permissive
SZMOFEI/ElementVueSpringbootCodeTemplate
2ef124dd8b00d95879d4234753b2c928a41117ec
e9a4fe801e3a4e28fb9cb262f30dd4aebd32057f
refs/heads/master
2020-03-23T10:23:45.047274
2018-07-17T05:55:21
2018-07-17T05:55:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,198
java
package cn.xiaowenjie.services; import static cn.xiaowenjie.common.utils.CheckUtil.check; import static cn.xiaowenjie.common.utils.CheckUtil.notEmpty; import static cn.xiaowenjie.common.utils.CheckUtil.notNull; import java.util.Collection; import java.util.List; import cn.xiaowenjie.common.utils.UserUtil; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import com.google.common.collect.Lists; import cn.xiaowenjie.beans.Config; import cn.xiaowenjie.common.beans.PageResp; import cn.xiaowenjie.daos.ConfigDao; /** * 配置业务处理类 * * @author 肖文杰 https://github.com/xwjie/ */ @Service @Slf4j public class ConfigService { @Autowired ConfigDao dao; public Collection<Config> getAll() { // 校验通过后打印重要的日志 log.info("getAll start ..."); List<Config> data = Lists.newArrayList(dao.findAll()); log.info("getAll end, data size:" + data.size()); return data; } public long add(Config config) { // 参数校验 notNull(config, "param.is.null"); notEmpty(config.getName(), "name.is.null"); notEmpty(config.getValue(), "value.is.null"); // 校验通过后打印重要的日志 log.info("add config:" + config); // 校验重复 check(null == dao.findByName(config.getName()), "name.repeat"); config = dao.save(config); // 修改操作需要打印操作结果 log.info("add config success, id:" + config.getId()); return config.getId(); } /** * 根据id删除配置项 * * 管理员或者自己创建的才可以删除掉 * @param id * @return */ public boolean delete(long id) { Config config = dao.findOne(id); // 参数校验 check(config != null, "id.error", id); // 判断是否可以删除 check(canDelete(config), "no.permission"); dao.delete(id); // 修改操作需要打印操作结果 log.info("delete config success, id:" + id); return true; } /** * 自己创建的或者管理员可以删除数据 * 判断逻辑变化可能性大,抽取一个函数 * * @param config * @return */ private boolean canDelete(Config config) { return UserUtil.getUser().equals(config.getCreator()) || UserUtil.isAdmin(); } /** * 分页查找 * * @param pageable * @param keyword * @return */ public PageResp<Config> listPage(Pageable pageable, String keyword) { if (StringUtils.isEmpty(keyword)) { return new PageResp<Config>(dao.findAll(pageable)); } else { // 也可以用springjpa 的 Specification 来实现查找 return new PageResp<>(dao.findAllByKeyword(keyword, pageable)); } } public Config getByName(String name) { return dao.findByName(name); } }
[ "121509092@qq.com" ]
121509092@qq.com
49a29294d75ba10bfdc6cfebdd6f9bda63f1b55b
55fd6d231c66f420e4f8c0db135f37ce2e23a8f2
/park-common/src/main/java/com/park/cloud/common/domain/po/tra/TraMonthlyTicketListPOExample.java
f81e7abc632736be6d6b15d20144388a482109d1
[]
no_license
QianUser/park
0cc1e3c78595eca5537bdef85e9e2fecad329173
726879bb498f24be7b3399449b27c4547002607c
refs/heads/master
2023-02-02T19:28:02.689427
2020-11-27T11:15:11
2020-12-22T06:52:33
323,564,629
0
0
null
null
null
null
UTF-8
Java
false
false
93
java
package com.park.cloud.common.domain.po.tra; public class TraMonthlyTicketListPOExample { }
[ "1070599782@qq.com" ]
1070599782@qq.com
191f3e8e8c959f8454a2b63700e147a6cbd54059
c604dfc86cd02f9851b39eb1cf8731236c4308d1
/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestTest.java
bfd1d0f512f46b9e469e310e217d45f0b017d110
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
oilove/gcloud-java
8737f28b2664290c9b000a859c1af76a36014e42
249cac6d5093263a429336ac124f5380fafae2b0
refs/heads/master
2021-01-12T12:41:17.441562
2016-03-29T03:09:16
2016-03-29T03:09:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,505
java
/* * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.gcloud.dns; import static org.easymock.EasyMock.createStrictMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.reset; import static org.easymock.EasyMock.verify; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; public class ChangeRequestTest { private static final String ZONE_NAME = "dns-zone-name"; private static final ChangeRequestInfo CHANGE_REQUEST_INFO = ChangeRequest.builder() .add(RecordSet.builder("name", RecordSet.Type.A).build()) .delete(RecordSet.builder("othername", RecordSet.Type.AAAA).build()) .build(); private static final DnsOptions OPTIONS = createStrictMock(DnsOptions.class); private Dns dns; private ChangeRequest changeRequest; private ChangeRequest changeRequestPartial; @Before public void setUp() throws Exception { dns = createStrictMock(Dns.class); expect(dns.options()).andReturn(OPTIONS).times(2); replay(dns); changeRequest = new ChangeRequest(dns, ZONE_NAME, new ChangeRequestInfo.BuilderImpl( CHANGE_REQUEST_INFO.toBuilder() .startTimeMillis(132L) .id("12") .status(ChangeRequest.Status.DONE) .build())); changeRequestPartial = new ChangeRequest(dns, ZONE_NAME, new ChangeRequest.BuilderImpl(CHANGE_REQUEST_INFO)); reset(dns); } @After public void tearDown() throws Exception { verify(dns); } @Test public void testConstructor() { expect(dns.options()).andReturn(OPTIONS); replay(dns); assertEquals(new ChangeRequest(dns, ZONE_NAME, new ChangeRequestInfo.BuilderImpl(CHANGE_REQUEST_INFO)), changeRequestPartial); assertNotNull(changeRequest.dns()); assertEquals(ZONE_NAME, changeRequest.zone()); assertSame(dns, changeRequestPartial.dns()); assertEquals(ZONE_NAME, changeRequestPartial.zone()); } @Test public void testFromPb() { expect(dns.options()).andReturn(OPTIONS).times(2); replay(dns); assertEquals(changeRequest, ChangeRequest.fromPb(dns, ZONE_NAME, changeRequest.toPb())); assertEquals(changeRequestPartial, ChangeRequest.fromPb(dns, ZONE_NAME, changeRequestPartial.toPb())); } @Test public void testEqualsAndToBuilder() { expect(dns.options()).andReturn(OPTIONS).times(2); replay(dns); ChangeRequest compare = changeRequest.toBuilder().build(); assertEquals(changeRequest, compare); assertEquals(changeRequest.hashCode(), compare.hashCode()); compare = changeRequestPartial.toBuilder().build(); assertEquals(changeRequestPartial, compare); assertEquals(changeRequestPartial.hashCode(), compare.hashCode()); } @Test public void testBuilder() { // one for each build() call because it invokes a constructor expect(dns.options()).andReturn(OPTIONS).times(9); replay(dns); String id = changeRequest.id() + "aaa"; assertEquals(id, changeRequest.toBuilder().id(id).build().id()); ChangeRequest modified = changeRequest.toBuilder().status(ChangeRequest.Status.PENDING).build(); assertEquals(ChangeRequest.Status.PENDING, modified.status()); modified = changeRequest.toBuilder().clearDeletions().build(); assertTrue(modified.deletions().isEmpty()); modified = changeRequest.toBuilder().clearAdditions().build(); assertTrue(modified.additions().isEmpty()); modified = changeRequest.toBuilder().additions(ImmutableList.<RecordSet>of()).build(); assertTrue(modified.additions().isEmpty()); modified = changeRequest.toBuilder().deletions(ImmutableList.<RecordSet>of()).build(); assertTrue(modified.deletions().isEmpty()); RecordSet cname = RecordSet.builder("last", RecordSet.Type.CNAME).build(); modified = changeRequest.toBuilder().add(cname).build(); assertTrue(modified.additions().contains(cname)); modified = changeRequest.toBuilder().delete(cname).build(); assertTrue(modified.deletions().contains(cname)); modified = changeRequest.toBuilder().startTimeMillis(0L).build(); assertEquals(Long.valueOf(0), modified.startTimeMillis()); } @Test public void testApplyTo() { expect(dns.applyChangeRequest(ZONE_NAME, changeRequest)).andReturn(changeRequest); expect(dns.applyChangeRequest(ZONE_NAME, changeRequest, Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.START_TIME))) .andReturn(changeRequest); replay(dns); assertSame(changeRequest, changeRequest.applyTo()); assertSame(changeRequest, changeRequest.applyTo(Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.START_TIME))); } }
[ "derka@google.com" ]
derka@google.com
71620049173a092ad0883e3d876164e4efb689b3
191a45ca36235b5a526611ab0a72fcae48ce9413
/alpaca/alpaca-core/src/main/java/net/vdrinkup/alpaca/configuration/IConfiguration.java
118957b37bb2736433450b96310859a37f176879
[]
no_license
uudragon/services
b29d040697aea3dc0f7ce4ca174d70f3b33beb27
396cd217b4304088456c1ca10e785491ff78bde6
refs/heads/master
2021-01-23T07:21:08.272546
2014-04-25T15:28:21
2014-04-25T15:28:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
/******************************************************************************* * Copyright (c) 2013 JD Corporation and others. * * Contributors: * JD Corporation *******************************************************************************/ package net.vdrinkup.alpaca.configuration; import net.vdrinkup.alpaca.Named; /** * 可配置接口 * <p></p> * @author liubing * Date Nov 10, 2013 */ public interface IConfiguration extends Named { }
[ "pluto.bing.liu@gmail.com" ]
pluto.bing.liu@gmail.com
cfc395d4b7e2d666fbd7ca07c2f100e68cb0ed08
0f4293993c4fcf610d811be06077461b6ad9477c
/IntegerArrayList/src/test/howard/edu/sycs363/spring15/lab4/IntegerArrayListTest.java
2de21a440cc6f2aa2cad434f26973b06766f94ac
[]
no_license
JesseNwankwo/JesseNwankwo.github.sycs363.lab6
a01b4c4b990ef9f5a310496ad4d69372130a2116
5354667210d228f15966a34dd25c04f18087d24f
refs/heads/master
2020-12-24T17:17:03.898574
2015-04-02T23:56:58
2015-04-02T23:56:58
33,332,024
0
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
package test.howard.edu.sycs363.spring15.lab4; import static org.junit.Assert.*; import howard.edu.sycs363.spring15.lab4.IntegerArrayList; import org.junit.Test; public class IntegerArrayListTest { @Test public void testAddInt() { IntegerArrayList tester = new IntegerArrayList(); tester.add(1); // Tests assertEquals(1, tester.get(0)); fail("Not yet implemented"); } @Test public void testAddIntInt() { IntegerArrayList tester = new IntegerArrayList(); tester.add(1); tester.add(2); tester.add(0,3); tester.add(1,4); assertEquals(3, tester.get(0)); fail("Not yet implemented"); } @Test public void testGet() { IntegerArrayList tester = new IntegerArrayList(); tester.add(1); tester.add(2); tester.add(3); // Tests assertEquals(2, tester.get(2)); fail("Not yet implemented"); } @Test public void testIndexOf() { IntegerArrayList tester = new IntegerArrayList(); tester.add(1); tester.add(2); tester.add(3); assertEquals(3, tester.indexOf(2)); fail("Not yet implemented"); } @Test public void testIsEmpty() { IntegerArrayList tester = new IntegerArrayList(); assertTrue(tester.isEmpty()); fail("Not yet implemented"); } @Test public void testDelete_Num() { IntegerArrayList tester = new IntegerArrayList(3); tester.add(10); tester.add(20); tester.add(30); assertEquals(20, tester.delete_Num(0)); fail("Not yet implemented"); } }
[ "jessenwake@gmail.com" ]
jessenwake@gmail.com
279accfcc1bcd2c359c6731d17e1935523d50e26
e3109a079793c5a66891aebef6dd7c2a44f8d360
/base/java/j/a/a/a/a/a/a.java
ccd2d77dd0c3b6650f3ce14bd04843b530d68dd7
[]
no_license
msorland/no.simula.smittestopp
d5a317b432e8a37c547fc9f2403f25db78ffd871
f5eeba1cc4b1cad98b8174315bb2b0b388d14be9
refs/heads/master
2022-04-17T12:50:10.853188
2020-04-17T10:14:01
2020-04-17T10:14:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,431
java
package j.a.a.a.a.a; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.SystemClock; import j.a.a.a.a.a.k; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; public abstract class a { public static a a; public static synchronized a a() { synchronized (a.class) { if (a != null) { a aVar = a; return aVar; } else if (Build.VERSION.SDK_INT >= 26) { d dVar = new d(); a = dVar; return dVar; } else if (Build.VERSION.SDK_INT >= 23) { c cVar = new c(); a = cVar; return cVar; } else { b bVar = new b(); a = bVar; return bVar; } } } public abstract void a(g gVar); public abstract void a(List<h> list, k kVar, g gVar, Handler handler); public final void b(g gVar) { if (gVar != null) { c(gVar); return; } throw new IllegalArgumentException("callback is null"); } public abstract void c(g gVar); /* renamed from: j.a.a.a.a.a.a$a reason: collision with other inner class name */ public static class C0087a { public final Object a = new Object(); public final boolean b; /* renamed from: c reason: collision with root package name */ public final boolean f1446c; /* renamed from: d reason: collision with root package name */ public final boolean f1447d; /* renamed from: e reason: collision with root package name */ public boolean f1448e; /* renamed from: f reason: collision with root package name */ public final List<h> f1449f; /* renamed from: g reason: collision with root package name */ public final k f1450g; /* renamed from: h reason: collision with root package name */ public final g f1451h; /* renamed from: i reason: collision with root package name */ public final Handler f1452i; /* renamed from: j reason: collision with root package name */ public final List<j> f1453j = new ArrayList(); /* renamed from: k reason: collision with root package name */ public final Set<String> f1454k = new HashSet(); /* renamed from: l reason: collision with root package name */ public final Map<String, j> f1455l = new HashMap(); public final Runnable m = new C0088a(); public final Runnable n = new b(); /* renamed from: j.a.a.a.a.a.a$a$a reason: collision with other inner class name */ public class C0088a implements Runnable { public C0088a() { } public void run() { C0087a aVar = C0087a.this; if (!aVar.f1448e) { aVar.b(); C0087a aVar2 = C0087a.this; aVar2.f1452i.postDelayed(this, aVar2.f1450g.B); } } } /* renamed from: j.a.a.a.a.a.a$a$b */ public class b implements Runnable { /* renamed from: j.a.a.a.a.a.a$a$b$a reason: collision with other inner class name */ public class C0089a implements Runnable { public final /* synthetic */ j x; public C0089a(j jVar) { this.x = jVar; } public void run() { C0087a.this.f1451h.a(4, this.x); } } public b() { } public void run() { long elapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos(); synchronized (C0087a.this.a) { Iterator<j> it = C0087a.this.f1455l.values().iterator(); while (it.hasNext()) { j next = it.next(); if (next.A < elapsedRealtimeNanos - C0087a.this.f1450g.H) { it.remove(); C0087a.this.f1452i.post(new C0089a(next)); } } if (!C0087a.this.f1455l.isEmpty()) { C0087a.this.f1452i.postDelayed(this, C0087a.this.f1450g.I); } } } } public C0087a(boolean z, boolean z2, List<h> list, k kVar, g gVar, Handler handler) { this.f1449f = Collections.unmodifiableList(list); this.f1450g = kVar; this.f1451h = gVar; this.f1452i = handler; boolean z3 = false; this.f1448e = false; this.f1447d = kVar.A != 1 && (!(Build.VERSION.SDK_INT >= 23) || !kVar.G); this.b = !list.isEmpty() && (!z2 || !kVar.E); long j2 = kVar.B; if (j2 > 0 && (!z || !kVar.F)) { z3 = true; } this.f1446c = z3; if (z3) { handler.postDelayed(this.m, j2); } } public void a() { this.f1448e = true; this.f1452i.removeCallbacksAndMessages((Object) null); synchronized (this.a) { this.f1455l.clear(); this.f1454k.clear(); this.f1453j.clear(); } } public void b() { if (this.f1446c && !this.f1448e) { synchronized (this.a) { this.f1451h.a((List<j>) new ArrayList(this.f1453j)); this.f1453j.clear(); this.f1454k.clear(); } } } public void a(int i2, j jVar) { boolean isEmpty; j put; if (this.f1448e) { return; } if (this.f1449f.isEmpty() || a(jVar)) { String address = jVar.x.getAddress(); if (this.f1447d) { synchronized (this.f1455l) { isEmpty = this.f1455l.isEmpty(); put = this.f1455l.put(address, jVar); } if (put == null && (this.f1450g.A & 2) > 0) { this.f1451h.a(2, jVar); } if (isEmpty && (this.f1450g.A & 4) > 0) { this.f1452i.removeCallbacks(this.n); this.f1452i.postDelayed(this.n, this.f1450g.I); } } else if (this.f1446c) { synchronized (this.a) { if (!this.f1454k.contains(address)) { this.f1453j.add(jVar); this.f1454k.add(address); } } } else { this.f1451h.a(i2, jVar); } } } public void a(List<j> list) { if (!this.f1448e) { if (this.b) { ArrayList arrayList = new ArrayList(); for (j next : list) { if (a(next)) { arrayList.add(next); } } list = arrayList; } this.f1451h.a(list); } } /* JADX WARNING: Removed duplicated region for block: B:82:0x00fb A[SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public final boolean a(j.a.a.a.a.a.j r21) { /* r20 = this; r0 = r20 r1 = r21 java.util.List<j.a.a.a.a.a.h> r2 = r0.f1449f java.util.Iterator r2 = r2.iterator() L_0x000a: boolean r3 = r2.hasNext() r4 = 0 if (r3 == 0) goto L_0x00ff java.lang.Object r3 = r2.next() j.a.a.a.a.a.h r3 = (j.a.a.a.a.a.h) r3 r5 = 0 if (r3 == 0) goto L_0x00fe r6 = 1 if (r1 != 0) goto L_0x001f goto L_0x00fb L_0x001f: android.bluetooth.BluetoothDevice r7 = r1.x java.lang.String r8 = r3.y if (r8 == 0) goto L_0x0031 java.lang.String r7 = r7.getAddress() boolean r7 = r8.equals(r7) if (r7 != 0) goto L_0x0031 goto L_0x00fb L_0x0031: j.a.a.a.a.a.i r7 = r1.y if (r7 != 0) goto L_0x0047 java.lang.String r8 = r3.x if (r8 != 0) goto L_0x00fb android.os.ParcelUuid r8 = r3.z if (r8 != 0) goto L_0x00fb byte[] r8 = r3.F if (r8 != 0) goto L_0x00fb byte[] r8 = r3.C if (r8 == 0) goto L_0x0047 goto L_0x00fb L_0x0047: java.lang.String r8 = r3.x if (r8 == 0) goto L_0x0055 java.lang.String r9 = r7.f1471f boolean r8 = r8.equals(r9) if (r8 != 0) goto L_0x0055 goto L_0x00fb L_0x0055: android.os.ParcelUuid r8 = r3.z if (r8 == 0) goto L_0x00c1 android.os.ParcelUuid r9 = r3.A java.util.List<android.os.ParcelUuid> r10 = r7.b if (r10 != 0) goto L_0x0060 goto L_0x00bd L_0x0060: java.util.Iterator r10 = r10.iterator() L_0x0064: boolean r11 = r10.hasNext() if (r11 == 0) goto L_0x00bd java.lang.Object r11 = r10.next() android.os.ParcelUuid r11 = (android.os.ParcelUuid) r11 if (r9 != 0) goto L_0x0074 r12 = r5 goto L_0x0078 L_0x0074: java.util.UUID r12 = r9.getUuid() L_0x0078: java.util.UUID r13 = r8.getUuid() java.util.UUID r11 = r11.getUuid() if (r12 != 0) goto L_0x0087 boolean r11 = r13.equals(r11) goto L_0x00b9 L_0x0087: long r14 = r13.getLeastSignificantBits() long r16 = r12.getLeastSignificantBits() long r14 = r14 & r16 long r16 = r11.getLeastSignificantBits() long r18 = r12.getLeastSignificantBits() long r16 = r16 & r18 int r18 = (r14 > r16 ? 1 : (r14 == r16 ? 0 : -1)) if (r18 == 0) goto L_0x00a0 goto L_0x00b8 L_0x00a0: long r13 = r13.getMostSignificantBits() long r15 = r12.getMostSignificantBits() long r13 = r13 & r15 long r15 = r11.getMostSignificantBits() long r11 = r12.getMostSignificantBits() long r11 = r11 & r15 int r15 = (r13 > r11 ? 1 : (r13 == r11 ? 0 : -1)) if (r15 != 0) goto L_0x00b8 r11 = 1 goto L_0x00b9 L_0x00b8: r11 = 0 L_0x00b9: if (r11 == 0) goto L_0x0064 r8 = 1 goto L_0x00be L_0x00bd: r8 = 0 L_0x00be: if (r8 != 0) goto L_0x00c1 goto L_0x00fb L_0x00c1: android.os.ParcelUuid r8 = r3.B if (r8 == 0) goto L_0x00de if (r7 == 0) goto L_0x00de byte[] r9 = r3.C byte[] r10 = r3.D java.util.Map<android.os.ParcelUuid, byte[]> r11 = r7.f1469d if (r11 != 0) goto L_0x00d1 r8 = r5 goto L_0x00d7 L_0x00d1: java.lang.Object r8 = r11.get(r8) byte[] r8 = (byte[]) r8 L_0x00d7: boolean r8 = r3.a(r9, r10, r8) if (r8 != 0) goto L_0x00de goto L_0x00fb L_0x00de: int r8 = r3.E if (r8 < 0) goto L_0x00fa if (r7 == 0) goto L_0x00fa byte[] r9 = r3.F byte[] r10 = r3.G android.util.SparseArray<byte[]> r7 = r7.f1468c if (r7 != 0) goto L_0x00ed goto L_0x00f3 L_0x00ed: java.lang.Object r5 = r7.get(r8) byte[] r5 = (byte[]) r5 L_0x00f3: boolean r3 = r3.a(r9, r10, r5) if (r3 != 0) goto L_0x00fa goto L_0x00fb L_0x00fa: r4 = 1 L_0x00fb: if (r4 == 0) goto L_0x000a return r6 L_0x00fe: throw r5 L_0x00ff: return r4 */ throw new UnsupportedOperationException("Method not decompiled: j.a.a.a.a.a.a.C0087a.a(j.a.a.a.a.a.j):boolean"); } } public final void a(List<h> list, k kVar, g gVar) { List<h> list2; a aVar; k kVar2; long j2; long j3; g gVar2 = gVar; if (gVar2 != null) { Handler handler = new Handler(Looper.getMainLooper()); if (list != null) { list2 = list; } else { list2 = Collections.emptyList(); } if (kVar != null) { aVar = this; kVar2 = kVar; } else { if (0 == 0 && 0 == 0) { j3 = 500; j2 = 4500; } else { j3 = 0; j2 = 0; } aVar = this; kVar2 = new k(0, 1, 0, 1, 3, true, 255, true, true, true, 10000, 10000, j3, j2, (k.a) null); } aVar.a(list2, kVar2, gVar2, handler); return; } throw new IllegalArgumentException("callback is null"); } }
[ "djkaty@users.noreply.github.com" ]
djkaty@users.noreply.github.com
7fdcb1f5ac92c2ea5aab0a0994a3a795845b05d6
774bade75cc23c7c38d14cfa536b80a7799d2b22
/OcrParser/src/main/java/org/innoagencyhack/ocrparser/extractors/scans/models/MatOfPointComparator.java
dedfb774dd20177f558256dbb61a04bcca2e6c95
[]
no_license
basalovyurij/innoagency-hack
72164e48f1cbeb9b9b20abc546bcb23da6cb7936
67de0406395685c0518c3cee7e6364d41ff36832
refs/heads/main
2023-01-06T12:49:25.861814
2020-10-31T16:11:37
2020-10-31T16:11:37
308,722,532
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package org.innoagencyhack.ocrparser.extractors.scans.models; import java.util.Comparator; import org.opencv.core.MatOfPoint; import org.opencv.imgproc.Imgproc; public class MatOfPointComparator implements Comparator<MatOfPoint> { @Override public int compare(MatOfPoint prev, MatOfPoint next) { double prevArea = Imgproc.contourArea(prev); double nextArea = Imgproc.contourArea(next); return (int) (nextArea - prevArea); } }
[ "basalov_yurij@mail.ru" ]
basalov_yurij@mail.ru
2e450639e68f1d32e11a4f848c46a20b266b0873
f2a0945afad3f4b8e014c54a8b00435e9d944e0a
/src/main/java/tfar/reciperandomizer/mixin/RecipeManagerMixin.java
d9d8ef42b644b40232e92dacf262228ec3934d41
[ "Unlicense" ]
permissive
Tfarcenim/RecipeRandomizers
a1e086f9530830573abde99b137a923707a2452c
3026bd157ee1e556a88511e8d4a14c8b380b6682
refs/heads/master
2021-06-30T23:35:32.878533
2021-06-11T21:39:40
2021-06-11T21:39:40
241,726,630
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package tfar.reciperandomizer.mixin; import com.google.gson.JsonObject; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipeType; import net.minecraft.item.crafting.RecipeManager; import net.minecraft.profiler.IProfiler; import net.minecraft.resources.IResourceManager; import net.minecraft.util.ResourceLocation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import tfar.reciperandomizer.MixinHooks; import java.util.Map; @Mixin(RecipeManager.class) public class RecipeManagerMixin { @Shadow private Map<IRecipeType<?>, Map<ResourceLocation, IRecipe<?>>> recipes; @Inject(method = "apply",at = @At("RETURN")) public void scrambleRecipes(Map<ResourceLocation, JsonObject> splashList, IResourceManager resourceManagerIn, IProfiler profilerIn, CallbackInfo ci){ recipes = MixinHooks.scramble(recipes); } }
[ "44327798+Gimpler@users.noreply.github.com" ]
44327798+Gimpler@users.noreply.github.com
4e89e02d3b05ca1b78dfa9da15581337a5246537
3a59bd4f3c7841a60444bb5af6c859dd2fe7b355
/sources/com/google/android/gms/internal/ads/zzbvm.java
6a2a80100e2dbb7a03fc3e73cfbf266b04c70a00
[]
no_license
sengeiou/KnowAndGo-android-thunkable
65ac6882af9b52aac4f5a4999e095eaae4da3c7f
39e809d0bbbe9a743253bed99b8209679ad449c9
refs/heads/master
2023-01-01T02:20:01.680570
2020-10-22T04:35:27
2020-10-22T04:35:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package com.google.android.gms.internal.ads; final /* synthetic */ class zzbvm implements zzbtu { static final zzbtu zzfka = new zzbvm(); private zzbvm() { } public final void zzr(Object obj) { ((zzahy) obj).zzrr(); } }
[ "joshuahj.tsao@gmail.com" ]
joshuahj.tsao@gmail.com
0b2ab038454ff99b71f48eae8f96698042094e36
fcc262d1f57a6f0d32ad9819e6e5200e7fa53518
/lib/src/main/java/com/github/artyomcool/chione/Named.java
53444ef86fde4b506552786fc150c7775d19d9d2
[]
no_license
Artyomcool/Chione
da435182182b4c524319191279b3a8e9ee072647
87ba32a723f91a2ca170fa0b2241ba5093e866a6
refs/heads/master
2020-03-23T18:12:59.615122
2018-09-10T08:00:31
2018-09-10T08:00:31
141,895,928
2
0
null
null
null
null
UTF-8
Java
false
false
1,267
java
/* * The MIT License * * Copyright (c) 2018 Artyom Drozdov (https://github.com/artyomcool) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.github.artyomcool.chione; public interface Named { String chioneName(); }
[ "artyomcool@yandex-team.ru" ]
artyomcool@yandex-team.ru
5fadb22f9e6b50cf067d90a04e2337c69a051a41
f1c3d5d595f97384a105fd89031a21057fff7c92
/examples/com/mellanox/jxio/tests/benchmarks/StatMain.java
a69d786cebd073b579a791a1f66b120ec4239499
[]
no_license
yangshun2532/JXIO
8ff35cf8995d9b34b955a543199794a2eb45be87
34509f09a6973611b26baa5bbd01a1572667d516
refs/heads/master
2021-05-01T18:45:26.084848
2014-11-08T08:43:36
2014-11-08T08:43:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.mellanox.jxio.tests.benchmarks; public class StatMain { public static void main(String[] args) { if (args.length < 3) { System.out.println("StatMain $IP $PORT $NUM_SESSIONS"); return; } Runnable test = new StatTest(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2])); test.run(); } }
[ "katyak@mellanox.com" ]
katyak@mellanox.com
03ee486b7a9bc0d594a6f4c1d1b361681f028a76
672a90ec789facfef42577f63cf2300e38848987
/app/src/main/java/kimxu/newsandfm/model/Game.java
5af4872fd16319e0ea53a899f7645a4a4514d62b
[]
no_license
Kimxu/NewsAndFm
d6d336c0b62338133e88bf00f7da15bc779a5cdf
2486207e9feb3b2e53613c5e4acba7359bc3f24e
refs/heads/master
2021-01-10T16:43:58.255233
2015-12-03T13:52:05
2015-12-03T13:52:05
46,541,328
3
1
null
2015-12-09T05:58:31
2015-11-20T05:23:20
Java
UTF-8
Java
false
false
128
java
package kimxu.newsandfm.model; public class Game { public int iconResId; public String name; public String like; }
[ "kimxu@163.com" ]
kimxu@163.com
35b16ac743e13c70877f5c10da0fa9de18b40083
ab011d3181134a299346ab660e8b4706f5137a43
/basetech-app/app/src/main/java/com/example/basetech/app/crud/annotation/CRUDSelectAll.java
b9965f3cba179759b9e4bda15e7cf2ad11fb4b4d
[]
no_license
zhanght86/xcloud_dev
06941bc3c37c611c18f8ea0f1dae28334068f66b
2c1990da7ecffbca3ef46d54e53f742d16e90e09
refs/heads/master
2021-06-05T14:05:50.887218
2016-09-24T10:03:42
2016-09-24T10:03:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.example.basetech.app.crud.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface CRUDSelectAll { }
[ "wangjiawei.huawei@gmail.com" ]
wangjiawei.huawei@gmail.com
e158c54d15c074a7e62b6c94817e1100761240cc
c0a82ab7e16aa0b9bd5498a85760ba3aec549bbe
/src/com/exer/Test1.java
d39307601a9d1673071909eb885071965013caa6
[]
no_license
gaidada/jdbc_1
f2e30a0827f7a4e21701d39730fc83bdc350676f
3471f52b1b58810ad020e32f477f5698510d40e4
refs/heads/master
2023-03-27T00:09:37.669253
2021-03-27T14:11:08
2021-03-27T14:11:08
352,089,451
0
0
null
null
null
null
UTF-8
Java
false
false
1,647
java
package com.exer; import com.util.JDBCUtils; import org.junit.Test; import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Scanner; public class Test1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("输入用户名:"); String name = scanner.next(); System.out.print("输入邮箱:"); String email = scanner.next(); System.out.print("输入生日:"); String birthday = scanner.next(); String sql = "insert into customers (name,email,birth) values (?,?,?)"; int insertCount = update(sql, name, email, birthday); if (insertCount > 0) { System.out.println("添加成功"); } else { System.out.println("添加失败"); } } public static int update(String sql, Object... args) {//sql中占位符的个数与可变形参的长度相同 Connection conn = null; PreparedStatement ps = null; try { //1.获取数据库的连接 conn = JDBCUtils.getConnection(); //2.预编译sql语句,返回PreparedStatement的实例 ps = conn.prepareStatement(sql); //3.填充占位符 for (int i = 0; i < args.length; i++) { ps.setObject(i + 1, args[i]);//!!!! } //4.执行 return ps.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { //5.关闭资源 JDBCUtils.closetResource(conn, ps); } return 0; } }
[ "923111528@qq.com" ]
923111528@qq.com
c5c0c585beef31ef65c354f1c2d4d0e009c04a90
58bdf35ca315767def65d92688f65a94975ebcfd
/04App/LogIn/app/src/main/java/com/example/login/RegisterActivity.java
9940046d2441c1ab5f4c7b888ffbbca5b84b3094
[]
no_license
ulife1779/2020homework-yml
a5e02e7eceae0b9a0796f506f00a2abdbddba3cb
0f165ae7fb78cc3daf82e4e3d54c20a32728f7c6
refs/heads/main
2023-02-02T23:58:16.788577
2020-12-18T14:17:15
2020-12-18T14:17:15
319,596,325
0
0
null
null
null
null
UTF-8
Java
false
false
2,876
java
package com.example.login; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.login.bean.UserInfo; import com.example.login.database.UserDBHelper; public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{ private UserDBHelper mHelper; // 声明一个用户数据库帮助器的对象 private EditText id_phone;//姓名 private EditText id_password;//手机号 private EditText id_name;//密码 private Button btn_register;//注册 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); id_phone = findViewById(R.id.id_phone); id_password = findViewById(R.id.id_password); id_name=findViewById(R.id.id_name); btn_register=findViewById(R.id.btn_register); btn_register.setOnClickListener(this); } @Override protected void onResume() { super.onResume(); // 获得用户数据库帮助器的一个实例 mHelper = UserDBHelper.getInstance(this, 2); // 恢复页面,则打开数据库连接 mHelper.openWriteLink(); } @Override protected void onPause() { super.onPause(); // 暂停页面,则关闭数据库连接 mHelper.closeLink(); } @Override public void onClick(View v) { if (v.getId() == R.id.btn_register){ UserInfo infocheck = mHelper.queryByPhone(id_phone.getText().toString()); if (infocheck != null) { Toast.makeText(this, "该账户存在", Toast.LENGTH_SHORT).show(); return; } String name=id_name.getText().toString(); String phone = id_phone.getText().toString(); String password =id_password.getText().toString(); UserInfo info = new UserInfo(); info.name=name; info.phone = phone; info.pwd = password; if (phone.length() < 11) { // 手机号码不足11位 Toast.makeText(this, "请输入正确的手机号", Toast.LENGTH_SHORT).show(); return; } if (password.length() < 8) { //密码需要6位 Toast.makeText(this, "请输入8位密码", Toast.LENGTH_SHORT).show(); return; } Toast.makeText(this, "注册成功", Toast.LENGTH_SHORT).show(); // 执行数据库帮助器的插入操作 mHelper.insert(info); Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); } } }
[ "1009669357@qq.com" ]
1009669357@qq.com
2b675246cd3164c4200d5d6d67cfae6d4e0784b4
2246623d541429e693930ac7ac71b265dae7e08e
/src/com/gmail/filoghost/ultrahardcore/utils/TeamMaker.java
c03528dfa99573613dba19e38d6c2ac230ffaa32
[ "BSD-2-Clause" ]
permissive
UnfireGames/UltraHardcore
578ea78c419cf049009bf5bdcabccf639bbf40c5
245f50430140d83960842a80d2f47db2b0e5f8c3
refs/heads/master
2022-04-11T17:16:45.616765
2020-04-01T14:31:55
2020-04-01T14:31:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,325
java
/* * Copyright (c) 2020, Wild Adventure * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * 4. Redistribution of this software in source or binary forms shall be free * of all charges or fees to the recipient of this software. * * 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 HOLDER 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 com.gmail.filoghost.ultrahardcore.utils; import java.util.Iterator; import java.util.List; import java.util.Set; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import com.gmail.filoghost.ultrahardcore.player.Team; import com.gmail.filoghost.ultrahardcore.player.TeamPreference; import com.google.common.collect.Lists; import com.google.common.collect.Sets; public class TeamMaker { private static final String PREFERENCES_NOT_RESPECTED = ChatColor.RED + "[Team] " + ChatColor.GRAY + "Spiacente, non è stato possibile rispettare del tutto le tue preferenze su con chi stare in team."; // Restituisce tutti i team creati public static Set<Team> assignTeams(int teamsSize, List<TeamPreference> preferences, List<Player> freePlayers) { List<Team> initialFullTeams = Lists.newArrayList(); // Questi sono i team completi dell'inizio List<Team> fullTeams = Lists.newArrayList(); // I team completi MA che sono stati formati dal metodo List<Team> partialTeams = Lists.newArrayList(); // I team incompleti for (TeamPreference preference : preferences) { if (preference.getMembers().size() >= teamsSize) { initialFullTeams.add(new Team(preference.getMembers())); } else { partialTeams.add(new Team(preference.getMembers())); } } System.out.println("----------- STATUS INIZIALE --------"); System.out.println("Initial complete teams: " + initialFullTeams.toString()); System.out.println("Complete teams: " + fullTeams.toString()); System.out.println("Partial: " + partialTeams.toString()); System.out.println("Free: " + freePlayers.toString()); System.out.println("------------------------------------"); // Cerca di unire i team liberi for (int i = 0; i < 100; i++) { // Tentativi per unire i team piccoli boolean changedSomething = false; for (Team partialTeam : partialTeams) { for (Team otherPartialTeam : partialTeams) { if (partialTeam != otherPartialTeam && !partialTeam.isEmpty() && !otherPartialTeam.isEmpty()) { if (partialTeam.size() + otherPartialTeam.size() <= teamsSize) { changedSomething = true; partialTeam.absorbTeam(otherPartialTeam); // Traferisce i giocatori all'altro team } } } } Iterator<Team> partialTeamsIter = partialTeams.iterator(); while (partialTeamsIter.hasNext()) { Team partialTeam = partialTeamsIter.next(); if (partialTeam.isEmpty()) { // Toglie i team vuoti partialTeamsIter.remove(); } else if (partialTeam.size() >= teamsSize) { // Trasferisce i team completi nella lista dei completi partialTeamsIter.remove(); fullTeams.add(partialTeam); } } if (!changedSomething) { break; } } // Cerca di assegnare i giocatori soli Iterator<Player> freeIter = freePlayers.iterator(); while (freeIter.hasNext()) { Player freePlayer = freeIter.next(); if (partialTeams.isEmpty()) { // Crea un nuovo team parziale, non ce ne sono abbastanza! partialTeams.add(new Team(freePlayer)); freeIter.remove(); continue; } // Riempe prima più team possibili, cercando i più grandi Team biggestPartial = findBiggest(partialTeams, null); biggestPartial.add(freePlayer); if (biggestPartial.size() >= teamsSize) { partialTeams.remove(biggestPartial); fullTeams.add(biggestPartial); } } // E adesso cerchiamo di sistemare tutti i team parziali rimasti, che sono i più piccoli while (!isNumberOfTeamsFine(fullTeams, partialTeams, teamsSize)) { if (partialTeams.size() <= 1) { // C'è rimasto solo un team parziale, tutti gli altri quindi sono completi ed è ok break; } Team smallest = findSmallest(partialTeams, null); Iterator<Player> smallestIter = smallest.getMembers().iterator(); // Separa il team piccolo per unirlo ai più grandi while (smallestIter.hasNext()) { Player spreadPlayer = smallestIter.next(); Team biggest = findBiggest(partialTeams, smallest); // Esclude il team più piccolo, IMPORTANTE! if (biggest != smallest) { smallestIter.remove(); biggest.add(spreadPlayer); spreadPlayer.sendMessage(PREFERENCES_NOT_RESPECTED); if (biggest.size() >= teamsSize) { partialTeams.remove(biggest); fullTeams.add(biggest); } } } if (smallest.isEmpty()) { partialTeams.remove(smallest); } } while (!partialTeams.isEmpty() && teamsSize - findSmallest(partialTeams, null).size() > 1) { // Necessita di giocatori Team smallest = findSmallest(partialTeams, null); Team biggestPartial = findBiggest(partialTeams, null); if (smallest != biggestPartial && biggestPartial.size() - smallest.size() > 1) { // Usiamo un team parziale Player removed = biggestPartial.removeLast(); removed.sendMessage(PREFERENCES_NOT_RESPECTED); smallest.add(removed); continue; } // Prendiamo dei giocatori dai team completi MA che sono stati formati da noi if (fullTeams.isEmpty()) { if (initialFullTeams.isEmpty()) { break; // Non si può fare nulla } // Siamo costretti a prenderlo da qui Team team = initialFullTeams.remove(0); fullTeams.add(team); } Team teamToCut = fullTeams.remove(0); partialTeams.add(teamToCut); Player removed = teamToCut.removeLast(); removed.sendMessage(PREFERENCES_NOT_RESPECTED); smallest.add(removed); } System.out.println("----------- STATUS FINALE ----------"); System.out.println("Initial complete teams: " + initialFullTeams.toString()); System.out.println("Complete teams: " + fullTeams.toString()); System.out.println("Partial: " + partialTeams.toString()); System.out.println("Free: " + freePlayers.toString()); System.out.println("------------------------------------"); for (Team team : initialFullTeams) { team.setAsTeamForMembers(); } for (Team team : fullTeams) { team.setAsTeamForMembers(); } for (Team team : partialTeams) { team.setAsTeamForMembers(); } Set<Team> allTeams = Sets.newHashSet(); allTeams.addAll(initialFullTeams); allTeams.addAll(fullTeams); allTeams.addAll(partialTeams); return allTeams; } /** * * Metodi di utilità * */ private static boolean isNumberOfTeamsFine(List<Team> fullTeams, List<Team> partialTeams, int teamsSize) { int totalPlayersCount = 0; for (Team team : fullTeams) { totalPlayersCount += team.size(); } for (Team team : partialTeams) { totalPlayersCount += team.size(); } int teamsAmount = fullTeams.size() + partialTeams.size(); int minimumAmountOfTeams = totalPlayersCount / teamsSize; if (totalPlayersCount % teamsSize > 0) { minimumAmountOfTeams++; } return teamsAmount <= minimumAmountOfTeams; } private static Team findSmallest(List<Team> teams, Team excluded) { Team smallest = null; for (Team team : teams) { if (excluded != null && excluded == team) { continue; } if (smallest == null) { smallest = team; } else { if (team.size() < smallest.size()) { smallest = team; } } } return smallest; } private static Team findBiggest(List<Team> teams, Team excluded) { Team biggest = null; for (Team team : teams) { if (excluded != null && excluded == team) { continue; } if (biggest == null) { biggest = team; } else { if (team.size() > biggest.size()) { biggest = team; } } } return biggest; } }
[ "admin@wildadventure.it" ]
admin@wildadventure.it
8d2640f73ea615cafc5e8c3c9cf4e37c1b51b6f5
3f4d6944a1140a38c39cbf65d40019e5ae2854f4
/pohimoisted/src/LuxBurger.java
563a28236160a8f1c75a49e80a5a3ad289fbb20d
[]
no_license
riinahaidkind/oop_java-1
344faac2fb23c8546fbd95e907cf8f254d66507f
69c5e05c6728b98bf4dfa9f957d08b7d1f4c31b9
refs/heads/master
2020-04-09T23:07:52.153973
2018-12-06T07:43:59
2018-12-06T07:43:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
823
java
public class LuxBurger extends Burger{ public LuxBurger() { super("LuxBurger", "Steik", "Valge sai", 10.0); super.valiLisand1("Frii-Kartul", 2.0); super.valiLisand2("Jook", 2.5); } @Override public void valiLisand1(String lisand1, Double lisand1Hind) { System.out.println("Lisandi valimine ei ole võimalik"); } @Override public void valiLisand2(String lisand2, Double lisand2Hind) { System.out.println("Lisandi valimine ei ole võimalik"); } @Override public void valiLisand3(String lisand3, Double lisand3Hind) { System.out.println("Lisandi valimine ei ole võimalik"); } @Override public void valiLisand4(String lisand4, Double lisand4Hind) { System.out.println("Lisandi valimine ei ole võimalik"); } }
[ "anna.karutina@khk.ee" ]
anna.karutina@khk.ee
f3f97a268c7c6bb523e2d34b0a2521f96fbfefc3
31ae04ca497f5a851a821dd37efc1a509ad4c590
/SGCVModelo/src/main/java/com/sgcv/dto/CostoDTO.java
009f428399d66c0fc7a1bc715b405dc8fdacbb03
[]
no_license
noeHernandezG/Proyecto-SGCV
bda48466d1b20a7b0d8d0cc0efa55cdd0b077a9f
5beece763304f9e18c0703c6ab979e1b68f918bf
refs/heads/master
2020-04-11T23:19:37.881351
2019-02-11T20:03:41
2019-02-11T20:03:41
162,163,320
0
0
null
null
null
null
UTF-8
Java
false
false
2,801
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sgcv.dto; /** * * @author Ernesto */ public class CostoDTO { private Integer idCosto; private Integer kilometrajeInicial; private Integer kilometrajeFinal; private Integer litrosGastados; private String calculoRendimiento; private Integer dieselCargado; private Integer casetas; private Integer comision; private Integer viaticos; private Integer otros; private ServiciosDTO idServicio; private Integer refacciones; public Integer getRefacciones() { return refacciones; } public void setRefacciones(Integer refacciones) { this.refacciones = refacciones; } public Integer getIdCosto() { return idCosto; } public void setIdCosto(Integer idCosto) { this.idCosto = idCosto; } public Integer getKilometrajeInicial() { return kilometrajeInicial; } public void setKilometrajeInicial(Integer kilometrajeInicial) { this.kilometrajeInicial = kilometrajeInicial; } public Integer getKilometrajeFinal() { return kilometrajeFinal; } public void setKilometrajeFinal(Integer kilometrajeFinal) { this.kilometrajeFinal = kilometrajeFinal; } public Integer getLitrosGastados() { return litrosGastados; } public void setLitrosGastados(Integer litrosGastados) { this.litrosGastados = litrosGastados; } public String getCalculoRendimiento() { return calculoRendimiento; } public void setCalculoRendimiento(String calculoRendimiento) { this.calculoRendimiento = calculoRendimiento; } public Integer getDieselCargado() { return dieselCargado; } public void setDieselCargado(Integer dieselCargado) { this.dieselCargado = dieselCargado; } public Integer getCasetas() { return casetas; } public void setCasetas(Integer casetas) { this.casetas = casetas; } public Integer getComision() { return comision; } public void setComision(Integer comision) { this.comision = comision; } public Integer getViaticos() { return viaticos; } public void setViaticos(Integer viaticos) { this.viaticos = viaticos; } public Integer getOtros() { return otros; } public void setOtros(Integer otros) { this.otros = otros; } public ServiciosDTO getIdServicio() { return idServicio; } public void setIdServicio(ServiciosDTO idServicio) { this.idServicio = idServicio; } }
[ "noe_5991@hotmail.com" ]
noe_5991@hotmail.com
533d9f2a0b68e39bc5dedd5d5a20d87e6ca6d233
9397fa04dd00109b703906aa1409d26b7a9102ca
/src/com/example/Main.java
a88ff613d6004be0662f6185ee64bb1c607c0f4e
[]
no_license
jafarmou4/farsi-to-english
ccfb67b930592b7db653d805df6d0b0ef15527f6
c6271b093fa8a7b7938392bb052fad4127e6367d
refs/heads/master
2022-12-16T00:21:31.275458
2020-09-20T03:39:02
2020-09-20T03:39:02
296,995,342
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package com.example; import java.math.BigDecimal; import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; public class Main { public static void main(String[] args) { String farsi = "٠٠٠١١٠١١۴۵٠٠٨٧۶١۴۵٠٠٨٧۶"; // String farsi = "101211012154555455"; String english = new BigDecimal("9" + farsi).toString().replaceFirst("9", ""); // int num = Integer.parseInt(farsi); System.out.println("9" + farsi); System.out.println(english); // System.out.println(num); // System.out.println(getUSNumber(farsi)); String body = "{\\\"karshenasiID\\\": " + 4376 + "}"; System.out.println(body); } private static String getUSNumber(String Numtoconvert){ NumberFormat formatter = NumberFormat.getInstance(Locale.US); try { if(Numtoconvert.contains("٫")) Numtoconvert=formatter.parse(Numtoconvert.split("٫")[0].trim())+"."+formatter.parse(Numtoconvert.split("٫")[1].trim()); else Numtoconvert=formatter.parse(Numtoconvert).toString(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return Numtoconvert; } }
[ "jafarmou4work@gmail.com" ]
jafarmou4work@gmail.com
216142a80156082822d59f8032cde6af148170f6
4d92e5140182d2a537ed03376091859f0b1e5746
/PrintTot4.java
b433b8d34be0270dde0c6f7ce577a48f6e3ac5aa
[]
no_license
lth9710/secondproject
80c5a6b8549e5bcbe81a48b1d4f0cbd98f71a021
b496eb4d165d6478e4a81b3daea7b13e41b258fd
refs/heads/master
2020-04-07T12:30:00.198048
2018-11-20T10:21:00
2018-11-20T10:21:00
158,370,222
0
0
null
null
null
null
WINDOWS-1253
Java
false
false
808
java
package com.project2; public class PrintTot4 extends Thread { @Override public void run() { try { System.out.println(" ΆΛ ΆΛ"); sleep(300); System.out.println(" ΆΛ ΆΛ"); sleep(300); System.out.println(" ΆΛ ΆΛ"); sleep(300); System.out.println(" ΆΛ ΆΛ"); sleep(300); System.out.println(" ΆΛ ΆΛ"); sleep(300); System.out.println(" ΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛΆΛ"); sleep(300); } catch (Exception e) { // TODO: handle exception } } }
[ "lth9710@naver.com" ]
lth9710@naver.com
b0fe633eca22eeed6228fd2af7ed197a0f907d26
40c961d3127a7dd6b541c7b77a6517d61b75415b
/src/com/bean/JogosCategoriaBean.java
9f524884ea64a2af0164598cfb8c3881bdc9ac70
[]
no_license
alvinobarboza/Malvino
4a380e315d1cc54a62642f652b54f204f2849880
972a0351303c5ec3db34f4dfc8bd553051c5a468
refs/heads/master
2021-08-23T02:40:22.219844
2017-12-02T16:19:38
2017-12-02T16:19:38
103,747,713
0
2
null
2017-09-27T02:32:37
2017-09-16T11:40:10
HTML
ISO-8859-1
Java
false
false
5,528
java
package com.bean; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import com.dao.CategoriasDAO; import com.model.JogosCategoria; import com.model.Jogos; import com.model.Categorias; import com.dao.JogosCategoriaDAO; import com.dao.JogosDAO; @ManagedBean @SessionScoped public class JogosCategoriaBean extends BaseBean implements IBO, ICRUDBean { private Jogos jogos; private JogosDAO jogosDAO; private Categorias Categorias; private CategoriasDAO CategoriasDAO; private JogosCategoria jogosCategoria; private JogosCategoriaDAO JogosCategoriaDAO; private List<Jogos> listJogos; private List<Categorias> listCategorias; private List<JogosCategoria> listJogosCategorias; private int codigoJogo; private int codigoCategoria; public Jogos getJogos() { if(jogos == null) jogos = new Jogos(); return jogos; } public void setJogos(Jogos jogos) { this.jogos = jogos; } public JogosDAO getJogosDAO() { if(jogosDAO == null) jogosDAO = new JogosDAO(); return jogosDAO; } public void setJogosDAO(JogosDAO jogosDAO) { this.jogosDAO = jogosDAO; } public JogosCategoria getJogosCategoria() { if(jogosCategoria == null) jogosCategoria = new JogosCategoria(); return jogosCategoria; } public void setJogosCategoria(JogosCategoria jogosCategoria) { this.jogosCategoria = jogosCategoria; } public JogosCategoriaDAO getJogosCategoriaDAO() { if (JogosCategoriaDAO == null) JogosCategoriaDAO = new JogosCategoriaDAO(); return JogosCategoriaDAO; } public void setJogosCategoriaDAO(JogosCategoriaDAO jogosCategoriaDAO) { JogosCategoriaDAO = jogosCategoriaDAO; } public List<Jogos> getListJogos() { if(listJogos == null){ listJogos = getJogosDAO().getBeans(); } return listJogos; } public List<JogosCategoria> getListJogosCategorias() { if(listJogosCategorias == null) listJogosCategorias = getJogosCategoriaDAO().getBeans(); return listJogosCategorias; } public Categorias getCategorias() { if (Categorias == null) Categorias = new Categorias(); return Categorias; } public void setCategorias(Categorias Categorias) { this.Categorias = Categorias; } public CategoriasDAO getCategoriasDAO() { if (CategoriasDAO == null) CategoriasDAO = new CategoriasDAO(); return CategoriasDAO; } public void setCategoriasDAO(CategoriasDAO CategoriasDAO) { this.CategoriasDAO = CategoriasDAO; } public List<Categorias> getListCategorias() { if(listCategorias == null) listCategorias = getCategoriasDAO().getBeans(); return listCategorias; } public void setListCategorias(List<Categorias> listCategorias) { this.listCategorias = listCategorias; } public int getCodigoJogo() { return codigoJogo; } public void setCodigoJogo(int codigo) { this.codigoJogo = codigo; } public int getCodigoCategoria() { return codigoCategoria; } public void setCodigoCategoria(int codigo) { this.codigoCategoria = codigo; } public void listJogosCategoria(){ listJogosCategorias = getJogosCategoriaDAO().getBeans(); } public void listJogos(){ listJogos = getJogosDAO().getBeans(); } public void listCategorias(){ listCategorias = getCategoriasDAO().getBeans(); } @Override public void find() { try { if (codigoJogo != 0 && codigoCategoria != 0) jogosCategoria = getJogosCategoriaDAO().getBeanID(codigoJogo,codigoCategoria); else jogosCategoria = new JogosCategoria(); } catch (Exception e) { showError("Erro ao tentar selecionar."); } finally { cleanMessageFlags(); } } @Override public void list() { } @Override public void delete() { try { existDependences(); if (isMessageError() == false) { getJogosCategoriaDAO().excluir(jogosCategoria); getJogosCategoriaDAO().commit(); showInfo("Dados excluidos com sucesso."); } } catch (Exception e) { getJogosCategoriaDAO().rollback(); showError("Erro ao excluir: " + e.getMessage()); } finally { cleanMessageFlags(); } } @Override public void edit() { try { validateModel(); if (isMessageError() == false && isMessageAlert() == false) { getJogosCategoriaDAO().atualizar(jogosCategoria); getJogosCategoriaDAO().commit(); showInfo("Dados atualizados com sucesso."); } } catch (Exception e) { getJogosCategoriaDAO().rollback(); showError("Erro ao atualizar: " + e.getMessage()); } finally { cleanMessageFlags(); } } @Override public void save() { try { validateModel(); validateRule(); if (isMessageError() == false && isMessageAlert() == false) { getJogosCategoriaDAO().salvar(jogosCategoria); getJogosCategoriaDAO().commit(); showInfo("Dados salvos com sucesso."); } } catch (Exception e) { getJogosCategoriaDAO().rollback(); showError("Erro ao salvar: " + e.getMessage()); } finally { cleanMessageFlags(); } } @Override public void validateRule() { } @Override public void validateModel() { if (getJogosCategoria().getJogos().getIdJogo() == 0) showAlert("Jogo não foi selecionado"); if (getJogosCategoria().getCategorias().getIdCategoria() == 0) showAlert("Categoria não foi selecionado"); } @Override public void existDependences() { // TODO Auto-generated method stub } }
[ "32014216+alvinobarboza@users.noreply.github.com" ]
32014216+alvinobarboza@users.noreply.github.com
caef7335f29dcf4208fb2dad4a986f72e5b5136d
323efc30a998ad1cb1720bf04cce9a0cdd3af2c9
/JSFramework/src/test/java/com/application/organizationpages/OrganizationPage.java
45bba63d4fcbf174be38d673fc044a2fffcee382
[]
no_license
qashack/jsproject
b21cd521879e4733c7aa37e908123e3e3c92f5aa
52d21d0709e04d904ae2a6efb036ef22d7964286
refs/heads/master
2021-01-11T20:59:20.386016
2017-01-19T09:17:19
2017-01-19T09:17:19
79,224,178
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package com.application.organizationpages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import com.application.generics.BasePage; import com.application.libraries.JavascriptLibrary; public class OrganizationPage extends BasePage{ WebDriver driver; @FindBy(css="div[title='Companies']") private WebElement companiesIcon; public OrganizationPage(WebDriver driver) { super(driver); this.driver=driver; PageFactory.initElements(driver, this); } public void clickCompaniesIcon(){ JavascriptLibrary.javascriptScrollWindow(driver, 0, 0); companiesIcon.click(); } }
[ "chandrashekar@qashack.com" ]
chandrashekar@qashack.com
a3f66fac5530afd12f8db83e83266f0c4288f1a2
8e6a266d73f2cc7c6f84ebfb18a69f3c5631a846
/app/src/main/java/com/example/ismail/discreteproblems/bs.java
40fb7984b404083aa9dda47ae93f9c862eb4460e
[]
no_license
SabirKhanAkash/Discrete-Math-Android-App
9c649cfd444bff0b6c7f4ce530cbe1eff329692e
afcca9ff1da6b5cc7c77596f95bf07bc21050d8a
refs/heads/master
2022-02-01T07:29:30.793957
2022-01-02T09:19:12
2022-01-02T09:19:12
234,896,075
1
0
null
null
null
null
UTF-8
Java
false
false
2,284
java
package com.example.ismail.discreteproblems; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class bs extends AppCompatActivity { ListView listView; String[] chapter = {"Discrete Mathematics and Its Application (7th Edition) -By Kenneth H. Rosen","Solution of the above book","Slides on Discrete Mathematics"}; ArrayAdapter<String> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bs); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); listView = (ListView) findViewById(R.id.bslistid); adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,android.R.id.text1,chapter); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(getBaseContext(),parent.getItemAtPosition(position)+" is selected",Toast.LENGTH_SHORT).show(); if(position==0) { Intent intent1 = new Intent(view.getContext(),dmbook.class); startActivityForResult(intent1,0); } if(position==1) { Intent intent2 = new Intent(view.getContext(),dmbooksol.class); startActivityForResult(intent2,0); } if(position==2) { Intent intent = new Intent(view.getContext(),dmslide.class); startActivityForResult(intent,0); } } }); } @Override public boolean onOptionsItemSelected (MenuItem item) { if(item.getItemId() == android.R.id.home) finish(); return super.onOptionsItemSelected(item); } }
[ "39434260+SabirKhanAkash@users.noreply.github.com" ]
39434260+SabirKhanAkash@users.noreply.github.com
df80d339b7dff30339473bcf3491ce8c040ad3ed
79095b9361e1a3247ea666b7d4d184f154f2d6ea
/src/main/java/com/iboarding/demo/model/doc_master.java
34665149ac159a8e974374476192090b577dfcf6
[]
no_license
yasasvy/project-backend-
7a3382b4d5dd9370b335be8936eeb07c1e24b201
ca91088fa9118b79d8fe6fe18489ebe779909db4
refs/heads/main
2023-08-14T14:26:17.231783
2021-10-18T03:28:13
2021-10-18T03:28:13
418,330,091
0
0
null
null
null
null
UTF-8
Java
false
false
906
java
package com.iboarding.demo.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "doc_master") public class doc_master{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int pkgid; private String doctype; public doc_master() { super(); // TODO Auto-generated constructor stub } public doc_master(int pkgid, String doctype) { super(); this.pkgid = pkgid; this.doctype = doctype; } @Override public String toString() { return "doc_master [pkgid=" + pkgid + ", doctype=" + doctype + "]"; } public int getPkgid() { return pkgid; } public void setPkgid(int pkgid) { this.pkgid = pkgid; } public String getDoctype() { return doctype; } public void setDoctype(String doctype) { this.doctype = doctype; } }
[ "guntur.yasasvy@gmail.com" ]
guntur.yasasvy@gmail.com
e95c90bfdc4cc20ea062d91cd2dfbb5326a6e4df
f4a9516d40b3bc4c8ca56ae23786f3d1e094225b
/be/ephec/mvc_v2/Person.java
4bd7c1a5d39410e6b8c18e421942d554afb3f1e7
[]
no_license
mnvro/java2018ephec
d6284fa6ed3ef869e40d7867106e03cd5f0225bf
51750556af2a358c68655cf12679a66a0bfff2d8
refs/heads/master
2020-04-06T09:49:42.847655
2018-11-14T09:12:48
2018-11-14T09:12:48
157,358,206
0
0
null
null
null
null
ISO-8859-1
Java
false
false
846
java
package be.ephec.mvc_v2; import java.util.Observable; /** * @author Marie-Noël Vroman * Cette classe contient les données * Elle est observable * */ public class Person extends Observable { private double height; private double mass; /** * @return the person's BMI (Body Mass Index) */ public double getBMI(){ return mass/(height*height); } public double getMass() { return mass; } public void setHeight(double height) { this.height = height; } public void setMass(double mass) { this.mass = mass; this.setChanged(); this.notifyObservers(); } public Person(){ } /** * @param height the person's height in m * @param mass the person's mass in kg */ public Person(double height, double mass) { this.height = height; this.mass = mass; } }
[ "mnvro@hotmail.com" ]
mnvro@hotmail.com
22cf9dfb01a5363b6af2077296cc24e8128bb542
7dd72cd0cedba93b6ba0fa664670057690458006
/app/src/main/java/com/bob/flyboymvp/util/TimeUtils.java
ecd5020feb3a5c5c3b6b71f486f949ecc8c9b2e5
[]
no_license
flybo/mindeeper
6e9a0b43155312307ff8f22542227dffd886b302
7a3c1543b8ce4503a4b2d8a83af1ff8d547f8388
refs/heads/master
2021-08-28T00:21:05.839491
2018-10-12T02:23:21
2018-10-12T02:23:24
195,039,371
0
0
null
null
null
null
UTF-8
Java
false
false
2,516
java
package com.bob.flyboymvp.util; import android.support.annotation.NonNull; import org.joda.time.DateTime; import org.joda.time.DateTimeConstants; import org.joda.time.Days; /** * @创建者 CSDN_LQR * @描述 时间工具(需要joda-time) */ public class TimeUtils { /** * 得到仿微信日期格式输出 * * @param msgTimeMillis * @return */ public static String getMsgFormatTime(long msgTimeMillis) { DateTime nowTime = new DateTime(); // LogUtils.sf("nowTime = " + nowTime); DateTime msgTime = new DateTime(msgTimeMillis); // LogUtils.sf("msgTime = " + msgTime); int days = Math.abs(Days.daysBetween(msgTime, nowTime).getDays()); // LogUtils.sf("days = " + days); if (days < 1) { //早上、下午、晚上 1:40 return getTime(msgTime); } else if (days == 1) { //昨天 return "昨天 " + getTime(msgTime); } else if (days <= 7) { //星期 switch (msgTime.getDayOfWeek()) { case DateTimeConstants.SUNDAY: return "周日 " + getTime(msgTime); case DateTimeConstants.MONDAY: return "周一 " + getTime(msgTime); case DateTimeConstants.TUESDAY: return "周二 " + getTime(msgTime); case DateTimeConstants.WEDNESDAY: return "周三 " + getTime(msgTime); case DateTimeConstants.THURSDAY: return "周四 " + getTime(msgTime); case DateTimeConstants.FRIDAY: return "周五 " + getTime(msgTime); case DateTimeConstants.SATURDAY: return "周六 " + getTime(msgTime); } return ""; } else { //12月22日 return msgTime.toString("MM月dd日 " + getTime(msgTime)); } } @NonNull private static String getTime(DateTime msgTime) { int hourOfDay = msgTime.getHourOfDay(); String when; if (hourOfDay >= 18) {//18-24 when = "晚上"; } else if (hourOfDay >= 13) {//13-18 when = "下午"; } else if (hourOfDay >= 11) {//11-13 when = "中午"; } else if (hourOfDay >= 5) {//5-11 when = "早上"; } else {//0-5 when = "凌晨"; } return when + " " + msgTime.toString("hh:mm"); } }
[ "flybo@users.noreply.github.com" ]
flybo@users.noreply.github.com