blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
d652fff300428374467ed26df2f5a6fab8f02fc6
e0fd3dc1141aaaa75a9662f4daf8af2c8f464359
/TalonsParkourAdventure/app/src/main/java/com/example/android/talonsparkouradventure/MenuUi/AboutScreen.java
68fb77c2ac55464f7bd812f1048a945f67f1a758
[]
no_license
gham98/TPABois
62b95fa2c028781fe2377fc61621c2eaa43e71bb
32f7c28bab9967a7f854166ef28417b8daecbdec
refs/heads/master
2021-06-13T17:32:29.378928
2017-05-07T09:16:22
2017-05-07T09:16:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,592
java
package com.example.android.talonsparkouradventure.MenuUi; import android.annotation.SuppressLint; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; import android.view.MotionEvent; import android.view.View; import android.view.Window; import com.example.android.talonsparkouradventure.R; /** * An example full-screen activity that shows and hides the system UI (i.e. * status bar and navigation/system bar) with user interaction. */ public class AboutScreen extends AppCompatActivity { private View mContentView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about_screen); mContentView = findViewById(R.id.fullscreen_content); mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Trigger the initial hide() shortly after the activity has been // created, to briefly hint to the user that UI controls // are available. } @Override protected void onPostResume() { super.onPostResume(); } }
699cc3edd208f94f88007fa5f23a0e5b829fe37f
ca074e809bbea80ed34f1d70510747f63b853713
/Demo/src/www/sohu/com/Food.java
4b8dca50cfe96c4c0ef7e84b5689d98a38031a6a
[]
no_license
typtarb/newgit
b6de3591570e19cabf639afd79f17c1237e67859
61e19962abf07775a9ee317694a4dfb7d52e72c7
refs/heads/master
2020-06-10T01:03:49.138631
2016-12-11T08:15:19
2016-12-11T08:15:19
76,118,858
0
0
null
null
null
null
UTF-8
Java
false
false
49
java
package www.sohu.com; public interface Food { }
000ea8302bb623c51a9980e35a46f05ab7ccc31f
f305bf2ffa83d4eab0b5247c1be96713037a40a8
/storage/src/main/java/net/digitalid/utility/storage/TableImplementation.java
178e0f2a1859be521f8b68f390891280fd8f41d6
[ "Apache-2.0" ]
permissive
synacts/digitalid-utility
27db121ba38481f371595ae92b010b224bb452bb
9ecec49cc3c1d13f989d6002f576476f7d24c626
refs/heads/development
2019-07-30T02:32:05.916207
2017-12-06T22:22:16
2017-12-06T22:22:16
113,369,317
0
3
Apache-2.0
2018-05-23T12:54:37
2017-12-06T21:30:34
Java
UTF-8
Java
false
false
1,649
java
/* * Copyright (C) 2017 Synacts GmbH, Switzerland ([email protected]) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.digitalid.utility.storage; import javax.annotation.Nonnull; import net.digitalid.utility.annotations.generics.Specifiable; import net.digitalid.utility.annotations.generics.Unspecifiable; import net.digitalid.utility.annotations.method.PureWithSideEffects; import net.digitalid.utility.validation.annotations.type.Immutable; /** * This class implements the {@link Table} interface. */ @Immutable public abstract class TableImplementation<@Unspecifiable ENTRY, @Specifiable PROVIDED> extends StorageImplementation implements Table<ENTRY, PROVIDED> { /* -------------------------------------------------- Visitor -------------------------------------------------- */ @Override @PureWithSideEffects public <@Specifiable RESULT, @Specifiable PARAMETER, @Unspecifiable EXCEPTION extends Exception> RESULT accept(@Nonnull StorageVisitor<RESULT, PARAMETER, EXCEPTION> visitor, PARAMETER parameter) throws EXCEPTION { return visitor.visit(this, parameter); } }
de0abf678e7f4dbf4cce4ae88c4af4b72a34ffa9
61c16988212258b0081d4c6fae62c1faff7245a8
/src/Number.java
dae34d498a24d18fdc286d29dab526f34e7c057b
[]
no_license
Xakerzz/Module11
4ef567f962b926545af72473470403efafcd80f3
8c6fd299d521206b6705678d929904adfe2d64a5
refs/heads/master
2023-08-28T22:37:27.378682
2021-10-29T05:33:47
2021-10-29T05:33:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
import java.io.Serializable; public class Number<T> implements Serializable { private int a; private String str; public Number() { this.str ="WTF"; this.a = 5; } public int getA() { return a; } public void setA(int a) { this.a = a; } public String getStr() { return str; } public void setStr(String str) { this.str = str; } @Override public String toString() { return "Number{" + "a=" + a + ", str='" + str + '\'' + '}'; } }
22107924d76e924c1b3899febad7a7b96ae1b9dc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/31/31_f893fcd34ca18c0b353451602ac039ad2115fd3e/ArbitraryDegreeSequence/31_f893fcd34ca18c0b353451602ac039ad2115fd3e_ArbitraryDegreeSequence_s.java
55b9eee0b3d36dabe1b7a161d21bee5ec49a61f7
[]
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
6,436
java
/* =========================================================== * GTNA : Graph-Theoretic Network Analyzer * =========================================================== * * (C) Copyright 2009-2011, by Benjamin Schiller (P2P, TU Darmstadt) * and Contributors * * Project Info: http://www.p2p.tu-darmstadt.de/research/gtna/ * * GTNA is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GTNA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * --------------------------------------- * ArbitaryDegreeSequence.java * --------------------------------------- * (C) Copyright 2009-2011, by Benjamin Schiller (P2P, TU Darmstadt) * and Contributors * * Original Author: stef; * Contributors: -; * * Changes since 2011-05-17 * --------------------------------------- * */ package gtna.networks.model.randomGraphs; import gtna.graph.Edges; import gtna.graph.Graph; import gtna.graph.Node; import gtna.networks.Network; import gtna.transformation.Transformation; import gtna.util.parameter.BooleanParameter; import gtna.util.parameter.Parameter; import gtna.util.parameter.StringParameter; import java.util.Arrays; import java.util.Random; import java.util.Vector; /** * @author stef * create an undirected graph with a arbitrary degree sequence */ public class ArbitraryDegreeSequence extends Network { int[] sequence; int[] sequenceIn; int[] sequenceOut; boolean directed; /** * * @param nodes * @param name * @param sequence: position i = degree of node i * @param ra * @param t */ public ArbitraryDegreeSequence(int nodes, String name, int[] sequence, Transformation[] t) { super("ARBITRARY_DEGREE_SEQUENCE", nodes, new Parameter[]{new StringParameter("NAME", name), new BooleanParameter("DIRECTED", false)}, t); this.sequence = sequence; this.directed = false; } public ArbitraryDegreeSequence(int nodes, String name, int[] sequenceIn, int[] sequenceOut, Transformation[] t) { super("ARBITRARY_DEGREE_SEQUENCE", nodes, new Parameter[]{new StringParameter("NAME", name), new BooleanParameter("DIRECTED", true)}, t); this.sequenceIn = sequenceIn; this.sequenceOut = sequenceOut; this.directed = true; } public ArbitraryDegreeSequence(String name, Graph g, Transformation[] t, boolean directed) { super("ARBITRARY_DEGREE_SEQUENCE", g.getNodes().length, new Parameter[]{new StringParameter("NAME", name), new BooleanParameter("DIRECTED", directed)}, t); this.directed = directed; Node[] nodes = g.getNodes(); if (directed){ this.sequenceIn = new int[nodes.length]; for (int i = 0; i < nodes.length; i++){ this.sequenceIn[i] = nodes[i].getInDegree(); } this.sequenceOut = new int[nodes.length]; for (int i = 0; i < nodes.length; i++){ this.sequenceOut[i] = nodes[i].getOutDegree(); } } else { this.sequence = new int[nodes.length]; for (int i = 0; i < nodes.length; i++){ this.sequenceIn[i] = nodes[i].getInDegree(); } } } /** * @param key * @param nodes * @param configKeys * @param configValues * @param ra * @param t */ public ArbitraryDegreeSequence(int nodes, Parameter[] parameters, int[] sequence,Transformation[] t) { super("ARBITRARY_DEGREE_SEQUENCE", nodes, parameters, t); this.sequence = sequence; } /* (non-Javadoc) * @see gtna.networks.Network#generate() */ @Override public Graph generate() { if (this.directed){ return this.generateDirected(); } else { return this.generateUndirected(); } } private Graph generateUndirected(){ Graph graph = new Graph(this.getDescription()); Random rand = new Random(System.currentTimeMillis()); Node[] nodes = Node.init(this.getNodes(), graph); int sum = 0; for (int j = 0; j < sequence.length; j++){ sum = sum + sequence[j]; } Edges edges = new Edges(nodes, sum); Vector<Integer> stubs = new Vector<Integer>(); Arrays.sort(sequence); for (int i = 0; i < sequence.length; i++){ for (int j = 0; j < sequence[sequence.length-i-1]; j++){ stubs.add(sequence.length-i-1); } } int k = 0; int src,dst; Vector<Integer> cStubs = (Vector<Integer>) stubs.clone(); while (k < 1000 && stubs.size() > 1){ src = stubs.remove(0); int med = rand.nextInt(stubs.size()); dst = stubs.remove(med); int t = 0; while (t < 1000 && src==dst){ stubs.add(med,dst); t++; med = rand.nextInt(stubs.size()); dst = stubs.remove(med); } if (src == dst){ k++; stubs = cStubs; } else { edges.add(src, dst); edges.add(dst,src); } } if (stubs.size() > 0){ throw new IllegalArgumentException("Graph construction not possible"); } edges.fill(); graph.setNodes(nodes); return graph; } private Graph generateDirected(){ Graph graph = new Graph(this.getDescription()); Random rand = new Random(System.currentTimeMillis()); Node[] nodes = Node.init(this.getNodes(), graph); int sum = 0; for (int j = 0; j < this.sequenceIn.length; j++){ sum = sum + this.sequenceIn[j]; } Edges edges = new Edges(nodes, sum); Vector<Integer> stubsOut = new Vector<Integer>(sum); Vector<Integer> stubsIn = new Vector<Integer>(sum); for (int i = 0; i < this.sequenceOut.length; i++){ for (int j = 0; j < this.sequenceOut[i]; j++){ stubsOut.add(i); } for (int j = 0; j < this.sequenceIn[i]; j++){ stubsIn.add(i); } } if (stubsIn.size() != stubsOut.size()){ throw new IllegalArgumentException("Graph construction not possible"); } int src,dst; while (stubsIn.size() > 0 && stubsOut.size() > 0){ src = stubsOut.remove(stubsOut.size()-1); dst = stubsIn.remove(rand.nextInt(stubsIn.size())); edges.add(src,dst); } graph.setNodes(nodes); return graph; } }
3a6cf03c19e343877f7e803e4ba8718ce529e12f
97cefc56ecc8abf3cd1b9650c6564c84c03ed600
/build/app/generated/not_namespaced_r_class_sources/release/r/com/baseflow/permissionhandler/R.java
a1a555ff7475f3eaa4812d844f4fd3e91bbc0016
[]
no_license
achilleustechnology/AlphaSample
13134c32b33123207a3c87cebeeac09a1f257c5e
ae8de82c1ec623d18ac96ac4a9c37968cf95b9bd
refs/heads/master
2023-02-02T22:24:59.238415
2020-12-19T09:25:44
2020-12-19T09:25:44
322,805,403
0
0
null
null
null
null
UTF-8
Java
false
false
13,713
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.baseflow.permissionhandler; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f04002a; public static final int font = 0x7f0400f5; public static final int fontProviderAuthority = 0x7f0400f7; public static final int fontProviderCerts = 0x7f0400f8; public static final int fontProviderFetchStrategy = 0x7f0400f9; public static final int fontProviderFetchTimeout = 0x7f0400fa; public static final int fontProviderPackage = 0x7f0400fb; public static final int fontProviderQuery = 0x7f0400fc; public static final int fontStyle = 0x7f0400fd; public static final int fontVariationSettings = 0x7f0400fe; public static final int fontWeight = 0x7f0400ff; public static final int ttcIndex = 0x7f040206; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f06009c; public static final int notification_icon_bg_color = 0x7f06009d; public static final int ripple_material_light = 0x7f0600a8; public static final int secondary_text_default_material_light = 0x7f0600ac; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f07006b; public static final int compat_button_inset_vertical_material = 0x7f07006c; public static final int compat_button_padding_horizontal_material = 0x7f07006d; public static final int compat_button_padding_vertical_material = 0x7f07006e; public static final int compat_control_corner_material = 0x7f07006f; public static final int compat_notification_large_icon_max_height = 0x7f070070; public static final int compat_notification_large_icon_max_width = 0x7f070071; public static final int notification_action_icon_size = 0x7f0700e4; public static final int notification_action_text_size = 0x7f0700e5; public static final int notification_big_circle_margin = 0x7f0700e6; public static final int notification_content_margin_start = 0x7f0700e7; public static final int notification_large_icon_height = 0x7f0700e8; public static final int notification_large_icon_width = 0x7f0700e9; public static final int notification_main_column_padding_top = 0x7f0700ea; public static final int notification_media_narrow_margin = 0x7f0700eb; public static final int notification_right_icon_size = 0x7f0700ec; public static final int notification_right_side_padding_top = 0x7f0700ed; public static final int notification_small_icon_background_padding = 0x7f0700ee; public static final int notification_small_icon_size_as_large = 0x7f0700ef; public static final int notification_subtext_size = 0x7f0700f0; public static final int notification_top_pad = 0x7f0700f1; public static final int notification_top_pad_large_text = 0x7f0700f2; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f0800c2; public static final int notification_bg = 0x7f0800c3; public static final int notification_bg_low = 0x7f0800c4; public static final int notification_bg_low_normal = 0x7f0800c5; public static final int notification_bg_low_pressed = 0x7f0800c6; public static final int notification_bg_normal = 0x7f0800c7; public static final int notification_bg_normal_pressed = 0x7f0800c8; public static final int notification_icon_background = 0x7f0800c9; public static final int notification_template_icon_bg = 0x7f0800ca; public static final int notification_template_icon_low_bg = 0x7f0800cb; public static final int notification_tile_bg = 0x7f0800cc; public static final int notify_panel_notification_icon_bg = 0x7f0800cd; } public static final class id { private id() {} public static final int accessibility_action_clickable_span = 0x7f090008; public static final int accessibility_custom_action_0 = 0x7f090009; public static final int accessibility_custom_action_1 = 0x7f09000a; public static final int accessibility_custom_action_10 = 0x7f09000b; public static final int accessibility_custom_action_11 = 0x7f09000c; public static final int accessibility_custom_action_12 = 0x7f09000d; public static final int accessibility_custom_action_13 = 0x7f09000e; public static final int accessibility_custom_action_14 = 0x7f09000f; public static final int accessibility_custom_action_15 = 0x7f090010; public static final int accessibility_custom_action_16 = 0x7f090011; public static final int accessibility_custom_action_17 = 0x7f090012; public static final int accessibility_custom_action_18 = 0x7f090013; public static final int accessibility_custom_action_19 = 0x7f090014; public static final int accessibility_custom_action_2 = 0x7f090015; public static final int accessibility_custom_action_20 = 0x7f090016; public static final int accessibility_custom_action_21 = 0x7f090017; public static final int accessibility_custom_action_22 = 0x7f090018; public static final int accessibility_custom_action_23 = 0x7f090019; public static final int accessibility_custom_action_24 = 0x7f09001a; public static final int accessibility_custom_action_25 = 0x7f09001b; public static final int accessibility_custom_action_26 = 0x7f09001c; public static final int accessibility_custom_action_27 = 0x7f09001d; public static final int accessibility_custom_action_28 = 0x7f09001e; public static final int accessibility_custom_action_29 = 0x7f09001f; public static final int accessibility_custom_action_3 = 0x7f090020; public static final int accessibility_custom_action_30 = 0x7f090021; public static final int accessibility_custom_action_31 = 0x7f090022; public static final int accessibility_custom_action_4 = 0x7f090023; public static final int accessibility_custom_action_5 = 0x7f090024; public static final int accessibility_custom_action_6 = 0x7f090025; public static final int accessibility_custom_action_7 = 0x7f090026; public static final int accessibility_custom_action_8 = 0x7f090027; public static final int accessibility_custom_action_9 = 0x7f090028; public static final int action_container = 0x7f090033; public static final int action_divider = 0x7f090035; public static final int action_image = 0x7f090036; public static final int action_text = 0x7f09003c; public static final int actions = 0x7f09003d; public static final int async = 0x7f090050; public static final int blocking = 0x7f090059; public static final int chronometer = 0x7f090074; public static final int dialog_button = 0x7f090097; public static final int forever = 0x7f0900b0; public static final int icon = 0x7f0900c1; public static final int icon_group = 0x7f0900c2; public static final int info = 0x7f0900c7; public static final int italic = 0x7f0900c9; public static final int line1 = 0x7f0900d1; public static final int line3 = 0x7f0900d2; public static final int normal = 0x7f0900e7; public static final int notification_background = 0x7f0900e8; public static final int notification_main_column = 0x7f0900e9; public static final int notification_main_column_container = 0x7f0900ea; public static final int right_icon = 0x7f090109; public static final int right_side = 0x7f09010a; public static final int tag_accessibility_actions = 0x7f09013f; public static final int tag_accessibility_clickable_spans = 0x7f090140; public static final int tag_accessibility_heading = 0x7f090141; public static final int tag_accessibility_pane_title = 0x7f090142; public static final int tag_screen_reader_focusable = 0x7f090143; public static final int tag_transition_group = 0x7f090144; public static final int tag_unhandled_key_event_manager = 0x7f090145; public static final int tag_unhandled_key_listeners = 0x7f090146; public static final int text = 0x7f09014a; public static final int text2 = 0x7f09014b; public static final int time = 0x7f090155; public static final int title = 0x7f090156; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0a0010; } public static final class layout { private layout() {} public static final int custom_dialog = 0x7f0c0029; public static final int notification_action = 0x7f0c0042; public static final int notification_action_tombstone = 0x7f0c0043; public static final int notification_template_custom_big = 0x7f0c004a; public static final int notification_template_icon_group = 0x7f0c004b; public static final int notification_template_part_chronometer = 0x7f0c004f; public static final int notification_template_part_time = 0x7f0c0050; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0e009a; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0f011b; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f011c; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f011e; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0121; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0123; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01ce; public static final int Widget_Compat_NotificationActionText = 0x7f0f01cf; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f04002a }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0400f7, 0x7f0400f8, 0x7f0400f9, 0x7f0400fa, 0x7f0400fb, 0x7f0400fc }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400f5, 0x7f0400fd, 0x7f0400fe, 0x7f0400ff, 0x7f040206 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
2386ce57e8e609c8bd28c85132f5a38dde987319
bdf3eff7763b7a1120a083accb87cdaab2457bfd
/redis-stu/src/main/java/com/test2.java
ef0e362bbcf043851c4f31c582164ba124ec757a
[]
no_license
yaoyiwen/sutdy
186e4658d8c12295abfd58d49c128578e24f6d5f
7b2743d1232985be047b71e85747ea938ad0e2b6
refs/heads/master
2020-03-25T19:44:10.260183
2018-08-07T05:55:41
2018-08-07T05:55:41
144,097,731
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package com; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; /** * @author: 姚轶文 * @date:2018年7月24日 下午4:25:55 * @version : * */ public class test2 { public static void main(String[] args) { JedisPoolConfig config = new JedisPoolConfig(); config.setMaxTotal(100); //最大连接数 config.setMaxIdle(10); //空闲连接数 JedisPool jedisPool = new JedisPool(config,"192.168.1.131",6379); Jedis jedis = jedisPool.getResource(); jedis.append("myTest2", "working2"); String str = jedis.get("myTest2"); System.out.println(str); if(jedis!=null) { jedis.close(); } if(jedisPool!=null) { jedisPool.close(); } } }
4af5b10ae21988a4ea5dbdecbfd8bb48fc82db67
984bc78055def357c50c2c465e740a54e686d22e
/lib/mp3tag/src/org/farng/mp3/id3/FrameBodyMCDI.java
d7bf4f56d72b46c25d42559e46c4c4568a6660fe
[]
no_license
lboynton/XMPP-Client
18986dc4a95a28f318b8563bba054da3befcea4a
b833d79153562f93c74f7122a72989733acaff37
refs/heads/master
2021-01-13T02:22:26.402596
2009-07-09T21:01:11
2009-07-09T21:01:11
247,388
2
2
null
null
null
null
UTF-8
Java
false
false
2,509
java
package org.farng.mp3.id3; import org.farng.mp3.InvalidTagException; import org.farng.mp3.object.ObjectByteArraySizeTerminated; import java.io.IOException; import java.io.RandomAccessFile; /** * <h3>4.4.&nbsp;&nbsp; Music CD identifier</h3> * <p/> * <p>&nbsp;&nbsp; This frame is intended for music that comes from a CD, so that the CD<br> * <p/> * &nbsp;&nbsp; can be identified in databases such as the CDDB [CDDB]. The frame<br> &nbsp;&nbsp; consists of a binary * dump of the Table Of Contents, TOC, from the CD,<br> &nbsp;&nbsp; which is a header of 4 bytes and then 8 bytes/track * on the CD plus 8<br> &nbsp;&nbsp; bytes for the 'lead out', making a maximum of 804 bytes. The offset<br> * &nbsp;&nbsp; to the beginning of every track on the CD should be described with a<br> * <p/> * &nbsp;&nbsp; four bytes absolute CD-frame address per track, and not with absolute<br> &nbsp;&nbsp; time. When this * frame is used the presence of a valid &quot;TRCK&quot; frame is<br> &nbsp;&nbsp; REQUIRED, even if the CD's only got * one track. It is recommended that<br> &nbsp;&nbsp; this frame is always added to tags originating from CDs. There * may<br> * <p/> * &nbsp;&nbsp; only be one &quot;MCDI&quot; frame in each tag.</p> * <p/> * <p>&nbsp;&nbsp;&nbsp;&nbsp; &lt;Header for 'Music CD identifier', ID: &quot;MCDI&quot;&gt;<br> * &nbsp;&nbsp;&nbsp;&nbsp; CD TOC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &lt;binary data&gt;<br> * <p/> * </p> * * @author Eric Farng * @version $Revision: 1.4 $ */ public class FrameBodyMCDI extends AbstractID3v2FrameBody { /** * Creates a new FrameBodyMCDI object. */ public FrameBodyMCDI() { super(); } /** * Creates a new FrameBodyMCDI object. */ public FrameBodyMCDI(final FrameBodyMCDI body) { super(body); } /** * Creates a new FrameBodyMCDI object. */ public FrameBodyMCDI(final byte[] cdTOC) { setObject("CD Table of Contents", cdTOC); } /** * Creates a new FrameBodyMCDI object. */ public FrameBodyMCDI(final RandomAccessFile file) throws IOException, InvalidTagException { this.read(file); } public String getIdentifier() { return "MCDI"; } protected void setupObjectList() { appendToObjectList(new ObjectByteArraySizeTerminated("CD Table of Contents")); } }
69c1617bfff0f06762fdefccb0e682ce2b1b8297
5c14c6b113f3fe101201f553fbf75dab50aa6406
/PrimefacesLogin/loginExample/src/java/com/query/dataQuery.java
51d0bddb1860354e79d81eefe3e1fb8ea43b1fb7
[]
no_license
manuel-martin3/PryPrimeFaces
410e746e16b456290f033babb4ac079f58ce5c7a
ea766567c51d7801aaf31a1764772cacac2c6bb2
refs/heads/master
2021-07-14T01:23:48.921266
2017-10-13T22:03:49
2017-10-13T22:03:49
104,621,599
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
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.query; import com.entity.Login; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; /** * * @author admin */ public class dataQuery { EntityManagerFactory emf; EntityManager em; public dataQuery() { emf = Persistence.createEntityManagerFactory("loginExamplePU"); em = emf.createEntityManager(); em.getTransaction().begin(); } public boolean logincontrol(String username, String password){ try { Login l = em.createNamedQuery("Login.control", Login.class) .setParameter("username", username) .setParameter("password", password) .getSingleResult(); if (l != null) { return true; } return false; } catch (Exception e) { return false; } } }
bd7659a9f3fd5d4674a0da5d989909b8847e98e0
c9d11c740d108822e18c6e448d696e2177f7c9ed
/present/xml/mensagem/Mensagem.java
13a4c4409eadfa2c122025f5119595e87ac491c8
[]
no_license
alexandreregattieri/monitoramentoTISS
298749342ff086a9f313bf4ef46cc04fb38f1740
6dffd21cd2c40b9ab7d677443dcd8757f6ba515c
refs/heads/master
2022-12-15T04:04:54.449702
2020-09-05T18:35:05
2020-09-05T18:35:05
293,124,644
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package present.xml.mensagem; import model.to.mensagem.MensagemTo; import org.w3c.dom.Document; import org.w3c.dom.Element; import present.xml.mensagem.operadoraParaAns.OperadoraParaAns; public class Mensagem { public Element getMensagem(Document doc, Element el, MensagemTo msg) { Element el1 = null; OperadoraParaAns opa = null; try { opa = new OperadoraParaAns(); el = doc.createElement("ans:Mensagem"); el1 = doc.createElement("ans:operadoraParaANS"); el1 = opa.getOperadoraParaAns(doc, el1, msg.getOperadoraParaANS()); el.appendChild(el1); } catch (Exception e) { e.printStackTrace(); System.out.println("present.xml.mensagem.Mensagem.getMensagem - e= " + e.toString()); } return el; } }
9127520b0b8b32d4f88feaa71ada68e25b4cf41f
bc32b189f28474492cceb24afe8ceb60081d0754
/src/ch02/applet/RectangleApplet.java
ecdfecebf7bf92c19a275f3bad81549bf234612e
[ "MIT" ]
permissive
raeffu/prog1
3e8cd444d9709df2e9c192fd0d6b0551ce6a7ce1
b8014a1af972308572495c3d33a1f4ac159929b6
refs/heads/master
2020-06-04T10:06:13.464856
2014-01-26T19:46:50
2014-01-26T19:46:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package ch02.applet; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import javax.swing.JApplet; /* An applet that draws two rectangles. */ public class RectangleApplet extends JApplet { public void paint(Graphics g) { // Prepare for extended graphics Graphics2D g2 = (Graphics2D) g; // Construct a rectangle and draw it Rectangle box = new Rectangle(5, 10, 20, 30); g2.draw(box); // Move rectangle 15 units to the right and 25 units down box.translate(15, 25); // Draw moved rectangle g2.draw(box); } }
4dd560a1747f987a9d4c8b96ab3d6a9c33b7fdfc
2308c27d0196c4676524f254b5115a3294e9ce3e
/app/src/main/java/com/pdc/pandamusic/entity/ArtistItem.java
3b4100d65f83fb269a5c4cb03d32017a2448c14f
[]
no_license
boyhattieu/pandamusic
365765fe8f7be45cbaf2871062d07b6cf57371f5
c81b8a343d0d071592cd2af560cf16e60f6e8f47
refs/heads/master
2020-05-03T01:58:20.396337
2019-04-27T03:43:24
2019-04-27T03:43:24
178,354,247
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.pdc.pandamusic.entity; public class ArtistItem { private int imgArtistAva; private String txtArtistName; private String txtArtistSong; public ArtistItem(int imgArtistAva, String txtArtistName, String txtArtistSong) { this.imgArtistAva = imgArtistAva; this.txtArtistName = txtArtistName; this.txtArtistSong = txtArtistSong; } public int getImgArtistAva() { return imgArtistAva; } public String getTxtArtistName() { return txtArtistName; } public String getTxtArtistSong() { return txtArtistSong; } }
2e22a4ac97980ec36b9c2bf6948c3d515d63e909
69104ae8eb7d4e980ebbee0748ceaf7c3c3c03c1
/mycalendar-web/src/main/java/com/smartdot/calendar/servlet/Event.java
4505d4d3fadf8de77b5ca9430e6070b7f3e37c45
[]
no_license
LancelotTian/ICalendar
115c4fe96c7dc44d3515bbe3111d8dbf78b30c02
02cc8c287fc3c65be6a7bcb33482e730f940e9ef
refs/heads/master
2021-01-13T01:58:50.304189
2017-03-16T15:53:51
2017-03-16T15:53:51
2,046,271
0
0
null
null
null
null
UTF-8
Java
false
false
19,261
java
package com.smartdot.calendar.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import com.smartdot.calendar.base.service.ServiceFactory; import com.smartdot.calendar.beans.Activity; import com.smartdot.calendar.beans.ActivityComment; import com.smartdot.calendar.format.FormatHelper; import com.smartdot.calendar.service.ActivityService; import com.smartdot.calendar.util.CalendarBeanUtil; import com.smartdot.calendar.utils.CalendarServletUtils; public class Event extends HttpServlet { private static final long serialVersionUID = -1610349809301482964L; private static Logger logger = Logger.getLogger(Event.class); /** * Constructor of the object. */ public Event() { super(); } /** * Destruction of the servlet. */ @Override public void destroy() { super.destroy(); } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String actionType = request.getParameter("action"); String output = request.getParameter("output"); StringBuilder strBuf = new StringBuilder(); if(actionType!=null && actionType.equalsIgnoreCase("VIEW") && output.equalsIgnoreCase("xml")) strBuf.append(doView(request,response)); response.setContentType(CalendarBeanUtil.getResponseContentType(output)); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.write(strBuf.toString()); out.flush(); out.close(); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.debug("-----------------------------------EVENT---------------------------------"); request.setCharacterEncoding("UTF-8"); /** 事件对应的操作类型:CREATE、DELETE、MODIFY **/ String actionType = request.getParameter("action"); String output = request.getParameter("output"); StringBuilder strBuf = new StringBuilder(); if(actionType==null && output.equalsIgnoreCase("xml")) strBuf.append(doViewEntryDetail(request,response)); //add by ray if(null!=actionType&&actionType.equalsIgnoreCase("VIEW") && output.equalsIgnoreCase("xml")) strBuf.append(doViewEntryDetail(request,response)); if(actionType!=null && actionType.equalsIgnoreCase("CREATE") && output.equalsIgnoreCase("js")){ String secid = request.getParameter("secid"); if(secid==null || secid.equalsIgnoreCase("")){ secid = CalendarServletUtils.getUserIdByRequest(request); if(secid==null || secid.equalsIgnoreCase("")) throw new ServletException("******Cookie secid has been expired ! Must logon again."); else response.addCookie(new Cookie("secid",secid)); } strBuf.append(doCreate(request,response,secid)); } //被更改的系列活动在撤销更改时应该显示的数据 if(actionType!=null && actionType.equalsIgnoreCase("VIEW_ORIGINAL") && output.equalsIgnoreCase("xml")) strBuf.append(doViewEntryOriginalDetail(request,response)); if(actionType!=null && actionType.equalsIgnoreCase("RESPOND") && output.equalsIgnoreCase("js")){ // 给活动添加一条注释 if(null == request.getParameter("rcomment")&&null==request.getParameter("rst")){ String secid = request.getParameter("secid"); if(secid==null || secid.equalsIgnoreCase("")){ secid = CalendarServletUtils.getUserIdByRequest(request); if(secid==null || secid.equalsIgnoreCase("")) throw new ServletException("******Cookie secid has been expired ! Must logon again."); else response.addCookie(new Cookie("secid",secid)); } strBuf.append(doAddComment(request,response,secid)); }else if(null != request.getParameter("rcomment")&&null!=request.getParameter("rst")){//来宾回复 logger.info("------------来宾回复----------------"); String secid = request.getParameter("secid"); String activeId = request.getParameter("eid"); String rcomment = request.getParameter("rcomment"); String join = request.getParameter("rst"); String guest = request.getParameter("rgu"); ActivityService actService = ServiceFactory.getInstance().getActivityService(); strBuf.append(actService.responseToActivity(activeId, secid, new Integer(guest.trim()), new Integer(join.trim()), rcomment)); }else if(null == request.getParameter("rcomment")&&null!=request.getParameter("rst")){ //来宾回复 参加与否 logger.info("------------来宾回复 参加与否----------------"); String secid = request.getParameter("secid"); String activeId = request.getParameter("eid"); String join = request.getParameter("rst"); ActivityService actService = ServiceFactory.getInstance().getActivityService(); actService.respondToActivity(activeId, secid, new Integer(join)); } } //与系列不同步的活动重置成同步的操作 if(actionType!=null && actionType.equalsIgnoreCase("RESTORE_ORIGINAL")) strBuf.append(doRestorOriginalEntry(request,response)); //修改日程操作 if(actionType!=null && actionType.equalsIgnoreCase("EDIT") && output.equalsIgnoreCase("js")) strBuf.append(doEditActivity(request,response)); response.setContentType(CalendarBeanUtil.getResponseContentType(output)); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.write(strBuf.toString()); out.flush(); out.close(); } @Override public void init() throws ServletException { } private String doCreate(HttpServletRequest request,HttpServletResponse response,String secid) throws ServletException,IOException{ request.setCharacterEncoding("UTF-8"); //以下属性对所有日程取值都一样 /**城市代码固定为 Asia/Shanghai **/ //String cityZone = request.getParameter("ctz"); /**有效期**/ //String droi = request.getParameter("droi"); /** locale信息:zh-CN **/ //String locale = request.getParameter("hl"); /** 未知,取值为"true" **/ //String sf = request.getParameter("sf"); //新建日程时未使用的参数 /**所有子日历的id集合**/ //String[] lef = request.getParameterValues("lef"); StringBuilder strBuf = new StringBuilder(); Map actProps = this.getActivityPropsByRequest(request);//request.getParameterMap(); Activity act = new Activity(); //act.setSecid(request.getParameter("secid")); //设置活动所有人id act.setSecid(secid); act.setSrcCalendarId(request.getParameter("src")); //设置活动属于的日历id act.setMultiProps(actProps); ActivityService actService = ServiceFactory.getInstance().getActivityService(); Object ret[] = actService.saveActivity( act, request.getParameter("recur"), CalendarBeanUtil.dateStrToDate( request.getParameter("droi").split("/")[0] ), CalendarBeanUtil.dateStrToDate( request.getParameter("droi").split("/")[1] ) ); Activity theAct = (Activity)((List)ret[0]).get(0); CalendarServletUtils.setSessionStateAttr(request, "create", new Integer(0), ret[0]); //生成返回结果 strBuf.append("while(1);[['r','").append(request.getParameter("eid")).append("','").append(theAct.getId()).append("'],"); strBuf.append((String)ret[1]); boolean allDays = FormatHelper.getTimeDur(theAct.getStartTime(), theAct.getEndTime()).indexOf("T")<0; strBuf.append(",['_RefreshCalendarWhenDisplayedNext'],['_Ping','500'],['_Ping','3000'],['_Ping','15000']"); strBuf.append(",['_ShowMessage','").append(allDays ? "添加了" : "活动已添加").append(" \\74span class\\75\\42lk\\42 onmousedown\\75\\42_EF_ShowEventDetails("); strBuf.append((theAct.getId().charAt(0) < '9' && theAct.getId().charAt(0) > '0') ? "\\047" : "\\47").append(theAct.getId()); strBuf.append("\\47);_HideMessage();\\42"); strBuf.append((!theAct.getText().equals("") && theAct.getText().charAt(0)<'9'&&theAct.getText().charAt(0)>'0')?"\\076":"\\76"); strBuf.append(CalendarBeanUtil.javaStrtoGoogleHTMLStr(theAct.getText())).append("\\74/span\\76,").append(allDays ? "日期为" : "时间为").append(":").append(FormatHelper.getTimeDurZH(theAct.getStartTime(), theAct.getEndTime()).split(" — ")[0]).append("。']]"); return strBuf.toString(); } private String doViewEntryDetail(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{ request.setCharacterEncoding("UTF-8"); String id = request.getParameter("eid"); //活动id String type = request.getParameter("action"); //当前场景 String secid = request.getParameter("secid"); //主日历id ActivityService actService = ServiceFactory.getInstance().getActivityService(); Object[] ret = actService.getActivityXMLFormat(id, type,secid); return ret[1].toString(); } private String doViewEntryOriginalDetail(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ request.setCharacterEncoding("UTF-8"); String id = request.getParameter("eid"); String type = request.getParameter("action"); String secid = request.getParameter("secid"); ActivityService actService = ServiceFactory.getInstance().getActivityService(); Object[] ret = actService.getActivityXMLFormat(id, type,secid); return (String)ret[1]; } private String doAddComment(HttpServletRequest request,HttpServletResponse response,String secid) throws ServletException,IOException{ request.setCharacterEncoding("UTF-8"); String id = request.getParameter("eid"); //活动id String commentText = request.getParameter("ec"); //String secid = request.getParameter("secid"); String calendarId = request.getParameter("src"); StringBuilder strBuf = new StringBuilder(); ActivityComment comment = new ActivityComment(); comment.setPersonId(secid); comment.setComment(commentText); comment.setSrcCalendarId(calendarId); ActivityService actService = ServiceFactory.getInstance().getActivityService(); Object[] ret = actService.addCommentToActivity(id, comment); strBuf.append("while(1);["); strBuf.append((String)ret[1]); strBuf.append(",['_RefreshCalendarWhenDisplayedNext'],['_Ping','500'],['_Ping','3000'],['_Ping','15000']]"); return strBuf.toString(); } private String doRestorOriginalEntry(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ request.setCharacterEncoding("UTF-8"); String id = request.getParameter("eid"); String secid = CalendarServletUtils.getUserIdByRequest(request); if(secid==null || secid.equalsIgnoreCase("")) throw new ServletException("******Can not to find user info from request."); ActivityService actService = ServiceFactory.getInstance().getActivityService(); Map actProps = this.getActivityPropsByRequest(request); StringBuilder strBuf = new StringBuilder(); Object[] ret = actService.restorOriginalActivity(secid,id,actProps); strBuf.append("while(1);["); strBuf.append((String)ret[1]); strBuf.append(",['_RefreshCalendarWhenDisplayedNext'],['_Ping','500'],['_Ping','3000'],['_Ping','15000'],['_ShowMessage','您的活动已更新。']]"); List acts = new ArrayList(); acts.add(ret[0]); CalendarServletUtils.setSessionStateAttr(request, "restore", new Integer(0), acts); return strBuf.toString(); } private String doEditActivity(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ request.setCharacterEncoding("UTF-8"); /** 修改时前台传回的日程属性中有些属性如果没有修改则不会出现,而有些则始终会出现 * 通过界面修改日程时始终会出现的属性: * action String 操作类型,CREATE、EDIT * add String[] 添加的来宾名称 * ctz String 城市区域,常量"Asia/Shanghai" 通过拖动日程修改不会出现 * droi String 日历有效期?? * eid String 修改的日程的id * erem String[] 日程提醒设置 通过拖动日程修改不会出现 * hl String 常量"zh-CN" 通过拖动日程修改不会出现 * lef String[] 当前用户所有的子日历id * output String 返回数据类型,"js"、"xml" * rfdt String 该日程创建时间 YMD格式,例如:20080910 通过拖动日程修改不会出现 * scp String 制定修改范围。"ONE"当前活动、"ALL"同一系列中的所有活动、"TAIL"同一系列该活动(包含该活动)之后的所有活动 * secid String[] 用户id * sf String 含义未知,目前为一常量值"true" 通过拖动日程修改不会出现 * src String 日程所在的子日历id * * 只有被更改时才会出现的属性 * dates String 对应新建日程界面的日程起、止时间 * details String 对应新建日程界面的"说明"字段值 * icc String 对应创建日程界面的"隐私"字段值,DEFAULT 默认、PRIVATE 私人、PUBLIC 公共 * location String 对应创建日程界面的"地点"字段值 * sprop String[] 对应创建日程界面的"邀请他人"、"查看来宾列表"字段值。例如:goo.allowInvitesOther:true/false,通过冒号前的值区分是哪个字段,只会出现被更改的 * text String 对应创建日程界面的"内容"字段值 * trp String 对应创建日程界面的"状态显示为"字段值,true 有空,false 忙碌 * */ //String srcCalendarId = request.getParameter("src"); String id = request.getParameter("eid"); String scp = request.getParameter("scp"); Map actProps = this.getActivityPropsByRequest(request); List entriesInLoadResp = new ArrayList(); StringBuilder strBuf = new StringBuilder("while(1);["); Object[] ret = null; String secid = CalendarServletUtils.getUserIdByRequest(request); if(secid==null || secid.equalsIgnoreCase("")) throw new ServletException("******Can not to find user info from request."); ActivityService actService = ServiceFactory.getInstance().getActivityService(); //修改单个非系列活动或单个系列活动且选择“仅此活动” if(scp.equals("ONE")){ ret = actService.modifyOneActivity(secid,id,actProps); strBuf.append((String)ret[1]); entriesInLoadResp.add(ret[2]); CalendarServletUtils.setSessionStateAttr(request, "edit", new Integer(0), entriesInLoadResp); }else{//修改“全部活动”或“以后活动”或将非系列活动修改为系列活动 ret = actService.modifySeriesActivities(secid,id, actProps, scp, CalendarBeanUtil.dateStrToDate(request.getParameter("rstart")), CalendarBeanUtil.getMsTimeByRdur(request.getParameter("rdur")), request.getParameter("recur"), CalendarBeanUtil.dateStrToDate(request.getParameter("droi").split("/")[0]), CalendarBeanUtil.dateStrToDate(request.getParameter("droi").split("/")[1]) ); strBuf.append((String)ret[1]); entriesInLoadResp.addAll((List)ret[2]); CalendarServletUtils.setSessionStateAttr(request, "edit", new Integer(0), entriesInLoadResp); } strBuf.append(",['_RefreshCalendarWhenDisplayedNext'],['_Ping','500'],['_Ping','3000'],['_Ping','15000'],['_ShowMessage','您的活动已更新。']]"); return strBuf.toString(); } private String doView(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String id = request.getParameter("eid"); //活动标识 String type = request.getParameter("action"); //当前操作类型 List entriesInEventResp = new ArrayList(); String secid = CalendarServletUtils.getUserIdByRequest(request); if(secid==null || secid.equalsIgnoreCase("")) throw new ServletException("******Can not to find user info from request."); ActivityService actService = ServiceFactory.getInstance().getActivityService(); Object[] ret = actService.getActivityXMLFormat(id, type,secid); entriesInEventResp.add((Activity)ret[0]); CalendarServletUtils.setSessionStateAttr(request, "view", new Integer(0), entriesInEventResp); return (String)ret[1]; } private Map getActivityPropsByRequest(HttpServletRequest request) throws IOException{ request.setCharacterEncoding("UTF-8"); Map params = request.getParameterMap(); Map ret = new HashMap(); //add by ray if(params.containsKey("add")){ //String [] persons = request.getParameterValues("add"); String [] persons = request.getParameter("add").split(","); ret.put("add", persons); } if(params.containsKey("del")){ String [] persons = request.getParameterValues("del"); ret.put("del", persons); } if(params.containsKey("sprop")){ String[] inviteType = request.getParameterValues("sprop"); ret.put("sprop", inviteType); } if(params.containsKey("text")){ String textStr = request.getParameter("text"); ret.put("text", textStr); } if(params.containsKey("dates")){ String dates = request.getParameter("dates"); String startDate = dates.split("/")[0]; String endDate = dates.split("/")[1]; ret.put("startTime", CalendarBeanUtil.dateStrToDate(startDate)); ret.put("endTime", CalendarBeanUtil.dateStrToDate(endDate)); } if(params.containsKey("rfdt")){ ret.put("rfdt", CalendarBeanUtil.dateStrToDate(request.getParameter("rfdt"))); } if(params.containsKey("details")){ String detailsStr = request.getParameter("details"); ret.put("details", detailsStr); } if(params.containsKey("icc")) ret.put("icc", request.getParameter("icc")); if(params.containsKey("location")){ String locationStr = request.getParameter("location"); ret.put("location", locationStr); } if(params.containsKey("sprop")) ret.put("sprop", request.getParameterValues("sprop")); if(params.containsKey("trp")) ret.put("trp", request.getParameter("trp").equalsIgnoreCase("true")); /** 表示提醒字段设置的数组,每个元素格式为:"*:***:*" 第一个字段表示提醒方式,1邮件提醒,3弹出窗口提醒 第二个字段表示提醒发生时间,秒为单位 第三个字段有三种取值,-1、0、1表示使用 0-表示数据库中已经存在该提醒 1-表示数据库中没有该提醒,当前要添加该提醒 -1-表示数据库中已经处在该提醒,当前要删除该提醒 */ if(params.containsKey("erem")) ret.put("erem", request.getParameterValues("erem")); if(params.containsKey("targ")) ret.put("targ", request.getParameter("targ")); return ret; } }
6436da6dc0b1a42cf5f7e3fa756ab1fdb96de689
8bf6ce8b6f713340d3c3f945f187c3df016b8a16
/src/main/java/k8exam/platform/api/logging/LogsRepository.java
8158342fd35b4729f0edb907cf19913ac274c9f8
[]
no_license
mateothegreat/k8qs-platform-api
a9cdc6443ec5c68fc70920ae8a12709a607a91ac
3ffd81ffd638385b13713771c326916ec2e8a5e0
refs/heads/master
2020-04-18T05:15:43.907480
2019-02-06T05:45:59
2019-02-06T05:45:59
167,272,106
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package k8exam.platform.api.logging; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; @Repository public interface LogsRepository extends PagingAndSortingRepository<Log, Long> { // Page<Log> getByUserOrderByIdDesc(User user, Pageable pageable); }
497ec46ffddbb18551eb71ae63db1165391579a7
3c1791cbfce22c7eb7e6c5d0a58c899f289c1312
/src/breakout/Display/ScoreBoard.java
63acc63b5475e0151ff76875c5acb9c78133685f
[]
no_license
Hosamtag/Breakout_JavaFX
351b15621a50f6af6d64d4d345fe0496739d5e13
9a411f4b8c8412d777d85374f00c405d7411a987
refs/heads/master
2022-12-19T15:28:57.467236
2020-09-29T06:41:32
2020-09-29T06:41:32
299,526,969
0
0
null
null
null
null
UTF-8
Java
false
false
2,261
java
package breakout.Display; import breakout.Player; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.Group; import javafx.scene.text.Text; import java.io.FileInputStream; import javafx.scene.image.Image; import javafx.scene.paint.ImagePattern; public class ScoreBoard extends Rectangle { private static final double SCOREBOARD_WIDTH = 200; private static final double SCOREBOARD_HEIGHT = 400; private static final double SCOREBOARD_XPOS = 400; private static final double SCOREBOARD_YPOS = 0; private static final int DISPLAY_LABEL_XPOS = 430; private static final int DISPLAY_LABEL_YPOS_DISPLACEMENT = 70; private static final String SCOREBOARD_BACKGROUND = "data/galaxy.jpg"; private static final String[] DISPLAY_LABELS = new String[]{"Level:", "Lives:", "Score:", "High Score:"}; private List<StatusDisplay> statusDisplayOrderedList; public ScoreBoard() { super(SCOREBOARD_XPOS, SCOREBOARD_YPOS, SCOREBOARD_WIDTH, SCOREBOARD_HEIGHT); try { InputStream stream = new FileInputStream(SCOREBOARD_BACKGROUND); Image image = new Image(stream); this.setFill(new ImagePattern(image)); } catch (Exception e) { this.setFill(Color.PURPLE); } this.statusDisplayOrderedList = new ArrayList<>(); statusDisplayOrderedList.add(new LevelDisplay()); statusDisplayOrderedList.add(new LivesDisplay()); statusDisplayOrderedList.add(new ScoreDisplay()); statusDisplayOrderedList.add(new HighScoreDisplay()); } public void updateScoreBoard(Group root, Player myPlayer) { for (StatusDisplay display : statusDisplayOrderedList) { display.update(root, myPlayer); } } public void addDisplaysToRoot(Group root) { int i = 1; for (StatusDisplay display : statusDisplayOrderedList) { Text displayLabel = display .newDisplay(DISPLAY_LABEL_XPOS, DISPLAY_LABEL_YPOS_DISPLACEMENT * i, DISPLAY_LABELS[i - 1]); displayLabel.setFill(Color.WHITE); root.getChildren().add(displayLabel); root.getChildren().add(display); i++; } } }
2fbb6005c1bc2454d343d6bd3dc1d5d0c21cd9c8
a15950e54e6775e6f7f7004bb90a5585405eade7
/base/android/javatests/src/org/chromium/base/EarlyTraceEventTest.java
67f5cc5a29045c0f61a5cf2edbafe4087a1df727
[ "BSD-3-Clause" ]
permissive
whycoding126/chromium
19f6b44d0ec3e4f1b5ef61cc083cae587de3df73
9191e417b00328d59a7060fa6bbef061a3fe4ce4
refs/heads/master
2023-02-26T22:57:28.582142
2018-04-09T11:12:57
2018-04-09T11:12:57
128,760,157
1
0
null
2018-04-09T11:17:03
2018-04-09T11:17:03
null
UTF-8
Java
false
false
8,133
java
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.base; import static org.chromium.base.EarlyTraceEvent.AsyncEvent; import static org.chromium.base.EarlyTraceEvent.Event; import android.os.Process; import android.support.test.filters.SmallTest; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Feature; /** * Tests for {@link EarlyTraceEvent}. * * TODO(lizeb): Move to roboelectric tests. */ @RunWith(BaseJUnit4ClassRunner.class) public class EarlyTraceEventTest { private static final String EVENT_NAME = "MyEvent"; private static final String EVENT_NAME2 = "MyOtherEvent"; private static final long EVENT_ID = 1; @Before public void setUp() throws Exception { LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); EarlyTraceEvent.resetForTesting(); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testCanRecordEvent() { EarlyTraceEvent.enable(); long myThreadId = Process.myTid(); long beforeNanos = Event.elapsedRealtimeNanos(); EarlyTraceEvent.begin(EVENT_NAME); EarlyTraceEvent.end(EVENT_NAME); long afterNanos = Event.elapsedRealtimeNanos(); Assert.assertEquals(1, EarlyTraceEvent.sCompletedEvents.size()); Assert.assertTrue(EarlyTraceEvent.sPendingEvents.isEmpty()); Event event = EarlyTraceEvent.sCompletedEvents.get(0); Assert.assertEquals(EVENT_NAME, event.mName); Assert.assertEquals(myThreadId, event.mThreadId); Assert.assertTrue( beforeNanos <= event.mBeginTimeNanos && event.mBeginTimeNanos <= afterNanos); Assert.assertTrue(event.mBeginTimeNanos <= event.mEndTimeNanos); Assert.assertTrue(beforeNanos <= event.mEndTimeNanos && event.mEndTimeNanos <= afterNanos); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testCanRecordAsyncEvent() { EarlyTraceEvent.enable(); long beforeNanos = Event.elapsedRealtimeNanos(); EarlyTraceEvent.startAsync(EVENT_NAME, EVENT_ID); EarlyTraceEvent.finishAsync(EVENT_NAME, EVENT_ID); long afterNanos = Event.elapsedRealtimeNanos(); Assert.assertEquals(2, EarlyTraceEvent.sAsyncEvents.size()); Assert.assertTrue(EarlyTraceEvent.sPendingEvents.isEmpty()); AsyncEvent eventStart = EarlyTraceEvent.sAsyncEvents.get(0); AsyncEvent eventEnd = EarlyTraceEvent.sAsyncEvents.get(1); Assert.assertEquals(EVENT_NAME, eventStart.mName); Assert.assertEquals(EVENT_ID, eventStart.mId); Assert.assertEquals(EVENT_NAME, eventEnd.mName); Assert.assertEquals(EVENT_ID, eventEnd.mId); Assert.assertTrue(beforeNanos <= eventStart.mTimestampNanos && eventEnd.mTimestampNanos <= afterNanos); Assert.assertTrue(eventStart.mTimestampNanos <= eventEnd.mTimestampNanos); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testCanRecordEventUsingTryWith() { EarlyTraceEvent.enable(); long myThreadId = Process.myTid(); long beforeNanos = Event.elapsedRealtimeNanos(); try (TraceEvent e = TraceEvent.scoped(EVENT_NAME)) { // Required comment to pass presubmit checks. } long afterNanos = Event.elapsedRealtimeNanos(); Assert.assertEquals(1, EarlyTraceEvent.sCompletedEvents.size()); Assert.assertTrue(EarlyTraceEvent.sPendingEvents.isEmpty()); Event event = EarlyTraceEvent.sCompletedEvents.get(0); Assert.assertEquals(EVENT_NAME, event.mName); Assert.assertEquals(myThreadId, event.mThreadId); Assert.assertTrue( beforeNanos <= event.mBeginTimeNanos && event.mBeginTimeNanos <= afterNanos); Assert.assertTrue(event.mBeginTimeNanos <= event.mEndTimeNanos); Assert.assertTrue(beforeNanos <= event.mEndTimeNanos && event.mEndTimeNanos <= afterNanos); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testIncompleteEvent() { EarlyTraceEvent.enable(); EarlyTraceEvent.begin(EVENT_NAME); Assert.assertTrue(EarlyTraceEvent.sCompletedEvents.isEmpty()); Assert.assertEquals(1, EarlyTraceEvent.sPendingEvents.size()); EarlyTraceEvent.Event event = EarlyTraceEvent.sPendingEvents.get(EVENT_NAME); Assert.assertEquals(EVENT_NAME, event.mName); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testNoDuplicatePendingEvents() { EarlyTraceEvent.enable(); EarlyTraceEvent.begin(EVENT_NAME); try { EarlyTraceEvent.begin(EVENT_NAME); } catch (IllegalArgumentException e) { // Expected. return; } Assert.fail(); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testIgnoreEventsWhenDisabled() { EarlyTraceEvent.begin(EVENT_NAME); EarlyTraceEvent.end(EVENT_NAME); try (TraceEvent e = TraceEvent.scoped(EVENT_NAME2)) { // Required comment to pass presubmit checks. } Assert.assertNull(EarlyTraceEvent.sCompletedEvents); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testIgnoreAsyncEventsWhenDisabled() { EarlyTraceEvent.startAsync(EVENT_NAME, EVENT_ID); EarlyTraceEvent.finishAsync(EVENT_NAME, EVENT_ID); Assert.assertNull(EarlyTraceEvent.sAsyncEvents); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testIgnoreNewEventsWhenFinishing() { EarlyTraceEvent.enable(); EarlyTraceEvent.begin(EVENT_NAME); EarlyTraceEvent.disable(); Assert.assertEquals(EarlyTraceEvent.STATE_FINISHING, EarlyTraceEvent.sState); EarlyTraceEvent.begin(EVENT_NAME2); EarlyTraceEvent.end(EVENT_NAME2); Assert.assertEquals(1, EarlyTraceEvent.sPendingEvents.size()); Assert.assertTrue(EarlyTraceEvent.sCompletedEvents.isEmpty()); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testFinishingToFinished() { EarlyTraceEvent.enable(); EarlyTraceEvent.begin(EVENT_NAME); EarlyTraceEvent.disable(); Assert.assertEquals(EarlyTraceEvent.STATE_FINISHING, EarlyTraceEvent.sState); EarlyTraceEvent.begin(EVENT_NAME2); EarlyTraceEvent.end(EVENT_NAME2); EarlyTraceEvent.end(EVENT_NAME); Assert.assertEquals(EarlyTraceEvent.STATE_FINISHED, EarlyTraceEvent.sState); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testCannotBeReenabledOnceFinished() { EarlyTraceEvent.enable(); EarlyTraceEvent.begin(EVENT_NAME); EarlyTraceEvent.end(EVENT_NAME); EarlyTraceEvent.disable(); Assert.assertEquals(EarlyTraceEvent.STATE_FINISHED, EarlyTraceEvent.sState); EarlyTraceEvent.enable(); Assert.assertEquals(EarlyTraceEvent.STATE_FINISHED, EarlyTraceEvent.sState); } @Test @SmallTest @Feature({"Android-AppBase"}) public void testThreadIdIsRecorded() throws Exception { EarlyTraceEvent.enable(); final long[] threadId = {0}; Thread thread = new Thread() { @Override public void run() { TraceEvent.begin(EVENT_NAME); threadId[0] = Process.myTid(); TraceEvent.end(EVENT_NAME); } }; thread.start(); thread.join(); Assert.assertEquals(1, EarlyTraceEvent.sCompletedEvents.size()); EarlyTraceEvent.Event event = EarlyTraceEvent.sCompletedEvents.get(0); Assert.assertEquals(threadId[0], event.mThreadId); } }
a6c8eeeb5fb977742b92a19d99307d5bd6e172d1
4a64d20a1cadffd9efb746e20435cb1843d219de
/commons/src/com/cuking/utils/PhoneNoUtils.java
b3abc42927edbb2662035508c221a62b1a983635
[]
no_license
cukingZhao/webComm
436022af6f1b5b08506b24e7caa7f6a85b5535a3
6e42cade9d21d85380611f54e4d24a022e72df42
refs/heads/master
2020-07-12T17:53:45.085541
2017-12-27T06:39:10
2017-12-27T06:39:10
73,901,758
2
0
null
null
null
null
UTF-8
Java
false
false
1,491
java
package com.cuking.utils; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by cuking on 2017/4/18. */ public class PhoneNoUtils { /** * 大陆号码或香港号码均可 */ public static boolean isPhoneLegal(String str) { return isChinaPhoneLegal(str) || isHKPhoneLegal(str); } /** * 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数 * 此方法中前三位格式有: * 13+任意数 * 145,147 * 15+任意数 * 166 * 17+除9的任意数 * 18+任意数 * 198,199 */ public static boolean isChinaPhoneLegal(String str) { String regExp = "^((13[0-9])|(145)|(147)|(15[0-9])|(166)|(17[0-8])|(18[0-9])|(19[8-9]))\\d{8}$"; Pattern p = Pattern.compile(regExp); Matcher m = p.matcher(str); return m.matches(); } /** * 香港手机号码8位数,5|6|8|9开头+7位任意数 */ public static boolean isHKPhoneLegal(String str) { String regExp = "^(5|6|8|9)\\d{7}$"; Pattern p = Pattern.compile(regExp); Matcher m = p.matcher(str); return m.matches(); } /** * 手机号加密 * * @param phoneNo * @return */ public static String formatPhone(String phoneNo) { return new StringBuilder(phoneNo.substring(0, 3)).append("****").append(phoneNo.substring(phoneNo.length() - 4, phoneNo.length())).toString(); } }
6b62dcaff81e2f8859797b2ccb35a5fe16b9e333
56649cd6f71bf77a4b4498d0e710d915eb45ea2b
/voxel-editor-editor/src/main/java/wilds/voxeleditor/editor/views/StatusBarView.java
3affef4d309fba6253ee9cddb6e0738ed39ca623
[]
no_license
MarkWilds/wilds.voxel-editor
61855fe828c9887c45bfc3aa29d31ebe15265ef5
3b1f1e9bef6edd957153e0f8b1338c5be7295a36
refs/heads/master
2022-10-20T21:47:31.245549
2019-10-26T14:06:28
2019-10-26T14:06:28
133,632,640
0
0
null
2022-10-05T18:37:04
2018-05-16T08:11:36
Java
UTF-8
Java
false
false
565
java
package wilds.voxeleditor.editor.views; import com.alee.extended.statusbar.WebMemoryBar; import com.alee.extended.statusbar.WebStatusBar; import com.alee.laf.label.WebLabel; /** * @author Mark "Wilds" van der Wal * @since 5-1-2018 */ public class StatusBarView extends WebStatusBar { private WebLabel messageLabel; public void setMessage(final String message) { messageLabel.setText(message); } public StatusBarView() { messageLabel = new WebLabel(); add(messageLabel); addToEnd(new WebMemoryBar()); } }
34f117d5689c114782de9e6a1eaccfbf469aff95
f5466a99799933e22263b2d3bacb8f7cbcef8cbe
/soastastore_demo/TestCase.java
0556e0c89ae1fda3316989a20fcd3c25dba50b80
[ "MIT" ]
permissive
manuieee/selenium
b18c4237e73df1e5a8519ba33ec192aa203e2e29
f5bd532a6d9ca8e6c984ebfa38d592b7dde86de4
refs/heads/master
2020-03-12T02:55:39.507070
2018-04-25T20:24:24
2018-04-25T20:24:24
130,414,234
0
0
null
null
null
null
WINDOWS-1258
Java
false
false
2,693
java
import java.util.regex.Pattern; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; public class TestCase { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://www.soastastore.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testCacse() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.linkText("Store")).click(); driver.findElement(By.linkText("Tron: Legacy")).click(); driver.findElement(By.id("product_155_submit_button")).click(); new Select(driver.findElement(By.name("product_rating"))).selectByVisibleText("2"); driver.findElement(By.id("s")).clear(); driver.findElement(By.id("s")).sendKeys("firth"); driver.findElement(By.id("searchsubmit")).click(); driver.findElement(By.linkText("The King’s Speech")).click(); new Select(driver.findElement(By.name("product_rating"))).selectByVisibleText("4"); driver.findElement(By.id("product_160_submit_button")).click(); driver.findElement(By.linkText("Checkout")).click(); driver.findElement(By.cssSelector("input.remove_button")).click(); driver.findElement(By.cssSelector("span > input[name=\"submit\"]")).click(); // Warning: assertTextPresent may require manual changes assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$")); } @After public void tearDown() throws Exception { driver.quit(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } } private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } } private boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } } private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } } }
0ade77908aaf5dfa77b09ad3b2b1323d23323da2
7aea9e09f43082559ef76e692d533811ece65cea
/source/PbJNetwork/src/pb/net/udp/UdpServerListener.java
94c3ad70c04a0392d2aa23733d17a9258f0d965a
[ "Apache-2.0" ]
permissive
ProteanBear/ProteanBear_Java
2941db6169e4943ce5a32b2633515a8f0a225099
ac414e3724f775b8121102c084994ae38c5eaa13
refs/heads/master
2020-05-03T18:54:04.656673
2015-08-03T15:33:41
2015-08-03T15:33:41
40,125,581
1
0
null
null
null
null
UTF-8
Java
false
false
2,914
java
package pb.net.udp; import pb.net.socket.SocketDataManager; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketException; import pb.thread.AbstractListenerRunnable; import pb.thread.ListenerRunnable; /** * UDP服务端连接监听器类。<br/> * 实现ListenerRunnable端口,用于创建监听器线程。<br/> * 1.00 —— 实现基本的方法 * * @author proteanBear(马强) * @version 1.01 2012/02/06 */ public class UdpServerListener extends AbstractListenerRunnable implements ListenerRunnable { /** * 域(私有)<br/> * 名称: listener<br/> * 描述: 发送和接收数据报包的套接字<br/> */ private DatagramSocket listener; /** * 域(私有)<br/> * 名称: dataManager<br/> * 描述: 记录对当前监听器使用的数据管理器<br/> */ private SocketDataManager dataManager; /** * 构造函数<br/> * 描述: 初始化域。 * 捕捉ServerSocket创建时的IOException异常,如果出现异常停止监听并记录错误信息。 * * @param server - 当前监听器所属的Socket服务器 * @param port - 监听端口 * @param dataManager - Socket数据管理器接口 */ public UdpServerListener(int port,SocketDataManager dataManager) { super(); try { this.dataManager=dataManager; this.listener=new DatagramSocket(port); } catch(SocketException ex) { this.stopThread(); this.setError(ex.toString()); } } /** * 方法(受保护)<br/> * 名称: beforeStop<br/> * 描述: 停止监听线程前进行的处理<br/> * 关闭当前的服务端口监听器 */ @Override public void beforeStop() { this.listener.close(); this.listener=null; } /** * 方法(受保护)<br/> * 名称: Execute<br/> * 描述: 线程运行监听调用方法。<br/> */ @Override protected void Execute() { try { byte[] buf=new byte[8192]; DatagramPacket packet=new DatagramPacket(buf,buf.length); this.listener.receive(packet); this.dataManager.receiveUdpData(buf,packet.getLength()); } catch(IOException ex) { this.setError(ex.getMessage()); } } /** * 方法(私有)<br/> * 名称: generateObject<br/> * 描述: 生成新的线程实现对象<br/> * 线程池使用,用于生成新的接口实现对象 * * @return ListenerRunnable - 新的线程实现对象 */ @Override public ListenerRunnable generateObject() { throw new UnsupportedOperationException("未实现此方法!"); } }
f0f2947dcb5f30ddc1b62975ee1e21be18a640f7
c9286268bfc5443d1c8f115315bb3c9c9fcfd6d0
/src/main/java/framework/webpage/IPage.java
3cc35afdd4153a7dd714c0ac500a01cc8d1efc5f
[]
no_license
AlanRun/AllureDemo
52413ad47dc1fd84539fa2bd41827c14cd8f4204
e777cc60e5956328080734b474d3d27e8b11718a
refs/heads/main
2023-04-15T04:58:15.969551
2021-04-25T09:55:51
2021-04-25T09:55:51
360,416,171
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package framework.webpage; public interface IPage { String getHtmlSource(); String getLocation(); String getTitle(); }
54d364b9241639a47764cc0b2351e432a685f828
c9e8b2b419100822618faf8a3da49262a3d35790
/EJBPlanetExpress/src/java/model/ModelPedidos.java
13457aef57f01dd95772f06397f4c55180bfdf50
[]
no_license
burinmatheus/E-commerce-Planet-Express
ff11ffd46d3376a1b9e715104c42f84de9de20ab
04a48534b1181885e5eee361c388adf1c8604060
refs/heads/master
2022-12-05T19:15:24.184203
2020-08-21T21:11:40
2020-08-21T21:11:40
275,526,043
0
0
null
null
null
null
UTF-8
Java
false
false
1,649
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.sql.Date; import java.sql.Time; /** * * @author Matheus M. Burin */ public class ModelPedidos { private int id_pedido; private int id_usuario; private int status; private Date data; private Time hora; private double valor; private int qtde; private ModelProdutos produto; public int getId_pedido() { return id_pedido; } public void setId_pedido(int id_pedido) { this.id_pedido = id_pedido; } public int getId_usuario() { return id_usuario; } public void setId_usuario(int id_usuario) { this.id_usuario = id_usuario; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public Date getData() { return data; } public void setData(Date data) { this.data = data; } public Time getHora() { return hora; } public void setHora(Time hora) { this.hora = hora; } public double getValor() { return valor; } public void setValor(double valor) { this.valor = valor; } public int getQtde() { return qtde; } public void setQtde(int qtde) { this.qtde = qtde; } public ModelProdutos getProduto() { return produto; } public void setProduto(ModelProdutos produto) { this.produto = produto; } }
fe96a7cc29fdf971aec7a945f5aa5599c0b9d791
4ddd1c3d48bbfc54afd9c142e471fc558efec80c
/app/src/main/java/com/material/materialdesign2/TileContentFragment.java
edb3ab04a8ad4a4f78623e898c69ccb3fabbd1d5
[]
no_license
develician/yoloholo-android
b93556ad35d3be3db439b401c23e960e5d44d76f
8019a5be10913ab00318af9fd2545e5425e1f37f
refs/heads/master
2020-03-17T10:06:31.146334
2018-05-15T10:33:50
2018-05-15T10:33:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,439
java
package com.material.materialdesign2; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.speech.RecognizerIntent; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; 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.TextView; public class TileContentFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // return inflater.inflate(R.layout.item_tile, null); RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.recycler_view, container, false); ContentAdapter adapter = new ContentAdapter(recyclerView.getContext()); recyclerView.setAdapter(adapter); recyclerView.setHasFixedSize(true); int tilePadding = getResources().getDimensionPixelSize(R.dimen.tile_padding); recyclerView.setPadding(tilePadding, tilePadding, tilePadding, tilePadding); recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2)); return recyclerView; } public static class ViewHolder extends RecyclerView.ViewHolder { public ImageView picture; public TextView name; public ViewHolder(LayoutInflater inflater, ViewGroup parent) { super(inflater.inflate(R.layout.item_tile, parent, false)); picture = (ImageView) itemView.findViewById(R.id.tile_picture); name = (TextView) itemView.findViewById(R.id.tile_title); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Context context = view.getContext(); Intent intent = new Intent(context, DetailActivity.class); context.startActivity(intent); } }); } } public static class ContentAdapter extends RecyclerView.Adapter<ViewHolder> { private static final int LENGTH = 18; private final String[] mPlaces; private final Drawable[] mPlacePictures; public ContentAdapter(Context context) { Resources resources = context.getResources(); mPlaces = resources.getStringArray(R.array.places); TypedArray a = resources.obtainTypedArray(R.array.places_picture); mPlacePictures = new Drawable[a.length()]; for (int i = 0;i < mPlacePictures.length;i++) { mPlacePictures[i] = a.getDrawable(i); } a.recycle(); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(parent.getContext()), parent); } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.picture.setImageDrawable(mPlacePictures[position % mPlacePictures.length]); holder.name.setText(mPlaces[position % mPlaces.length]); } @Override public int getItemCount() { return LENGTH; } } }
a7b49fd12a91f5e62d4e13f737ac8440d1bba8f2
265f7e4f42c43ea9e9f98901fd699d5f57180163
/src/logic/utilities/PageLoader.java
052a717599921713478358e7abf79ce589e47586
[]
no_license
jacopofabi/BeEcological
85100fd6ddf8f374aa333fe8c6a01c5713b5d8eb
63eaef138a5573ec56884dae6f7a2ff742544716
refs/heads/master
2022-07-20T15:16:30.090944
2020-06-11T19:13:54
2020-06-11T19:13:54
215,526,119
2
1
null
null
null
null
UTF-8
Java
false
false
4,473
java
package logic.utilities; import java.io.File; import java.io.IOException; import java.net.URL; import javafx.event.Event; import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.MenuButton; import javafx.stage.Stage; import logic.bean.UserBean; import logic.view.HomepageView; import logic.view.SearchResultView; public class PageLoader { private FXMLLoader loader; private Stage stage; private static String errorMessage = "Page loading error"; public PageLoader(Page page, Event event) throws IOException { init1(page.getResource(), page.getTitle(), event); } public PageLoader(Page page, MenuButton button) throws IOException { init2(page.getResource(), page.getTitle(), button); } private void init1(String resource, String title, Event event) throws IOException { stage = (Stage) ((Node)event.getSource()).getScene().getWindow(); URL url = new File(resource).toURI().toURL(); loader = new FXMLLoader(url); Parent tableViewParent = loader.load(); Scene tableViewScene = new Scene(tableViewParent); stage.setScene(tableViewScene); stage.setTitle(title); } private void init2(String resource, String title, MenuButton button) throws IOException { stage = (Stage) button.getScene().getWindow(); URL url = new File(resource).toURI().toURL(); loader = new FXMLLoader(url); Parent tableViewParent = loader.load(); Scene tableViewScene = new Scene(tableViewParent); stage.setScene(tableViewScene); stage.setTitle(title); } public Object getController() { return loader.getController(); } public void stageShow() { stage.show(); } public void homeConfig() { HomepageView controller = (HomepageView) loader.getController(); if(UserBean.getInstance() != null) { controller.loginGroup4.setVisible(false); controller.userGroup4.setVisible(true); controller.circleUserGroup4.setVisible(true); controller.circleOwnerGroup4.setVisible(false); controller.userButton4.setText(UserBean.getInstance().getUsbUsername()); controller.welcomebackText4.setText("Welcome back, "+UserBean.getUserInstance("").getUsbUsername()); } stage.show(); } public void searchConfig() { SearchResultView controller = (SearchResultView) loader.getController(); if(UserBean.getInstance() != null) { controller.loginGroup.setVisible(false); controller.userGroup.setVisible(true); controller.userButton.setText(UserBean.getInstance().getUsbUsername()); } else { controller.userGroup.setVisible(false); controller.loginGroup.setVisible(true); } controller.textSearched.setText(Tool.getString()); //setta il testo del risultato come quello cercato stage.show(); } public static String getErrorMessage() { return errorMessage; } public enum Page { BOOKING_AND_UNLOADS("src/res/fxml/BookingANDUnloads.fxml", "BeEcological - Booking & Unloads"), CENTER_PAGE("src/res/fxml/CenterPage.fxml", "BeEcological - Center Page"), HOME_OWNER("src/res/fxml/HomeOwner.fxml", "BeEcological for Managers - Homepage"), HOMEPAGE("src/res/fxml/Homepage.fxml", "BeEcological - Homepage"), LOGIN_OWNER("src/res/fxml/LoginOwner.fxml", "BeEcological - Login"), LOGIN_USER("src/res/fxml/LoginUser.fxml", "BeEcological - Login"), MANAGE_BOOKING("src/res/fxml/ManageBooking.fxml", "BeEcological for Managers - Manage Booking"), MANAGE_INFORMATION("src/res/fxml/ManageInformation.fxml", "BeEcological for Managers - Manage Information"), OWNER_PROFILE("src/res/fxml/OwnerProfile.fxml", "BeEcological for Managers - Profile"), REGISTER_UNLOAD("src/res/fxml/RegisterUnload.fxml", "BeEcological for Managers - Register Unload"), SEARCH_RESULT("src/res/fxml/SearchResult.fxml", "BeEcological - Search Result"), SHOP("src/res/fxml/Shop.fxml", "BeEcological - BeEcological - Shop"), USER_BOOKING_LIST("src/res/fxml/UserBookingList.fxml", "BeEcological - Booking List"), USER_PROFILE("src/res/fxml/UserProfile.fxml", "BeEcological - Profile"); private String resource; private String title; private Page(String resource, String title) { this.resource = resource; this.title = title; } public String getResource() { return this.resource; } public String getTitle() { return this.title; } } }
dd40a71da18fda5e557e4121836a74042fc14b56
a20ae89d3f35c0af2cf5334ebaa9124a998957f7
/Reseaux/TP/TP1/gamelin/java/src/fr/univ_lille1/fil/reseaux/gui/Window.java
4858e9d57b51824ea03e06e16bb979c9c39b3bcd
[]
no_license
Gounaya/Licence3-Semestre6
8873971d5f5cf5115c2edac3954c36ef290a6f92
61fcf13d6f144788785d0100b41d69417a3d0a11
refs/heads/master
2021-04-16T03:34:38.545419
2016-04-05T06:37:22
2016-04-05T06:37:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,439
java
package fr.univ_lille1.fil.reseaux.gui; import java.awt.Point; import java.awt.TextArea; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; import com.jgoodies.forms.layout.ColumnSpec; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.FormSpecs; import com.jgoodies.forms.layout.RowSpec; import fr.univ_lille1.fil.reseaux.Application; @SuppressWarnings("serial") public class Window extends JFrame { protected Application app; protected JPanel contentPane; protected JTextArea textArea; protected JScrollPane scrollPane; private TextArea message; /** * Create the frame. */ public Window(Application app) { this.app = app; addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { app.getReceiver().leaveGroupe(); app.getSender().leaveGroupe(); } }); setTitle("Chat"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 610, 683); contentPane = new JPanel(); setContentPane(contentPane); scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); textArea = new JTextArea(); textArea.setEditable(false); textArea.setText("Welcome"); textArea.setTabSize(4); scrollPane.setViewportView(textArea); message = new TextArea(); message.addKeyListener(this.app); contentPane.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(577px;min):grow"),}, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:max(554px;default):grow(11)"), FormSpecs.UNRELATED_GAP_ROWSPEC, RowSpec.decode("fill:59px"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,})); contentPane.add(message, "2, 4, fill, fill"); contentPane.add(scrollPane, "2, 2, fill, fill"); setVisible(true); } public void seText(String msg){ textArea.setText(textArea.getText() + "\n" + msg); message.setText(""); //scrollPane.getViewport().setViewPosition(new Point(0,textArea.getDocument().getLength())); } public TextArea getMessage(){ return message; } }
35ddd50ca56e4f370f0914ed52ed9fe8af29fbdc
de42c27af340943745b912ce60ed84ddf3f56fa4
/app/src/test/java/com/example/nisha/productsearchdb/ExampleUnitTest.java
ed658a218880afe94b0152262472b5ae631d20b0
[]
no_license
Priyaveluru/AndroidAsyncTask
79816fcff0bfc3bbfb7363fd142a44eb22a1ebd4
9ff09d36703f6226b6a7a4b4feb1e019273b86e4
refs/heads/master
2021-07-03T22:43:04.205864
2017-09-24T21:05:05
2017-09-24T21:05:05
104,675,012
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.example.nisha.productsearchdb; 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() throws Exception { assertEquals(4, 2 + 2); } }
ba9711e747eb4a3f728ae27dc70d200ef7ffd89f
d48fc4adbe6445508be8b506decacd3f738ad19b
/spring-security-oauth2-server/src/main/java/com/ciao/oauth2/server/user/service/UserRoleService.java
0449307f71c44abb91a8148916599ef13759cfba
[]
no_license
xuechaoke/spring-boot-security-oauth2
5e5ea82ebc2f4250dcd91f80fa879a6fb12839ff
eec797d1e2a41c7c369350bc1d93f913d8fc894c
refs/heads/master
2020-07-06T23:14:11.020431
2019-08-19T16:00:25
2019-08-19T16:00:25
203,168,575
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package com.ciao.oauth2.server.user.service; import com.ciao.oauth2.server.mp.service.BaseService; import com.ciao.oauth2.server.mp.tool.page.PageData; import com.ciao.oauth2.server.user.entity.UserRoleEntity; import com.ciao.oauth2.server.user.entity.dto.UserRoleDTO; import java.util.List; import java.util.Map; /** * 用户角色表 * * @author xuechaoke [email protected] * @since v1.0.0 2019-08-19 */ public interface UserRoleService extends BaseService<UserRoleEntity> { PageData<UserRoleDTO> page(Map<String, Object> params); List<UserRoleDTO> list(Map<String, Object> params); UserRoleDTO get(String id); void save(UserRoleDTO dto); void update(UserRoleDTO dto); void delete(String[] ids); }
0205bffdb55fa1f8549955ec7cd45efec25bef5e
0b409f419739c3890904d1ffc28e0c0634fe2f6c
/src/main/java/pages/LoginPage.java
137737d8eb044083d9cad412008e84b90aefc6cb
[]
no_license
MaxRoss89/Lesson6WebUI
6bb6945c5a58748c59448a26d543f51546f64b93
30419b69b621decbe71b4a9fd80098e0eb162f9a
refs/heads/master
2023-05-26T22:55:13.849250
2021-06-12T11:38:50
2021-06-12T11:38:50
376,275,269
0
0
null
null
null
null
UTF-8
Java
false
false
1,104
java
package pages; import Base.BaseView; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class LoginPage extends BaseView { @FindBy(css = "input[id='prependedInput']") private WebElement inputLogin; @FindBy(css = ".span2[name='_password']") private WebElement inputPassword; @FindBy(xpath = ".//button[@name='_submit']") private WebElement buttonSignIn; public LoginPage(WebDriver driver) { super(driver); } public LoginPage enterLogin(String login) { inputLogin.sendKeys(login); return this; } public LoginPage enterPassword(String password) { inputPassword.sendKeys(password); return this; } public HomePage clickLoginButton() { buttonSignIn.click(); return new HomePage(driver); } public HomePage authoriseScenario(String login, String password) { inputLogin.sendKeys(login); inputPassword.sendKeys(password); buttonSignIn.click(); return new HomePage(driver); } }
612145ee42fe7eff94ac195ac7214fbede390d24
e063498878ad06b6829bf61953af0411f3f330b4
/src/main/java/com/example/demo/contoller/UserController.java
a0176717ed8966cd9d6011d775947dcb53364cf2
[]
no_license
awesomeme01/InitSystem
cb38c39c9d3b231fc46a23c56193dec4b20c780a
66f8c501d02038e751ce67a2388e47eddb47ca2f
refs/heads/master
2023-03-03T03:22:14.833351
2021-02-14T11:52:02
2021-02-14T11:52:02
298,484,735
0
0
null
null
null
null
UTF-8
Java
false
false
5,054
java
package com.example.demo.contoller; import com.example.demo.helper.Response; import com.example.demo.helper.UserUpdateWrapper; import com.example.demo.helper.UserWrapper; import com.example.demo.helper.PasswordWrapper; import com.example.demo.model.User; import com.example.demo.repository.CourseRepository; import com.example.demo.repository.GroupRepository; import com.example.demo.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.annotation.Secured; import org.springframework.web.bind.annotation.*; import java.security.Principal; @RestController @RequestMapping(path = "/user") @CrossOrigin(origins = "*") public class UserController { // List<User> getAll(); // User createUser(User user); // User updateUser(User user); // User getUserById(Long id); // void deleteUserById(Long id); @Autowired UserService userService; @Autowired CourseRepository courseRepository; @Autowired GroupRepository groupRepository; @Secured("ROLE_USER") @GetMapping(path = "/getAll") public Response getAll(){ return new Response(true, "All registered users", userService.getAll()); } @Secured("ROLE_USER") @GetMapping(path = "/getStudentsByCourse/{id}") public Response getStudentsByCourse(@PathVariable Long id){ return new Response(true, "All student in course with id = " + id, userService.getUsersByCourse(courseRepository.findById(id).get()).stream().filter(x->x.getLevel() == 1)); } @Secured("ROLE_ADMIN") @PostMapping(path = "/create") public Response createUser(@RequestBody UserWrapper userWrapper){ try{ User user = new User.Builder(userWrapper.getUsername()) .withName(userWrapper.getFullname()) .withGender(userWrapper.getGender()) .withPassword(userWrapper.getPassword()) .withPhoneNumber(userWrapper.getPhonenumber()) .withEmail(userWrapper.getEmail()) .isActive(userWrapper.getIsActive()) .withLevel(userWrapper.getLevel()) .build(); if(userWrapper.getCourseId()!=null){ user.setCourse(courseRepository.findById(userWrapper.getCourseId()).get()); } if(userWrapper.getGroupId()!=null){ user.setGroup(groupRepository.findById(userWrapper.getGroupId()).get()); } return new Response(true, "New user created!", userService.createUser(user)); } catch (NullPointerException ex){ return new Response(false, "Some fields were empty!", ex.getStackTrace()); } } @Secured("ROLE_ADMIN") @PostMapping(path = "/update/{id}") public Response updateUser(@RequestBody UserUpdateWrapper userUpdateWrapper, @PathVariable Long id){ try{ User user = new User.Builder(userUpdateWrapper.getUsername()) .withEmail(userUpdateWrapper.getEmail()) .withGender(userUpdateWrapper.getGender()) .withPhoneNumber(userUpdateWrapper.getPhoneNumber()) .withName(userUpdateWrapper.getFullname()) .withPassword(userUpdateWrapper.getPassword()) .isActive(userUpdateWrapper.getIsActive()).build(); return new Response(true, "Updated user with id = " + id, userService.updateUser(user, id)); } catch (NullPointerException ex){ return new Response(false, "Some fields were empty!", ex.getStackTrace()); } } // @Secured("ROLE_ADMIN") // @PostMapping(path = "/login") // public Response updateUser(@RequestBody LoginCheck loginCheck){ // return new Response(true, "Login successful",userService.updateUser()); // } @Secured("ROLE_ADMIN") @GetMapping(path = "/get/{id}") public Response getUserById(@PathVariable Long id){ return new Response(true, "Information about User with id = " + id, userService.getUserById(id)); } @Secured("ROLE_USER") @GetMapping(path = "/getByCourseId/{id}") public Response getByCourseId(@PathVariable Long id){ return new Response(true, "All users of the course with id = " + id, userService.getUsersByCourse(courseRepository.findById(id).get())); } @Secured("ROLE_ADMIN") @DeleteMapping(path = "/delete/{id}") public Response deleteUser(@PathVariable Long id){ userService.deleteUserById(id); return new Response(true, "User with id = " + id + " was deleted!", null ); } @Secured("ROLE_USER") @PostMapping(path = "/changePassword") public Response changePassword(@RequestBody PasswordWrapper passwordWrapper, Principal principal){ passwordWrapper.setUser(userService.getUserByUsername(principal.getName())); return new Response(true,"Password changed successfully", userService.changePassword(passwordWrapper)); } }
eaee47e7ae6388e7c79268d3f540cb6e0205b7e0
bf016d3d843999e5be9ddc0db9000f72b3e7941e
/chapter_002/src/test/java/ru/job4j/filestatuschecker/ModificationsRegistryTest.java
685a86f3e1cce6ce42b8ef1a8629388719b05ae1
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
vguryanov/job4j
16adf3e740ce980e22e5f6911a203cea3390d8a9
1aedca2f1fc1817e1b69e65cf4b69fb12cc245c0
refs/heads/master
2020-03-08T20:14:59.558540
2018-08-12T14:35:40
2018-08-12T14:35:40
128,377,401
2
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
package ru.job4j.filestatuschecker; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; import static org.hamcrest.core.Is.is; /** * Created by User2 on 07.05.2018. */ public class ModificationsRegistryTest { private FileSystem testFileSystem; @Before public void setUp() { testFileSystem = new FileSystem(); } @After public void after() { testFileSystem.clear(); } @Test public void ifAddingThenStatusOfModificationIsAdded() { String testFilePath = "file1"; testFileSystem.add(testFilePath); ModificationsRegistry testRegistry = new ModificationsRegistry(testFileSystem); testRegistry.scanFileSystemForModifications(); FileStatus result = testRegistry.getLastModificationStatusOfFile(testFilePath); FileStatus expected = FileStatus.Added; assertThat(result, is(expected)); } @Test public void ifRemovingThenStatusOfModificationIsRemoved() { String testFilePath = "file1"; testFileSystem.add(testFilePath); ModificationsRegistry testRegistry = new ModificationsRegistry(testFileSystem); testRegistry.scanFileSystemForModifications(); testFileSystem.removeFiles(testFilePath); testRegistry.scanFileSystemForModifications(); FileStatus result = testRegistry.getLastModificationStatusOfFile(testFilePath); FileStatus expected = FileStatus.Removed; assertThat(result, is(expected)); } }
c8c6ccc20aca3b8b9a203f8bbbcc5761079c11ef
771fa54ba5b0c985d185d931367bdb97d47987ad
/weekSeven/TTSTwitterAVD/src/main/java/com/tts/TTSTwitterAVD/repository/TagRepo.java
fc812de636f5691db543be2b4ec210afcc49e67d
[]
no_license
errk01/ADV-Java-06-15-2021
1e8142661df22b536aad7e26328317d266992064
a14ae60f21335465512d87d9a05b529e7e8551f2
refs/heads/main
2023-07-15T14:53:41.027761
2021-08-03T14:40:43
2021-08-03T14:40:43
379,683,505
0
0
null
2021-08-03T14:40:26
2021-06-23T17:37:33
Java
UTF-8
Java
false
false
305
java
package com.tts.TTSTwitterAVD.repository; import com.tts.TTSTwitterAVD.model.Tag; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface TagRepo extends CrudRepository<Tag, Long> { Tag findByPhrase(String phrase); }
e8df4c640ff38e20f4fe86da5fafd407b37ae29f
5ac5f43848b36154198172172e3867d41e6692b2
/src/leetcode/QueueReconstructionbyHeight.java
fa0f13bf5cf3c0b1582d90b141e9f886178061ba
[]
no_license
kingraser/leetcode
619aba7e5afe2c1655f1430f23d9c9de8a3ff34b
c1a47d6f83a3f3f6bd1395ed32f0ba42f2885e77
refs/heads/master
2023-08-18T01:35:28.032279
2023-08-09T07:39:59
2023-08-09T07:39:59
41,731,944
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package leetcode; import static org.junit.Assert.assertArrayEquals; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import org.junit.Test; public class QueueReconstructionbyHeight { /* Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of this person who have a height greater than or equal to h. Write an algorithm to reconstruct the queue. Note: The number of people is less than 1,100. Example Input: [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]] Output: [[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]] */ @Test public void test() { assertArrayEquals(new int[][] { { 5, 0 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 4, 4 }, { 7, 1 } }, reconstructQueue(new int[][] { { 7, 0 }, { 4, 4 }, { 7, 1 }, { 5, 0 }, { 6, 1 }, { 5, 2 } })); } public int[][] reconstructQueue(int[][] people) { Arrays.sort(people, (p1, p2) -> p2[0] == p1[0] ? p1[1] - p2[1] : p2[0] - p1[0]); List<int[]> result = new LinkedList<>(); Arrays.stream(people).forEach(p -> result.add(p[1], p)); return result.toArray(people); } }
0f1483a1a4eda157706532725848b3120ba60413
7f2dfd7728438792df39a260ed4bd09e43302d58
/src/org/jboxcar/api/Shock.java
3693fd949e91e6a5d0e8d169d2ff805c2e6cf876
[]
no_license
ZWiki/JBoxCar
bad989d2ccb49669e1894ae957af4e6a30739382
32efe7365d608a361345787b8fe2bf9af0f0246e
refs/heads/master
2021-01-10T14:42:39.883498
2015-12-16T06:20:06
2015-12-16T06:20:06
48,091,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,924
java
package org.jboxcar.api; import static org.jboxcar.util.Globals.world; import org.jbox2d.collision.shapes.PolygonShape; import org.jbox2d.common.Vec2; import org.jbox2d.dynamics.Body; import org.jbox2d.dynamics.BodyDef; import org.jbox2d.dynamics.BodyType; import org.jbox2d.dynamics.FixtureDef; public class Shock { private Body chassis; private float hx; private float hy; private float angle; private Vec2 center; private PolygonShape axleContainerShape; private PolygonShape axleShape; private FixtureDef axleContainerFixtureDef; private FixtureDef axleFixtureDef; private Body body; public Shock(Body chassis, float hx, float hy, Vec2 center, float angle) { this.chassis = chassis; this.hx = hx; this.hy = hy; this.center = center; this.angle = angle; createAxleContainer(3, 3, .3f); body = createAxle(.5f, 3, 0); } private void createAxleContainer(float density, float friction, float restitution) { axleContainerShape = new PolygonShape(); axleContainerShape.setAsBox(hx, hy, center, (float)Math.toRadians(angle)); axleContainerFixtureDef = new FixtureDef(); axleContainerFixtureDef.setDensity(density); axleContainerFixtureDef.setFriction(friction); axleContainerFixtureDef.getFilter().groupIndex = -1; axleContainerFixtureDef.setShape(axleContainerShape); chassis.createFixture(axleContainerFixtureDef); } private Body createAxle(float density, float friction, float restitution) { axleShape = new PolygonShape(); axleShape.setAsBox(hx/2, hy, new Vec2(0,0), (float)Math.toRadians(angle)); axleFixtureDef = new FixtureDef(); axleFixtureDef.setDensity(density); axleFixtureDef.setFriction(friction); axleFixtureDef.getFilter().groupIndex = -1; axleFixtureDef.setShape(axleShape); BodyDef bodyDef = new BodyDef(); bodyDef.setType(BodyType.DYNAMIC); Body body = world.createBody(bodyDef); body.createFixture(axleFixtureDef); return body; } }
271b62be6ff3cbaccf46bb9f1bd015c6680ab756
27f649c606bc2cdf839c175219fcfbf1af9b1f32
/src/main/java/net/bdsc/util/JsonUtils.java
057bf3f43a1dc3d52bd8a89fa0206bff1a9cff14
[]
no_license
heyewei/block
38717394de805c9205755e7a46f46faa8a097415
849655194551d8c93a61545b959a1e74e99bd7bb
refs/heads/master
2023-01-28T22:25:00.012454
2020-12-10T05:16:15
2020-12-10T05:16:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,523
java
/* * Copyright 2008-2018 shopxx.net. All rights reserved. * Support: localhost * License: localhost/license * FileId: b5vxH+DBc8dove+g1zdVwstf8nGuv5ZQ */ package net.bdsc.util; import java.io.IOException; import java.io.Writer; import java.lang.reflect.Type; import org.springframework.util.Assert; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; /** * Utils - JSON * * @author 好源++ Team * @version 6.1 */ public final class JsonUtils { /** * ObjectMapper */ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); /** * 不可实例化 */ private JsonUtils() { } /** * 将对象转换为JSON字符串 * * @param value * 对象 * @return JSON字符串 */ public static String toJson(Object value) { Assert.notNull(value, "[Assertion failed] - value is required; it must not be null"); try { return OBJECT_MAPPER.writeValueAsString(value); } catch (JsonProcessingException e) { throw new RuntimeException(e.getMessage(), e); } } /** * 将JSON字符串转换为对象 * * @param json * JSON字符串 * @param valueType * 类型 * @return 对象 */ public static <T> T toObject(String json, Class<T> valueType) { Assert.hasText(json, "[Assertion failed] - json must have text; it must not be null, empty, or blank"); Assert.notNull(valueType, "[Assertion failed] - valueType is required; it must not be null"); try { return OBJECT_MAPPER.readValue(json, valueType); } catch (JsonParseException e) { throw new RuntimeException(e.getMessage(), e); } catch (JsonMappingException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } /** * 将JSON字符串转换为对象 * * @param json * JSON字符串 * @param typeReference * 类型 * @return 对象 */ public static <T> T toObject(String json, TypeReference<?> typeReference) { Assert.hasText(json, "[Assertion failed] - json must have text; it must not be null, empty, or blank"); Assert.notNull(typeReference, "[Assertion failed] - typeReference is required; it must not be null"); try { return OBJECT_MAPPER.readValue(json, typeReference); } catch (JsonParseException e) { throw new RuntimeException(e.getMessage(), e); } catch (JsonMappingException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } /** * 将JSON字符串转换为对象 * * @param json * JSON字符串 * @param javaType * 类型 * @return 对象 */ public static <T> T toObject(String json, JavaType javaType) { Assert.hasText(json, "[Assertion failed] - json must have text; it must not be null, empty, or blank"); Assert.notNull(javaType, "[Assertion failed] - javaType is required; it must not be null"); try { return OBJECT_MAPPER.readValue(json, javaType); } catch (JsonParseException e) { throw new RuntimeException(e.getMessage(), e); } catch (JsonMappingException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } /** * 将JSON字符串转换为树 * * @param json * JSON字符串 * @return 树 */ public static JsonNode toTree(String json) { Assert.hasText(json, "[Assertion failed] - json must have text; it must not be null, empty, or blank"); try { return OBJECT_MAPPER.readTree(json); } catch (JsonProcessingException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } /** * 将对象转换为JSON流 * * @param writer * Writer * @param value * 对象 */ public static void writeValue(Writer writer, Object value) { Assert.notNull(writer, "[Assertion failed] - writer is required; it must not be null"); Assert.notNull(value, "[Assertion failed] - value is required; it must not be null"); try { OBJECT_MAPPER.writeValue(writer, value); } catch (JsonGenerationException e) { throw new RuntimeException(e.getMessage(), e); } catch (JsonMappingException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } /** * 构造类型 * * @param type * 类型 * @return 类型 */ public static JavaType constructType(Type type) { Assert.notNull(type, "[Assertion failed] - type is required; it must not be null"); return TypeFactory.defaultInstance().constructType(type); } /** * 构造类型 * * @param typeReference * 类型 * @return 类型 */ public static JavaType constructType(TypeReference<?> typeReference) { Assert.notNull(typeReference, "[Assertion failed] - typeReference is required; it must not be null"); return TypeFactory.defaultInstance().constructType(typeReference); } }
0fca23fdc4454a3a8c751a82ff384e8eb8dae96b
dc9e18881c25a9a30d9c387bc38c1b952a42c047
/axon-bank/src/main/java/com/borysfan/web/AccountObject.java
6e82256b55179938227438d5556b2346b61894b2
[ "Apache-2.0" ]
permissive
borysfan/axon-bank-poc
950fd5253ce15865922250586be3254fdcd2b6e9
f5c7ab8b7efa329dbb97b23674a58685757552b9
refs/heads/master
2021-07-19T20:35:55.006256
2017-10-27T07:29:22
2017-10-27T07:29:22
105,123,031
0
0
null
2017-10-18T12:23:31
2017-09-28T08:32:51
Java
UTF-8
Java
false
false
771
java
package com.borysfan.web; import org.springframework.data.annotation.Id; public class AccountObject { @Id private String accountId; private Long balance; private Long overdraft; public AccountObject() { } public AccountObject(String accountId, Long overdraft) { this.accountId = accountId; this.overdraft = overdraft; this.balance = 0L; } public void setBalance(Long balance) { this.balance = balance; } public void setOverdraft(Long overdraft) { this.overdraft = overdraft; } public String getAccountId() { return accountId; } public Long getOverdraft() { return overdraft; } public Long getBalance() { return balance; } }
d941c032db2e1daeaa0e37f789e7f95703625076
1f086b3fe1d88db58f162ec0df746554530d6c85
/src/main/java/com/example/trago_driver/StartUpScreen.java
0ebd2bb24f94f84bbbe6de0a9e16e3e47bd36c17
[]
no_license
adarsh-shahi/DriverApp
9f8f66a7ee7560467ce09ea2b6ac15d0e4c9bfbb
1a76e0b082a7551715e6210246c62c78f3a15c0d
refs/heads/master
2022-11-29T10:55:35.287431
2020-08-02T14:14:16
2020-08-02T14:14:16
284,475,126
1
0
null
null
null
null
UTF-8
Java
false
false
690
java
package com.example.trago_driver; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import androidx.appcompat.app.AppCompatActivity; public class StartUpScreen extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent homeIntent=new Intent(StartUpScreen.this,MainActivity.class); startActivity(homeIntent); finish(); } },500); } }
147b2905606846054cda2c461ffe1e96b6f89cd6
9ab732469d5413b5498f4e911569f57b9f92bfc8
/src/mysecondpro/MySecondPro.java
0d9fbd8d7275436ddd81a5defdc6df27d4cb8998
[]
no_license
makarovan/MySecondPro
a83721a96a254a537de0a9d63b4f7a0946f02f7d
9b729a82a6ed5f2e4db6970a7440f12e3244fa20
refs/heads/master
2023-07-20T10:51:55.477065
2021-09-08T06:36:27
2021-09-08T06:36:27
403,526,433
0
0
null
null
null
null
UTF-8
Java
false
false
604
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 mysecondpro; /** * * @author pupil */ public class MySecondPro { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here System.out.println("My second programmыыыыыы"); System.out.println("First changes"); System.out.println("Second changes"); } }
480c13a5e22b6d6c5b93b231e09bb1cbd4b0bf50
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project237/src/test/java/org/gradle/test/performance/largejavamultiproject/project237/p1186/Test23721.java
8d6f2fe7da8ef156cabb4a494738537bf1562c9b
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,113
java
package org.gradle.test.performance.largejavamultiproject.project237.p1186; import org.junit.Test; import static org.junit.Assert.*; public class Test23721 { Production23721 objectUnderTest = new Production23721(); @Test public void testProperty0() { String value = "value"; objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { String value = "value"; objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { String value = "value"; objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
4c7c76ef6e5250cf909de9383e08d14813b3aebd
e480c179e904b6989676ff78aafe4cdc6fdca535
/niu-user/niu-user-api/src/main/java/com/github/niu/user/api/models/dto/AddressDTO.java
11b233ec9abd2372a1a62564a32e51993b437ec2
[]
no_license
nullbull/niu-heo
019a1634ddee7a1456b50ee265aa0b608c87f8d0
9ea6eb8a39730fad9b17bbcafa24cc8b3b987629
refs/heads/master
2022-06-30T00:54:58.062433
2019-06-25T11:56:52
2019-06-25T11:56:52
162,564,543
0
1
null
2022-06-21T01:03:34
2018-12-20T10:34:00
Java
UTF-8
Java
false
false
728
java
package com.github.niu.user.api.models.dto; import com.github.niu.common.constants.Magic; import lombok.Data; import javax.validation.constraints.NotNull; /** * @author 牛贞昊([email protected]) * @date 2019/5/3 14:46 * @desc */ @Data public class AddressDTO implements Magic { private Long id; @NotNull(message = "用户ID不能为空") private Long userId; @NotNull(message = "收件人不能为空") private String leaveName; @NotNull(message = "手机号不能为空") private String leavePhone; @NotNull(message = "宿舍区域不能为空") private Byte locationId; @NotNull(message = "状态不能为空") private Byte status; private String detail; }
f174f566df5ba20d46f7bd187b74a0fee9952768
87bb36b03f8069f2a9ffb4025b5eb3410905f217
/base/src/main/java/com/cvicse/base/utils/ProcessUtils.java
678a23623f4142fe121f22d4304784d1140ba1f8
[]
no_license
883111LB/app_stock
14fee33c2e4e3104a09276816efda9a38bf05406
6e89ee5809a600173e317246a56a67446b5ebe53
refs/heads/master
2022-08-28T00:48:44.988011
2020-05-27T07:29:03
2020-05-27T07:29:03
267,245,079
1
0
null
null
null
null
UTF-8
Java
false
false
6,569
java
package com.cvicse.base.utils; import android.app.ActivityManager; import android.app.AppOpsManager; import android.app.usage.UsageStats; import android.app.usage.UsageStatsManager; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.provider.Settings; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2016/10/18 * desc : 进程相关工具类 * </pre> */ public class ProcessUtils { private ProcessUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * 获取前台线程包名 * <p>当不是查看当前App,且SDK大于21时, * 需添加权限 {@code <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>}</p> * * @return 前台应用包名 */ public static String getForegroundProcessName() { ActivityManager manager = (ActivityManager) UtilsConfig.getInitContext().getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> infos = manager.getRunningAppProcesses(); if (infos != null && infos.size() != 0) { for (ActivityManager.RunningAppProcessInfo info : infos) { if (info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { return info.processName; } } } if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.LOLLIPOP) { PackageManager packageManager = UtilsConfig.getInitContext().getPackageManager(); Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS); List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); System.out.println(list); if (list.size() > 0) {// 有"有权查看使用权限的应用"选项 try { ApplicationInfo info = packageManager.getApplicationInfo(UtilsConfig.getInitContext().getPackageName(), 0); AppOpsManager aom = (AppOpsManager) UtilsConfig.getInitContext().getSystemService(Context.APP_OPS_SERVICE); if (aom.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, info.uid, info.packageName) != AppOpsManager.MODE_ALLOWED) { UtilsConfig.getInitContext().startActivity(intent); } if (aom.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, info.uid, info.packageName) != AppOpsManager.MODE_ALLOWED) { LogUtils.d("getForegroundApp", "没有打开\"有权查看使用权限的应用\"选项"); return null; } UsageStatsManager usageStatsManager = (UsageStatsManager) UtilsConfig.getInitContext().getSystemService(Context.USAGE_STATS_SERVICE); long endTime = System.currentTimeMillis(); long beginTime = endTime - 86400000 * 7; List<UsageStats> usageStatses = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, beginTime, endTime); if (usageStatses == null || usageStatses.isEmpty()) return null; UsageStats recentStats = null; for (UsageStats usageStats : usageStatses) { if (recentStats == null || usageStats.getLastTimeUsed() > recentStats.getLastTimeUsed()) { recentStats = usageStats; } } return recentStats == null ? null : recentStats.getPackageName(); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } else { LogUtils.d("getForegroundApp", "无\"有权查看使用权限的应用\"选项"); } } return null; } /** * 杀死后台服务进程 * <p>需添加权限 {@code <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>}</p> * * @return 杀死后台进程数 */ public static int killAllBackgroundProcesses() { int count = 0; ActivityManager am = (ActivityManager) UtilsConfig.getInitContext().getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> infos = am.getRunningAppProcesses(); if (infos == null || infos.size() == 0) return 0; Set<String> set = new HashSet<>(); for (ActivityManager.RunningAppProcessInfo info : infos) { for (String pkg : info.pkgList) { am.killBackgroundProcesses(pkg); set.add(pkg); ++count; } } infos = am.getRunningAppProcesses(); if (infos == null || infos.size() == 0) return count; for (ActivityManager.RunningAppProcessInfo info : infos) { for (String pkg : info.pkgList) { set.remove(pkg); --count; } } return count; } /** * 杀死后台服务进程 * <p>需添加权限 {@code <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>}</p> * * @param packageName 包名 * @return {@code true}: 杀死成功<br>{@code false}: 杀死失败 */ public static boolean killBackgroundProcesses(String packageName) { if (StringUtils.isSpace(packageName)) return false; ActivityManager am = (ActivityManager) UtilsConfig.getInitContext().getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> infos = am.getRunningAppProcesses(); if (infos == null || infos.size() == 0) return true; for (ActivityManager.RunningAppProcessInfo info : infos) { if (Arrays.asList(info.pkgList).contains(packageName)) { am.killBackgroundProcesses(packageName); } } infos = am.getRunningAppProcesses(); if (infos == null || infos.size() == 0) return true; for (ActivityManager.RunningAppProcessInfo info : infos) { if (Arrays.asList(info.pkgList).contains(packageName)) { return false; } } return true; } }
[ "3140704209.l" ]
3140704209.l
8c3e6432281c57d09383a9fddc02be4390da66c5
068eefa2fc3b80e004e386221bfe1fa36a61e1cd
/DekingChen/src/dk/io/Encode.java
8ff8dcc2d87486d2c8633f1901c3017fdb141d25
[]
no_license
DekingChen/Java
aa311024936cf4bf9f5acda1f2514b9fa0fa0973
25d56d6edfbd44926c4eb42578dd41ac1127d6f0
refs/heads/master
2021-01-17T13:29:41.862519
2016-06-21T12:50:08
2016-06-21T12:50:08
58,041,534
0
1
null
null
null
null
GB18030
Java
false
false
1,179
java
package dk.io; public class Encode{ public static void show(Object obj){ System.out.println(obj.toString()); } public static void show(){ System.out.println(); } public static void toHex(byte b){ System.out.print(Integer.toHexString(b & 0xff)+" "); System.out.print(Integer.toHexString(b )+" "); } public static void main(String args[]) throws Exception{ String s = "慕课ABC"; show("============项目默认编码:gbk编码============================="); byte[] b = s.getBytes();//用的是项目默认的编码 for(byte bb:b){ toHex(bb); } show(); show("============gbk编码,英文占一个字节和中文占两个字节编码==============="); byte[] b1 = s.getBytes("gbk"); for(byte bb:b1){ toHex(bb); } show(); show("============utf-8编码,英文占一个字节和中文占三个字节编码============="); byte[] b2 = s.getBytes("utf-8"); for(byte bb:b2){ toHex(bb); } show(); show("============java是双字节编码,英文和中文都是两个字节编码=============="); byte[] b3 = s.getBytes("utf-16be"); for(byte bb:b3){ toHex(bb); } } }
7821a9785641bb8b6fe6ab1ce01812a5505c3eb0
00404ba8d375d01676e00fe619b69a4e7c8a6ea4
/src/org/sample/ConditionalStatements.java
4b19bcc10b96974df1f708e69a61d2c48380ecaf
[]
no_license
syedfarith127/NewRepoSalman
c01570680f3855d4bd0c11883934be017add0e53
0a96ba36961a400a6b4bd3c6dc72cec3e6cfb960
refs/heads/master
2023-03-06T16:41:36.997901
2021-02-24T19:03:03
2021-02-24T19:03:03
342,003,557
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package org.sample; public class ConditionalStatements { public static void main(String[] args) { // Nested If int a = 3; // 1 2 5 for (int i = 0; i < a; i++) { // 3.1 3.2 3.4 for (int j = 0; j < a; j++) { System.out.println(j); } // 4 System.out.println(i); } } }
a3f61170c82bc6f42c30612050083b261c142e3d
e63ea083c0144208dbad5bfa5c2b1d335044bf25
/app/src/main/java/com/sinobpo/godtalk/MainActivity.java
88ac9ba516f0c0395ae7aeaa69c053ee55bb9c8f
[]
no_license
dexit/PushToTalkIntranet
91d015b8da50c9306befa24e9a602db1f1b79d59
dfa924a0d059b45d1debda80da310871b5469d71
refs/heads/master
2020-03-21T15:48:54.535377
2016-09-27T11:53:55
2016-09-27T11:53:55
null
0
0
null
null
null
null
GB18030
Java
false
false
33,729
java
package com.sinobpo.godtalk; import java.io.File; import java.io.IOException; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.ArrayList; import java.util.Date; import java.util.Enumeration; import java.util.List; import java.util.Map; import com.sinobpo.R; import com.sinobpo.daseHelper.ChartContentDaoImpl; import com.sinobpo.service.MainService; import com.sinobpo.util.ChatContent; import com.sinobpo.util.Constant; import com.sinobpo.util.FileName; import com.sinobpo.util.FileState; import com.sinobpo.util.Person; import com.sinobpo.util.ShakeListener; import com.sinobpo.util.ShakeListener.OnShakeListener; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.graphics.Color; import android.media.MediaPlayer; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.preference.PreferenceManager; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.BaseExpandableListAdapter; import android.widget.Button; import android.widget.ExpandableListView; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import android.widget.ExpandableListView.OnGroupExpandListener; /** * Copyright (C) 2012 移动应用研发组-神聊对讲机 版本: 日期: 描述:主界面(联系人界面) 操作:添加 操作人:移动应用研发组-gxc */ public class MainActivity extends Activity implements View.OnClickListener { /***/ private ExpandableListView ev = null; private String[] groupIndicatorLabeles = null; private SettingDialog settingDialog = null; private CallingDialog callingDialog = null; private CallingDialog receiveAudioDialog=null; private MyBroadcastRecv broadcastRecv = null; private IntentFilter bFilter = null; private ArrayList<Map<Integer, Person>> children = null; private ArrayList<Integer> personKeys = null; private MainService mService = null; private Intent mMainServiceIntent = null; private ExListAdapter adapter = null; private Person me = null; private Person person = null; private AlertDialog dialog = null; private boolean isPaused = false;// 判断本身是不是可见 private boolean isRemoteUserClosed = false; // 是否远程用户已经关闭了通话。 private boolean isFinish = false;// 判断是否退出应用程序 private ArrayList<FileState> receivedFileNames = null;// 接收到的对方传过来的文件名 private ArrayList<FileState> beSendFileNames = null;// 发送到对方的文件名信息 private boolean isRecording = false; /** 刷新按钮 */ private ImageButton btnFriendRefresh; File recordingFile; /** 底部 显示当前连接的wifi */ private TextView txtShowWifi; /**wifi管理器*/ private WifiManager wifiManager = null; /**接收文件Dialog*/ private AlertDialog recDialog; //接受文件的dialog的OK按钮 private Button btn_receive; private String filePath="//sdcard/shenliao-sinobpo/"; /**我的Ip*/ private String localIp=""; private ChartContentDaoImpl chartDaoImpl; private String clickPersonIp=""; /** * MainService服务与当前Activity的绑定连接器 */ private ServiceConnection sConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { mService = ((MainService.ServiceBinder) service).getService(); } @Override public void onServiceDisconnected(ComponentName name) { mService = null; } }; private Adapter_ReceiveSendFileList receiveFileListAdapter = new Adapter_ReceiveSendFileList( this,1); private Adapter_ReceiveSendFileList sendFileListAdapter = new Adapter_ReceiveSendFileList( this,0); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.godtalk_activity); wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); //获得当前在线用户 groupIndicatorLabeles = getResources().getStringArray( R.array.groupIndicatorLabeles); // 当前Activity与后台MainService进行绑定 mMainServiceIntent = new Intent(this, MainService.class); bindService(mMainServiceIntent, sConnection, BIND_AUTO_CREATE); startService(mMainServiceIntent); btnFriendRefresh = (ImageButton) findViewById(R.id.btnFriendRefresh); btnFriendRefresh.setOnClickListener(this); txtShowWifi = (TextView) findViewById(R.id.txtShowWifi); ev = (ExpandableListView) findViewById(R.id.expListUser); /**覆盖在手风琴分组上的View,使其无法点击*/ TextView tv_overlay=(TextView)findViewById(R.id.tv_overlay); tv_overlay.getBackground().setAlpha(0); chartDaoImpl=new ChartContentDaoImpl(this); regBroadcastRecv(); if (Environment.MEDIA_MOUNTED.equals(Environment .getExternalStorageState())) { File path = new File(// 创建一个临时文件夹 Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.apress.proandroidmedia.ch07.altaudiorecorder/files/"); if (path.exists()) { // 删除临时文件 File[] temFiles = path.listFiles(); File tempFile; for (int i = 0; i < temFiles.length; i++) { tempFile = temFiles[i]; tempFile.delete(); } } else { path.mkdirs(); } try { recordingFile = File.createTempFile("recording", ".pcm", path);// 文件名称以及类型 } catch (IOException e) { throw new RuntimeException("Couldn't create file on SD card", e); } } else { Toast.makeText(this, "SD卡已拔出,语音功能暂时不可用!", Toast.LENGTH_SHORT) .show(); } // 摇一摇实现列表刷新 ShakeListener shakeListener = new ShakeListener(MainActivity.this); // 创建一个对象 shakeListener.setOnShakeListener(new OnShakeListener() { // 调用setOnShakeListener方法进行监听 public void onShake() { mService.refreshFriend(); } }); // 刚进入这个界面土司提示 Toast.makeText(MainActivity.this, "摇晃可刷新列表", Toast.LENGTH_SHORT) .show(); } /** * 获取连接WIFI信息 * * @return * @throws IOException * @throws SocketException */ public String getWifiInfo() { String wifiInfo = null; try { for (Enumeration<NetworkInterface> en = NetworkInterface .getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf .getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { if (inetAddress.isReachable(1000)) { localIp = inetAddress.getHostAddress() .toString(); wifiInfo = wifiManager.getConnectionInfo() .getSSID() + "(" + localIp + ")"; } } } } } catch (Exception e) { e.printStackTrace(); } return wifiInfo; } // ==============================ExpandableListView数据适配器=================================== private class ExListAdapter extends BaseExpandableListAdapter { private Context context = null; public ExListAdapter(Context context) { this.context = context; } // 获得某个用户对象 @Override public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get( personKeys.get(childPosition)); } // 获得用户在用户列表中的序号 @Override public long getChildId(int groupPosition, int childPosition) { return personKeys.get(childPosition); } // 生成用户布局View @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parentView) { View view = null; if (groupPosition < children.size()) {// 如果groupPosition的序号能从children列表中获得一个children对象 Person person = children.get(groupPosition).get( personKeys.get(childPosition));// 获得当前用户实例 view = getLayoutInflater().inflate(R.layout.godtalk_child_item, null);// 生成List用户条目布局对象 view.setOnClickListener(MainActivity.this); view.setTag(person);// 添加一个tag标记以便在长按事件和点击事件中根据该标记进行相关处理 view.setPadding(10, 0, 0, 0);// 设置左边填充空白距离 ImageView headIconView = (ImageView) view .findViewById(R.id.txtPerHeadIcon);// 头像 TextView nickeNameView = (TextView) view .findViewById(R.id.txtPerNickName);// 昵称 TextView loginTimeView = (TextView) view .findViewById(R.id.txtPerLoginTime);// 登录时间 TextView msgCountView = (TextView) view .findViewById(R.id.txtPerMsgCount);// 未读信息计数 Button imgStartCalling = (Button) view .findViewById(R.id.imgStartCalling);// 开始呼叫 // TextView // audioMsgCount=(TextView)view.findViewById(R.id.txtAudioMsgCount);//未读语音计数 TextView ipaddressView = (TextView) view .findViewById(R.id.txtPerIpAddre);// IP地址 imgStartCalling.setOnClickListener(new CallingOnClickListener( person.ipAddress, imgStartCalling)); headIconView.setImageResource(person.personHeadIconId); nickeNameView.setText(person.personNickeName); loginTimeView.setText(person.loginTime); // String msgCountStr = // getString(R.string.init_msg_count);格式化字符串 // 根据用户id从service层获得该用户的消息数量 int count = mService.getMessagesCountById(person.personId) + mService.getAudioMsgCountById(person.personId); msgCountView.setText(String.valueOf(count)); if (count > 0) { msgCountView.setVisibility(View.VISIBLE); } else { msgCountView.setVisibility(View.GONE); } // audioMsgCount.setText("语音消息数:"+mService.getAudioMsgCountById(person.personId)); ipaddressView.setText(person.ipAddress); } return view; } // 获得某个用户组中的用户数 @Override public int getChildrenCount(int groupPosition) { int childrenCount = 0; if (groupPosition < children.size()) childrenCount = children.get(groupPosition).size(); return childrenCount; } // 获得某个用户组对象 @Override public Object getGroup(int groupPosition) { return children.get(groupPosition); } // 获得用户组数量,该处的用户组数量返回的是组名称的数量 @Override public int getGroupCount() { return groupIndicatorLabeles.length; } // 获得用户组序号 @Override public long getGroupId(int groupPosition) { return groupPosition; } // 生成用户组布局View @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { int childrenCount = 0; if (groupPosition < children.size()) {// 如果groupPosition序号能从children列表中获得children对象,则获得该children对象中的用户数量 childrenCount = children.get(groupPosition).size(); } View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.godtalk_parent_item, null); } TextView title = (TextView) view .findViewById(R.id.txtFriendNickName); TextView txtMsgCount = (TextView) view .findViewById(R.id.txtMsgCount); title.setText(groupIndicatorLabeles[groupPosition]); txtMsgCount.setText("(" + childrenCount + ")"); // if(isExpanded) // image.setBackgroundResource(R.drawable.narrow_select); // else // image.setBackgroundResource(R.drawable.narrow); return view; } @Override public boolean hasStableIds() { return true; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } /** * 联系人名字后面的“呼叫”按钮 * * @author Buddy * */ public class CallingOnClickListener implements android.view.View.OnClickListener { private String ipAddress; private TextView btnStartCalling; public CallingOnClickListener(String ipAddress, TextView btnStartCalling) { this.btnStartCalling = btnStartCalling; this.ipAddress = ipAddress; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.imgStartCalling: isRecording = true; // mService.startCalling(ipAddress); if (null == callingDialog) callingDialog = new CallingDialog(MainActivity.this, mService, ipAddress); callingDialog.show(); break; } } } // =================================ExpandableListView数据适配器结束=================================================== // 获得自已的相关信息 private void getMyInfomation() { SharedPreferences pre = PreferenceManager .getDefaultSharedPreferences(this); int iconId = pre.getInt("headIconId", R.drawable.applause2); String nickeName = pre.getString("nickeName", "输入你的昵称"); ImageView myHeadIcon = (ImageView) findViewById(R.id.imvMyHead); myHeadIcon.setImageResource(iconId); TextView myNickeName = (TextView) findViewById(R.id.txtMyNickName); myNickeName.setText(nickeName); me = new Person(); me.personHeadIconId = iconId; me.personNickeName = nickeName; me.ipAddress=localIp; } @Override public void onClick(View view) { switch (view.getId()) { case R.id.linLayMyInfo:// 弹出系统设置窗口 showSettingDialog(); break; case R.id.linLayPersonItem:// 转到发信息页面 person = (Person) view.getTag();// 用户列表的childView被点击时 openChartPage(person); break; case R.id.long_send_msg:// 长按列表的childView时在弹出的窗口中点击"发送信息"按钮时 person = (Person) view.getTag(); openChartPage(person); if (null != dialog) dialog.dismiss(); break; case R.id.btnFriendRefresh:// 刷新好友 mService.refreshFriend(); if (getWifiInfo() != null) { txtShowWifi.setText(getWifiInfo());// 显示wifi信息 } else { txtShowWifi.setText("未连接网络"); txtShowWifi.setTextColor(Color.RED); } break; case R.id.long_send_file: Intent intent = new Intent(this, FileManagerActivity.class); intent.putExtra("selectType", Constant.SELECT_FILES); startActivityForResult(intent, 0); dialog.dismiss(); break; case R.id.long_click_call: person = (Person) view.getTag(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(me.personNickeName); String title = String.format(getString(R.string.talk_with), person.personNickeName); builder.setMessage(title); builder.setIcon(me.personHeadIconId); builder.setNegativeButton(getString(R.string.close), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface cdialog, int which) { cdialog.dismiss(); } }); final AlertDialog callDialog = builder.show(); callDialog .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface arg0) { mService.stopTalk(person.personId); } }); mService.startTalk(person.personId); break; case R.id.long_click_cancel: dialog.dismiss(); break; } } boolean finishedSendFile = false;// 记录当前这些文件是不是本次已经接收过了 @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (null != data) { int selectType = data.getExtras().getInt("selectType"); if (selectType == Constant.SELECT_FILE_PATH) {// 如果收到的是文件夹选择模式,说明现在是要保存对方传过来的文件,则把当前选择的文件夹路径返回服务层 String fileSavePath = data.getExtras().getString( "fileSavePath"); if (null != fileSavePath) { mService.receiveFiles(fileSavePath); finishedSendFile = true;// 把本次接收状态置为true filePath =data.getExtras().getString( "fileSavePath"); System.out.println("over save file ..."); } else {//文件夹不可写,无法保存文件! Toast.makeText(this, getString(R.string.folder_can_not_write), Toast.LENGTH_SHORT).show(); } } else if (selectType == Constant.SELECT_FILES) {// 如果收到的是文件选择模式,说明现在是要发送文件,则把当前选择的所有文件返回给服务层。 @SuppressWarnings("unchecked") final ArrayList<FileName> files = (ArrayList<FileName>) data .getExtras().get("files"); mService.sendFiles(person.personId, files);// 把当前选择的所有文件返回给服务层 // 显示文件发送列表 beSendFileNames = mService.getBeSendFileNames();// 从服务层获得所有需要接收的文件的文件名 if (beSendFileNames.size() <= 0) return; sendFileListAdapter.setResources(beSendFileNames); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(me.personNickeName); builder.setMessage(R.string.start_to_send_file); builder.setIcon(me.personHeadIconId); View vi = getLayoutInflater().inflate( R.layout.request_file_popupwindow_layout, null); builder.setView(vi); final AlertDialog fileListDialog = builder.show(); fileListDialog .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface arg0) { beSendFileNames.clear(); files.clear(); } }); ListView lv = (ListView) vi .findViewById(R.id.receive_file_list);// 需要接收的文件清单 lv.setAdapter(sendFileListAdapter); Button btn_ok = (Button) vi .findViewById(R.id.receive_file_okbtn); btn_ok.setVisibility(View.GONE); Button btn_cancle = (Button) vi .findViewById(R.id.receive_file_cancel); // 如果该按钮被点击则打开文件选择器,并设置成文件夹选择模式,选择一个用来接收对方文件的文件夹 btn_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!finishedSendFile) {// 如果本次文件已经接收过了则不再打开文件夹选择器 Intent intent = new Intent( MainActivity.this, FileManagerActivity.class); intent.putExtra("selectType", Constant.SELECT_FILE_PATH); startActivityForResult(intent, 0); } } }); // 如果该按钮被点击则向服务层发送用户拒绝接收文件的广播 btn_cancle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fileListDialog.dismiss(); } }); } } } } // 显示信息设置对话框 private void showSettingDialog() { if (null == settingDialog) settingDialog = new SettingDialog(this, R.style.SettingDialog); settingDialog.show(); } // 铃声提示用户收到消息 public void msgRemind() { int playSound = R.raw.callremin; SharedPreferences sp = getSharedPreferences("bell_list_preference", Context.MODE_PRIVATE); int callremin = sp.getInt("callremin", 1); MediaPlayer mMediaPlayer = null; if (mMediaPlayer != null) { mMediaPlayer.release(); mMediaPlayer = null; } if (callremin == 1) { playSound = R.raw.callremin; } else if (callremin == 2) { playSound = R.raw.callremin2; } else if (callremin == 3) { playSound = R.raw.callremin3; } else if (callremin == 4) { playSound = R.raw.callremin4; } else { return; } mMediaPlayer = MediaPlayer.create(this, playSound); try { mMediaPlayer.start(); } catch (Exception e) { e.printStackTrace(); } } // =========================广播接收器========================================================== private class MyBroadcastRecv extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Constant.updateMyInformationAction)) { getMyInfomation(); } else if (intent.getAction().equals( Constant.dataReceiveErrorAction) || intent.getAction().equals(Constant.dataSendErrorAction)) { Toast .makeText(MainActivity.this, intent.getExtras().getString("msg"), Toast.LENGTH_SHORT).show(); } else if (intent.getAction().equals( Constant.fileReceiveStateUpdateAction)) {// 收到来自服务层的文件接收状态通知 if (!isPaused) { receivedFileNames = mService.getReceivedFileNames();// 获得当前所有文件接收状态 receiveFileListAdapter.setResources(receivedFileNames); receiveFileListAdapter.notifyDataSetChanged();// 更新文件接收列表 } } else if (intent.getAction().equals( Constant.fileSendStateUpdateAction)) {// 收到来自服务层的文件接收状态通知 if (!isPaused) { beSendFileNames = mService.getBeSendFileNames();// 获得当前所有文件接收状态 sendFileListAdapter.setResources(beSendFileNames); sendFileListAdapter.notifyDataSetChanged();// 更新文件接收列表 } } else if (intent.getAction().equals( Constant.receivedTalkRequestAction)) { if (!isFinish) { msgRemind(); adapter.notifyDataSetChanged(); } } else if (intent.getAction().equals(Constant.recorderFailAction)) { Toast.makeText(MainActivity.this, "录音发生错误!", Toast.LENGTH_SHORT).show(); } else if (intent.getAction().equals( Constant.remoteUserClosedTalkAction)) { isRemoteUserClosed = true;// 如果接收到远程用户关闭通话指令则把该标记置为true } else if (intent.getAction().equals(//对方拒绝接受文件 Constant.remoteUserRefuseReceiveFileAction)) { Toast.makeText(MainActivity.this, getString(R.string.refuse_receive_file), Toast.LENGTH_SHORT).show(); } else if (intent.getAction().equals( Constant.personHasChangedAction)) {//获取用户信息 children = mService.getChildren(); personKeys = mService.getPersonKeys(); if (null == adapter) { adapter = new ExListAdapter(MainActivity.this); ev.setAdapter(adapter); ev.expandGroup(0); ev.setGroupIndicator(null); ev.setDivider(null); } adapter.notifyDataSetChanged(); } else if (intent.getAction().equals(Constant.hasMsgUpdatedAction)) { msgRemind(); adapter.notifyDataSetChanged(); } else if (intent.getAction().equals(Constant.remoteCallingAction)) {//收到语音(这里只是显示dialog,真正地接受语音消失在对方按下录音键的时候执行) String ipAddress = intent.getExtras().getString("ipAddress"); receiveAudioDialog = new CallingDialog( MainActivity.this, ipAddress); if (!ipAddress.equals("")) { receiveAudioDialog.show(); } handler_SendFile.sendEmptyMessage(2); } else if (intent.getAction().equals( Constant.receivedSendFileRequestAction)) {// 接收到文件发送请求,请求接收文件 if (!isPaused) {// 如果自身处于可见状态则响应广播,弹出一个提示框是否要接收发过来的文件 receivedFileNames = mService.getReceivedFileNames();// 从服务层获得所有需要接收的文件的文件名 if (receivedFileNames.size() <= 0) return; receiveFileListAdapter.setResources(receivedFileNames); Person psn = (Person) intent.getExtras().get("person"); AlertDialog.Builder builder = new AlertDialog.Builder( context); builder.setTitle(psn.personNickeName); builder.setMessage(R.string.sending_file_to_you); builder.setIcon(psn.personHeadIconId); View vi = getLayoutInflater().inflate( R.layout.request_file_popupwindow_layout, null); builder.setView(vi); recDialog = builder.show(); recDialog .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface arg0) { receivedFileNames.clear(); if (!finishedSendFile) {// 如果本次文件并未接收就关闭接收窗口,说明放弃本次接收,同时向远程发送一个拒绝接收的指令。 Intent intent = new Intent(); intent .setAction(Constant.refuseReceiveFileAction); sendBroadcast(intent); } finishedSendFile = false;// 关闭文件接收对话框,本表示本次文件接收完成,把本次文件接收状态置为false } }); ListView lv = (ListView) vi .findViewById(R.id.receive_file_list);// 需要接收的文件清单 lv.setAdapter(receiveFileListAdapter); btn_receive = (Button) vi .findViewById(R.id.receive_file_okbtn); Button btn_cancle = (Button) vi .findViewById(R.id.receive_file_cancel); // 如果该按钮被点击则打开文件选择器,并设置成文件夹选择模式,选择一个用来接收对方文件的文件夹 btn_receive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { btn_receive.setEnabled(false); if (!finishedSendFile) {// 如果本次文件已经接收过了则不再打开文件夹选择器 Intent intent = new Intent( MainActivity.this, FileManagerActivity.class); intent.putExtra("selectType", Constant.SELECT_FILE_PATH); startActivityForResult(intent, 0); } // dialog.dismiss(); } }); // 如果该按钮被点击则向服务层发送用户拒绝接收文件的广播 btn_cancle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { recDialog.dismiss(); } }); Constant.sendFileIsOver=false; /**启动handler监听文件是否发送完毕*/ if(Constant.sendFileIsOver==false){ handler_SendFile.sendEmptyMessage(1); }else{ if(receivedFileNames.size()==1){ btn_receive.setText("打开"); btn_receive.setEnabled(true); btn_receive.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub openFile(filePath+"/"+receivedFileNames.get(0).fileName); } }); }else{ recDialog.dismiss(); Toast.makeText(MainActivity.this, "可以通过“设置”里的“已收文件”进行查看", Toast.LENGTH_SHORT).show(); } } } } } } private class SaveData extends AsyncTask<String, String, String> { @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub int personID=Integer.parseInt(params[0]); List<com.sinobpo.util.Message> list_msgs = mService.getMessagesById(personID); int i = 0; if (null != list_msgs) { while(list_msgs.size()>0){ com.sinobpo.util.Message msg = list_msgs.remove(0); ChatContent chatContent = new ChatContent(params[1], me.ipAddress, msg.receivedTime, msg.msg, "", person.personHeadIconId, person.personNickeName, "1", ""); chartDaoImpl.saveToCallLog(chatContent); i++; } } return null; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); Intent intent = new Intent(MainActivity.this, ChartMsgActivity.class); intent.putExtra("person", person); intent.putExtra("me", me); startActivity(intent); } } private Handler handler_SendFile=new Handler(){ @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); switch(msg.what){ case 1: if(Constant.sendFileIsOver==false){ sendEmptyMessageDelayed(1, 300); }else{ if(receivedFileNames.size()==1){ btn_receive.setText("打开"); btn_receive.setEnabled(true); btn_receive.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub System.out.println("ooooooooooooooooooo9"); //如果存到了默认文件夹就这样写,否则 openFile(filePath+"/"+receivedFileNames.get(0).fileName); } }); }else{ recDialog.dismiss(); Toast.makeText(MainActivity.this, "可以通过“设置”里的“已收文件”进行查看", Toast.LENGTH_SHORT).show(); } } break; case 2: if(Constant.receiveAudio==false){ sendEmptyMessageDelayed(2, 300); }else{ receiveAudioDialog.dismiss(); } break; } } }; /** 打开文件 **/ private void openFile(String path) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); File f = new File(path); String type =Constant.getMIMEType(f.getName()); intent.setDataAndType(Uri.fromFile(f), type); startActivity(intent); } // =========================广播接收器结束========================================================== // 广播接收器注册 private void regBroadcastRecv() { broadcastRecv = new MyBroadcastRecv(); bFilter = new IntentFilter(); bFilter.addAction(Constant.updateMyInformationAction); bFilter.addAction(Constant.personHasChangedAction); bFilter.addAction(Constant.hasMsgUpdatedAction); bFilter.addAction(Constant.receivedSendFileRequestAction); bFilter.addAction(Constant.remoteUserRefuseReceiveFileAction); bFilter.addAction(Constant.dataReceiveErrorAction); bFilter.addAction(Constant.dataSendErrorAction); bFilter.addAction(Constant.fileReceiveStateUpdateAction); bFilter.addAction(Constant.fileSendStateUpdateAction); bFilter.addAction(Constant.receivedTalkRequestAction); bFilter.addAction(Constant.remoteUserClosedTalkAction); bFilter.addAction(Constant.sendAudioAction); bFilter.addAction(Constant.recorderFailAction); bFilter.addAction(Constant.remoteCallingAction); bFilter.addAction(Constant.remoteFinishCallingAction); registerReceiver(broadcastRecv, bFilter); } // 跳转到聊天页面 private void openChartPage(Person person) { String personId=String.valueOf(person.personId); clickPersonIp=person.ipAddress; new SaveData().execute(personId,clickPersonIp); } /** * 退出对话框 */ @Override protected Dialog onCreateDialog(int id, Bundle bundle) { // final Bundle bu=bundle; Dialog dialog = null; switch (id) { case 0: dialog = new AlertDialog.Builder(MainActivity.this).setIcon( android.R.drawable.ic_dialog_info).setTitle("确定退出吗?") .setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { unregisterReceiver(broadcastRecv); stopService(mMainServiceIntent); unbindService(sConnection); ChartContentDaoImpl daoImpl=new ChartContentDaoImpl(MainActivity.this); daoImpl.deleteAllDate(); android.os.Process.killProcess(android.os.Process.myPid()) ; isFinish = true; } }).setNeutralButton("后台运行", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { moveTaskToBack(true);// 后台运行 } }).setNegativeButton("取消", null).create(); break; } return dialog; } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getOrder()) { case 1: showSettingDialog(); break; case 2: startActivity(new Intent(MainActivity.this, SettingsActivity.class)); break; } return super.onOptionsItemSelected(item); } // 返回键监听事件 public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { showDialog(0); return true; } return super.onKeyDown(keyCode, event); }; @Override protected void onResume() { super.onResume(); if (getWifiInfo() != null) { txtShowWifi.setText(getWifiInfo());// 显示wifi信息 } else { txtShowWifi.setText("未连接网络"); txtShowWifi.setTextColor(Color.RED); } isPaused = false; getMyInfomation(); } @Override protected void onPause() { super.onPause(); isPaused = true; } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(broadcastRecv); stopService(mMainServiceIntent); unbindService(sConnection); isFinish = true; } }
c44330a4dcec1f4b5055b52a49dc8f762c806a0c
978d7756a232e26e8d628cc2dff1ec783d1ae5b6
/osyris-model/src/main/java/be/gim/tov/osyris/model/controle/NetwerkAnderProbleem.java
d3c09a32070162d2437c0d2865f262fb609997d9
[]
no_license
EmmanuelDS/Osyris
523b7ef61e53e44e1a436b69c0307a19a4cff976
46a16bd31808873fbd472ddd42a517c594cdd0bb
refs/heads/master
2016-09-05T10:17:38.658821
2015-06-15T14:13:50
2015-06-15T14:13:50
42,449,350
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package be.gim.tov.osyris.model.controle; import org.conscientia.api.model.annotation.Model; import org.conscientia.api.model.annotation.ModelStore; import org.hibernate.bytecode.internal.javassist.FieldHandled; /** * * @author kristof * */ @Model @ModelStore("OsyrisDataStore") public class NetwerkAnderProbleem extends AnderProbleem implements FieldHandled { }
f529243d3f2ec581ba6bfb82e0dcc64e389a1f74
0f46656c0d8fee9e0d38ad4cb28f64e638e27d83
/src/main/java/org/devoxx/store/config/CloudDatabaseConfiguration.java
6ca249636fc60fdac05f1dafdb0374fb10c63c25
[]
no_license
BulkSecurityGeneratorProject11/store
b7ad3799704758e96ad49bc02001af03dca96e48
f9146a41cc0e46fdf7bb81406f3290f96f3cdd67
refs/heads/master
2022-12-09T12:30:44.491674
2017-02-24T00:13:40
2017-02-24T00:13:40
296,587,978
0
0
null
2020-09-18T10:22:32
2020-09-18T10:22:31
null
UTF-8
Java
false
false
691
java
package org.devoxx.store.config; import io.github.jhipster.config.JHipsterConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.config.java.AbstractCloudConfig; import org.springframework.context.annotation.*; import javax.sql.DataSource; @Configuration @Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) public class CloudDatabaseConfiguration extends AbstractCloudConfig { private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); @Bean public DataSource dataSource() { log.info("Configuring JDBC datasource from a cloud provider"); return connectionFactory().dataSource(); } }
b1f8f49e6fb07b0fc177672c64e64ed2f5eba45d
939834760deb61ec435f13eb0e98a286069b28eb
/Spring_Data_june_2021/04 Spring Data Intro/intro/intro/src/main/java/com/spring/intro/HomeworkApplication.java
a0c8853648887437ea6775d1186c2410723b65c0
[]
no_license
knaevKMK/DATA_BASE
3382010e17cf878e64988e8bede445e3d1d2e61d
01cb8029dd3dbd35953bb7394bfcb144825505e0
refs/heads/main
2023-06-21T22:22:41.495844
2021-07-24T11:46:38
2021-07-24T11:46:38
323,394,027
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.spring.intro; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication public class HomeworkApplication { public static void main(String[] args) { SpringApplication.run(HomeworkApplication.class, args); } }
d514d5b4ad08394e82192c775b8d5ee561d5ee11
ef826135287273ba4e917872242e5492b6a287e3
/src/java/SomeServlet.java
b3174f770f2f9492eb7e41f116a4f296c46a7837
[]
no_license
Lamateam/tablet-polls
9c7c8517a0e31ae0eab50be45383f87552b73571
a3fd06f42e6ab380beb15c21d8e9b3541b6c3666
refs/heads/master
2020-12-04T14:36:57.762816
2016-09-08T15:22:13
2016-09-08T15:22:13
66,490,613
0
0
null
2016-09-08T15:22:13
2016-08-24T18:47:12
Java
UTF-8
Java
false
false
631
java
import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * Created by Нася on 25.08.2016. */ @WebServlet("/some") public class SomeServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("Hello World"); } }
3a6f86cd780943a746a22539b4b2d528bcbaa9a2
5e5239864e14233eedab28fb5a6044ef6508d0a8
/String/FavoriteGenres.Java
b6f79202745b1241c6519a3e9af7d3f6a142c56c
[]
no_license
akash9920/Algorithms-and-Data-Strucutre
895d643fbb7e228003dba53db7f2e15de676ef14
f723588cf694717946b89c13a0017804257333af
refs/heads/master
2020-03-28T18:02:41.343450
2019-12-23T01:56:53
2019-12-23T01:56:53
148,847,401
0
0
null
null
null
null
UTF-8
Java
false
false
3,337
java
class FavoriteGenres { // Question /* * * Given a map Map<String, List<String>> userSongs with user names as keys and a * list of all the songs that the user has listened to as values. * * Also given a map Map<String, List<String>> songGenres, with song genre as * keys and a list of all the songs within that genre as values. The song can * only belong to only one genre. * * The task is to return a map Map<String, List<String>>, where the key is a * user name and the value is a list of the user's favorite genre(s). Favorite * genre is the most listened to genre. A user can have more than one favorite * genre if he/she has listened to the same number of songs per each of the * genres. * * Example 1: * * Input: userSongs = { "David": ["song1", "song2", "song3", "song4", "song8"], * "Emma": ["song5", "song6", "song7"] }, songGenres = { "Rock": ["song1", * "song3"], "Dubstep": ["song7"], "Techno": ["song2", "song4"], "Pop": * ["song5", "song6"], "Jazz": ["song8", "song9"] } * * Output: { "David": ["Rock", "Techno"], "Emma": ["Pop"] } * * Explanation: David has 2 Rock, 2 Techno and 1 Jazz song. So he has 2 favorite * genres. Emma has 2 Pop and 1 Dubstep song. Pop is Emma's favorite genre. * Example 2: * * Input: userSongs = { "David": ["song1", "song2"], "Emma": ["song3", "song4"] * }, songGenres = {} * * Output: { "David": [], "Emma": [] } * */ Map<String, List<String>> favoriteGenreSongList = new HashMap<>(); Map<String, List<String>> personSongList = new HashMap<>(); Map<String, List<String>> genreSongList = new HashMap<>(); Map<String, List<String>> favGenreListMap = new HashMap<>(); List<String> temp = new ArrayList<>(); Stack<String> favoriteGenre = new Stack<>(); public static void main(String[] args) { // Map<String,List<String>> personSongList = new HashMap<>(); // Map<String,List<String>> genreSongList = new HashMap<>(); } public Map<String, List<String>> favoriteGenreSong() { // init map; Map<String, List<String>> tempMap = new HashMap<String, List<String>>(); for (String name : personSongList.keySet()) { tempMap.put(name, new ArrayList<String>()); favGenreListMap.put(name, new ArrayList<String>()); } for (String name : personSongList.keySet()) { temp.clear(); for (String song : personSongList.get(name)) { for (String genre : genreSongList.keySet()) { if (genreSongList.get(genre).contains(song)) { temp.add(genre); break; } } } tempMap.put(name, temp); } Map<String, Integer> genreCount = new HashMap<>(); for (String name : tempMap.keySet()) { genreCount.clear(); int n = 0; for (String genreNAme : tempMap.get(name)) { if (genreCount.containsKey(name)) { genreCount.put(name, genreCount.get(genreNAme) + 1); } else { genreCount.put(name, 1); } for (String g : genreCount.keySet()) { if (genreCount.get(g) > n) { favoriteGenre.clear(); favoriteGenre.push(g); n = genreCount.get(g); } if (genreCount.get(g) == n) { favoriteGenre.push(g); } } favGenreListMap.put(name, new ArrayList<String>()); for (String s : favoriteGenre) { favGenreListMap.get(name).add(s); } } } return favGenreListMap; } }
b4855a1dfb57b16160b943c3c41e9362714af968
4100f6a98e26d7786819c3cc132b4c0c61d697f2
/src/main/java/com/example/mapping/domain/Ciclista.java
f08d1e39732e41e6e8b22e521c29cab287c5a83b
[]
no_license
luizgustavoss/mapping-specialized-collections
41d9a02ef5cd84fb0b7a2784bc322a40e09ec3c9
e93ba20b0ee60643881194c3961f4f664fb7483e
refs/heads/main
2023-01-04T08:01:56.417558
2020-11-05T05:04:12
2020-11-05T05:04:12
310,190,205
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.example.mapping.domain; import lombok.Getter; import lombok.Setter; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; @Getter @Setter @Entity @DiscriminatorValue("ciclista") public class Ciclista extends Piloto { }
5648597e767de2ea63f9d77d6416e4b4289e37a4
b448a7b4c91fb72a6bc343fc089a6a5a1926fd5e
/src/main/java/com/example/demo/model/beans/Pessoa.java
0d8018cd78cb37a52faa0954c07e6fe904474707
[]
no_license
MarceloRodrigues19/fatec_ipi_spring_jpa_hibernate3
7a45bd2b9b845cccf3eda8559d1bb8f9b9ea427f
f7e7781829417586767f51f54a4e79f27140f941
refs/heads/master
2022-11-21T03:07:58.198401
2020-07-22T01:44:59
2020-07-22T01:44:59
281,546,114
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package com.example.demo.model.beans; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "tb_pessoa") public class Pessoa { @Id @GeneratedValue private Long id; private String name; @OneToMany(mappedBy = "pessoa", cascade = CascadeType.ALL) private List<Veiculo> veiculos; public void setVeiculos(List<Veiculo> veiculos) { this.veiculos = veiculos; } public List<Veiculo> getVeiculos() { return veiculos; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
be04b92a533e9199f0f9ad4526ce729406e3a28b
10cde920bbef5eac779e7ca1cd6120e906471718
/app/src/main/java/org/scoutsfalcon/loboswallet/utils/Joven.java
fe5bca8fe91a818ee11e6d582cd4a4e05017228f
[]
no_license
scfouetsfalceon/loboswallet
5497d32ca8630acc8610585789a5456114ad5609
640609c34975b5ad4154479f2e3acf8a33d2bfb2
refs/heads/master
2021-05-29T17:48:00.740877
2015-09-28T04:58:05
2015-09-28T04:58:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,504
java
package org.scoutsfalcon.loboswallet.utils; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; public class Joven extends Object { private String code; private String name; private String lastName; private String region; private String district; private String group; private Integer account; public Boolean sex; public Joven(String code) { this.code = code; } public Joven(String code, String name, String lastName, Boolean sex, String region, String district, String group, Integer account) { this.code = code; this.name = name; this.lastName = lastName; this.sex = sex; this.region = region; this.district = district; this.group = group; this.account = account; } public String getCode() { return code; } public Boolean getSex() { return sex; } public String getName() { return name; } public String getLastName() { return lastName; } public String getRegion() { return region; } public String getDistrict() { return district; } public String getGroup() { return group; } public Integer getAccount() { return account; } public String getData() { String resultado = ""; if (code.isEmpty()) { resultado = "** Estación vacía **"; } else { resultado = String.format("%s - %s %s", code, name, lastName); } return resultado; } }
8d04435976837c397cd997427c3d235698070f8c
284eba873ea159e25c55e08d06b36cb3744d6fda
/src/main/java/com/yunding/lago/util/QRCodeEncoder.java
98ae70802785c704758e75ca5ab4f2e6ad010102
[]
no_license
justinjiangshiye/lago
6cfbf6c5f1e72def18f78fa04162034ca1d17814
df1bf72d99834e49e224d96a1c68f97b82753b2b
refs/heads/master
2016-09-15T22:14:20.331255
2014-10-12T10:19:46
2014-10-12T10:19:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,676
java
package com.yunding.lago.util; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import com.swetake.util.Qrcode; /** * * 二维码生成器 * * @blog http://sjsky.iteye.com * * @author Michael */ public class QRCodeEncoder { public static void encoderQRCode(String content, String imgPath) { try { Qrcode qrcodeHandler = new Qrcode(); qrcodeHandler.setQrcodeErrorCorrect('M'); qrcodeHandler.setQrcodeEncodeMode('B'); qrcodeHandler.setQrcodeVersion(7); System.out.println(content); byte[] contentBytes = content.getBytes("UTF-8"); BufferedImage bufImg = new BufferedImage(140, 140, BufferedImage.TYPE_INT_RGB); Graphics2D gs = bufImg.createGraphics(); gs.setBackground(Color.WHITE); gs.clearRect(0, 0, 140, 140); // 设定图像颜色> BLACK gs.setColor(Color.BLACK); // 设置偏移量 不设置可能导致解析出错 int pixoff = 2; // 输出内容> 二维码 if (contentBytes.length > 0 && contentBytes.length < 120) { boolean[][] codeOut = qrcodeHandler.calQrcode(contentBytes); for (int i = 0; i < codeOut.length; i++) { for (int j = 0; j < codeOut.length; j++) { if (codeOut[j][i]) { gs.fillRect(j * 3 + pixoff, i * 3 + pixoff, 3, 3); } } } } else { System.err.println("QRCode content bytes length = " + contentBytes.length + " not in [ 0,120 ]. "); } gs.dispose(); bufImg.flush(); File imgFile = new File(imgPath); // 生成二维码QRCode图片 ImageIO.write(bufImg, "png", imgFile); } catch (Exception e) { e.printStackTrace(); } } }
30651346815554800f230d5daa3dbbf551a0f620
581d6a9547646900c8866b241ca9dd7b97366016
/src/main/java/hu/akarnokd/rxjava2/debug/validator/ObservableValidator.java
b8c4e1c52d76ddcc6d89c5aee802280b94111ea8
[ "Apache-2.0" ]
permissive
zorrock/RxJavaExtensions
f2406604c8e6726585227efe790704cd5717a15e
4b1eb3c7cc8003621afbf00f4680d40efe481662
refs/heads/master
2020-12-03T06:01:31.210743
2019-06-25T08:13:56
2019-06-25T08:13:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,934
java
/* * Copyright 2016-2019 David Karnok * * 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 hu.akarnokd.rxjava2.debug.validator; import hu.akarnokd.rxjava2.functions.PlainConsumer; import io.reactivex.*; import io.reactivex.disposables.Disposable; /** * Validates an Observable. * @param <T> the value type * @since 0.17.4 */ final class ObservableValidator<T> extends Observable<T> { final Observable<T> source; final PlainConsumer<ProtocolNonConformanceException> onViolation; ObservableValidator(Observable<T> source, PlainConsumer<ProtocolNonConformanceException> onViolation) { this.source = source; this.onViolation = onViolation; } @Override protected void subscribeActual(Observer<? super T> observer) { source.subscribe(new ValidatorConsumer<T>(observer, onViolation)); } static final class ValidatorConsumer<T> implements Observer<T>, Disposable { final Observer<? super T> downstream; final PlainConsumer<ProtocolNonConformanceException> onViolation; Disposable upstream; boolean done; ValidatorConsumer(Observer<? super T> downstream, PlainConsumer<ProtocolNonConformanceException> onViolation) { super(); this.downstream = downstream; this.onViolation = onViolation; } @Override public void onSubscribe(Disposable d) { if (d == null) { onViolation.accept(new NullOnSubscribeParameterException()); } Disposable u = upstream; if (u != null) { onViolation.accept(new MultipleOnSubscribeCallsException()); } upstream = d; downstream.onSubscribe(this); } @Override public void onNext(T t) { if (t == null) { onViolation.accept(new NullOnNextParameterException()); } if (upstream == null) { onViolation.accept(new OnSubscribeNotCalledException()); } if (done) { onViolation.accept(new OnNextAfterTerminationException()); } else { downstream.onNext(t); } } @Override public void onError(Throwable e) { if (e == null) { onViolation.accept(new NullOnErrorParameterException()); } if (upstream == null) { onViolation.accept(new OnSubscribeNotCalledException(e)); } if (done) { onViolation.accept(new MultipleTerminationsException(e)); } else { done = true; downstream.onError(e); } } @Override public void onComplete() { if (upstream == null) { OnSubscribeNotCalledException ex = new OnSubscribeNotCalledException(); onViolation.accept(ex); } if (done) { onViolation.accept(new MultipleTerminationsException()); } else { done = true; downstream.onComplete(); } } @Override public void dispose() { upstream.dispose(); } @Override public boolean isDisposed() { return upstream.isDisposed(); } } }
876942f8b84207af90ca1e62e8ce3dd35a792136
63a8af1c239143d94528399b3719706d45341b24
/src/main/java/ks/web/TypeResponse.java
8afce272c24071229b86d7dfb0d01fed053e0d35
[ "MIT" ]
permissive
linxueqin/ks-web
2336fb05e6feb454cb7e882f55653574f2747b93
a27acf254bd4a5fcf621311949613b5c4501e742
refs/heads/master
2021-07-06T14:12:16.004290
2017-09-26T18:40:46
2017-09-26T18:40:46
104,912,849
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package ks.web; public class TypeResponse<T> extends Response { private T data; public T getData() { return data; } public void setData(T data) { this.data = data; } }
0b5588d3c5acd4c31973323dab40e187835890c8
989c44fe2a4452fe1a04592731d2e8a21fbda721
/app/src/main/java/student/sdu/hearingscreening/translators/ITranslator.java
cde815b5fa667a9ac1f5393859adfd2e6ef3d034
[]
no_license
ChrisDaBang/CE.BachelorProject
a1a79ca28fac86fb36fc0f79f6efb7283e46c48e
6cfd126bef64ec908bf59c5f3f419980b4c01334
refs/heads/master
2021-01-13T11:34:24.098446
2017-09-27T18:49:05
2017-09-27T18:49:05
81,205,904
0
1
null
2017-05-11T08:26:22
2017-02-07T12:32:11
Java
UTF-8
Java
false
false
191
java
package student.sdu.hearingscreening.translators; /** * Created by Bogs on 13-04-2017. */ public interface ITranslator { public float translate(float input, int frequencyNumber); }
dc8f064c2c04cd0ccbc340b59bf36838bdc49b18
93e9ddda54559cc3cb4825239518d8b5d3bb9083
/Snake Game/src/Main.java
c62d5842ffe243eaa46d144a9d39280a004d6339
[]
no_license
alisolanki/Snake-Game
2ed9d94aa376a69c046322164d8564214d020eef
f8a93a334d613d743e7c47e7589d1254d7dc3428
refs/heads/master
2020-07-28T08:00:32.104949
2020-02-01T16:51:37
2020-02-01T16:51:37
209,358,542
3
2
null
null
null
null
UTF-8
Java
false
false
589
java
import javax.swing.JFrame; public class Main { public Main() { JFrame frame = new JFrame(); Gamepanel gamepanel = new Gamepanel(); frame.add(gamepanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Snake Game ~ Ali Solanki"); try { frame.wait(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } frame.pack(); frame.setVisible(true); frame.setLocationRelativeTo(null); } public static void main(String[] args) { new Main(); } }
c26284368118919116ede39043195fd55d227ca8
29ef246e7e9030611f5d9d35122791badb9426b9
/src/com/sopiana/yang/javaDecompiler/instruction/byteCodes/dconst_0.java
fbeaf756905eb9a8f731548237c302ad10a8c9f7
[]
no_license
sopiana/javaDecompiler
c6085f36d04100dca80c9eec2062b951b7620aec
4c09b7db1fd87f24d56dadee4fd9e6b552b93714
refs/heads/master
2021-05-31T15:58:37.607374
2016-04-27T16:13:31
2016-04-27T16:13:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package com.sopiana.yang.javaDecompiler.instruction.byteCodes; import com.sopiana.yang.javaDecompiler.instruction.instruction; import com.sopiana.yang.javaDecompiler.instruction.instructionException; import com.sopiana.yang.javaDecompiler.instruction.opcodeTable; public class dconst_0 extends instruction { public static final opcodeTable ins = opcodeTable._dconst_0; public static dconst_0 getInstance(byte[]codes, int offset) throws instructionException { if(codes[offset]!=ins.opcode) throw new instructionException("supplied code is not valid "+ins.mnemonic+" opcode"); dconst_0 res = new dconst_0(); res.offset = offset; res.opcode = codes[offset]; return res; } public byte[] getData() { return new byte[]{opcode}; } public int getSize() { return 1; } public String getMnemonic() { return ins.mnemonic; } }
1dd2883692b18b6b6105db1233d7af1f4aaa3ebc
0f2ccf85c1823f9646742bf1ace0aedaa0570bca
/2D Game Engine/src/dev/moltencube/mygame/entities/statics/Plant.java
a0f871c7359db50a7b609d9277fc59654ba86449
[]
no_license
mdeane84/Software-Engineering-Portfolio
c11c33ecef715e02d1391ed86c76099c25677900
874db1373b8f51fdc0ca920c5e8a45d91e318578
refs/heads/master
2021-07-11T22:29:57.632202
2020-12-01T03:52:50
2020-12-01T03:52:50
221,572,829
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
package dev.moltencube.mygame.entities.statics; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.util.Random; import dev.moltencube.mygame.Handler; import dev.moltencube.mygame.items.Item; import dev.moltencube.mygame.items.types.ToolType; public class Plant extends StaticEntity { public Plant(Handler handler, BufferedImage texture, float x, float y) { super(handler, x, y, 32, 48); this.texture = texture; this.strength = 0; this.solid = false; this.requiredTool = ToolType.ANY; bounds.x = 4; bounds.y = 32; bounds.width = 16; bounds.height = 16; maxHealth = 1; health = maxHealth; } public Plant(Handler handler, BufferedImage texture, float x, float y, int width, int height) { super(handler, x, y, width, height); this.texture = texture; this.strength = 0; this.solid = false; this.requiredTool = ToolType.ANY; bounds.x = 12; bounds.y = (int) (height / 1.2f); bounds.width = width - 22; bounds.height = (int) (height - height / 1.2f); maxHealth = 1; health = maxHealth; } @Override public void tick() { super.tick(); } @Override public void render(Graphics g) { g.drawImage(texture, (int) (x - handler.getGameCamera().getxOffset()), (int) (y - handler.getGameCamera().getyOffset()), width, height, null); } public void die() { Random random = new Random(); handler.getWorld().getItemManager().addItem(Item.plantFiberItem.createNew((int) x,(int) y, random.nextInt(3) + 1)); } }
a6a251c621db32c8cdea22b0fb30ef9efa51e1c7
6a54c9d5f0ef3f7fa37b9e47953bbab4db44fa82
/src/com/turt2live/luxe/lottery/pages/Line.java
b3b99f71130975e1f19963b0d2dcb9f84e732107
[]
no_license
LuxeMinecraft/Luxe-Lottery
055e86a2109326c2a987cc73e583be0ce1c06e2f
b9c581483051f003bc2b4d986a234caa991b22fe
refs/heads/master
2020-04-15T13:04:28.941508
2012-08-14T00:50:19
2012-08-14T00:50:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
672
java
package com.turt2live.luxe.lottery.pages; /** * Represents a line * * @author turt2live */ public abstract class Line { protected String line; /** * Creates a new Line with no value */ public Line(){} /** * Creates a new Line with a default value * * @param line the line */ public Line(String line){ this.line = line; } /** * Fetches the line * * @return the line */ public String getLine(){ return line; } /** * Sets the line * * @param line the line */ public void setLine(String line){ this.line = line; } /** * Called by the page generator before adding the line */ public abstract void format(); }
7ffa1d82c7e6241be77132559b39a7f6375c1dee
e70abc02efbb8a7637eb3655f287b0a409cfa23b
/hyjf-api-web/src/main/java/com/hyjf/api/web/banklist/BankSettingBean.java
3dfcd7e625a6dd632391fb4a290b273afdc2249d
[]
no_license
WangYouzheng1994/hyjf
ecb221560460e30439f6915574251266c1a49042
6cbc76c109675bb1f120737f29a786fea69852fc
refs/heads/master
2023-05-12T03:29:02.563411
2020-05-19T13:49:56
2020-05-19T13:49:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.hyjf.api.web.banklist; import com.hyjf.bank.service.BaseBean; /** * 文章管理实体类 * * @author * */ public class BankSettingBean extends BaseBean { }
bdeb3555751a5ee6b44ab0ed72b480bed1bda234
96d8c80eff6204fbf97c0eb7f567444d43efb32f
/src/objetos/comandos/ComandoAdicionarSala.java
52511a5c97650c6b56efd22d58482e7331614f39
[]
no_license
ThallesAraujo/Sistema-de-Aloca-o-de-Salas-Design-Patterns-
eb950b060dcd32379208c516aa6a8a149638e9ae
2d376cb8bd8b2d24beb9d9dbdfcf07cb0f172156
refs/heads/master
2020-12-02T20:56:28.945473
2017-08-09T19:05:38
2017-08-09T19:05:38
96,232,808
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,461
java
package objetos.comandos; import exceptions.RoomsAllocationException; import graphicalui.janelas.JanelaPrincipal; import graphicalui.objetos.AlertaDeErro; import graphicalui.objetos.AlertaDeInformacao; import logica.Logger; import logica.OperadorSalas; import objetos.Log; import objetos.Sala; public class ComandoAdicionarSala implements Comando{ private Sala sala; public ComandoAdicionarSala(Sala sala){ this.sala = sala; } @Override public void executar() throws Exception { try{ OperadorSalas.salvar(sala); Logger.adicionarLog(new Log("Sala "+sala.getId()+" salva com sucesso.")); }catch(Exception e){ this.sala = null; Logger.adicionarLog(new Log("ERRO: "+e.getMessage())); throw new RoomsAllocationException(e.getMessage()); } } @Override public void desfazer() throws Exception { if(sala!=null){ try{ OperadorSalas.excluir(sala.getId()); JanelaPrincipal.atualizar(); AlertaDeInformacao alerta = new AlertaDeInformacao("Desfazer ação","Ação desfeita","Sala "+sala.getId()+" apagada com sucesso."); Logger.adicionarLog(new Log("AÇÃO DESFEITA: Sala "+sala.getId()+" apagada com sucesso.")); }catch(Exception e){ Logger.adicionarLog(new Log("ERRO: "+e.getMessage())); throw new RoomsAllocationException(e.getMessage()); } }else{ AlertaDeErro alerta = new AlertaDeErro("Desfazer ação","Comando vazio","Não há nada há ser desfeito porque o comando é nulo"); } } }
ef1afbf419711fbd59315e5de5553c0f5960d92b
87f9b147dda4fdbab0a073c975ebcd35d45362a7
/src/main/java/com/warehouse/dto/filter/PurchaseModelFilterDto.java
1795bdb381c20daa9ddef16542bb05b27c9552b3
[]
no_license
Aigul9/warehouse-back
25f455f17a8f988921912162b5ff13e10a586a64
d857e41b8dd93db8b10e843224886738ae64c63d
refs/heads/master
2023-06-23T09:34:20.077985
2021-07-18T19:55:20
2021-07-18T19:55:20
380,024,066
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package com.warehouse.dto.filter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import java.util.Date; @Getter @Setter @NoArgsConstructor @ApiModel(description = "Represents a purchase for filtering purposes.") public class PurchaseModelFilterDto { @ApiModelProperty(value = "date of the purchase") private Date date; @ApiModelProperty(value = "total sum of the purchase") private Double total; public PurchaseModelFilterDto(Date date, Double total) { this.date = date; this.total = total; } }
1317b5f964e0e5fab03d5476ebcf1dc4a3154ee3
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a042/A042948Test.java
c9a229f56b50eac8b6932797d3405e7c5d512786
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package irvine.oeis.a042; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A042948Test extends AbstractSequenceTest { }
105965d206df4669fdd8842f76ac8aeaf5883c9b
5ccf4bb5fb3ee1e30263242c3b4dc34262f95fae
/app/src/main/java/com/example/project/ACTIVITY/MyGifts.java
95554a73796b9ab3b8bd1bf011c3a7dd72c24c0b
[]
no_license
ayebmehdi2/ForUser
cfb577d295fc53ef3853a2eb21d916001760c358
5fc50925e6abd3bbed6578e689ff4e921b951f85
refs/heads/master
2021-03-24T06:32:09.270909
2020-07-07T04:49:27
2020-07-07T04:49:27
247,526,040
1
1
null
null
null
null
UTF-8
Java
false
false
3,881
java
package com.example.project.ACTIVITY; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View; import android.view.Window; import android.view.WindowManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.LinearLayoutManager; import com.example.project.ADAPTERS.AdapterGifts; import com.example.project.DATAS.GIFT; import com.example.project.R; import com.example.project.databinding.MyGiftsBinding; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; public class MyGifts extends AppCompatActivity implements AdapterGifts.click { MyGiftsBinding binding; FirebaseDatabase database; DatabaseReference reference; String uid; private AdapterGifts giftsAdapter; private ValueEventListener valueEventListener; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); binding = DataBindingUtil.setContentView(this, R.layout.my_gifts); database = FirebaseDatabase.getInstance(); reference = database.getReference(); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); uid = preferences.getString("uid", null); giftsAdapter = new AdapterGifts(this); binding.rec.setLayoutManager(new LinearLayoutManager(this)); binding.rec.setHasFixedSize(true); binding.rec.setAdapter(giftsAdapter); ArrayList<GIFT> gifts = new ArrayList<>(); valueEventListener = new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { giftsAdapter.swapAdapter(null); gifts.clear(); if (!(dataSnapshot.getChildrenCount() > 0)){ binding.rec.setVisibility(View.GONE); binding.empty.setVisibility(View.VISIBLE); return; } for (DataSnapshot snapshot : dataSnapshot.getChildren()) { GIFT g = snapshot.getValue(GIFT.class); gifts.add(g); } binding.empty.setVisibility(View.GONE); binding.rec.setVisibility(View.VISIBLE); giftsAdapter.swapAdapter(gifts); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }; } @Override protected void onStart() { super.onStart(); reference.child("USERS").child(uid).child("myGifts").addValueEventListener(valueEventListener); } @Override protected void onStop() { super.onStop(); reference.child("USERS").child(uid).child("myGifts").removeEventListener(valueEventListener); } @Override public void onBackPressed() { finish(); } @Override public void command(GIFT g) { Intent i = new Intent(this, CommandGiftMap.class); CommandGiftMap.gif = g; startActivity(i); } @Override public void viewQr(GIFT g) { Intent i = new Intent(this, ShowImage.class); i.putExtra("url", g.getQr_img()); startActivity(i); } }
e6d5766707b7bbe0cc3c07c52058af4d68f8af51
ac2c49f1886d076a956e3c6c28e22b9341fe147e
/hxcpp-debugger-protocol/src/JavaProtocol/src/haxe/lang/VarArgsFunction.java
9242dd04bcd6b294ba86623d0f82acd5625cc31b
[ "Apache-2.0" ]
permissive
m0rkeulv/intellij-haxe
fe118f2f24c8f67c423b3d036c95fe15805e2536
22949da430d455954b18cd1a634491238634e850
refs/heads/master
2021-08-18T04:44:15.876735
2018-03-29T06:40:43
2018-03-29T06:40:43
125,924,711
0
0
Apache-2.0
2021-01-13T21:29:45
2018-03-19T21:48:58
Java
UTF-8
Java
false
false
451
java
package haxe.lang; import haxe.root.*; @SuppressWarnings(value={"rawtypes", "unchecked"}) public class VarArgsFunction extends haxe.lang.VarArgsBase { public VarArgsFunction(haxe.lang.Function fun) { super(-1, -1); this.fun = fun; } public haxe.lang.Function fun; @Override public java.lang.Object __hx_invokeDynamic(haxe.root.Array dynArgs) { return ((java.lang.Object) (this.fun.__hx_invoke1_o(0.0, dynArgs)) ); } }
d22803d0214bd694d504b39747e6635f475c0704
ea3bd0d2beb6cdca76447ec2b232f5a317d84f25
/src/com/en/celia/if5.java
d9c19c30b8106d25cd92d9951216a66c9f363fbe
[]
no_license
en-raluca/JavaGroup2021
709b53079e4e7c52b41cdd3d7f94e0dc89dd7d01
0d983e4642052b849cdfa40b152782b94a30afc7
refs/heads/main
2023-03-30T16:42:19.303611
2021-04-09T06:37:12
2021-04-09T06:37:12
349,389,380
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package com.en.celia; public class if5 { public static int pozitiveOrNegative (int n){ if (n>0) { System.out.println("The number is positive"); }else if (n==0) { System.out.println("The number is 0"); }else { System.out.println("The number is negative"); } return n; } public static void main(String[] args) { int result = pozitiveOrNegative(-3); System.out.println(result); } }
0e2c9c25905d60582a4e8e4b4f9ed687c8c17f21
bac3bbcf73b23df3f18772486f8ab414abf3fab0
/PS4/src/ch/makery/address/view/PersonEditDialogController.java
ab2871ca5bba0a2a0c2376b4ba9413d573cb6c71
[]
no_license
geofftwomey/PS4
8f21cd90270918d33dc735777aa8f95989edb207
a29c37512198a4c7e43812527a401d42bacac18a
refs/heads/master
2021-01-19T00:11:06.666897
2017-04-04T04:43:35
2017-04-04T04:43:35
87,147,931
0
0
null
null
null
null
UTF-8
Java
false
false
3,959
java
package ch.makery.address.view; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.TextField; import javafx.stage.Stage; import ch.makery.address.model.Person; import ch.makery.address.util.DateUtil; /** * Dialog to edit details of a person. * * @author Marco Jakob */ public class PersonEditDialogController { @FXML private TextField firstNameField; @FXML private TextField lastNameField; @FXML private TextField streetField; @FXML private TextField postalCodeField; @FXML private TextField cityField; @FXML private TextField birthdayField; private Stage dialogStage; private Person person; private boolean okClicked = false; /** * Initializes the controller class. This method is automatically called * after the fxml file has been loaded. */ @FXML private void initialize() { } /** * Sets the stage of this dialog. * * @param dialogStage */ public void setDialogStage(Stage dialogStage) { this.dialogStage = dialogStage; } /** * Sets the person to be edited in the dialog. * * @param person */ public void setPerson(Person person) { this.person = person; firstNameField.setText(person.getFirstName()); lastNameField.setText(person.getLastName()); streetField.setText(person.getStreet()); postalCodeField.setText(Integer.toString(person.getPostalCode())); cityField.setText(person.getCity()); birthdayField.setText(DateUtil.format(person.getBirthday())); birthdayField.setPromptText("dd.mm.yyyy"); } /** * Returns true if the user clicked OK, false otherwise. * * @return */ public boolean isOkClicked() { return okClicked; } /** * Called when the user clicks ok. */ @FXML private void handleOk() { if (isInputValid()) { person.setFirstName(firstNameField.getText()); person.setLastName(lastNameField.getText()); person.setStreet(streetField.getText()); person.setPostalCode(Integer.parseInt(postalCodeField.getText())); person.setCity(cityField.getText()); person.setBirthday(DateUtil.parse(birthdayField.getText())); okClicked = true; dialogStage.close(); } } /** * Called when the user clicks cancel. */ @FXML private void handleCancel() { dialogStage.close(); } /** * Validates the user input in the text fields. * * @return true if the input is valid */ private boolean isInputValid() { String errorMessage = ""; if (firstNameField.getText() == null || firstNameField.getText().length() == 0) { errorMessage += "No valid first name!\n"; } if (lastNameField.getText() == null || lastNameField.getText().length() == 0) { errorMessage += "No valid last name!\n"; } if (streetField.getText() == null || streetField.getText().length() == 0) { errorMessage += "No valid street!\n"; } if (postalCodeField.getText() == null || postalCodeField.getText().length() == 0) { errorMessage += "No valid postal code!\n"; } else { // try to parse the postal code into an int. try { Integer.parseInt(postalCodeField.getText()); } catch (NumberFormatException e) { errorMessage += "No valid postal code (must be an integer)!\n"; } } if (cityField.getText() == null || cityField.getText().length() == 0) { errorMessage += "No valid city!\n"; } if (birthdayField.getText() == null || birthdayField.getText().length() == 0) { errorMessage += "No valid birthday!\n"; } else { if (!DateUtil.validDate(birthdayField.getText())) { errorMessage += "No valid birthday. Use the format dd.mm.yyyy!\n"; } } if (errorMessage.length() == 0) { return true; } else { // Show the error message. Alert alert = new Alert(AlertType.ERROR); alert.initOwner(dialogStage); alert.setTitle("Invalid Fields"); alert.setHeaderText("Please correct invalid fields"); alert.setContentText(errorMessage); alert.showAndWait(); return false; } } }
e81143650496064998652caf4d09121f6774a98b
e4ba7965183b066e1ae9706a4fff16e285a935cc
/src/main/java/com/school/leerlingenregistratie/dao/StudentDataAccessService.java
f262248f78db5ab7eae1d117e63792cd0682cc40
[]
no_license
teijekuiken/StudentRegistrationAPI
5a403ef033c7f61a521a6cf4dfc60f5555eabd59
3401c8bd23b95c4d18c8e733c1b1fdca9cd242c1
refs/heads/master
2023-01-04T02:22:13.109726
2020-05-29T23:08:37
2020-05-29T23:08:37
308,768,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,667
java
package com.school.leerlingenregistratie.dao; import com.school.leerlingenregistratie.model.Student; import org.springframework.stereotype.Repository; import javax.swing.text.html.Option; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; @Repository("StudentDao") public class StudentDataAccessService implements StudentDao { private static List<Student> database = new ArrayList<>(); @Override public int insertStudent(UUID id, Student student) { database.add(new Student(id, student.getStudentFirstName(), student.getStudentLastName())); return 1; } @Override public Optional<Student> selectStudentById(UUID id) { return database.stream() .filter(student -> student.getStudentID().equals(id)) .findFirst(); } @Override public List<Student> selectAllStudents() { return database; } @Override public int deleteStudentId(UUID id) { Optional<Student> student = selectStudentById(id); if(student.isEmpty()){ return 0; } database.remove(student.get()); return 1; } @Override public int updateStudent(UUID id, Student student) { return selectStudentById(id) .map(s -> { int indexOfStudentToDelete = database.indexOf(student); if(indexOfStudentToDelete >= 0){ database.set(indexOfStudentToDelete, student); return 1; } return 1; }) .orElse(0); } }
4edf97c2abf90cfbd50e11d738b871ffb60866a4
c1733822a2879e1a234c43cd69e33036d988e776
/app/src/androidTest/java/net/ibnux/whoisid/ExampleInstrumentedTest.java
2b6fa9681dab7b458d9847687fb2a72e4d94854d
[]
no_license
irhasnh/Whois.ID
d65345eeb5ba16079ebaccf588e44238b4d6f17f
750afdc058a31f6329a6ff1b39f88586f89b430f
refs/heads/master
2021-01-03T09:02:27.407543
2019-09-25T05:53:29
2019-09-25T05:53:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package net.ibnux.whoisid; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("net.ibnux.whoisid", appContext.getPackageName()); } }
4afc66dadb9c2d0419af17e0d832e4fc79ad832d
960657a9b89eee67f09cc4e23675996f7f902440
/src/main/java/org/uic/barcode/ticket/api/asn/omv3/LuggageRestrictionType.java
684b762797ba23195827f6af9e38527c3cd655ba
[ "Apache-2.0" ]
permissive
UnionInternationalCheminsdeFer/UIC-barcode
cfe5193f01361177a53b2889ba676d96a02d3be2
91c78a9c0dbb20ce141a0122267b4f6d367646ec
refs/heads/master
2023-08-18T20:18:57.933509
2023-08-11T08:43:36
2023-08-11T08:43:36
216,804,906
16
6
NOASSERTION
2023-08-11T08:43:38
2019-10-22T12:09:57
Java
UTF-8
Java
false
false
2,587
java
/* * This file was generated by openASN.1 - an open source ASN.1 toolkit for java * * openASN.1 is Copyright (C) 2007 Clayton Hoss, Marc Weyland * * openASN.1 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 3 of * the License, or (at your option) any later version. * * openASN.1 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 openASN.1. If not, see <http://www.gnu.org/licenses/>. * */ package org.uic.barcode.ticket.api.asn.omv3; import org.uic.barcode.asn1.datatypes.Asn1Default; import org.uic.barcode.asn1.datatypes.Asn1Optional; import org.uic.barcode.asn1.datatypes.FieldOrder; import org.uic.barcode.asn1.datatypes.HasExtensionMarker; import org.uic.barcode.asn1.datatypes.IntRange; import org.uic.barcode.asn1.datatypes.Sequence; @Sequence @HasExtensionMarker public class LuggageRestrictionType extends Object { public LuggageRestrictionType() { } @FieldOrder(order = 0) @IntRange(minValue=0,maxValue=99) @Asn1Default(value="3") @Asn1Optional public Long maxHandLuggagePieces; @FieldOrder(order = 1) @IntRange(minValue=0,maxValue=99) @Asn1Default(value="1") @Asn1Optional public Long maxNonHandLuggagePieces; @FieldOrder(order = 2) @Asn1Optional public SequenceOfRegisteredLuggageType registeredLuggage; public void setRegisteredLuggage( SequenceOfRegisteredLuggageType registeredLuggage) { this.registeredLuggage = registeredLuggage; } public Long getMaxHandLuggagePieces() { if (maxHandLuggagePieces == null) { return new Long(3); } return this.maxHandLuggagePieces; } public Long getMaxNonHandLuggagePieces() { if (maxNonHandLuggagePieces == null) { return new Long(1); } return this.maxNonHandLuggagePieces; } public SequenceOfRegisteredLuggageType getRegisteredLuggage() { return this.registeredLuggage; } public void setMaxHandLuggagePieces(Long maxHandLuggagePieces) { this.maxHandLuggagePieces = maxHandLuggagePieces; } public void setMaxNonHandLuggagePieces(Long maxNonHandLuggagePieces) { this.maxNonHandLuggagePieces = maxNonHandLuggagePieces; } }
2a4873648b60e66828420d20b06be30b86f3a8f7
c53988700394a033c77e55c45e914f822a059644
/thread-demo/src/main/java/com/td/生产者消费者/MyBlockingQueueForCondition.java
fb73a2bcdf66faf2beba582d38fa9da75342c78f
[]
no_license
syxr/kurry
728b28777b5d37abbb771c4433ea7da3fcafaabc
0d6871d203cbe0acf352c054667c61387b90b236
refs/heads/master
2022-12-06T22:02:49.003101
2020-08-07T01:30:44
2020-08-07T01:30:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,351
java
package com.td.生产者消费者; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; /** * @ClassName: MyBlockingQueueForCondition * @Description: 描述 * @Author: zhoujian * @Date: 2020/7/8$ 17:33$ * @Version: 1.0 */ public class MyBlockingQueueForCondition { private Queue queue; private int max = 16; private ReentrantLock lock = new ReentrantLock(); private Condition notEmpty = lock.newCondition(); private Condition notFull = lock.newCondition(); public MyBlockingQueueForCondition(int size) { this.max = size; queue = new LinkedList(); } public void put(Object o) throws InterruptedException { lock.lock(); try { while (queue.size() == max) { notFull.await(); } queue.add(o); notEmpty.signalAll(); } finally { lock.unlock(); } } public Object take() throws InterruptedException { lock.lock(); try { while (queue.size() == 0) { notEmpty.await(); } Object item = queue.remove(); notFull.signalAll(); return item; } finally { lock.unlock(); } } }
22bf4680d9d372cb5b1a32184e8cfdcc272c9f53
48c61bdd1cb92138dca1dbfcd4531d3a1d81472a
/_02_Tools_Basic/_11_ListView/_09_Colors_ListView/Main.java
3326186be1f2478e5f9c4fb9102e112bfef75359
[]
no_license
Majd-Talji/JavaFX
b907c85bd9061aef35bb29de68cf907430ca0b47
d2f29d15dcb1ed3d1b24b3393eb73ac942b47cac
refs/heads/master
2022-05-31T22:35:22.990795
2020-05-03T16:25:16
2020-05-03T16:25:16
260,971,476
0
0
null
null
null
null
UTF-8
Java
false
false
1,863
java
package _02_Tools_Basic._11_ListView._09_Colors_ListView; import javafx.application.Application; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; /** * * @author Majd Talji <[email protected]> */ public class Main extends Application { @Override public void start(Stage stage) { Label label = new Label(); ListView<String> listView = new ListView(); ObservableList<String> items = FXCollections.observableArrayList( "red", "blue", "green", "yellow", "orange", "brown", "pink", "purple", "gray", "black", "white" ); listView.setItems(items); listView.setCellFactory((ListView<String> ol) -> new ColorRectCell()); label.setPrefSize(200, 30); listView.setPrefSize(152, 250); label.setTranslateX(180); label.setTranslateY(110); listView.setTranslateX(0); listView.setTranslateY(0); label.setFont(new Font("Arial", 22)); Group root = new Group(); root.getChildren().add(label); root.getChildren().add(listView); Scene scene = new Scene(root, 400, 250); stage.setTitle("JavaFX ListView"); stage.setScene(scene); stage.show(); listView.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends String> ov, String oldValue, String newValue) -> { label.setText(newValue); label.setTextFill(Color.web(newValue)); }); } public static void main(String[] args) { launch(args); } }
17e0a9c66777eee32aa57318a937f56b1ec01c7a
809667752ef560f28cbc79c24400d6817bf00e78
/sireum-bakar-xml/src/main/java/org/sireum/bakar/xml/FloorAttribute.java
5a3d2e5e30d81c505fa555356c3593ecb74d0a0a
[]
no_license
sireum/v2-bakar
caccd4508a1df48792da3d6e67fac4d7be19c0ca
901665e57bf3a8501ffc11859d67ce6fc864cfda
refs/heads/master
2021-06-11T10:16:32.180056
2016-11-14T19:38:53
2016-11-14T19:38:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,260
java
package org.sireum.bakar.xml; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for Floor_Attribute complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Floor_Attribute"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="sloc" type="{}Source_Location"/> * &lt;element name="prefix_q" type="{}Expression_Class"/> * &lt;element name="attribute_designator_identifier_q" type="{}Expression_Class"/> * &lt;/sequence> * &lt;attribute name="type" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="checks" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Floor_Attribute", propOrder = { "sloc", "prefixQ", "attributeDesignatorIdentifierQ" }) public class FloorAttribute extends Base { @XmlElement(required = true) protected SourceLocation sloc; @XmlElement(name = "prefix_q", required = true) protected ExpressionClass prefixQ; @XmlElement(name = "attribute_designator_identifier_q", required = true) protected ExpressionClass attributeDesignatorIdentifierQ; @XmlAttribute(name = "type", required = true) protected String type; @XmlAttribute(name = "checks") protected String checks; /** * Gets the value of the sloc property. * * @return * possible object is * {@link SourceLocation } * */ public SourceLocation getSloc() { return sloc; } /** * Sets the value of the sloc property. * * @param value * allowed object is * {@link SourceLocation } * */ public void setSloc(SourceLocation value) { this.sloc = value; } /** * Gets the value of the prefixQ property. * * @return * possible object is * {@link ExpressionClass } * */ public ExpressionClass getPrefixQ() { return prefixQ; } /** * Sets the value of the prefixQ property. * * @param value * allowed object is * {@link ExpressionClass } * */ public void setPrefixQ(ExpressionClass value) { this.prefixQ = value; } /** * Gets the value of the attributeDesignatorIdentifierQ property. * * @return * possible object is * {@link ExpressionClass } * */ public ExpressionClass getAttributeDesignatorIdentifierQ() { return attributeDesignatorIdentifierQ; } /** * Sets the value of the attributeDesignatorIdentifierQ property. * * @param value * allowed object is * {@link ExpressionClass } * */ public void setAttributeDesignatorIdentifierQ(ExpressionClass value) { this.attributeDesignatorIdentifierQ = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link String } * */ public String getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link String } * */ public void setType(String value) { this.type = value; } /** * Gets the value of the checks property. * * @return * possible object is * {@link String } * */ public String getChecks() { return checks; } /** * Sets the value of the checks property. * * @param value * allowed object is * {@link String } * */ public void setChecks(String value) { this.checks = value; } }
07a61239a3a0ef21428db00d42841b0c31483869
329e9dcd21da39bdc752c03309e44b735e6addce
/cscs/cscs-platform-commons/src/main/java/com/chinacscs/platform/commons/entity/AuditBaseEntity.java
4cc355731e4fb2c1b2aa331dbb336a91ac0a553b
[]
no_license
pengliwh/hadoop
1431edc78789ffca34bf83c748c0f07c99b1d840
f1eb68348b15c2fafe6eb4aee6734c685b85ed92
refs/heads/master
2020-04-08T21:48:42.865847
2019-04-03T07:13:45
2019-04-03T07:13:45
159,759,379
0
0
null
null
null
null
UTF-8
Java
false
false
726
java
package com.chinacscs.platform.commons.entity; import java.util.Date; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; /** * @author:MG01867 * @date:2018年6月15日 * @email:[email protected] * @version: * @describe 基础审计实体类 */ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public abstract class AuditBaseEntity extends BaseEntity{ /**数据更新用户id:VARCHAR(36)**/ private Long updateUserId; /**数据更新日期(每次写操作时赋值):TIMESTAMP**/ private Date updateDate; /**数据创建用户id:VARCHAR(36)**/ private Long createUserId; /**数据创建日期(只在创建时赋值):TIMESTAMP**/ private Date createDate; }
ca6835184a8ac000afcfdf8c777068ac62938dc7
2e2e213e01971bc4d6460afb5156a4390bb12bc1
/src/main/java/uz/pdp/appatm/repositpry/ClientRepository.java
4c24eb029b87fa985911b2f396e7dd9b392b7e78
[]
no_license
Hakimbek/app-atm
63070a14622bc2d3fd932306440e24d96a1ff83c
b9268465436dccec2cc6a26aa37fc3cde1ac2e0b
refs/heads/master
2023-04-29T15:32:14.573898
2021-05-11T14:04:52
2021-05-11T14:04:52
366,367,501
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package uz.pdp.appatm.repositpry; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import uz.pdp.appatm.entity.Client; import java.util.UUID; @RepositoryRestResource(path = "client") public interface ClientRepository extends JpaRepository<Client, UUID> { }
7a71192cc4d7cbd5101d3ecbfd3514070ab35621
e295eb56743fae4a45cfaca6623edcd17c9f56f5
/app/src/main/java/com/example/tuptr/Model/items.java
904cd74134e77d773f21c82a6939157141dfeaa2
[]
no_license
KarenCalulo0012/torqapp-mobile-apk
8b27959c8aebeffd68f1ef8fa8f4971c0d4f6f3d
88cdafeb4fa4df12d7d4331d299b61fe20e41d9c
refs/heads/master
2023-07-09T01:11:43.453810
2021-08-12T13:29:39
2021-08-12T13:29:39
297,263,325
0
0
null
null
null
null
UTF-8
Java
false
false
93
java
package com.example.tuptr.Model; public class items { public static String itemlists; }
6c8dbc0fe1746e98fc980021f297b321d7f6772a
8ec2cbabd6125ceeb00e0c6192c3ce84477bdde6
/com.nokia.as.thirdparty.cljl/src/com/nokia/licensing/agnosticImpl/CredentialAccessImpl.java
671072d8106be9023777b544ced507d7f18ebede
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
nokia/osgi-microfeatures
2cc2b007454ec82212237e012290425114eb55e6
50120f20cf929a966364550ca5829ef348d82670
refs/heads/main
2023-08-28T12:13:52.381483
2021-11-12T20:51:05
2021-11-12T20:51:05
378,852,173
1
1
null
null
null
null
UTF-8
Java
false
false
640
java
// Copyright 2000-2021 Nokia // // Licensed under the Apache License 2.0 // SPDX-License-Identifier: Apache-2.0 // package com.nokia.licensing.agnosticImpl; import java.util.HashMap; import com.nokia.licensing.interfaces.CredentialAccess; public class CredentialAccessImpl implements CredentialAccess { @Override public HashMap<String, String> getCredentials() { final HashMap<String, String> credentialMap = new HashMap<String, String>(10); credentialMap.put(CredentialAccess.USERNAME_KEY, "license"); credentialMap.put(CredentialAccess.PASSWORD_KEY, "license"); return credentialMap; } }
48eb98e606387dc618fdcef796106acde8b2d34b
c33230e6799f1bf014804d35211500e0a2ed9056
/4.JavaCollections/src/com/javarush/task/task37/task3708/retrievers/CachingProxyRetriever.java
e10ec0ac49455b5aeb6eea03337606e768679a66
[]
no_license
YeslieSnayder/JavaRushTasks
747837243e12259148b73c2af5b12e8aab5f1314
7ca41668a0f595150eb9d7c2399f20dcd7a76c45
refs/heads/master
2021-08-18T00:07:43.983008
2021-05-24T19:11:05
2021-05-24T19:11:05
252,421,273
0
0
null
null
null
null
UTF-8
Java
false
false
686
java
package com.javarush.task.task37.task3708.retrievers; import com.javarush.task.task37.task3708.cache.LRUCache; import com.javarush.task.task37.task3708.storage.Storage; public class CachingProxyRetriever implements Retriever { private OriginalRetriever original; private LRUCache<Long, Object> cache; public CachingProxyRetriever(Storage storage) { original = new OriginalRetriever(storage); cache = new LRUCache<>(100); } @Override public Object retrieve(long id) { Object obj = cache.find(id); if (obj == null) { obj = original.retrieve(id); cache.set(id, obj); } return obj; } }
e5d22ff2ea165bced125a4a3d0072234e184250e
21dab1cf2f5c0ba531a74fd58f00591e9550c293
/src/io/github/dmi3coder/javafx_design_patterns/behavioral/iterator/Iterator.java
54e6f99550d50c7ec9e60e34b9de504d9e582dbb
[]
no_license
dmi3coder/Design_Patterns_With_JavaFX
ab879292009e818b6f31e907260d41c46abb3552
9fa60869ef8b68edbf622d828a2f1165ec3ceced
refs/heads/master
2021-07-19T14:38:50.932227
2017-10-30T07:10:22
2017-10-30T07:10:22
106,570,241
1
0
null
null
null
null
UTF-8
Java
false
false
184
java
package io.github.dmi3coder.javafx_design_patterns.behavioral.iterator; /** * Created by dim3coder on 10/30/17. */ public interface Iterator<T> { boolean hasNext(); T next(); }
5703a0d4d00db8234ab2fe16cf049881c3732ad6
06e0c512eab01403ccb081412573e1917832acf6
/src/test/HMap.java
2a46799b264e068f331000d59cbb9c542776ac88
[]
no_license
raphaelamorim/Implementation-of-Advanced-Data-Structures-and-Algorithms
b8e4c4156000360d25ca6e41b3ffc64d3ead09d7
76a37f5db26615b9ba1ec21673a075708ea45ddf
refs/heads/master
2020-12-03T04:05:38.461461
2014-12-18T22:02:56
2014-12-18T22:02:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,960
java
package test; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.TreeMap; public class HMap { TreeMap<Long,ArrayList<HMValue>> HM=new TreeMap<Long,ArrayList<HMValue>>(); public void insert(Dictionary d) { HMValue val=new HMValue(); val.id=d.ID; val.price=d.price; ArrayList<Long> list=d.name; for(long i :list) { if(HM.containsKey(i)) { ArrayList<HMValue> hlist=HM.get(i); if(!hlist.contains(val)) { hlist.add(val); HM.put(i,hlist); } } else { ArrayList<HMValue> hlist=new ArrayList<HMValue>(); hlist.add(val); HM.put(i,hlist); } } } public int modify(Dictionary olddata,float newprice) { //flag to check whether the delet function is done int flag=0; //Iterator for the old name Iterator<Long> it=olddata.name.iterator(); //to save the list of each name key in the hash map while(it.hasNext()) { long n=it.next(); ArrayList<HMValue> vlist=HM.get(n); for(HMValue h:vlist) { if(h.id==olddata.ID) { h.price=newprice; //vlist.add(h); break; } } HM.put(n, vlist); } if(flag==1) { return 1; }return 0; } public long delete(long key, TMValue data) { Iterator<Long> it=data.name.iterator(); long sum=0; // System.out.println("Old id and price"+val.id+" "+val.price); //to save the list of each name key in the hash map while(it.hasNext()) { int index=0,flag=0; ArrayList<HMValue> vlist=new ArrayList<HMValue>(); long n=it.next(); //System.out.println("key is "+n); sum=sum+n; vlist=HM.get(n); if(vlist!=null) { for(HMValue h:vlist) { //System.out.println("inst :"+h.id+" "+h.price); if(h.id==key) { flag=1; break; } index++; } if(flag==1) vlist.remove(index); if(vlist.size()!=0) { HM.put(n, vlist); } else { HM.remove(n); } } //HM.put(n, vlist); } return sum; } public float FindMinPrice(long n) { float min=Float.MAX_VALUE; if(HM.containsKey(n)) { ArrayList<HMValue> vlist=HM.get(n); HMValue val=new HMValue(); Iterator it=vlist.iterator(); while(it.hasNext()) { val=(HMValue) it.next(); if(min>val.price) min=val.price; } } if(min==Float.MAX_VALUE) return 0; else return min; } public float FindMaxPrice(long n) { float min=0; if(HM.containsKey(n)) { ArrayList<HMValue> vlist=HM.get(n); HMValue val=new HMValue(); Iterator it=vlist.iterator(); while(it.hasNext()) { val=(HMValue) it.next(); if(min<val.price) min=val.price; } } return min; } public int FindPriceRange(long n,float low,float high) { int sum=0; if(HM.containsKey(n)) { ArrayList<HMValue> vlist=HM.get(n); HMValue val=new HMValue(); Iterator it=vlist.iterator(); while(it.hasNext()) { val=(HMValue) it.next(); if((val.price>=low) && (val.price<=high)) sum=sum+1; } } return sum; } public void print() { System.out.println("in side print"); Set str=HM.keySet(); //String[] s=(String[]) str.toArray(); Iterator it=str.iterator(); while(it.hasNext()) { long s=(Long) it.next(); ArrayList l=(ArrayList) HM.get(s); Iterator i=l.iterator(); System.out.print(s); while(i.hasNext()) { HMValue n=(HMValue) i.next(); System.out.print(":"+n.id+" "+n.price); } System.out.println(); } } public void print(ArrayList<HMValue> list) { Iterator it=list.iterator(); while(it.hasNext()) { HMValue val=(HMValue) it.next(); System.out.println(val.id+" "+val.price); } } }
ace94f6ee76cdecbdb47a370d05ee86bee53a8b3
4a7d395e7bfeef6aa775ea82de93212e9997cad5
/biblio-service/src/main/java/de/hrw/swep/biblio/service/Main.java
9821cafc99ca42f4029e1728b613350af90ac7d9
[]
no_license
nussb13/SWEP_Testat
b9cd0a86000d557a768cf7ec30a7a29b11f26e6e
0348e49c30b7defa0637321e579ee85d14736a3a
refs/heads/master
2021-01-10T05:48:57.681055
2016-01-28T22:01:27
2016-01-28T22:01:27
50,524,457
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
// CHECKSTYLE:OFF package de.hrw.swep.biblio.service; import de.hrw.swep.biblio.persistence.DAO; import de.hrw.swep.biblio.service.benutzer.Benutzer; public class Main { /** * @param args */ public static void main(String[] args) { Bibliothek bib = new Bibliothek(); bib.setDb(new DAO()); System.out.println( bib.sucheBenutzerNachId(1)); System.out.println( bib.sucheBenutzerNachId(2)); System.out.println( bib.sucheBenutzerNachId(3)); System.out.println( bib.sucheBenutzerNachId(4)); } }
12301f86784e4fcd86372a87f1258d8b8dfc3a88
1661db79d375951ea2533609a930e5ea4730583b
/bitcamp-java-basic/src/step17/ex2/Appliance.java
1ac23038cd02fd15dc4ac72c58865aeb3f6ded93
[]
no_license
soyoungkim9/bitcamp
7075731bcb90be505eaf4a94d42a73c83ada6eeb
81f2e9afe055aa53462fe4b1d7d3bab538e6326b
refs/heads/master
2021-01-24T10:27:55.741323
2018-08-16T08:19:12
2018-08-16T08:19:12
123,054,180
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package step17.ex2; public class Appliance { public static final int TV = 10; public static final int AAUDIO = 11; public static final int DVD = 12; public static final int VACUUMCLEANER = 13; }
721ed1f34c4495ebc937881d4d51087dd3287c81
1e9f4a14fce00f2298235266887581fc0d5c4e4c
/test-mt/src/main/java/com/xuecheng/mt/dao/AddressListRepository.java
1fba700bd838e1ecd29b44285aabdef43fc6fafb
[]
no_license
sunbenjin/xcEdu
54a15b6d52df20a4e5ae5276f320cf207f34a62e
293d93ae9555c6a0c55acd5cde378515cb08f492
refs/heads/master
2022-11-17T07:39:38.435825
2019-07-09T14:15:02
2019-07-09T14:15:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.xuecheng.mt.dao; import com.xuecheng.mt.domain.AddressList; import com.xuecheng.mt.domain.Person; import com.xuecheng.mt.domain.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface AddressListRepository extends JpaRepository<AddressList,Long> { }
3f59d1155653075d03f01c89812efd4e01ebc0ae
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/AWSLogsAsyncClientBuilder.java
46e27e5d435e7b90b75010ad1c01c575ee863144
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,334
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.logs; import javax.annotation.Generated; import com.amazonaws.ClientConfigurationFactory; import com.amazonaws.annotation.NotThreadSafe; import com.amazonaws.client.builder.AwsAsyncClientBuilder; import com.amazonaws.client.AwsAsyncClientParams; /** * Fluent builder for {@link com.amazonaws.services.logs.AWSLogsAsync}. Use of the builder is preferred over using * constructors of the client class. **/ @NotThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public final class AWSLogsAsyncClientBuilder extends AwsAsyncClientBuilder<AWSLogsAsyncClientBuilder, AWSLogsAsync> { private static final ClientConfigurationFactory CLIENT_CONFIG_FACTORY = new ClientConfigurationFactory();; /** * @return Create new instance of builder with all defaults set. */ public static AWSLogsAsyncClientBuilder standard() { return new AWSLogsAsyncClientBuilder(); } /** * @return Default async client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and * {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain */ public static AWSLogsAsync defaultClient() { return standard().build(); } private AWSLogsAsyncClientBuilder() { super(CLIENT_CONFIG_FACTORY); } /** * Construct an asynchronous implementation of AWSLogsAsync using the current builder configuration. * * @param params * Current builder configuration represented as a parameter object. * @return Fully configured implementation of AWSLogsAsync. */ @Override protected AWSLogsAsync build(AwsAsyncClientParams params) { return new AWSLogsAsyncClient(params); } }
[ "" ]
806aa85616b4477bbc72aba0e0fe0bc988206290
53ecd7ac0d6202dd3097aa93b5545d1b98e0633f
/src/main/java/com/fangxin/siwei/fangzhi/vo/result/SwDeliverBaseResutVo.java
8a0431573ebe6a143a532e99c9fd3ad25821d070
[]
no_license
dongjunwen/siweierp
744fc9c42a5689705a792296307c31a88a99c762
baaf7624ea9d17896b746fcfeb725a5f5f233b7c
refs/heads/master
2021-06-04T09:18:43.593034
2018-01-12T08:45:12
2018-01-12T08:45:12
107,348,353
3
0
null
null
null
null
UTF-8
Java
false
false
5,067
java
package com.fangxin.siwei.fangzhi.vo.result; import java.util.Date; /** * @Date:2017/10/26 0026 14:22 * @Author lu.dong * @Description: **/ public class SwDeliverBaseResutVo { private Integer id; private String deliverNo; private String deliverDate; private String deliverWay; private String deliverWayName; private String sendName; private String ifGurant; private String deliverStatus; private String deliverStatusName; private String memo; private String custCompNo; private String custCompName; private String custContactName; private String custMobile; private String custPhone; private String custTax; private String custAddr; private String createNo; private String createName; private String createTime; private String modiNo; private String modiName; private String modiTime; //审核理由 private String auditDesc; //审核人 private String auditName; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getDeliverNo() { return deliverNo; } public void setDeliverNo(String deliverNo) { this.deliverNo = deliverNo; } public String getDeliverDate() { return deliverDate; } public void setDeliverDate(String deliverDate) { this.deliverDate = deliverDate; } public String getDeliverWay() { return deliverWay; } public void setDeliverWay(String deliverWay) { this.deliverWay = deliverWay; } public String getDeliverWayName() { return deliverWayName; } public void setDeliverWayName(String deliverWayName) { this.deliverWayName = deliverWayName; } public String getSendName() { return sendName; } public void setSendName(String sendName) { this.sendName = sendName; } public String getIfGurant() { return ifGurant; } public void setIfGurant(String ifGurant) { this.ifGurant = ifGurant; } public String getDeliverStatus() { return deliverStatus; } public void setDeliverStatus(String deliverStatus) { this.deliverStatus = deliverStatus; } public String getDeliverStatusName() { return deliverStatusName; } public void setDeliverStatusName(String deliverStatusName) { this.deliverStatusName = deliverStatusName; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public String getCustCompNo() { return custCompNo; } public void setCustCompNo(String custCompNo) { this.custCompNo = custCompNo; } public String getCustCompName() { return custCompName; } public void setCustCompName(String custCompName) { this.custCompName = custCompName; } public String getCustContactName() { return custContactName; } public void setCustContactName(String custContactName) { this.custContactName = custContactName; } public String getCustMobile() { return custMobile; } public void setCustMobile(String custMobile) { this.custMobile = custMobile; } public String getCustPhone() { return custPhone; } public void setCustPhone(String custPhone) { this.custPhone = custPhone; } public String getCustTax() { return custTax; } public void setCustTax(String custTax) { this.custTax = custTax; } public String getCustAddr() { return custAddr; } public void setCustAddr(String custAddr) { this.custAddr = custAddr; } public String getCreateNo() { return createNo; } public void setCreateNo(String createNo) { this.createNo = createNo; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getModiNo() { return modiNo; } public void setModiNo(String modiNo) { this.modiNo = modiNo; } public String getModiTime() { return modiTime; } public void setModiTime(String modiTime) { this.modiTime = modiTime; } public String getCreateName() { return createName; } public void setCreateName(String createName) { this.createName = createName; } public String getModiName() { return modiName; } public void setModiName(String modiName) { this.modiName = modiName; } public String getAuditDesc() { return auditDesc; } public void setAuditDesc(String auditDesc) { this.auditDesc = auditDesc; } public String getAuditName() { return auditName; } public void setAuditName(String auditName) { this.auditName = auditName; } }
[ "WeiMob@201708" ]
WeiMob@201708
fa38a86c3827919d57aa091ed6e4ea2cecc839c0
b1bea28904a4fdf754d29a19ee2290c62c9d5786
/fu_ui/src/main/java/com/faceunity/ui/seekbar/internal/drawable/StateDrawable.java
a864d5c8e7a1b6bf1ee0796f49d5660524e62d14
[]
no_license
davidliwork/FULiveDemoDroid
2a280cfc087f51f7b988fbc94b2f527d6ebd0ef9
a867a2558e6ee576f9c93bfc91ff6f77c53f1e4a
refs/heads/master
2023-08-17T05:57:43.818551
2023-07-10T09:47:43
2023-07-10T09:47:43
279,554,797
0
0
null
2020-07-14T10:31:03
2020-07-14T10:31:02
null
UTF-8
Java
false
false
2,776
java
package com.faceunity.ui.seekbar.internal.drawable; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import androidx.annotation.NonNull; /** * A drawable that changes it's Paint color depending on the Drawable State * <p> * Subclasses should implement {@link #doDraw(Canvas, Paint)} * </p> * * @hide */ public abstract class StateDrawable extends Drawable { private ColorStateList mTintStateList; private final Paint mPaint; private int mCurrentColor; private int mAlpha = 255; public StateDrawable(@NonNull ColorStateList tintStateList) { super(); setColorStateList(tintStateList); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); } @Override public boolean isStateful() { return (mTintStateList.isStateful()) || super.isStateful(); } @Override public boolean setState(int[] stateSet) { boolean handled = super.setState(stateSet); handled = updateTint(stateSet) || handled; return handled; } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } private boolean updateTint(int[] state) { final int color = mTintStateList.getColorForState(state, mCurrentColor); if (color != mCurrentColor) { mCurrentColor = color; //We've changed states invalidateSelf(); return true; } return false; } @Override public void draw(Canvas canvas) { mPaint.setColor(mCurrentColor); int alpha = modulateAlpha(Color.alpha(mCurrentColor)); mPaint.setAlpha(alpha); doDraw(canvas, mPaint); } public void setColorStateList(@NonNull ColorStateList tintStateList) { mTintStateList = tintStateList; mCurrentColor = tintStateList.getDefaultColor(); } /** * Subclasses should implement this method to do the actual drawing * * @param canvas The current {@link Canvas} to draw into * @param paint The {@link Paint} preconfigurred with the current * {@link ColorStateList} color */ abstract void doDraw(Canvas canvas, Paint paint); @Override public void setAlpha(int alpha) { mAlpha = alpha; invalidateSelf(); } int modulateAlpha(int alpha) { int scale = mAlpha + (mAlpha >> 7); return alpha * scale >> 8; } @Override public int getAlpha() { return mAlpha; } @Override public void setColorFilter(ColorFilter cf) { mPaint.setColorFilter(cf); } }
0970d8eafa965c7d91773e5a66c31671a5595703
b428fdbff4ac155a5baa432caa6aaf1445979ab8
/src/main/java/cdi/sample/dependencyinjection/MyApp.java
b3cfe97428388881a97e983284859bcbf94c32e4
[ "Apache-2.0" ]
permissive
t2y/cdi-sample
621bbf1968996c6f18251bc09e92a5bde1085a15
12b21e001a6310137d003dc15cb57e7393e154c2
refs/heads/master
2020-12-11T09:37:27.463253
2020-01-15T23:21:18
2020-01-15T23:21:18
233,810,528
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package cdi.sample.dependencyinjection; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import lombok.Getter; @Getter @ApplicationScoped public class MyApp { @Inject @MyClientWithArgs private MyClient myClient1; @Inject @MyClientWithContainer private MyClient myClient2; }
035026983c3232b4d2f905c802eef0ec2275b6a0
152c9ef18a7093c24973a69bdfa1f89117854b1f
/src/main/java/ruc/summer/storage/dao/KeepPointDao.java
a11bea91d97f0b3a57b5b172a0d1860ede8862d7
[]
no_license
IreneSunny/summer
4ad0aabb46eaf0431c186f12c971946bac2154b0
3e9759bf0e46d09fb5955ce6af3e7e624da986e8
refs/heads/master
2020-06-13T10:11:29.880009
2014-05-07T03:41:19
2014-05-07T03:41:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,163
java
package ruc.summer.storage.dao; import ruc.summer.storage.dao.core.BaseDao; import ruc.summer.storage.dao.core.DaoException; import ruc.summer.storage.model.KeepPoint; import java.util.Date; import java.util.List; /** * User: xiatian * Date: 2/23/13 4:33 PM */ public interface KeepPointDao extends BaseDao<KeepPoint> { /** * URL对应的签名是否存在 * @param url * @param signature * @return */ boolean existsByUrlSignature(String url, String signature) throws DaoException; boolean existsByMd5Signature(String urlMd5, String signature) throws DaoException; /** * url对应的时间点有无留痕记录 * @param url * @param keepTime * @return * @throws DaoException */ boolean existsByUrlKeepTime(String url, Date keepTime) throws DaoException; boolean existsByMd5KeepTime(String urlMd5, Date keepTime) throws DaoException; KeepPoint getByUrlKeepTime(String url, Date keepTime) throws DaoException; KeepPoint getByMd5KeepTime(String urlMd5, Date keepTime) throws DaoException; /** * 如果当前时间点没有,则向后继续寻找最近的一个记录 * @param urlMd5 * @param keepTime * @param nearby * @return * @throws DaoException */ KeepPoint getByMd5KeepTime(String urlMd5, Date keepTime, boolean nearby) throws DaoException; /** * 在某一天是否有过留痕记录,日期为yyyyMMdd的字符串,例如20130226 * @param url * @param yyyyMMdd * @return * @throws DaoException */ boolean existsOneByUrl(String url, String yyyyMMdd) throws DaoException; /** * 获取起止时间之内的所有留痕点 * @param url * @param startDate * @param endDate * @return * @throws DaoException */ List<KeepPoint> getListByUrl(String url, Date startDate, Date endDate) throws DaoException; /** * 获取某一天的所有留痕记录 * @param url * @param yyyyMMdd * @return * @throws DaoException */ List<KeepPoint> getListByUrl(String url, String yyyyMMdd) throws DaoException; }
6c9fdce0c38898efc9e4ebf0a750b009eb7788d3
4029335eaaabbd8701ea4555680058d52518a326
/DownloadHDFSFile.java
f21b12e7dc7babc09800ca8faa6c97757bc901eb
[]
no_license
Askiki/HadoopExp
25640caf849b55e1c3ca3caa0a8520128bf841d1
ba973275b049ee39ae1a103e613bcad9e881cbdd
refs/heads/master
2020-08-23T07:58:22.349648
2019-11-07T12:29:20
2019-11-07T12:29:20
216,575,447
1
0
null
2019-11-07T12:28:20
2019-10-21T13:29:36
Java
UTF-8
Java
false
false
712
java
package hadoop.ch03.ly17034460229; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import java.net.URI; public class DownloadHDFSFile { public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); URI uri = new URI("hdfs://192.168.30.131:8020"); FileSystem fs = FileSystem.get(uri, conf, "hadoop"); Path src = new Path("/17034460229/test5.txt"); Path dest = new Path("D://17034460229/test5.txt"); fs.copyToLocalFile(false,src,dest,true); fs.close(); System.out.println("Download sucessfully!"); } }
216e713b04c736b621fd526c8cd64adbdf041c43
8c6a4c33e06f9928a72a0415b1a77f99c63cf5b0
/smart-wechat/src/main/java/com/tinymood/wechat/util/TranslateResult.java
53e4564f28875335ff43975376caa7367c89f83b
[]
no_license
TonyJava/LightweightApp
f553c9372c98a1dbb53641ef208622f1e1537fb5
dab3c20bdfc84e48b8cf2b7f478745e9395372fa
refs/heads/master
2021-06-16T17:29:41.962262
2017-05-01T06:13:57
2017-05-01T06:13:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
package com.tinymood.wechat.util; import java.util.List; /** * 调用百度翻译api查询结果 * * @author nothankyou * @date 2017-02-03 22:03:34 */ public class TranslateResult { // 实际采用的源语言 private String from; // 实际采用的目标语言 private String to; // 结果体 private List<ResultPair> trans_result; public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } public List<ResultPair> getTrans_result() { return trans_result; } public void setTrans_result(List<ResultPair> trans_result) { this.trans_result = trans_result; } }
fbf0649ece64f4355ea66432991f7e22032a532a
1b3c4b6cf3ecf89b034fffd9009cdea8ed69d010
/src/main/java/cn/material/base/sale/vo/SaleVo.java
0e6d17ae231f999de616b031ccf7473c21986e73
[]
no_license
taengguu/Test
0e00750c985cab92dfebdec6b593a58cb907d33a
815c54dac003a51699e1e3f579bb69551f3a82b9
refs/heads/master
2021-08-12T02:53:19.642236
2017-11-14T10:26:01
2017-11-14T10:26:01
110,636,265
0
0
null
null
null
null
UTF-8
Java
false
false
2,571
java
package cn.material.base.sale.vo; import java.util.Date; public class SaleVo { private String id; private String serialNo; private String materialId; private String materialName; private String memberId; private String memberName; private int amount; private float totalPrice; private String minTotalPrice; private String maxTotalPrice; private Date orderTime; private String saleStatus; private String payType; private Date payTime; private String remark; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSerialNo() { return serialNo; } public void setSerialNo(String serialNo) { this.serialNo = serialNo; } public String getMaterialId() { return materialId; } public void setMaterialId(String materialId) { this.materialId = materialId; } public String getMaterialName() { return materialName; } public void setMaterialName(String materialName) { this.materialName = materialName; } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } public String getMemberName() { return memberName; } public void setMemberName(String memberName) { this.memberName = memberName; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } public Date getOrderTime() { return orderTime; } public void setOrderTime(Date orderTime) { this.orderTime = orderTime; } public String getPayType() { return payType; } public void setPayType(String payType) { this.payType = payType; } public Date getPayTime() { return payTime; } public void setPayTime(Date payTime) { this.payTime = payTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public float getTotalPrice() { return totalPrice; } public void setTotalPrice(float totalPrice) { this.totalPrice = totalPrice; } public String getSaleStatus() { return saleStatus; } public void setSaleStatus(String saleStatus) { this.saleStatus = saleStatus; } public String getMinTotalPrice() { return minTotalPrice; } public void setMinTotalPrice(String minTotalPrice) { this.minTotalPrice = minTotalPrice; } public String getMaxTotalPrice() { return maxTotalPrice; } public void setMaxTotalPrice(String maxTotalPrice) { this.maxTotalPrice = maxTotalPrice; } }
ad79e9cbd97e66ee98d56e65321c53ff600be9d7
05f87ab95a631c5ee19ac810032fd8f4d71882e3
/src/main/java/com/wangshuo/spring/chapter3/bean/ResourceBean.java
10d8557ad31d00b690334faadf09c37371e53354
[]
no_license
gf10214/spring3
d8f7008035b2bb6ad3186c31fbde2fa34eb26b91
eb55743efacd974fbf38053b5432f1b8f77c269f
refs/heads/master
2021-01-21T15:37:19.312352
2018-06-05T13:00:06
2018-06-05T13:00:06
95,395,731
0
0
null
null
null
null
UTF-8
Java
false
false
1,163
java
package com.wangshuo.spring.chapter3.bean; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class ResourceBean { private FileOutputStream fos; private File file; //初始化方法 public void init() { System.out.println("ResourceBean:========初始化"); //加载资源,在此只是演示 System.out.println("ResourceBean:========加载资源,执行一些预操作"); try { this.fos = new FileOutputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); } } //销毁资源方法 public void destroy() { System.out.println("ResourceBean:========销毁"); //释放资源 System.out.println("ResourceBean:========释放资源,执行一些清理操作"); try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } public FileOutputStream getFos() { return fos; } public void setFile(File file) { this.file = file; } }
39d74e466fbc639fc9b20061322afecd9d3803ae
215b2ef1be3f60c39cf60a3c384312ecf9d83158
/src/com/goodeggapps/rhythmbattle/game/enemies/EnemyBullet.java
e0fdc100905540a9ae9d3b069a2f8bd8d2fbe3f9
[]
no_license
wshelor/rhythm-battle
f5375775babc2e85e4adbde6fa5b894589e4249c
5fa3539ec622f2430c50eade64c8c2025c7206a1
refs/heads/master
2016-09-03T06:37:38.686875
2014-01-27T03:33:07
2014-01-27T03:33:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package com.goodeggapps.rhythmbattle.game.enemies; import org.anddev.andengine.engine.Engine; import org.anddev.andengine.entity.sprite.Sprite; import org.anddev.andengine.opengl.texture.region.TextureRegion; import com.goodeggapps.rhythmbattle.game.GameActivity; public class EnemyBullet extends Sprite { private final Engine mEngine; public EnemyBullet(float pX, float pY, TextureRegion pTiledTextureRegion, Engine engine) { super(pX, pY, pTiledTextureRegion); mEngine = engine; this.setVelocity(0, 300); GameActivity.enemyBullets.add(this); } public static EnemyBullet reuse(float posx, float posy) { final EnemyBullet bullet = GameActivity.enemyBulletsToReuse.get(0); GameActivity.enemyBullets.add(bullet); GameActivity.enemyBulletsToReuse.remove(bullet); bullet.setPosition(posx, posy); return bullet; } public void addToScene() { mEngine.getScene().getBottomLayer().addEntity(this); } public void removeFromScene() { mEngine.getScene().getBottomLayer().removeEntity(this); GameActivity.enemyBulletsToReuse.add(0, this); GameActivity.enemyBullets.remove(this); } @Override protected void onManagedUpdate(final float pSecondsElapsed) { final EnemyBullet bullet = this; if (this.getY() > GameActivity.CAMERA_HEIGHT) { mEngine.runOnUpdateThread(new Runnable() { public void run() { bullet.removeFromScene(); } }); } super.onManagedUpdate(pSecondsElapsed); } }
f91777fa57edd0eb0fa1ba3dc90c6174f2ffa935
6b67adafefba3e36964d7e1ed2f26211f4b1fb8a
/PassengerBuddy/app/src/main/java/com/example/passengerbuddy/MessageDisplayAdapter.java
e48266fd78d514e9672e15070daf5c6dd9a22e2b
[]
no_license
shouvik0013/Passenger-Buddy
0ff29e433af32a8ce2c4c7418e7caba1a67e68a2
aa64f87b8fd9f5e9e29fd9c36e6d860bfe5edf7b
refs/heads/main
2023-09-04T04:49:06.574504
2021-10-26T14:24:34
2021-10-26T14:24:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,072
java
package com.example.passengerbuddy; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.ArrayList; public class MessageDisplayAdapter extends ArrayAdapter<MessageDetails> { Context context; ArrayList<MessageDetails> messageList; public MessageDisplayAdapter(Context context, ArrayList<MessageDetails> messageList){ super(context,0,messageList); this.context = context; this.messageList = messageList; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { MessageDetails messageDetails = getItem(position); if(convertView == null){ convertView = LayoutInflater.from(context).inflate(R.layout.message_info_layout, parent, false); } TextView userName = (TextView) convertView.findViewById(R.id.text_message_name); TextView messageHead = (TextView) convertView.findViewById(R.id.textView2); TextView dateTime = (TextView) convertView.findViewById(R.id.text_message_time); TextView messageDescription = (TextView) convertView.findViewById(R.id.text_message_body); userName.setText(messageDetails.getUserName()); messageHead.setText(messageDetails.getMessageHead()); dateTime.setText(messageDetails.getDateTime()); messageDescription.setText(messageDetails.getMessageDescription()); /*userName.setTextColor(context.getResources().getColor(R.color.white)); messageHead.setTextColor(context.getResources().getColor(R.color.white)); dateTime.setTextColor(context.getResources().getColor(R.color.white)); messageDescription.setTextColor(context.getResources().getColor(R.color.colorPrimaryDark));*/ return convertView; } }
97905a6314ca693b081b73f5baa944417c2e85eb
cf11beaa860b6976e76995be54586a5720f26735
/src/main/java/com/whut/dao/UserDao.java
01b89d4b2d35d87908495f3c6b2643396dc1727c
[]
no_license
1206GoGoGo/LEMS
785f95578396f3c32fbcaac1fccb9b5e4bdb5523
4db7ca689a1ea3ecdd48a226667fe810a05d9382
refs/heads/master
2020-04-13T07:50:48.443014
2018-12-26T13:37:04
2018-12-26T13:37:04
163,063,977
1
0
null
null
null
null
UTF-8
Java
false
false
218
java
package com.whut.dao; import java.util.List; import com.whut.pojo.User; public interface UserDao { public User findByUsername(String username); public List<User> findAll(); public void add(User user); }
f62fca9b067051c372c2732e4831355acd3d0715
b24e4ac3f3476b97751a384c4eee76eb9a680682
/src/main/java/com/excelra/mvc/service/tabularview/ProteinClassificationTabService.java
37e9b3e77a2189b011cac77ed7fb050da9026319
[]
no_license
KiranKumarGoud/test
e9ea441b33462f42be1b19ba5966bfcb066d5fa7
2d769ceb25c29035e2b4b62ed52483975ff0f4e5
refs/heads/master
2023-04-27T11:10:52.025385
2019-11-22T08:07:26
2019-11-22T08:07:26
223,336,149
0
0
null
2022-06-29T17:47:42
2019-11-22T06:12:45
HTML
UTF-8
Java
false
false
2,106
java
package com.excelra.mvc.service.tabularview; import com.excelra.mvc.model.tabularview.*; import com.excelra.mvc.model.userjdbc.UserJdbc; import com.excelra.mvc.repository.tabularview.ProteinClassificationTabDAO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * Protein Classification tabularview service methods implementation. * * @author Venkat Salagrama */ @Service public class ProteinClassificationTabService implements IProteinClassificationTab { @Autowired private ProteinClassificationTabDAO proteinClassificationTabDAO; /** * * @param tabularviewFilterRequest * @param userJdbc * @param currentSessionUserToken * @return */ @Override public List<ProteinClassificationTabDTO> findProteinClassificationTabFilterFieldByStdnameIds(TabularviewFilterRequest tabularviewFilterRequest, UserJdbc userJdbc, String currentSessionUserToken) { return proteinClassificationTabDAO.findProteinClassificationTabFilterFieldByStdnameIds(tabularviewFilterRequest, userJdbc, currentSessionUserToken); } /** * * @param tabularviewRequest * @param userJdbc * @param currentSessionUserToken * @return */ @Override public ProteinClassificationTabPageData findProteinClassificationTabData(TabularviewRequest tabularviewRequest, UserJdbc userJdbc, String currentSessionUserToken) { return proteinClassificationTabDAO.findProteinClassificationTabData(tabularviewRequest, userJdbc, currentSessionUserToken); } /** * * @param tabularviewExportRequest * @param userJdbc * @param currentSessionUserToken * @return */ @Override public List<ProteinClassificationTabDTO> findProteinClassificationTabDataForExport(TabularviewExportRequest tabularviewExportRequest, UserJdbc userJdbc, String currentSessionUserToken) { return proteinClassificationTabDAO.findProteinClassificationTabDataForExport(tabularviewExportRequest, userJdbc, currentSessionUserToken); } }
1a5765844fceb0ea49f5980d24e5441e8e7c63ab
501989f313f923b069c9c1b06a507463ab946e2b
/src/com/jspgou/cms/dao/impl/GiftDaoImpl.java
dec2d9db2b9ebaead0a2e26405399a82ddbf26cb
[]
no_license
xrogzu/shop
fded93f9dbc801ff983362fc10d33ad7a8c07fad
17568c709f64323e2b0dce06f4bc3d600a8157f8
refs/heads/master
2021-04-12T08:48:48.082699
2017-07-24T06:11:52
2017-07-24T06:16:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,055
java
package com.jspgou.cms.dao.impl; import org.springframework.stereotype.Repository; import com.jspgou.common.hibernate3.Finder; import com.jspgou.common.hibernate3.HibernateBaseDao; import com.jspgou.common.page.Pagination; import com.jspgou.cms.dao.GiftDao; import com.jspgou.cms.entity.Gift; /** * This class should preserve. * @preserve */ @Repository public class GiftDaoImpl extends HibernateBaseDao<Gift, Long> implements GiftDao { @Override public Pagination getPageGift( int pageNo, int pageSize) { Finder f = Finder.create("from Gift bean"); f.append(" order by bean.id desc"); return find(f, pageNo, pageSize); } @Override public Gift findById(Long id) { Gift entity = get(id); return entity; } @Override public Gift save(Gift bean) { getSession().save(bean); return bean; } @Override public Gift deleteById(Long id) { Gift entity = super.get(id); if (entity != null) { getSession().delete(entity); } return entity; } @Override protected Class<Gift> getEntityClass() { return Gift.class; } }
1ef4d9c3c02029f2bfd2845ae4bf92f2c46d5ff8
853b0794dd9a1d3879636fbfdb9e8a5084348a12
/src/runlauncher/EditGeometryTablePanel.java
897f46b5f89819dc24a676e8fb8fdbe6841441a9
[]
no_license
jmasison/SpringSaLaD
c18bad3881bc90bc322f79577e46b0b7f83e176e
9551e2885b005d6086be0acbc994b28dc97765db
refs/heads/master
2021-05-15T22:38:32.170636
2017-11-17T20:03:11
2017-11-17T20:03:11
106,734,703
2
3
null
null
null
null
UTF-8
Java
false
false
1,177
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 runlauncher; import helpersetup.Constraints; import helpersetup.Fonts; import java.awt.BorderLayout; import javax.swing.*; import langevinsetup.Global; import langevinsetup.ValueCellEditor; import langevinsetup.ValueTextField; public class EditGeometryTablePanel extends JPanel { public EditGeometryTablePanel(Global g, Simulation simulation){ this.setLayout(new BorderLayout()); JTable table = new JTable(new EditGeometryTableModel(g, simulation)); table.setFillsViewportHeight(true); table.setDefaultEditor(Double.class, new ValueCellEditor(ValueTextField.DOUBLE, Constraints.POSITIVE, true)); JScrollPane scrollPane = new JScrollPane(table); JLabel label = new JLabel("System Geometry", JLabel.CENTER); label.setFont(Fonts.TITLEFONT); this.add(label, "North"); this.add(scrollPane, "Center"); } }
52896c726c353e9104963534147dbf9972ea7cce
80913050cc14a814b02a461874001b60e469c38c
/datastructure/TreeMapDemo.java
5dd21fae8ab826a857c19a8b8695d5836bea6522
[]
no_license
Irena-J/Daily-practice-and-reflection
8d0a3f53d293562a786ffc075124c70f53809315
79d66901b10c746dd4ce14260751aebea6760dd7
refs/heads/master
2022-12-11T22:48:14.710789
2020-09-06T14:47:32
2020-09-06T14:47:32
206,910,205
0
0
null
null
null
null
UTF-8
Java
false
false
1,950
java
//统计字符串中每个字符出现得次数 eg:"aababcabcdabcde"获取每个字符串中每一个字母出现得次数要求结果: "a(5)b(4)c(3)d(2)e(1)" 思路: A:定义一个字符串 B:定义一个Map集合 C:把字符串转换为字符数组 D: 遍历字符数组,得到每一个字符 E: 拿这个字符到Map集合中去找,看返回值 是null:就把这个字符作为键,1就为值存储 不是null:就把值++,然后重新存储该键和值 F:定义一个字符串缓冲区 G:遍历TreeMap集合,获取每一个键值对元素拼接 H: 把字符串缓冲区转换为字符串输出 public class TreeMapDemo { public static void main(String[] args){ //定义一个字符串 Scanner sc = new Scanner(System.in); System.out.println("请输入一个字符串:"); String line = sc.nextLine(); //定义一个TreeMap集合 TreeMap<Character,Integer> tm = new TreeMap<Character,Integer>(); //把字符串转换为字符数据 char[] chs = line.toCharArray(); //遍历字符数组,得到每一个字符 for(char ch : chs) { //拿刚才得到得字符作为集合中去找值,看返回值 Integer i = tm.get(ch); //是null,说明该键不存在,就把这字符作为键,1作为值存储 if(i == null) { tm.put(ch,1); } else { //不是null,说明该键存在,就把值加1,然后重新存储该键和值 i++; //自动拆箱,加加后再自动装箱 tm.put(ch,i); } } 定义字符串缓冲区 StringBuilder sb = new StringBuilder(); //遍历集合,得到键和值,进行按照要求拼接 Set<Character> set = tm.keySet(); for(Character key : set) { Integer value = tm.get(key); sb.append(key).append("(").append(value).append(")"); } //把字符串缓冲区转换为字符串输出 String result = sb.toString(); System.out.println("result:"+result); } }
f73c72cee106756d57596e730281756622414cb6
e4c3f19f82bbf42efddb7bea3c1f337faeb9e2e5
/src/com/rustyrazorblade/graph/Element.java
f3757168fbb57341c2ec9642d7b45c9408cc37e3
[ "BSD-2-Clause" ]
permissive
rustyrazorblade/javagraph
71a96f33bbb1611fbfabe86cf76ada61d19e8dcb
7ef62ae13ce5863f2c05d93f2f22daf6d4e3ecfe
refs/heads/master
2021-01-01T18:28:34.431913
2014-06-08T22:42:04
2014-06-08T22:42:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
185
java
package com.rustyrazorblade.graph; /** * Created by jhaddad on 6/7/14. */ public class Element { public TraversalState query() { return new TraversalState(this); } }