blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
7eb0a7d70f7c7eb5bc3d9939755e75f696828485
716e011ebc5751b87ba309c2eb30d70fd059125f
/app/src/main/java/com/example/djamel/salate/login.java
b7893e40b1d8aa8566c819f063ca75baaa727039
[]
no_license
djamelzerrouki/Hay-Ala-Al-SALAT-App-Android-and-server-node-js
28cba4434581e3e63e49a64d5dbffb8e3e005587
c85f7019834daacdb1c0df2cf98318ba020c5064
refs/heads/master
2021-07-23T08:22:59.486401
2020-05-05T05:18:37
2020-05-05T05:18:37
160,763,731
3
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.example.djamel.salate; /** * Created by djamel on 26/12/2017. */ public class login { public static String id; public static String username; public static String pasword; public login(String id, String username, String pasword ) { this.id=id; this.username=username; this.pasword=pasword; } }
[ "djameljimmizerrouki@gmail.com" ]
djameljimmizerrouki@gmail.com
430c05afdef3e76df542403707e0a2b9d9130124
c3f696f5eb33ccd9645e0634be654a0c2a537607
/app/src/main/java/com/example/beatmaster/PlayerActivity.java
4a961eb3ebc566874bb11870b607485a27c88665
[]
no_license
AdityaKanikdaley/Beat_Master
6c7961f9b950487c590924326ab932147e7d767e
9da5e2dc06e0b4c24c844bfc9dc9d93911c2f7f1
refs/heads/master
2023-01-08T07:37:51.872489
2020-11-11T17:05:18
2020-11-11T17:05:18
292,601,306
0
0
null
null
null
null
UTF-8
Java
false
false
12,340
java
package com.example.beatmaster; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.media.MediaMetadataRetriever; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.ImageView; import android.widget.SeekBar; import android.widget.TextView; import com.bumptech.glide.Glide; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.ArrayList; import static com.example.beatmaster.MainActivity.musicFiles; public class PlayerActivity extends AppCompatActivity { TextView song_name, artist_name, duration_played, duration_total; ImageView cover_art, nextBtn, prevBtn, backBtn, shuffleBtn, repeatBtn; FloatingActionButton playPauseBtn; SeekBar seekBar; int position = -1; static ArrayList<MusicFiles> listSongs = new ArrayList<>(); static Uri uri; static MediaPlayer mediaPlayer; private Handler handler = new Handler(); private Thread playThread, prevThread, nextThread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); initViews(); getIntentMethod(); song_name.setText(listSongs.get(position).getTitle()); artist_name.setText(listSongs.get(position).getArtist()); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if(mediaPlayer != null && fromUser) { mediaPlayer.seekTo(progress * 1000); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); PlayerActivity.this.runOnUiThread(new Runnable() { @Override public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); duration_played.setText(formattedTime(mCurrentPosition)); } handler.postDelayed(this, 1000); } }); } @Override protected void onPostResume() { playThreadBtn(); nextThreadBtn(); prevThreadBtn(); super.onPostResume(); } private void prevThreadBtn() { prevThread = new Thread() { @Override public void run() { super.run(); prevBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { prevBtnClicked(); } }); } }; prevThread.start(); } private void prevBtnClicked() { if(mediaPlayer.isPlaying()) { mediaPlayer.start(); mediaPlayer.release(); position = ((position - 1) < 0 ? (listSongs.size() - 1) : (position - 1)); uri = Uri.parse(listSongs.get(position).getPath()); mediaPlayer = MediaPlayer.create(getApplicationContext(),uri); metaData(uri); song_name.setText(listSongs.get(position).getTitle()); artist_name.setText(listSongs.get(position).getArtist()); seekBar.setMax(mediaPlayer.getDuration() / 1000); PlayerActivity.this.runOnUiThread(new Runnable() { public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); } handler.postDelayed(this, 1000); } }); playPauseBtn.setImageResource(R.drawable.ic_pause); mediaPlayer.start(); } else { mediaPlayer.start(); mediaPlayer.release(); position = ((position - 1) < 0 ? (listSongs.size() - 1) : (position - 1)); uri = Uri.parse(listSongs.get(position).getPath()); mediaPlayer = MediaPlayer.create(getApplicationContext(),uri); metaData(uri); song_name.setText(listSongs.get(position).getTitle()); artist_name.setText(listSongs.get(position).getArtist()); seekBar.setMax(mediaPlayer.getDuration() / 1000); PlayerActivity.this.runOnUiThread(new Runnable() { public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); } handler.postDelayed(this, 1000); } }); playPauseBtn.setImageResource(R.drawable.ic_play); } } private void nextThreadBtn() { nextThread = new Thread() { @Override public void run() { super.run(); nextBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { nextBtnClicked(); } }); } }; nextThread.start(); } private void nextBtnClicked() { if(mediaPlayer.isPlaying()) { mediaPlayer.start(); mediaPlayer.release(); position = ((position + 1) % listSongs.size()); uri = Uri.parse(listSongs.get(position).getPath()); mediaPlayer = MediaPlayer.create(getApplicationContext(),uri); metaData(uri); song_name.setText(listSongs.get(position).getTitle()); artist_name.setText(listSongs.get(position).getArtist()); seekBar.setMax(mediaPlayer.getDuration() / 1000); PlayerActivity.this.runOnUiThread(new Runnable() { public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); } handler.postDelayed(this, 1000); } }); playPauseBtn.setImageResource(R.drawable.ic_pause); mediaPlayer.start(); } else { mediaPlayer.start(); mediaPlayer.release(); position = ((position + 1) % listSongs.size()); uri = Uri.parse(listSongs.get(position).getPath()); mediaPlayer = MediaPlayer.create(getApplicationContext(),uri); metaData(uri); song_name.setText(listSongs.get(position).getTitle()); artist_name.setText(listSongs.get(position).getArtist()); seekBar.setMax(mediaPlayer.getDuration() / 1000); PlayerActivity.this.runOnUiThread(new Runnable() { public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); } handler.postDelayed(this, 1000); } }); playPauseBtn.setImageResource(R.drawable.ic_play); } } private void playThreadBtn() { playThread = new Thread() { @Override public void run() { super.run(); playPauseBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playPauseBtnClicked(); } }); } }; playThread.start(); } private void playPauseBtnClicked() { if(mediaPlayer.isPlaying()) { playPauseBtn.setImageResource(R.drawable.ic_play); mediaPlayer.pause(); seekBar.setMax(mediaPlayer.getDuration() / 1000); PlayerActivity.this.runOnUiThread(new Runnable() { public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); } handler.postDelayed(this, 1000); } }); } else { playPauseBtn.setImageResource(R.drawable.ic_pause); mediaPlayer.start(); seekBar.setMax(mediaPlayer.getDuration() / 1000); PlayerActivity.this.runOnUiThread(new Runnable() { @Override public void run() { if(mediaPlayer != null) { int mCurrentPosition = mediaPlayer.getCurrentPosition() / 1000; seekBar.setProgress(mCurrentPosition); } handler.postDelayed(this, 1000); } }); } } private String formattedTime(int mCurrentPosition) { String totalout = ""; String totalNew = ""; String seconds = String.valueOf(mCurrentPosition % 60); String minutes = String.valueOf(mCurrentPosition / 60); totalout = minutes + ":" + seconds; totalNew = minutes + ":" + "0" + seconds; if(seconds.length() == 1) { return totalNew; } else { return totalout; } } private void getIntentMethod() { position = getIntent().getIntExtra("position", -1); listSongs = musicFiles; if(listSongs != null) { playPauseBtn.setImageResource(R.drawable.ic_pause); uri = Uri.parse(listSongs.get(position).getPath()); } if(mediaPlayer != null) { mediaPlayer.start(); mediaPlayer.release(); mediaPlayer = MediaPlayer.create(getApplicationContext(), uri); mediaPlayer.start(); } else { mediaPlayer = MediaPlayer.create(getApplicationContext(), uri); mediaPlayer .start(); } seekBar.setMax(mediaPlayer.getDuration() / 1000); metaData(uri); } private void initViews() { song_name = findViewById(R.id.song_name); artist_name = findViewById(R.id.song_artist); duration_played = findViewById(R.id.durationPlayed); duration_total = findViewById(R.id.durationTotal); cover_art = findViewById(R.id.cover_art); nextBtn = findViewById(R.id.id_next); prevBtn = findViewById(R.id.id_prev); backBtn = findViewById(R.id.back_btn); shuffleBtn = findViewById(R.id.id_shuffle); repeatBtn = findViewById(R.id.id_repeat); playPauseBtn = findViewById(R.id.play_pause); seekBar = findViewById(R.id.seekbar); } private void metaData(Uri uri) { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); retriever.setDataSource(uri.toString()); int durationTotal = Integer.parseInt(listSongs.get(position).getDuration()) / 1000; duration_total.setText(formattedTime(durationTotal)); byte[] art = retriever.getEmbeddedPicture(); if(art != null) { Glide.with(this) .asBitmap() .load(art) .into(cover_art); } else { Glide.with(this) .asBitmap() .load(R.drawable.bewedoc) .into(cover_art); } } }
[ "66816491+AdityaKanikdaley@users.noreply.github.com" ]
66816491+AdityaKanikdaley@users.noreply.github.com
3a39178a7f42ace01371f992e4c2e5e40e3a689f
cc793d96dd091a179a994908a5a77d281fc86cfb
/FileRulerWithDesign/src/fileruler/view/ImageViewCustom.java
c4c416f3665cedf7a232ce403383579281849acb
[]
no_license
VictorVangelov/FileRuler
c7c5bb116a623b38d2027f6ea9c7c5ef1fd795c1
01e178ad7b3161f916b7f4e8badf01600adb4537
refs/heads/master
2020-05-29T11:53:15.431263
2015-06-01T14:50:43
2015-06-01T14:50:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package fileruler.view; import javafx.scene.image.ImageView; public class ImageViewCustom<T> extends ImageView { private T source; public ImageViewCustom(T source) { this.source = source; } public T getMovieSource(){ return this.source; } public void setMovieSource(T source){ this.source = source; } }
[ "encho_belezirev@outlook.com" ]
encho_belezirev@outlook.com
5bd1a8c547bf27793c0d9ab9bb5f406bab2b7c49
b4280c4821707d7424b12d0bfca963f14570981f
/Programmers/src/Level2/가장큰수.java
b7e2eeac045f6eb3f615d50242cc6c4f02f9cb55
[]
no_license
dahui3765/algorithm
61032ee307cd9276b7d6971d194d38aac672cd25
e2a14fd48e94241c3649f538cd15c6ad2a1741c2
refs/heads/main
2023-07-13T02:51:37.371591
2021-08-15T11:40:36
2021-08-15T11:40:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package Level2; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; public class 가장큰수 { public static void main(String[] args) { int [] numbers = {3, 30, 34, 5, 9}; solution(numbers); } public static String solution(int[] numbers) { String answer = ""; String arr[] = new String[numbers.length]; for (int i = 0; i < numbers.length; i++) { arr[i] = Integer.toString(numbers[i]); } Arrays.sort(arr, new Comparator<String>() { @Override public int compare(String o1, String o2) { String s1 = o1+o2; String s2 = o2+o1; return Integer.parseInt(s2) - Integer.parseInt(s1); } }); StringBuilder sb = new StringBuilder(); for (int i = 0; i < arr.length; i++) { sb.append(arr[i]); } answer = sb.toString(); if(answer.charAt(0) == '0') return "0"; System.out.println(answer); return answer; } }
[ "ekgml3765@naver.com" ]
ekgml3765@naver.com
dd4d81833c55d363294ef0267d3ef51a4773322a
7f84966b904c89fffe7b452a5bbe9d96ac16360c
/src/ru/billing/client/CatalogStubLoader.java
755d3b173ef8de0536d05c8dffaf654af1b4ff4b
[]
no_license
chinarev/lab2BaseProg
42cbb4e8efc7c1885208f8dc4c275be838013651
a49ae366cb342451453fe9af7c5188fb5d043f42
refs/heads/master
2021-02-11T00:31:10.543829
2020-04-16T23:04:39
2020-04-16T23:04:39
244,433,842
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
package ru.billing.client; import ru.billing.exceptions.CatalogLoadException; import ru.billing.exceptions.ItemAlreadyExistsException; import ru.billing.stocklist.Category; import ru.billing.stocklist.FoodItem; import ru.billing.stocklist.GenericItem; import ru.billing.stocklist.ItemCatalog; import javax.xml.catalog.CatalogException; import java.util.Date; public class CatalogStubLoader implements CatalogLoader { public void load(ItemCatalog itemCatalog) throws CatalogLoadException { GenericItem item1 = new GenericItem("Sony TV&", 23000, Category.GENERAL); FoodItem item2 = new FoodItem("Bread", 12, null, new Date(), (short) 10); try { itemCatalog.addItem(item1); itemCatalog.addItem(item2); } catch (ItemAlreadyExistsException e) { // TODO Auto-generated catch block e.printStackTrace(); throw new CatalogLoadException(e); } } }
[ "mihaelchinarev@gmail.com" ]
mihaelchinarev@gmail.com
9e9077668752f900810c08a2b8c97d3ab5a406ea
3370d2bcf49a84dc06b899038029291eca1a3086
/app/src/main/java/com/mtcle/learnandroid/day324/pattern/instances/SingleInstancClass.java
715ae61198fc8ee063c78bd19aa0ee458e000312
[]
no_license
mtcle/LearnAndroid
2591094e9de8b0e9e59fab3ecfbf75249896d208
1a27c33a7c9fc410769ff726c5d45d0e8eb60974
refs/heads/master
2020-04-27T19:55:02.922608
2019-04-28T01:48:54
2019-04-28T01:48:54
174,639,112
1
0
null
null
null
null
UTF-8
Java
false
false
467
java
package com.mtcle.learnandroid.day324.pattern.instances; /** * 作者:Lenovo on 2019/3/20 17:17 * <p> * 邮箱:mtcle@126.com * <p> * 描述:线程安全的,有jvm保证线程安全 */ public class SingleInstancClass { private static final SingleInstancClass ourInstance = new SingleInstancClass(); public static SingleInstancClass getInstance() { return ourInstance; } private SingleInstancClass() { //TODO } }
[ "mtcle@126.com" ]
mtcle@126.com
2b10f6f1ccdd899d61ae8397e90839e8563d2870
d78ba692d6ef3dd93e004eed6ae9ae46ea23e4b8
/nifi-registry-core/nifi-registry-data-model/src/main/java/org/apache/nifi/registry/extension/component/manifest/Restricted.java
82ab09de15ac42d7fd29073894aed5230410a54b
[ "Apache-2.0", "MIT" ]
permissive
apache/nifi-registry
bf3c36321f258d2e5dd18809201bc8c1230c1c25
ab9975139a87763fa1a66ce0d9e54ed445c03fcf
refs/heads/main
2023-07-02T21:15:32.036942
2021-07-15T19:48:17
2021-07-15T19:48:17
81,920,458
106
122
Apache-2.0
2021-07-15T19:48:18
2017-02-14T08:00:07
Java
UTF-8
Java
false
false
2,109
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.nifi.registry.extension.component.manifest; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import java.util.List; @ApiModel @XmlAccessorType(XmlAccessType.FIELD) public class Restricted { private String generalRestrictionExplanation; @Valid @XmlElementWrapper @XmlElement(name = "restriction") private List<Restriction> restrictions; @ApiModelProperty(value = "The general restriction for the extension, or null if only specific restrictions exist") public String getGeneralRestrictionExplanation() { return generalRestrictionExplanation; } public void setGeneralRestrictionExplanation(String generalRestrictionExplanation) { this.generalRestrictionExplanation = generalRestrictionExplanation; } @ApiModelProperty(value = "The specific restrictions") public List<Restriction> getRestrictions() { return restrictions; } public void setRestrictions(List<Restriction> restrictions) { this.restrictions = restrictions; } }
[ "kdoran@apache.org" ]
kdoran@apache.org
faf67425aff9b106ce8eca507c4c6cf90059235f
c72acaabb03bfbf4b6f44fd89a71a9dcf52871a6
/app/src/test/java/com/monami/mrc/box8category/ExampleUnitTest.java
385efd655a54f8a2d8213629bc5ca8691a24f50b
[]
no_license
monami-roychowdhury/Category
b1edfc2a8c54364403827d2ad24e71012118977d
cc4262005c215d5b7fb3b6bf396df91d3764632c
refs/heads/master
2020-03-10T19:54:31.517159
2018-04-15T14:37:13
2018-04-15T14:37:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.monami.mrc.box8category; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "mrc.barisha@gmail.com" ]
mrc.barisha@gmail.com
f4c9a3f9a1d972eedcbda8152da954d4a13b9541
14da20bf0e7da4eaab5f89da1911f9eb24b5c7ce
/src/test/java/org/curious/felidae/AppTest.java
e855ba06698b9a397aa8b91af08542bba72cfc6e
[]
no_license
jarl-haggerty/felidae
2b42f245789da7150aaa22a836e0bf3c11c2f7e4
f416ca736aa2b0f7d7d41d1d60d7e7ad904edab6
refs/heads/master
2021-01-20T00:40:18.082844
2011-03-17T19:12:25
2011-03-17T19:12:25
1,163,948
0
0
null
null
null
null
UTF-8
Java
false
false
647
java
package org.curious.felidae; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "jarlh@email.arizona.edu" ]
jarlh@email.arizona.edu
b02563c821e68350483b8fc259b2833c8860c906
655b1a0601b8be654c9321eb480b7c98926b0907
/CountDownLatchDemo/src/com/company/Main.java
62b3301127fb40cb02a1c4e4062fda25d39a85bd
[]
no_license
dspatched/Concurrency_Examples
71abb5b6235216c70aa7214f9356f6c6fee02203
b90d1ba0ff1926f56ed3f8dc1fd1cf3c0e2abe58
refs/heads/master
2020-05-29T23:32:48.253068
2019-05-22T11:20:39
2019-05-22T11:20:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.company; public class Main { /* * CountDownLatch demo * Developers work on their features while the manager awaits for all the features to be completed */ public static void main(String[] args) throws InterruptedException { SWProject project = new SWProject(5); project.start(); } }
[ "akulyakhtin@gmail.com" ]
akulyakhtin@gmail.com
8fd80932c5898c6fedc10502e9a66197f9204764
c84cdbb4b1adfa86a37cd3c85dde4a3a45448760
/ksearch-web-utils/src/main/java/com/youqianhuan/ksearch/util/util/ClassHelper.java
2881f1549e0db4a3c843f768e315c1d202d329c6
[]
no_license
chenghuanhuan/ksearch-web
d811d87f7c1b97610246b896a3011bc5dac7b062
183056ad86c609ded16bb97863f8cd510cb3bf8c
refs/heads/master
2021-01-01T04:36:32.661447
2018-03-01T08:49:13
2018-03-01T08:49:13
120,998,247
1
0
null
2018-02-10T09:12:11
2018-02-10T08:27:21
null
UTF-8
Java
false
false
7,621
java
/** * kaike.la Inc. * Copyright (c) 2014-2016 All Rights Reserved. */ package com.youqianhuan.ksearch.util.util; import java.lang.reflect.Array; import java.util.*; /** * @author chenghuanhuan@kaike.la * @since $Revision:1.0.0, $Date: 2018年01月12日 下午7:29 $ */ public class ClassHelper { public static Class<?> forNameWithThreadContextClassLoader(String name) throws ClassNotFoundException { return forName(name, Thread.currentThread().getContextClassLoader()); } public static Class<?> forNameWithCallerClassLoader(String name, Class<?> caller) throws ClassNotFoundException { return forName(name, caller.getClassLoader()); } public static ClassLoader getCallerClassLoader(Class<?> caller) { return caller.getClassLoader(); } /** * get class loader * * @param cls * @return class loader */ public static ClassLoader getClassLoader(Class<?> cls) { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (Throwable ex) { // Cannot access thread context ClassLoader - falling back to system class loader... } if (cl == null) { // No thread context class loader -> use class loader of this class. cl = cls.getClassLoader(); } return cl; } /** * Return the default ClassLoader to use: typically the thread context * ClassLoader, if available; the ClassLoader that loaded the ClassUtils * class will be used as fallback. * <p> * Call this method if you intend to use the thread context ClassLoader in a * scenario where you absolutely need a non-null ClassLoader reference: for * example, for class path resource loading (but not necessarily for * <code>Class.forName</code>, which accepts a <code>null</code> ClassLoader * reference as well). * * @return the default ClassLoader (never <code>null</code>) * @see java.lang.Thread#getContextClassLoader() */ public static ClassLoader getClassLoader() { return getClassLoader(ClassHelper.class); } /** * Same as <code>Class.forName()</code>, except that it works for primitive * types. */ public static Class<?> forName(String name) throws ClassNotFoundException { return forName(name, getClassLoader()); } /** * Replacement for <code>Class.forName()</code> that also returns Class * instances for primitives (like "int") and array class names (like * "String[]"). * * @param name the name of the Class * @param classLoader the class loader to use (may be <code>null</code>, * which indicates the default class loader) * @return Class instance for the supplied name * @throws ClassNotFoundException if the class was not found * @throws LinkageError if the class file could not be loaded * @see Class#forName(String, boolean, ClassLoader) */ public static Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException, LinkageError { Class<?> clazz = resolvePrimitiveClassName(name); if (clazz != null) { return clazz; } // "java.lang.String[]" style arrays if (name.endsWith(ARRAY_SUFFIX)) { String elementClassName = name.substring(0, name.length() - ARRAY_SUFFIX.length()); Class<?> elementClass = forName(elementClassName, classLoader); return Array.newInstance(elementClass, 0).getClass(); } // "[Ljava.lang.String;" style arrays int internalArrayMarker = name.indexOf(INTERNAL_ARRAY_PREFIX); if (internalArrayMarker != -1 && name.endsWith(";")) { String elementClassName = null; if (internalArrayMarker == 0) { elementClassName = name .substring(INTERNAL_ARRAY_PREFIX.length(), name.length() - 1); } else if (name.startsWith("[")) { elementClassName = name.substring(1); } Class<?> elementClass = forName(elementClassName, classLoader); return Array.newInstance(elementClass, 0).getClass(); } ClassLoader classLoaderToUse = classLoader; if (classLoaderToUse == null) { classLoaderToUse = getClassLoader(); } return classLoaderToUse.loadClass(name); } /** * Resolve the given class name as primitive class, if appropriate, * according to the JVM's naming rules for primitive classes. * <p> * Also supports the JVM's internal class names for primitive arrays. Does * <i>not</i> support the "[]" suffix notation for primitive arrays; this is * only supported by {@link #forName}. * * @param name the name of the potentially primitive class * @return the primitive class, or <code>null</code> if the name does not * denote a primitive class or primitive array class */ public static Class<?> resolvePrimitiveClassName(String name) { Class<?> result = null; // Most class names will be quite long, considering that they // SHOULD sit in a package, so a length check is worthwhile. if (name != null && name.length() <= 8) { // Could be a primitive - likely. result = (Class<?>) primitiveTypeNameMap.get(name); } return result; } /** Suffix for array class names: "[]" */ public static final String ARRAY_SUFFIX = "[]"; /** Prefix for internal array class names: "[L" */ private static final String INTERNAL_ARRAY_PREFIX = "[L"; /** * Map with primitive type name as key and corresponding primitive type as * value, for example: "int" -> "int.class". */ private static final Map<String,Class<?>> primitiveTypeNameMap = new HashMap<String, Class<?>>(16); /** * Map with primitive wrapper type as key and corresponding primitive type * as value, for example: Integer.class -> int.class. */ private static final Map<Class<?>,Class<?>> primitiveWrapperTypeMap = new HashMap<Class<?>, Class<?>>(8); static { primitiveWrapperTypeMap.put(Boolean.class, boolean.class); primitiveWrapperTypeMap.put(Byte.class, byte.class); primitiveWrapperTypeMap.put(Character.class, char.class); primitiveWrapperTypeMap.put(Double.class, double.class); primitiveWrapperTypeMap.put(Float.class, float.class); primitiveWrapperTypeMap.put(Integer.class, int.class); primitiveWrapperTypeMap.put(Long.class, long.class); primitiveWrapperTypeMap.put(Short.class, short.class); Set<Class<?>> primitiveTypeNames = new HashSet<Class<?>>(16); primitiveTypeNames.addAll(primitiveWrapperTypeMap.values()); primitiveTypeNames.addAll(Arrays .asList(new Class<?>[] { boolean[].class, byte[].class, char[].class, double[].class, float[].class, int[].class, long[].class, short[].class })); for (Iterator<Class<?>> it = primitiveTypeNames.iterator(); it.hasNext();) { Class<?> primitiveClass = (Class<?>) it.next(); primitiveTypeNameMap.put(primitiveClass.getName(), primitiveClass); } } public static String toShortString(Object obj){ if(obj == null){ return "null"; } return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj); } }
[ "ch746848281@163.com" ]
ch746848281@163.com
93004102448063957f604e7f57bdf63cb50f71e1
6f9a534c8e1b46f300be6bdeec99b0b0ed5236b0
/dfgx/sceneTask/src/main/java/com/bonc/common/thread/ThreadPoolManage.java
c09292628e091946f5d7590989a17d76aec05f2e
[]
no_license
snailshen2014/career
4ffd7e30fdc2e4ae74b990e679ac3f1c2998d588
c5f08e0f007d23b13150ef18e999a39f87e64b17
refs/heads/master
2020-04-10T12:15:58.280308
2018-12-09T09:32:16
2018-12-09T09:32:16
161,016,843
1
0
null
null
null
null
UTF-8
Java
false
false
2,773
java
package com.bonc.common.thread; /* * 线程管理类 * @author:曾定勇 */ import java.lang.Thread; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; //import com.dave.jfs.core.base.SysGlobal; public class ThreadPoolManage { private final static Logger log= LoggerFactory.getLogger(ThreadPoolManage.class); ThreadBaseFunction ThreadBaseFunctionIns = null; int iThreadNum = 5; boolean bNodataQuitFlag = true; public ThreadPoolManage(ThreadBaseFunction func){ if(func == null) return ; this.ThreadBaseFunctionIns = func; } public ThreadPoolManage(int threadNum,ThreadBaseFunction func){ if(func == null) return ; if(threadNum <= 0 || threadNum >50) iThreadNum = 5; else this.iThreadNum = threadNum; this.ThreadBaseFunctionIns = func; } public ThreadPoolManage(int threadNum,ThreadBaseFunction func,boolean bNodataQuit){ if(func == null) return ; if(threadNum <= 0 || threadNum >50) iThreadNum = 25; else this.iThreadNum = threadNum; this.ThreadBaseFunctionIns = func; this.bNodataQuitFlag = bNodataQuit; } public void start(){ log.info(" --- 线程任务执行开始 ---"); ThreadBaseFunctionIns.begin(); //创建一个可重用固定线程数的线程池 ExecutorService pool = Executors.newFixedThreadPool(iThreadNum); for(int i=0;i < iThreadNum;++i){ //log.debug("--- create thread :{}",i); Thread ThreadIns = new PoolThread(ThreadBaseFunctionIns,bNodataQuitFlag); pool.execute(ThreadIns); } //关闭线程池 pool.shutdown(); try{ //pool.awaitTermination(3600, TimeUnit.SECONDS); // --- 等待1小时--- pool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS); ThreadBaseFunctionIns.end(); }catch(Exception e){ log.error(e.toString()); } log.info(" --- 线程任务执行结束 ---"); } /* * 网上参考代码 * void shutdownAndAwaitTermination(ExecutorService pool) { pool.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { pool.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!pool.awaitTermination(60, TimeUnit.SECONDS)) System.err.println("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted pool.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } } */ }
[ "shenyanjun1@jd.com" ]
shenyanjun1@jd.com
79c9e6a3fd9386bbd4f3cd6a78e25f040d99a889
ef33ab032cbf79179f127cb317721ddc508daa5f
/app/src/androidTest/java/hyeon/woo/com/capstone/ExampleInstrumentedTest.java
3d2698df0d2ca5aef91f587d723185c75fc1326b
[]
no_license
dkanskcj/capstone_design
5889dff5c5116157342d874f39be4dc5f5b315c8
551063804db5999786559c7c5fc60f99b49c6d38
refs/heads/master
2023-02-22T14:11:48.663764
2021-01-24T13:35:35
2021-01-24T13:35:35
326,425,002
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
package hyeon.woo.com.capstone; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.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.getTargetContext(); assertEquals("hyeon.woo.com.capstone", appContext.getPackageName()); } }
[ "dkanskcj@naver.com" ]
dkanskcj@naver.com
b5982a26d3a73dffd62d5cf0899cef59950de941
83080abf46771f90236e4ebb09799e559770f27f
/src/TermBrowser/src/java/de/fhdo/collaboration/discgroup/DiscGroupData.java
9252cfbf4f65939c6a9a72b7a19a3c619845b484
[ "Apache-2.0" ]
permissive
vonkc2/Termserver
a82babd23aaee7bee660f443faea254161d30a24
5bc2652f27eca7c559ed69b2600d6872f4ad52e5
refs/heads/master
2021-01-15T18:51:40.562365
2015-03-11T13:39:50
2015-03-11T13:39:50
31,499,798
0
0
null
2015-03-01T15:03:00
2015-03-01T15:03:00
null
UTF-8
Java
false
false
1,346
java
/* * CTS2 based Terminology Server and Terminology Browser * Copyright (C) 2014 FH Dortmund: Peter Haas, Robert Muetzner * * 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 de.fhdo.collaboration.discgroup; import de.fhdo.collaboration.db.classes.Collaborationuser; import de.fhdo.collaboration.db.classes.Discussiongroup; /** * * @author Philipp Urbauer */ public class DiscGroupData { private Discussiongroup group; private Collaborationuser headOfGroup; public Discussiongroup getGroup() { return group; } public void setGroup(Discussiongroup group) { this.group = group; } public Collaborationuser getHeadOfGroup() { return headOfGroup; } public void setHeadOfGroup(Collaborationuser headOfGroup) { this.headOfGroup = headOfGroup; } }
[ "robert.muetzner@fh-dortmund.de" ]
robert.muetzner@fh-dortmund.de
d8270519a176bdbaaa099425f45171fb4e948ac1
c4eb564ebb1cb98b513698dd074d943488d0dc89
/icc-wechat-api/src/main/java/com/icc/common/IdFactory.java
e6fec4542e2675303e8d96159cbc63130a839186
[]
no_license
csiizhur/iccspace_projects
92d3df66754db6668042c9ce4743d4ef1a48cac8
e4b944a7f74469cb55ba11e753493a97bba9982a
refs/heads/master
2021-01-11T21:33:50.875197
2017-01-13T06:43:26
2017-01-13T06:43:26
78,807,738
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.icc.common; import java.util.UUID; /** * * @description 主键工厂 * @author zhur * @date 2016年9月23日上午11:53:21 */ public class IdFactory { /** * 获取uuid并且去掉- * @return */ public String getUUID(){ UUID uuid=UUID.randomUUID(); String replUUID=uuid.toString().replaceAll("-", ""); return replUUID; } }
[ "691529382@qq.com" ]
691529382@qq.com
36947b7ac99c309ad9df20862c8027224a2a466e
5807d83ec7d9517e423d6a763bb62e169e1fc8dd
/app/src/main/java/com/example/petagram/MainActivity.java
240c41adc077f1259b59c2fe30429f03fdb3866a
[]
no_license
pedrofranciscofranco/Petagram
aa2adb70868121c2cd8b2648a4db4db36a4aba10
a3fc1261c0c5010759c498e29e6a6c3a12346162
refs/heads/master
2022-12-19T18:21:57.657214
2020-10-04T05:36:22
2020-10-04T05:36:22
298,216,212
0
0
null
null
null
null
UTF-8
Java
false
false
3,198
java
package com.example.petagram; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; import androidx.viewpager2.widget.ViewPager2; import android.content.ClipData; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private MaterialToolbar toolbar; private TabLayout tabLayout; static ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = findViewById(R.id.toolbar); tabLayout = findViewById(R.id.tablayout); viewPager = findViewById(R.id.viewpager); setUpViewPager(); /* petagram = findViewById(R.id.rvAnimalitos); LinearLayoutManager llm = new LinearLayoutManager(this); llm.setOrientation(RecyclerView.VERTICAL); petagram.setLayoutManager(llm); cargardatos(); inicializaradaptador(); */ if (toolbar!=null){ setSupportActionBar(toolbar); } } /* public void clik (View view) { Toast.makeText(this, "like", Toast.LENGTH_SHORT).show(); } */ @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.action_favorite: Intent afavoritos = new Intent(this, favoritos5.class); startActivity(afavoritos); return true; case R.id.menu_Contacto: Intent aContacto = new Intent(this, Contacto.class); startActivity(aContacto); return true; case R.id.menu_Acercade: Intent aAcercade = new Intent(this, bio.class); startActivity(aAcercade); return true; default: return super.onOptionsItemSelected(item); } } private ArrayList<Fragment> agregarfragmetn(){ ArrayList<Fragment> fragments = new ArrayList<>(); fragments.add(new fragmentrecycler()); fragments.add(new PerfilMascota()); return fragments; } private void setUpViewPager(){ viewPager.setAdapter(new PageAdapter(getSupportFragmentManager(), agregarfragmetn())); tabLayout.setupWithViewPager(viewPager); tabLayout.getTabAt(0).setIcon(R.drawable.iconhouse); tabLayout.getTabAt(1).setIcon(R.drawable.iconpet); } }
[ "pedrofranciscofranco@hotmail.com" ]
pedrofranciscofranco@hotmail.com
9d03a0afc50f6da3e964cb7b3cc389560750ce3f
5c009ccdde089a427bd2e3a5684ccb9b759896d9
/src/main/java/com/wemsuser/app/Response/Feedbackdata.java
49219eb0e242913d53b7b44011edd6a826830125
[]
no_license
UmraoNidhi/iparknidhi
062e12fd0e919dab89de0178c912d1c6ffbfff27
5c660ffefd783816ca2a1d390e2ff2b1b2e2057a
refs/heads/master
2022-12-08T14:55:12.126549
2020-01-29T13:36:21
2020-01-29T13:36:21
288,910,023
0
0
null
null
null
null
UTF-8
Java
false
false
2,105
java
package com.wemsuser.app.Response; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Feedbackdata { @SerializedName("user_id") @Expose private String userId; @SerializedName("merchant_id") @Expose private String merchantId; @SerializedName("service_type_id") @Expose private String serviceTypeId; @SerializedName("user_feedback") @Expose private String userFeedback; @SerializedName("creation_ip") @Expose private String creationIp; @SerializedName("creation_date") @Expose private String creationDate; @SerializedName("status") @Expose private String status; @SerializedName("browse_type") @Expose private String browseType; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getMerchantId() { return merchantId; } public void setMerchantId(String merchantId) { this.merchantId = merchantId; } public String getServiceTypeId() { return serviceTypeId; } public void setServiceTypeId(String serviceTypeId) { this.serviceTypeId = serviceTypeId; } public String getUserFeedback() { return userFeedback; } public void setUserFeedback(String userFeedback) { this.userFeedback = userFeedback; } public String getCreationIp() { return creationIp; } public void setCreationIp(String creationIp) { this.creationIp = creationIp; } public String getCreationDate() { return creationDate; } public void setCreationDate(String creationDate) { this.creationDate = creationDate; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getBrowseType() { return browseType; } public void setBrowseType(String browseType) { this.browseType = browseType; } }
[ "vivek@algosoftech.in" ]
vivek@algosoftech.in
6216492f8bc9ebe2387bbb5a72563cf782971eb8
0b949c5c930a97ec6b2d2ff4a8430cdc38401fba
/tags/SMSPopup v0.9.9/src/net/everythingandroid/smspopup/SMSPopupActivity.java
fc359cdaa10c775968146e354f927060fd408a90
[]
no_license
KhalidElSayed/Android-smspopup
4633176474643b6aa01f39f75993618f78d1ccf6
0f9e8070b27da1b9e5ec8a36d17e3b82eeaa341d
refs/heads/master
2021-01-18T00:31:52.145270
2012-03-06T16:02:38
2012-03-06T16:02:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,013
java
package net.everythingandroid.smspopup; import net.everythingandroid.smspopup.ManageKeyguard.LaunchOnKeyguardExit; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.TextUtils; import android.view.Display; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; public class SMSPopupActivity extends Activity { private SmsMmsMessage message; private boolean exitingKeyguardSecurely = false; private Bundle bundle = null; private SharedPreferences myPrefs; private TextView headerTV; private TextView messageTV; private TextView fromTV; private TextView mmsSubjectTV; private LinearLayout viewButtonLayout; private LinearLayout mmsLinearLayout; private ScrollView messageScrollView; private boolean wasVisible = false; private boolean replying = false; private final double WIDTH = 0.8; private static final int DELETE_DIALOG = 0; @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); Log.v("SMSPopupActivity: onCreate()"); //First things first, acquire wakelock, otherwise the phone may sleep ManageWakeLock.acquirePartial(getApplicationContext()); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.popup); //Get shared prefs myPrefs = PreferenceManager.getDefaultSharedPreferences(this); //Check preferences and then blur out background behind window if (myPrefs.getBoolean(getString(R.string.pref_blur_key), Boolean.valueOf(getString(R.string.pref_blur_default)))) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); } //This sets the minimum width of the activity to 75% of the screen size //only needed because the theme of this activity is "dialog" so it looks //like it's floating and doesn't seem to fill_parent like a regular activity LinearLayout mainLL = (LinearLayout) findViewById(R.id.MainLinearLayout); Display d = getWindowManager().getDefaultDisplay(); int width = (int)(d.getWidth() * WIDTH); Log.v("setting width to: " + width); mainLL.setMinimumWidth(width); //Find the main textviews fromTV = (TextView) findViewById(R.id.FromTextView); messageTV = (TextView) findViewById(R.id.MessageTextView); headerTV = (TextView) findViewById(R.id.HeaderTextView); mmsSubjectTV = (TextView) findViewById(R.id.MmsSubjectTextView); viewButtonLayout = (LinearLayout) findViewById(R.id.ViewButtonLinearLayout); messageScrollView = (ScrollView) findViewById(R.id.MessageScrollView); mmsLinearLayout = (LinearLayout) findViewById(R.id.MmsLinearLayout); //The close button Button closeButton = (Button) findViewById(R.id.closeButton); closeButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent i = new Intent(SMSPopupActivity.this.getApplicationContext(), SMSPopupUtilsService.class); i.setAction(SMSPopupUtilsService.ACTION_MARK_MESSAGE_READ); i.putExtras(message.toBundle()); SMSPopupUtilsService.beginStartingService( SMSPopupActivity.this.getApplicationContext(), i); // Finish up this activity myFinish(); } }); //The inbox button Button inboxButton = (Button) findViewById(R.id.InboxButton); inboxButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { exitingKeyguardSecurely = true; ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() { public void LaunchOnKeyguardExitSuccess() { Intent i = SMSPopupUtils.getSmsIntent(); SMSPopupActivity.this.getApplicationContext().startActivity(i); myFinish(); } }); //myFinish(); } }); //The view button (if in privacy mode) Button viewButton = (Button) findViewById(R.id.ViewButton); viewButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { exitingKeyguardSecurely = true; ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() { public void LaunchOnKeyguardExitSuccess() { Intent i = getIntent(); i.putExtra(SmsMmsMessage.EXTRAS_NOTIFY, false); startActivity(i); } }); } }); //The reply button Button replyButton = (Button) findViewById(R.id.replyButton); replyButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { exitingKeyguardSecurely = true; ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() { public void LaunchOnKeyguardExitSuccess() { Intent reply = message.getReplyIntent(); SMSPopupActivity.this.getApplicationContext().startActivity(reply); replying = true; myFinish(); } }); //ManageNotification.clearAll(SMSPopupActivity.this.getApplicationContext(), true); //myFinish(); } }); // The ViewMMS button Button viewMmsButton = (Button) findViewById(R.id.ViewMmsButton); viewMmsButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { exitingKeyguardSecurely = true; ManageKeyguard.exitKeyguardSecurely(new LaunchOnKeyguardExit() { public void LaunchOnKeyguardExitSuccess() { Intent reply = message.getReplyIntent(); SMSPopupActivity.this.getApplicationContext().startActivity(reply); myFinish(); } }); //ManageNotification.clearAll(SMSPopupActivity.this.getApplicationContext(), true); //myFinish(); } }); // The Delete button Button deleteButton = (Button) findViewById(R.id.deleteButton); if (myPrefs.getBoolean(getString(R.string.pref_show_delete_button_key), Boolean.valueOf(getString(R.string.pref_show_delete_button_default)))) { deleteButton.setVisibility(View.VISIBLE); } else { deleteButton.setVisibility(View.GONE); } deleteButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(DELETE_DIALOG); } }); if (bundle == null) { populateViews(getIntent().getExtras()); } else { populateViews(bundle); } wakeApp(); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.v("SMSPopupActivity: onNewIntent()"); //First things first, acquire wakelock, otherwise the phone may sleep ManageWakeLock.acquirePartial(getApplicationContext()); setIntent(intent); //Re-populate views with new intent data (ie. new sms data) populateViews(intent.getExtras()); wakeApp(); } @Override protected void onStart() { super.onStart(); Log.v("SMSPopupActivity: onStart()"); ManageWakeLock.acquirePartial(getApplicationContext()); } @Override protected void onResume() { super.onResume(); Log.v("SMSPopupActivity: onResume()"); wasVisible = false; //Reset exitingKeyguardSecurely bool to false exitingKeyguardSecurely = false; } @Override protected void onPause() { super.onPause(); Log.v("SMSPopupActivity: onPause()"); if (wasVisible) { //Cancel the receiver that will clear our locks ClearAllReceiver.removeCancel(getApplicationContext()); ClearAllReceiver.clearAll(!exitingKeyguardSecurely); } } @Override protected void onStop() { super.onStop(); Log.v("SMSPopupActivity: onStop()"); //Cancel the receiver that will clear our locks ClearAllReceiver.removeCancel(getApplicationContext()); ClearAllReceiver.clearAll(!exitingKeyguardSecurely); } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); Log.v("SMSPopupActivity: onWindowFocusChanged(" + hasFocus + ")"); if (hasFocus) { // This is really hacky, basically a flag that is set if the message // was at some point visible. I tried using onResume() or other methods // to prevent doing some things 2 times but this seemed to be the only // reliable way (?) wasVisible = true; } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Log.v("SMSPopupActivity: onSaveInstanceState()"); // Save values from most recent bundle (ie. most recent message) outState.putAll(bundle); } private void myFinish() { Log.v("myFinish()"); // Start a service that will update the notification in the status bar Intent i = new Intent( SMSPopupActivity.this.getApplicationContext(), SMSPopupUtilsService.class); i.setAction(SMSPopupUtilsService.ACTION_UPDATE_NOTIFICATION); // Convert current message to bundle i.putExtras(message.toBundle()); // We need to know if the user is replying - if so, the entire thread id should // be ignored when working out the message tally in the notification bar. We // can't rely on the system database as it may take a little while for the reply // intent to fire and load up the messaging up (after which the messages will be // marked read in the database). i.putExtra(SmsMmsMessage.EXTRAS_REPLYING, replying); // Start the service SMSPopupUtilsService.beginStartingService( SMSPopupActivity.this.getApplicationContext(), i); // Cancel any reminder notifications ReminderReceiver.cancelReminder(getApplicationContext()); // Finish up the activity finish(); } private void populateViews(Bundle b) { // Store bundle bundle = b; // Regenerate the SmsMmsMessage from the extras bundle message = new SmsMmsMessage(getApplicationContext(), bundle); // Refresh privacy settings (hide/show message) refreshPrivacy(); // Find the ImageView that will show the contact photo ImageView iv = (ImageView) findViewById(R.id.FromImageView); // See if we have a contact photo, if so set it to the IV, if not, show a // generic dialog info icon Bitmap contactPhoto = message.getContactPhoto(); if (contactPhoto != null) { iv.setImageBitmap(contactPhoto); } else { iv.setImageDrawable( getResources().getDrawable(android.R.drawable.ic_dialog_info)); } // Show/hide the LinearLayout and update the unread message count // if there are >1 unread messages waiting LinearLayout mLL = (LinearLayout) findViewById(R.id.UnreadCountLinearLayout); TextView tv = (TextView) findViewById(R.id.UnreadCountTextView); if (message.getUnreadCount() <= 1) { mLL.setVisibility(View.GONE); tv.setText(""); } else { String textWaiting = String.format( getString(R.string.unread_text_waiting), message .getUnreadCount() - 1); tv.setText(textWaiting); mLL.setVisibility(View.VISIBLE); } // Update TextView that contains the timestamp for the incoming message String headerText = getString(R.string.new_text_at); headerText = headerText.replaceAll("%s", message.getFormattedTimestamp()); //Set the from, message and header views fromTV.setText(message.getContactName()); if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_SMS) { messageTV.setText(message.getMessageBody()); } else { mmsSubjectTV.setText(getString(R.string.mms_subject) + " " + message.getMessageBody()); } headerTV.setText(headerText); } private void refreshPrivacy() { //We need to init the keyguard class so we can check if the keyguard is on ManageKeyguard.initialize(getApplicationContext()); //Fetch privacy mode boolean privacyMode = myPrefs.getBoolean( getString(R.string.pref_privacy_key), Boolean.valueOf(getString(R.string.pref_privacy_default))); // If it's a MMS message, just show the MMS layout if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_MMS) { viewButtonLayout.setVisibility(View.GONE); messageScrollView.setVisibility(View.GONE); mmsLinearLayout.setVisibility(View.VISIBLE); // If no MMS subject, hide the subject text view if (TextUtils.isEmpty(message.getMessageBody())) { mmsSubjectTV.setVisibility(View.GONE); } else { mmsSubjectTV.setVisibility(View.VISIBLE); } } else { // Otherwise hide MMS layout and show either the view button if in // privacy mode or the message body textview if not mmsLinearLayout.setVisibility(View.GONE); if (privacyMode && ManageKeyguard.inKeyguardRestrictedInputMode()) { viewButtonLayout.setVisibility(View.VISIBLE); messageScrollView.setVisibility(View.GONE); } else { viewButtonLayout.setVisibility(View.GONE); messageScrollView.setVisibility(View.VISIBLE); } } } private void wakeApp() { // Time to acquire a full WakeLock (turn on screen) ManageWakeLock.acquireFull(getApplicationContext()); // See if a notification has been played for this message... if (message.getNotify()) { // Store extra to signify we have already notified for this message bundle.putBoolean(SmsMmsMessage.EXTRAS_NOTIFY, false); // Reset the reminderCount to 0 just to be sure message.updateReminderCount(0); // Schedule a reminder notification ReminderReceiver.scheduleReminder(getApplicationContext(), message); // Run the notification ManageNotification.show(getApplicationContext(), message); } } @Override protected void onDestroy() { Log.v("onDestroy()"); // ClearAllReceiver.clearAll(!exitingKeyguardSecurely); super.onDestroy(); } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DELETE_DIALOG: return new AlertDialog.Builder(this) .setIcon(android.R.drawable.ic_dialog_alert) .setTitle(getString(R.string.pref_show_delete_button_dialog_title)) .setMessage(getString(R.string.pref_show_delete_button_dialog_text)) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Intent i = new Intent( SMSPopupActivity.this.getApplicationContext(), SMSPopupUtilsService.class); i.setAction(SMSPopupUtilsService.ACTION_DELETE_MESSAGE); i.putExtras(message.toBundle()); SMSPopupUtilsService.beginStartingService( SMSPopupActivity.this.getApplicationContext(), i); myFinish(); } }) .setNegativeButton(android.R.string.cancel, null) .create(); } return null; } }
[ "chema.larrea@gmail.com" ]
chema.larrea@gmail.com
58db81f49a33fc3017b1e3f4bb4314f734ee6ccc
b76ce8f33bf7db8203b8192d0a94a1f0973f715a
/src/java/filediff/DiffException.java
9d85a57550ea0997fb045bc05de2e440e92b1e43
[ "MIT" ]
permissive
nendhruv/data-dictionary
320eb33bcba2b883eed844a7b5f9a7805cf2a823
2c4183f15a83c65cdceed36083267f02a2597be7
refs/heads/master
2021-01-22T06:59:20.634232
2014-12-07T09:17:46
2014-12-07T09:17:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package filediff; public class DiffException extends Exception { private static final long serialVersionUID = 1L; public DiffException() { } public DiffException(String msg) { super(msg); } }
[ "dhruv94k@gmail.com" ]
dhruv94k@gmail.com
34d031ce6915abd078f2e97a0b94a8f423c23599
08335a2d0dde25f08b4f82d21b2a7fd788b414c0
/src/main/java/com/meadowcottage/roboticcraft/common/init/ModTools.java
972cbbc65a2c5e6b0ad118a0b8cad256d6186cb6
[ "MIT" ]
permissive
Mazdallier/Roboticcraft
e8f6d74abbcc29590006cfb4a2abfa2e3204d426
c628937b905db6f73ed8fcb3cb6eb6244bf7f6d9
refs/heads/master
2020-04-09T05:04:16.486748
2015-02-05T19:01:04
2015-02-05T19:01:04
30,405,097
0
0
null
2015-02-06T09:33:10
2015-02-06T09:33:10
null
UTF-8
Java
false
false
1,538
java
package com.meadowcottage.roboticcraft.common.init; import com.meadowcottage.roboticcraft.common.items.tools.ItemSteelAxe; import com.meadowcottage.roboticcraft.common.items.tools.ItemSteelPick; import com.meadowcottage.roboticcraft.common.items.tools.ItemSteelShovel; import com.meadowcottage.roboticcraft.common.items.tools.ItemSteelSword; import com.meadowcottage.roboticcraft.common.items.tools.ItemWrench; import com.meadowcottage.roboticcraft.common.reference.Names; import com.meadowcottage.roboticcraft.common.reference.Reference; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.item.Item; @GameRegistry.ObjectHolder(Reference.MOD_ID) public class ModTools { //Declare Tools public static final ItemWrench Wrench = new ItemWrench(); public static final ItemSteelSword SteelSword = new ItemSteelSword(Item.ToolMaterial.IRON ); public static final ItemSteelPick SteelPick = new ItemSteelPick(Item.ToolMaterial.IRON ); public static final ItemSteelShovel SteelShovel = new ItemSteelShovel(Item.ToolMaterial.IRON ); public static final ItemSteelAxe SteelAxe = new ItemSteelAxe(Item.ToolMaterial.IRON ); public static void init() { //Registering Items GameRegistry.registerItem(Wrench, Names.Tools.Wrench); GameRegistry.registerItem(SteelSword, Names.Tools.SteelSword); GameRegistry.registerItem(SteelPick, Names.Tools.SteelPick); GameRegistry.registerItem(SteelShovel, Names.Tools.SteelShovel); GameRegistry.registerItem(SteelAxe, Names.Tools.SteelAxe); } }
[ "bendixon50@gmail.com" ]
bendixon50@gmail.com
d9f893378cb1e26e85683f8c3f18fc9c16aeeb39
b9abf72fe96cb69c8537026dd13b0b64e9f74236
/src/main/java/com/bbstone/pisces/server/base/ReqDispatcher.java
bfd4861771d65a5cfca32aeb8ecf6cab5a0ac005
[ "Apache-2.0" ]
permissive
bbstone101/pisces
5b22a0c56e03e42dc2af00a7297e8aac92133efd
77368ba0e5f00d590916e0abab0c44d847a977aa
refs/heads/master
2023-03-14T14:20:17.348681
2021-02-25T13:29:31
2021-02-25T13:29:31
333,356,918
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
package com.bbstone.pisces.server.base; import com.bbstone.pisces.proto.BFileMsg; import com.bbstone.pisces.server.cmd.CmdHandler; import io.netty.channel.ChannelHandlerContext; /** * client request will dispatch to different server cmdHandler according cmd * */ public class ReqDispatcher { public static void dispatch(ChannelHandlerContext ctx, BFileMsg.BFileReq msg) { CmdHandler cmdHandler = CmdRegister.getHandler(msg.getCmd()); cmdHandler.handle(ctx, msg); } }
[ "liguifa2020@163.com" ]
liguifa2020@163.com
cc11215a0f7f5c1360759f4d071c13dcba47a241
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/17/17_a77682d4012f36b1a678a450bff12d829ad8e963/SMSParser/17_a77682d4012f36b1a678a450bff12d829ad8e963_SMSParser_s.java
1ff2010f7a70d86780f38ab275d3582588984fce
[]
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
3,514
java
package mobserv.smsgaming; import java.util.ArrayList; import android.app.Activity; import android.database.Cursor; import android.net.Uri; import android.util.Log; /** * Provides methods to see if a given challenge has been completed * @author lolo * */ public class SMSParser { ArrayList<Group> groups = new ArrayList<Group>(); Player user; SMSParser() { groups = null; } SMSParser(Player user, ArrayList<Group> groups) { this.groups = groups; this.user = user; if (null == user){ Log.e("SMSParser", "No user provided !"); } } /** * Looks through the SMS inbox for messages containing * <code>chall.objective</code>. * * @param chall(Challenge) challenge we're looking for * @param act(Activity) activity the method was called from * @return first matching SMS, null if nothing found */ public String searchSMS(Challenge chall, Activity act){ if (chall.isCompleted()){ return "challenge already completed"; } String[] projection = {"address","date","body", "_id"};//The informations we are interested in the SMSs Group group = null; ArrayList<String> playerNumbers; Cursor cursor = act.getContentResolver().query(Uri.parse("content://sms/inbox"), projection, null, null, null); //int lastSearch = chall.lastSearch; Log.d("SMSParser", "Searching for challenge "+chall.toString()); //Try to find the group... for (Group g : groups){ if (g.getName() == chall.getGroupname()){ group = g; } } if (null == group){ Log.e("SMSParser", "Group "+chall.getGroupname()+" was not found."); // return "No group !"; } playerNumbers = group.getPlayerNumbers(); if (cursor.getCount() == 0){ Log.e("SMSParser", "You don't have any SMS, loser !"); return "No SMS !"; } //cursor.moveToPosition(cursor.getCount() - lastSearch - 1);//Go to the last message checked, according to the Challenge object cursor.moveToLast(); do{ String msgData = cursor.getString(2); String sender = cursor.getString(0); //Log.d("SMSParser", "Message "+cursor.getString(3)+" from : "+cursor.getString(0)+" : "+msgData); //if (msgData.contains(chall.objective) ){ if (msgData.contains(chall.objective) && playerNumbers.contains(sender) ){ Log.d("SMSParser", " Challenge completed : "+msgData); user.challengeCompleted(group,chall); return "Success"; } }while(cursor.moveToPrevious()); chall.lastSearch = cursor.getCount(); return "No matching sms !!"; } /** * Looks through the SMS inbox for messages containing <code>obj</code>. * * @param obj string we're looking for * @param act activity the method was called for * @return first matching SMS */ public String searchSMS(String obj, Activity act){ return searchSMS( new Challenge(act, obj, 0, null, false), act); } /** * This method is called by SMSReceiver when messages are incoming * Currently only printing the SMS * * @param msg : String containing one or more SMS */ @Deprecated public void parse(String msg){ Log.i("SMSParser", msg); try{ //groups.get(0).getUser().challengeCompleted(groups.get(0), groups.get(0).getChallenges().get(0)); //groups.get(0).getChallenges().get(0).setCompleted(); } catch (java.lang.NullPointerException e){ Log.e("SMSParser", "I don't know where the 'groups' is !!!"); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
cfdacf89ae517a53000e8af461fcfbc0b9cf007c
37317fc21744b1e64312f931626c0b140453508b
/src/test/java/org/brewman/examples/logger/LoggerOutputStreamTest.java
5a0d95fe50e70b043835e9fe9a1544168a4267fd
[]
no_license
danielshiplett/examples
1fe42466f4dcd5947d6927c962fa37eead54c6f8
e8c598d969d084d500505f331ae85451242bad06
refs/heads/master
2021-01-10T12:51:41.662346
2015-05-29T18:40:39
2015-05-29T18:40:39
35,988,199
0
0
null
null
null
null
UTF-8
Java
false
false
605
java
package org.brewman.examples.logger; import java.io.PrintStream; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ch.qos.logback.classic.Level; public class LoggerOutputStreamTest { private static final Logger LOG = LoggerFactory .getLogger(LoggerOutputStreamTest.class); @Test public void test() { /* * Configure the System.ERR to go to our logger. */ System.setErr(new PrintStream(new LoggerOutputStream(LOG, Level.ERROR), true)); System.err.print("This is a test!"); } }
[ "dshiplet@vt.edu" ]
dshiplet@vt.edu
2556b468332a87483e4a54d7ede6ffcebc0b7378
44b2a693c6396fb241e2c21a49a4b3054b4af2c2
/src/main/java/io/gr1d/ic/usage/api/subscriptions/model/ApiGatewayResponse.java
114a540c25f1f11893315009ef2c40cd4b98aa08
[]
no_license
thiagozampieri/devPortal
0b9ebf3559ee80d659fe122740845bbe769bbdd6
7089747bd9028f2e4d070fa423e7f5f1d516f5b9
refs/heads/master
2021-04-22T15:04:48.538153
2020-03-23T20:00:11
2020-03-23T20:00:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
package io.gr1d.ic.usage.api.subscriptions.model; import lombok.Data; import java.time.LocalDateTime; @Data public class ApiGatewayResponse { private String uuid; private String apiUuid; private PlanResponse apiPlan; private String splitMode; private String name; private String externalId; private String productionExternalId; private GatewayResponse gateway; private ProviderResponse provider; private LocalDateTime createdAt; private LocalDateTime removedAt; }
[ "62027231+kdupieroni@users.noreply.github.com" ]
62027231+kdupieroni@users.noreply.github.com
2769b187cdad8f28790a1a873813fb98b862ea5c
a8a0afc76179156d1ea837a20bd41fe7d6940580
/app/src/main/java/com/example/android/logindemo/Repeating_activity.java
e887c20126e3f088fa3b8f9660e9012e88ea9dd1
[]
no_license
shan7030/collect-chunk
1fed8af401807d6061ec863c5e38e3d62a4846b8
15a27ee9af5ae0a5baf5ab936018078dfbd2d406
refs/heads/master
2021-09-23T23:15:27.807060
2018-09-28T19:33:22
2018-09-28T19:33:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
596
java
package com.example.android.logindemo; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; /** * Created by shantanu on 26/9/18. */ public class Repeating_activity extends AppCompatActivity{ @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_daily); Intent intenter = new Intent (Repeating_activity.this, DailyActivity.class); startActivity(intenter); } }
[ "shan7030666366@gmail.com" ]
shan7030666366@gmail.com
64dd669d0c45ddfc8279e4054f8c58471d32a1cf
0bab1663db7b947917b6b4660dd0fb9ea267eeaa
/osgiwebservlet/src/jetty_osgi_example/Activator.java
48d62ec9d0e592c4474e27a34eadc0f943169b52
[]
no_license
abdul99/OSGi
d368b0028fd133a7729787f6343a9987b646c515
b090684e1efd91af530c39fbe1cefd5d15361469
refs/heads/master
2021-01-17T17:45:57.857326
2016-06-28T05:08:21
2016-06-28T05:08:21
62,111,589
0
0
null
null
null
null
UTF-8
Java
false
false
1,432
java
package jetty_osgi_example; import java.util.Hashtable; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHandler; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { private static BundleContext context; static BundleContext getContext() { return context; } public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; //1. We create a Servlet Handler ServletHandler handler = new ServletHandler(); //2. We register our Servlet and its URL mapping handler.addServletWithMapping(JcgServlet.class, "/*"); //3. We are creating a Servlet Context handler ServletContextHandler ch= new ServletContextHandler(); //4. We are defining the context path ch.setContextPath("/jcgservletpath"); //5. We are attaching our servlet handler ch.setServletHandler(handler); //6. We are creating an empty Hashtable as the properties Hashtable props = new Hashtable(); // 7. Here we register the ServletContextHandler as the OSGi service bundleContext.registerService(ContextHandler.class.getName(), ch, props); System.out.println("Registration Complete"); } public void stop(BundleContext bundleContext) throws Exception { Activator.context = null; } }
[ "uideveloper2015@gmail.com" ]
uideveloper2015@gmail.com
691d1df12cd6d6f1a05cec1b9ef1550c145c71e4
38ee0271dd601420dba9dd133343a6d06a2880d7
/EasyTest/src/main/java/com/java/singleAsync/TaskHelper.java
a60800719d8f5e6c14a1693c6d924b718b5c32ec
[]
no_license
tankmyb/EasyProject
c630ba69f458fe13449c0ff5b88d797bb46e90cf
e699826d41c034d1ca1f8092463e7426e85778b3
refs/heads/master
2016-09-06T02:36:59.128880
2015-02-17T02:03:51
2015-02-17T02:03:51
30,898,342
2
0
null
null
null
null
UTF-8
Java
false
false
3,188
java
package com.java.singleAsync; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; public class TaskHelper { public static TaskEventEmitter createIOTask(TaskExecutor executor, String fileName){ final IOTask task = new IOTask(executor, fileName, "UTF-8"); task.on("open", new EventHandler() { @Override public void handle(EventObject event) { String fileName = (String) event.getArgs()[0]; System.out.println(Thread.currentThread() + " - " + fileName + " has been opened."); } }); task.on("next", new EventHandler() { @Override public void handle(EventObject event) { BufferedReader reader = (BufferedReader) event.getArgs()[0]; try { String line = reader.readLine(); if (line != null) { task.emit("ready", line); task.emit("next", reader); } else { task.emit("close", task.getFileName()); } } catch (IOException e) { task.emit(e.getClass().getName(), e, task.getFileName()); try { reader.close(); task.emit("close", task.getFileName()); } catch (IOException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } } }); task.on("ready", new EventHandler() { @Override public void handle(EventObject event) { String line = (String) event.getArgs()[0]; int len = line.length(); int wordCount = line.split("[\\s+,.]+").length; System.out.println(Thread.currentThread()+" - word count: "+wordCount+" length: "+len); } }); task.on(IOException.class.getName(), new EventHandler() { @Override public void handle(EventObject event) { Object[] args = event.getArgs(); IOException e = (IOException) args[0]; String fileName = (String) args[1]; System.out.println(Thread.currentThread()+ " - An IOException occurred while reading " + fileName + ", error: " + e.getMessage()); } }); task.on("close", new EventHandler() { @Override public void handle(EventObject event) { String fileName = (String) event.getArgs()[0]; System.out.println(Thread.currentThread() + " - " + fileName + " has been closed."); } }); task.on(FileNotFoundException.class.getName(), new EventHandler() { @Override public void handle(EventObject event) { FileNotFoundException e = (FileNotFoundException) event.getArgs()[0]; e.printStackTrace(); System.exit(1); } }); return task; } }
[ "=" ]
=
7158441c30f9958e533c7595b239c74c54e1a038
47034e7fcb058b3df4bf5928455951e5f455897e
/javatools/hserranalysis/src/main/java/me/hatter/tools/hserranalysis/sun/jvm/hotspot/asm/x86/X86CondJmpInstruction.java
8e494d90328b45015c5ac6d153247f39d05c4f8a
[]
no_license
KingBowser/hatter-source-code
2858a651bc557e3aacb4a07133450f62dc7a15c6
f10d4f0ec5f5adda1baa942e179f76301ebc328a
refs/heads/master
2021-01-01T06:49:52.889183
2015-03-21T17:00:28
2015-03-21T17:00:28
32,662,581
3
1
null
null
null
null
UTF-8
Java
false
false
2,277
java
/* * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ package me.hatter.tools.hserranalysis.sun.jvm.hotspot.asm.x86; import me.hatter.tools.hserranalysis.sun.jvm.hotspot.asm.*; public class X86CondJmpInstruction extends X86Instruction implements BranchInstruction { final private X86PCRelativeAddress addr; public X86CondJmpInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes) { super(name, size, prefixes); this.addr = addr; if(addr instanceof X86PCRelativeAddress) { addr.setInstructionSize(getSize()); } } public String asString(long currentPc, SymbolFinder symFinder) { StringBuffer buf = new StringBuffer(); buf.append(getPrefixString()); buf.append(getName()); buf.append(spaces); if(addr instanceof X86PCRelativeAddress) { long disp = ((X86PCRelativeAddress)addr).getDisplacement(); long address = disp + currentPc; buf.append(symFinder.getSymbolFor(address)); } return buf.toString(); } public Address getBranchDestination() { return addr; } public boolean isBranch() { return true; } public boolean isConditional() { return true; } }
[ "jht5945@gmail.com@dd6f9e7e-b4fe-0bd6-ab9c-0ed876a8e821" ]
jht5945@gmail.com@dd6f9e7e-b4fe-0bd6-ab9c-0ed876a8e821
4b2e57018c258486b9af2177d746fa41f1d8b1f5
d049893e680f6f7736748459a2bcd0d2f52be645
/Lp-common/src/main/java/com/lp/rpc/domain/LpRequest.java
f7e5c8447a5f991fab2af6e7193a17c47b8da0cf
[ "MIT" ]
permissive
steakliu/Lp-Rpc
c3337c9d5ee3166df6523833769cf574637d5b22
6616190763c2e3006d486bbf8bec1f1d81162ff0
refs/heads/master
2023-07-16T10:20:28.297058
2021-08-31T09:26:40
2021-08-31T09:26:40
399,060,021
1
0
null
null
null
null
UTF-8
Java
false
false
410
java
package com.lp.rpc.domain; import lombok.*; import lombok.experimental.Accessors; import java.io.Serializable; @AllArgsConstructor @NoArgsConstructor @Accessors(chain = true) @Setter @Getter @ToString public class LpRequest implements Serializable { private String requestId; private String className; private String methodName; private Class<?>[] paramTypes; private Object[] params; }
[ "2319492349@qq.com" ]
2319492349@qq.com
9fdf9bf6b86984e945c7b2275034bc959c48d6a0
9cd8e7c05b59e247e07d9f3e8db8ed91b2ed205e
/src/main/java/org/fpml/fpml_5/master/AbstractEvent.java
ab812d4e25adf435954b73cc8c27dd1269bed9b8
[]
no_license
silvionetto/gapp
d534f919cf732b0eb475abfd46e3dd5a213d7e6d
655e3740216d2a7e55625d5c1ebfcbe3b72ef1af
refs/heads/master
2022-01-09T03:35:18.331184
2022-01-04T10:03:41
2022-01-04T10:03:41
113,552,613
0
0
null
2022-01-04T10:03:42
2017-12-08T08:46:54
Java
UTF-8
Java
false
false
2,644
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170531.0717 // See <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2018.02.10 at 05:14:53 PM CET // package org.fpml.fpml_5.master; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; /** * Abstract base type for all events. * * <p>Java class for AbstractEvent complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="AbstractEvent"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="eventIdentifier" type="{http://www.fpml.org/FpML-5/master}BusinessEventIdentifier" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AbstractEvent", propOrder = { "eventIdentifier" }) @XmlSeeAlso({ AdditionalEvent.class, ChangeEvent.class, OptionEvent.class, OptionExercise.class, OptionExpiry.class, TradeAmendmentContent.class, TradeChangeBase.class, TradeNovationContent.class }) public abstract class AbstractEvent { protected List<BusinessEventIdentifier> eventIdentifier; /** * Gets the value of the eventIdentifier property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the eventIdentifier property. * * <p> * For example, to add a new item, do as follows: * <pre> * getEventIdentifier().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link BusinessEventIdentifier } * * */ public List<BusinessEventIdentifier> getEventIdentifier() { if (eventIdentifier == null) { eventIdentifier = new ArrayList<BusinessEventIdentifier>(); } return this.eventIdentifier; } }
[ "silvio.netto@gmail.com" ]
silvio.netto@gmail.com
41cc0ad9a4a22d67476992e15084dd29613ec6e9
53f0e22b43c624dae0b5d46d0fc4bca1f089cb67
/addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/tests/ContactMailTests.java
85aac915c7e464cc71e1a7c5b9698ac3fa2e1102
[ "Apache-2.0" ]
permissive
SweetyDonut/java_pft
da9f78b4b09f5849e821d13bd17b06a54e8d191e
777994895029b7aed0983c6458e6da57d542a5ae
refs/heads/master
2021-01-19T19:15:22.434055
2017-06-16T20:58:57
2017-06-16T20:58:57
88,408,935
0
0
null
null
null
null
UTF-8
Java
false
false
1,170
java
package ru.stqa.pft.addressbook.tests; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import ru.stqa.pft.addressbook.model.ContactData; import java.util.Arrays; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.*; /** * Created by Даниил on 10.06.2017. */ public class ContactMailTests extends TestBase { @BeforeMethod public void ensurePreconditions() { app.goTo().HomePage(); if (app.contact().all().size() == 0) { app.contact().create(new ContactData().withFirstname("Danil").withLastname("Babin")); } } @Test public void testContactMail(){ ContactData contact = app.contact().all().iterator().next(); ContactData contactInfoFromEditor = app.contact().infoFromEditForm(contact); assertThat(contact.getAllMails(), equalTo(getMergeMails(contactInfoFromEditor))); } private String getMergeMails(ContactData contact) { return Arrays.asList(contact.getMail(),contact.getMail2(),contact.getMail3()) .stream().filter((s -> !s.equals(""))) .collect(Collectors.joining("\n")); } }
[ "danilbabin@mail.ru" ]
danilbabin@mail.ru
0735e56c93f3340a8a01cf5e0629b57fcbf593b3
9194befd6b5b1ed427ba8553d49da36c9efc0da4
/src/main/java/com/memsource/demotestproject/config/MemsourceConfig.java
7c742484b5cec719839e640461e1a3a3a1e0686e
[]
no_license
Jahom55/memsource-demo
87d6c4a3ca7649acd8dd549e5e0f7a9d7a334788
810288a1ba7b871996516a9896f6d5fda84abd40
refs/heads/master
2023-06-22T17:03:14.019289
2020-08-10T13:25:59
2020-08-10T13:36:31
286,481,997
0
0
null
2023-06-19T17:08:31
2020-08-10T13:24:16
Java
UTF-8
Java
false
false
740
java
package com.memsource.demotestproject.config; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; @Component @Data @AllArgsConstructor @NoArgsConstructor @Configuration @ConfigurationProperties("memsource") public class MemsourceConfig { private String baseUrl; private String loginUrl; private String projectsUrl; private Login login; @Data @AllArgsConstructor @NoArgsConstructor public static class Login { private String username; private String password; } }
[ "homolkajaromir@gmail.com" ]
homolkajaromir@gmail.com
70dd097ea4707aadde02d638ce2d6b65dc9b07bb
07c47485051bea8faec924fb1bf13336ae48856f
/PaintSourceCodeDemo/app/src/main/java/com/dyx/pscd/MainActivity.java
1a0ff420dd1035ceb0ae3e5ee4dcedd7a04463ab
[]
no_license
caozhen456521/BlogCode
e10322a7453912445797d40ed6dfc8bb825550b0
a5bb63ef5193cb827e56ccea5ce17be877714589
refs/heads/master
2020-06-27T12:38:33.564498
2018-10-19T17:02:13
2018-10-19T17:02:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package com.dyx.pscd; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "dayongxin@aliyun.com" ]
dayongxin@aliyun.com
9e412e76bba30cdbd63cf6cfc7c96bb358743353
6d00c76588e6e8c129391b566920b24e119d48b6
/src/com/arpit/iitg/presentsir/AutoUpdateBunkMeter.java
c9df9947309e890b7e82f632d985f18fb742adc5
[]
no_license
calvincodes/PresentSir
38ebc80650893f0c15659df3e698ef96141533ba
5f4e3402b85c9cfa15b124233c72012ec0f3407f
refs/heads/master
2020-12-21T09:46:49.130793
2020-01-26T23:24:06
2020-01-26T23:24:06
236,389,997
0
0
null
null
null
null
UTF-8
Java
false
false
4,370
java
package com.arpit.iitg.presentsir; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; import android.os.Vibrator; import android.util.TypedValue; import android.widget.TextView; public class AutoUpdateBunkMeter extends Activity { int hours; String today; TextView auto_update_tv; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.auto_bm_count_update_page); android.app.ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); Drawable action_bar_bg = getResources().getDrawable(R.drawable.sides_chalkboard); actionBar.setBackgroundDrawable(action_bar_bg); Typeface comic_font = Typeface.createFromAsset(getAssets(),"fonts/Action_Man.ttf"); int titleId = getResources().getIdentifier("action_bar_title", "id", "android"); TextView app_title_tv = (TextView) findViewById(titleId); app_title_tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); app_title_tv.setTypeface(comic_font); SharedPreferences sound_prefs_sp = getSharedPreferences("SoundPrefs",Context.MODE_PRIVATE); int sound_val = sound_prefs_sp.getInt("sound_pref", 1); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification); if(sound_val == 1){ // Vib + Mel v.vibrate(1500); // Vibrate for 1000 milliseconds = 1.5 sec r.play(); // Play the current ringtone of the phone }else if(sound_val == 2){ // Mel only r.play(); }else if(sound_val == 3){ // Vib only v.vibrate(1500); } hours = getIntent().getExtras().getInt("hours"); auto_update_tv = (TextView) findViewById(R.id.auto_update_notification_tv); auto_update_tv.setTypeface(comic_font); SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE", Locale.US); Calendar calendar = Calendar.getInstance(); today = dayFormat.format(calendar.getTime()); // Get today's day String slot_to_show = null; switch(hours){ case 9: slot_to_show = "8to9"; break; case 10: slot_to_show = "9to10"; break; case 11: slot_to_show = "10to11"; break; case 12: slot_to_show = "11to12"; break; case 13: slot_to_show = "12to1"; break; case 14: slot_to_show = "1to2"; break; case 15: slot_to_show = "2to3"; break; case 16: slot_to_show = "3to4"; break; case 17: slot_to_show = "4to5"; break; case 18: slot_to_show = "5to6"; break; case 19: slot_to_show = "6to7"; break; } SharedPreferences open_tt_to_incr_bm = getApplicationContext().getSharedPreferences(today,Context.MODE_PRIVATE); SharedPreferences incr_bunk_sp = getSharedPreferences(open_tt_to_incr_bm.getString("name_" + slot_to_show,"N/A"),Context.MODE_PRIVATE); SharedPreferences.Editor edit_bunk_counter = incr_bunk_sp.edit(); String set_update_msg = "No Response!\nWe assumed you bunked "+open_tt_to_incr_bm.getString("name_" + slot_to_show,"N/A")+" ("+ open_tt_to_incr_bm.getString("num_" + slot_to_show,"N/A")+ ") class. If you attended the class, decrease the bunk meter manually"; auto_update_tv.setText(set_update_msg); int last_bunk_count = incr_bunk_sp.getInt("bunk_count", 0); edit_bunk_counter.putInt("bunk_count", (last_bunk_count+1)); edit_bunk_counter.commit(); } @Override public void onBackPressed() { go_to_home(); } private void go_to_home() { Intent home_screen = new Intent(AutoUpdateBunkMeter.this, AppHome.class); home_screen.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(home_screen); finish(); } }
[ "arpitjain1821@gmail.com" ]
arpitjain1821@gmail.com
7a1bf43438dab337727bcc1051969043d660c0d6
cef6fd979b7b9723460ee30e5f5cdbb306c6c0f9
/src/ParticleArray.java
01afeb316668de127a09c3cab9cfa52779fb7378
[]
no_license
roboman2444/nbody
1860a8383525d8d388ce6edd3a69735585ddf794
1a0586a3d810ff354779b3ff0cc6da79a36c1228
refs/heads/master
2020-08-25T03:30:13.630497
2013-07-29T02:38:56
2013-07-29T02:38:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,955
java
public class ParticleArray { public static float[] posx; public static float[] posy; public static float[] posz; public static float[] velx; public static float[] vely; public static float[] velz; public static float[] colr; public static float[] colb; public static float[] colg; public static float[] mass; public static int[] suns = new int[2]; public static void spawnSun(int i){ suns[0] = i; posx[i] = 0f; posy[i] = 0f; posz[i] = 0f; velx[i] = 0f; vely[i] = 0f; velz[i] = 0f; mass[i] = 100f; } public static void spawnSun2(int i){ suns[1] = i; posx[i] = 21f; posy[i] = 20f; posz[i] = 2f; velx[i] = -0.01f; vely[i] = -0.01f; velz[i] = 0f; mass[i] = 200f; } public static void spawnGalaxy(int n){ for(int i=0;i < n; i++){ velx[i] = 0.0f; vely[i] = 0.0f; velx[i] += (float) -(posy[i]/50); vely[i] += (float) (posx[i]/50); velz[i] = 0.0f; posz[i] = 0.0f; } } public static void spawnGalaxy2(int n){ for(int i=0;i < n; i++){ velx[i] = -0.01f; vely[i] = -0.01f; velx[i] += (float) -(posy[i]/30); vely[i] += (float) (posx[i]/30); velz[i] = 0.0f; posz[i] = 0.0f; posx[i] += 21; posy[i] += 20; posz[i] += 2; } } public static void spawnParticleRandom(int n){ posx = new float[n]; posy = new float[n]; posz = new float[n]; velx = new float[n]; vely = new float[n]; velz = new float[n]; colr = new float[n]; colb = new float[n]; colg = new float[n]; mass = new float[n]; for(int i=0;i < n; i++){ posx[i] = (float) (Math.random()-0.5); posy[i] = (float) (Math.random()-0.5); posz[i] = (float) (Math.random()-0.5); velx[i] = (float) ((Math.random()-0.5)/500); vely[i] = (float) ((Math.random()-0.5)/500); velz[i] = (float) ((Math.random()-0.5)/500); colr[i] = (float) (Math.random()); colg[i] = (float) (Math.random()); colb[i] = (float) (Math.random()); mass[i] = (float) (Math.random()); } } public static void getnBodyVelocityChange(float timescale,int p){ float acceleration, deltax, deltay, deltaz, distance; for(int i=0; i< nbody.numberofparticles; i++){ if(i == p) continue;//dont do crackulations against self deltax = posx[p] - posx[i]; deltay = posy[p] - posy[i]; deltaz = posz[p] - posz[i]; //distance = (float) Math.sqrt(Math.pow(deltax, 2)+Math.pow(deltay, 2)+Math.pow(deltaz, 2)); // shits SLOW distance = (float) Math.sqrt((deltax * deltax)+(deltay*deltay)+(deltaz*deltaz)); acceleration = (mass[i] / (distance))/10000000; velx[p] -= (deltax/distance) * acceleration; vely[p] -= (deltay/distance) * acceleration; velz[p] -= (deltaz/distance) * acceleration; } } public static void updatePositions(float timescale, int p){ posx[p] += velx[p]*timescale; posy[p] += vely[p]*timescale; posz[p] += velz[p]*timescale; } }
[ "roboman2444@gmail.com" ]
roboman2444@gmail.com
37f4bae5b07c77df33a8aa5820e48ac37db34af0
6e0fe0c6b38e4647172259d6c65c2e2c829cdbc5
/modules/base/indexing-impl/src/main/java/com/intellij/psi/search/GlobalSearchScopeUtil.java
77549114f739be90bedfd219d6651f8ce0d11db9
[ "Apache-2.0", "LicenseRef-scancode-jgraph" ]
permissive
TCROC/consulo
3f9a6df84e0fbf2b6211457b8a5f5857303b3fa6
cda24a03912102f916dc06ffce052892a83dd5a7
refs/heads/master
2023-01-30T13:19:04.216407
2020-12-06T16:57:00
2020-12-06T16:57:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,115
java
/* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.psi.search; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.util.containers.ContainerUtil; import javax.annotation.Nonnull; import java.util.LinkedHashSet; import java.util.Set; public class GlobalSearchScopeUtil { @Nonnull public static GlobalSearchScope toGlobalSearchScope(@Nonnull final SearchScope scope, @Nonnull Project project) { if (scope instanceof GlobalSearchScope) { return (GlobalSearchScope)scope; } return ApplicationManager.getApplication() .runReadAction((Computable<GlobalSearchScope>)() -> GlobalSearchScope.filesScope(project, getLocalScopeFiles((LocalSearchScope)scope))); } @Nonnull public static Set<VirtualFile> getLocalScopeFiles(@Nonnull final LocalSearchScope scope) { return ApplicationManager.getApplication().runReadAction((Computable<Set<VirtualFile>>)() -> { Set<VirtualFile> files = new LinkedHashSet<>(); for (PsiElement element : scope.getScope()) { PsiFile file = element.getContainingFile(); if (file != null) { ContainerUtil.addIfNotNull(files, file.getVirtualFile()); ContainerUtil.addIfNotNull(files, file.getNavigationElement().getContainingFile().getVirtualFile()); } } return files; }); } }
[ "vistall.valeriy@gmail.com" ]
vistall.valeriy@gmail.com
2afa6a613554c962922c41bf20c19a382a01e0a7
3ba7ac115976d891a041a58cad53e4be0beb7c50
/src/org/rs2server/rs2/packet/InspectPacket.java
2be9c513b69eec6c42a7c07a336a6baaab776767
[ "MIT" ]
permissive
Hueyrs/GAPOOoapskpogaskpokpogkpogPOKAGKPgkpgsakpagkpoagokpgokpgakpopoagskgassasasagg
8a27c1970dde36c67057c25d1810e32e91878039
c568043e36b7051eee3865df73dfe6c24caf3595
refs/heads/master
2021-01-19T10:20:08.984644
2012-01-01T16:50:35
2012-01-01T16:50:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package org.rs2server.rs2.packet; import org.rs2server.rs2.model.Player; import org.rs2server.rs2.net.Packet; public class InspectPacket implements PacketHandler { @Override public void handle(Player player, Packet packet) { player.getActionSender().sendMessage("Your dragonfire shield currently has: " + player.dfsCharges + " charge(s)"); } }
[ "mrbornking@gmail.com" ]
mrbornking@gmail.com
acc4252ab26004c529515bfcacd4a73c03849838
dbad3213f6544564d580932e20dca31c7c1943da
/src/org/apache/catalina/storeconfig/StoreRegistry.java
7fb6e21e61f219cc58b35b0e7b258548ebac5452
[]
no_license
Lyon1994/MyTomcatServerApp
0ef3db59bc3bc0ecdbd35e4d616ca75d082420be
37304fdfa03a7d03f119ae7eaa54f13539021b50
refs/heads/master
2021-01-19T03:19:02.243034
2015-07-28T06:21:44
2015-07-28T06:58:51
39,816,568
1
0
null
null
null
null
UTF-8
Java
false
false
6,537
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.storeconfig; import java.util.HashMap; import java.util.Map; import javax.naming.directory.DirContext; import org.apache.catalina.CredentialHandler; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Manager; import org.apache.catalina.Realm; import org.apache.catalina.Valve; import org.apache.catalina.WebResourceRoot; import org.apache.catalina.WebResourceSet; import org.apache.catalina.ha.CatalinaCluster; import org.apache.catalina.ha.ClusterDeployer; import org.apache.catalina.ha.ClusterListener; import org.apache.catalina.tribes.Channel; import org.apache.catalina.tribes.ChannelInterceptor; import org.apache.catalina.tribes.ChannelReceiver; import org.apache.catalina.tribes.ChannelSender; import org.apache.catalina.tribes.Member; import org.apache.catalina.tribes.MembershipService; import org.apache.catalina.tribes.MessageListener; import org.apache.catalina.tribes.transport.DataSender; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; /** * Central StoreRegistry for all server.xml elements */ public class StoreRegistry { private static Log log = LogFactory.getLog(StoreRegistry.class); private Map<String, StoreDescription> descriptors = new HashMap<>(); private String encoding = "UTF-8"; private String name; private String version; // Access Information private static Class<?> interfaces[] = { CatalinaCluster.class, ChannelSender.class, ChannelReceiver.class, Channel.class, MembershipService.class, ClusterDeployer.class, Realm.class, Manager.class, DirContext.class, LifecycleListener.class, Valve.class, ClusterListener.class, MessageListener.class, DataSender.class, ChannelInterceptor.class, Member.class, WebResourceRoot.class, WebResourceSet.class, CredentialHandler.class }; /** * @return Returns the name. */ public String getName() { return name; } /** * @param name * The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the version. */ public String getVersion() { return version; } /** * @param version * The version to set. */ public void setVersion(String version) { this.version = version; } /** * Find a description for id. Handle interface search when no direct match * found. * * @param id * @return The description */ public StoreDescription findDescription(String id) { if (log.isDebugEnabled()) log.debug("search descriptor " + id); StoreDescription desc = descriptors.get(id); if (desc == null) { Class<?> aClass = null; try { aClass = Class.forName(id, true, this.getClass() .getClassLoader()); } catch (ClassNotFoundException e) { log.error("ClassName:" + id, e); } if (aClass != null) { desc = descriptors.get(aClass.getName()); for (int i = 0; desc == null && i < interfaces.length; i++) { if (interfaces[i].isAssignableFrom(aClass)) { desc = descriptors.get(interfaces[i].getName()); } } } } if (log.isDebugEnabled()) if (desc != null) log.debug("find descriptor " + id + "#" + desc.getTag() + "#" + desc.getStoreFactoryClass()); else log.debug(("Can't find descriptor for key " + id)); return desc; } /** * Find Description by class * * @param aClass * @return The description */ public StoreDescription findDescription(Class<?> aClass) { return findDescription(aClass.getName()); } /** * Find factory from classname * * @param aClassName * @return The factory */ public IStoreFactory findStoreFactory(String aClassName) { StoreDescription desc = findDescription(aClassName); if (desc != null) return desc.getStoreFactory(); else return null; } /** * find factory from class * * @param aClass * @return The factory */ public IStoreFactory findStoreFactory(Class<?> aClass) { return findStoreFactory(aClass.getName()); } /** * Register a new description * * @param desc */ public void registerDescription(StoreDescription desc) { String key = desc.getId(); if (key == null || "".equals(key)) key = desc.getTagClass(); descriptors.put(key, desc); if (log.isDebugEnabled()) log.debug("register store descriptor " + key + "#" + desc.getTag() + "#" + desc.getTagClass()); } public StoreDescription unregisterDescription(StoreDescription desc) { String key = desc.getId(); if (key == null || "".equals(key)) key = desc.getTagClass(); return descriptors.remove(key); } // Attributes /** * @return The encoding */ public String getEncoding() { return encoding; } /** * @param string */ public void setEncoding(String string) { encoding = string; } }
[ "765211630@qq.com" ]
765211630@qq.com
2f7516eab7a96f379fb46f965cfc802cdacf5f60
e380a3272dd6bbcf85add30dca25f072e1ef0ca2
/src/org/vanda/workflows/hyper/SyntaxAnalysis.java
ee3f92e59e385dc71324c7143a2b67582745bb1b
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
mbuechse/vanda-studio
52b3aa7164d7998b096e415cc1ce37541e277053
4e9d3545304d02c9656c80cdcda1dc7b9875883c
refs/heads/master
2020-05-06T14:04:40.065781
2019-03-13T07:33:53
2019-03-13T07:33:53
180,171,443
0
0
BSD-3-Clause
2019-04-08T14:51:01
2019-04-08T14:51:01
null
UTF-8
Java
false
false
1,759
java
package org.vanda.workflows.hyper; import java.util.Collections; import java.util.Comparator; import java.util.Map; import org.vanda.types.Type; import org.vanda.util.MultiplexObserver; import org.vanda.workflows.hyper.TopSorter.TopSortException; /** * Performs type checking and topological sorting of a Workflow, and stores the results * @author kgebhardt * */ public class SyntaxAnalysis { private MutableWorkflow hwf; private Map<Object, Type> types = Collections.emptyMap(); private Type fragmentType = null; private MultiplexObserver<SyntaxAnalysis> syntaxChangedObservable; protected Job[] sorted = null; private final Comparator<Job> priorities; public SyntaxAnalysis(MutableWorkflow hwf, Comparator<Job> priorities) { this.hwf = hwf; this.priorities = priorities; syntaxChangedObservable = new MultiplexObserver<SyntaxAnalysis>(); try { checkWorkflow(); } catch (Exception e) { // do nothing } } public SyntaxAnalysis(MutableWorkflow hwf) { this(hwf, null); } public void typeCheck() throws TypeCheckingException { TypeChecker tc = new TypeChecker(); hwf.typeCheck(tc); tc.check(); types = tc.getTypes(); fragmentType = tc.getFragmentType(); } public void checkWorkflow() throws TypeCheckingException, TopSortException { sorted = null; typeCheck(); if (priorities != null) sorted = hwf.getSorted(priorities); else sorted = hwf.getSorted(); syntaxChangedObservable.notify(this); } public Job[] getSorted() { return sorted; } public Type getFragmentType() { return fragmentType; } public Type getType(Object variable) { return types.get(variable); } public MultiplexObserver<SyntaxAnalysis> getSyntaxChangedObservable() { return syntaxChangedObservable; } }
[ "kilian.gebhardt@mailbox.tu-dresden.de" ]
kilian.gebhardt@mailbox.tu-dresden.de
ee7349e22b2700fcb4d1ee0f9ee767990797af7c
1bbc5c34520b3fa1992994441d475d3c25544f1f
/src/Sistem/makePreview.java
a03977ed14eaaa44fe7f38b3f1ed77bb02bda738
[]
no_license
fidiarya/inventory_telkom_akses
7a93d15e1576794a0bd274ab8f553fdeaae561f2
d99e06f6db494a1b56e90661cb7fbd944516f87e
refs/heads/master
2023-02-18T05:14:01.498242
2021-01-23T12:58:35
2021-01-23T12:58:35
317,589,864
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
package Sistem; import java.io.File; import java.sql.Connection; import java.util.HashMap; import javax.swing.JOptionPane; import mainkoneksi.Koneksi; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.view.JasperViewer; public class makePreview { public void makePreview (String vName){ try { String KopLaporan = getClass().getResource("/IMG/icon_telkom.png").toString(); // String User = getClass().getResource("txUser.getText()").toString(); String locFile = "src/report/"; String namaFile = locFile + vName + ".jasper"; Connection conn = new Koneksi().connect(); HashMap parameter = new HashMap(); parameter.put("Logo", KopLaporan); // parameter.put("txUser", User); File report_file = new File (namaFile); JasperReport jasperReport = (JasperReport) JRLoader.loadObject(report_file.getPath()); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameter, conn); JasperViewer.viewReport(jasperPrint, false ); JasperViewer.setDefaultLookAndFeelDecorated(true); } catch (Exception e){ JOptionPane.showMessageDialog(null, e.getMessage()); } } }
[ "fidiarya@gmail.com" ]
fidiarya@gmail.com
fc2e4a872326d6de28546defab4202fb2f7db380
9ff81eac90a3cfcb6bc4e4d174cb324c29b73464
/CCF_Java/src/_2017/_12/_1/Main.java
a15717fbb62c05cc7b1f0d265067534ae865f007
[]
no_license
shuxiaoyuan/CCF_Java
37d12f33499f03a8af57973c9770e953bf6ed37c
048fe752518f26b5ac16d38b2cbcbad50828e0a1
refs/heads/master
2020-03-27T23:49:17.298742
2018-09-08T11:31:24
2018-09-08T11:31:24
147,349,380
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package _2017._12._1; import java.util.Arrays; import java.util.Scanner; // 最小差值 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] nums = new int[n]; for(int i = 0; i < n; i++) { nums[i] = sc.nextInt(); } Arrays.sort(nums); int res = 10000; for(int i = 0; i < n-1; i++) { int diff = nums[i+1] - nums[i]; if(diff < res) { res = diff; } } System.out.println(res); sc.close(); } }
[ "1362521868@qq.com" ]
1362521868@qq.com
20fc940480d035031a937c0b6a30c18a6514608b
3a82fbfd7550f1a5f979d4a4e7c9b28070395c43
/app/src/test/java/com/appsmontreal/menu2/ExampleUnitTest.java
ebdee468cabf48aa3a69403c5f00c958987ccee3
[]
no_license
michukanyto/Menu
81b850fd04adcb5603acf5fc0f140cabaaf301c2
08de108a69c68ee75297ffbae71c26980127d305
refs/heads/master
2020-04-22T18:53:10.406470
2019-02-14T21:31:41
2019-02-14T21:31:41
170,590,570
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package com.appsmontreal.menu2; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "escobar.marlon@gmail.com" ]
escobar.marlon@gmail.com
36268266e348ed4c4fe4a7cb681cc78f356e1678
d0c2e07934c3f8c8a13d9bcfdbd7afb8715dc341
/3-spring/projects/conferene-spring/src/main/java/dev/syscode/conference/repository/SpeakerRepository.java
abd21dc8d4b33583de2ce8ec973e9ffaddce57d0
[]
no_license
gnujavasergio/spring-experiments
5cc5ddc41ed7f89a91610a4cf7588570790983ee
1c133ae7f1e3c1d61ae87f05d69ac25e7ca96732
refs/heads/master
2022-09-01T10:14:00.235661
2022-08-11T15:43:53
2022-08-11T15:43:53
250,904,395
0
0
null
null
null
null
UTF-8
Java
false
false
179
java
package dev.syscode.conference.repository; import dev.syscode.conference.model.Speaker; import java.util.List; public interface SpeakerRepository { List<Speaker> findAll(); }
[ "sochoa@openkm.com" ]
sochoa@openkm.com
f9a2835285a855d8fa7c9fd9f40d325da9afbf34
57beb16f196058dcbc59888199494cf3d5277509
/Modul_3_String_and_basics_of_text_processing/src/m_2_object_String_or_StringBuilder/Task_03.java
9ec30a3eaa2cb75ce00786a95076b678dc996e23
[]
no_license
P1ethora/EPAM_training_online
65db496a912ce248531ff95df9524a69942f789b
1eae98f2cd78179a187c653881f6365a28890a6a
refs/heads/master
2021-05-20T12:28:06.822019
2020-11-02T21:14:19
2020-11-02T21:14:19
252,541,845
9
3
null
null
null
null
UTF-8
Java
false
false
671
java
package m_2_object_String_or_StringBuilder; /** * Проверить, является ли заданное слово палиндромом. */ public class Task_03 { public static void main(String[] args) { String word = "level", word1 = "java", word2 = "noon"; System.out.println(check(word) + "\n" + check(word1) + "\n" + check(word2)); } private static boolean check(String text) { while (text.length() > 1) { if (!text.endsWith(text.substring(0, 1))) return false; text = text.substring(1, text.length() - 1); } return true; } }
[ "54984087+PAL4D1N@users.noreply.github.com" ]
54984087+PAL4D1N@users.noreply.github.com
3afd0c6b934590dbad2ed6d36106232dd619602f
ad6f19b13a42dbfef86ea68e2ca5ca66d701d2ff
/src/test/java/ADV/EMCO/login2.java
5831e623f26e6b8a56998e422c33993d5478616b
[]
no_license
guptahitesh4u/Myfirst
8cb1977f51008680fae8e4fc54abd0877f9bdca7
6815058ce62d9cdb3968d666ee3403a35a822593
refs/heads/main
2023-06-14T05:24:25.798625
2021-06-23T04:01:07
2021-06-23T04:01:07
378,562,834
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package ADV.EMCO; import java.io.IOException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class login2 extends base { WebDriver driver; reusables reu=new reusables(); private static Logger log= LogManager.getLogger(login2.class.getName()); @BeforeTest public void preTest() throws IOException { driver = initializeDriver(); driver.get(prop.getProperty("url")); driver.manage().window().maximize(); log.info("URL Launched"); } @Test public void emcoLogin() throws IOException, IllegalArgumentException, IllegalAccessException { driver=reu.emcoLogin(driver); driver=reu.checkHeader(driver); driver=reu.workspace(driver); } @Test public void projectManagement() throws IOException, IllegalArgumentException, IllegalAccessException { } @AfterTest public void teardown() { driver.close(); } }
[ "hitesh.gupta@advantmed.com" ]
hitesh.gupta@advantmed.com
cb7388253c2d3e7d98740fc96bf637d5bc7cae3b
505445050d68cd1bcb63c1b38fc88c0dacc3de10
/admin/src/main/java/com/aojiaoo/core/shiro/realm/DbRealm.java
31dcc857bbf04e3363f06b8e71c199f44a3d9c9a
[]
no_license
puremdq/kissPlan
03b0e7f7c1eb0c862a151c84807d06468a372729
53a728cc911ac5e1249f139cd5517debd4e26205
refs/heads/master
2022-12-24T17:30:12.266260
2019-07-04T01:58:22
2019-07-04T01:58:22
157,180,418
1
0
null
2022-12-15T23:52:15
2018-11-12T08:29:45
Java
UTF-8
Java
false
false
2,675
java
package com.aojiaoo.core.shiro.realm; import com.aojiaoo.modules.sys.entity.User; import com.aojiaoo.modules.sys.service.UserService; import org.apache.commons.codec.digest.DigestUtils; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.List; public class DbRealm extends AuthorizingRealm { @Autowired UserService userService; /*授权时使用*/ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { // 从 principals获取主身份信息 // 将getPrimaryPrincipal方法返回值转为真实身份类型(在上边的doGetAuthenticationInfo认证通过填充到SimpleAuthenticationInfo中身份类型), User user = (User) principalCollection.getPrimaryPrincipal(); System.out.println(user); // 根据身份信息获取权限信息 // 连接数据库... // 模拟从数据库获取到数据 List<String> permissions = new ArrayList<String>(); permissions.add("user:create");// 用户的创建 permissions.add("items:add");// 商品添加权限 // .... // 查到权限数据,返回授权信息(要包括 上边的permissions) SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); // 将上边查询到授权信息填充到simpleAuthorizationInfo对象中 simpleAuthorizationInfo.addStringPermissions(permissions); simpleAuthorizationInfo.addRole("sd"); return simpleAuthorizationInfo; } /*登录时调用*/ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { //1.把AuthenticationToken转换为UsernamePasswordToken UsernamePasswordToken userToken = (UsernamePasswordToken) authenticationToken; User user = userService.getByUserName(userToken.getUsername()); //若用户不行存在,可以抛出UnknownAccountException if (user == null) { throw new UnknownAccountException("用户不存在"); } String afterMd5Password = DigestUtils.md5Hex(String.valueOf(userToken.getPassword()) + user.getSalt()); userToken.setPassword(afterMd5Password.toCharArray()); return new SimpleAuthenticationInfo(user, user.getPassword(), getName()); } }
[ "puremdq@gmail.com" ]
puremdq@gmail.com
fdc73fae90757b6ec54b7e8677273e5a5052beff
97635912078f3e3ebd0e0caa14684c9723e165b7
/gui_slidingbars/src/ent/dom/slidingbars/widget/AnimationLayout.java
7eb155ca6e82718dd06b55250f2ae25800aa2bb3
[]
no_license
Sjith/WorkspaceExamplesBackup
5afd3cc5bfd905bdec734bafc5441143bbcc6d7b
7dfa8217e21ba40f92be2409a110abf354d420ea
refs/heads/master
2021-01-18T07:57:07.848197
2013-02-25T14:29:31
2013-02-25T14:29:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,559
java
/* * Copyright (C) 2012 0xlab - http://0xlab.org/ * * 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. * * Authored by Julian Chu <walkingice AT 0xlab.org> */ package ent.dom.slidingbars.widget; // update the package name to match your app import ent.dom.slidingbars.R; import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.TranslateAnimation; import android.view.MotionEvent; import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; public class AnimationLayout extends ViewGroup { public final static int DURATION = 400; protected boolean mPlaceLeft=false; protected boolean mOpened; protected View mSidebar; protected View mContent; protected int mSidebarWidth = 150; /* assign default value. It will be overwrite in onMeasure by Layout xml resource. */ protected int mSidebarHeight = 150; protected Animation mAnimation; protected OpenListener mOpenListener; protected CloseListener mCloseListener; protected Listener mListener; int dir=0,constVal = 120; protected boolean mPressed = false; public AnimationLayout(Context context) { this(context, null); } public AnimationLayout(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onFinishInflate() { super.onFinishInflate(); mSidebar = findViewById(R.id.animation_layout_sidebar); mContent = findViewById(R.id.animation_layout_content); if (mSidebar == null) { throw new NullPointerException("no view id = animation_sidebar"); } if (mContent == null) { throw new NullPointerException("no view id = animation_content"); } mOpenListener = new OpenListener(mSidebar, mContent); mCloseListener = new CloseListener(mSidebar, mContent); } @Override public void onLayout(boolean changed, int l, int t, int r, int b) { /* the title bar assign top padding, drop it */ int sidebarLeft = l; if (!mPlaceLeft) { sidebarLeft = r - mSidebarWidth; } mSidebar.layout(sidebarLeft, 0, sidebarLeft + mSidebarWidth, 0 + mSidebar.getMeasuredHeight()); if (mOpened) { Log.d("mOpened","true"); if (mPlaceLeft) { mContent.layout(mSidebarWidth-constVal, mSidebarHeight-constVal,r+mSidebarWidth,b+mSidebarHeight); } else { //mContent.layout(-mSidebarWidth+constVal,mSidebarHeight-constVal,constVal,(r+(mSidebarHeight))); -- This is right top to left bottom animation mContent.layout(-mSidebarWidth+constVal,-mSidebarHeight+constVal,constVal,constVal); } } else { Log.d("mOpened","false"); if(mPlaceLeft) { mContent.layout(0, 0, mSidebarWidth, mSidebarHeight); } else { //mContent.layout(0, 0, mSidebarWidth, mSidebarHeight); -- This is right top to left bottom animation mContent.layout(0, 0, mSidebarWidth, mSidebarHeight); } } } @Override public void onMeasure(int w, int h) { super.onMeasure(w, h); super.measureChildren(w, h); mSidebarWidth = mSidebar.getMeasuredWidth(); mSidebarHeight = mSidebar.getMeasuredHeight(); } @Override protected void measureChild(View child, int parentWSpec, int parentHSpec) { /* the max width of Sidebar is 90% of Parent */ if (child == mSidebar) { int mode = MeasureSpec.getMode(parentWSpec); int width = (int)(getMeasuredWidth() * 1);//should be 0.9 int height = (int)(getMeasuredHeight() * 1);//should be 0.9 super.measureChild(child, MeasureSpec.makeMeasureSpec(width, mode), MeasureSpec.makeMeasureSpec(height, MeasureSpec.getMode(parentHSpec))); } else { super.measureChild(child, parentWSpec, parentHSpec); } } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (!isOpening()) { return false; } int action = ev.getAction(); if (action != MotionEvent.ACTION_UP && action != MotionEvent.ACTION_DOWN) { return false; } /* if user press and release both on Content while * sidebar is opening, call listener. otherwise, pass * the event to child. */ int x = (int)ev.getX(); int y = (int)ev.getY(); if (mContent.getLeft() < x && mContent.getRight() > x && mContent.getTop() < y && mContent.getBottom() > y) { if (action == MotionEvent.ACTION_DOWN) { mPressed = true; } if (mPressed && action == MotionEvent.ACTION_UP && mListener != null) { mPressed = false; return mListener.onContentTouchedWhenOpening(); } } else { mPressed = false; } return false; } public void setListener(Listener l) { mListener = l; } /* to see if the Sidebar is visible */ public boolean isOpening() { return mOpened; } public void toggleSidebar(int dir) { this.dir = dir; if(dir == 0) mPlaceLeft = true; else if(dir == 1) mPlaceLeft = false; if (mContent.getAnimation() != null) { return; } if (mOpened) { /* opened, make close animation*/ if (mPlaceLeft) { mAnimation = new TranslateAnimation(0,-(mSidebarWidth-constVal),0,-(mSidebarHeight-constVal)); } else { //mAnimation = new TranslateAnimation(0, mSidebarWidth-constVal, 0, -(mSidebarHeight-constVal)); -- This is right top to left bottom animation mAnimation = new TranslateAnimation(0, mSidebarWidth-constVal, 0, mSidebarHeight-constVal); //mAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.hyperspace_jump); } mAnimation.setAnimationListener(mCloseListener); } else { /* not opened, make open animation */ if (mPlaceLeft) { mAnimation = new TranslateAnimation(0, mSidebarWidth-constVal, 0, mSidebarHeight-constVal); } else { //mAnimation = new TranslateAnimation(0, -mSidebarWidth+constVal, 0, mSidebarHeight-constVal); -- This is right top to left bottom animation mAnimation = new TranslateAnimation(0, -mSidebarWidth+constVal, 0, -mSidebarHeight+constVal); } mAnimation.setAnimationListener(mOpenListener); } mAnimation.setDuration(DURATION); mAnimation.setFillAfter(true); mAnimation.setFillEnabled(true); mContent.startAnimation(mAnimation); } public void openSidebar() { if (!mOpened) { toggleSidebar(dir); } } public void closeSidebar() { if (mOpened) { toggleSidebar(dir); } } class OpenListener implements Animation.AnimationListener { View iSidebar; View iContent; OpenListener(View sidebar, View content) { iSidebar = sidebar; iContent = content; } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { iSidebar.setVisibility(View.VISIBLE); } public void onAnimationEnd(Animation animation) { iContent.clearAnimation(); mOpened = !mOpened; requestLayout(); if (mListener != null) { mListener.onSidebarOpened(); } } } class CloseListener implements Animation.AnimationListener { View iSidebar; View iContent; CloseListener(View sidebar, View content) { iSidebar = sidebar; iContent = content; } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } public void onAnimationEnd(Animation animation) { iContent.clearAnimation(); iSidebar.setVisibility(View.INVISIBLE); mOpened = !mOpened; requestLayout(); if (mListener != null) { mListener.onSidebarClosed(); } } } public interface Listener { public void onSidebarOpened(); public void onSidebarClosed(); public boolean onContentTouchedWhenOpening(); } }
[ "sandeep.gadde@dominionenterprises.com" ]
sandeep.gadde@dominionenterprises.com
51a437070da4c744017f33c438972daf678023d7
f78c2630cc4e1ec445534a6bb07e85567036d3d9
/src/main/java/com/cmr/hotshop/dao/UmsAdminLoginLogMapper.java
c436817db4df3b4e0bbd48fe3448044b1854243b
[]
no_license
chenmrU/hot_shop
007d283f3157b953fcd0539c3209baa8559dd091
bf3b4dae5347ff4e08b65ef5dfcd755bf8a05a8a
refs/heads/master
2020-11-28T18:09:35.421006
2020-01-11T03:11:14
2020-01-11T03:11:14
229,888,939
0
0
null
null
null
null
UTF-8
Java
false
false
985
java
package com.cmr.hotshop.dao; import com.cmr.hotshop.entity.UmsAdminLoginLog; import com.cmr.hotshop.entity.UmsAdminLoginLogExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface UmsAdminLoginLogMapper { long countByExample(UmsAdminLoginLogExample example); int deleteByExample(UmsAdminLoginLogExample example); int deleteByPrimaryKey(Long id); int insert(UmsAdminLoginLog record); int insertSelective(UmsAdminLoginLog record); List<UmsAdminLoginLog> selectByExample(UmsAdminLoginLogExample example); UmsAdminLoginLog selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") UmsAdminLoginLog record, @Param("example") UmsAdminLoginLogExample example); int updateByExample(@Param("record") UmsAdminLoginLog record, @Param("example") UmsAdminLoginLogExample example); int updateByPrimaryKeySelective(UmsAdminLoginLog record); int updateByPrimaryKey(UmsAdminLoginLog record); }
[ "chenmengrui@kp99.cn" ]
chenmengrui@kp99.cn
57b3de948f23efd6bba107b214bb8274fdc66275
ea74d502f1057a241b6cceabbe5c7e6cd0bc9d51
/src/com/fastjavaframework/listener/SystemSet.java
a3aa88bfda80ac4ca3eb19f0407073ccdbded3ef
[]
no_license
CRayFish07/fastjava
16f2fa94804780b5c04176936d71c48cc82e54b1
4409570c2710d58c1cc3cfeef703232820e16923
refs/heads/master
2021-01-20T16:38:39.655811
2017-06-26T10:24:54
2017-06-26T10:24:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
551
java
package com.fastjavaframework.listener; import org.springframework.context.ApplicationContext; public class SystemSet extends ContextLoader { @Override public void runBeforeContext(ApplicationContext context) { String projectPath = getClass().getResource("/").getFile().toString(); String[] projectPaths = projectPath.split("/WEB-INF")[0].split("/"); System.setProperty("project.name", projectPaths.length>0?projectPaths[projectPaths.length - 1]:"project"); } @Override public void runAferContext(ApplicationContext context) { } }
[ "slwangm@isoftstone.com" ]
slwangm@isoftstone.com
fde02b3b39cbac8d4a8171acb6ffd13262c69ed3
ad25232967a408cd58d1e3c49b939884f165a6c3
/app/src/main/java/baidumapsdk/demo/mybaidumap/PoiSearchDemo.java
b84556bc69ab405f0ef888bcb57dda60c99229a7
[]
no_license
aliliqu/BaiduMapsORTuYa
1951187b014447ca659783411c0abfccc118e98e
237ffa43ad56b459768544958c775a8d1be0bad4
refs/heads/master
2021-01-17T22:23:08.952504
2016-06-30T08:08:44
2016-06-30T08:08:50
62,290,265
0
0
null
null
null
null
UTF-8
Java
false
false
11,653
java
package baidumapsdk.demo.mybaidumap; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.EditText; import android.widget.Toast; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.CircleOptions; import com.baidu.mapapi.map.GroundOverlayOptions; import com.baidu.mapapi.map.MapStatusUpdate; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.OverlayOptions; import com.baidu.mapapi.map.Stroke; import com.baidu.mapapi.map.SupportMapFragment; import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.model.LatLngBounds; import com.baidu.mapapi.overlayutil.PoiOverlay; import com.baidu.mapapi.search.core.CityInfo; import com.baidu.mapapi.search.core.PoiInfo; import com.baidu.mapapi.search.core.SearchResult; import com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener; import com.baidu.mapapi.search.poi.PoiBoundSearchOption; import com.baidu.mapapi.search.poi.PoiCitySearchOption; import com.baidu.mapapi.search.poi.PoiDetailResult; import com.baidu.mapapi.search.poi.PoiDetailSearchOption; import com.baidu.mapapi.search.poi.PoiIndoorResult; import com.baidu.mapapi.search.poi.PoiNearbySearchOption; import com.baidu.mapapi.search.poi.PoiResult; import com.baidu.mapapi.search.poi.PoiSearch; import com.baidu.mapapi.search.poi.PoiSortType; import com.baidu.mapapi.search.sug.OnGetSuggestionResultListener; import com.baidu.mapapi.search.sug.SuggestionResult; import com.baidu.mapapi.search.sug.SuggestionSearch; import com.baidu.mapapi.search.sug.SuggestionSearchOption; import java.util.ArrayList; import java.util.List; import baidumapsdk.demo.R; /** * 演示poi搜索功能 */ public class PoiSearchDemo extends FragmentActivity implements OnGetPoiSearchResultListener, OnGetSuggestionResultListener { private PoiSearch mPoiSearch = null; private SuggestionSearch mSuggestionSearch = null; private BaiduMap mBaiduMap = null; private List<String> suggest; /** * 搜索关键字输入窗口 */ //搜索城市 输入框 private EditText editCity = null; //根据输入文字更改的 private AutoCompleteTextView keyWorldsView = null; private ArrayAdapter<String> sugAdapter = null; private int loadIndex = 0; // LatLng center = new LatLng(39.92235, 116.380338); int radius = 500; LatLng southwest = new LatLng( 39.92235, 116.380338 ); LatLng northeast = new LatLng( 39.947246, 116.414977); LatLngBounds searchbound = new LatLngBounds.Builder().include(southwest).include(northeast).build(); int searchType = 0; // 搜索的类型,在显示时区分 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_poisearch); // 初始化搜索模块, mPoiSearch = PoiSearch.newInstance(); //注册搜索事件监听 mPoiSearch.setOnGetPoiSearchResultListener(this); // 初始化建议搜索模块 mSuggestionSearch = SuggestionSearch.newInstance(); //注册建议搜索事件监听 mSuggestionSearch.setOnGetSuggestionResultListener(this); editCity = (EditText) findViewById(R.id.city); keyWorldsView = (AutoCompleteTextView) findViewById(R.id.searchkey); sugAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line); keyWorldsView.setAdapter(sugAdapter); keyWorldsView.setThreshold(1); mBaiduMap = ((SupportMapFragment) (getSupportFragmentManager() .findFragmentById(R.id.map))).getBaiduMap(); /** * 当输入关键字变化时,动态更新建议列表 */ keyWorldsView.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { if (cs.length() <= 0) { return; } /** * 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新 */ mSuggestionSearch .requestSuggestion((new SuggestionSearchOption()) .keyword(cs.toString()).city(editCity.getText().toString())); } }); } @Override protected void onPause() { super.onPause(); } @Override protected void onResume() { super.onResume(); } @Override protected void onDestroy() { mPoiSearch.destroy(); mSuggestionSearch.destroy(); super.onDestroy(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); } /** * 响应城市内搜索按钮点击事件 * * @param v */ public void searchButtonProcess(View v) { searchType = 1; String citystr = editCity.getText().toString(); String keystr = keyWorldsView.getText().toString(); mPoiSearch.searchInCity((new PoiCitySearchOption()) .city(citystr).keyword(keystr).pageNum(loadIndex)); } /** * 响应周边搜索按钮点击事件 * * @param v */ public void searchNearbyProcess(View v) { searchType = 2; PoiNearbySearchOption nearbySearchOption = new PoiNearbySearchOption().keyword(keyWorldsView.getText() .toString()).sortType(PoiSortType.distance_from_near_to_far).location(center) .radius(radius).pageNum(loadIndex); mPoiSearch.searchNearby(nearbySearchOption); } public void goToNextPage(View v) { loadIndex++; searchButtonProcess(null); } /** * 响应区域搜索按钮点击事件 * * @param v */ public void searchBoundProcess(View v) { searchType = 3; mPoiSearch.searchInBound(new PoiBoundSearchOption().bound(searchbound) .keyword(keyWorldsView.getText().toString())); } /** * 获取POI搜索结果,包括searchInCity,searchNearby,searchInBound返回的搜索结果 * @param result */ public void onGetPoiResult(PoiResult result) { if (result == null || result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(PoiSearchDemo.this, "未找到结果", Toast.LENGTH_LONG) .show(); return; } if (result.error == SearchResult.ERRORNO.NO_ERROR) { mBaiduMap.clear(); PoiOverlay overlay = new MyPoiOverlay(mBaiduMap); mBaiduMap.setOnMarkerClickListener(overlay); overlay.setData(result); overlay.addToMap(); overlay.zoomToSpan(); switch( searchType ) { case 2: showNearbyArea(center, radius); break; case 3: showBound(searchbound); break; default: break; } return; } if (result.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) { // 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表 String strInfo = "在"; for (CityInfo cityInfo : result.getSuggestCityList()) { strInfo += cityInfo.city; strInfo += ","; } strInfo += "找到结果"; Toast.makeText(PoiSearchDemo.this, strInfo, Toast.LENGTH_LONG) .show(); } } /** * 获取POI详情搜索结果,得到searchPoiDetail返回的搜索结果 * @param result */ public void onGetPoiDetailResult(PoiDetailResult result) { if (result.error != SearchResult.ERRORNO.NO_ERROR) { Toast.makeText(PoiSearchDemo.this, "抱歉,未找到结果", Toast.LENGTH_SHORT) .show(); } else { Toast.makeText(PoiSearchDemo.this, result.getName() + ": " + result.getAddress(), Toast.LENGTH_SHORT) .show(); } } @Override public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) { } /** * 获取在线建议搜索结果,得到requestSuggestion返回的搜索结果 * @param res */ @Override public void onGetSuggestionResult(SuggestionResult res) { if (res == null || res.getAllSuggestions() == null) { return; } suggest = new ArrayList<String>(); for (SuggestionResult.SuggestionInfo info : res.getAllSuggestions()) { if (info.key != null) { suggest.add(info.key); } } sugAdapter = new ArrayAdapter<String>(PoiSearchDemo.this, android.R.layout.simple_dropdown_item_1line, suggest); keyWorldsView.setAdapter(sugAdapter); sugAdapter.notifyDataSetChanged(); } private class MyPoiOverlay extends PoiOverlay { public MyPoiOverlay(BaiduMap baiduMap) { super(baiduMap); } @Override public boolean onPoiClick(int index) { super.onPoiClick(index); PoiInfo poi = getPoiResult().getAllPoi().get(index); // if (poi.hasCaterDetails) { mPoiSearch.searchPoiDetail((new PoiDetailSearchOption()) .poiUid(poi.uid)); // } return true; } } /** * 对周边检索的范围进行绘制 * @param center * @param radius */ public void showNearbyArea( LatLng center, int radius) { BitmapDescriptor centerBitmap = BitmapDescriptorFactory .fromResource(R.drawable.icon_geo); MarkerOptions ooMarker = new MarkerOptions().position(center).icon(centerBitmap); mBaiduMap.addOverlay(ooMarker); OverlayOptions ooCircle = new CircleOptions().fillColor( 0xCCCCCC00 ) .center(center).stroke(new Stroke(5, 0xFFFF00FF )) .radius(radius); mBaiduMap.addOverlay(ooCircle); } /** * 对区域检索的范围进行绘制 * @param bounds */ public void showBound( LatLngBounds bounds) { BitmapDescriptor bdGround = BitmapDescriptorFactory .fromResource(R.drawable.ground_overlay); OverlayOptions ooGround = new GroundOverlayOptions() .positionFromBounds(bounds).image(bdGround).transparency(0.8f); mBaiduMap.addOverlay(ooGround); MapStatusUpdate u = MapStatusUpdateFactory .newLatLng(bounds.getCenter()); mBaiduMap.setMapStatus(u); bdGround.recycle(); } }
[ "122085846@qq.com" ]
122085846@qq.com
ae0f06dc68fcec0b5728e7b5d53c927409bb6a54
93f44ee976fd6d1c42663e1fb0f72aed80c2dc89
/Day0511MON/src/Person/President.java
6fb02b0d200d7ac24d0251369b7fabd16fc16dbb
[]
no_license
jaedeokhan/dcusl-20-1-web-developer
87a56fd70f8e17bad6af94ee3cb6fe19893dcf54
548b7f5dde4cf29999743680a29205652d353399
refs/heads/master
2022-10-16T23:40:10.284260
2020-06-19T15:07:43
2020-06-19T15:07:43
255,309,880
0
0
null
null
null
null
UTF-8
Java
false
false
168
java
package Person; public class President extends Person{ @Override public void showSleepingStyel() { System.out.println("대통령도 그냥 사람이다."); } }
[ "dgd03023@cu.ac.kr" ]
dgd03023@cu.ac.kr
22ce34828ac2e4c17034eb8d0f914ec432d97e5a
3a6c9d1dc936cd6596d686793cb973a97445db70
/src/main/java/com/store/com/security/jwt/TokenProvider.java
4ad294a13d757b24e373646677bc76ffdd3c1a4a
[]
no_license
ANDERSON1808/store
7b3bb2f2781f852be8e5a25aa70c28c25e5ba934
5a2f67ef8ea50733448ca1c7f5a204fccd4a3395
refs/heads/main
2023-05-02T07:47:34.257298
2021-05-29T03:18:50
2021-05-29T03:18:50
371,864,498
0
0
null
null
null
null
UTF-8
Java
false
false
4,214
java
package com.store.com.security.jwt; import java.nio.charset.StandardCharsets; import java.security.Key; import java.util.*; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import io.github.jhipster.config.JHipsterProperties; import io.jsonwebtoken.*; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; @Component public class TokenProvider { private final Logger log = LoggerFactory.getLogger(TokenProvider.class); private static final String AUTHORITIES_KEY = "auth"; private Key key; private long tokenValidityInMilliseconds; private long tokenValidityInMillisecondsForRememberMe; private final JHipsterProperties jHipsterProperties; public TokenProvider(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; } @PostConstruct public void init() { byte[] keyBytes; String secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret(); if (!StringUtils.isEmpty(secret)) { log.warn("Warning: the JWT key used is not Base64-encoded. " + "We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security."); keyBytes = secret.getBytes(StandardCharsets.UTF_8); } else { log.debug("Using a Base64-encoded JWT secret key"); keyBytes = Decoders.BASE64.decode(jHipsterProperties.getSecurity().getAuthentication().getJwt().getBase64Secret()); } this.key = Keys.hmacShaKeyFor(keyBytes); this.tokenValidityInMilliseconds = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds(); this.tokenValidityInMillisecondsForRememberMe = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt() .getTokenValidityInSecondsForRememberMe(); } public String createToken(Authentication authentication, boolean rememberMe) { String authorities = authentication.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); long now = (new Date()).getTime(); Date validity; if (rememberMe) { validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe); } else { validity = new Date(now + this.tokenValidityInMilliseconds); } return Jwts.builder() .setSubject(authentication.getName()) .claim(AUTHORITIES_KEY, authorities) .signWith(key, SignatureAlgorithm.HS512) .setExpiration(validity) .compact(); } public Authentication getAuthentication(String token) { Claims claims = Jwts.parserBuilder() .setSigningKey(key) .build() .parseClaimsJws(token) .getBody(); Collection<? extends GrantedAuthority> authorities = Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(",")) .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); User principal = new User(claims.getSubject(), "", authorities); return new UsernamePasswordAuthenticationToken(principal, token, authorities); } public boolean validateToken(String authToken) { try { Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(authToken); return true; } catch (JwtException | IllegalArgumentException e) { log.info("Invalid JWT token."); log.trace("Invalid JWT token trace.", e); } return false; } }
[ "programador.junior7@interedes.com.co" ]
programador.junior7@interedes.com.co
d71144ca0b38647e55ae92dbfa06afa71736fd9c
bb21a6c41649faf4d53c05a479ee221b57f3c570
/app/src/main/java/com/hencoder/hencoderpracticedraw2/practice/Practice13ShadowLayerView.java
a9fd0d2ea4c21a1ee0edb6cedd78c50e312ec2f9
[]
no_license
bihailantian/PracticeDraw2-master
af19045485c6bc6e1a0a2907ad5caa57fcd81f56
2451182947739130dd52eff757cba9320652df01
refs/heads/master
2021-08-16T22:08:44.215800
2017-11-20T11:38:50
2017-11-20T11:38:50
111,402,761
0
0
null
null
null
null
UTF-8
Java
false
false
1,065
java
package com.hencoder.hencoderpracticedraw2.practice; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; public class Practice13ShadowLayerView extends View { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); public Practice13ShadowLayerView(Context context) { super(context); } public Practice13ShadowLayerView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public Practice13ShadowLayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } { // 使用 Paint.setShadowLayer() 设置阴影 paint.setShadowLayer(20,10,10, Color.RED); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); paint.setTextSize(120); canvas.drawText("Hello HenCoder", 50, 200, paint); } }
[ "you@example.com" ]
you@example.com
78e2a9e26199ed9843770b7260443291d5e7e631
e49d9edb5df3fa241bed2018dd1f225ba16a4557
/src/src/in/definex/Looper.java
89d9c8e250385001b0e06e700e116d62390edb1e
[ "MIT" ]
permissive
iamstan13y/supbot
e5097c583cc98ed0aa9cb40d1b9127115d80eb44
e082306f86ef68368c3391d4c12ea0b6a8118295
refs/heads/master
2022-04-26T16:10:28.762852
2020-05-01T12:23:16
2020-05-01T12:23:16
387,380,819
4
0
MIT
2021-07-19T07:43:40
2021-07-19T07:43:39
null
UTF-8
Java
false
false
7,163
java
package in.definex; import in.definex.Action.ActionManager; import in.definex.Action.Checker; import in.definex.Action.Core.Checker.CheckInCurrentGroupAction; import in.definex.Action.Core.Checker.CheckOtherGroupForNewAction; import in.definex.Action.Core.MoveToChatAction; import in.definex.Action.Core.SendMessageAction; import in.definex.Action.StringActionInitializer; import in.definex.ChatSystem.ChatGroupsManager; import in.definex.ChatSystem.ChatProcessorManager; import in.definex.ChatSystem.Core.CommandCP; import in.definex.Console.Console; import in.definex.Console.Core.*; import in.definex.Console.Log; import in.definex.Database.Configuration; import in.definex.Database.Core.ChatGroupDatabase; import in.definex.Database.Core.ClientDatabase; import in.definex.Database.DatabaseManager; import in.definex.Feature.Accounts.AccountsFeature; import in.definex.Feature.FeatureManager; import in.definex.Feature.GroupConfig.GroupConfigFeature; import in.definex.Feature.Help.HelpFeature; import in.definex.Functions.Utils; import in.definex.NetworkJob.NetworkJobManager; import in.definex.Scheduler.ScheduleDatabase; import in.definex.Scheduler.ScheduleManager; import in.definex.Scheduler.ScheduleTaskInitializer; import in.definex.String.Strings; import in.definex.String.XPaths; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; /** * Looper class * * Initializes features, checkers, console commands, * creates and runs checkerAndActionThread thread and console command threads * * Created by adam_ on 30-11-2017. */ public class Looper { private ExtraLooperFunctions extraLooperFunctions; private Thread checkerAndActionThread; private boolean quit = false; private String chromeProfileLoc; /** * Status of the program. * * @return true if the program has quit. */ public boolean isQuit() { return quit; } /** * Called to exit the program */ public void quit() { quit = true; } /** * Constructor, * Creates checkerAndActionThread thread, * starts selenium * * @param extraLooperFunctions passed from the main Class, * contains initialization of checker, features and console commands */ public Looper(ExtraLooperFunctions extraLooperFunctions) { this.extraLooperFunctions = extraLooperFunctions; checkerAndActionThread = new Thread("CheckerActionThread"){ @Override public void run() { while(!quit) loop(); } }; } public void setChromeProfileLoc(String chromeProfileLoc) { this.chromeProfileLoc = chromeProfileLoc; } /*** * Method called to start the program from main * * Waits wait for whatsapp to initialize (scan qr code) * then runs the init() method * then runs checkerAndActionThread and console thread * then waits for the threads to exit */ public void start(){ WebDriver driver; if(chromeProfileLoc == null || !chromeProfileLoc.isEmpty()) { ChromeOptions options = new ChromeOptions(); options.addArguments("user-data-dir="+chromeProfileLoc); driver = new ChromeDriver(options); } else driver = new ChromeDriver(); driver.get("http://web.whatsapp.com/"); Bot.CreateBot( driver, new ActionManager(), new Checker(() -> Log.a("RESETTING CHECKERS")), new FeatureManager(), new ChatProcessorManager(), new Console(this), new ChatGroupsManager(), this, new DatabaseManager(), new Configuration(), new StringActionInitializer(), new ScheduleManager(), new NetworkJobManager(), new ScheduleTaskInitializer() ); Strings.commandPrefix = Bot.getConfiguration().GetConfig("command_prefix",";;"); Strings.titlePrefix = Bot.getConfiguration().GetConfig("group_title_prefix", ";;"); System.out.println("Waiting for Whatsapp web to initialize."); while (Bot.getWebDriver().findElements(By.xpath(XPaths.autoStartReady)).size() == 0) Utils.waitFor(500); Utils.waitFor(1000); System.out.println("Program starting."); init(); checkerAndActionThread.start(); Bot.getConsole().getMyThread().start(); } /** * Initializes ActionManger, FeatureManager, ChatgroupManager, Console with core objects * also initializes non core objects * * Ran inside start function */ private void init(){ //core features Bot.getFeatureManager().add( new HelpFeature(), new GroupConfigFeature(), new AccountsFeature() ); //core checkers Bot.getChecker().addCheckers( new CheckInCurrentGroupAction(), new CheckOtherGroupForNewAction() ); //coreConsoleCommands Bot.getConsole().getConsoleCommandManager().add( new QuitCC(), new GroupCC(), new LogCC(), new RunCC(), new ActionCallerCC(), new CheckerCallerCC(), new VersionCC(), new HelpCC(), new ScheduleCC() ); //core database Bot.getDatabaseManager().add( new ChatGroupDatabase(), new ClientDatabase(), new ScheduleDatabase() ); //core ChatProcessors Bot.getChatProcessorManager().add( new CommandCP() ); Bot.getRemoteActionCall().add( MoveToChatAction.class, SendMessageAction.class ); extraLooperFunctions.addThingsInBot(); //init managers Bot.getDatabaseManager().init(); Bot.getChatGroupsManager().loadGroups(); Log.init(); Bot.getScheduleManager().init(); extraLooperFunctions.moreInits(); } /*** * Loop ran by checkerAndActionThread */ private void loop(){ if(!Bot.getActionManager().hasPendingWork()) Bot.getActionManager().add(Bot.getChecker().getNextChecker()); Bot.getActionManager().popAndPerform(); Utils.waitFor(500); } public void join(){ try { checkerAndActionThread.join(); Bot.getConsole().getMyThread().join(); Bot.getScheduleManager().cancelAll(); } catch (InterruptedException e) { e.printStackTrace(); } Bot.getWebDriver().quit(); } /** * Interface made to pass initialization of * feature, check and console commands from main */ public interface ExtraLooperFunctions { void addThingsInBot(); void moreInits(); } }
[ "adsau59@gmail.com" ]
adsau59@gmail.com
0b9ac4ba29afccc89504f65d4df4a2e3c6c8f785
abebf020ffc473b9c8974e575fc94ecb6d33fd06
/src/com/dietactics/presentation/controller/servlets/IndexServlet.java
4cda2cdaf33bc8be5a0b725e2ecc2ef4032e87ad
[]
no_license
michallegut/Dietactics
f2cc629b2d68422df18a30d3b43eebf6d345fd49
56b71cf1a71b246a3cde455cb60f99c0e6058205
refs/heads/master
2020-04-14T05:20:31.843183
2019-12-01T11:28:45
2019-12-01T11:28:45
163,657,979
1
0
null
null
null
null
UTF-8
Java
false
false
573
java
package com.dietactics.presentation.controller.servlets; 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; @WebServlet("/index") public class IndexServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.getRequestDispatcher("index.jsp").forward(req, resp); } }
[ "michallegut@wp.pl" ]
michallegut@wp.pl
f9819a0051b8617effa22d0d06a7b4a625bbb975
7822eb2f86317aebf6e689da2a6708e9cc4ee1ea
/Rachio_apk/sources/com/squareup/okhttp/internal/http/HttpMethod.java
c356a83601cb627c6f0a6a08189770ad4f1c2e26
[ "BSD-2-Clause" ]
permissive
UCLA-ECE209AS-2018W/Haoming-Liang
9abffa33df9fc7be84c993873dac39159b05ef04
f567ae0adc327b669259c94cc49f9b29f50d1038
refs/heads/master
2021-04-06T20:29:41.296769
2018-03-21T05:39:43
2018-03-21T05:39:43
125,328,864
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package com.squareup.okhttp.internal.http; public final class HttpMethod { public static boolean requiresRequestBody(String method) { return method.equals("POST") || method.equals("PUT") || method.equals("PATCH") || method.equals("PROPPATCH") || method.equals("REPORT"); } public static boolean permitsRequestBody(String method) { return requiresRequestBody(method) || method.equals("OPTIONS") || method.equals("DELETE") || method.equals("PROPFIND") || method.equals("MKCOL") || method.equals("LOCK"); } }
[ "zan@s-164-67-234-113.resnet.ucla.edu" ]
zan@s-164-67-234-113.resnet.ucla.edu
3f07865ffb7c8afeb409bf811c8e4ad56621259d
753244933fc4465b0047821aea81c311738e1732
/promise/target/java-D no-opt/ts3/src/thx/promise/PromiseTuple2_mapTuplePromise_445__Fun_0.java
fa1268b05bbde92af9320507ff871411a672c39d
[ "MIT" ]
permissive
mboussaa/HXvariability
abfaba5452fecb1b83bc595dc3ed942a126510b8
ea32b15347766b6e414569b19cbc113d344a56d9
refs/heads/master
2021-01-01T17:45:54.656971
2017-07-26T01:27:49
2017-07-26T01:27:49
98,127,672
0
0
null
null
null
null
UTF-8
Java
false
true
1,101
java
// Generated by Haxe 3.3.0 package thx.promise; import haxe.root.*; @SuppressWarnings(value={"rawtypes", "unchecked"}) public class PromiseTuple2_mapTuplePromise_445__Fun_0<TOut, T2, T1> extends haxe.lang.Function { public PromiseTuple2_mapTuplePromise_445__Fun_0(haxe.lang.Function success) { //line 446 "/HXvariability/promise/src/thx/promise/Promise.hx" super(1, 0); //line 446 "/HXvariability/promise/src/thx/promise/Promise.hx" this.success = success; } @Override public java.lang.Object __hx_invoke1_o(double __fn_float1, java.lang.Object __fn_dyn1) { //line 445 "/HXvariability/promise/src/thx/promise/Promise.hx" java.lang.Object t = ( (( __fn_dyn1 == haxe.lang.Runtime.undefined )) ? (((java.lang.Object) (__fn_float1) )) : (((java.lang.Object) (__fn_dyn1) )) ); //line 446 "/HXvariability/promise/src/thx/promise/Promise.hx" return ((thx.promise.Future<thx.Either>) (this.success.__hx_invoke2_o(0.0, ((T1) (haxe.lang.Runtime.getField(t, "_0", true)) ), 0.0, ((T2) (haxe.lang.Runtime.getField(t, "_1", true)) ))) ); } public haxe.lang.Function success; }
[ "mohamed.boussaa@inria.fr" ]
mohamed.boussaa@inria.fr
c08e5d5fb066e8a3f3b7ab3f6843aaa54c06b181
493d1f3ae87bcdb7705621b511653d844b4e7e80
/src/main/java/org/ocr/service/UserService.java
b748e02031fa6e0821303abbe60b5b8495cff4d4
[]
no_license
BulkSecurityGeneratorProject/ocr-app
e06c3370ce3aa2fa9ab426d618fcd67edb3e1c0a
e3a7617d15ab25a3f40a670b4c3177a8d355d2aa
refs/heads/master
2022-12-13T17:52:53.492414
2017-07-01T21:04:06
2017-07-01T21:04:06
296,647,021
0
0
null
2020-09-18T14:38:34
2020-09-18T14:38:34
null
UTF-8
Java
false
false
9,186
java
package org.ocr.service; import org.ocr.domain.Authority; import org.ocr.domain.User; import org.ocr.repository.AuthorityRepository; import org.ocr.config.Constants; import org.ocr.repository.UserRepository; import org.ocr.security.AuthoritiesConstants; import org.ocr.security.SecurityUtils; import org.ocr.service.util.RandomUtil; import org.ocr.service.dto.UserDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; /** * Service class for managing users. */ @Service @Transactional public class UserService { private final Logger log = LoggerFactory.getLogger(UserService.class); private final UserRepository userRepository; private final PasswordEncoder passwordEncoder; private final AuthorityRepository authorityRepository; public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository) { this.userRepository = userRepository; this.passwordEncoder = passwordEncoder; this.authorityRepository = authorityRepository; } public Optional<User> activateRegistration(String key) { log.debug("Activating user for activation key {}", key); return userRepository.findOneByActivationKey(key) .map(user -> { // activate given user for the registration key. user.setActivated(true); user.setActivationKey(null); log.debug("Activated user: {}", user); return user; }); } public Optional<User> completePasswordReset(String newPassword, String key) { log.debug("Reset user password for reset key {}", key); return userRepository.findOneByResetKey(key) .filter(user -> user.getResetDate().isAfter(Instant.now().minusSeconds(86400))) .map(user -> { user.setPassword(passwordEncoder.encode(newPassword)); user.setResetKey(null); user.setResetDate(null); return user; }); } public Optional<User> requestPasswordReset(String mail) { return userRepository.findOneByEmail(mail) .filter(User::getActivated) .map(user -> { user.setResetKey(RandomUtil.generateResetKey()); user.setResetDate(Instant.now()); return user; }); } public User createUser(String login, String password, String firstName, String lastName, String email, String imageUrl, String langKey) { User newUser = new User(); Authority authority = authorityRepository.findOne(AuthoritiesConstants.USER); Set<Authority> authorities = new HashSet<>(); String encryptedPassword = passwordEncoder.encode(password); newUser.setLogin(login); // new user gets initially a generated password newUser.setPassword(encryptedPassword); newUser.setFirstName(firstName); newUser.setLastName(lastName); newUser.setEmail(email); newUser.setImageUrl(imageUrl); newUser.setLangKey(langKey); // new user is not active newUser.setActivated(false); // new user gets registration key newUser.setActivationKey(RandomUtil.generateActivationKey()); authorities.add(authority); newUser.setAuthorities(authorities); userRepository.save(newUser); log.debug("Created Information for User: {}", newUser); return newUser; } public User createUser(UserDTO userDTO) { User user = new User(); user.setLogin(userDTO.getLogin()); user.setFirstName(userDTO.getFirstName()); user.setLastName(userDTO.getLastName()); user.setEmail(userDTO.getEmail()); user.setImageUrl(userDTO.getImageUrl()); if (userDTO.getLangKey() == null) { user.setLangKey("en"); // default language } else { user.setLangKey(userDTO.getLangKey()); } if (userDTO.getAuthorities() != null) { Set<Authority> authorities = new HashSet<>(); userDTO.getAuthorities().forEach( authority -> authorities.add(authorityRepository.findOne(authority)) ); user.setAuthorities(authorities); } String encryptedPassword = passwordEncoder.encode(RandomUtil.generatePassword()); user.setPassword(encryptedPassword); user.setResetKey(RandomUtil.generateResetKey()); user.setResetDate(Instant.now()); user.setActivated(true); userRepository.save(user); log.debug("Created Information for User: {}", user); return user; } /** * Update basic information (first name, last name, email, language) for the current user. * * @param firstName first name of user * @param lastName last name of user * @param email email id of user * @param langKey language key * @param imageUrl image URL of user */ public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl) { userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(user -> { user.setFirstName(firstName); user.setLastName(lastName); user.setEmail(email); user.setLangKey(langKey); user.setImageUrl(imageUrl); log.debug("Changed Information for User: {}", user); }); } /** * Update all information for a specific user, and return the modified user. * * @param userDTO user to update * @return updated user */ public Optional<UserDTO> updateUser(UserDTO userDTO) { return Optional.of(userRepository .findOne(userDTO.getId())) .map(user -> { user.setLogin(userDTO.getLogin()); user.setFirstName(userDTO.getFirstName()); user.setLastName(userDTO.getLastName()); user.setEmail(userDTO.getEmail()); user.setImageUrl(userDTO.getImageUrl()); user.setActivated(userDTO.isActivated()); user.setLangKey(userDTO.getLangKey()); Set<Authority> managedAuthorities = user.getAuthorities(); managedAuthorities.clear(); userDTO.getAuthorities().stream() .map(authorityRepository::findOne) .forEach(managedAuthorities::add); log.debug("Changed Information for User: {}", user); return user; }) .map(UserDTO::new); } public void deleteUser(String login) { userRepository.findOneByLogin(login).ifPresent(user -> { userRepository.delete(user); log.debug("Deleted User: {}", user); }); } public void changePassword(String password) { userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(user -> { String encryptedPassword = passwordEncoder.encode(password); user.setPassword(encryptedPassword); log.debug("Changed password for User: {}", user); }); } @Transactional(readOnly = true) public Page<UserDTO> getAllManagedUsers(Pageable pageable) { return userRepository.findAllByLoginNot(pageable, Constants.ANONYMOUS_USER).map(UserDTO::new); } @Transactional(readOnly = true) public Optional<User> getUserWithAuthoritiesByLogin(String login) { return userRepository.findOneWithAuthoritiesByLogin(login); } @Transactional(readOnly = true) public User getUserWithAuthorities(Long id) { return userRepository.findOneWithAuthoritiesById(id); } @Transactional(readOnly = true) public User getUserWithAuthorities() { return userRepository.findOneWithAuthoritiesByLogin(SecurityUtils.getCurrentUserLogin()).orElse(null); } /** * Not activated users should be automatically deleted after 3 days. * <p> * This is scheduled to get fired everyday, at 01:00 (am). * </p> */ @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(Instant.now().minus(3, ChronoUnit.DAYS)); for (User user : users) { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); } } /** * @return a list of all the authorities */ public List<String> getAuthorities() { return authorityRepository.findAll().stream().map(Authority::getName).collect(Collectors.toList()); } }
[ "zeeskhan1990@gmail.com" ]
zeeskhan1990@gmail.com
8cb3bf6fe7159f2bc760448abac656d9015726ec
6d29286a00c519437a0814b8d74827c8d94ce072
/preferenceroom/src/main/java/com/skydoves/preferenceroom/DefaultPreference.java
fda6965c00baebf91eb5250ab3b7c0a385cfe775
[ "Apache-2.0" ]
permissive
skydoves/PreferenceRoom
52dcbf2fd5b1622255f68450d543f6c395356e1b
b67eb5279422b203888db71af48bb1fda5382a04
refs/heads/main
2022-08-08T00:09:14.066176
2022-08-07T07:37:23
2022-08-07T07:37:23
111,425,878
395
36
Apache-2.0
2022-08-07T06:46:50
2017-11-20T15:10:52
Java
UTF-8
Java
false
false
1,087
java
/* * Copyright (C) 2017 skydoves * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.skydoves.preferenceroom; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Marks a class as an default SharedPreference entity. This entity will be mapped the default * SharedPreference persistence data. */ @Documented @Target(TYPE) @Retention(RUNTIME) public @interface DefaultPreference {}
[ "skydoves@naver.com" ]
skydoves@naver.com
68f815854a458bd6e3a82f976054eaa1dca8c863
58bb4736570e8692eede412afad3b64822eea742
/src/main/java/com/yuqmettal/voting/entity/EmployeeVotesEntity.java
c5ed10ac80e9b1ea3082bed83e5096b95b84e830
[]
no_license
yuqmettal/avalith-voting
51a334a53fa1b43fdb20c08eb44bfa3850dd5d91
d8ee9c05cedaaaf10fd075bb800a66df3f689c2a
refs/heads/master
2022-10-23T20:26:18.833202
2020-06-09T21:14:46
2020-06-09T21:14:46
271,109,074
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
package com.yuqmettal.voting.entity; import javax.persistence.Entity; import javax.persistence.Id; import org.hibernate.annotations.Immutable; import org.hibernate.annotations.Subselect; @Entity @Immutable @Subselect("SELECT * from vote") public class EmployeeVotesEntity { @Id Long id; private String username; private String name; private int votes; public EmployeeVotesEntity() { } public EmployeeVotesEntity(Long id, String username, String name, int votes) { this.id = id; this.username = username; this.name = name; this.votes = votes; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public int getVotes() { return this.votes; } public void setVotes(int votes) { this.votes = votes; } public EmployeeVotesEntity username(String username) { this.username = username; return this; } public EmployeeVotesEntity name(String name) { this.name = name; return this; } public EmployeeVotesEntity votes(int votes) { this.votes = votes; return this; } }
[ "marcoyuqui@hotmail.com" ]
marcoyuqui@hotmail.com
dd68cb4ca25498ad281a54357289f18db7e3fffa
07e2b658d5a9b17d1f99c811f433b9a71efe7ad7
/src/main/java/coding/test/ZiJIe2.java
b02cf8899abb31dd832365a2112227b49754584c
[]
no_license
YasinZhangX/LeetCodeEx
b2ea2a57b15e31bb40166a647f8f0020da8da222
7679d0ce1d9c6c871bb93d05add318e4807a41fd
refs/heads/master
2021-06-25T01:59:09.385022
2020-11-18T04:04:33
2020-11-18T04:04:33
160,682,540
0
0
null
null
null
null
UTF-8
Java
false
false
1,424
java
package coding.test; import java.util.Scanner; /** * @author Yasin Zhang */ public class ZiJIe2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n+1]; for(int i = 1; i <= n; i++){ arr[i] = sc.nextInt(); } System.out.println(solution(arr)); } private static long solution(int[] arr) { long max = 0; int n = arr.length - 1; int[] memo = new int[n+1]; for (int i = 1; i <= n; i++) { int L = L(arr, i, memo); int R = R(arr, i); memo[i] = L; max = Math.max((long)L*(long)R, max); } return max; } private static int L(int[] arr, int i, int[] memo) { int l = i - 1; int ans = 0; while (l >= 1) { if (arr[l] > arr[i]) { ans = l; break; } else if (arr[l] == arr[i]) { ans = memo[l]; break; } l--; } return ans; } private static int R(int[] arr, int i) { int r = i + 1; int n = arr.length - 1; int ans = 0; while (r <= n) { if (arr[r] > arr[i]) { ans = r; break; } r++; } return ans; } }
[ "271155397@qq.com" ]
271155397@qq.com
db37d28e6d33f51241a797bef9043033436492d8
8837dfc80d12b66f080864e6ffbbb32a7c4671ef
/src/oop/project/OOPProject.java
6aee5e70e7a38dc5630f0c62eb4b55708b60780f
[]
no_license
DropStone99/OOP-Project
1056134fb6257eeacb0d1208bb4c19e01ed3a192
10cb5f58f0c4b0ead9dbfe7cded81b39df68c6cd
refs/heads/master
2023-03-25T22:25:34.820660
2021-03-25T21:43:23
2021-03-25T21:43:23
324,661,168
0
1
null
null
null
null
UTF-8
Java
false
false
413
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 oop.project; /** * * @author ibrahim */ public class OOPProject { /** * @param args the command line arguments */ public static void main(String[] args) { LoginGUI.main(null); } }
[ "DropStone99@users.noreply.github.com" ]
DropStone99@users.noreply.github.com
958c69450b8ae7b2399838361a12a6ad63abaf36
58cd843ee0ab084aeb3b27699d748fd434a15e35
/easycode-common/src/main/java/com/easycodebox/common/file/UploadFileInfo.java
059d25c8732f76414b0e943751eb0f7ccd838fc1
[ "Apache-2.0" ]
permissive
yuanzj/easycode
b9f55560d93b66bcae117ba6731db36ba2636330
b3de71c3c28aca85c61f7514d2d759b8ec28889b
refs/heads/master
2021-01-12T08:01:38.874325
2016-12-20T13:34:24
2016-12-20T13:34:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package com.easycodebox.common.file; import java.io.InputStream; /** * @author WangXiaoJin * */ public class UploadFileInfo extends FileInfo { private static final long serialVersionUID = -5758401252814280071L; /** * 上传图片时用到的参数名 */ private String paramKey; private InputStream inputStream; public UploadFileInfo() { super(); } public InputStream getInputStream() { return inputStream; } public void setInputStream(InputStream inputStream) { this.inputStream = inputStream; } public String getParamKey() { return paramKey; } public void setParamKey(String paramKey) { this.paramKey = paramKey; } }
[ "381954728@qq.com" ]
381954728@qq.com
1a8b7e3fc660aa01d4804221e390bf8b9606c996
a8887f2d310faa92a23e3edded2dd5f5390a3431
/app/src/main/java/org/kprsongs/domain/AuthorSong.java
4e64c7ab003221198f5f12e533e2b5ebd09bc183
[]
no_license
kpreddygithub/LyricsApp
de5ec5c3121334a7d4511ab33ae698d3a8cb3bda
3b0724e5ba7d334fea43f168735cf0f08cb7cfe2
refs/heads/master
2021-04-27T06:55:30.530754
2018-04-10T10:28:12
2018-04-10T10:28:12
122,621,615
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package org.kprsongs.domain; import org.apache.commons.lang3.builder.ToStringBuilder; /** * Created by K Purushotham Reddy on 3/24/2015. */ public class AuthorSong { private int authorId; private int songId; private Song song; private Author author; public int getAuthorId() { return authorId; } public void setAuthorId(int authorId) { this.authorId = authorId; } public int getSongId() { return songId; } public void setSongId(int songId) { this.songId = songId; } public Song getSong() { return song; } public void setSong(Song song) { this.song = song; } public Author getAuthor() { return author; } public void setAuthor(Author author) { this.author = author; } @Override public String toString() { ToStringBuilder stringBuilder = new ToStringBuilder(this); stringBuilder.append("authorname", getAuthor().getDisplayName()); stringBuilder.append("song title", getSong().getTitle()); return stringBuilder.toString(); } }
[ "govind.bommena@iblesoft.com" ]
govind.bommena@iblesoft.com
ec2442fbb0004e023c383ea9c870cae8b1d761da
a3357f9928fa7d9d2a0b7e70f77da456b2f5ebfa
/ShiftDemo.java
b781f91e4918840de98214d3c88e15b198be72be
[]
no_license
abhisheksinghs/Java
7ad60ac84bdf2f5285fb68ae7d7fa8744fb2d5be
255b622a78b3bf9511381bb6b4cff63713781b17
refs/heads/master
2021-01-02T23:09:27.201719
2019-08-24T01:51:40
2019-08-24T01:51:40
99,478,201
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
import java.lang.*; import java.util.*; import java.io.*; public class ShiftDemo{ public static void main(String args[]){ byte b = 11; // Shift to the Left System.out.println(b << 1); //Signed Shift to the Right System.out.println(b >> 1); //Unsigned Shift to the right byte c = -10; //Shift to the left three System.out.println(c << 3); //Sign shift to the right System.out.println(c >> 1); System.out.println(c >>> 1); System.out.println(b >>> 2); } }
[ "Abhisheksingh9135@gmail.com" ]
Abhisheksingh9135@gmail.com
37ad2889094253a6a1079df38c4a1977cb2646a5
7c29eb22c9d4a55b87c1cb4c9e31b04c2a9b2b31
/kettle-scheduler-backstage/src/main/java/com/piesat/kettlescheduler/mapper/KTransRecordDao.java
da5193f3adc0ef721179d8cdecba6a5c3efda585
[]
no_license
523499159/kettle-web
afa9f60958c86a3119bba406edf434d63a3d3c4a
d55c8a38c572cf58d34d3fee243a9026bb4b5b69
refs/heads/master
2023-03-17T22:50:28.851262
2020-08-31T07:02:53
2020-08-31T07:02:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package com.piesat.kettlescheduler.mapper; import com.piesat.kettlescheduler.model.*; import org.beetl.sql.core.annotatoin.SqlStatement; import org.beetl.sql.core.mapper.BaseMapper; import java.util.List; public interface KTransRecordDao extends BaseMapper<KTransRecord> { @SqlStatement(params = "kTransRecord,start,size") List<KTransRecord> pageQuery(KTransRecord kTransRecord, Integer start, Integer size); @SqlStatement(params = "kTransRecord") Long allCount(KTransRecord kTrans); @SqlStatement(params = "kTransId,startTime,endTime") List<KTransRecord> getAll(int kTransId, String startTime, String endTime); }
[ "18309292271@163.com" ]
18309292271@163.com
76f5435d06d5f03be7f9888409dc6f03316f5332
ade14722ec0d0b4c6d3c5369d974d4be3e0ad50a
/src/br/com/PraticaDragDrop/model/entity/Pacote.java
37f5ff730ed5538590052a245a2fb4d9e8d801e1
[]
no_license
lucasbiel7/PraticaDragAndDrop
d0234a13066506a67eebf5bdfba933a0242c19be
b096987d8750f48cee4a1ef857936de20df1a24e
refs/heads/master
2020-04-18T13:53:54.642784
2016-09-02T15:45:09
2016-09-02T15:45:09
67,235,118
0
0
null
null
null
null
UTF-8
Java
false
false
3,753
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 br.com.PraticaDragDrop.model.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author OCTI01 */ @Entity @Table(name = "pacote") @NamedQueries({ @NamedQuery(name = "Pacote.findAll", query = "SELECT p FROM Pacote p")}) public class Pacote implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Column(name = "fim") @Temporal(TemporalType.DATE) private Date fim; @Column(name = "inicio") @Temporal(TemporalType.DATE) private Date inicio; @Basic(optional = false) @Column(name = "preco") private double preco; @JoinColumn(name = "tipoQuarto_id", referencedColumnName = "id") @ManyToOne private TipoQuarto tipoQuartoid; @JoinColumn(name = "hotel_id", referencedColumnName = "id") @ManyToOne private Hotel hotelId; @JoinColumn(name = "voo_id", referencedColumnName = "id") @ManyToOne private Voo vooId; public Pacote() { } public Pacote(Integer id) { this.id = id; } public Pacote(Integer id, double preco) { this.id = id; this.preco = preco; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Date getFim() { return fim; } public void setFim(Date fim) { this.fim = fim; } public Date getInicio() { return inicio; } public void setInicio(Date inicio) { this.inicio = inicio; } public double getPreco() { return preco; } public void setPreco(double preco) { this.preco = preco; } public TipoQuarto getTipoQuartoid() { return tipoQuartoid; } public void setTipoQuartoid(TipoQuarto tipoQuartoid) { this.tipoQuartoid = tipoQuartoid; } public Hotel getHotelId() { return hotelId; } public void setHotelId(Hotel hotelId) { this.hotelId = hotelId; } public Voo getVooId() { return vooId; } public void setVooId(Voo vooId) { this.vooId = vooId; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Pacote)) { return false; } Pacote other = (Pacote) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "br.com.PraticaDragDrop.model.entity.Pacote[ id=" + id + " ]"; } }
[ "lucas@DESKTOP-BC69A01" ]
lucas@DESKTOP-BC69A01
7a4435ca68d0e78ca6f14e9394f5ca442c54f58e
ada2f73af28a93a7980dc498f439d611e12f3672
/android/.build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/mediacompat/R.java
88be7963af8ae4afea5e88cf4f1522251f030fbb
[]
no_license
io-pan/SPIPOLL
b2a314bc85c374b040399c27b438ce17e1fa8cde
dff7a49c27a0a4419dadf509948d1fd263913e7e
refs/heads/master
2023-01-29T12:42:29.641161
2019-06-13T21:26:08
2019-06-13T21:26:08
164,143,508
1
0
null
2023-01-03T15:51:11
2019-01-04T18:50:21
Java
UTF-8
Java
false
false
12,561
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 android.support.mediacompat; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f02002a; public static final int font = 0x7f020089; public static final int fontProviderAuthority = 0x7f02008b; public static final int fontProviderCerts = 0x7f02008c; public static final int fontProviderFetchStrategy = 0x7f02008d; public static final int fontProviderFetchTimeout = 0x7f02008e; public static final int fontProviderPackage = 0x7f02008f; public static final int fontProviderQuery = 0x7f020090; public static final int fontStyle = 0x7f020091; public static final int fontVariationSettings = 0x7f020092; public static final int fontWeight = 0x7f020093; public static final int ttcIndex = 0x7f020139; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f04004a; public static final int notification_icon_bg_color = 0x7f04004b; public static final int notification_material_background_media_default_color = 0x7f04004c; public static final int primary_text_default_material_dark = 0x7f040051; public static final int ripple_material_light = 0x7f040056; public static final int secondary_text_default_material_dark = 0x7f040057; public static final int secondary_text_default_material_light = 0x7f040058; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; public static final int subtitle_corner_radius = 0x7f05006a; public static final int subtitle_outline_width = 0x7f05006b; public static final int subtitle_shadow_offset = 0x7f05006c; public static final int subtitle_shadow_radius = 0x7f05006d; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f06006d; public static final int notification_bg = 0x7f06006e; public static final int notification_bg_low = 0x7f06006f; public static final int notification_bg_low_normal = 0x7f060070; public static final int notification_bg_low_pressed = 0x7f060071; public static final int notification_bg_normal = 0x7f060072; public static final int notification_bg_normal_pressed = 0x7f060073; public static final int notification_icon_background = 0x7f060074; public static final int notification_template_icon_bg = 0x7f060075; public static final int notification_template_icon_low_bg = 0x7f060076; public static final int notification_tile_bg = 0x7f060077; public static final int notify_panel_notification_icon_bg = 0x7f060078; } public static final class id { private id() {} public static final int action0 = 0x7f070008; public static final int action_container = 0x7f070010; public static final int action_divider = 0x7f070012; public static final int action_image = 0x7f070013; public static final int action_text = 0x7f070019; public static final int actions = 0x7f07001a; public static final int async = 0x7f070023; public static final int blocking = 0x7f070027; public static final int cancel_action = 0x7f07002a; public static final int chronometer = 0x7f070032; public static final int end_padder = 0x7f070040; public static final int forever = 0x7f07004c; public static final int icon = 0x7f070053; public static final int icon_group = 0x7f070054; public static final int info = 0x7f070058; public static final int italic = 0x7f070059; public static final int line1 = 0x7f07005c; public static final int line3 = 0x7f07005d; public static final int media_actions = 0x7f070060; public static final int normal = 0x7f070066; public static final int notification_background = 0x7f070067; public static final int notification_main_column = 0x7f070068; public static final int notification_main_column_container = 0x7f070069; public static final int right_icon = 0x7f070073; public static final int right_side = 0x7f070074; public static final int status_bar_latest_event_content = 0x7f07009a; public static final int tag_transition_group = 0x7f07009f; public static final int tag_unhandled_key_event_manager = 0x7f0700a0; public static final int tag_unhandled_key_listeners = 0x7f0700a1; public static final int text = 0x7f0700a3; public static final int text2 = 0x7f0700a4; public static final int time = 0x7f0700a8; public static final int title = 0x7f0700a9; } public static final class integer { private integer() {} public static final int cancel_button_image_alpha = 0x7f080002; public static final int status_bar_notification_info_maxnum = 0x7f080005; } public static final class layout { private layout() {} public static final int notification_action = 0x7f090021; public static final int notification_action_tombstone = 0x7f090022; public static final int notification_media_action = 0x7f090023; public static final int notification_media_cancel_action = 0x7f090024; public static final int notification_template_big_media = 0x7f090025; public static final int notification_template_big_media_custom = 0x7f090026; public static final int notification_template_big_media_narrow = 0x7f090027; public static final int notification_template_big_media_narrow_custom = 0x7f090028; public static final int notification_template_custom_big = 0x7f090029; public static final int notification_template_icon_group = 0x7f09002a; public static final int notification_template_lines_media = 0x7f09002b; public static final int notification_template_media = 0x7f09002c; public static final int notification_template_media_custom = 0x7f09002d; public static final int notification_template_part_chronometer = 0x7f09002e; public static final int notification_template_part_time = 0x7f09002f; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0c0058; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0d00f9; public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00fa; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0d00fb; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00fc; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0d00fd; public static final int TextAppearance_Compat_Notification_Media = 0x7f0d00fe; public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00ff; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0d0100; public static final int TextAppearance_Compat_Notification_Title = 0x7f0d0101; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0d0102; public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0173; public static final int Widget_Compat_NotificationActionText = 0x7f0d0174; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f02002a }; 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 = { 0x7f02008b, 0x7f02008c, 0x7f02008d, 0x7f02008e, 0x7f02008f, 0x7f020090 }; 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, 0x7f020089, 0x7f020091, 0x7f020092, 0x7f020093, 0x7f020139 }; 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; } }
[ "lionel.rousseau@bluewin.ch" ]
lionel.rousseau@bluewin.ch
9126ab45438207802f0eaf75862369e516db3cc4
80d313b8f0c3395cdec241c41d7305e60536756d
/NgHibernate/src/test/java/Test.java
c171be575e34055448136757b8bda0df909181de
[ "MIT" ]
permissive
Tsual/sf.tsual
a2a85b1479691e568245a5a40abc389fd39ece7a
843a32e19fb1f2e308416e3a2d6b13bb4d54b3de
refs/heads/NgTsual/develop/build
2020-03-26T05:29:06.408647
2019-03-14T06:16:47
2019-03-14T06:16:47
144,559,337
1
0
null
2019-02-18T03:38:59
2018-08-13T09:41:15
C++
UTF-8
Java
false
false
209
java
import java.util.Arrays; import java.util.List; public class Test { public static void main(String[] args) throws Exception { final List<Long> longs = Arrays.asList(new Long[]{0L, 1L}); int a = 0; } }
[ "562974055@qq.com" ]
562974055@qq.com
86184638778ac1e390a7e243a9211c49bb22a701
b73d505cbb8a0e41953e1e41184fb694ba760660
/CollectionUtils/src/com/nacr/collections/LinkedHashSetExample.java
4e12bd864332700a54b8581fa79206503937f371
[]
no_license
shekarsprm/CollectionExamples
e99f2cb0219a3740e8fa69e39f37df2a910d71f8
8e8b9127d9cd317ba378b405f2001602fd2c251b
refs/heads/master
2021-07-17T06:58:37.210392
2017-10-24T03:56:04
2017-10-24T03:56:04
108,073,975
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package com.nacr.collections; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; public class LinkedHashSetExample { public static void main( String[] args ) { Set< Integer > linkedHashset = new LinkedHashSet< Integer >( ); linkedHashset.addAll( Arrays.asList( 20, 10, 50, 75, 90 ) ); System.out.println( linkedHashset ); Set< String > sHashset = new LinkedHashSet< String >( ); sHashset.addAll( Arrays.asList( "HELLO", "WORLD", "JAVA" ) ); System.out.println( sHashset ); } }
[ "Welcome@Welcome-PC" ]
Welcome@Welcome-PC
b9f4a7d8dd31cc0c352f9292b75f64fd143b93ef
3116cce9a40edb4786c8f784197cae78dcfd4fe2
/app/src/main/java/com/cfish/rvb/fragment/SiteFragment.java
97920d2f833802de0f81a9e401dd583debcebd54
[]
no_license
fishho/NKBBS
23640a0028ac0997873d10855c63a6d1495f334a
7f06140d6f10257003bd0a42f078fe53e6b12dbc
refs/heads/master
2020-05-21T12:26:08.963405
2017-01-05T12:56:22
2017-01-05T12:56:22
50,716,931
0
0
null
null
null
null
UTF-8
Java
false
false
9,155
java
package com.cfish.rvb.fragment; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.alibaba.fastjson.JSON; import com.cfish.rvb.R; import com.cfish.rvb.SiteArticleActivity; import com.cfish.rvb.adapter.NewsAdapter; import com.cfish.rvb.bean.SiteDetails; import com.cfish.rvb.util.CommonData; import com.cfish.rvb.util.HttpUtil; import com.cfish.rvb.util.JsonParse; import com.loopj.android.http.JsonHttpResponseHandler; import com.loopj.android.http.RequestParams; import com.loopj.android.http.TextHttpResponseHandler; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import cz.msebera.android.httpclient.Header; /** * A simple {@link Fragment} subclass. * Use the {@link SiteFragment#newInstance} factory method to * create an instance of this fragment. */ public class SiteFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String TAG = "SiteFragment"; private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private RequestParams params, paramsTest; private NewsAdapter adapter; private List<Map<String,String>> newsList; private RecyclerView siteArticleRv; private View view; /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment SiteFragment. */ // TODO: Rename and change types and number of parameters public static SiteFragment newInstance(String param1, String param2) { SiteFragment fragment = new SiteFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } public SiteFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_site, container, false); initView(); //initData(); initAction(); view.setLayoutParams(new android.widget.LinearLayout.LayoutParams( android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT)); return view; } public void initView() { siteArticleRv = (RecyclerView)view.findViewById(R.id.site_article_rv); siteArticleRv.setLayoutManager(new LinearLayoutManager(getActivity())); } public void initData() { newsList = new ArrayList<>(); adapter = new NewsAdapter(getActivity(),newsList); siteArticleRv.setAdapter(adapter); getDada(); } public void initAction() { } public void getDada() { String uid = (CommonData.user.getUid() == null)? "-1" : CommonData.user.getUid(); Log.d(TAG, "SiteFragment uid = " + uid); params = new RequestParams(); params.add("uid",uid); params.add("type","get_site_articles"); HttpUtil.post(CommonData.siteURL, params, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); Log.d(TAG, "SiteFragment SS " + response); //List<Topic> topics = JsonParse.parseGroupArticles(JSON.parseObject(responseString)); // for (Topic topic : topics) { // topicList.add(topic); // } // topicList.addAll(topics); // adapter.refreshData(topicList); JSONArray data =null; Map<String,String> map = new HashMap<>(); try { data = response.getJSONArray("data"); for (int i=0;i<data.length();i++) { map = new HashMap(); map.put("sid",data.getJSONObject(i).getString("sid")); map.put("s_a_id",data.getJSONObject(i).getString("s_a_id")); map.put("author",data.getJSONObject(i).getString("author")); map.put("creatime",data.getJSONObject(i).getString("creatime")); map.put("reply",data.getJSONObject(i).getString("reply_num")); map.put("name",data.getJSONObject(i).getString("name")); map.put("signature",data.getJSONObject(i).getString("signature")); newsList.add(map); } } catch (JSONException e) { Log.e(TAG,e.getMessage(),e); } adapter.refreshData(newsList); adapter.setOnItemClickListener(new NewsAdapter.OnRecyclerViewItemClickListener() { @Override public void onItemClick(View v, String data) { Intent intent = new Intent(getActivity(), SiteArticleActivity.class); intent.putExtra("s_a_id", data); getActivity().startActivity(intent); // paramsTest = new RequestParams(); // paramsTest.add("uid","-1"); // paramsTest.add("reply_order", CommonData.user.getReply_order()); // paramsTest.add("type", "get_site_article"); // paramsTest.add("s_a_id", data); // Log.d(TAG, "onItemClick: "+data); // HttpUtil.post(CommonData.siteURL, paramsTest, new TextHttpResponseHandler() { // @Override // public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { // Log.d(TAG, "onFailure: "+responseString); // } // // @Override // public void onSuccess(int statusCode, Header[] headers, String responseString) { // // Log.d("DDDDD", responseString); // if (responseString.length() > 4000){ // Log.d("Dfish","Article part1"+responseString.length()+responseString.substring(0,4000)); // Log.d("Dfish","Article part2"+responseString.substring(4000)); // // if (responseString.startsWith("<")) { // responseString = responseString.substring(responseString.indexOf("{"),responseString.length()); // } // com.alibaba.fastjson.JSONObject resp = com.alibaba.fastjson.JSON.parseObject(responseString); // if (resp.getString("status").equals("0")) { // Snackbar.make(view, "找不见了", Snackbar.LENGTH_SHORT).show(); // } else { // SiteDetails details = JsonParse.parseSiteDetails(resp); // Log.d("Dddd",details.getArticle().getContent()); // } // } // } // }); } }); } @Override public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { super.onFailure(statusCode, headers, throwable, errorResponse); Log.d(TAG, " siteFragment FF" + errorResponse); } }); } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if(isVisibleToUser){ initData(); } else { Log.d(TAG,"SiteFragment is not visible"); } } }
[ "2012chenjian@gmail.com" ]
2012chenjian@gmail.com
c30fa4c71d6e73c986c348324b0f5ae30365882f
0b764de80d64306612477f7fac1b50c53d7028c5
/src/main/java/org/sgk/service/ReservationService.java
608bc41b69d0801a96f193892cd0e55a251f99b1
[]
no_license
naikwadi-sachin/sgk
4b138d5f6d1fdf9e0ee01a459efcad4084672b21
c45681e2f02adc25af2b8679480ef4bf8c2c685f
refs/heads/master
2020-05-07T09:53:42.947781
2014-10-28T13:26:24
2014-10-28T13:26:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package org.sgk.service; import java.util.List; import org.sgk.controller.ReservationNotAvailableException; import org.sgk.domain.PeriodicReservation; import org.sgk.domain.Reservation; import org.sgk.domain.SportType; public interface ReservationService { public List<Reservation> query(String courtName); public void make(Reservation reservation) throws ReservationNotAvailableException; public List<SportType> getAllSportTypes(); public SportType getSportType(int sportTypeId); public void makePeriodic(PeriodicReservation periodicReservation) throws ReservationNotAvailableException; }
[ "sachinn@cybage.com" ]
sachinn@cybage.com
6138ddf907830e0314b6beeaa9790673d9c29c7e
8591013303e40e7c82ecab24852196e1202aba03
/LogicaProgramacion/src/logica/CuartoEjercicio.java
5f62453f6fa7cee8a89e81650a8a9d585a244156
[]
no_license
LuisEstebanArango/RefuerzoLogica
f76be0a28bb8a268e272f03bca8500549f558f0d
5c466da76b15e7178440e99cf1b1cb6fcefe8c9c
refs/heads/master
2021-01-19T10:38:46.699460
2015-05-23T08:23:19
2015-05-23T08:23:19
33,023,020
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package logica; public class CuartoEjercicio { public static void main(String[] args) { // TODO Auto-generated method stub for (int i = 1; i <= 10; i++) { for (int j = 1; j <=10; j++) { System.out.println(i+" * "+ j +" = "+ (i*j)); } System.out.println(); } } }
[ "estebanarango14@hotmail.com" ]
estebanarango14@hotmail.com
111828ac62fa9d65ede631be96e0488325705f92
12fbd93f600537986e35f7032028064a46616c19
/src/main/java/com/dhu/dao/SupplierDao.java
80cc75d0831435577598e434255043865dcf0adb
[]
no_license
lmyaxx/SpringMVC-SSH
57d0b03cf2e2e5f489a53c41646f9b3d8e7e5da8
6dc02495bac5ec403e73bc4715815a742a1c3647
refs/heads/master
2022-12-31T06:32:07.378576
2019-10-29T05:44:10
2019-10-29T05:44:10
218,208,853
0
0
null
2022-12-16T09:44:49
2019-10-29T05:11:32
JavaScript
UTF-8
Java
false
false
170
java
package com.dhu.dao; import com.dhu.pojo.Supplier; import org.springframework.stereotype.Repository; @Repository public class SupplierDao extends BaseDao<Supplier> { }
[ "1367968283@qq.com" ]
1367968283@qq.com
3f48059bbfe256ff3ca4a8eefeedc8c3ac10b54d
802bd0e3175fe02a3b6ca8be0a2ff5347a1fd62c
/recyclerviewlibrary/src/main/java/com/chad/library/adapter/base/listener/IDraggableListener.java
3ffb323ce83d8004495084b8c06603d9c2781fac
[]
no_license
wuwind/CstFramePub
87b8534d85cabcf6b8ca58077ef54d706c8a6a91
4059789b42224fe53806569673065a207c0890dd
refs/heads/master
2023-04-11T20:58:37.505639
2021-04-14T06:11:29
2021-04-14T06:11:29
351,687,796
0
0
null
null
null
null
UTF-8
Java
false
false
1,720
java
package com.chad.library.adapter.base.listener; import android.graphics.Canvas; import android.support.v7.widget.RecyclerView; /** * <pre> * @author : xyk * e-mail : yaxiaoke@163.com * time : 2019/07/29 * desc : 抽取拖拽功能,为了兼容新旧实现 * version: 1.0 * </pre> */ public interface IDraggableListener { /** * @return boolean */ boolean isItemSwipeEnable(); /** * @return boolean */ boolean isItemDraggable(); /** * Is there a toggle view which will trigger drag event. * * @return boolean */ boolean hasToggleView(); /** * @param viewHolder viewHolder */ void onItemDragStart(RecyclerView.ViewHolder viewHolder); /** * @param viewHolder viewHolder */ void onItemDragEnd(RecyclerView.ViewHolder viewHolder); /** * @param viewHolder viewHolder */ void onItemSwipeClear(RecyclerView.ViewHolder viewHolder); /** * @param source source * @param target target */ void onItemDragMoving(RecyclerView.ViewHolder source, RecyclerView.ViewHolder target); /** * @param viewHolder viewHolder */ void onItemSwiped(RecyclerView.ViewHolder viewHolder); /** * @param canvas canvas * @param viewHolder viewHolder * @param x x * @param y y * @param isCurrentlyActive isCurrentlyActive */ void onItemSwiping(Canvas canvas, RecyclerView.ViewHolder viewHolder, float x, float y, boolean isCurrentlyActive); /** * @param viewHolder viewHolder */ void onItemSwipeStart(RecyclerView.ViewHolder viewHolder); }
[ "412719784@qq.com" ]
412719784@qq.com
7ffdd1ae6dc63cc104254d983557b9d3c43c80b1
560ae9392b2eb67197770d59f5b45b968ef41992
/app/src/main/java/com/example/feng/myapp/common/Common.java
5a615bd99d04f4180ff7ad0492526367d52950b3
[]
no_license
PyBird/MyApp
cef48a2e79d24ef72ef9da1db835f47f9916fcfd
ac546edc97443f9d9f8b4c85609213c7060234b5
refs/heads/master
2020-05-21T23:56:13.105992
2016-12-07T07:36:03
2016-12-07T07:36:03
61,613,396
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.example.feng.myapp.common; import android.os.Environment; /** * Created by feng on 2016/6/15. */ public class Common { public static String SERVER_URL="http://192.168.1.117/api/"; public static String FILE_TORRENT= Environment.getExternalStorageDirectory().getPath() +"/myapp/torrent/"; }
[ "asd998723@163.com" ]
asd998723@163.com
be84745783d727e14ea0d4c70c10e21fd7586e23
9787e30fcd5d7f6e24e8207e68e0473394c2218c
/book-service/src/main/java/com/example/book/AppBean.java
9af674ace23c443c120bdd5a8e7bb356a1409729
[]
no_license
PheaSoy/spring-cloud-config
1ac6cf02bb9a48661f2700d86af1fcad571a8338
36682f4cb52ec91d30adfb425daeab61eb05eeb2
refs/heads/master
2023-01-23T08:47:59.537740
2022-12-25T14:42:22
2022-12-25T14:42:22
259,965,704
0
1
null
null
null
null
UTF-8
Java
false
false
720
java
package com.example.book; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Bean; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component public class AppBean { @Autowired private Environment environment; @Bean CommandLineRunner commandLineRunner(){ return args -> { String property = environment.getProperty("message.text", "n/a"); String subject = environment.getProperty("message.subject", "n/a"); System.out.println(property); System.out.println(subject); }; } }
[ "phea.soy@hatthabank.com" ]
phea.soy@hatthabank.com
153b71e5802e0242da18e893d4f14c542aa7d0a6
ec297ab97f35f3de29f879fd48e4548f8a8890ed
/FlatPlace/src/edu/unca/jderbysh/FlatPlace/FlatPlace.java
bdeaf2c918a98a11dc51a5739ab146dd4cb67c8f
[]
no_license
Derbs/CSCI373-Test2
80932839f8db1c9fb93ed67eece7471ad16ba7c6
3bbb87e2bf67de8b2041e2dc0133497941def1c4
refs/heads/master
2021-01-21T16:32:18.278309
2012-11-08T21:11:13
2012-11-08T21:11:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package edu.unca.jderbysh.FlatPlace; import java.util.logging.Logger; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; public class FlatPlace extends JavaPlugin{ private Logger log = Logger.getLogger("Minecraft"); public void onEnable() { this.logMessage("Enabled"); } public void onDisable() { this.logMessage("Disabled"); } public void logMessage(String msg) { PluginDescriptionFile pdFile = this.getDescription(); this.log.info(pdFile.getName() + " " + pdFile.getVersion() + ": " + msg); } public ChunkGenerator getDefaultWorldGenerator(String worldName, String uid){ return new FlatPlaceGenerator(this); } }
[ "jderbysh@unca.edu" ]
jderbysh@unca.edu
295c6b7ae5a049f201aaad2d680e36932df4cbbd
7a9dcba89fd913fd731f463c46073460241e5664
/src/teste/Relogio.java
ca1527c7f368feab195c08038e2992f6e7ec2825
[]
no_license
ThiagoKrug/BatePapoServidor
5569c1ef87bcf6544a458c3a8a751dc510e9c75d
f5483eb6831bf52fa15d6604e5930984efb53471
refs/heads/master
2016-09-06T16:55:15.110285
2012-05-20T00:20:52
2012-05-20T00:20:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,096
java
package teste; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.GregorianCalendar; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public final class Relogio extends JFrame implements ActionListener { private javax.swing.Timer timer; private JLabel label; public Relogio() { super("Relógio"); label = new JLabel(); label.setFont(new Font("Arial", Font.BOLD, 22)); JPanel panel = new JPanel(); panel.add(label); Container c = getContentPane(); FlowLayout layout = new FlowLayout(); layout.setAlignment(FlowLayout.CENTER); c.setLayout(layout); c.add(panel); setResizable(false); setBounds(250, 200, 150, 80); show(); disparaRelogio(); } public void disparaRelogio() { if (timer == null) { timer = new javax.swing.Timer(1, this); timer.setInitialDelay(0); timer.start(); } else if (!timer.isRunning()) { timer.restart(); } } @Override public void actionPerformed(ActionEvent ae) { GregorianCalendar calendario = new GregorianCalendar(); int h = calendario.get(GregorianCalendar.HOUR_OF_DAY); int m = calendario.get(GregorianCalendar.MINUTE); int s = calendario.get(GregorianCalendar.SECOND); int ml = calendario.get(GregorianCalendar.MILLISECOND); String hora = ((h < 10) ? "0" : "") + h + ":" + ((m < 10) ? "0" : "") + m + ":" + ((s < 10) ? "0" : "") + s + ":" + ((ml < 10) ? "0" : "") + ml; label.setText(hora); } public static void main(String args[]) { Relogio relogio = new Relogio(); } }
[ "brunodosax@hotmail.com" ]
brunodosax@hotmail.com
f2e41c7cb4b225292ee37a3af95534f82125372f
a4dcbf58f95e853e6f2d5fb9171314348a6f4cfc
/book05/src/com/qinkai/pojo/Cart.java
2213ae5af97107ddb015d6236fa4f5f07b7e3cdf
[]
no_license
1220170250/Bookstore
f82048d5981b00d0ff4eee7306190ffe09d4fd90
5a107247869b13ed9c8f3daf8b3986c23484d0f5
refs/heads/master
2023-08-19T23:10:22.192536
2021-10-25T03:05:02
2021-10-25T03:05:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,349
java
package com.qinkai.pojo; import java.math.BigDecimal; import java.util.LinkedHashMap; import java.util.Map; /** * 购物车对象 * 购物车具备功能: * 1.加入购物车 * 2.删除商品项 * 3.清空购物车 * 2.修改商品项数量 * 实现购物车技术: * Session(采用) * 数据库 * redis+数据库+cookie */ public class Cart { //购物车商品集合,Integer 商品id CartItem 商品项 //LinkedHashMap是HashMap的一个子类,保存了记录的插入顺序,在用Iterator遍历LinkedHashMap时,先得到的记录肯定是先插入的 private Map<Integer, CartItem> items = new LinkedHashMap<Integer, CartItem>(); /** * 向购物车添加商品项,分两种情况: * 1.购物车已存在该商品 * 2.购物车不存在该商品 * @param cartItem */ public void addItem(CartItem cartItem) { CartItem item = items.get(cartItem.getId()); if (item == null) { //当前购物车不存在要添加的商品项,在末尾添加 items.put(cartItem.getId(), cartItem); } else { //当前购物车已存在要添加的商品项,只需修改对应的商品项,数量和总价 item.setCount(item.getCount() + cartItem.getCount()); item.setTotalPrice(item.getPrice().multiply(new BigDecimal(item.getCount()))); } } /** * 删除购物车中id对应的商品 * @param id */ public void deleteItem(Integer id) { items.remove(id); } /** * 清空购物车 */ public void clear() { items.clear(); } /** * 修改购物车某商品项 * * @param id * @param count */ public void updateCount(Integer id, Integer count) { CartItem item = items.get(id); if (item == null) { } else { //在当前购物车找到要修改的商品项,修改对应的商品项,数量和总价 item.setCount(count); item.setTotalPrice(item.getPrice().multiply(new BigDecimal(item.getCount()))); } } public Cart() { } public Cart(Map<Integer, CartItem> items) { this.items = items; } /** * 遍历所有商品项得到购物车商品总数 * @return */ public Integer getTotalCount() { Integer totalCount = 0; for (Map.Entry<Integer, CartItem> entry : items.entrySet()) { totalCount = totalCount + entry.getValue().getCount(); } return totalCount; } /** * 遍历所有商品项得到购物车商品总金额 * @return */ public BigDecimal getTotalPrice() { BigDecimal totalPrice = new BigDecimal(0); for (Map.Entry<Integer, CartItem> entry : items.entrySet()) { totalPrice = totalPrice.add(entry.getValue().getTotalPrice()); } return totalPrice; } public Map<Integer, CartItem> getItems() { return items; } public void setItems(Map<Integer, CartItem> items) { this.items = items; } @Override public String toString() { return "Cart{" + "totalCount=" + getTotalCount() + ", totalPrice=" + getTotalPrice() + ", items=" + items + '}'; } }
[ "1220170250@qq.com" ]
1220170250@qq.com
d7616f331d60a3c5d45f72f22fe49c19f877dac5
243337c80779b164d8fb864800eef96a39a07aa8
/tools/language-parser-builder/src/main/java/org/openrewrite/toml/tree/Key.java
3e093a4c1fea104275bff9ed1c67d03905d9d72f
[ "Apache-2.0" ]
permissive
gastaldi/rewrite
7ace35c0564b94d4520a77a645c1cf74cddd20eb
b100395582ef3323f53afd4b84734855b48739a9
refs/heads/main
2023-04-14T12:02:20.074814
2023-03-28T13:46:29
2023-03-28T13:46:29
186,921,097
0
0
null
2019-05-16T00:24:01
2019-05-16T00:24:00
null
UTF-8
Java
false
false
74
java
package org.openrewrite.toml.tree; public interface Key extends Toml { }
[ "jkschneider@gmail.com" ]
jkschneider@gmail.com
249bb694c90a82c0d7b8767c7c7e01e1ea3805aa
018a2ffe7c881695a68796631c5cdaf3e7b758a6
/kfms-admin/src/main/java/com/khoders/kfms/jbeans/controller/FeedOverviewController.java
88593021c38b37d7fe8f146231bab673545e1b85
[]
no_license
Richnarh/kfarms
048328279020742c27838bb1c253fa4865596e8e
ed0adf2057cd5ab4ee7622e47b42a937040ac9ec
refs/heads/master
2023-03-25T01:18:10.306425
2021-03-24T08:41:55
2021-03-24T08:41:55
309,069,284
0
0
null
null
null
null
UTF-8
Java
false
false
1,888
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.khoders.kfms.jbeans.controller; import com.khoders.kfms.entities.feedFormulation.FeedConfig; import com.khoders.kfms.entities.feedFormulation.FeedConfigItem; import com.khoders.kfms.jpa.AppSession; import com.khoders.kfms.services.FeedFormulationService; import com.khoders.resource.jpa.CrudApi; import java.io.Serializable; import java.util.LinkedList; import java.util.List; import javax.enterprise.context.SessionScoped; import javax.inject.Inject; import javax.inject.Named; /** * * @author khoders */ @Named(value = "feedOverviewController") @SessionScoped public class FeedOverviewController implements Serializable{ @Inject private CrudApi crudApi; @Inject private AppSession appSession; @Inject private FeedFormulationService feedFormulationService; private List<FeedConfigItem> feedOverviewChartList = new LinkedList<>(); private FeedConfigItem configItem = new FeedConfigItem(); private FeedConfig selectedFeedConfig; public void initChart() { feedOverviewChartList = feedFormulationService.getFeedConfigList(selectedFeedConfig); } public List<FeedConfigItem> getFeedOverviewChartList() { return feedOverviewChartList; } public FeedConfig getSelectedFeedConfig() { return selectedFeedConfig; } public void setSelectedFeedConfig(FeedConfig selectedFeedConfig) { this.selectedFeedConfig = selectedFeedConfig; } public FeedConfigItem getConfigItem() { return configItem; } public void setConfigItem(FeedConfigItem configItem) { this.configItem = configItem; } }
[ "pascalcppjava@gmail.com" ]
pascalcppjava@gmail.com
c4dea28326ffa5f52a4006e7fc83a20991f4d46c
45f30472f4a8a94f1a026eeefd01b6fc93d9a567
/p6/ast.java
f28737e73708223488485a6b9a9e5b4c859771a1
[]
no_license
danghao96/Compiler
5e97ea9de7a5cad6d403544947b73e38803db56c
567009784dc9ea29f84670078d345ca03a70a217
refs/heads/master
2020-05-19T22:34:29.009269
2019-05-07T01:45:35
2019-05-07T01:45:35
185,249,359
0
0
null
null
null
null
UTF-8
Java
false
false
81,813
java
import java.io.*; import java.util.*; // ********************************************************************** // The ASTnode class defines the nodes of the abstract-syntax tree that // represents a C-- program. // // Internal nodes of the tree contain pointers to children, organized // either in a list (for nodes that may have a variable number of // children) or as a fixed set of fields. // // The nodes for literals and ids contain line and character number // information; for string literals and identifiers, they also contain a // string; for integer literals, they also contain an integer value. // // Here are all the different kinds of AST nodes and what kinds of children // they have. All of these kinds of AST nodes are subclasses of "ASTnode". // Indentation indicates further subclassing: // // Subclass Kids // -------- ---- // ProgramNode DeclListNode // DeclListNode linked list of DeclNode // DeclNode: // VarDeclNode TypeNode, IdNode, int // FnDeclNode TypeNode, IdNode, FormalsListNode, FnBodyNode // FormalDeclNode TypeNode, IdNode // StructDeclNode IdNode, DeclListNode // // FormalsListNode linked list of FormalDeclNode // FnBodyNode DeclListNode, StmtListNode // StmtListNode linked list of StmtNode // ExpListNode linked list of ExpNode // // TypeNode: // IntNode -- none -- // BoolNode -- none -- // VoidNode -- none -- // StructNode IdNode // // StmtNode: // AssignStmtNode AssignNode // PostIncStmtNode ExpNode // PostDecStmtNode ExpNode // ReadStmtNode ExpNode // WriteStmtNode ExpNode // IfStmtNode ExpNode, DeclListNode, StmtListNode // IfElseStmtNode ExpNode, DeclListNode, StmtListNode, // DeclListNode, StmtListNode // WhileStmtNode ExpNode, DeclListNode, StmtListNode // RepeatStmtNode ExpNode, DeclListNode, StmtListNode // CallStmtNode CallExpNode // ReturnStmtNode ExpNode // // ExpNode: // IntLitNode -- none -- // StrLitNode -- none -- // TrueNode -- none -- // FalseNode -- none -- // IdNode -- none -- // DotAccessNode ExpNode, IdNode // AssignNode ExpNode, ExpNode // CallExpNode IdNode, ExpListNode // UnaryExpNode ExpNode // UnaryMinusNode // NotNode // BinaryExpNode ExpNode ExpNode // PlusNode // MinusNode // TimesNode // DivideNode // AndNode // OrNode // EqualsNode // NotEqualsNode // LessNode // GreaterNode // LessEqNode // GreaterEqNode // // Here are the different kinds of AST nodes again, organized according to // whether they are leaves, internal nodes with linked lists of kids, or // internal nodes with a fixed number of kids: // // (1) Leaf nodes: // IntNode, BoolNode, VoidNode, IntLitNode, StrLitNode, // TrueNode, FalseNode, IdNode // // (2) Internal nodes with (possibly empty) linked lists of children: // DeclListNode, FormalsListNode, StmtListNode, ExpListNode // // (3) Internal nodes with fixed numbers of kids: // ProgramNode, VarDeclNode, FnDeclNode, FormalDeclNode, // StructDeclNode, FnBodyNode, StructNode, AssignStmtNode, // PostIncStmtNode, PostDecStmtNode, ReadStmtNode, WriteStmtNode // IfStmtNode, IfElseStmtNode, WhileStmtNode, CallStmtNode // ReturnStmtNode, DotAccessNode, AssignExpNode, CallExpNode, // UnaryExpNode, BinaryExpNode, UnaryMinusNode, NotNode, // PlusNode, MinusNode, TimesNode, DivideNode, // AndNode, OrNode, EqualsNode, NotEqualsNode, // LessNode, GreaterNode, LessEqNode, GreaterEqNode // // ********************************************************************** // ********************************************************************** // ASTnode class (base class for all other kinds of nodes) // ********************************************************************** abstract class ASTnode { public void codeGen(PrintWriter p){} // every subclass must provide an unparse operation abstract public void unparse(PrintWriter p, int indent); // this method can be used by the unparse methods to do indenting protected void doIndent(PrintWriter p, int indent) { for (int k=0; k<indent; k++) p.print(" "); } } // ********************************************************************** // ProgramNode, DeclListNode, FormalsListNode, FnBodyNode, // StmtListNode, ExpListNode // ********************************************************************** class ProgramNode extends ASTnode { public ProgramNode(DeclListNode L) { myDeclList = L; } /** * nameAnalysis * Creates an empty symbol table for the outermost scope, then processes * all of the globals, struct defintions, and functions in the program. */ public void nameAnalysis() { SymTable symTab = new SymTable(); myDeclList.nameAnalysis(symTab); Sym s = symTab.lookupGlobal("main"); if(s == null || !(s instanceof FnSym)){ ErrMsg.fatal(0, 0, "No main function"); } } /** * typeCheck */ public void typeCheck() { myDeclList.typeCheck(); } public void codeGen(PrintWriter p) { myDeclList.codeGen(p); } public void unparse(PrintWriter p, int indent) { myDeclList.unparse(p, indent); } // 1 kid private DeclListNode myDeclList; } class DeclListNode extends ASTnode { public DeclListNode(List<DeclNode> S) { myDecls = S; } /** * nameAnalysis * Given a symbol table symTab, process all of the decls in the list. */ public void nameAnalysis(SymTable symTab) { nameAnalysis(symTab, symTab); } /** * nameAnalysis * Given a symbol table symTab and a global symbol table globalTab * (for processing struct names in variable decls), process all of the * decls in the list. */ public void nameAnalysis(SymTable symTab, SymTable globalTab) { for (DeclNode node : myDecls) { if (node instanceof VarDeclNode) { ((VarDeclNode)node).nameAnalysis(symTab, globalTab); } else { node.nameAnalysis(symTab); } } } /** * typeCheck */ public void typeCheck() { for (DeclNode node : myDecls) { node.typeCheck(); } } public void codeGen(PrintWriter p) { for (DeclNode node : myDecls) { node.codeGen(p); } } public void unparse(PrintWriter p, int indent) { Iterator it = myDecls.iterator(); try { while (it.hasNext()) { ((DeclNode)it.next()).unparse(p, indent); } } catch (NoSuchElementException ex) { System.err.println("unexpected NoSuchElementException in DeclListNode.print"); System.exit(-1); } } // list of kids (DeclNodes) private List<DeclNode> myDecls; } class FormalsListNode extends ASTnode { public FormalsListNode(List<FormalDeclNode> S) { myFormals = S; } /** * nameAnalysis * Given a symbol table symTab, do: * for each formal decl in the list * process the formal decl * if there was no error, add type of formal decl to list */ public List<Type> nameAnalysis(SymTable symTab) { List<Type> typeList = new LinkedList<Type>(); for (FormalDeclNode node : myFormals) { Sym sym = node.nameAnalysis(symTab); if (sym != null) { typeList.add(sym.getType()); } } return typeList; } /** * Return the number of formals in this list. */ public int length() { return myFormals.size(); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { Iterator<FormalDeclNode> it = myFormals.iterator(); if (it.hasNext()) { // if there is at least one element it.next().unparse(p, indent); while (it.hasNext()) { // print the rest of the list p.print(", "); it.next().unparse(p, indent); } } } // list of kids (FormalDeclNodes) private List<FormalDeclNode> myFormals; } class FnBodyNode extends ASTnode { public FnBodyNode(DeclListNode declList, StmtListNode stmtList) { myDeclList = declList; myStmtList = stmtList; } /** * nameAnalysis * Given a symbol table symTab, do: * - process the declaration list * - process the statement list */ public void nameAnalysis(SymTable symTab) { myDeclList.nameAnalysis(symTab); myStmtList.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { myStmtList.typeCheck(retType); } public void codeGen(PrintWriter p, String retLab) { myStmtList.codeGen(p, retLab); } public void unparse(PrintWriter p, int indent) { myDeclList.unparse(p, indent); myStmtList.unparse(p, indent); } // 2 kids private DeclListNode myDeclList; private StmtListNode myStmtList; } class StmtListNode extends ASTnode { public StmtListNode(List<StmtNode> S) { myStmts = S; } /** * nameAnalysis * Given a symbol table symTab, process each statement in the list. */ public void nameAnalysis(SymTable symTab) { for (StmtNode node : myStmts) { node.nameAnalysis(symTab); } } /** * typeCheck */ public void typeCheck(Type retType) { for(StmtNode node : myStmts) { node.typeCheck(retType); } } public void codeGen(PrintWriter p, String retLab) { for(StmtNode node : myStmts) { if(node instanceof ReturnStmtNode){ ((ReturnStmtNode)node).codeGen(p, retLab); }else{ node.codeGen(p); } } } public void unparse(PrintWriter p, int indent) { Iterator<StmtNode> it = myStmts.iterator(); while (it.hasNext()) { it.next().unparse(p, indent); } } // list of kids (StmtNodes) private List<StmtNode> myStmts; } class ExpListNode extends ASTnode { public ExpListNode(List<ExpNode> S) { myExps = S; } public int size() { return myExps.size(); } /** * nameAnalysis * Given a symbol table symTab, process each exp in the list. */ public void nameAnalysis(SymTable symTab) { for (ExpNode node : myExps) { node.nameAnalysis(symTab); } } /** * typeCheck */ public void typeCheck(List<Type> typeList) { int k = 0; try { for (ExpNode node : myExps) { Type actualType = node.typeCheck(); // actual type of arg if (!actualType.isErrorType()) { // if this is not an error Type formalType = typeList.get(k); // get the formal type if (!formalType.equals(actualType)) { ErrMsg.fatal(node.lineNum(), node.charNum(), "Type of actual does not match type of formal"); } } k++; } } catch (NoSuchElementException e) { System.err.println("unexpected NoSuchElementException in ExpListNode.typeCheck"); System.exit(-1); } } public void codeGen(PrintWriter p) { for (ExpNode node : myExps) { node.codeGen(p); } } public void unparse(PrintWriter p, int indent) { Iterator<ExpNode> it = myExps.iterator(); if (it.hasNext()) { // if there is at least one element it.next().unparse(p, indent); while (it.hasNext()) { // print the rest of the list p.print(", "); it.next().unparse(p, indent); } } } // list of kids (ExpNodes) private List<ExpNode> myExps; } // ********************************************************************** // DeclNode and its subclasses // ********************************************************************** abstract class DeclNode extends ASTnode { /** * Note: a formal decl needs to return a sym */ abstract public Sym nameAnalysis(SymTable symTab); // default version of typeCheck for non-function decls public void typeCheck() { } } class VarDeclNode extends DeclNode { public VarDeclNode(TypeNode type, IdNode id, int size) { myType = type; myId = id; mySize = size; } /** * nameAnalysis (overloaded) * Given a symbol table symTab, do: * if this name is declared void, then error * else if the declaration is of a struct type, * lookup type name (globally) * if type name doesn't exist, then error * if no errors so far, * if name has already been declared in this scope, then error * else add name to local symbol table * * symTab is local symbol table (say, for struct field decls) * globalTab is global symbol table (for struct type names) * symTab and globalTab can be the same */ public Sym nameAnalysis(SymTable symTab) { return nameAnalysis(symTab, symTab); } public Sym nameAnalysis(SymTable symTab, SymTable globalTab) { boolean badDecl = false; String name = myId.name(); Sym sym = null; IdNode structId = null; if (myType instanceof VoidNode) { // check for void type ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Non-function declared void"); badDecl = true; } else if (myType instanceof StructNode) { structId = ((StructNode)myType).idNode(); sym = globalTab.lookupGlobal(structId.name()); // if the name for the struct type is not found, // or is not a struct type if (sym == null || !(sym instanceof StructDefSym)) { ErrMsg.fatal(structId.lineNum(), structId.charNum(), "Invalid name of struct type"); badDecl = true; } else { structId.link(sym); } } if (symTab.lookupLocal(name) != null) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier"); badDecl = true; } if (!badDecl) { // insert into symbol table try { if(symTab.size() == 1){ myId.myIsGlobal = true; } if (myType instanceof StructNode) { sym = new StructSym(structId); } else { sym = new Sym(myType.type()); } symTab.addDecl(name, sym); myId.link(sym); } catch (DuplicateSymException ex) { System.err.println("Unexpected DuplicateSymException " + " in VarDeclNode.nameAnalysis"); System.exit(-1); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis"); System.exit(-1); } catch (WrongArgumentException ex) { System.err.println("Unexpected WrongArgumentException " + " in VarDeclNode.nameAnalysis"); System.exit(-1); } } return sym; } public void codeGen(PrintWriter p) { if(myId.myIsGlobal){ Codegen.p.println("\t.data"); Codegen.p.println("\t.align 2"); Codegen.p.println("_" + myId.name() + ":\t.space 4"); } } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); myType.unparse(p, 0); p.print(" "); p.print(myId.name()); p.println(";"); } // 3 kids private TypeNode myType; private IdNode myId; private int mySize; // use value NOT_STRUCT if this is not a struct type public static int NOT_STRUCT = -1; } class FnDeclNode extends DeclNode { public FnDeclNode(TypeNode type, IdNode id, FormalsListNode formalList, FnBodyNode body) { myType = type; myId = id; myFormalsList = formalList; myBody = body; } /** * nameAnalysis * Given a symbol table symTab, do: * if this name has already been declared in this scope, then error * else add name to local symbol table * in any case, do the following: * enter new scope * process the formals * if this function is not multiply declared, * update symbol table entry with types of formals * process the body of the function * exit scope */ public Sym nameAnalysis(SymTable symTab) { String name = myId.name(); FnSym sym = null; if (symTab.lookupLocal(name) != null) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier"); } else { // add function name to local symbol table try { sym = new FnSym(myType.type(), myFormalsList.length()); symTab.addDecl(name, sym); myId.link(sym); } catch (DuplicateSymException ex) { System.err.println("Unexpected DuplicateSymException " + " in FnDeclNode.nameAnalysis"); System.exit(-1); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in FnDeclNode.nameAnalysis"); System.exit(-1); } catch (WrongArgumentException ex) { System.err.println("Unexpected WrongArgumentException " + " in FnDeclNode.nameAnalysis"); System.exit(-1); } } symTab.addScope(); // add a new scope for locals and params // process the formals List<Type> typeList = myFormalsList.nameAnalysis(symTab); if (sym != null) { sym.addFormals(typeList); } myBody.nameAnalysis(symTab); // process the function body try { symTab.removeScope(); // exit scope } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in FnDeclNode.nameAnalysis"); System.exit(-1); } return null; } /** * typeCheck */ public void typeCheck() { myBody.typeCheck(myType.type()); } public void codeGen(PrintWriter p) { if(myId.name().equals("main")){ Codegen.p.println(".text"); Codegen.generate(".globl main"); Codegen.genLabel(myId.name()); Codegen.genLabel("__start"); } else { Codegen.generate(".text"); Codegen.p.print("_"); Codegen.genLabel(myId.name()); } Codegen.genPush(Codegen.RA); Codegen.genPush(Codegen.FP); String retLab = Codegen.nextLabel(); Codegen.generate("addu", Codegen.FP, Codegen.SP, 8 + myParamSize); if (myLocalsSize != 0) { Codegen.generate("subu",Codegen.SP, Codegen.SP, myLocalsSize); } myBody.codeGen(p, retLab); Codegen.genLabel(retLab); Codegen.generateIndexed("lw", Codegen.RA, Codegen.FP, (-myParamSize));//0); Codegen.generate("move", Codegen.T0, Codegen.FP); Codegen.generateIndexed("lw", Codegen.FP, Codegen.FP,-(myParamSize+4)); // -4); Codegen.generate("move", Codegen.SP, Codegen.T0); if(myId.name().equals("main")) { Codegen.generate("li", Codegen.V0, 10); Codegen.generate("syscall"); } else { Codegen.generate("jr", Codegen.RA); } } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); myType.unparse(p, 0); p.print(" "); p.print(myId.name()); p.print("("); myFormalsList.unparse(p, 0); p.println(") {"); myBody.unparse(p, indent+4); p.println("}\n"); } // 4 kids private TypeNode myType; private IdNode myId; private FormalsListNode myFormalsList; private FnBodyNode myBody; private int myLocalsSize; private int myParamSize; } class FormalDeclNode extends DeclNode { public FormalDeclNode(TypeNode type, IdNode id) { myType = type; myId = id; } /** * nameAnalysis * Given a symbol table symTab, do: * if this formal is declared void, then error * else if this formal is already in the local symble table, * then issue multiply declared error message and return null * else add a new entry to the symbol table and return that Sym */ public Sym nameAnalysis(SymTable symTab) { String name = myId.name(); boolean badDecl = false; Sym sym = null; if (myType instanceof VoidNode) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Non-function declared void"); badDecl = true; } if (symTab.lookupLocal(name) != null) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier"); badDecl = true; } if (!badDecl) { // insert into symbol table try { sym = new Sym(myType.type()); symTab.addDecl(name, sym); myId.link(sym); } catch (DuplicateSymException ex) { System.err.println("Unexpected DuplicateSymException " + " in VarDeclNode.nameAnalysis"); System.exit(-1); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in VarDeclNode.nameAnalysis"); System.exit(-1); } catch (WrongArgumentException ex) { System.err.println("Unexpected WrongArgumentException " + " in VarDeclNode.nameAnalysis"); System.exit(-1); } } return sym; } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { myType.unparse(p, 0); p.print(" "); p.print(myId.name()); } // 2 kids private TypeNode myType; private IdNode myId; } class StructDeclNode extends DeclNode { public StructDeclNode(IdNode id, DeclListNode declList) { myId = id; myDeclList = declList; } /** * nameAnalysis * Given a symbol table symTab, do: * if this name is already in the symbol table, * then multiply declared error (don't add to symbol table) * create a new symbol table for this struct definition * process the decl list * if no errors * add a new entry to symbol table for this struct */ public Sym nameAnalysis(SymTable symTab) { String name = myId.name(); boolean badDecl = false; if (symTab.lookupLocal(name) != null) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Multiply declared identifier"); badDecl = true; } SymTable structSymTab = new SymTable(); // process the fields of the struct myDeclList.nameAnalysis(structSymTab, symTab); if (!badDecl) { try { // add entry to symbol table StructDefSym sym = new StructDefSym(structSymTab); symTab.addDecl(name, sym); myId.link(sym); } catch (DuplicateSymException ex) { System.err.println("Unexpected DuplicateSymException " + " in StructDeclNode.nameAnalysis"); System.exit(-1); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in StructDeclNode.nameAnalysis"); System.exit(-1); } catch (WrongArgumentException ex) { System.err.println("Unexpected WrongArgumentException " + " in StructDeclNode.nameAnalysis"); System.exit(-1); } } return null; } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("struct "); p.print(myId.name()); p.println("{"); myDeclList.unparse(p, indent+4); doIndent(p, indent); p.println("};\n"); } // 2 kids private IdNode myId; private DeclListNode myDeclList; } // ********************************************************************** // TypeNode and its Subclasses // ********************************************************************** abstract class TypeNode extends ASTnode { /* all subclasses must provide a type method */ abstract public Type type(); } class IntNode extends TypeNode { public IntNode() { } /** * type */ public Type type() { return new IntType(); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { p.print("int"); } } class BoolNode extends TypeNode { public BoolNode() { } /** * type */ public Type type() { return new BoolType(); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { p.print("bool"); } } class VoidNode extends TypeNode { public VoidNode() { } /** * type */ public Type type() { return new VoidType(); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { p.print("void"); } } class StructNode extends TypeNode { public StructNode(IdNode id) { myId = id; } public IdNode idNode() { return myId; } /** * type */ public Type type() { return new StructType(myId); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { p.print("struct "); p.print(myId.name()); } // 1 kid private IdNode myId; } // ********************************************************************** // StmtNode and its subclasses // ********************************************************************** abstract class StmtNode extends ASTnode { abstract public void nameAnalysis(SymTable symTab); abstract public void typeCheck(Type retType); } class AssignStmtNode extends StmtNode { public AssignStmtNode(AssignNode assign) { myAssign = assign; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myAssign.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { myAssign.typeCheck(); } public void codeGen(PrintWriter p) { myAssign.codeGen(p); Codegen.genPop(Codegen.T0); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); myAssign.unparse(p, -1); // no parentheses p.println(";"); } // 1 kid private AssignNode myAssign; } class PostIncStmtNode extends StmtNode { public PostIncStmtNode(ExpNode exp) { myExp = exp; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (!type.isErrorType() && !type.isIntType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Arithmetic operator applied to non-numeric operand"); } } public void codeGen(PrintWriter p) { ((IdNode)myExp).codeGen(p); ((IdNode)myExp).addrGen(); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("add", Codegen.T1, Codegen.T1, 1); Codegen.generateIndexed("sw", Codegen.T1, Codegen.T0, 0); Codegen.genPush(Codegen.T1); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); myExp.unparse(p, 0); p.println("++;"); } // 1 kid private ExpNode myExp; } class PostDecStmtNode extends StmtNode { public PostDecStmtNode(ExpNode exp) { myExp = exp; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (!type.isErrorType() && !type.isIntType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Arithmetic operator applied to non-numeric operand"); } } public void codeGen(PrintWriter p) { ((IdNode)myExp).codeGen(p); ((IdNode)myExp).addrGen(); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("sub", Codegen.T1, Codegen.T1, 1); Codegen.generateIndexed("sw", Codegen.T1, Codegen.T0, 0); Codegen.genPush(Codegen.T1); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); myExp.unparse(p, 0); p.println("--;"); } // 1 kid private ExpNode myExp; } class ReadStmtNode extends StmtNode { public ReadStmtNode(ExpNode e) { myExp = e; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (type.isFnType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to read a function"); } if (type.isStructDefType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to read a struct name"); } if (type.isStructType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to read a struct variable"); } } public void codeGen(PrintWriter p) { Codegen.generate("li", Codegen.V0, 5); Codegen.generate("syscall"); ((IdNode)myExp).addrGen(); Codegen.genPop(Codegen.T0); Codegen.generateIndexed("sw", Codegen.V0, Codegen.T0, 0); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("cin >> "); myExp.unparse(p, 0); p.println(";"); } // 1 kid (actually can only be an IdNode or an ArrayExpNode) private ExpNode myExp; } class WriteStmtNode extends StmtNode { public WriteStmtNode(ExpNode exp) { myExp = exp; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (type.isFnType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to write a function"); } if (type.isStructDefType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to write a struct name"); } if (type.isStructType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to write a struct variable"); } if (type.isVoidType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Attempt to write void"); } } public void codeGen(PrintWriter p) { myExp.codeGen(p); Codegen.genPop(Codegen.A0); if (myExp instanceof StringLitNode) Codegen.generate("li", Codegen.V0, 4); else Codegen.generate("li", Codegen.V0, 1); Codegen.generate("syscall"); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("cout << "); myExp.unparse(p, 0); p.println(";"); } // 1 kid private ExpNode myExp; } class IfStmtNode extends StmtNode { public IfStmtNode(ExpNode exp, DeclListNode dlist, StmtListNode slist) { myDeclList = dlist; myExp = exp; myStmtList = slist; } /** * nameAnalysis * Given a symbol table symTab, do: * - process the condition * - enter a new scope * - process the decls and stmts * - exit the scope */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); symTab.addScope(); myDeclList.nameAnalysis(symTab); myStmtList.nameAnalysis(symTab); try { symTab.removeScope(); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis"); System.exit(-1); } } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (!type.isErrorType() && !type.isBoolType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Non-bool expression used as an if condition"); } myStmtList.typeCheck(retType); } public void codeGen(PrintWriter p) { String skip = Codegen.nextLabel(); myExp.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.generate("beq", Codegen.T0, Codegen.FALSE, skip); myStmtList.codeGen(p); Codegen.genLabel(skip); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("if ("); myExp.unparse(p, 0); p.println(") {"); myDeclList.unparse(p, indent+4); myStmtList.unparse(p, indent+4); doIndent(p, indent); p.println("}"); } // e kids private ExpNode myExp; private DeclListNode myDeclList; private StmtListNode myStmtList; } class IfElseStmtNode extends StmtNode { public IfElseStmtNode(ExpNode exp, DeclListNode dlist1, StmtListNode slist1, DeclListNode dlist2, StmtListNode slist2) { myExp = exp; myThenDeclList = dlist1; myThenStmtList = slist1; myElseDeclList = dlist2; myElseStmtList = slist2; } /** * nameAnalysis * Given a symbol table symTab, do: * - process the condition * - enter a new scope * - process the decls and stmts of then * - exit the scope * - enter a new scope * - process the decls and stmts of else * - exit the scope */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); symTab.addScope(); myThenDeclList.nameAnalysis(symTab); myThenStmtList.nameAnalysis(symTab); try { symTab.removeScope(); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis"); System.exit(-1); } symTab.addScope(); myElseDeclList.nameAnalysis(symTab); myElseStmtList.nameAnalysis(symTab); try { symTab.removeScope(); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis"); System.exit(-1); } } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (!type.isErrorType() && !type.isBoolType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Non-bool expression used as an if condition"); } myThenStmtList.typeCheck(retType); myElseStmtList.typeCheck(retType); } public void codeGen(PrintWriter p) { String skip = Codegen.nextLabel(); String done = Codegen.nextLabel(); myExp.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.generate("beq", Codegen.T0, Codegen.FALSE, skip); myThenStmtList.codeGen(p); Codegen.generate("j", done); Codegen.genLabel(skip); myElseStmtList.codeGen(p); Codegen.genLabel(done); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("if ("); myExp.unparse(p, 0); p.println(") {"); myThenDeclList.unparse(p, indent+4); myThenStmtList.unparse(p, indent+4); doIndent(p, indent); p.println("}"); doIndent(p, indent); p.println("else {"); myElseDeclList.unparse(p, indent+4); myElseStmtList.unparse(p, indent+4); doIndent(p, indent); p.println("}"); } // 5 kids private ExpNode myExp; private DeclListNode myThenDeclList; private StmtListNode myThenStmtList; private StmtListNode myElseStmtList; private DeclListNode myElseDeclList; } class WhileStmtNode extends StmtNode { public WhileStmtNode(ExpNode exp, DeclListNode dlist, StmtListNode slist) { myExp = exp; myDeclList = dlist; myStmtList = slist; } /** * nameAnalysis * Given a symbol table symTab, do: * - process the condition * - enter a new scope * - process the decls and stmts * - exit the scope */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); symTab.addScope(); myDeclList.nameAnalysis(symTab); myStmtList.nameAnalysis(symTab); try { symTab.removeScope(); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis"); System.exit(-1); } } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (!type.isErrorType() && !type.isBoolType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Non-bool expression used as a while condition"); } myStmtList.typeCheck(retType); } public void codeGen(PrintWriter p) { String start = Codegen.nextLabel(); String done = Codegen.nextLabel(); Codegen.genLabel(start); myExp.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.generate("beq", Codegen.T0, Codegen.FALSE, done); myStmtList.codeGen(p); Codegen.generate("j", start); Codegen.genLabel(done); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("while ("); myExp.unparse(p, 0); p.println(") {"); myDeclList.unparse(p, indent+4); myStmtList.unparse(p, indent+4); doIndent(p, indent); p.println("}"); } // 3 kids private ExpNode myExp; private DeclListNode myDeclList; private StmtListNode myStmtList; } class RepeatStmtNode extends StmtNode { public RepeatStmtNode(ExpNode exp, DeclListNode dlist, StmtListNode slist) { myExp = exp; myDeclList = dlist; myStmtList = slist; } /** * nameAnalysis * Given a symbol table symTab, do: * - process the condition * - enter a new scope * - process the decls and stmts * - exit the scope */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); symTab.addScope(); myDeclList.nameAnalysis(symTab); myStmtList.nameAnalysis(symTab); try { symTab.removeScope(); } catch (EmptySymTableException ex) { System.err.println("Unexpected EmptySymTableException " + " in IfStmtNode.nameAnalysis"); System.exit(-1); } } /** * typeCheck */ public void typeCheck(Type retType) { Type type = myExp.typeCheck(); if (!type.isErrorType() && !type.isIntType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Non-integer expression used as a repeat clause"); } myStmtList.typeCheck(retType); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("repeat ("); myExp.unparse(p, 0); p.println(") {"); myDeclList.unparse(p, indent+4); myStmtList.unparse(p, indent+4); doIndent(p, indent); p.println("}"); } // 3 kids private ExpNode myExp; private DeclListNode myDeclList; private StmtListNode myStmtList; } class CallStmtNode extends StmtNode { public CallStmtNode(CallExpNode call) { myCall = call; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myCall.nameAnalysis(symTab); } /** * typeCheck */ public void typeCheck(Type retType) { myCall.typeCheck(); } public void codeGen(PrintWriter p) { myCall.codeGen(p); Codegen.genPop(Codegen.T0); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); myCall.unparse(p, indent); p.println(";"); } // 1 kid private CallExpNode myCall; } class ReturnStmtNode extends StmtNode { public ReturnStmtNode(ExpNode exp) { myExp = exp; } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child, * if it has one */ public void nameAnalysis(SymTable symTab) { if (myExp != null) { myExp.nameAnalysis(symTab); } } /** * typeCheck */ public void typeCheck(Type retType) { if (myExp != null) { // return value given Type type = myExp.typeCheck(); if (retType.isVoidType()) { ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Return with a value in a void function"); } else if (!retType.isErrorType() && !type.isErrorType() && !retType.equals(type)){ ErrMsg.fatal(myExp.lineNum(), myExp.charNum(), "Bad return value"); } } else { // no return value given -- ok if this is a void function if (!retType.isVoidType()) { ErrMsg.fatal(0, 0, "Missing return value"); } } } public void codeGen(PrintWriter p, String retLab) { if (myExp != null) { myExp.codeGen(p); Codegen.genPop(Codegen.V0); } Codegen.generate("j", retLab); } public void unparse(PrintWriter p, int indent) { doIndent(p, indent); p.print("return"); if (myExp != null) { p.print(" "); myExp.unparse(p, 0); } p.println(";"); } // 1 kid private ExpNode myExp; // possibly null } // ********************************************************************** // ExpNode and its subclasses // ********************************************************************** abstract class ExpNode extends ASTnode { /** * Default version for nodes with no names */ public void nameAnalysis(SymTable symTab) { } abstract public Type typeCheck(); abstract public int lineNum(); abstract public int charNum(); } class IntLitNode extends ExpNode { public IntLitNode(int lineNum, int charNum, int intVal) { myLineNum = lineNum; myCharNum = charNum; myIntVal = intVal; } /** * Return the line number for this literal. */ public int lineNum() { return myLineNum; } /** * Return the char number for this literal. */ public int charNum() { return myCharNum; } /** * typeCheck */ public Type typeCheck() { return new IntType(); } public void codeGen(PrintWriter p) { Codegen.generate("li", Codegen.T0, myIntVal); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print(myIntVal); } private int myLineNum; private int myCharNum; private int myIntVal; } class StringLitNode extends ExpNode { public StringLitNode(int lineNum, int charNum, String strVal) { myLineNum = lineNum; myCharNum = charNum; myStrVal = strVal; } /** * Return the line number for this literal. */ public int lineNum() { return myLineNum; } /** * Return the char number for this literal. */ public int charNum() { return myCharNum; } /** * typeCheck */ public Type typeCheck() { return new StringType(); } public String strVal(){ return myStrVal; } public void codeGen(PrintWriter p) { String strLab = Codegen.nextLabel(); Codegen.p.println("\t.data"); Codegen.generateLabeled(strLab, ".asciiz " + myStrVal, ""); Codegen.p.println("\t.text"); Codegen.generate("la", Codegen.T0, strLab); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print(myStrVal); } private int myLineNum; private int myCharNum; private String myStrVal; } class TrueNode extends ExpNode { public TrueNode(int lineNum, int charNum) { myLineNum = lineNum; myCharNum = charNum; } /** * Return the line number for this literal. */ public int lineNum() { return myLineNum; } /** * Return the char number for this literal. */ public int charNum() { return myCharNum; } /** * typeCheck */ public Type typeCheck() { return new BoolType(); } public void codeGen(PrintWriter p) { Codegen.generate("li", Codegen.T0, 1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("true"); } private int myLineNum; private int myCharNum; } class FalseNode extends ExpNode { public FalseNode(int lineNum, int charNum) { myLineNum = lineNum; myCharNum = charNum; } /** * Return the line number for this literal. */ public int lineNum() { return myLineNum; } /** * Return the char number for this literal. */ public int charNum() { return myCharNum; } /** * typeCheck */ public Type typeCheck() { return new BoolType(); } public void codeGen(PrintWriter p) { Codegen.generate("li", Codegen.T0, 0); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("false"); } private int myLineNum; private int myCharNum; } class IdNode extends ExpNode { public IdNode(int lineNum, int charNum, String strVal) { myLineNum = lineNum; myCharNum = charNum; myStrVal = strVal; myIsGlobal = false; } /** * Link the given symbol to this ID. */ public void link(Sym sym) { mySym = sym; } /** * Return the name of this ID. */ public String name() { return myStrVal; } /** * Return the symbol associated with this ID. */ public Sym sym() { return mySym; } /** * Return the line number for this ID. */ public int lineNum() { return myLineNum; } /** * Return the char number for this ID. */ public int charNum() { return myCharNum; } public int offset() { return myOffset; } /** * nameAnalysis * Given a symbol table symTab, do: * - check for use of undeclared name * - if ok, link to symbol table entry */ public void nameAnalysis(SymTable symTab) { Sym sym = symTab.lookupGlobal(myStrVal); if (sym == null) { ErrMsg.fatal(myLineNum, myCharNum, "Undeclared identifier"); } else { link(sym); } } /** * typeCheck */ public Type typeCheck() { if (mySym != null) { return mySym.getType(); } else { System.err.println("ID with null sym field in IdNode.typeCheck"); System.exit(-1); } return null; } public void jmpLnkGen() { if (myStrVal.equals("main")) { Codegen.generate("jal", "main"); } Codegen.generate("jal", "_" + myStrVal); } public void codeGen(PrintWriter p) { if(myIsGlobal) { Codegen.generate("lw", Codegen.T0, "_" + myStrVal); Codegen.genPush(Codegen.T0); } else { Codegen.generateIndexed("lw", Codegen.T0, Codegen.FP, -1 * myOffset); Codegen.genPush(Codegen.T0); } } public void addrGen() { if(myIsGlobal) { Codegen.generate("la", Codegen.T0, "_" + myStrVal); Codegen.genPush(Codegen.T0); } else { Codegen.generateIndexed("la", Codegen.T0, Codegen.FP, -1 * myOffset); Codegen.genPush(Codegen.T0); } } public void unparse(PrintWriter p, int indent) { p.print(myStrVal); if (mySym != null) { p.print("(" + mySym + ")"); } } private int myLineNum; private int myCharNum; private String myStrVal; private Sym mySym; public boolean myIsGlobal; private int myOffset; } class DotAccessExpNode extends ExpNode { public DotAccessExpNode(ExpNode loc, IdNode id) { myLoc = loc; myId = id; mySym = null; } /** * Return the symbol associated with this dot-access node. */ public Sym sym() { return mySym; } /** * Return the line number for this dot-access node. * The line number is the one corresponding to the RHS of the dot-access. */ public int lineNum() { return myId.lineNum(); } /** * Return the char number for this dot-access node. * The char number is the one corresponding to the RHS of the dot-access. */ public int charNum() { return myId.charNum(); } /** * nameAnalysis * Given a symbol table symTab, do: * - process the LHS of the dot-access * - process the RHS of the dot-access * - if the RHS is of a struct type, set the sym for this node so that * a dot-access "higher up" in the AST can get access to the symbol * table for the appropriate struct definition */ public void nameAnalysis(SymTable symTab) { badAccess = false; SymTable structSymTab = null; // to lookup RHS of dot-access Sym sym = null; myLoc.nameAnalysis(symTab); // do name analysis on LHS // if myLoc is really an ID, then sym will be a link to the ID's symbol if (myLoc instanceof IdNode) { IdNode id = (IdNode)myLoc; sym = id.sym(); // check ID has been declared to be of a struct type if (sym == null) { // ID was undeclared badAccess = true; } else if (sym instanceof StructSym) { // get symbol table for struct type Sym tempSym = ((StructSym)sym).getStructType().sym(); structSymTab = ((StructDefSym)tempSym).getSymTable(); } else { // LHS is not a struct type ErrMsg.fatal(id.lineNum(), id.charNum(), "Dot-access of non-struct type"); badAccess = true; } } // if myLoc is really a dot-access (i.e., myLoc was of the form // LHSloc.RHSid), then sym will either be // null - indicating RHSid is not of a struct type, or // a link to the Sym for the struct type RHSid was declared to be else if (myLoc instanceof DotAccessExpNode) { DotAccessExpNode loc = (DotAccessExpNode)myLoc; if (loc.badAccess) { // if errors in processing myLoc badAccess = true; // don't continue proccessing this dot-access } else { // no errors in processing myLoc sym = loc.sym(); if (sym == null) { // no struct in which to look up RHS ErrMsg.fatal(loc.lineNum(), loc.charNum(), "Dot-access of non-struct type"); badAccess = true; } else { // get the struct's symbol table in which to lookup RHS if (sym instanceof StructDefSym) { structSymTab = ((StructDefSym)sym).getSymTable(); } else { System.err.println("Unexpected Sym type in DotAccessExpNode"); System.exit(-1); } } } } else { // don't know what kind of thing myLoc is System.err.println("Unexpected node type in LHS of dot-access"); System.exit(-1); } // do name analysis on RHS of dot-access in the struct's symbol table if (!badAccess) { sym = structSymTab.lookupGlobal(myId.name()); // lookup if (sym == null) { // not found - RHS is not a valid field name ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Invalid struct field name"); badAccess = true; } else { myId.link(sym); // link the symbol // if RHS is itself as struct type, link the symbol for its struct // type to this dot-access node (to allow chained dot-access) if (sym instanceof StructSym) { mySym = ((StructSym)sym).getStructType().sym(); } } } } /** * typeCheck */ public Type typeCheck() { return myId.typeCheck(); } public void codeGen(PrintWriter p) { } public void unparse(PrintWriter p, int indent) { myLoc.unparse(p, 0); p.print("."); myId.unparse(p, 0); } // 2 kids private ExpNode myLoc; private IdNode myId; private Sym mySym; // link to Sym for struct type private boolean badAccess; // to prevent multiple, cascading errors } class AssignNode extends ExpNode { public AssignNode(ExpNode lhs, ExpNode exp) { myLhs = lhs; myExp = exp; } /** * Return the line number for this assignment node. * The line number is the one corresponding to the left operand. */ public int lineNum() { return myLhs.lineNum(); } /** * Return the char number for this assignment node. * The char number is the one corresponding to the left operand. */ public int charNum() { return myLhs.charNum(); } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's * two children */ public void nameAnalysis(SymTable symTab) { myLhs.nameAnalysis(symTab); myExp.nameAnalysis(symTab); } /** * typeCheck */ public Type typeCheck() { Type typeLhs = myLhs.typeCheck(); Type typeExp = myExp.typeCheck(); Type retType = typeLhs; if (typeLhs.isFnType() && typeExp.isFnType()) { ErrMsg.fatal(lineNum(), charNum(), "Function assignment"); retType = new ErrorType(); } if (typeLhs.isStructDefType() && typeExp.isStructDefType()) { ErrMsg.fatal(lineNum(), charNum(), "Struct name assignment"); retType = new ErrorType(); } if (typeLhs.isStructType() && typeExp.isStructType()) { ErrMsg.fatal(lineNum(), charNum(), "Struct variable assignment"); retType = new ErrorType(); } if (!typeLhs.equals(typeExp) && !typeLhs.isErrorType() && !typeExp.isErrorType()) { ErrMsg.fatal(lineNum(), charNum(), "Type mismatch"); retType = new ErrorType(); } if (typeLhs.isErrorType() || typeExp.isErrorType()) { retType = new ErrorType(); } return retType; } public void codeGen(PrintWriter p) { myExp.codeGen(p); if(!(myLhs instanceof DotAccessExpNode)){ ((IdNode)myLhs).addrGen(); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generateIndexed("sw", Codegen.T1, Codegen.T0, 0); Codegen.genPush(Codegen.T1); } } public void unparse(PrintWriter p, int indent) { if (indent != -1) p.print("("); myLhs.unparse(p, 0); p.print(" = "); myExp.unparse(p, 0); if (indent != -1) p.print(")"); } // 2 kids private ExpNode myLhs; private ExpNode myExp; } class CallExpNode extends ExpNode { public CallExpNode(IdNode name, ExpListNode elist) { myId = name; myExpList = elist; } public CallExpNode(IdNode name) { myId = name; myExpList = new ExpListNode(new LinkedList<ExpNode>()); } /** * Return the line number for this call node. * The line number is the one corresponding to the function name. */ public int lineNum() { return myId.lineNum(); } /** * Return the char number for this call node. * The char number is the one corresponding to the function name. */ public int charNum() { return myId.charNum(); } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's * two children */ public void nameAnalysis(SymTable symTab) { myId.nameAnalysis(symTab); myExpList.nameAnalysis(symTab); } /** * typeCheck */ public Type typeCheck() { if (!myId.typeCheck().isFnType()) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Attempt to call a non-function"); return new ErrorType(); } FnSym fnSym = (FnSym)(myId.sym()); if (fnSym == null) { System.err.println("null sym for Id in CallExpNode.typeCheck"); System.exit(-1); } if (myExpList.size() != fnSym.getNumParams()) { ErrMsg.fatal(myId.lineNum(), myId.charNum(), "Function call with wrong number of args"); return fnSym.getReturnType(); } myExpList.typeCheck(fnSym.getParamTypes()); return fnSym.getReturnType(); } public void codeGen(PrintWriter p) { myExpList.codeGen(p); myId.jmpLnkGen(); Codegen.genPush(Codegen.V0); } // ** unparse ** public void unparse(PrintWriter p, int indent) { myId.unparse(p, 0); p.print("("); if (myExpList != null) { myExpList.unparse(p, 0); } p.print(")"); } // 2 kids private IdNode myId; private ExpListNode myExpList; // possibly null } abstract class UnaryExpNode extends ExpNode { public UnaryExpNode(ExpNode exp) { myExp = exp; } /** * Return the line number for this unary expression node. * The line number is the one corresponding to the operand. */ public int lineNum() { return myExp.lineNum(); } /** * Return the char number for this unary expression node. * The char number is the one corresponding to the operand. */ public int charNum() { return myExp.charNum(); } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's child */ public void nameAnalysis(SymTable symTab) { myExp.nameAnalysis(symTab); } // one child protected ExpNode myExp; } abstract class BinaryExpNode extends ExpNode { public BinaryExpNode(ExpNode exp1, ExpNode exp2) { myExp1 = exp1; myExp2 = exp2; } /** * Return the line number for this binary expression node. * The line number is the one corresponding to the left operand. */ public int lineNum() { return myExp1.lineNum(); } /** * Return the char number for this binary expression node. * The char number is the one corresponding to the left operand. */ public int charNum() { return myExp1.charNum(); } /** * nameAnalysis * Given a symbol table symTab, perform name analysis on this node's * two children */ public void nameAnalysis(SymTable symTab) { myExp1.nameAnalysis(symTab); myExp2.nameAnalysis(symTab); } // two kids protected ExpNode myExp1; protected ExpNode myExp2; } // ********************************************************************** // Subclasses of UnaryExpNode // ********************************************************************** class UnaryMinusNode extends UnaryExpNode { public UnaryMinusNode(ExpNode exp) { super(exp); } /** * typeCheck */ public Type typeCheck() { Type type = myExp.typeCheck(); Type retType = new IntType(); if (!type.isErrorType() && !type.isIntType()) { ErrMsg.fatal(lineNum(), charNum(), "Arithmetic operator applied to non-numeric operand"); retType = new ErrorType(); } if (type.isErrorType()) { retType = new ErrorType(); } return retType; } public void codeGen(PrintWriter p) { myExp.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.generate("li", Codegen.T1, 0); Codegen.generate("sub", Codegen.T0, Codegen.T1, Codegen.T0); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("(-"); myExp.unparse(p, 0); p.print(")"); } } class NotNode extends UnaryExpNode { public NotNode(ExpNode exp) { super(exp); } /** * typeCheck */ public Type typeCheck() { Type type = myExp.typeCheck(); Type retType = new BoolType(); if (!type.isErrorType() && !type.isBoolType()) { ErrMsg.fatal(lineNum(), charNum(), "Logical operator applied to non-bool operand"); retType = new ErrorType(); } if (type.isErrorType()) { retType = new ErrorType(); } return retType; } public void codeGen(PrintWriter p) { myExp.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.generate("li", Codegen.T1, 1); Codegen.generate("xor", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("(!"); myExp.unparse(p, 0); p.print(")"); } } // ********************************************************************** // Subclasses of BinaryExpNode // ********************************************************************** abstract class ArithmeticExpNode extends BinaryExpNode { public ArithmeticExpNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } /** * typeCheck */ public Type typeCheck() { Type type1 = myExp1.typeCheck(); Type type2 = myExp2.typeCheck(); Type retType = new IntType(); if (!type1.isErrorType() && !type1.isIntType()) { ErrMsg.fatal(myExp1.lineNum(), myExp1.charNum(), "Arithmetic operator applied to non-numeric operand"); retType = new ErrorType(); } if (!type2.isErrorType() && !type2.isIntType()) { ErrMsg.fatal(myExp2.lineNum(), myExp2.charNum(), "Arithmetic operator applied to non-numeric operand"); retType = new ErrorType(); } if (type1.isErrorType() || type2.isErrorType()) { retType = new ErrorType(); } return retType; } } abstract class LogicalExpNode extends BinaryExpNode { public LogicalExpNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } /** * typeCheck */ public Type typeCheck() { Type type1 = myExp1.typeCheck(); Type type2 = myExp2.typeCheck(); Type retType = new BoolType(); if (!type1.isErrorType() && !type1.isBoolType()) { ErrMsg.fatal(myExp1.lineNum(), myExp1.charNum(), "Logical operator applied to non-bool operand"); retType = new ErrorType(); } if (!type2.isErrorType() && !type2.isBoolType()) { ErrMsg.fatal(myExp2.lineNum(), myExp2.charNum(), "Logical operator applied to non-bool operand"); retType = new ErrorType(); } if (type1.isErrorType() || type2.isErrorType()) { retType = new ErrorType(); } return retType; } } abstract class EqualityExpNode extends BinaryExpNode { public EqualityExpNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } /** * typeCheck */ public Type typeCheck() { Type type1 = myExp1.typeCheck(); Type type2 = myExp2.typeCheck(); Type retType = new BoolType(); if (type1.isVoidType() && type2.isVoidType()) { ErrMsg.fatal(lineNum(), charNum(), "Equality operator applied to void functions"); retType = new ErrorType(); } if (type1.isFnType() && type2.isFnType()) { ErrMsg.fatal(lineNum(), charNum(), "Equality operator applied to functions"); retType = new ErrorType(); } if (type1.isStructDefType() && type2.isStructDefType()) { ErrMsg.fatal(lineNum(), charNum(), "Equality operator applied to struct names"); retType = new ErrorType(); } if (type1.isStructType() && type2.isStructType()) { ErrMsg.fatal(lineNum(), charNum(), "Equality operator applied to struct variables"); retType = new ErrorType(); } if (!type1.equals(type2) && !type1.isErrorType() && !type2.isErrorType()) { ErrMsg.fatal(lineNum(), charNum(), "Type mismatch"); retType = new ErrorType(); } if (type1.isErrorType() || type2.isErrorType()) { retType = new ErrorType(); } return retType; } } abstract class RelationalExpNode extends BinaryExpNode { public RelationalExpNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } /** * typeCheck */ public Type typeCheck() { Type type1 = myExp1.typeCheck(); Type type2 = myExp2.typeCheck(); Type retType = new BoolType(); if (!type1.isErrorType() && !type1.isIntType()) { ErrMsg.fatal(myExp1.lineNum(), myExp1.charNum(), "Relational operator applied to non-numeric operand"); retType = new ErrorType(); } if (!type2.isErrorType() && !type2.isIntType()) { ErrMsg.fatal(myExp2.lineNum(), myExp2.charNum(), "Relational operator applied to non-numeric operand"); retType = new ErrorType(); } if (type1.isErrorType() || type2.isErrorType()) { retType = new ErrorType(); } return retType; } } class PlusNode extends ArithmeticExpNode { public PlusNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("add", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" + "); myExp2.unparse(p, 0); p.print(")"); } } class MinusNode extends ArithmeticExpNode { public MinusNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("sub", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" - "); myExp2.unparse(p, 0); p.print(")"); } } class TimesNode extends ArithmeticExpNode { public TimesNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("mult", Codegen.T0, Codegen.T1); Codegen.generate("mflo", Codegen.T0); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" * "); myExp2.unparse(p, 0); p.print(")"); } } class DivideNode extends ArithmeticExpNode { public DivideNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("mult", Codegen.T0, Codegen.T1); Codegen.generate("mflo", Codegen.T0); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" / "); myExp2.unparse(p, 0); p.print(")"); } } class AndNode extends LogicalExpNode { public AndNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); String skip = Codegen.nextLabel(); String done = Codegen.nextLabel(); Codegen.genPop(Codegen.T0); Codegen.generate("beq", Codegen.T0, "0", skip); myExp2.codeGen(p); Codegen.generate("j", done); Codegen.genLabel(skip); Codegen.genPush(Codegen.T0); Codegen.genLabel(done); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" && "); myExp2.unparse(p, 0); p.print(")"); } } class OrNode extends LogicalExpNode { public OrNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); String skip = Codegen.nextLabel(); String done = Codegen.nextLabel(); Codegen.genPop(Codegen.T0); Codegen.generate("beq", Codegen.T0, "1", skip); myExp2.codeGen(p); Codegen.generate("j", done); Codegen.genLabel(skip); Codegen.genPush(Codegen.T0); Codegen.genLabel(done); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" || "); myExp2.unparse(p, 0); p.print(")"); } } class EqualsNode extends EqualityExpNode { public EqualsNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { if(myExp1 instanceof StringLitNode && myExp2 instanceof StringLitNode){ String s1 = ((StringLitNode)myExp1).strVal(); String s2 = ((StringLitNode)myExp2).strVal(); if (s1.equals(s2)) { Codegen.generate("li", Codegen.T0, 0); Codegen.genPush(Codegen.T0); Codegen.generate("li", Codegen.T1, 0); Codegen.genPush(Codegen.T1); } else { Codegen.generate("li", Codegen.T0, 0); Codegen.genPush(Codegen.T0); Codegen.generate("li", Codegen.T1, 1); Codegen.genPush(Codegen.T1); } }else{ myExp1.codeGen(p); myExp2.codeGen(p); } String skip = Codegen.nextLabel(); String done = Codegen.nextLabel(); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("beq", Codegen.T0, Codegen.T1, skip); Codegen.generate("li", Codegen.T0, "0"); Codegen.generate("j", done); Codegen.genLabel(skip); Codegen.generate("li", Codegen.T0, "1"); Codegen.genLabel(done); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" == "); myExp2.unparse(p, 0); p.print(")"); } } class NotEqualsNode extends EqualityExpNode { public NotEqualsNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { if(myExp1 instanceof StringLitNode && myExp2 instanceof StringLitNode){ String s1 = ((StringLitNode)myExp1).strVal(); String s2 = ((StringLitNode)myExp2).strVal(); if (s1.equals(s2)) { Codegen.generate("li", Codegen.T0, 1); Codegen.genPush(Codegen.T0); Codegen.generate("li", Codegen.T1, 0); Codegen.genPush(Codegen.T1); } else { Codegen.generate("li", Codegen.T0, 0); Codegen.genPush(Codegen.T0); Codegen.generate("li", Codegen.T1, 0); Codegen.genPush(Codegen.T1); } }else{ myExp1.codeGen(p); myExp2.codeGen(p); } String skip = Codegen.nextLabel(); String done = Codegen.nextLabel(); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("bne", Codegen.T0, Codegen.T1, skip); Codegen.generate("li", Codegen.T0, "0"); Codegen.generate("j", done); Codegen.genLabel(skip); Codegen.generate("li", Codegen.T0, "1"); Codegen.genLabel(done); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" != "); myExp2.unparse(p, 0); p.print(")"); } } class LessNode extends RelationalExpNode { public LessNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("slt", Codegen.T0, Codegen.T1, Codegen.T0); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" < "); myExp2.unparse(p, 0); p.print(")"); } } class GreaterNode extends RelationalExpNode { public GreaterNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("slt", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" > "); myExp2.unparse(p, 0); p.print(")"); } } class LessEqNode extends RelationalExpNode { public LessEqNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("slt", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.generate("li", Codegen.T1, 1); Codegen.generate("xor", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" <= "); myExp2.unparse(p, 0); p.print(")"); } } class GreaterEqNode extends RelationalExpNode { public GreaterEqNode(ExpNode exp1, ExpNode exp2) { super(exp1, exp2); } public void codeGen(PrintWriter p) { myExp1.codeGen(p); myExp2.codeGen(p); Codegen.genPop(Codegen.T0); Codegen.genPop(Codegen.T1); Codegen.generate("slt", Codegen.T0, Codegen.T1, Codegen.T0); Codegen.generate("li", Codegen.T1, 1); Codegen.generate("xor", Codegen.T0, Codegen.T0, Codegen.T1); Codegen.genPush(Codegen.T0); } public void unparse(PrintWriter p, int indent) { p.print("("); myExp1.unparse(p, 0); p.print(" >= "); myExp2.unparse(p, 0); p.print(")"); } }
[ "danghao1996@gmail.com" ]
danghao1996@gmail.com
48cae60441fd40cbbfaabfb5e9911ab4bb5f16a4
d8df366ece25df8b8bb126bab0dd0204d284538b
/SocialGossipClient/src/RMINotifier.java
fa761844606dd565754c4e39d257cfbae58fd431
[]
no_license
LorenzoBellomo/ProgettoReti
4cf803b8b87451a5cbc7fa57a5c3d5a3d7fb3fef
8a3ededa5fd965b16ca06dede7423d47e8204f24
refs/heads/master
2020-04-13T02:51:29.134533
2019-02-24T10:37:03
2019-02-24T10:37:03
162,913,616
0
0
null
null
null
null
UTF-8
Java
false
false
1,755
java
import java.rmi.RemoteException; import java.rmi.server.RemoteObject; import java.util.Vector; import condivise.Notifier; /** * Classe che implementa le notifiche di tipo RMI per il cambio di stato di * amici di un utente. * * @author Lorenzo Bellomo, Nicolo' Lucchesi */ public class RMINotifier extends RemoteObject implements Notifier { private static final long serialVersionUID = 1L; // il vector di user online e offline private Vector<String> online; private Vector<String> offline; // l'oggetto resposabile della GUI private SG_Home home; public RMINotifier(Vector<String> online, Vector<String> offline, SG_Home home) throws RemoteException { // COSTRUTTORE super(); // di RemoteObject this.online = online; this.offline = offline; this.home = home; } /** * Metodi che implementano le funzioni RMI di notifica al client del * cambiamento di stato di un amico */ public void NotifyOnlineFriend(String nickname) throws RemoteException { if (!this.offline.remove(nickname)) { // nuovo amico, non era presente prima nel vettore offline // aggiungo l'amico nell'interfaccia home.addFriend(nickname); } // notifico la GUI del cambiamento di stato home.changeStatus(nickname, 1); // aggiungo l'amico anche al vettore degli amici online this.online.add(nickname); } public void NotifyOfflineFriend(String nickname) throws RemoteException { if (!this.online.remove(nickname)) { // nuovo amico, non era presente prima nel vettore online // aggiungo l'amico nell'interfaccia home.addFriend(nickname); } // notifico la GUI del cambiamento di stato home.changeStatus(nickname, 0); // aggiungo l'amico anche al vettore degli amici offline this.offline.add(nickname); } }
[ "lorenzo.bellomo.lb@gmail.com" ]
lorenzo.bellomo.lb@gmail.com
f2766e8d8c73992314729cbf976f184e210524e1
f868ff6486e65dff54d5aefda6c3cc8a969b6cb8
/src/test/java/StepDefinition/Handledropdowm.java
6c03c9744c602bf04b7aeeb6418b0912de7b161c
[]
no_license
remo241195/practiceautomation
401a4f28f97a591125398f2dfae7c047225cc601
3f2f4d327fa7bc1d37722f524381f8cbf4bad4d2
refs/heads/master
2023-07-06T08:44:02.389280
2021-08-12T05:12:01
2021-08-12T05:12:01
395,191,659
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package StepDefinition; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; import io.github.bonigarcia.wdm.WebDriverManager; public class Handledropdowm { public static void main(String[] args) throws InterruptedException { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("https://www.opencart.com/index.php?route=account/register"); // driver.findElement(By.linkText("REGISTER")).click(); WebElement Dropdownele =driver.findElement(By.xpath("//select[@id='input-country']")); Select dropdown = new Select(Dropdownele); dropdown.selectByVisibleText("Angola"); Thread.sleep(5000); dropdown.selectByValue("10"); Thread.sleep(5000); dropdown.selectByIndex(13); } }
[ "rohiteceremo@gmail.com" ]
rohiteceremo@gmail.com
71b7feaaeea40be5f0938207256530c7e1ed950f
6d9155c8f842b510f703d6027d961557a4b0b51f
/pitalium/src/main/java/com/htmlhifive/pitalium/core/model/ExecResult.java
ee77b7ee63313020a5226aa71a6d4e77569ab0ae
[ "Apache-2.0" ]
permissive
noxi515/hifive-pitalium
5df5059511d455820fffe75be9e225b85768068b
64dd0105f9378929f368aab1e465bb11cd3a3019
refs/heads/master
2020-04-01T23:35:40.343847
2016-08-02T03:17:26
2016-08-02T03:17:26
49,244,935
0
0
null
2016-01-08T02:46:03
2016-01-08T02:46:03
null
UTF-8
Java
false
false
1,107
java
/* * Copyright (C) 2015-2016 NS Solutions Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.htmlhifive.pitalium.core.model; /** * テストの実行結果を表す列挙 */ public enum ExecResult { /** * テスト成功 */ SUCCESS { @Override public boolean isSuccess() { return true; } }, /** * テスト失敗 */ FAILURE; /** * テスト実行結果が成功したかどうかを取得します。 * * @return テスト実行結果が成功の場合true、それ以外はfalse */ public boolean isSuccess() { return false; } }
[ "nakatani.taizo.38x@jp.nssol.nssmc.com" ]
nakatani.taizo.38x@jp.nssol.nssmc.com
4364ae787bcee3dacf98888522a81008dd2a98ce
1e75f37c7dd35a9344f66380683e4c162d19919e
/src/main/java/com/TB/TBox/future/servlet/FutureServlet.java
aa7568d31e7a8084e93d83cd9d218ced37b37e88
[]
no_license
DonovanDuck/WBTB
38fe037ccfd9d19383ed2002b79ee202ebdbc1f6
5aa9382b2e08ab94b74311c94f4168b836fabb78
refs/heads/master
2021-07-17T16:58:23.256037
2017-10-24T10:06:59
2017-10-24T10:06:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,389
java
package com.TB.TBox.future.servlet; import java.io.IOException; import java.io.PrintWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.TB.TBox.future.bean.Future; import com.TB.TBox.future.bean.Message; import com.TB.TBox.future.service.FutureService; import com.TB.TBox.jobClass.FutureNote; import com.TB.TBox.push.bean.PushMsg; import com.TB.TBox.push.service.PushMsgService; import com.TB.TBox.user.servlet.FriendServlet; import com.TB.base.quartz.QuartzThreadPool; import com.TB.push.PushMsgToSingleDevice; import com.baidu.yun.push.exception.PushClientException; import com.baidu.yun.push.exception.PushServerException; import com.google.gson.Gson; @Controller @RequestMapping("/future") @Scope("prototype") public class FutureServlet { Gson gson = new Gson(); Logger log = Logger.getLogger(FriendServlet.class); DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat preFormat = new SimpleDateFormat("yyyy-MM-dd "); @Autowired private Future future; @Autowired private FutureService futureService; @Autowired private FutureNote futureNote; /** * 添加未来纸条 * * @param request * @param response * @throws IOException */ @RequestMapping(value = "/addFuture", method = RequestMethod.POST) public void addFuture(HttpServletRequest request, HttpServletResponse response) throws IOException { request.setCharacterEncoding("utf-8"); String formafrom = request.getParameter("afrom"); int afrom = Integer.parseInt(formafrom); String afterAcontent = request.getParameter("afterAcontent"); String aend = request.getParameter("aend"); Date date = new Date(); String abegin = format.format(date); System.out.println(abegin); future.setAbegin(abegin); future.setAend(aend); future.setAfrom(afrom); future.setAfterAcontent(afterAcontent); future.setAstatus(0); futureService.addFuture(future); QuartzThreadPool q = new QuartzThreadPool(); q.setText("FutureNote", aend + " 09:00:00"); response.setContentType("text/json;charset=UTF-8"); PrintWriter out = response.getWriter(); out.print("添加成功!"); out.flush(); out.close(); } /** * 用户查询已经触发推送模块的未来表 * * @param request * @param response * @throws IOException */ @RequestMapping(value = "/selectUserFutureNoteByPre", method = RequestMethod.POST) public void selectUserFutureNoteByPre(HttpServletRequest request, HttpServletResponse response) throws IOException { request.setCharacterEncoding("utf-8"); int afrom = Integer.parseInt(request.getParameter("uid")); Map<String, Object> map = new HashMap<>(); List<Future> futureList = new ArrayList<>(); Date date = new Date(); String aend = preFormat.format(date); int astatus = 1; map.put("afrom", afrom); map.put("aend", aend); map.put("astatus", astatus); futureList = futureService.selectUserFutureNoteByPre(map); response.setContentType("text/json;charset=UTF-8"); PrintWriter out = response.getWriter(); out.print(gson.toJson(futureList)); out.flush(); out.close(); // 查询完以后别修改状态为2表示已经查询完毕 for (Future future : futureList) { future.setAstatus(2); futureService.updateFutureStatus(future); } } @Test public void test() { Future future = new Future(); FutureService futureService = new FutureService(); int afrom = 1; Map<String, Object> map = new HashMap<>(); List<Future> futureList = new ArrayList<>(); Date date = new Date(); String aend = preFormat.format(date); System.out.println(aend); int astatus = 1; map.put("afrom", afrom); map.put("aend", aend); map.put("astatus", astatus); futureList = futureService.selectUserFutureNoteByPre(map); for (Future future1 : futureList) { log.info(gson.toJson(future1)); } } }
[ "m15735042025@163.com" ]
m15735042025@163.com
1b28f7d02f8e65ab56f085e6ef8bbcbd6af6b696
9616e98c592b06857f9ba1af75901052eb62167f
/Java_code_saves/eclipse_workspace/java_face_to_new/src/overloading/driver.java
ccc256d85f59f66ea8a2bcc499b4b33e875532e4
[]
no_license
Sliense-ysd/world
1dc40ad904f3a429aaf0032d609971b7ebc5a86b
592fd7fcb7d51d61afa5282bad1caf3d8731e4ab
refs/heads/master
2023-04-03T21:54:02.417464
2021-04-13T06:31:40
2021-04-13T06:31:40
265,842,944
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package overloading; public class driver { public driver(car c)//���췽���IJ�����һ������ { System.out.println("driver"); } }
[ "310842705@qq.com" ]
310842705@qq.com
7f5cbe15a36c35eb45a89512948cf56d87f2159e
dda45c60e7dba10de255d91192b23ba863035992
/FirstSpringConfigurationProject/src/com/springinaction/springidol/Juggler.java
7e9c184e19caebe88f44452b0cf84b237c7050e2
[]
no_license
anshuldevmehta/AnshulDevRepository
1b7d5a581d5202b7dac9c44a3a3acbdd45cf8185
6c4bacc3449136f4b7e0678d4c3d29a7049d3dff
refs/heads/master
2021-01-24T13:28:18.741239
2017-05-08T14:17:01
2017-05-08T14:19:44
37,931,510
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package com.springinaction.springidol; public class Juggler implements Performer { private int beanBags=3; public Juggler() { } public Juggler (int beanBags) { this.beanBags=beanBags; } @Override public void perform() { System.out.println("Juggling " + beanBags + " BEANBAGS"); } }
[ "devious_itinerant@yahoo.in" ]
devious_itinerant@yahoo.in
5a40dd1690d97c295a75c2397a3d289cd7db6777
51d6f00d7c9bbf8e52fb299fa48554b0c10b5a3d
/app/src/main/java/com/moria/finalexamflickerapp/GetFlickerJsonData.java
64b56a40979d18ea456f47bdbe7fa06b652d5d54
[]
no_license
moriayair/FinalExamFlickerApp
cfaf4a140b05176901f9d0c7e89e1a127be386c2
1c786571b870fc8a512d21f7b6eff67bb1a76762
refs/heads/master
2021-03-26T22:24:16.938151
2020-03-16T16:00:26
2020-03-16T16:00:26
247,756,557
0
0
null
null
null
null
UTF-8
Java
false
false
4,296
java
package com.moria.finalexamflickerapp; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; class GetFlickerJsonData extends AsyncTask<String,Void,List<Photo>> implements GetRawData.OnDownloadComplete { private static final String TAG = "GetFlickerJsonData"; private List<Photo>photoList = null; private String baseURL; private String language; private boolean matchAll; private final OnDataAvailable callBack; private boolean runningOnSameThread = false; interface OnDataAvailable { void onDataAvailable(List<Photo> data,DownloadStatus status); } public GetFlickerJsonData(OnDataAvailable callBack, String baseURL, String language, boolean matchAll ) { Log.d(TAG, "GetFlickerJsonData: called"); this.baseURL = baseURL; this.language = language; this.matchAll = matchAll; this.callBack = callBack; } void executeOnSameThread(String searchCriteria){ Log.d(TAG, "executeOnSameThread: starts"); runningOnSameThread = true; String destUri = createUri(searchCriteria,language,matchAll); GetRawData getRawData = new GetRawData(this); getRawData.execute(destUri); Log.d(TAG, "executeOnSameThread: ends"); } @Override protected void onPostExecute(List<Photo> photos) { Log.d(TAG, "onPostExecute: starts"); if (callBack != null){ callBack.onDataAvailable(photoList,DownloadStatus.OK); } Log.d(TAG, "onPostExecute: ends"); } @Override protected List<Photo> doInBackground(String... params) { Log.d(TAG, "doInBackground: starts"); String destUri = createUri(params[0],language,matchAll); GetRawData getRawData = new GetRawData(this); getRawData.runInSameThread(destUri); Log.d(TAG, "doInBackground: ends"); return photoList; } private String createUri(String searchCriteria, String language, boolean matchAll) { Log.d(TAG, "createUri: createUri starts"); return Uri.parse(baseURL).buildUpon() .appendQueryParameter("tags",searchCriteria) .appendQueryParameter("tagmode", matchAll ? "ALL" : "ANY") .appendQueryParameter("lang",language) .appendQueryParameter("format","json") .appendQueryParameter("nojsoncallback","1") .build().toString(); } @Override public void onDownloadComplete(String data, DownloadStatus status) { Log.d(TAG, "onDownloadComplete: starts status = " + status); if (status == DownloadStatus.OK){ photoList = new ArrayList<>(); try{ JSONObject jsonData = new JSONObject(data); JSONArray itemsArray = jsonData.getJSONArray("items"); for (int i = 0; i < itemsArray.length(); i++) { JSONObject jsonPhoto = itemsArray.getJSONObject(i); String title = jsonPhoto.getString("title"); String author = jsonPhoto.getString("author"); String authorId = jsonPhoto.getString("author_id"); String tags = jsonPhoto.getString("tags"); JSONObject jsonMedia = jsonPhoto.getJSONObject("media"); String photoUrl = jsonMedia.getString("m"); String link = photoUrl.replaceFirst("_m.","_b."); Photo photoObject = new Photo(title,author,authorId,link,tags,photoUrl); photoList.add(photoObject); Log.d(TAG, "onDownloadComplete: " + photoObject.toString()); } }catch (JSONException jsone){ jsone.printStackTrace(); Log.e(TAG, "onDownloadComplete: Error procesing Json data " + jsone.getMessage() ); status = DownloadStatus.FAILED_OR_EMPTY; } } if (runningOnSameThread == true && callBack != null){ callBack.onDataAvailable(photoList,status); } Log.d(TAG, "onDownloadComplete: ends"); } }
[ "moriayair@h-MacBook-Pro-sl-Moria.local" ]
moriayair@h-MacBook-Pro-sl-Moria.local
876b16057661a92793a5a12338dc28e215acfb00
d523206fce46708a6fe7b2fa90e81377ab7b6024
/com/google/android/gms/wearable/DataItemAsset.java
cb593bd5ac69abeae9f2eeef6190a6b41b4bd6ba
[]
no_license
BlitzModder/BlitzJava
0ee94cc069dc4b7371d1399ff5575471bdc88aac
6c6d71d2847dfd5f9f4f7c716cd820aeb7e45f2c
refs/heads/master
2021-06-11T15:04:05.571324
2017-02-04T16:04:55
2017-02-04T16:04:55
77,459,517
1
2
null
null
null
null
UTF-8
Java
false
false
479
java
package com.google.android.gms.wearable; import com.google.android.gms.common.data.Freezable; public abstract interface DataItemAsset extends Freezable<DataItemAsset> { public abstract String getDataItemKey(); public abstract String getId(); } /* Location: /Users/subdiox/Downloads/dex2jar-2.0/net.wargaming.wot.blitz-dex2jar.jar!/com/google/android/gms/wearable/DataItemAsset.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "subdiox@gmail.com" ]
subdiox@gmail.com
b9020373191ebe38e2c27da7347c9b1ef3c6188c
8a59b3ae74c214e48dd72268abac67009f887713
/LevenshteinEditDistance.java
ecb81030469cf518153e739a1d6cb10431b0c7ea
[]
no_license
lyridwan/Levenshtein-Edit-Distance
5d55adf0fc2e0dd9b01a8897c3a76f26c3831a11
3d3071c17b4f73953c9d3fd7163ee6da3e3d3d69
refs/heads/master
2021-07-17T17:17:16.330925
2017-10-25T06:33:57
2017-10-25T06:33:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,159
java
import java.awt.Point; import java.util.HashMap; import java.util.Map; import java.util.*; public class LevenshteinEditDistance { /** * Denotes the fact that one character in one input string was removed. */ public static final String GAP = "-"; public static final class LevenshteinEditDistanceResult { private final int distance; private final String editSequence; private final String topAlignmentRow; private final String bottomAlignmentRow; LevenshteinEditDistanceResult(final int distance, final String editSequence, final String topAlignmentRow, final String bottomAlignmentRow) { this.distance = distance; this.editSequence = editSequence; this.topAlignmentRow = topAlignmentRow; this.bottomAlignmentRow = bottomAlignmentRow; } public int getDistance() { return distance; } public String getEditSequence() { return editSequence; } public String getTopAlignmentRow() { return topAlignmentRow; } public String getBottomAlignmentRow() { return bottomAlignmentRow; } } private static enum EditOperation { INSERT ("I"), SUBSTITUTE ("S"), DELETE ("D"), NONE ("N"); private final String s; private EditOperation(String s) { this.s = s; } @Override public String toString() { return s; } } public static LevenshteinEditDistanceResult compute(String s, String z) { // This is required to keep the parent map invariant. If we did not do // this, the very first edit operation would not end up in the output. // For more details, comment out the following two rows and see what // happens. s = "\u0000" + s; z = "\u0000" + z; final int n = s.length(); final int m = z.length(); final int[][] d = new int[m + 1][n + 1]; final Map<Point, Point> parentMap = new HashMap<>(); for (int i = 1; i <= m; ++i) { d[i][0] = i; } for (int j = 1; j <= n; ++j) { d[0][j] = j; } for (int j = 1; j <= n; ++j) { for (int i = 1; i <= m; ++i) { //subtitution param final int delta = (s.charAt(j - 1) == z.charAt(i - 1)) ? 0 : 2; int tentativeDistance = d[i - 1][j] + 1; EditOperation editOperation = EditOperation.INSERT; if (tentativeDistance > d[i][j - 1] + 1) { tentativeDistance = d[i][j - 1] + 1; editOperation = EditOperation.DELETE; } if (tentativeDistance > d[i - 1][j - 1] + delta) { tentativeDistance = d[i - 1][j - 1] + delta; editOperation = EditOperation.SUBSTITUTE; } d[i][j] = tentativeDistance; switch (editOperation) { case SUBSTITUTE: parentMap.put(new Point(i, j), new Point(i - 1, j - 1)); break; case INSERT: parentMap.put(new Point(i, j), new Point(i - 1, j)); break; case DELETE: parentMap.put(new Point(i, j), new Point(i, j - 1)); break; } } } final StringBuilder topLineBuilder = new StringBuilder(n + m); final StringBuilder bottomLineBuilder = new StringBuilder(n + m); final StringBuilder editSequenceBuilder = new StringBuilder(n + m); Point current = new Point(m, n); while (true) { Point predecessor = parentMap.get(current); if (predecessor == null) { break; } if (current.x != predecessor.x && current.y != predecessor.y) { final char schar = s.charAt(predecessor.y); final char zchar = z.charAt(predecessor.x); topLineBuilder.append(schar); bottomLineBuilder.append(zchar); editSequenceBuilder.append(schar != zchar ? EditOperation.SUBSTITUTE : EditOperation.NONE); } else if (current.x != predecessor.x) { topLineBuilder.append(GAP); bottomLineBuilder.append(z.charAt(predecessor.x)); editSequenceBuilder.append(EditOperation.INSERT); } else { topLineBuilder.append(s.charAt(predecessor.y)); bottomLineBuilder.append(GAP); editSequenceBuilder.append(EditOperation.DELETE); } current = predecessor; } // Remove the last characters that correspond to the very beginning // of the alignments and edit sequence (since the path reconstructoin // proceeds from the "end" to the "beginning" of the distance matrix. topLineBuilder .deleteCharAt(topLineBuilder.length() - 1); bottomLineBuilder .deleteCharAt(bottomLineBuilder.length() - 1); editSequenceBuilder.deleteCharAt(editSequenceBuilder.length() - 1); // Our result data is backwards, reverse them. topLineBuilder .reverse(); bottomLineBuilder .reverse(); editSequenceBuilder.reverse(); return new LevenshteinEditDistanceResult(d[m][n], editSequenceBuilder.toString(), topLineBuilder.toString(), bottomLineBuilder.toString()); } public static void main(String[] args) { String string1 = new String(); String string2 = new String(); Scanner scanner = new Scanner(System.in); System.out.println("+-----------------+"); System.out.println("| Input |"); System.out.println("+-----------------+\n"); System.out.println("Input Word 1: "); try{ string1 = scanner.next(); }catch (Exception e) { } System.out.println("Input Word 2: "); try{ string2 = scanner.next(); }catch (Exception e) { } System.out.println("\n+-----------------+"); System.out.println("| Output |"); System.out.println("+-----------------+\n"); LevenshteinEditDistanceResult result = compute(string1, string2); System.out.println("Distance: " + result.getDistance() + "\n"); System.out.println("Alignment:"); System.out.println(result.getTopAlignmentRow()); System.out.println(result.getBottomAlignmentRow()); } }
[ "just.muhammadridwan@gmail.com" ]
just.muhammadridwan@gmail.com
8206d480b678443ac023cdfb3a2769d0f9a8a573
e564bba06783dbed110d1da7420bd644fc2e7555
/src/main/java/Servlets/GetUserImagesServlet.java
8aab8eace88b4a0fa8d23d3ebcfeeb1319b91878
[]
no_license
Freeuni-Lekva/final-project-binder
08d16c4f657302430d31e4dff393e9aefe865d41
6c56b091976d49af1bff2f74cd3ea759bca7f132
refs/heads/master
2023-07-09T04:28:19.470841
2021-08-16T07:44:39
2021-08-16T07:44:39
382,918,400
0
0
null
null
null
null
UTF-8
Java
false
false
1,705
java
package Servlets; import DAO.PersonalInfoDAO; import DAO.SessionsDAO; import DAO.SuggestionDataDAO; import DAO.UserImagesDAO; import Model.PersonalUserInfo; import com.google.gson.Gson; 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; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Random; @WebServlet(name = "GetUserImagesServlet", value = "/GetUserImagesServlet") public class GetUserImagesServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { int user_profile_id = Integer.valueOf(request.getParameter("suggestedPersonalId")); PrintWriter out = response.getWriter(); try { SessionsDAO.getUser_id(request.getSession(false).getId()); PersonalUserInfo userInfo = PersonalInfoDAO.getUserInfoByPersonalID(user_profile_id); String result = UserImagesDAO.getUserImages(userInfo.getUser_profile_id()); if (result.isEmpty()) { return; } String json = (new Gson()).toJson(result); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(json); } catch (SQLException throwables) { throwables.printStackTrace(); } } }
[ "gurami.abramishvili@gmail.com" ]
gurami.abramishvili@gmail.com
8ecb00b68fdaa06ee58e9297bc7e4827e1485319
76c0c7f7b90a8c94431a848c1fd4637aa44aa78a
/gulimall-member/src/main/java/com/atguigu/gulimall/member/controller/MemberLevelController.java
7a674b10422021b055470c9fb12610a894cbca0a
[ "Apache-2.0" ]
permissive
lishuheng12345/gulimall
6b8a7b96f89a013a7fc29a6db49fd618fb2eef5f
e5a6596a15937d62f6b5aeff0e2766ab2edc855a
refs/heads/master
2022-12-30T01:06:22.004922
2020-09-26T08:13:57
2020-09-26T08:13:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,999
java
package com.atguigu.gulimall.member.controller; import java.util.Arrays; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.atguigu.gulimall.member.entity.MemberLevelEntity; import com.atguigu.gulimall.member.service.MemberLevelService; import com.atguigu.common.utils.PageUtils; import com.atguigu.common.utils.R; /** * 会员等级 * * @author lish * @email 1458303034@gmail.com * @date 2020-09-26 16:01:13 */ @RestController @RequestMapping("member/memberlevel") public class MemberLevelController { @Autowired private MemberLevelService memberLevelService; /** * 列表 */ @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = memberLevelService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ MemberLevelEntity memberLevel = memberLevelService.getById(id); return R.ok().put("memberLevel", memberLevel); } /** * 保存 */ @RequestMapping("/save") public R save(@RequestBody MemberLevelEntity memberLevel){ memberLevelService.save(memberLevel); return R.ok(); } /** * 修改 */ @RequestMapping("/update") public R update(@RequestBody MemberLevelEntity memberLevel){ memberLevelService.updateById(memberLevel); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ memberLevelService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
[ "1458303034@qq.com" ]
1458303034@qq.com
8a912ea356a6c06e9dfc329afd0d8fea130d8807
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13372-3-7-NSGA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/objects/BaseCollection_ESTest_scaffolding.java
b2f0abd3a3f22b16b1049610c56cd228661af8e9
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
440
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Apr 02 00:22:28 UTC 2020 */ package com.xpn.xwiki.objects; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class BaseCollection_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
9c5b2cb3382122d3cc97c8807eeb0e878125c360
363356c7f24925b5ef2baf3f7551d9f665f83e4e
/test/com/goit/gojavaonline/practice/practicum1/MatrixSnakeTraversalTest.java
eddbbce23f933f01fdc35c902bc7196d6ec3cc68
[]
no_license
barlogz/GoJavaOnlinePracticum
20599462c2ddfb81ab7afc26c149800c62993b0f
0c4faaf7a81b675a6d4895ac70acfcf792967f66
refs/heads/master
2020-12-31T04:56:38.388132
2016-05-19T20:18:42
2016-05-19T20:18:42
56,981,142
0
0
null
null
null
null
UTF-8
Java
false
false
1,458
java
package com.goit.gojavaonline.practice.practicum1; import com.goit.gojavaonline.practice.practicum1.MatrixSnakeTraversal; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.util.Arrays; import java.util.Collection; import static org.junit.Assert.*; @RunWith(value = Parameterized.class) public class MatrixSnakeTraversalTest { private final int[][] input; private final int[] expectedOutput; private MatrixSnakeTraversal matrixSnakeTraversal = new MatrixSnakeTraversal(); public MatrixSnakeTraversalTest(int[][] input, int[] output) { this.input = input; this.expectedOutput = output; } @Parameterized.Parameters(name = "for input[][]{index}") public static Collection<Object[]> data() { final int input1[][] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; final int input2[][] = { {1, 4, 7, 10}, {2, 5, 8, 11}, {3, 6, 9, 12} }; return Arrays.asList(new Object[][]{ {input1, new int[]{1, 4, 7, 8, 5, 2, 3, 6, 9}}, {input2, new int[]{1, 2, 3, 6, 5, 4, 7, 8, 9, 12, 11, 10}}, }); } @Test(timeout = 1000) public void testPrint() throws Exception { final int[] output = matrixSnakeTraversal.print(input); assertArrayEquals(expectedOutput, output); } }
[ "r.didkivskyi@gmail.com" ]
r.didkivskyi@gmail.com
1309b36d8010e9973b0661e4d9aa09fb1e7fac1d
fd762c46c95159ad8151293d60762d2fc8c38007
/src/main/java/pl/longhorn/autopoly/player/state/PlayerState.java
c9c1f512e6d3fe141b4392418d7da6cf5a562952
[]
no_license
jaksak/autopoly
f647feb500e96452aa17214c5e4ac73d5edab635
a54e295d511990c8e49783b9af06fae1318a4ed0
refs/heads/master
2022-12-25T05:51:42.257716
2020-10-11T04:28:35
2020-10-11T04:28:35
298,645,575
0
0
null
2020-10-01T15:36:01
2020-09-25T18:03:13
Java
UTF-8
Java
false
false
239
java
package pl.longhorn.autopoly.player.state; import pl.longhorn.autopoly.action.result.BoardActionResult; import pl.longhorn.autopoly.player.Player; public interface PlayerState { BoardActionResult autoProcessAction(Player player); }
[ "jkrzemien28@gmail.com" ]
jkrzemien28@gmail.com
ce6912a90da760601293b21cb70bfd4178830243
9f7339ff85e4d97a0557ce1d30117e28c464d924
/tsd-podcast/src/com/tuyou/tsd/podcast/db/SubscriptionItemDAO.java
c7dca4bf152398a8c7e1991dcba40873ec01b3c0
[]
no_license
laihui0207/work
f3c95a3f3f006178b55e74b72f5daa31b84d9c42
a072a008880786171876440823ccc7ed2f3ab554
refs/heads/master
2020-05-23T13:25:44.929989
2015-06-21T12:50:20
2015-06-21T12:50:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,594
java
package com.tuyou.tsd.podcast.db; import java.util.ArrayList; import java.util.List; import com.google.gson.Gson; import com.tuyou.tsd.common.network.AudioCategory; import com.tuyou.tsd.common.network.AudioItem; import com.tuyou.tsd.common.network.AudioSubscription; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class SubscriptionItemDAO extends BaseDAO { private static SubscriptionItemDAO instance = null; private SubscriptionItemDAO(Context mContext) { super(mContext, DBOpenHelper.FAVOURITE_TABLE_NAME); } public static SubscriptionItemDAO getInstance(Context context) { if (instance == null) instance = new SubscriptionItemDAO(context); return instance; } /** * 保存或新增entity. 若entity的jobId为0,则新增job,否则更新数据项 * * @param entity * @return 返回JobId。-1表示失败 */ public long save(SubscriptionItemEntity entity) { long rowId = -1; SQLiteDatabase db = this.openWritableDb(); if (db == null) return 0; ContentValues values = new ContentValues(); Gson gson = new Gson(); String jsonDetailString = gson.toJson(entity.getDetail()); values.put("detail", jsonDetailString.getBytes()); if (entity.getId() < 0) { Cursor cursor = null; try { cursor = db.query(getTableName(), new String[] { "_id" }, "_id=?", new String[] { String.valueOf(entity.getId()) }, null, null, null); if (cursor.moveToFirst()) { rowId = cursor.getLong(cursor.getColumnIndex("_id")); } } finally { if (cursor != null) { cursor.close(); } } } if (rowId >= 0) { db.update(getTableName(), values, "_id=?", new String[] { String.valueOf(rowId) }); } else { rowId = db.insert(getTableName(), null, values); } // 关闭数据库 db.close(); if (rowId < 0) return -1; return rowId; } /** * 从数据库中读取列表 * * @return */ public List<SubscriptionItemEntity> readAll() { Log.i("CategoryDAO", "GameListDAO::readAll()"); SQLiteDatabase db = this.openWritableDb(); if (db == null) return null; List<SubscriptionItemEntity> apps = null; ArrayList<Long> garbageRecIds = new ArrayList<Long>(); String orderBy = "_id"; // 倒序查出记录,最后插入的最先读出 Cursor cursor = db.query(getTableName(), new String[] { "_id", "detail" }, null, null, null, null, orderBy); Gson gson = new Gson(); if (cursor != null) { if (cursor.moveToFirst()) { apps = new ArrayList<SubscriptionItemEntity>(); SubscriptionItemEntity app = null; do { app = new SubscriptionItemEntity(); app.setId(cursor.getLong(cursor.getColumnIndex("_id"))); byte encryptData[] = cursor.getBlob(cursor .getColumnIndex("detail")); if (encryptData != null) { String gsonString = new String(encryptData); AudioSubscription detail = gson.fromJson(gsonString, AudioSubscription.class); if (detail != null) { app.setDetail(detail); apps.add(app); } } else { garbageRecIds.add(app.getId()); } } while (cursor.moveToNext()); } cursor.close(); } else { Log.i("CategoryDAO", "not found Game List in database"); } db.close(); if (garbageRecIds.size() > 0) { Log.i("CategoryDAO", "remove garbage record."); for (Long id : garbageRecIds) { if (id != null && id >= 0) delete(id); // 从数据库中删除垃圾数据 } } return apps; } }
[ "fangking1988@gmail.com" ]
fangking1988@gmail.com
2d0a724b28b5a1869ca22e33f2cf5944984559fd
39c5a07abb7cff6b010dc4d9c74ed35865a1e63b
/app/src/main/java/br/edu/ifspsaocarlos/agendacp/adapter/ContatoAdapter.java
c1b2e287e278b2ecd26c7e2526a3e80c773fbb09
[]
no_license
chefer/AgendaCP
2a50cfa90abb8953e7c507587b6fb859a624d5e7
c4e6f4c63eea8846a5232b86ea6350c6dc2f17ef
refs/heads/master
2021-01-13T10:02:07.240713
2016-10-26T17:22:40
2016-10-26T17:22:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,985
java
package br.edu.ifspsaocarlos.agendacp.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import br.edu.ifspsaocarlos.agendacp.model.Contato; import br.edu.ifspsaocarlos.agendacp.R; import java.util.List; public class ContatoAdapter extends RecyclerView.Adapter<ContatoAdapter.ContatoViewHolder> { private List<Contato> contatos; private Context context; private static ItemClickListener clickListener; public ContatoAdapter(List<Contato> contatos, Context context) { this.contatos = contatos; this.context = context; } @Override public ContatoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.contato_celula, parent, false); return new ContatoViewHolder(view); } @Override public void onBindViewHolder(ContatoViewHolder holder, int position) { Contato contato = contatos.get(position) ; holder.nome.setText(contato.getNome()); } @Override public int getItemCount() { return contatos.size(); } public void setClickListener(ItemClickListener itemClickListener) { clickListener = itemClickListener; } public class ContatoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ final TextView nome; public ContatoViewHolder(View view) { super(view); nome = (TextView) view.findViewById(R.id.nome); view.setOnClickListener(this); } @Override public void onClick(View view) { if (clickListener != null) clickListener.onItemClick(view, getAdapterPosition()); } } public interface ItemClickListener { void onItemClick(View view, int position); } }
[ "dalbem@ifsp.edu.br" ]
dalbem@ifsp.edu.br
c68d2e4ca6113ef0177a3647446be62dccf6a6df
3901c11d501ca2d3e6c89cf372277900abbf13d0
/Projeto_Grupo2/Projeto_Grupo2/src/service/ETituloService.java
ff2178c5362351d9b245a8ccd369e5590b9008c6
[]
no_license
ViniciusCCO/leitor_qrcode
60ce471266bfc59958ee9a5e9ae444011665b96c
1cb5f5d8bbf54bbbff2a79758234cf3449ed4a0e
refs/heads/master
2020-04-16T00:38:14.919659
2019-01-10T23:26:16
2019-01-10T23:26:16
165,145,855
0
0
null
null
null
null
UTF-8
Java
false
false
715
java
package service; import Utilitary.Metodo; import dao.ETituloDao; import dao.QueryDao; import model.ETitulo; public class ETituloService { ETituloDao dao; QueryDao qdao; public ETituloService() { dao = new ETituloDao(); qdao = new QueryDao(); } public boolean load(ETitulo to, ETitulo base) { boolean validate = true; try { dao.load(to); if(to.getDocument_id() == -1 || !to.equals(base)) { validate = false; Metodo.invalidDocumentError(); } } catch(Exception e) { e.printStackTrace(); Metodo.invalidDocumentError(); validate = false; } if(validate) qdao.create(to); else qdao.create(); return validate; } }
[ "vinicius.cco10@gmail.com" ]
vinicius.cco10@gmail.com