blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
7dce4fe53dbd516fb35b30a3b16ca9d223499356
33,870,112,116,081
82ed236c1617763f9798c83e8084992e51177065
/src/dalia/Homework.java
b49707d5c5d967d4f6f7ef6327108cd05d35ea0b
[]
no_license
DaliaAsh/Homework
https://github.com/DaliaAsh/Homework
cdfa0590ec5644039f006d175f312387824aa7cb
036dddb5cb43326b39004b32b7d7a75d6fee41b2
refs/heads/master
2020-04-20T06:40:18.459000
2019-02-01T12:04:22
2019-02-01T12:04:22
168,690,693
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dalia; public class Homework { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("The first Homework"); int x = 9 ; int y = 10 ; x = 18 ; } }
UTF-8
Java
232
java
Homework.java
Java
[]
null
[]
package dalia; public class Homework { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("The first Homework"); int x = 9 ; int y = 10 ; x = 18 ; } }
232
0.577586
0.556035
15
13.466666
15.014956
43
false
false
0
0
0
0
0
0
1.266667
false
false
1
639bc629c13532c24251985256f432952143f9e4
29,154,238,064,852
952b16ee2a03dc84feca5506aae53b69a3f05a5f
/app/src/main/java/com/example/astronomyquiz/ResultActivity.java
b008c73a53b8cd7a00f28cff69fa692def90009d
[]
no_license
sweesenkoh/Astronomy-Quiz-Android-App
https://github.com/sweesenkoh/Astronomy-Quiz-Android-App
f2a38911aa580de83baaa603cd3c971edd03a14f
56909f0771ad46014256f063b3f945ea6b7a6a04
refs/heads/master
2020-07-28T20:20:19.479000
2019-12-27T17:57:32
2019-12-27T17:57:32
209,525,428
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.astronomyquiz; import android.content.Intent; import android.support.v4.content.IntentCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; public class ResultActivity extends AppCompatActivity { private RecyclerView resultRecyclerView; private RecyclerView.Adapter resultRecyclerAdapter; private RecyclerView.LayoutManager resultRecyclerLayoutManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); buildingRecyclerView(); updateTextViewQuestionCorrectCount(); setupDoneQuizSaveResultButton(); } private void buildingRecyclerView(){ resultRecyclerView = findViewById(R.id.result_grid_recycler_view); resultRecyclerView.setHasFixedSize(true); resultRecyclerLayoutManager = new GridLayoutManager(this,4); resultRecyclerView.setLayoutManager(resultRecyclerLayoutManager); resultRecyclerAdapter = new ResultRecyclerAdapter(); resultRecyclerView.setAdapter(resultRecyclerAdapter); } private void updateTextViewQuestionCorrectCount(){ Integer correctCount = 0; Integer wrongCount = 0; Integer unattemptedCount = 0; for (int x = 0 ; x < UserChoices.choices.size() ; x++){ if (UserChoices.choices.get(x).answerCorrectness == 0){ wrongCount++; } else if (UserChoices.choices.get(x).answerCorrectness == 1){ correctCount++; } else{ unattemptedCount++; } } TextView correctCountTextView = findViewById(R.id.correct_count_textview); correctCountTextView.setText(correctCount.toString()); TextView wrongCountTextView = findViewById(R.id.wrong_count_textview); wrongCountTextView.setText(wrongCount.toString()); TextView unattemptedCountTextView = findViewById(R.id.unattempted_count_textview); unattemptedCountTextView.setText(unattemptedCount.toString()); } private void setupDoneQuizSaveResultButton(){ ImageButton saveButton = findViewById(R.id.save_result_image_button); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intents = new Intent(view.getContext(), MainActivity.class); intents.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intents); finish(); Toast.makeText(view.getContext(), "Your results are saved!", Toast.LENGTH_LONG).show(); } }); } }
UTF-8
Java
3,168
java
ResultActivity.java
Java
[]
null
[]
package com.example.astronomyquiz; import android.content.Intent; import android.support.v4.content.IntentCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; public class ResultActivity extends AppCompatActivity { private RecyclerView resultRecyclerView; private RecyclerView.Adapter resultRecyclerAdapter; private RecyclerView.LayoutManager resultRecyclerLayoutManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); buildingRecyclerView(); updateTextViewQuestionCorrectCount(); setupDoneQuizSaveResultButton(); } private void buildingRecyclerView(){ resultRecyclerView = findViewById(R.id.result_grid_recycler_view); resultRecyclerView.setHasFixedSize(true); resultRecyclerLayoutManager = new GridLayoutManager(this,4); resultRecyclerView.setLayoutManager(resultRecyclerLayoutManager); resultRecyclerAdapter = new ResultRecyclerAdapter(); resultRecyclerView.setAdapter(resultRecyclerAdapter); } private void updateTextViewQuestionCorrectCount(){ Integer correctCount = 0; Integer wrongCount = 0; Integer unattemptedCount = 0; for (int x = 0 ; x < UserChoices.choices.size() ; x++){ if (UserChoices.choices.get(x).answerCorrectness == 0){ wrongCount++; } else if (UserChoices.choices.get(x).answerCorrectness == 1){ correctCount++; } else{ unattemptedCount++; } } TextView correctCountTextView = findViewById(R.id.correct_count_textview); correctCountTextView.setText(correctCount.toString()); TextView wrongCountTextView = findViewById(R.id.wrong_count_textview); wrongCountTextView.setText(wrongCount.toString()); TextView unattemptedCountTextView = findViewById(R.id.unattempted_count_textview); unattemptedCountTextView.setText(unattemptedCount.toString()); } private void setupDoneQuizSaveResultButton(){ ImageButton saveButton = findViewById(R.id.save_result_image_button); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intents = new Intent(view.getContext(), MainActivity.class); intents.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intents); finish(); Toast.makeText(view.getContext(), "Your results are saved!", Toast.LENGTH_LONG).show(); } }); } }
3,168
0.676136
0.672348
84
36.714287
25.936998
90
false
false
0
0
0
0
0
0
0.630952
false
false
1
69b20c445984be6d0f5c335d371b3e2c4d64f807
35,261,681,510,918
67b5b208c97d72160aee1b931d92c81c6aca6252
/elephant56/src/main/java/it/unisa/elephant56/user/sample/common/individual/IntegerSequenceIndividual.java
b4e2d7b63227823b403ef6d4b08092b5f899047e
[ "Apache-2.0" ]
permissive
Freejourney/elephant56
https://github.com/Freejourney/elephant56
77f805962e9631e1ec8804a0f391bf527f3e7bb0
8840470bfa634bc8cfff6923ea0abc655dd1a5c6
refs/heads/master
2021-09-15T10:21:49.536000
2018-05-30T12:55:09
2018-05-30T12:55:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.unisa.elephant56.user.sample.common.individual; import java.util.ArrayList; import java.util.Iterator; /** * Defines a sequence individual of {@link Integer}. */ public class IntegerSequenceIndividual extends SequenceIndividual<Integer, IntegerSequenceIndividual, IntegerSequenceIndividual> { private ArrayList<Integer> arrayList; /** * Constructs an empty sequence. */ public IntegerSequenceIndividual() { this.arrayList = new ArrayList<Integer>(); } /** * Constructs a sequence specifying the size, incrementable adding more elements. * * @param size the size of the array list */ public IntegerSequenceIndividual(int size) { this.arrayList = new ArrayList<Integer>(size); } /** * Constructs a sequence specifying copying the one in input. * * @param original the sequence to copy */ private IntegerSequenceIndividual(IntegerSequenceIndividual original) { this.arrayList = new ArrayList<Integer>(original.size()); for (Integer value : original.arrayList) this.arrayList.add(value.intValue()); } @Override protected Class<IntegerSequenceIndividual> getSequenceIndividualClass() { return IntegerSequenceIndividual.class; } @Override public int size() { return this.arrayList.size(); } @Override public Integer get(int index) { return this.arrayList.get(index); } @Override public void set(int index, Integer element) { if (index < this.size()) { this.arrayList.set(index, element); } else if (index == this.size()) { this.arrayList.add(index, element); } } @Override public Iterator<Integer> iterator() { return this.arrayList.iterator(); } @Override public Object clone() throws CloneNotSupportedException { return new IntegerSequenceIndividual(this); } @Override public int hashCode() { return this.arrayList.hashCode(); } }
UTF-8
Java
2,156
java
IntegerSequenceIndividual.java
Java
[]
null
[]
package it.unisa.elephant56.user.sample.common.individual; import java.util.ArrayList; import java.util.Iterator; /** * Defines a sequence individual of {@link Integer}. */ public class IntegerSequenceIndividual extends SequenceIndividual<Integer, IntegerSequenceIndividual, IntegerSequenceIndividual> { private ArrayList<Integer> arrayList; /** * Constructs an empty sequence. */ public IntegerSequenceIndividual() { this.arrayList = new ArrayList<Integer>(); } /** * Constructs a sequence specifying the size, incrementable adding more elements. * * @param size the size of the array list */ public IntegerSequenceIndividual(int size) { this.arrayList = new ArrayList<Integer>(size); } /** * Constructs a sequence specifying copying the one in input. * * @param original the sequence to copy */ private IntegerSequenceIndividual(IntegerSequenceIndividual original) { this.arrayList = new ArrayList<Integer>(original.size()); for (Integer value : original.arrayList) this.arrayList.add(value.intValue()); } @Override protected Class<IntegerSequenceIndividual> getSequenceIndividualClass() { return IntegerSequenceIndividual.class; } @Override public int size() { return this.arrayList.size(); } @Override public Integer get(int index) { return this.arrayList.get(index); } @Override public void set(int index, Integer element) { if (index < this.size()) { this.arrayList.set(index, element); } else if (index == this.size()) { this.arrayList.add(index, element); } } @Override public Iterator<Integer> iterator() { return this.arrayList.iterator(); } @Override public Object clone() throws CloneNotSupportedException { return new IntegerSequenceIndividual(this); } @Override public int hashCode() { return this.arrayList.hashCode(); } }
2,156
0.625232
0.624304
80
24.950001
24.435579
99
false
false
0
0
0
0
0
0
0.275
false
false
1
04cd7d026d229a4928a015e9904237859ce2d5be
27,453,431,000,402
dde824cd8cf79179909dc950ce7d95756ebb7697
/src/main/java/com/stm/salesfast/backend/services/specs/MeetingUpdateService.java
40026023a361e80eacaec94d91621a998e76ef20
[]
no_license
harshulgandhi/salesfast
https://github.com/harshulgandhi/salesfast
c8526433a729063c38887c74890b2249aff27005
d7749d025cdacaef5e159f04ea9b29e1af16c4c7
refs/heads/master
2021-01-17T17:38:31.282000
2016-06-26T06:36:24
2016-06-26T06:36:24
59,855,854
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stm.salesfast.backend.services.specs; import java.text.ParseException; import java.util.List; import com.stm.salesfast.backend.dto.MeetingUpdateDto; import com.stm.salesfast.backend.dto.ProductDto; import com.stm.salesfast.backend.entity.MeetingStatusCountEntity; import com.stm.salesfast.backend.entity.MeetingUpdateEntity; public interface MeetingUpdateService { public void insertMeetingUpdate(MeetingUpdateEntity meetingUpdateEntity) throws ParseException; public MeetingUpdateDto getMeetingUpdateByAppointmentId(int appointmentId); public List<Integer> getPrescribingProduct(int physicianId); public void setupEDetailing(MeetingUpdateEntity meetingUpdateEntity); public void sendMail(String subject, String body, String toEmailId); public List<Integer> getLostPhysiciansForAUser(int userId); public List<Integer> getPrescribingPhysiciansForAUser(int userId); public List<String> getStatusForAllAppointments(int userId, int physicianId); public List<MeetingUpdateDto> getForPhysiciansPortal(String status1, String status2, String status3, int physicianId); public void updateIsExpensiveAndHasSideEffects(boolean isExpensive, boolean hasSideEffects, int appointmentId); public List<MeetingStatusCountEntity> getMeetingUpdateStatusCount(int userId); }
UTF-8
Java
1,293
java
MeetingUpdateService.java
Java
[]
null
[]
package com.stm.salesfast.backend.services.specs; import java.text.ParseException; import java.util.List; import com.stm.salesfast.backend.dto.MeetingUpdateDto; import com.stm.salesfast.backend.dto.ProductDto; import com.stm.salesfast.backend.entity.MeetingStatusCountEntity; import com.stm.salesfast.backend.entity.MeetingUpdateEntity; public interface MeetingUpdateService { public void insertMeetingUpdate(MeetingUpdateEntity meetingUpdateEntity) throws ParseException; public MeetingUpdateDto getMeetingUpdateByAppointmentId(int appointmentId); public List<Integer> getPrescribingProduct(int physicianId); public void setupEDetailing(MeetingUpdateEntity meetingUpdateEntity); public void sendMail(String subject, String body, String toEmailId); public List<Integer> getLostPhysiciansForAUser(int userId); public List<Integer> getPrescribingPhysiciansForAUser(int userId); public List<String> getStatusForAllAppointments(int userId, int physicianId); public List<MeetingUpdateDto> getForPhysiciansPortal(String status1, String status2, String status3, int physicianId); public void updateIsExpensiveAndHasSideEffects(boolean isExpensive, boolean hasSideEffects, int appointmentId); public List<MeetingStatusCountEntity> getMeetingUpdateStatusCount(int userId); }
1,293
0.846094
0.843774
34
37.029411
37.318569
119
false
false
0
0
0
0
0
0
1.147059
false
false
1
9170e10a90df907458218f03ea14b5546f290e13
23,957,327,642,462
2924807c57eda021d0c3819f9564e08139f85aee
/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/lenskit/LenskitRecommenderRunner.java
d996158bb7b31d26d58496267591ee9b61ff75f3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cass-green/rival
https://github.com/cass-green/rival
a5ec9c905e6e45f4a349b1918dc6b12dae4816a4
f2cb40451498c398af67021d95a24bc6842082dd
refs/heads/master
2020-04-19T19:24:23.236000
2019-01-30T18:32:13
2019-01-30T18:32:13
168,387,280
0
0
Apache-2.0
true
2019-01-30T17:45:55
2019-01-30T17:45:54
2018-12-27T03:07:06
2017-10-18T10:55:45
2,083
0
0
0
null
false
null
/* * Copyright 2015 recommenders.net. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.recommenders.rival.recommend.frameworks.lenskit; import it.unimi.dsi.fastutil.longs.Long2DoubleMap; import it.unimi.dsi.fastutil.longs.LongSet; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; import net.recommenders.rival.core.TemporalDataModel; import net.recommenders.rival.core.TemporalDataModelIF; import net.recommenders.rival.recommend.frameworks.AbstractRunner; import net.recommenders.rival.recommend.frameworks.RecommendationRunner; import net.recommenders.rival.recommend.frameworks.RecommenderIO; import net.recommenders.rival.recommend.frameworks.exceptions.RecommenderException; import org.apache.mahout.cf.taste.similarity.ItemSimilarity; import org.grouplens.lenskit.iterative.IterationCount; import org.grouplens.lenskit.iterative.IterationCountStoppingCondition; import org.grouplens.lenskit.iterative.StoppingCondition; import org.lenskit.LenskitConfiguration; import org.lenskit.LenskitRecommender; import org.lenskit.LenskitRecommenderEngine; import org.lenskit.api.ItemRecommender; import org.lenskit.api.ItemScorer; import org.lenskit.api.RecommenderBuildException; import org.lenskit.api.Result; import org.lenskit.baseline.BaselineScorer; import org.lenskit.baseline.UserMeanItemScorer; import org.lenskit.bias.BiasModel; import org.lenskit.bias.UserItemBiasModel; import org.lenskit.data.dao.DataAccessObject; import org.lenskit.data.dao.file.StaticDataSource; import org.lenskit.data.dao.file.TextEntitySource; import org.lenskit.data.ratings.RatingSummary; import org.lenskit.data.ratings.RatingVectorPDAO; import org.lenskit.data.ratings.StandardRatingVectorPDAO; import org.lenskit.knn.NeighborhoodSize; import org.lenskit.knn.user.LiveNeighborFinder; import org.lenskit.knn.user.NeighborFinder; import org.lenskit.mf.funksvd.FeatureCount; import org.lenskit.similarity.VectorSimilarity; import org.lenskit.util.IdBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A runner for LensKit-based recommenders. * * @author <a href="http://github.com/alansaid">Alan</a> */ public class LenskitRecommenderRunner extends AbstractRunner<Long, Long> { /** * Logger. */ private static final Logger LOGGER = LoggerFactory.getLogger(LenskitRecommenderRunner.class); /** * Default constructor. * * @param props properties */ public LenskitRecommenderRunner(final Properties props) { super(props); } /** * Runs the recommender. * * @param opts see * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS} * @return see * {@link #run(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, net.recommenders.rival.core.TemporalDataModelIF, net.recommenders.rival.core.TemporalDataModelIF)} * @throws RecommenderException when the recommender is instantiated * incorrectly or breaks otherwise. */ @Override @SuppressWarnings("unchecked") public TemporalDataModelIF<Long, Long> run(final RUN_OPTIONS opts) throws RecommenderException { if (isAlreadyRecommended()) { return null; } File trainingFile = new File(getProperties().getProperty(RecommendationRunner.TRAINING_SET)); File testFile = new File(getProperties().getProperty(RecommendationRunner.TEST_SET)); // EventDAO base = new TextEventDAO(trainingFile, Formats.delimitedRatings("\t")); TextEntitySource tesTraining = new TextEntitySource(); tesTraining.setFile(trainingFile.toPath()); tesTraining.setFormat(org.lenskit.data.dao.file.Formats.delimitedRatings("\t")); StaticDataSource sourceTraining = new StaticDataSource("training"); sourceTraining.addSource(tesTraining); DataAccessObject base = sourceTraining.get(); // EventDAO test = new TextEventDAO(testFile, Formats.delimitedRatings("\t")); TextEntitySource tesTest = new TextEntitySource(); tesTest.setFile(testFile.toPath()); tesTest.setFormat(org.lenskit.data.dao.file.Formats.delimitedRatings("\t")); StaticDataSource sourceTest = new StaticDataSource("test"); sourceTest.addSource(tesTest); DataAccessObject test = sourceTest.get(); return runLenskitRecommender(opts, base, test); } /** * Runs the recommender using the provided datamodels. * * @param opts see * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS} * @param trainingModel model to be used to train the recommender. * @param testModel model to be used to test the recommender. * @return see * {@link #runLenskitRecommender(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, org.grouplens.lenskit.data.dao.EventDAO, org.grouplens.lenskit.data.dao.EventDAO)} * @throws RecommenderException see * {@link #runLenskitRecommender(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, org.grouplens.lenskit.data.dao.EventDAO, org.grouplens.lenskit.data.dao.EventDAO)} */ @Override public TemporalDataModelIF<Long, Long> run(final RUN_OPTIONS opts, final TemporalDataModelIF<Long, Long> trainingModel, final TemporalDataModelIF<Long, Long> testModel) throws RecommenderException { if (isAlreadyRecommended()) { return null; } // transform from core's DataModels to Lenskit's EventDAO DataAccessObject trainingModelLensKit = new EventDAOWrapper(trainingModel); DataAccessObject testModelLensKit = new EventDAOWrapper(testModel); return runLenskitRecommender(opts, trainingModelLensKit, testModelLensKit); } /** * Runs a Lenskit recommender using the provided datamodels and the * previously provided properties. * * @param opts see * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS} * @param trainingModel model to be used to train the recommender. * @param testModel model to be used to test the recommender. * @return nothing when opts is * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS#OUTPUT_RECS}, * otherwise, when opts is * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS#RETURN_RECS} * or * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS#RETURN_AND_OUTPUT_RECS} * it returns the predictions * @throws RecommenderException when recommender cannot be instantiated * properly */ @SuppressWarnings("unchecked") public TemporalDataModelIF<Long, Long> runLenskitRecommender(final RUN_OPTIONS opts, final DataAccessObject trainingModel, final DataAccessObject testModel) throws RecommenderException { if (isAlreadyRecommended()) { return null; } LenskitConfiguration config = new LenskitConfiguration(); // int nItems = new PrefetchingItemDAO(trainingModel).getItemIds().size(); LongSet items = RatingSummary.create(trainingModel).getItems(); int nItems = items.size(); try { config.bind(ItemScorer.class).to((Class<? extends ItemScorer>) Class.forName(getProperties().getProperty(RecommendationRunner.RECOMMENDER))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemScorer: " + e.getMessage()); } if (getProperties().getProperty(RecommendationRunner.RECOMMENDER).contains(".user.")) { config.bind(NeighborFinder.class).to(LiveNeighborFinder.class); if (getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD).equals("-1")) { getProperties().setProperty(RecommendationRunner.NEIGHBORHOOD, Math.round(Math.sqrt(nItems)) + ""); } config.set(NeighborhoodSize.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD))); } if (getProperties().containsKey(RecommendationRunner.SIMILARITY)) { try { config.within(ItemSimilarity.class). bind(VectorSimilarity.class). to((Class<? extends VectorSimilarity>) Class.forName(getProperties().getProperty(RecommendationRunner.SIMILARITY))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemSimilarity: " + e.getMessage()); } } if (getProperties().containsKey(RecommendationRunner.FACTORS)) { config.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class); config.bind(StoppingCondition.class).to(IterationCountStoppingCondition.class); config.bind(BiasModel.class).to(UserItemBiasModel.class); config.set(IterationCount.class).to(DEFAULT_ITERATIONS); if (getProperties().getProperty(RecommendationRunner.FACTORS).equals("-1")) { getProperties().setProperty(RecommendationRunner.FACTORS, Math.round(Math.sqrt(nItems)) + ""); } config.set(FeatureCount.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.FACTORS))); } RatingVectorPDAO test = new StandardRatingVectorPDAO(testModel); LenskitRecommender rec = null; try { LenskitRecommenderEngine engine = LenskitRecommenderEngine.build(config, trainingModel); rec = engine.createRecommender(trainingModel); } catch (RecommenderBuildException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new RecommenderException("Problem with LenskitRecommenderEngine: " + e.getMessage()); } ItemRecommender irec = null; ItemScorer iscore = null; if (rec != null) { irec = rec.getItemRecommender(); iscore = rec.getItemScorer(); } assert irec != null; assert iscore != null; TemporalDataModelIF<Long, Long> model = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case RETURN_RECS: model = new TemporalDataModel<>(); break; default: model = null; } String name = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case OUTPUT_RECS: name = getFileName(); break; default: name = null; } boolean createFile = true; for (IdBox<Long2DoubleMap> u : test.streamUsers()) { long user = u.getId(); // The following does not return anything // List<Long> recItems = irec.recommend(user, nItems); // List<RecommenderIO.Preference<Long, Long>> prefs = new ArrayList<>(); Map<Long, Double> results = iscore.score(user, items); for (Long i : items) { // Result r = iscore.score(user, i); // if (r != null) { if (results.containsKey(i)) { // Double s = r.getScore(); Double s = results.get(i); prefs.add(new RecommenderIO.Preference<>(user, i, s)); } } // RecommenderIO.writeData(user, prefs, getPath(), name, !createFile, model); createFile = false; } rec.close(); return model; } }
UTF-8
Java
12,249
java
LenskitRecommenderRunner.java
Java
[ { "context": "menders.\n *\n * @author <a href=\"http://github.com/alansaid\">Alan</a>\n */\npublic class LenskitRecommenderRunn", "end": 2693, "score": 0.9996728897094727, "start": 2685, "tag": "USERNAME", "value": "alansaid" }, { "context": "*\n * @author <a href=\"http://github.com/alansaid\">Alan</a>\n */\npublic class LenskitRecommenderRunner ext", "end": 2699, "score": 0.9975303411483765, "start": 2695, "tag": "NAME", "value": "Alan" } ]
null
[]
/* * Copyright 2015 recommenders.net. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.recommenders.rival.recommend.frameworks.lenskit; import it.unimi.dsi.fastutil.longs.Long2DoubleMap; import it.unimi.dsi.fastutil.longs.LongSet; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; import net.recommenders.rival.core.TemporalDataModel; import net.recommenders.rival.core.TemporalDataModelIF; import net.recommenders.rival.recommend.frameworks.AbstractRunner; import net.recommenders.rival.recommend.frameworks.RecommendationRunner; import net.recommenders.rival.recommend.frameworks.RecommenderIO; import net.recommenders.rival.recommend.frameworks.exceptions.RecommenderException; import org.apache.mahout.cf.taste.similarity.ItemSimilarity; import org.grouplens.lenskit.iterative.IterationCount; import org.grouplens.lenskit.iterative.IterationCountStoppingCondition; import org.grouplens.lenskit.iterative.StoppingCondition; import org.lenskit.LenskitConfiguration; import org.lenskit.LenskitRecommender; import org.lenskit.LenskitRecommenderEngine; import org.lenskit.api.ItemRecommender; import org.lenskit.api.ItemScorer; import org.lenskit.api.RecommenderBuildException; import org.lenskit.api.Result; import org.lenskit.baseline.BaselineScorer; import org.lenskit.baseline.UserMeanItemScorer; import org.lenskit.bias.BiasModel; import org.lenskit.bias.UserItemBiasModel; import org.lenskit.data.dao.DataAccessObject; import org.lenskit.data.dao.file.StaticDataSource; import org.lenskit.data.dao.file.TextEntitySource; import org.lenskit.data.ratings.RatingSummary; import org.lenskit.data.ratings.RatingVectorPDAO; import org.lenskit.data.ratings.StandardRatingVectorPDAO; import org.lenskit.knn.NeighborhoodSize; import org.lenskit.knn.user.LiveNeighborFinder; import org.lenskit.knn.user.NeighborFinder; import org.lenskit.mf.funksvd.FeatureCount; import org.lenskit.similarity.VectorSimilarity; import org.lenskit.util.IdBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A runner for LensKit-based recommenders. * * @author <a href="http://github.com/alansaid">Alan</a> */ public class LenskitRecommenderRunner extends AbstractRunner<Long, Long> { /** * Logger. */ private static final Logger LOGGER = LoggerFactory.getLogger(LenskitRecommenderRunner.class); /** * Default constructor. * * @param props properties */ public LenskitRecommenderRunner(final Properties props) { super(props); } /** * Runs the recommender. * * @param opts see * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS} * @return see * {@link #run(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, net.recommenders.rival.core.TemporalDataModelIF, net.recommenders.rival.core.TemporalDataModelIF)} * @throws RecommenderException when the recommender is instantiated * incorrectly or breaks otherwise. */ @Override @SuppressWarnings("unchecked") public TemporalDataModelIF<Long, Long> run(final RUN_OPTIONS opts) throws RecommenderException { if (isAlreadyRecommended()) { return null; } File trainingFile = new File(getProperties().getProperty(RecommendationRunner.TRAINING_SET)); File testFile = new File(getProperties().getProperty(RecommendationRunner.TEST_SET)); // EventDAO base = new TextEventDAO(trainingFile, Formats.delimitedRatings("\t")); TextEntitySource tesTraining = new TextEntitySource(); tesTraining.setFile(trainingFile.toPath()); tesTraining.setFormat(org.lenskit.data.dao.file.Formats.delimitedRatings("\t")); StaticDataSource sourceTraining = new StaticDataSource("training"); sourceTraining.addSource(tesTraining); DataAccessObject base = sourceTraining.get(); // EventDAO test = new TextEventDAO(testFile, Formats.delimitedRatings("\t")); TextEntitySource tesTest = new TextEntitySource(); tesTest.setFile(testFile.toPath()); tesTest.setFormat(org.lenskit.data.dao.file.Formats.delimitedRatings("\t")); StaticDataSource sourceTest = new StaticDataSource("test"); sourceTest.addSource(tesTest); DataAccessObject test = sourceTest.get(); return runLenskitRecommender(opts, base, test); } /** * Runs the recommender using the provided datamodels. * * @param opts see * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS} * @param trainingModel model to be used to train the recommender. * @param testModel model to be used to test the recommender. * @return see * {@link #runLenskitRecommender(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, org.grouplens.lenskit.data.dao.EventDAO, org.grouplens.lenskit.data.dao.EventDAO)} * @throws RecommenderException see * {@link #runLenskitRecommender(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, org.grouplens.lenskit.data.dao.EventDAO, org.grouplens.lenskit.data.dao.EventDAO)} */ @Override public TemporalDataModelIF<Long, Long> run(final RUN_OPTIONS opts, final TemporalDataModelIF<Long, Long> trainingModel, final TemporalDataModelIF<Long, Long> testModel) throws RecommenderException { if (isAlreadyRecommended()) { return null; } // transform from core's DataModels to Lenskit's EventDAO DataAccessObject trainingModelLensKit = new EventDAOWrapper(trainingModel); DataAccessObject testModelLensKit = new EventDAOWrapper(testModel); return runLenskitRecommender(opts, trainingModelLensKit, testModelLensKit); } /** * Runs a Lenskit recommender using the provided datamodels and the * previously provided properties. * * @param opts see * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS} * @param trainingModel model to be used to train the recommender. * @param testModel model to be used to test the recommender. * @return nothing when opts is * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS#OUTPUT_RECS}, * otherwise, when opts is * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS#RETURN_RECS} * or * {@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS#RETURN_AND_OUTPUT_RECS} * it returns the predictions * @throws RecommenderException when recommender cannot be instantiated * properly */ @SuppressWarnings("unchecked") public TemporalDataModelIF<Long, Long> runLenskitRecommender(final RUN_OPTIONS opts, final DataAccessObject trainingModel, final DataAccessObject testModel) throws RecommenderException { if (isAlreadyRecommended()) { return null; } LenskitConfiguration config = new LenskitConfiguration(); // int nItems = new PrefetchingItemDAO(trainingModel).getItemIds().size(); LongSet items = RatingSummary.create(trainingModel).getItems(); int nItems = items.size(); try { config.bind(ItemScorer.class).to((Class<? extends ItemScorer>) Class.forName(getProperties().getProperty(RecommendationRunner.RECOMMENDER))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemScorer: " + e.getMessage()); } if (getProperties().getProperty(RecommendationRunner.RECOMMENDER).contains(".user.")) { config.bind(NeighborFinder.class).to(LiveNeighborFinder.class); if (getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD).equals("-1")) { getProperties().setProperty(RecommendationRunner.NEIGHBORHOOD, Math.round(Math.sqrt(nItems)) + ""); } config.set(NeighborhoodSize.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD))); } if (getProperties().containsKey(RecommendationRunner.SIMILARITY)) { try { config.within(ItemSimilarity.class). bind(VectorSimilarity.class). to((Class<? extends VectorSimilarity>) Class.forName(getProperties().getProperty(RecommendationRunner.SIMILARITY))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemSimilarity: " + e.getMessage()); } } if (getProperties().containsKey(RecommendationRunner.FACTORS)) { config.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class); config.bind(StoppingCondition.class).to(IterationCountStoppingCondition.class); config.bind(BiasModel.class).to(UserItemBiasModel.class); config.set(IterationCount.class).to(DEFAULT_ITERATIONS); if (getProperties().getProperty(RecommendationRunner.FACTORS).equals("-1")) { getProperties().setProperty(RecommendationRunner.FACTORS, Math.round(Math.sqrt(nItems)) + ""); } config.set(FeatureCount.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.FACTORS))); } RatingVectorPDAO test = new StandardRatingVectorPDAO(testModel); LenskitRecommender rec = null; try { LenskitRecommenderEngine engine = LenskitRecommenderEngine.build(config, trainingModel); rec = engine.createRecommender(trainingModel); } catch (RecommenderBuildException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new RecommenderException("Problem with LenskitRecommenderEngine: " + e.getMessage()); } ItemRecommender irec = null; ItemScorer iscore = null; if (rec != null) { irec = rec.getItemRecommender(); iscore = rec.getItemScorer(); } assert irec != null; assert iscore != null; TemporalDataModelIF<Long, Long> model = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case RETURN_RECS: model = new TemporalDataModel<>(); break; default: model = null; } String name = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case OUTPUT_RECS: name = getFileName(); break; default: name = null; } boolean createFile = true; for (IdBox<Long2DoubleMap> u : test.streamUsers()) { long user = u.getId(); // The following does not return anything // List<Long> recItems = irec.recommend(user, nItems); // List<RecommenderIO.Preference<Long, Long>> prefs = new ArrayList<>(); Map<Long, Double> results = iscore.score(user, items); for (Long i : items) { // Result r = iscore.score(user, i); // if (r != null) { if (results.containsKey(i)) { // Double s = r.getScore(); Double s = results.get(i); prefs.add(new RecommenderIO.Preference<>(user, i, s)); } } // RecommenderIO.writeData(user, prefs, getPath(), name, !createFile, model); createFile = false; } rec.close(); return model; } }
12,249
0.688464
0.687321
265
45.222641
36.709358
202
false
false
0
0
0
0
0
0
0.630189
false
false
1
b71c34ef396db35939f16db846eabc3242290241
23,957,327,643,162
aa8f0926bb37a7cf40e0af86471c29bec0600041
/02/POO/src/SimulationComparator.java
85a8634a9912ef321b25da7aec050aa0701c2925
[]
no_license
frmendes/uminho
https://github.com/frmendes/uminho
f8fa7404235f5e9cea156a007e8649307cdaead9
92a428b9e43243ee44d7efd64b699a68372e4289
refs/heads/master
2021-01-17T04:27:32.783000
2016-07-15T13:49:57
2016-07-15T13:49:57
56,968,466
5
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.Serializable; import java.util.Comparator; /** * * @author frmendes */ public class SimulationComparator implements Comparator<Long>, Serializable { @Override public int compare(Long sim1, Long sim2) { if(sim1 < sim2) return 1; if(sim1 > sim2) return -1; else { int rand1; int rand2; do { rand1 = (int)(Math.random() * 100); rand2 = (int)(Math.random() * 100); } while(rand1 == rand2); if(rand1 < rand2) return 1; if(rand1 > rand2) return -1; } return 0; // Never happens but Netbeans thinks it might. So it won't compile without a return statement } }
UTF-8
Java
764
java
SimulationComparator.java
Java
[ { "context": "e;\nimport java.util.Comparator;\n\n/**\n *\n * @author frmendes\n */\npublic class SimulationComparator implements ", "end": 86, "score": 0.999492347240448, "start": 78, "tag": "USERNAME", "value": "frmendes" } ]
null
[]
import java.io.Serializable; import java.util.Comparator; /** * * @author frmendes */ public class SimulationComparator implements Comparator<Long>, Serializable { @Override public int compare(Long sim1, Long sim2) { if(sim1 < sim2) return 1; if(sim1 > sim2) return -1; else { int rand1; int rand2; do { rand1 = (int)(Math.random() * 100); rand2 = (int)(Math.random() * 100); } while(rand1 == rand2); if(rand1 < rand2) return 1; if(rand1 > rand2) return -1; } return 0; // Never happens but Netbeans thinks it might. So it won't compile without a return statement } }
764
0.524869
0.489529
29
25.310345
24.664791
111
false
false
0
0
0
0
0
0
0.482759
false
false
1
7f0f4e8217e2bc499ead9e28e20757700284b036
22,737,556,921,509
cd5a1f2ca315bfbc69f37f354a505d574d22f7ab
/Android/scfood/src/scfood/mobile/adapter/ShopAdapter.java
0eb93900a6aac328597a4134b83bf93b7a071af4
[]
no_license
dalinhuang/zhixin-xianzi
https://github.com/dalinhuang/zhixin-xianzi
2f24511dbc4918a22a0b7232e3cca9d63eeaebdb
1aa793dad03522763d27be049f096a713839570b
refs/heads/master
2016-08-11T14:08:37.491000
2014-07-02T09:20:57
2014-07-02T09:20:57
48,632,259
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package scfood.mobile.adapter; import java.util.Map; import scfood.mobile.R; import scfood.mobile.shop.Info; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; public class ShopAdapter extends zhixin.android.ui.SimpleAdapter { private Context context; public ShopAdapter(Context context) { super(context); this.context = context; } @Override public View getView(int arg0, View arg1, ViewGroup arg2) { final Map<String,String> map = list.get(arg0); View view = LayoutInflater.from(context).inflate(R.layout.shop_item, null); ImageView logo = (ImageView)view.findViewById(R.id.home_item_img); if(map.containsKey("url")) super.showImageAccordingAsyncTask(logo, map.get("url"), map.get("file")); else logo.setImageURI(Uri.parse(map.get("logo"))); logo.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Intent intent = new Intent(context, Info.class); Bundle extras = new Bundle(); extras.putInt("sid", Integer.parseInt(map.get("sid"))); extras.putString("name", map.get("name")); extras.putString("logo", map.get("logo")); extras.putString("lat", map.get("lat")); extras.putString("lng", map.get("lng")); extras.putString("tel", map.get("tel")); intent.putExtras(extras); context.startActivity(intent); } }); ((TextView)view.findViewById(R.id.home_item_name)).setText(map.get("name")); ((ImageView)view.findViewById(R.id.home_item_start1)).setImageResource(Integer.parseInt(map.get("start1"))); ((ImageView)view.findViewById(R.id.home_item_start2)).setImageResource(Integer.parseInt(map.get("start2"))); ((ImageView)view.findViewById(R.id.home_item_start3)).setImageResource(Integer.parseInt(map.get("start3"))); ((ImageView)view.findViewById(R.id.home_item_start4)).setImageResource(Integer.parseInt(map.get("start4"))); ((ImageView)view.findViewById(R.id.home_item_start5)).setImageResource(Integer.parseInt(map.get("start5"))); ((TextView)view.findViewById(R.id.home_item_price)).setText(map.get("price")); ((TextView)view.findViewById(R.id.home_item_juli)).setText(map.get("juli")); if(Boolean.parseBoolean(map.get("yuding"))) view.findViewById(R.id.icon_yd).setVisibility(View.VISIBLE); if(Boolean.parseBoolean(map.get("quan"))) view.findViewById(R.id.icon_quan).setVisibility(View.VISIBLE); view.findViewById(R.id.home_item_bt1).setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { double lat = Double.parseDouble(map.get("lat")); double lng = Double.parseDouble(map.get("lng")); if(lat <1 || lng < 1){ zhixin.android.ui.Dialog.messageBox(context, "该商户还未标注位置"); }else{ Intent intent = new Intent(context, scfood.mobile.ui.BaiDuMap.class); Bundle extras = new Bundle(); extras.putDouble("lat", lat); extras.putDouble("lng", lng); intent.putExtras(extras); context.startActivity(intent); } } }); view.findViewById(R.id.home_item_bt2).setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { if(map.get("tel").equals("")){ zhixin.android.ui.Dialog.messageBox(context, "该商户还未填写联系电话"); }else{ context.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + map.get("tel")))); } } }); return view; } }
GB18030
Java
3,688
java
ShopAdapter.java
Java
[]
null
[]
package scfood.mobile.adapter; import java.util.Map; import scfood.mobile.R; import scfood.mobile.shop.Info; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; public class ShopAdapter extends zhixin.android.ui.SimpleAdapter { private Context context; public ShopAdapter(Context context) { super(context); this.context = context; } @Override public View getView(int arg0, View arg1, ViewGroup arg2) { final Map<String,String> map = list.get(arg0); View view = LayoutInflater.from(context).inflate(R.layout.shop_item, null); ImageView logo = (ImageView)view.findViewById(R.id.home_item_img); if(map.containsKey("url")) super.showImageAccordingAsyncTask(logo, map.get("url"), map.get("file")); else logo.setImageURI(Uri.parse(map.get("logo"))); logo.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Intent intent = new Intent(context, Info.class); Bundle extras = new Bundle(); extras.putInt("sid", Integer.parseInt(map.get("sid"))); extras.putString("name", map.get("name")); extras.putString("logo", map.get("logo")); extras.putString("lat", map.get("lat")); extras.putString("lng", map.get("lng")); extras.putString("tel", map.get("tel")); intent.putExtras(extras); context.startActivity(intent); } }); ((TextView)view.findViewById(R.id.home_item_name)).setText(map.get("name")); ((ImageView)view.findViewById(R.id.home_item_start1)).setImageResource(Integer.parseInt(map.get("start1"))); ((ImageView)view.findViewById(R.id.home_item_start2)).setImageResource(Integer.parseInt(map.get("start2"))); ((ImageView)view.findViewById(R.id.home_item_start3)).setImageResource(Integer.parseInt(map.get("start3"))); ((ImageView)view.findViewById(R.id.home_item_start4)).setImageResource(Integer.parseInt(map.get("start4"))); ((ImageView)view.findViewById(R.id.home_item_start5)).setImageResource(Integer.parseInt(map.get("start5"))); ((TextView)view.findViewById(R.id.home_item_price)).setText(map.get("price")); ((TextView)view.findViewById(R.id.home_item_juli)).setText(map.get("juli")); if(Boolean.parseBoolean(map.get("yuding"))) view.findViewById(R.id.icon_yd).setVisibility(View.VISIBLE); if(Boolean.parseBoolean(map.get("quan"))) view.findViewById(R.id.icon_quan).setVisibility(View.VISIBLE); view.findViewById(R.id.home_item_bt1).setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { double lat = Double.parseDouble(map.get("lat")); double lng = Double.parseDouble(map.get("lng")); if(lat <1 || lng < 1){ zhixin.android.ui.Dialog.messageBox(context, "该商户还未标注位置"); }else{ Intent intent = new Intent(context, scfood.mobile.ui.BaiDuMap.class); Bundle extras = new Bundle(); extras.putDouble("lat", lat); extras.putDouble("lng", lng); intent.putExtras(extras); context.startActivity(intent); } } }); view.findViewById(R.id.home_item_bt2).setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { if(map.get("tel").equals("")){ zhixin.android.ui.Dialog.messageBox(context, "该商户还未填写联系电话"); }else{ context.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + map.get("tel")))); } } }); return view; } }
3,688
0.690515
0.685581
87
39.931034
31.902796
110
false
false
0
0
0
0
0
0
3.137931
false
false
1
fd0840bd0cf87442a0cd3404efb45f65ad7c7eee
34,711,925,691,435
3d42003772e3db51b6191192454eb1f76cdbbcf0
/src/main/java/com/cos/blog/dto/ProductionDto.java
8a64c684ea737af6635b36472ce0b028eac5e63b
[]
no_license
connieya/production_management
https://github.com/connieya/production_management
e0060723c8dd13048746c7108b14ef51d2f27b74
0403e7aefcbd06d150d975e3871f9d94731c99a6
refs/heads/master
2023-03-16T11:24:39.517000
2021-03-05T08:57:30
2021-03-05T08:57:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cos.blog.dto; import java.sql.Date; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class ProductionDto { private int Target; private int Production; private Date Date; }
UTF-8
Java
281
java
ProductionDto.java
Java
[]
null
[]
package com.cos.blog.dto; import java.sql.Date; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class ProductionDto { private int Target; private int Production; private Date Date; }
281
0.80427
0.80427
17
15.529411
11.561181
33
false
false
0
0
0
0
0
0
0.647059
false
false
1
ea75233aaf26e8bc1b4334d3ad76f54b46687487
30,090,540,925,371
da2f69734405dc02c7cacc3e2cc948f9d3b417d6
/News_xinhua/news_svn/src/main/java/com/cplatform/xhxw/ui/model/Other.java
ef35f314f591d66a7657f4c99b344fea9622e349
[]
no_license
cckmit/MyRepository-1
https://github.com/cckmit/MyRepository-1
41b2ab2f3ea6a12fc8c738a86c0dc7c63477979b
7024f23dcfea0633f038b83083013bc1f6435ae4
refs/heads/master
2023-03-16T18:37:16.416000
2015-11-20T13:05:37
2015-11-20T13:05:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cplatform.xhxw.ui.model; import java.util.List; /** * 推荐位 * Created by cy-love on 14-1-8. */ public class Other { private String newsId; //新闻ID private String posid; //推荐位ID private String order; //排序 private String title; //标题 private String thumbnail; //缩略图 private String bigthumbnail; private String summary; private String videourl; private int footType; private int showType; private int newsType; private List<NewPic> picInfo; private List<String> minipics; private String published; private String commentcount; private String iscomment;//0:允许,1:不允许 private String liveurl; // 直播新闻url private String isread;//后台记录的已读未读状态 private int listStyle; //列表栏目显示类型 private String showSource; //新闻来源 private int liveType; private int signStatus; //圈阅状态 0:未圈阅, 1:已圈阅 private String shareUrl; private int typeId; public New getNew() { New news = new New(); news.setRead(false); news.setNewsId(newsId); news.setOrders(order); news.setTitle(title); news.setThumbnail(thumbnail); news.setBigthumbnail(bigthumbnail); news.setSummary(summary); news.setVideourl(videourl); news.setFootType(footType); news.setShowType(showType); news.setNewsType(newsType); news.setPicInfo(picInfo); news.setMinipics(minipics); news.setPublished(published); news.setCommentcount(commentcount); news.setIscomment(iscomment); news.setLiveurl(liveurl); news.setIsread(isread); news.setListStyle(listStyle); news.setShowSource(showSource); news.setLiveType(liveType); news.setSignStatus(signStatus); news.setShareUrl(shareUrl); news.setTypeId(typeId); return news; } public String getIscomment() { return iscomment; } public void setIscomment(String iscomment) { this.iscomment = iscomment; } public String getNewsId() { return newsId; } public void setNewsId(String newsId) { this.newsId = newsId; } public String getPosid() { return posid; } public void setPosid(String posid) { this.posid = posid; } public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getThumbnail() { return thumbnail; } public void setThumbnail(String thumbnail) { this.thumbnail = thumbnail; } public String getBigthumbnail() { return bigthumbnail; } public void setBigthumbnail(String bigthumbnail) { this.bigthumbnail = bigthumbnail; } public String getSummary() { return summary; } public void setSummary(String summary) { this.summary = summary; } public String getVideourl() { return videourl; } public void setVideourl(String videourl) { this.videourl = videourl; } public int getFootType() { return footType; } public void setFootType(int footType) { this.footType = footType; } public int getShowType() { return showType; } public void setShowType(int showType) { this.showType = showType; } public int getNewsType() { return newsType; } public void setNewsType(int newsType) { this.newsType = newsType; } public List<NewPic> getPicInfo() { return picInfo; } public void setPicInfo(List<NewPic> picInfo) { this.picInfo = picInfo; } public List<String> getMinipics() { return minipics; } public void setMinipics(List<String> minipics) { this.minipics = minipics; } public String getPublished() { return published; } public void setPublished(String published) { this.published = published; } public String getCommentcount() { return commentcount; } public void setCommentcount(String commentcount) { this.commentcount = commentcount; } public String getLiveurl() { return liveurl; } public void setLiveurl(String liveurl) { this.liveurl = liveurl; } public String getIsread() { return isread; } public void setIsread(String isread) { this.isread = isread; } public int getListStyle() { return listStyle; } public void setListStyle(int listStyle) { this.listStyle = listStyle; } public String getShowSource() { return showSource; } public void setShowSource(String showSource) { this.showSource = showSource; } public int getLiveType() { return liveType; } public void setLiveType(int liveType) { this.liveType = liveType; } public int getSignStatus() { return signStatus; } public void setSignStatus(int signStatus) { this.signStatus = signStatus; } public String getShareUrl() { return shareUrl; } public void setShareUrl(String shareUrl) { this.shareUrl = shareUrl; } public int getTypeId() { return typeId; } public void setTypeId(int typeId) { this.typeId = typeId; } }
UTF-8
Java
5,442
java
Other.java
Java
[ { "context": "\n\nimport java.util.List;\n\n/**\n * 推荐位\n * Created by cy-love on 14-1-8.\n */\npublic class Other {\n\n private ", "end": 94, "score": 0.9996094703674316, "start": 87, "tag": "USERNAME", "value": "cy-love" } ]
null
[]
package com.cplatform.xhxw.ui.model; import java.util.List; /** * 推荐位 * Created by cy-love on 14-1-8. */ public class Other { private String newsId; //新闻ID private String posid; //推荐位ID private String order; //排序 private String title; //标题 private String thumbnail; //缩略图 private String bigthumbnail; private String summary; private String videourl; private int footType; private int showType; private int newsType; private List<NewPic> picInfo; private List<String> minipics; private String published; private String commentcount; private String iscomment;//0:允许,1:不允许 private String liveurl; // 直播新闻url private String isread;//后台记录的已读未读状态 private int listStyle; //列表栏目显示类型 private String showSource; //新闻来源 private int liveType; private int signStatus; //圈阅状态 0:未圈阅, 1:已圈阅 private String shareUrl; private int typeId; public New getNew() { New news = new New(); news.setRead(false); news.setNewsId(newsId); news.setOrders(order); news.setTitle(title); news.setThumbnail(thumbnail); news.setBigthumbnail(bigthumbnail); news.setSummary(summary); news.setVideourl(videourl); news.setFootType(footType); news.setShowType(showType); news.setNewsType(newsType); news.setPicInfo(picInfo); news.setMinipics(minipics); news.setPublished(published); news.setCommentcount(commentcount); news.setIscomment(iscomment); news.setLiveurl(liveurl); news.setIsread(isread); news.setListStyle(listStyle); news.setShowSource(showSource); news.setLiveType(liveType); news.setSignStatus(signStatus); news.setShareUrl(shareUrl); news.setTypeId(typeId); return news; } public String getIscomment() { return iscomment; } public void setIscomment(String iscomment) { this.iscomment = iscomment; } public String getNewsId() { return newsId; } public void setNewsId(String newsId) { this.newsId = newsId; } public String getPosid() { return posid; } public void setPosid(String posid) { this.posid = posid; } public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getThumbnail() { return thumbnail; } public void setThumbnail(String thumbnail) { this.thumbnail = thumbnail; } public String getBigthumbnail() { return bigthumbnail; } public void setBigthumbnail(String bigthumbnail) { this.bigthumbnail = bigthumbnail; } public String getSummary() { return summary; } public void setSummary(String summary) { this.summary = summary; } public String getVideourl() { return videourl; } public void setVideourl(String videourl) { this.videourl = videourl; } public int getFootType() { return footType; } public void setFootType(int footType) { this.footType = footType; } public int getShowType() { return showType; } public void setShowType(int showType) { this.showType = showType; } public int getNewsType() { return newsType; } public void setNewsType(int newsType) { this.newsType = newsType; } public List<NewPic> getPicInfo() { return picInfo; } public void setPicInfo(List<NewPic> picInfo) { this.picInfo = picInfo; } public List<String> getMinipics() { return minipics; } public void setMinipics(List<String> minipics) { this.minipics = minipics; } public String getPublished() { return published; } public void setPublished(String published) { this.published = published; } public String getCommentcount() { return commentcount; } public void setCommentcount(String commentcount) { this.commentcount = commentcount; } public String getLiveurl() { return liveurl; } public void setLiveurl(String liveurl) { this.liveurl = liveurl; } public String getIsread() { return isread; } public void setIsread(String isread) { this.isread = isread; } public int getListStyle() { return listStyle; } public void setListStyle(int listStyle) { this.listStyle = listStyle; } public String getShowSource() { return showSource; } public void setShowSource(String showSource) { this.showSource = showSource; } public int getLiveType() { return liveType; } public void setLiveType(int liveType) { this.liveType = liveType; } public int getSignStatus() { return signStatus; } public void setSignStatus(int signStatus) { this.signStatus = signStatus; } public String getShareUrl() { return shareUrl; } public void setShareUrl(String shareUrl) { this.shareUrl = shareUrl; } public int getTypeId() { return typeId; } public void setTypeId(int typeId) { this.typeId = typeId; } }
5,442
0.638962
0.637458
256
19.773438
16.150036
54
false
false
0
0
0
0
0
0
0.671875
false
false
1
2582a7e545c84cedf2c46639c2e5c1e05362effe
24,618,752,597,379
299eab69441e755baea585da8bc644d6fd7d3759
/swagger-doclet/src/test/resources/fixtures/issue17b/UserService.java
cf58fde3d024124f8692c8a178c3f7c4bb2e94b7
[ "Apache-2.0" ]
permissive
conorroche/swagger-doclet
https://github.com/conorroche/swagger-doclet
e726a4e0da910edb55cddb288e87c458280b957e
35199ca9879752d8a70625f28d9e7002b1928971
refs/heads/master
2021-01-12T21:17:02.135000
2016-05-25T06:57:19
2016-05-25T06:57:19
55,234,819
73
31
Apache-2.0
true
2023-07-26T11:16:41
2016-04-01T13:34:03
2022-12-15T02:38:50
2019-06-20T03:41:30
12,731
68
20
16
JavaScript
false
false
package fixtures.issue17b; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; @Path("/users") @SuppressWarnings("javadoc") public interface UserService { @POST @Consumes(APPLICATION_JSON) Response createUser(User user); @GET @Produces(APPLICATION_JSON) List<User> retrieveAllUsers(@QueryParam("start") @DefaultValue("0") int start, @QueryParam("max") @DefaultValue("0") int max); @GET @Produces(APPLICATION_JSON) @Path("/{username}") User retrieveUser(@PathParam("username") String username); @DELETE @Path("/{username}") void deleteUser(@PathParam("username") String username); }
UTF-8
Java
921
java
UserService.java
Java
[]
null
[]
package fixtures.issue17b; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; @Path("/users") @SuppressWarnings("javadoc") public interface UserService { @POST @Consumes(APPLICATION_JSON) Response createUser(User user); @GET @Produces(APPLICATION_JSON) List<User> retrieveAllUsers(@QueryParam("start") @DefaultValue("0") int start, @QueryParam("max") @DefaultValue("0") int max); @GET @Produces(APPLICATION_JSON) @Path("/{username}") User retrieveUser(@PathParam("username") String username); @DELETE @Path("/{username}") void deleteUser(@PathParam("username") String username); }
921
0.752443
0.7481
39
22.615385
23.497534
127
false
false
0
0
0
0
0
0
0.794872
false
false
1
5812f4e1f399914d5601efdebad29e100c481ab5
10,041,633,600,951
11820af9190e6e0bcb2d22a819d704e24258ef47
/app/src/main/java/com/aryeetey/newsearchview/MainActivity.java
6fc56106876702269bfc880aa5112744902382ac
[ "Apache-2.0" ]
permissive
hayahyts/NewSearchView
https://github.com/hayahyts/NewSearchView
633a485d3a53cd2948c1f8468f418b57cf4a3f7e
6b1c05107c611495d7ff7722288f7601616fe81c
refs/heads/master
2020-03-27T03:02:46.426000
2018-08-23T11:54:19
2018-08-23T11:54:19
145,835,469
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aryeetey.newsearchview; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import com.nfortics.searchview.NewSearchView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List<String> suggestions = new ArrayList<>(); suggestions.add("SpaceWork"); suggestions.add("Google"); suggestions.add("Tesla"); suggestions.add("AirBnb"); NewSearchView searchView = findViewById(R.id.search_bar); searchView.allowVoiceSearch(true); searchView.setSuggestions(suggestions); searchView.setSubmitOnClick(true); searchView.setOnQueryTextListener(new NewSearchView.QueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { log(query + " was submitted!"); return true; } @Override public void onQueryTextChange(String newText) { log(newText + " is the new text!"); } }); searchView.setItemListener(suggestion -> log(suggestion + " was clicked!")); } private void log(String message) { Log.d(TAG, message); } }
UTF-8
Java
1,512
java
MainActivity.java
Java
[ { "context": "package com.aryeetey.newsearchview;\n\nimport android.os.Bundle;\nimport ", "end": 20, "score": 0.7308290600776672, "start": 15, "tag": "USERNAME", "value": "eetey" } ]
null
[]
package com.aryeetey.newsearchview; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import com.nfortics.searchview.NewSearchView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List<String> suggestions = new ArrayList<>(); suggestions.add("SpaceWork"); suggestions.add("Google"); suggestions.add("Tesla"); suggestions.add("AirBnb"); NewSearchView searchView = findViewById(R.id.search_bar); searchView.allowVoiceSearch(true); searchView.setSuggestions(suggestions); searchView.setSubmitOnClick(true); searchView.setOnQueryTextListener(new NewSearchView.QueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { log(query + " was submitted!"); return true; } @Override public void onQueryTextChange(String newText) { log(newText + " is the new text!"); } }); searchView.setItemListener(suggestion -> log(suggestion + " was clicked!")); } private void log(String message) { Log.d(TAG, message); } }
1,512
0.652116
0.651455
48
30.5
23.394266
84
false
false
0
0
0
0
0
0
0.541667
false
false
1
73292411a97f8bee2aed4645ff750ad560e3e8fc
10,900,627,062,357
4eef53d9f0ce9651bf194a11329db7192e3a6905
/src/JavaExamples/FactoryPattern.java
e42c3db06aad8248b703b3cf3371da1720423a26
[]
no_license
siva2k16/JavaExamples
https://github.com/siva2k16/JavaExamples
57f4478080e5214a519e9c702f89e9e5ac5ff85c
81f0a7791aae68a7eceb87f8a8299ba76bb1a425
refs/heads/master
2020-04-11T09:12:32.062000
2015-04-15T05:50:32
2015-04-15T05:50:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package JavaExamples; interface IClientProperty { public String SetRegion(); } class APACProperty implements IClientProperty { String regionLocation; public String SetRegion() { regionLocation = "APAC"; System.out.println(regionLocation); return regionLocation; } } class USProperty implements IClientProperty { String regionLocation; public String SetRegion() { regionLocation = "US"; System.out.println(regionLocation); return regionLocation; } } public class FactoryPattern { public static void main(String args[]) { FactoryPattern program = new FactoryPattern(); IClientProperty objBase = program.GetObject("US"); FactoryPattern program2 = new FactoryPattern(); IClientProperty objBase2 = program2.GetObject("APAC"); System.out.println("Result One is :" + objBase.SetRegion()); System.out.println("\nResult Two is :" + objBase2.SetRegion()); } public IClientProperty GetObject(String Region) { IClientProperty objBase = null; if (Region.equals("US")) { objBase = new USProperty(); } else if (Region.equals("APAC")) { objBase = new APACProperty(); } return objBase; } }
UTF-8
Java
1,135
java
FactoryPattern.java
Java
[]
null
[]
package JavaExamples; interface IClientProperty { public String SetRegion(); } class APACProperty implements IClientProperty { String regionLocation; public String SetRegion() { regionLocation = "APAC"; System.out.println(regionLocation); return regionLocation; } } class USProperty implements IClientProperty { String regionLocation; public String SetRegion() { regionLocation = "US"; System.out.println(regionLocation); return regionLocation; } } public class FactoryPattern { public static void main(String args[]) { FactoryPattern program = new FactoryPattern(); IClientProperty objBase = program.GetObject("US"); FactoryPattern program2 = new FactoryPattern(); IClientProperty objBase2 = program2.GetObject("APAC"); System.out.println("Result One is :" + objBase.SetRegion()); System.out.println("\nResult Two is :" + objBase2.SetRegion()); } public IClientProperty GetObject(String Region) { IClientProperty objBase = null; if (Region.equals("US")) { objBase = new USProperty(); } else if (Region.equals("APAC")) { objBase = new APACProperty(); } return objBase; } }
1,135
0.728634
0.72511
51
21.274509
19.77231
65
false
false
0
0
0
0
0
0
1.392157
false
false
1
b90cc3422ebedabec354a3daceea3310affa4573
29,703,993,859,569
a0cd546101594e679544d24f92ae8fcc17013142
/refactorit-core/src/main/java/net/sf/refactorit/source/format/BinExpressionFormatter.java
41629b4207c845b115a1777fbbd655b810673da7
[]
no_license
svn2github/RefactorIT
https://github.com/svn2github/RefactorIT
f65198bb64f6c11e20d35ace5f9563d781b7fe5c
4b1fc1ebd06c8e192af9ccd94eb5c2d96f79f94c
refs/heads/master
2021-01-10T03:09:28.310000
2008-09-18T10:17:56
2008-09-18T10:17:56
47,540,746
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ package net.sf.refactorit.source.format; import net.sf.refactorit.classmodel.expressions.BinExpression; // FIXME: implement a common base class public class BinExpressionFormatter extends BinItemFormatter { protected BinExpression exp; public BinExpressionFormatter(BinExpression exp) { this.exp = exp; } public String print() { if (exp.getRootAst() != null) { return exp.getCompilationUnit().getContent() .substring(exp.getStartPosition(), exp.getEndPosition()).trim(); } else { throw new UnsupportedOperationException("Not yet implemented"); } } }
UTF-8
Java
922
java
BinExpressionFormatter.java
Java
[]
null
[]
/* * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ package net.sf.refactorit.source.format; import net.sf.refactorit.classmodel.expressions.BinExpression; // FIXME: implement a common base class public class BinExpressionFormatter extends BinItemFormatter { protected BinExpression exp; public BinExpressionFormatter(BinExpression exp) { this.exp = exp; } public String print() { if (exp.getRootAst() != null) { return exp.getCompilationUnit().getContent() .substring(exp.getStartPosition(), exp.getEndPosition()).trim(); } else { throw new UnsupportedOperationException("Not yet implemented"); } } }
922
0.693059
0.684382
32
26.8125
26.946054
74
false
false
0
0
0
0
0
0
0.21875
false
false
1
a12c6139cad750715a97ad43c1e1a71ec83c4a37
18,193,481,531,956
263a268c272dae09b0520e5a319bb3782dcd02fb
/src/main/java/com/example/gamedemo/common/resource/ResourceBeanPostProcessor.java
2ee50073d5e2ad61e4491b6208f0cbf9d50fdc5a
[]
no_license
vilinian/gamedemo
https://github.com/vilinian/gamedemo
aeef51b205d34ec58c82c97523aa6c3d2452552c
0a9bf137cdf47f01d0409ba0a31c9e3208087185
refs/heads/master
2020-07-04T04:17:22.650000
2019-07-25T13:31:44
2019-07-25T13:31:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.gamedemo.common.resource; import com.example.gamedemo.common.anno.Resource; import com.example.gamedemo.common.utils.ExcelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter; import org.springframework.core.Ordered; import org.springframework.stereotype.Component; import java.util.List; /** * @author wengj * @description:配置文件加载 * @date 2019/6/13 */ @Component public class ResourceBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter implements Ordered { private static final Logger logger = LoggerFactory.getLogger(ResourceBeanPostProcessor.class); @Override public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { Class<?> clazz = bean.getClass(); Resource annotation = clazz.getAnnotation(Resource.class); if (annotation != null) { logger.info("加载静态资源[{}]", beanName); List<?> list = ExcelUtils.importExcel(clazz); for (Object object : list) { ResourceInterface resourceItem = (ResourceInterface) object; // 加载完成进行处理,如字符串装换成特殊格式的数据 resourceItem.postInit(); ResourceManager.putResourceItem(clazz, resourceItem.getId(), object); } } return super.postProcessAfterInstantiation(bean, beanName); } @Override public int getOrder() { return Integer.MAX_VALUE; } }
UTF-8
Java
1,573
java
ResourceBeanPostProcessor.java
Java
[ { "context": "Component;\n\nimport java.util.List;\n\n/**\n * @author wengj\n * @description:配置文件加载\n * @date 2019/6/13\n */\n@Co", "end": 483, "score": 0.9996194243431091, "start": 478, "tag": "USERNAME", "value": "wengj" } ]
null
[]
package com.example.gamedemo.common.resource; import com.example.gamedemo.common.anno.Resource; import com.example.gamedemo.common.utils.ExcelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter; import org.springframework.core.Ordered; import org.springframework.stereotype.Component; import java.util.List; /** * @author wengj * @description:配置文件加载 * @date 2019/6/13 */ @Component public class ResourceBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter implements Ordered { private static final Logger logger = LoggerFactory.getLogger(ResourceBeanPostProcessor.class); @Override public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { Class<?> clazz = bean.getClass(); Resource annotation = clazz.getAnnotation(Resource.class); if (annotation != null) { logger.info("加载静态资源[{}]", beanName); List<?> list = ExcelUtils.importExcel(clazz); for (Object object : list) { ResourceInterface resourceItem = (ResourceInterface) object; // 加载完成进行处理,如字符串装换成特殊格式的数据 resourceItem.postInit(); ResourceManager.putResourceItem(clazz, resourceItem.getId(), object); } } return super.postProcessAfterInstantiation(bean, beanName); } @Override public int getOrder() { return Integer.MAX_VALUE; } }
1,573
0.756829
0.750833
46
31.630434
28.20373
100
false
false
0
0
0
0
0
0
0.543478
false
false
1
7e070dcf7b9826464af83b0290f7c1e7e485c1db
35,433,480,194,868
789f12ce13d1be95a7c08f05c3043d03939bb561
/src/mgn/obj/_beans/customerRegBean.java
085649106a661b0a57f0d0b1d5044d61260910ba
[]
no_license
jozzell/ManhassetGreatNeck.com
https://github.com/jozzell/ManhassetGreatNeck.com
bcda9eebf4cc0e8691d36a46cba480d131f6a3cd
f3d4c877a62b486a6bcf11e48315ed75017b8576
refs/heads/master
2021-01-18T22:10:47.539000
2016-05-16T20:34:33
2016-05-16T20:34:33
25,309,747
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 mgn.obj._beans; import java.io.Serializable; import javax.faces.bean.ManagedBean; /** * * @author Lloyd */ @ManagedBean(name = "customerRegBean") public class customerRegBean extends customerLinkBean implements Serializable{ private int regId; private int regCustId; private int regLookupId; private int regPaidId,regCompleted; private String regNote="",pdf,lookupDesc; private int shirtSize,warmupSuiteSize,shortSide; private String shirtSizeStr,warmupSuiteSizeStr,shortSideStr; private String dobStr,fullname,school,health,contact,subjectBody,feeDesc; /** * @return the regId */ public int getRegId() { return regId; } /** * @param regId the regId to set */ public void setRegId(int regId) { this.regId = regId; } /** * @return the regCustId */ public int getRegCustId() { return regCustId; } /** * @param regCustId the regCustId to set */ public void setRegCustId(int regCustId) { this.regCustId = regCustId; } /** * @return the regLookupId */ public int getRegLookupId() { return regLookupId; } /** * @param regLookupId the regLookupId to set */ public void setRegLookupId(int regLookupId) { this.regLookupId = regLookupId; } /** * @return the regPaidId */ public int getRegPaidId() { return regPaidId; } /** * @param regPaidId the regPaidId to set */ public void setRegPaidId(int regPaidId) { this.regPaidId = regPaidId; } /** * @return the regNote */ public String getRegNote() { return regNote; } /** * @param regNote the regNote to set */ public void setRegNote(String regNote) { this.regNote = regNote; } /** * @return the pdf */ public String getPdf() { return pdf; } /** * @param pdf the pdf to set */ public void setPdf(String pdf) { this.pdf = pdf; } /** * @return the regCompleted */ public int getRegCompleted() { return regCompleted; } /** * @param regCompleted the regCompleted to set */ public void setRegCompleted(int regCompleted) { this.regCompleted = regCompleted; } /** * @return the lookupDesc */ public String getLookupDesc() { return lookupDesc; } /** * @param lookupDesc the lookupDesc to set */ public void setLookupDesc(String lookupDesc) { this.lookupDesc = lookupDesc; } /** * @return the shirtSize */ public int getShirtSize() { return shirtSize; } /** * @param shirtSize the shirtSize to set */ public void setShirtSize(int shirtSize) { this.shirtSize = shirtSize; } /** * @return the warmupSuiteSize */ public int getWarmupSuiteSize() { return warmupSuiteSize; } /** * @param warmupSuiteSize the warmupSuiteSize to set */ public void setWarmupSuiteSize(int warmupSuiteSize) { this.warmupSuiteSize = warmupSuiteSize; } /** * @return the shortSide */ public int getShortSide() { return shortSide; } /** * @param shortSide the shortSide to set */ public void setShortSide(int shortSide) { this.shortSide = shortSide; } /** * @return the dobStr */ @Override public String getDobStr() { return dobStr; } /** * @param dobStr the dobStr to set */ @Override public void setDobStr(String dobStr) { this.dobStr = dobStr; } /** * @return the fullName */ @Override public String getFullname() { return fullname; } @Override public void setFullname(String fullName) { this.fullname = fullName; } /** * @return the shirtSizeStr */ public String getShirtSizeStr() { return shirtSizeStr; } /** * @param shirtSizeStr the shirtSizeStr to set */ public void setShirtSizeStr(String shirtSizeStr) { this.shirtSizeStr = shirtSizeStr; } /** * @return the warmupSuiteSizeStr */ public String getWarmupSuiteSizeStr() { return warmupSuiteSizeStr; } /** * @param warmupSuiteSizeStr the warmupSuiteSizeStr to set */ public void setWarmupSuiteSizeStr(String warmupSuiteSizeStr) { this.warmupSuiteSizeStr = warmupSuiteSizeStr; } /** * @return the shortSideStr */ public String getShortSideStr() { return shortSideStr; } /** * @param shortSideStr the shortSideStr to set */ public void setShortSideStr(String shortSideStr) { this.shortSideStr = shortSideStr; } /** * @return the school */ public String getSchool() { return school; } /** * @param school the school to set */ public void setSchool(String school) { this.school = school; } /** * @return the health */ public String getHealth() { return health; } /** * @param health the health to set */ public void setHealth(String health) { this.health = health; } /** * @return the contact */ public String getContact() { return contact; } /** * @param contact the contact to set */ public void setContact(String contact) { this.contact = contact; } /** * @return the subjectBody */ public String getSubjectBody() { return subjectBody; } /** * @param subjectBody the subjectBody to set */ public void setSubjectBody(String subjectBody) { this.subjectBody = subjectBody; } /** * @return the feeDesc */ public String getFeeDesc() { return feeDesc; } /** * @param feeDesc the feeDesc to set */ public void setFeeDesc(String feeDesc) { this.feeDesc = feeDesc; } }
UTF-8
Java
6,686
java
customerRegBean.java
Java
[ { "context": "vax.faces.bean.ManagedBean;\r\n\r\n/**\r\n *\r\n * @author Lloyd\r\n */\r\n@ManagedBean(name = \"customerRegBean\")\r\npub", "end": 312, "score": 0.9987302422523499, "start": 307, "tag": "NAME", "value": "Lloyd" } ]
null
[]
/* * 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 mgn.obj._beans; import java.io.Serializable; import javax.faces.bean.ManagedBean; /** * * @author Lloyd */ @ManagedBean(name = "customerRegBean") public class customerRegBean extends customerLinkBean implements Serializable{ private int regId; private int regCustId; private int regLookupId; private int regPaidId,regCompleted; private String regNote="",pdf,lookupDesc; private int shirtSize,warmupSuiteSize,shortSide; private String shirtSizeStr,warmupSuiteSizeStr,shortSideStr; private String dobStr,fullname,school,health,contact,subjectBody,feeDesc; /** * @return the regId */ public int getRegId() { return regId; } /** * @param regId the regId to set */ public void setRegId(int regId) { this.regId = regId; } /** * @return the regCustId */ public int getRegCustId() { return regCustId; } /** * @param regCustId the regCustId to set */ public void setRegCustId(int regCustId) { this.regCustId = regCustId; } /** * @return the regLookupId */ public int getRegLookupId() { return regLookupId; } /** * @param regLookupId the regLookupId to set */ public void setRegLookupId(int regLookupId) { this.regLookupId = regLookupId; } /** * @return the regPaidId */ public int getRegPaidId() { return regPaidId; } /** * @param regPaidId the regPaidId to set */ public void setRegPaidId(int regPaidId) { this.regPaidId = regPaidId; } /** * @return the regNote */ public String getRegNote() { return regNote; } /** * @param regNote the regNote to set */ public void setRegNote(String regNote) { this.regNote = regNote; } /** * @return the pdf */ public String getPdf() { return pdf; } /** * @param pdf the pdf to set */ public void setPdf(String pdf) { this.pdf = pdf; } /** * @return the regCompleted */ public int getRegCompleted() { return regCompleted; } /** * @param regCompleted the regCompleted to set */ public void setRegCompleted(int regCompleted) { this.regCompleted = regCompleted; } /** * @return the lookupDesc */ public String getLookupDesc() { return lookupDesc; } /** * @param lookupDesc the lookupDesc to set */ public void setLookupDesc(String lookupDesc) { this.lookupDesc = lookupDesc; } /** * @return the shirtSize */ public int getShirtSize() { return shirtSize; } /** * @param shirtSize the shirtSize to set */ public void setShirtSize(int shirtSize) { this.shirtSize = shirtSize; } /** * @return the warmupSuiteSize */ public int getWarmupSuiteSize() { return warmupSuiteSize; } /** * @param warmupSuiteSize the warmupSuiteSize to set */ public void setWarmupSuiteSize(int warmupSuiteSize) { this.warmupSuiteSize = warmupSuiteSize; } /** * @return the shortSide */ public int getShortSide() { return shortSide; } /** * @param shortSide the shortSide to set */ public void setShortSide(int shortSide) { this.shortSide = shortSide; } /** * @return the dobStr */ @Override public String getDobStr() { return dobStr; } /** * @param dobStr the dobStr to set */ @Override public void setDobStr(String dobStr) { this.dobStr = dobStr; } /** * @return the fullName */ @Override public String getFullname() { return fullname; } @Override public void setFullname(String fullName) { this.fullname = fullName; } /** * @return the shirtSizeStr */ public String getShirtSizeStr() { return shirtSizeStr; } /** * @param shirtSizeStr the shirtSizeStr to set */ public void setShirtSizeStr(String shirtSizeStr) { this.shirtSizeStr = shirtSizeStr; } /** * @return the warmupSuiteSizeStr */ public String getWarmupSuiteSizeStr() { return warmupSuiteSizeStr; } /** * @param warmupSuiteSizeStr the warmupSuiteSizeStr to set */ public void setWarmupSuiteSizeStr(String warmupSuiteSizeStr) { this.warmupSuiteSizeStr = warmupSuiteSizeStr; } /** * @return the shortSideStr */ public String getShortSideStr() { return shortSideStr; } /** * @param shortSideStr the shortSideStr to set */ public void setShortSideStr(String shortSideStr) { this.shortSideStr = shortSideStr; } /** * @return the school */ public String getSchool() { return school; } /** * @param school the school to set */ public void setSchool(String school) { this.school = school; } /** * @return the health */ public String getHealth() { return health; } /** * @param health the health to set */ public void setHealth(String health) { this.health = health; } /** * @return the contact */ public String getContact() { return contact; } /** * @param contact the contact to set */ public void setContact(String contact) { this.contact = contact; } /** * @return the subjectBody */ public String getSubjectBody() { return subjectBody; } /** * @param subjectBody the subjectBody to set */ public void setSubjectBody(String subjectBody) { this.subjectBody = subjectBody; } /** * @return the feeDesc */ public String getFeeDesc() { return feeDesc; } /** * @param feeDesc the feeDesc to set */ public void setFeeDesc(String feeDesc) { this.feeDesc = feeDesc; } }
6,686
0.549207
0.549207
324
18.635803
17.703232
79
false
false
0
0
0
0
0
0
0.212963
false
false
1
0614953c66e3bdeba96803259b735744228d7116
35,081,292,878,538
6e2f635e57136938e115c69f7731acf7f5789f6e
/test/src/collection/TreeSetTest1.java
2d98d3a654e67a928ee78082fc821ea33f5d61a6
[]
no_license
610152753/ClassTest
https://github.com/610152753/ClassTest
a1bc9d1c7a4486414179da69b7c94c7632cfde19
996f161e65fdc788b83ff156567fb210898ca99b
refs/heads/master
2020-12-24T05:49:26.179000
2016-07-10T11:07:06
2016-07-10T11:07:06
18,234,372
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collection; import java.util.Comparator; import java.util.Iterator; import java.util.TreeSet; public class TreeSetTest1 { public static void main(String[] args) { TreeSet set = new TreeSet(new MyObjComparator()); Person p1 = new Person(10); Person p2 = new Person(20); Person p3 = new Person(30); set.add(p1); set.add(p2); set.add(p3); System.out.println(set); for (Iterator iter = set.iterator(); iter.hasNext();) { Person pt = (Person)iter.next(); System.out.println(pt.score); } } } class Person { int score; public Person(int score) { this.score = score; } } class MyObjComparator implements Comparator<Object> { public int compare(Object o1, Object o2) { Person pa1 = (Person) o1; Person pa2 = (Person) o2; return pa1.score - pa2.score; } }
UTF-8
Java
855
java
TreeSetTest1.java
Java
[]
null
[]
package collection; import java.util.Comparator; import java.util.Iterator; import java.util.TreeSet; public class TreeSetTest1 { public static void main(String[] args) { TreeSet set = new TreeSet(new MyObjComparator()); Person p1 = new Person(10); Person p2 = new Person(20); Person p3 = new Person(30); set.add(p1); set.add(p2); set.add(p3); System.out.println(set); for (Iterator iter = set.iterator(); iter.hasNext();) { Person pt = (Person)iter.next(); System.out.println(pt.score); } } } class Person { int score; public Person(int score) { this.score = score; } } class MyObjComparator implements Comparator<Object> { public int compare(Object o1, Object o2) { Person pa1 = (Person) o1; Person pa2 = (Person) o2; return pa1.score - pa2.score; } }
855
0.636257
0.611696
47
16.234043
15.965672
55
false
false
0
0
0
0
0
0
1.489362
false
false
1
b7d53aef64a5c2bf0d970eac8d1e2d8d4af09c20
22,608,707,914,040
fc3d5bb8a38d727e6ae7d9672f0460d0016f38e5
/L10 - jsp/src/main/java/rnk/l10/rest/RnkCreditAccounter.java
37b48698627cdf5cc17db2eab42b7242b0807b8a
[ "MIT" ]
permissive
drJabber/otus_javaee_2018_09
https://github.com/drJabber/otus_javaee_2018_09
f46a4c14c16c313564e32207a34dd1ba04adbe62
5c560a2b7a29bc2a6c666bbc5e20772d3986a5f3
refs/heads/master
2020-03-28T17:45:03.511000
2019-02-10T15:18:46
2019-02-10T15:18:46
148,819,061
0
0
MIT
false
2018-12-03T19:54:28
2018-09-14T17:09:19
2018-12-03T04:10:35
2018-12-03T19:54:28
1,724
0
0
0
Java
false
null
package rnk.l10.rest; import rnk.l10.rest.model.AccountingParams; import javax.validation.Valid; import javax.ws.rs.BeanParam; import java.util.List; public interface RnkCreditAccounter { public List<Double> computePayment(@Valid @BeanParam AccountingParams params); }
UTF-8
Java
276
java
RnkCreditAccounter.java
Java
[]
null
[]
package rnk.l10.rest; import rnk.l10.rest.model.AccountingParams; import javax.validation.Valid; import javax.ws.rs.BeanParam; import java.util.List; public interface RnkCreditAccounter { public List<Double> computePayment(@Valid @BeanParam AccountingParams params); }
276
0.800725
0.786232
11
24.09091
23.78867
82
false
false
0
0
0
0
0
0
0.545455
false
false
1
5ad8a7712faf4f9162ecf35fb66ababbfc37499f
9,594,956,977,755
cd4bd8abf04a98ae8b95f59d7b54a848ba758059
/app/src/main/java/com/arkainfoteck/helpmate/Activitys/DatabaseHelper.java
7ed15e4f2d7e326932d057a0f65f907bb4bafb6e
[]
no_license
Mounikavallabhani/HelpMate
https://github.com/Mounikavallabhani/HelpMate
b6f093758ba362d51d6df0e2256279c9a3e8d965
9236d547d52b70db3c0b8144e5e7e0b3f0935663
refs/heads/master
2020-04-27T07:26:20.123000
2019-03-10T06:43:01
2019-03-10T06:43:01
174,135,985
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.arkainfoteck.helpmate.Activitys; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import android.widget.Toast; import java.sql.Time; import java.util.ArrayList; import java.util.List; public class DatabaseHelper extends SQLiteOpenHelper { public static String DATABASE = "database.db"; public static String TABLE ="mytable"; public static String NAME ="name"; public static String COMPANY ="company"; public static String CITY ="city"; public static String COUNTRY ="country"; public static String TABLE_TIME_SLAT="timeslat"; public static String TIME ="time"; String br; String brdata; public DatabaseHelper(Context context) { super(context, DATABASE, null, 1); } @Override public void onCreate(SQLiteDatabase db) { br = "CREATE TABLE "+TABLE+"("+NAME+ " Text, "+COMPANY+ " Text, "+CITY+ " Text, "+COUNTRY+ " Text);"; brdata = "CREATE TABLE "+TABLE_TIME_SLAT+"("+TIME+ " Text);"; db.execSQL(br); db.execSQL(brdata); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS "+TABLE+" ;"); db.execSQL("DROP TABLE IF EXISTS "+TABLE_TIME_SLAT+" ;"); onCreate(db); } public void insertdata(String name,String company ,String city,String country){ System.out.print("Hello "+br); SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues= new ContentValues(); contentValues.put(NAME, name); contentValues.put(COMPANY, company); contentValues.put(CITY,city); contentValues.put(COUNTRY,country); db.insert(TABLE,null,contentValues); } public long inserttimedata(String name ){ System.out.print("Hello123"+name); SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues= new ContentValues(); contentValues.put(TIME, name); long count= db.insert(TABLE_TIME_SLAT,null,contentValues); System.out.print("H122123"+count); return count; } public ArrayList<DataModel> gettimedata(){ ArrayList<DataModel> data=new ArrayList<>(); SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery("select * from "+TABLE_TIME_SLAT+" ;",null); StringBuffer stringBuffer = new StringBuffer(); DataModel dataModel = null; while (cursor.moveToNext()) { dataModel= new DataModel(); String name = cursor.getString(cursor.getColumnIndexOrThrow("time")); dataModel.setTime_slat(name); stringBuffer.append(dataModel); data.add(dataModel); } for (DataModel mo:data ) { Log.i("Hellomo",""+mo.getTime_slat()); } return data; } public ArrayList<DataModel> getdata(){ ArrayList<DataModel> data=new ArrayList<>(); SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery("select * from "+TABLE+" ;",null); StringBuffer stringBuffer = new StringBuffer(); DataModel dataModel = null; while (cursor.moveToNext()) { dataModel= new DataModel(); String name = cursor.getString(cursor.getColumnIndexOrThrow("name")); String company = cursor.getString(cursor.getColumnIndexOrThrow("company")); String country = cursor.getString(cursor.getColumnIndexOrThrow("country")); String city = cursor.getString(cursor.getColumnIndexOrThrow("city")); dataModel.setName(name); dataModel.setApparent_house(city); dataModel.setLocality(country); dataModel.setNear_by_place(company); stringBuffer.append(dataModel); data.add(dataModel); } for (DataModel mo:data ) { Log.i("Hellomo",""+mo.getName()); } return data; } public int deleteConformOrderData(){ SQLiteDatabase db=getWritableDatabase(); int count= db.delete(TABLE_TIME_SLAT,null,null); db.close(); return count; } }
UTF-8
Java
4,363
java
DatabaseHelper.java
Java
[]
null
[]
package com.arkainfoteck.helpmate.Activitys; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import android.widget.Toast; import java.sql.Time; import java.util.ArrayList; import java.util.List; public class DatabaseHelper extends SQLiteOpenHelper { public static String DATABASE = "database.db"; public static String TABLE ="mytable"; public static String NAME ="name"; public static String COMPANY ="company"; public static String CITY ="city"; public static String COUNTRY ="country"; public static String TABLE_TIME_SLAT="timeslat"; public static String TIME ="time"; String br; String brdata; public DatabaseHelper(Context context) { super(context, DATABASE, null, 1); } @Override public void onCreate(SQLiteDatabase db) { br = "CREATE TABLE "+TABLE+"("+NAME+ " Text, "+COMPANY+ " Text, "+CITY+ " Text, "+COUNTRY+ " Text);"; brdata = "CREATE TABLE "+TABLE_TIME_SLAT+"("+TIME+ " Text);"; db.execSQL(br); db.execSQL(brdata); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS "+TABLE+" ;"); db.execSQL("DROP TABLE IF EXISTS "+TABLE_TIME_SLAT+" ;"); onCreate(db); } public void insertdata(String name,String company ,String city,String country){ System.out.print("Hello "+br); SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues= new ContentValues(); contentValues.put(NAME, name); contentValues.put(COMPANY, company); contentValues.put(CITY,city); contentValues.put(COUNTRY,country); db.insert(TABLE,null,contentValues); } public long inserttimedata(String name ){ System.out.print("Hello123"+name); SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues= new ContentValues(); contentValues.put(TIME, name); long count= db.insert(TABLE_TIME_SLAT,null,contentValues); System.out.print("H122123"+count); return count; } public ArrayList<DataModel> gettimedata(){ ArrayList<DataModel> data=new ArrayList<>(); SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery("select * from "+TABLE_TIME_SLAT+" ;",null); StringBuffer stringBuffer = new StringBuffer(); DataModel dataModel = null; while (cursor.moveToNext()) { dataModel= new DataModel(); String name = cursor.getString(cursor.getColumnIndexOrThrow("time")); dataModel.setTime_slat(name); stringBuffer.append(dataModel); data.add(dataModel); } for (DataModel mo:data ) { Log.i("Hellomo",""+mo.getTime_slat()); } return data; } public ArrayList<DataModel> getdata(){ ArrayList<DataModel> data=new ArrayList<>(); SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery("select * from "+TABLE+" ;",null); StringBuffer stringBuffer = new StringBuffer(); DataModel dataModel = null; while (cursor.moveToNext()) { dataModel= new DataModel(); String name = cursor.getString(cursor.getColumnIndexOrThrow("name")); String company = cursor.getString(cursor.getColumnIndexOrThrow("company")); String country = cursor.getString(cursor.getColumnIndexOrThrow("country")); String city = cursor.getString(cursor.getColumnIndexOrThrow("city")); dataModel.setName(name); dataModel.setApparent_house(city); dataModel.setLocality(country); dataModel.setNear_by_place(company); stringBuffer.append(dataModel); data.add(dataModel); } for (DataModel mo:data ) { Log.i("Hellomo",""+mo.getName()); } return data; } public int deleteConformOrderData(){ SQLiteDatabase db=getWritableDatabase(); int count= db.delete(TABLE_TIME_SLAT,null,null); db.close(); return count; } }
4,363
0.639239
0.636947
135
31.325926
25.014612
109
false
false
0
0
0
0
0
0
0.814815
false
false
1
e8ac34012fe89e76600bc4caf7f54d8a8d8cb11a
21,543,555,999,085
bca7eeac177cb86ac7da42c49b79faea98b79b68
/src/main/java/servlets/EditUserServlet.java
3d20f7bbc39a2f9c3876e89526985c79c1fe081a
[]
no_license
IvanCherepica/biusness-festival
https://github.com/IvanCherepica/biusness-festival
efd31c7e00c89fd52a87f0603b5770b88fa3e570
1836d3b49f920922a2b9c184aff81414de0ebfdf
refs/heads/master
2023-04-28T21:30:41.522000
2019-02-13T16:05:19
2019-02-13T16:05:19
169,571,944
1
0
null
false
2023-04-14T17:47:04
2019-02-07T12:57:17
2019-02-13T16:06:14
2023-04-14T17:47:04
558
1
0
5
Java
false
false
package servlets; import models.EventPoint; import models.User; import org.hibernate.HibernateException; import services.EventPoinService; import services.EventPoinServiceImpl; import services.UserService; import services.UserServiceImpl; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; @WebServlet("/admin/editUser") public class EditUserServlet extends HttpServlet { private final UserService userService = UserServiceImpl.getInstance(); private final EventPoinService eventPoinService= EventPoinServiceImpl.getInstance(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); String paramId = request.getParameter("edit"); User user; if (paramId == null) { response.sendRedirect("/error.html"); } else { long id = Long.parseLong(paramId); user = userService.getById(id); List<EventPoint> eventFromUser = user.getEvents(); List<EventPoint> allEventsFromDB=eventPoinService.getAllList(); request.setAttribute("user", user); boolean p= allEventsFromDB.removeAll(eventFromUser); request.setAttribute("eventsp",allEventsFromDB); request.setAttribute( "ueventsp",eventFromUser); } RequestDispatcher dispatcher = request.getRequestDispatcher("/editUser.jsp"); dispatcher.forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String paramId = request.getParameter("id"); String name = request.getParameter("name"); String password = request.getParameter("password"); String role = request.getParameter("role"); String[] eventId= request.getParameterValues("epoint"); try { Long id = Long.parseLong(paramId); User user = userService.getById(id); user.setName(name == null ? "" : name); user.setPassword(password == null ? "" : password); user.setRole(role == null ? "" : role); List<EventPoint> userEvents= user.getEvents(); //добавление ивентов для участника if (userEvents != null) { if (eventId != null) { List<EventPoint> events = new ArrayList<>(); for (String eve : eventId) { events.add(eventPoinService.getById(Long.parseLong(eve))); } user.setEventsToUser(events); } else { userEvents.removeAll(userEvents); user.setEventsToUser(userEvents); } } //конец добавления userService.update(user); response.setContentType("text/html"); response.sendRedirect("/admin/users"); } catch (HibernateException | NumberFormatException e) { response.sendRedirect("/error.html"); } } }
UTF-8
Java
3,451
java
EditUserServlet.java
Java
[]
null
[]
package servlets; import models.EventPoint; import models.User; import org.hibernate.HibernateException; import services.EventPoinService; import services.EventPoinServiceImpl; import services.UserService; import services.UserServiceImpl; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; @WebServlet("/admin/editUser") public class EditUserServlet extends HttpServlet { private final UserService userService = UserServiceImpl.getInstance(); private final EventPoinService eventPoinService= EventPoinServiceImpl.getInstance(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); String paramId = request.getParameter("edit"); User user; if (paramId == null) { response.sendRedirect("/error.html"); } else { long id = Long.parseLong(paramId); user = userService.getById(id); List<EventPoint> eventFromUser = user.getEvents(); List<EventPoint> allEventsFromDB=eventPoinService.getAllList(); request.setAttribute("user", user); boolean p= allEventsFromDB.removeAll(eventFromUser); request.setAttribute("eventsp",allEventsFromDB); request.setAttribute( "ueventsp",eventFromUser); } RequestDispatcher dispatcher = request.getRequestDispatcher("/editUser.jsp"); dispatcher.forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String paramId = request.getParameter("id"); String name = request.getParameter("name"); String password = request.getParameter("password"); String role = request.getParameter("role"); String[] eventId= request.getParameterValues("epoint"); try { Long id = Long.parseLong(paramId); User user = userService.getById(id); user.setName(name == null ? "" : name); user.setPassword(password == null ? "" : password); user.setRole(role == null ? "" : role); List<EventPoint> userEvents= user.getEvents(); //добавление ивентов для участника if (userEvents != null) { if (eventId != null) { List<EventPoint> events = new ArrayList<>(); for (String eve : eventId) { events.add(eventPoinService.getById(Long.parseLong(eve))); } user.setEventsToUser(events); } else { userEvents.removeAll(userEvents); user.setEventsToUser(userEvents); } } //конец добавления userService.update(user); response.setContentType("text/html"); response.sendRedirect("/admin/users"); } catch (HibernateException | NumberFormatException e) { response.sendRedirect("/error.html"); } } }
3,451
0.645142
0.645142
90
36.855556
26.211771
122
false
false
0
0
0
0
0
0
0.688889
false
false
1
15644aedb8a3d727663937d30c15316a8c66cde4
18,116,172,059,614
84d71e42b5c8144a0db6eaf152fe8e661a012e42
/Projet_PAF/src/main/java/com/inti/formation/webservice/TribunalRestController.java
b77ab579dfa1eb344508d88064398fd4fff86b44
[]
no_license
DrBubulle/Projet_PAF
https://github.com/DrBubulle/Projet_PAF
1bac144ed92de681b05a6354ab4bd8cdf6725b41
4de0d224bb58f5ceddeef1806f0bb289bee93780
refs/heads/master
2023-04-29T09:29:48.872000
2019-06-25T09:36:46
2019-06-25T09:36:46
191,781,100
0
0
null
false
2023-04-14T17:47:53
2019-06-13T14:42:44
2019-06-25T09:36:51
2023-04-14T17:47:53
175
0
0
1
Java
false
false
package com.inti.formation.webservice; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; 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.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.inti.formation.IMetier.ITribunalMetier; import com.inti.formation.Model.Tribunal; @RestController @CrossOrigin("*") @RequestMapping("/apiTribunal") public class TribunalRestController { @Autowired private ITribunalMetier tribunalmetier; public ITribunalMetier getTribunalmetier() { return tribunalmetier; } public void setTribunalmetier(ITribunalMetier tribunalmetier) { this.tribunalmetier = tribunalmetier; } @RequestMapping(value="/ajouterTribunal", method=RequestMethod.POST) public Tribunal ajouter(@RequestBody Tribunal t) { return tribunalmetier.ajouter(t); } @RequestMapping(value="/updateTribunal", method=RequestMethod.PUT) public Tribunal update(@RequestBody Tribunal t) { return tribunalmetier.update(t); } @RequestMapping(value="/deleteTribunal/{id}", method=RequestMethod.DELETE) public void delete(@PathVariable("id") long id) { tribunalmetier.delete(id); } @RequestMapping(value="/tribunal/{id}", method=RequestMethod.GET) public Tribunal findOne(@PathVariable("id") long id) { return tribunalmetier.findOne(id); } @RequestMapping(value="/tribunaux", method=RequestMethod.GET) public List<Tribunal> findAll(){ return tribunalmetier.findAll(); } }
UTF-8
Java
1,780
java
TribunalRestController.java
Java
[]
null
[]
package com.inti.formation.webservice; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; 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.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.inti.formation.IMetier.ITribunalMetier; import com.inti.formation.Model.Tribunal; @RestController @CrossOrigin("*") @RequestMapping("/apiTribunal") public class TribunalRestController { @Autowired private ITribunalMetier tribunalmetier; public ITribunalMetier getTribunalmetier() { return tribunalmetier; } public void setTribunalmetier(ITribunalMetier tribunalmetier) { this.tribunalmetier = tribunalmetier; } @RequestMapping(value="/ajouterTribunal", method=RequestMethod.POST) public Tribunal ajouter(@RequestBody Tribunal t) { return tribunalmetier.ajouter(t); } @RequestMapping(value="/updateTribunal", method=RequestMethod.PUT) public Tribunal update(@RequestBody Tribunal t) { return tribunalmetier.update(t); } @RequestMapping(value="/deleteTribunal/{id}", method=RequestMethod.DELETE) public void delete(@PathVariable("id") long id) { tribunalmetier.delete(id); } @RequestMapping(value="/tribunal/{id}", method=RequestMethod.GET) public Tribunal findOne(@PathVariable("id") long id) { return tribunalmetier.findOne(id); } @RequestMapping(value="/tribunaux", method=RequestMethod.GET) public List<Tribunal> findAll(){ return tribunalmetier.findAll(); } }
1,780
0.769101
0.769101
57
29.228069
25.289909
75
false
false
0
0
0
0
0
0
1.157895
false
false
1
b159a2baeab6fdb09977aa6f9eac9a3a5ec0423a
20,907,900,804,945
2bb9c9584e003f638401756ff0a38c618e466fe5
/Resources/other/2003_c++/java-version/src/q1/CollegeGroup.java
3922260bd8292325ab430f079d28e049f66642fc
[ "MIT" ]
permissive
mdvsh/LearningJava
https://github.com/mdvsh/LearningJava
60ca7832aa01fedcfdbacf0fdae16552b94c2a13
d08f07d3a2aaa543b5f32758c191e7b9dc30d662
refs/heads/master
2022-01-10T19:24:38.884000
2019-05-05T13:36:53
2019-05-05T13:36:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
mport java.util.ArrayList; public class CollegeGroup { private College[] myColleges; // myColleges.length is # colleges // precondition: there exists a College in this group // whose name is collegeName, call this // myColleges[index] // postcondition: myColleges[index].getTuition() == newTuition, i.e., // the College with collegeName has // newTuition as its tuition public void updateTuition(String collegeName, int newTuition) { // you will write this code } // precondition: low <= high // postcondition: returns ArrayList of College objects // from this group in specified region // whose tuition is between (including) // low and high, i.e., low <= tuition <= high public ArrayList getCollegeList(String region, int low, int high) { // you will write this code } }
UTF-8
Java
1,041
java
CollegeGroup.java
Java
[ { "context": "this group\n // whose name is collegeName, call this\n // myColleges[index", "end": 234, "score": 0.5374318361282349, "start": 226, "tag": "USERNAME", "value": "legeName" } ]
null
[]
mport java.util.ArrayList; public class CollegeGroup { private College[] myColleges; // myColleges.length is # colleges // precondition: there exists a College in this group // whose name is collegeName, call this // myColleges[index] // postcondition: myColleges[index].getTuition() == newTuition, i.e., // the College with collegeName has // newTuition as its tuition public void updateTuition(String collegeName, int newTuition) { // you will write this code } // precondition: low <= high // postcondition: returns ArrayList of College objects // from this group in specified region // whose tuition is between (including) // low and high, i.e., low <= tuition <= high public ArrayList getCollegeList(String region, int low, int high) { // you will write this code } }
1,041
0.556196
0.556196
32
31.53125
25.314255
73
false
false
0
0
0
0
0
0
0.3125
false
false
1
149137fe33ef75f21012c5fc1b6dd379039e3829
22,265,110,467,527
92e5459253b3123fa22f4d8d158e2e10756db2db
/coisini-cloud/cloud-gateway/src/main/java/com/work/cloudgateway/filter/ApiAccessRouteFilter.java
5cb47ac407df14ca34f30d1f9f57c8ca90cecd16
[]
no_license
songmanyi/coisini
https://github.com/songmanyi/coisini
e5b2053889e5e98a7e31843673ef751cabd9611f
545cf35b568ecab6092b066a5c76e13cff720e99
refs/heads/master
2022-06-30T19:08:13.578000
2019-10-14T09:15:51
2019-10-14T09:15:51
210,966,699
0
0
null
false
2022-06-21T01:56:52
2019-09-26T00:41:33
2019-10-14T09:20:35
2022-06-21T01:56:51
110
0
0
6
Java
false
false
package com.work.cloudgateway.filter; import com.netflix.zuul.ZuulFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants; import org.springframework.stereotype.Component; @Component public class ApiAccessRouteFilter extends ZuulFilter{ private static Logger log = LoggerFactory.getLogger(ApiAccessRouteFilter.class); /** * 是否应该执行该过滤器,如果是false,则不执行该filter */ @Override public boolean shouldFilter() { //上一个filter设置该值 //return RequestContext.getCurrentContext().getBoolean("isOK"); return true; } /** * 过滤器类型 * 顺序: pre ->routing -> post ,以上3个顺序出现异常时都可以触发error类型的filter */ @Override public String filterType() { return FilterConstants.ROUTE_TYPE; } /** * 同filterType类型中,order值越大,优先级越低 */ @Override public int filterOrder() { return 1; } @Override public Object run() { return null; } }
UTF-8
Java
1,156
java
ApiAccessRouteFilter.java
Java
[]
null
[]
package com.work.cloudgateway.filter; import com.netflix.zuul.ZuulFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants; import org.springframework.stereotype.Component; @Component public class ApiAccessRouteFilter extends ZuulFilter{ private static Logger log = LoggerFactory.getLogger(ApiAccessRouteFilter.class); /** * 是否应该执行该过滤器,如果是false,则不执行该filter */ @Override public boolean shouldFilter() { //上一个filter设置该值 //return RequestContext.getCurrentContext().getBoolean("isOK"); return true; } /** * 过滤器类型 * 顺序: pre ->routing -> post ,以上3个顺序出现异常时都可以触发error类型的filter */ @Override public String filterType() { return FilterConstants.ROUTE_TYPE; } /** * 同filterType类型中,order值越大,优先级越低 */ @Override public int filterOrder() { return 1; } @Override public Object run() { return null; } }
1,156
0.672852
0.668945
44
22.272728
21.796959
84
false
false
0
0
0
0
0
0
0.295455
false
false
1
703f07b8a3e153c6a4957b9c04f1641534f72317
23,441,931,508,475
5363f2ab3ba53745bf6e427b7098d208ac41849b
/src/main/java/com/cts/commsmedia/forecast/dto/RateCardDetailsDTO.java
9d632a6177bd8013706fece747b79b72f3c208a6
[]
no_license
devadossp/ResourceForecasting
https://github.com/devadossp/ResourceForecasting
93b4870c0b40eaf72179eea2e57e262f13098ef8
baa80e218423ed5cf4c8de1d23ae01cad837f5b4
refs/heads/master
2020-04-12T02:45:46.381000
2018-05-07T09:09:09
2018-05-07T09:09:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cts.commsmedia.forecast.dto; import java.util.List; public class RateCardDetailsDTO { private String skillName; private String fromdate; private String todate; private String location; private String department; private float rate; private String onsite; private String projectId; private String projectName; private java.sql.Timestamp fromdate_timestamp; private java.sql.Timestamp todate_timestamp; private int rateValue; /** * @return the skillName */ public String getSkillName() { return skillName; } /** * @param skillName the skillName to set */ public void setSkillName(String skillName) { this.skillName = skillName; } /** * @return the fromdate */ public String getFromdate() { return fromdate; } /** * @param fromdate the fromdate to set */ public void setFromdate(String fromdate) { this.fromdate = fromdate; } /** * @return the todate */ public String getTodate() { return todate; } /** * @param todate the todate to set */ public void setTodate(String todate) { this.todate = todate; } /** * @return the location */ public String getLocation() { return location; } /** * @param location the location to set */ public void setLocation(String location) { this.location = location; } /** * @return the department */ public String getDepartment() { return department; } /** * @param department the department to set */ public void setDepartment(String department) { this.department = department; } /** * @return the rate */ public float getRate() { return rate; } /** * @param rate the rate to set */ public void setRate(float rate) { this.rate = rate; } /** * @return the onsite */ public String getOnsite() { return onsite; } /** * @param onsite the onsite to set */ public void setOnsite(String onsite) { this.onsite = onsite; } /** * @return the projectId */ public String getProjectId() { return projectId; } /** * @param projectId the projectId to set */ public void setProjectId(String projectId) { this.projectId = projectId; } /** * @return the projectName */ public String getProjectName() { return projectName; } /** * @param projectName the projectName to set */ public void setProjectName(String projectName) { this.projectName = projectName; } /** * @return the fromdate_timestamp */ public java.sql.Timestamp getFromdate_timestamp() { return fromdate_timestamp; } /** * @param fromdate_timestamp the fromdate_timestamp to set */ public void setFromdate_timestamp(java.sql.Timestamp fromdate_timestamp) { this.fromdate_timestamp = fromdate_timestamp; } /** * @return the todate_timestamp */ public java.sql.Timestamp getTodate_timestamp() { return todate_timestamp; } /** * @param todate_timestamp the todate_timestamp to set */ public void setTodate_timestamp(java.sql.Timestamp todate_timestamp) { this.todate_timestamp = todate_timestamp; } /** * @return the rateValue */ public int getRateValue() { return rateValue; } /** * @param rateValue the rateValue to set */ public void setRateValue(int rateValue) { this.rateValue = rateValue; } }
UTF-8
Java
3,376
java
RateCardDetailsDTO.java
Java
[]
null
[]
package com.cts.commsmedia.forecast.dto; import java.util.List; public class RateCardDetailsDTO { private String skillName; private String fromdate; private String todate; private String location; private String department; private float rate; private String onsite; private String projectId; private String projectName; private java.sql.Timestamp fromdate_timestamp; private java.sql.Timestamp todate_timestamp; private int rateValue; /** * @return the skillName */ public String getSkillName() { return skillName; } /** * @param skillName the skillName to set */ public void setSkillName(String skillName) { this.skillName = skillName; } /** * @return the fromdate */ public String getFromdate() { return fromdate; } /** * @param fromdate the fromdate to set */ public void setFromdate(String fromdate) { this.fromdate = fromdate; } /** * @return the todate */ public String getTodate() { return todate; } /** * @param todate the todate to set */ public void setTodate(String todate) { this.todate = todate; } /** * @return the location */ public String getLocation() { return location; } /** * @param location the location to set */ public void setLocation(String location) { this.location = location; } /** * @return the department */ public String getDepartment() { return department; } /** * @param department the department to set */ public void setDepartment(String department) { this.department = department; } /** * @return the rate */ public float getRate() { return rate; } /** * @param rate the rate to set */ public void setRate(float rate) { this.rate = rate; } /** * @return the onsite */ public String getOnsite() { return onsite; } /** * @param onsite the onsite to set */ public void setOnsite(String onsite) { this.onsite = onsite; } /** * @return the projectId */ public String getProjectId() { return projectId; } /** * @param projectId the projectId to set */ public void setProjectId(String projectId) { this.projectId = projectId; } /** * @return the projectName */ public String getProjectName() { return projectName; } /** * @param projectName the projectName to set */ public void setProjectName(String projectName) { this.projectName = projectName; } /** * @return the fromdate_timestamp */ public java.sql.Timestamp getFromdate_timestamp() { return fromdate_timestamp; } /** * @param fromdate_timestamp the fromdate_timestamp to set */ public void setFromdate_timestamp(java.sql.Timestamp fromdate_timestamp) { this.fromdate_timestamp = fromdate_timestamp; } /** * @return the todate_timestamp */ public java.sql.Timestamp getTodate_timestamp() { return todate_timestamp; } /** * @param todate_timestamp the todate_timestamp to set */ public void setTodate_timestamp(java.sql.Timestamp todate_timestamp) { this.todate_timestamp = todate_timestamp; } /** * @return the rateValue */ public int getRateValue() { return rateValue; } /** * @param rateValue the rateValue to set */ public void setRateValue(int rateValue) { this.rateValue = rateValue; } }
3,376
0.65077
0.65077
163
18.711657
16.874392
75
false
false
0
0
0
0
0
0
1.349693
false
false
1
4842be6df00c375ae7a3dd3d4b5304e0206808bd
29,008,209,123,284
580aa615b3f476c2eabe2273b8dd64faf9101365
/src/main/java/cat/itb/projecte/controlador/ControladorEmpleats.java
c4c5b505295ff50e51bcaed734a04d43dc46d50e
[]
no_license
SergiMolinaItb/persitenciaStringSecurity
https://github.com/SergiMolinaItb/persitenciaStringSecurity
b281e2569786eb76d7ca8fc2f0407f1b85dce5f8
efa5a3f183c883044e1eebaa0e0431d55d0e7080
refs/heads/main
2023-04-17T19:09:30.078000
2021-05-11T10:26:04
2021-05-11T10:26:04
366,338,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cat.itb.projecte.controlador; import cat.itb.projecte.servei.EmpleatService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @Controller public class ControladorEmpleats { @Autowired private EmpleatService servei; @GetMapping("/empleats/listPerName") public String llistarPerNom(Model m){ m.addAttribute("llistaEmpleats",servei.llistatOrdenatPerNom()); return "llistat"; } @GetMapping("/empleats/list") public String llistar(Model m){ m.addAttribute("llistaEmpleats",servei.llistat()); return "llistat"; } @GetMapping("/empleats/new") public String afegirEmpleat(Model m){ m.addAttribute("empleatForm",new Empleat()); return "afegir"; } @GetMapping("/empleats/edit") public String afegirEmpleat(@RequestParam(value = "id",required = false) int id,@RequestParam(value = "nom",required = false) String nom,@RequestParam(value = "email",required = false) String email,@RequestParam(value = "telefon",required = false) String telefon,Model m){ Empleat nou = new Empleat(); nou.setId(id); nou.setNom(nom); nou.setEmail(email); nou.setTelefon(telefon); m.addAttribute("empleatForm",nou); m.addAttribute("id", id); m.addAttribute("nom",nom); m.addAttribute("email",email); m.addAttribute("telefon",telefon); return "afegir"; } @PostMapping("empleats/new/submit") public String afegirSubmit(@ModelAttribute("empleatForm") Empleat emp){ servei.afegir(emp); return "redirect:/empleats/list"; } @PostMapping("empleats/edit/submit") public String editSubmit(@ModelAttribute("empleatForm") Empleat emp){ servei.substituir(emp); return "redirect:/empleats/list"; } @GetMapping("empleats/eliminar") public String eliminarEmpleat(@RequestParam(value = "id",required = false) int id,Model m){ servei.eliminarPerId(id); return "redirect:/empleats/list"; } }
UTF-8
Java
2,376
java
ControladorEmpleats.java
Java
[]
null
[]
package cat.itb.projecte.controlador; import cat.itb.projecte.servei.EmpleatService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @Controller public class ControladorEmpleats { @Autowired private EmpleatService servei; @GetMapping("/empleats/listPerName") public String llistarPerNom(Model m){ m.addAttribute("llistaEmpleats",servei.llistatOrdenatPerNom()); return "llistat"; } @GetMapping("/empleats/list") public String llistar(Model m){ m.addAttribute("llistaEmpleats",servei.llistat()); return "llistat"; } @GetMapping("/empleats/new") public String afegirEmpleat(Model m){ m.addAttribute("empleatForm",new Empleat()); return "afegir"; } @GetMapping("/empleats/edit") public String afegirEmpleat(@RequestParam(value = "id",required = false) int id,@RequestParam(value = "nom",required = false) String nom,@RequestParam(value = "email",required = false) String email,@RequestParam(value = "telefon",required = false) String telefon,Model m){ Empleat nou = new Empleat(); nou.setId(id); nou.setNom(nom); nou.setEmail(email); nou.setTelefon(telefon); m.addAttribute("empleatForm",nou); m.addAttribute("id", id); m.addAttribute("nom",nom); m.addAttribute("email",email); m.addAttribute("telefon",telefon); return "afegir"; } @PostMapping("empleats/new/submit") public String afegirSubmit(@ModelAttribute("empleatForm") Empleat emp){ servei.afegir(emp); return "redirect:/empleats/list"; } @PostMapping("empleats/edit/submit") public String editSubmit(@ModelAttribute("empleatForm") Empleat emp){ servei.substituir(emp); return "redirect:/empleats/list"; } @GetMapping("empleats/eliminar") public String eliminarEmpleat(@RequestParam(value = "id",required = false) int id,Model m){ servei.eliminarPerId(id); return "redirect:/empleats/list"; } }
2,376
0.692761
0.692761
69
33.434784
36.791019
276
false
false
0
0
0
0
0
0
0.73913
false
false
1
cf8b7d4d241b67d23dd996c5eb5790ea466da9b0
11,501,922,431,888
dffd285c8d89b53adcd4016b4dc5f9cdd7dfa34f
/javademo/IdeaProjects/basic-code/day04-code/src/cn/itcast/day04/demo02/Date/Demo02Calendar.java
9307f860aecb2deccf211381d86635b2da1e97fc
[]
no_license
WhiteLie1/code_back
https://github.com/WhiteLie1/code_back
bbbe33d8ea22cb01f02856886e8a44fabc5d7df3
00f13356125e1c12ab3ca23954697507352cd5f0
refs/heads/master
2023-01-24T07:10:44.821000
2020-06-23T04:07:33
2020-06-23T04:07:33
210,386,317
0
0
null
false
2023-01-04T23:17:27
2019-09-23T15:12:31
2020-06-23T04:07:48
2023-01-04T23:17:26
25,049
0
0
22
Java
false
false
package cn.itcast.day04.demo02.Date; import java.util.Calendar; /* 日历类: 提供了许多的日历操作字段的方法 */ public class Demo02Calendar { public static void main(String[] args) { Calendar c = Calendar.getInstance(); // 多态 System.out.println(c); } }
UTF-8
Java
305
java
Demo02Calendar.java
Java
[]
null
[]
package cn.itcast.day04.demo02.Date; import java.util.Calendar; /* 日历类: 提供了许多的日历操作字段的方法 */ public class Demo02Calendar { public static void main(String[] args) { Calendar c = Calendar.getInstance(); // 多态 System.out.println(c); } }
305
0.653992
0.631179
14
17.785715
17.188778
50
false
false
0
0
0
0
0
0
0.285714
false
false
1
697d20206cf5e628860a601099deb0f5fedac113
24,524,263,271,358
77a500d3a65984ecb6de2ba39a30dd5db9fdcf97
/src/test/java/org/obolibrary/obo2owl/RoundTripEquivalentToChain.java
d620ef4ff0e6f08d1f04268bb0210deac633043f
[]
no_license
safrant/oboformat
https://github.com/safrant/oboformat
1d40610be7cf77764b2b49e1976fe59c55bea37a
fd6b200f8fd60fcb0a400026ee214290d15a461c
refs/heads/master
2016-09-12T23:44:23.403000
2016-05-12T16:32:17
2016-05-12T16:32:17
58,658,699
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.obolibrary.obo2owl; import org.junit.Test; public class RoundTripEquivalentToChain extends RoundTripTest { @Test public void testTrailingQualifiers() throws Exception { roundTripOBOFile("roundtrip_equivalent_to_chain.obo", true); } }
UTF-8
Java
254
java
RoundTripEquivalentToChain.java
Java
[]
null
[]
package org.obolibrary.obo2owl; import org.junit.Test; public class RoundTripEquivalentToChain extends RoundTripTest { @Test public void testTrailingQualifiers() throws Exception { roundTripOBOFile("roundtrip_equivalent_to_chain.obo", true); } }
254
0.795276
0.791339
11
22.09091
25.346523
63
false
false
0
0
0
0
0
0
0.818182
false
false
1
724dc6279e18871e973bffe25862cb94221dd65d
27,092,653,714,634
8e01b6184ed4b3de5b3808de43749745e02466cb
/app/src/main/java/com/example/kushwah_1/a1/ChatFragment.java
9cc4da19a442890ce8c9d80c3db9c16af528f6b2
[]
no_license
manvendrakushwah/MultiTenantChatApp
https://github.com/manvendrakushwah/MultiTenantChatApp
8f2a34e6866eae06cba90b5dcdd32c8778aa2920
c64593e084e661002e81d4171d58a63b73408398
refs/heads/master
2020-04-08T09:27:36.958000
2018-12-12T16:22:29
2018-12-12T16:22:29
159,224,991
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.kushwah_1.a1; import android.content.Context; import android.os.Bundle; import android.os.SystemClock; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Random; public class ChatFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_chat, container, false); } @Override public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final ArrayList<MessageClass> list=new ArrayList<>(); final FirebaseDatabase database = FirebaseDatabase.getInstance(); final String uid =FirebaseAuth.getInstance().getCurrentUser().getUid().toString(); final String currentUser=FirebaseAuth.getInstance().getCurrentUser().getDisplayName().toString(); final DatabaseReference myref = database.getReference().child("messages/" + uid ); final DatabaseReference myref2=database.getReference().child("messages"); // MessageClass data=new MessageClass("11/11/2018","gviw uh","Subject","this is text","11:02:13","ckIhSc7XH3OnstlLO2j60N1BHvj1" ); // list.add(data); // list.add(data); // list.add(data); //myref.push().setValue(); myref2.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { Log.e("Countless",""+dataSnapshot.getChildrenCount()); final Map<String,Boolean> hashMap= new HashMap<String,Boolean>(); //MessageClass data=new MessageClass("11/11/2018","gviw uh","Subject","this is text","11:02:13","ckIhSc7XH3OnstlLO2j60N1BHvj1" ); // list.add(data); list.clear(); for(DataSnapshot snapshot :dataSnapshot.getChildren()){ for(DataSnapshot dataSnapshot1: snapshot.getChildren()){ //list.add(data); Log.e("xyx",dataSnapshot1.child("sender").toString()); if(dataSnapshot1.hasChild("sender") && dataSnapshot1.child("sender").getValue().toString().equals(currentUser)){ Log.e("xxxx","xxxx"); final String subject= (dataSnapshot1.child("subject").getValue()!=null)?dataSnapshot1.child("subject").getValue().toString():"(Empty Message)"; final String Date= (dataSnapshot1.child("Date").getValue()!=null)?(dataSnapshot1.child("Date").getValue().toString()):"(Invalid Date)"; final String time= (dataSnapshot1.child("time").getValue()!=null)?(dataSnapshot1.child("time").getValue().toString()):"(Invalid time)"; final String text= (dataSnapshot1.child("text").getValue()!=null)?(dataSnapshot1.child("text").getValue().toString()):"(Invalid time)"; final String sender= (dataSnapshot1.child("sender").getValue()!=null)?(dataSnapshot1.child("sender").getValue().toString()):("(Invalid sender)"); final String senderUid=(dataSnapshot1.child("senderUid").getValue()!=null)?(dataSnapshot1.child("senderUid").getValue().toString()):("Invalid User"); final String key=snapshot.getKey().toString(); DatabaseReference dbrf=FirebaseDatabase.getInstance().getReference("users/"+key); dbrf.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()){ if(dataSnapshot1.getKey().equals("username")){ Log.e("ccc",dataSnapshot1.getValue().toString()); if(hashMap.get(dataSnapshot1.getValue().toString())==null ){ MessageClass snap=new MessageClass(Date,dataSnapshot1.getValue().toString(),subject,text,time,key); list.add(snap); } hashMap.put(dataSnapshot1.getValue().toString(),Boolean.TRUE); } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } } } myref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { MessageClass data=new MessageClass("11/11/2018","gviw uh","Subject","this is text","11:02:13","ckIhSc7XH3OnstlLO2j60N1BHvj1" ); // list.add(data); for(DataSnapshot dataSnapshot1:dataSnapshot.getChildren()){ // MessageClass snap= snapshot.getValue(MessageClass.class); String subject= (dataSnapshot1.child("subject").getValue()!=null)?dataSnapshot1.child("subject").getValue().toString():"(Empty Message)"; String Date= (dataSnapshot1.child("Date").getValue()!=null)?(dataSnapshot1.child("Date").getValue().toString()):"(Invalid Date)"; String time= (dataSnapshot1.child("time").getValue()!=null)?(dataSnapshot1.child("time").getValue().toString()):"(Invalid time)"; String text= (dataSnapshot1.child("text").getValue()!=null)?(dataSnapshot1.child("text").getValue().toString()):"(Invalid time)"; String sender= (dataSnapshot1.child("sender").getValue()!=null)?(dataSnapshot1.child("sender").getValue().toString()):("(Invalid sender)"); String senderUid=(dataSnapshot1.child("senderUid").getValue()!=null)?(dataSnapshot1.child("senderUid").getValue().toString()):("Invalid User"); MessageClass snap=new MessageClass(Date,sender,subject,text,time,senderUid); if(hashMap.get(sender)==null ){ list.add(snap); } hashMap.put(sender,Boolean.TRUE); Log.e("Get data",snap.getSubject()); } RecyclerView recyclerView =view.findViewById(R.id.chat_recycler); Context context= getContext(); recyclerView.setLayoutManager(new GridLayoutManager(context,1)); MessageAdapter messageAdapter =new MessageAdapter(list); recyclerView.setAdapter(messageAdapter); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("Manv","error in loading", databaseError.toException()); } }); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("Manv","error in loading", databaseError.toException()); } }); } }
UTF-8
Java
8,537
java
ChatFragment.java
Java
[ { "context": "package com.example.kushwah_1.a1;\n\nimport android.content.Context;\nimport andro", "end": 29, "score": 0.9354715943336487, "start": 20, "tag": "USERNAME", "value": "kushwah_1" }, { "context": " if(dataSnapshot1.getKey().equals(\"username\")){\n L", "end": 4763, "score": 0.9963104724884033, "start": 4755, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.example.kushwah_1.a1; import android.content.Context; import android.os.Bundle; import android.os.SystemClock; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Random; public class ChatFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_chat, container, false); } @Override public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final ArrayList<MessageClass> list=new ArrayList<>(); final FirebaseDatabase database = FirebaseDatabase.getInstance(); final String uid =FirebaseAuth.getInstance().getCurrentUser().getUid().toString(); final String currentUser=FirebaseAuth.getInstance().getCurrentUser().getDisplayName().toString(); final DatabaseReference myref = database.getReference().child("messages/" + uid ); final DatabaseReference myref2=database.getReference().child("messages"); // MessageClass data=new MessageClass("11/11/2018","gviw uh","Subject","this is text","11:02:13","ckIhSc7XH3OnstlLO2j60N1BHvj1" ); // list.add(data); // list.add(data); // list.add(data); //myref.push().setValue(); myref2.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { Log.e("Countless",""+dataSnapshot.getChildrenCount()); final Map<String,Boolean> hashMap= new HashMap<String,Boolean>(); //MessageClass data=new MessageClass("11/11/2018","gviw uh","Subject","this is text","11:02:13","ckIhSc7XH3OnstlLO2j60N1BHvj1" ); // list.add(data); list.clear(); for(DataSnapshot snapshot :dataSnapshot.getChildren()){ for(DataSnapshot dataSnapshot1: snapshot.getChildren()){ //list.add(data); Log.e("xyx",dataSnapshot1.child("sender").toString()); if(dataSnapshot1.hasChild("sender") && dataSnapshot1.child("sender").getValue().toString().equals(currentUser)){ Log.e("xxxx","xxxx"); final String subject= (dataSnapshot1.child("subject").getValue()!=null)?dataSnapshot1.child("subject").getValue().toString():"(Empty Message)"; final String Date= (dataSnapshot1.child("Date").getValue()!=null)?(dataSnapshot1.child("Date").getValue().toString()):"(Invalid Date)"; final String time= (dataSnapshot1.child("time").getValue()!=null)?(dataSnapshot1.child("time").getValue().toString()):"(Invalid time)"; final String text= (dataSnapshot1.child("text").getValue()!=null)?(dataSnapshot1.child("text").getValue().toString()):"(Invalid time)"; final String sender= (dataSnapshot1.child("sender").getValue()!=null)?(dataSnapshot1.child("sender").getValue().toString()):("(Invalid sender)"); final String senderUid=(dataSnapshot1.child("senderUid").getValue()!=null)?(dataSnapshot1.child("senderUid").getValue().toString()):("Invalid User"); final String key=snapshot.getKey().toString(); DatabaseReference dbrf=FirebaseDatabase.getInstance().getReference("users/"+key); dbrf.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()){ if(dataSnapshot1.getKey().equals("username")){ Log.e("ccc",dataSnapshot1.getValue().toString()); if(hashMap.get(dataSnapshot1.getValue().toString())==null ){ MessageClass snap=new MessageClass(Date,dataSnapshot1.getValue().toString(),subject,text,time,key); list.add(snap); } hashMap.put(dataSnapshot1.getValue().toString(),Boolean.TRUE); } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } } } myref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { MessageClass data=new MessageClass("11/11/2018","gviw uh","Subject","this is text","11:02:13","ckIhSc7XH3OnstlLO2j60N1BHvj1" ); // list.add(data); for(DataSnapshot dataSnapshot1:dataSnapshot.getChildren()){ // MessageClass snap= snapshot.getValue(MessageClass.class); String subject= (dataSnapshot1.child("subject").getValue()!=null)?dataSnapshot1.child("subject").getValue().toString():"(Empty Message)"; String Date= (dataSnapshot1.child("Date").getValue()!=null)?(dataSnapshot1.child("Date").getValue().toString()):"(Invalid Date)"; String time= (dataSnapshot1.child("time").getValue()!=null)?(dataSnapshot1.child("time").getValue().toString()):"(Invalid time)"; String text= (dataSnapshot1.child("text").getValue()!=null)?(dataSnapshot1.child("text").getValue().toString()):"(Invalid time)"; String sender= (dataSnapshot1.child("sender").getValue()!=null)?(dataSnapshot1.child("sender").getValue().toString()):("(Invalid sender)"); String senderUid=(dataSnapshot1.child("senderUid").getValue()!=null)?(dataSnapshot1.child("senderUid").getValue().toString()):("Invalid User"); MessageClass snap=new MessageClass(Date,sender,subject,text,time,senderUid); if(hashMap.get(sender)==null ){ list.add(snap); } hashMap.put(sender,Boolean.TRUE); Log.e("Get data",snap.getSubject()); } RecyclerView recyclerView =view.findViewById(R.id.chat_recycler); Context context= getContext(); recyclerView.setLayoutManager(new GridLayoutManager(context,1)); MessageAdapter messageAdapter =new MessageAdapter(list); recyclerView.setAdapter(messageAdapter); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("Manv","error in loading", databaseError.toException()); } }); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("Manv","error in loading", databaseError.toException()); } }); } }
8,537
0.575612
0.563196
166
50.433735
48.632923
176
false
false
0
0
0
0
0
0
0.759036
false
false
1
d76d063ec49fa26daf498ab341032901f3c1bea5
13,786,845,024,807
8beeec9a16e3f7941cda8001715926adb6134634
/src/main/java/com/quizdeck/controllers/QuizRequestController.java
399a164df25d32bf3ac9514bdc14925eb18df62a
[ "MIT" ]
permissive
bcroden/QuizDeck-Server
https://github.com/bcroden/QuizDeck-Server
1347e69dcf6ba7e37e55752481827523097e2b73
b7eb83c9d3998188f72375ebc69617497ef188d3
refs/heads/master
2021-01-10T13:25:20.370000
2016-05-03T06:27:50
2016-05-03T06:27:50
49,986,645
0
1
null
false
2016-05-03T06:27:51
2016-01-19T22:08:59
2016-02-02T22:51:19
2016-05-03T06:27:50
454
0
1
5
Java
null
null
package com.quizdeck.controllers; import com.quizdeck.exceptions.ForbiddenAccessException; import com.quizdeck.exceptions.InvalidJsonException; import com.quizdeck.model.database.Quiz; import com.quizdeck.model.inputs.NewQuizInput; import com.quizdeck.repositories.QuizRepository; import com.quizdeck.repositories.UserRepository; import io.jsonwebtoken.Claims; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; /** * Created by Cade on 2/27/2016. * Return a users requested quiz or quizzes */ @RestController @RequestMapping("/rest/secure/quiz") public class QuizRequestController { @Autowired QuizRepository quizRepository; @Autowired UserRepository userRepository; @RequestMapping(value="/searchBySelf", method = RequestMethod.GET) public List<Quiz> getQuizBySelf(@ModelAttribute("claims") Claims claims){ return quizRepository.findByOwner(claims.get("user").toString()); } @RequestMapping(value="/searchById/{quizId}", method=RequestMethod.GET) public Quiz getQuizById(@PathVariable String quizId){ return quizRepository.findById(quizId); } @RequestMapping(value="/quizEdit", method = RequestMethod.PUT) public ResponseEntity<String> quizLabelsUpdate(@Valid @RequestBody Quiz input, BindingResult result) throws InvalidJsonException { if(result.hasErrors()){ throw new InvalidJsonException(); } //blanket update for the quiz that was previously saved quizRepository.save(input); return new ResponseEntity<String>(HttpStatus.OK); } @RequestMapping(value="/quizDelete/{quizId}", method = RequestMethod.DELETE) public ResponseEntity<String> quizDelete(@ModelAttribute("claims") Claims claims, @PathVariable String quizId) throws ForbiddenAccessException{ if(!quizRepository.findById(quizId).getOwner().equals(claims.get("user"))) { throw new ForbiddenAccessException(); } quizRepository.removeById(quizId); return new ResponseEntity<String>(HttpStatus.OK); } @RequestMapping(value="/quizsubmission", method= RequestMethod.POST) public ResponseEntity<String> quizSubmissionResponse(@Valid @RequestBody NewQuizInput input, BindingResult result) throws InvalidJsonException{ if(result.hasErrors()) { throw new InvalidJsonException(); } quizRepository.save(new Quiz(input.getOwner(), input.getTitle(), input.getQuestions(), input.getLabels(), input.getCategories(), input.isPublicAvailable())); return new ResponseEntity<String>(HttpStatus.OK); } }
UTF-8
Java
2,847
java
QuizRequestController.java
Java
[ { "context": "n.Valid;\nimport java.util.List;\n\n/**\n * Created by Cade on 2/27/2016.\n * Return a users requested quiz or", "end": 698, "score": 0.9978675842285156, "start": 694, "tag": "NAME", "value": "Cade" } ]
null
[]
package com.quizdeck.controllers; import com.quizdeck.exceptions.ForbiddenAccessException; import com.quizdeck.exceptions.InvalidJsonException; import com.quizdeck.model.database.Quiz; import com.quizdeck.model.inputs.NewQuizInput; import com.quizdeck.repositories.QuizRepository; import com.quizdeck.repositories.UserRepository; import io.jsonwebtoken.Claims; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; /** * Created by Cade on 2/27/2016. * Return a users requested quiz or quizzes */ @RestController @RequestMapping("/rest/secure/quiz") public class QuizRequestController { @Autowired QuizRepository quizRepository; @Autowired UserRepository userRepository; @RequestMapping(value="/searchBySelf", method = RequestMethod.GET) public List<Quiz> getQuizBySelf(@ModelAttribute("claims") Claims claims){ return quizRepository.findByOwner(claims.get("user").toString()); } @RequestMapping(value="/searchById/{quizId}", method=RequestMethod.GET) public Quiz getQuizById(@PathVariable String quizId){ return quizRepository.findById(quizId); } @RequestMapping(value="/quizEdit", method = RequestMethod.PUT) public ResponseEntity<String> quizLabelsUpdate(@Valid @RequestBody Quiz input, BindingResult result) throws InvalidJsonException { if(result.hasErrors()){ throw new InvalidJsonException(); } //blanket update for the quiz that was previously saved quizRepository.save(input); return new ResponseEntity<String>(HttpStatus.OK); } @RequestMapping(value="/quizDelete/{quizId}", method = RequestMethod.DELETE) public ResponseEntity<String> quizDelete(@ModelAttribute("claims") Claims claims, @PathVariable String quizId) throws ForbiddenAccessException{ if(!quizRepository.findById(quizId).getOwner().equals(claims.get("user"))) { throw new ForbiddenAccessException(); } quizRepository.removeById(quizId); return new ResponseEntity<String>(HttpStatus.OK); } @RequestMapping(value="/quizsubmission", method= RequestMethod.POST) public ResponseEntity<String> quizSubmissionResponse(@Valid @RequestBody NewQuizInput input, BindingResult result) throws InvalidJsonException{ if(result.hasErrors()) { throw new InvalidJsonException(); } quizRepository.save(new Quiz(input.getOwner(), input.getTitle(), input.getQuestions(), input.getLabels(), input.getCategories(), input.isPublicAvailable())); return new ResponseEntity<String>(HttpStatus.OK); } }
2,847
0.748507
0.746048
75
36.959999
37.410671
165
false
false
0
0
0
0
0
0
0.546667
false
false
1
75492697c69f20d10aae95a8dbc80f2116edeb01
24,472,723,658,798
d18b1e2a2719f009bb3177db3859c4e3f9a36152
/android/app/src/main/java/com/example/C_7_2_2/CustomJavaModule.java
fcf9203fd40bc9dd66bfab5e84bb1061c82aa004
[]
no_license
LeFE-1/react-native-explorer
https://github.com/LeFE-1/react-native-explorer
d8c0a0650f65465ae61367aa16db02c6ea3e6b76
5d7b42391509496d286746498ff7424b3d160cf0
refs/heads/master
2023-08-14T13:53:07.916000
2021-10-06T09:31:48
2021-10-06T09:31:48
401,520,140
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.C_7_2_2; import android.widget.Toast; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import javax.annotation.Nonnull; /** * Created by yangpan * on 2020-03-09 */ public class CustomJavaModule extends ReactContextBaseJavaModule { public CustomJavaModule(@Nonnull ReactApplicationContext reactContext) { super(reactContext); } @Nonnull @Override public String getName() { return "CustomJavaModule"; } @ReactMethod public void handleJSReturnValue(String returnValue) { if (getCurrentActivity() == null) return; getCurrentActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getReactApplicationContext(), returnValue, Toast.LENGTH_SHORT).show(); } }); } }
UTF-8
Java
963
java
CustomJavaModule.java
Java
[ { "context": "mport javax.annotation.Nonnull;\n\n/**\n * Created by yangpan\n * on 2020-03-09\n */\npublic class CustomJavaModul", "end": 285, "score": 0.9996116161346436, "start": 278, "tag": "USERNAME", "value": "yangpan" } ]
null
[]
package com.example.C_7_2_2; import android.widget.Toast; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import javax.annotation.Nonnull; /** * Created by yangpan * on 2020-03-09 */ public class CustomJavaModule extends ReactContextBaseJavaModule { public CustomJavaModule(@Nonnull ReactApplicationContext reactContext) { super(reactContext); } @Nonnull @Override public String getName() { return "CustomJavaModule"; } @ReactMethod public void handleJSReturnValue(String returnValue) { if (getCurrentActivity() == null) return; getCurrentActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getReactApplicationContext(), returnValue, Toast.LENGTH_SHORT).show(); } }); } }
963
0.685358
0.673936
38
24.342106
25.259991
101
false
false
0
0
0
0
0
0
0.342105
false
false
1
3e2aadb30708517c504d4f45f0b2b12df7405606
33,672,543,612,010
fed60b848f415c8207514e4250c85c254dadb337
/pbg-poc/People-portlet/docroot/WEB-INF/src/com/componence/bean/search/PortletPreferencesBackingBean.java
b960380cbef911c3619924fc838903f62f4b64e2
[]
no_license
kantila/LGR
https://github.com/kantila/LGR
eccd046c5300f8228871edfa44982ea5264f47c0
6682d53f0c234a43e5df2e74707770f86c888ae4
refs/heads/master
2016-09-05T10:44:31.534000
2011-12-14T08:46:06
2011-12-14T08:46:06
2,978,145
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.componence.bean.search; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequest; import javax.portlet.ReadOnlyException; import javax.portlet.ValidatorException; import org.apache.log4j.Logger; import com.componence.util.Constants; /** * This is a JSF backing managed-bean that has an valueChange-listener for * saving portlet preferences. * * @author Nikhil Nishchal * */ @ManagedBean(name = "portletPreferencesBackingBean") @RequestScoped public class PortletPreferencesBackingBean { /** * private value for selected option. */ private String selectedOption = null; private static final Logger LOGGER = Logger.getLogger(PortletPreferencesBackingBean.class); public String getSelectedOption() { return selectedOption; } public void setSelectedOption(String selectedOption) { this.selectedOption = selectedOption; } /** * Get the portlet preference. * * @return PortletPreferences */ public PortletPreferences getPortletPrefs() { LOGGER.debug("People Search :Getting portlet prefences."); FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); PortletRequest pReq = (PortletRequest) ec.getRequest(); PortletPreferences prefs = pReq.getPreferences(); return prefs; } /** * On change of selection it set value in portlet preference. * * @param event */ public void changeOption(ValueChangeEvent event) { try { getPortletPrefs().setValue("selectedOption", event.getNewValue().toString()); getPortletPrefs().store(); LOGGER.debug("People Search :Portlet prefences changed."); } catch (ReadOnlyException exp) { LOGGER.error("People Search :ReadOnly Exception while changing preferences", exp); } catch (ValidatorException exp) { LOGGER.error("People Search :Validation Exception while changing preferences", exp); } catch (IOException exp) { LOGGER.error("People Search :IO Exception while changing preferences", exp); } } /** * Get the list of preferences to select from. */ public List<SelectItem> getOptions() { List<SelectItem> serviceList = new ArrayList<SelectItem>(); serviceList.add(new SelectItem(Constants.NETFLIX)); serviceList.add(new SelectItem(Constants.WEBSERVICE)); return serviceList; } }
UTF-8
Java
2,702
java
PortletPreferencesBackingBean.java
Java
[ { "context": "r\r\n * saving portlet preferences.\r\n * \r\n * @author Nikhil Nishchal\r\n * \r\n */\r\n@ManagedBean(name = \"portletPreference", "end": 755, "score": 0.9998056292533875, "start": 740, "tag": "NAME", "value": "Nikhil Nishchal" } ]
null
[]
package com.componence.bean.search; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequest; import javax.portlet.ReadOnlyException; import javax.portlet.ValidatorException; import org.apache.log4j.Logger; import com.componence.util.Constants; /** * This is a JSF backing managed-bean that has an valueChange-listener for * saving portlet preferences. * * @author <NAME> * */ @ManagedBean(name = "portletPreferencesBackingBean") @RequestScoped public class PortletPreferencesBackingBean { /** * private value for selected option. */ private String selectedOption = null; private static final Logger LOGGER = Logger.getLogger(PortletPreferencesBackingBean.class); public String getSelectedOption() { return selectedOption; } public void setSelectedOption(String selectedOption) { this.selectedOption = selectedOption; } /** * Get the portlet preference. * * @return PortletPreferences */ public PortletPreferences getPortletPrefs() { LOGGER.debug("People Search :Getting portlet prefences."); FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); PortletRequest pReq = (PortletRequest) ec.getRequest(); PortletPreferences prefs = pReq.getPreferences(); return prefs; } /** * On change of selection it set value in portlet preference. * * @param event */ public void changeOption(ValueChangeEvent event) { try { getPortletPrefs().setValue("selectedOption", event.getNewValue().toString()); getPortletPrefs().store(); LOGGER.debug("People Search :Portlet prefences changed."); } catch (ReadOnlyException exp) { LOGGER.error("People Search :ReadOnly Exception while changing preferences", exp); } catch (ValidatorException exp) { LOGGER.error("People Search :Validation Exception while changing preferences", exp); } catch (IOException exp) { LOGGER.error("People Search :IO Exception while changing preferences", exp); } } /** * Get the list of preferences to select from. */ public List<SelectItem> getOptions() { List<SelectItem> serviceList = new ArrayList<SelectItem>(); serviceList.add(new SelectItem(Constants.NETFLIX)); serviceList.add(new SelectItem(Constants.WEBSERVICE)); return serviceList; } }
2,693
0.735751
0.735381
90
28.022223
24.652689
92
false
false
0
0
0
0
0
0
1.333333
false
false
1
58a31afb58247512fbec30e94275355c86226348
5,566,277,617,217
1cf215072bc1f50cedc0467e85489b6570e40acf
/EurekaFeign/src/main/java/com/zp/feign/controller/HiController.java
c9be4ec3816c8a3878de6d19b4cd5840b67976ff
[]
no_license
954480192/cloudDemo
https://github.com/954480192/cloudDemo
98510de5f24cda7421609079b37be74c5d08eff5
bea355a7f914b631e02575b50f34c344b4b1f156
refs/heads/master
2022-07-31T07:51:34.183000
2020-07-21T10:29:15
2020-07-21T10:29:15
173,656,811
0
0
null
false
2022-06-29T18:15:49
2019-03-04T02:05:20
2020-07-21T10:29:36
2022-06-29T18:15:49
309
0
0
4
Java
false
false
package com.zp.feign.controller; import com.zp.feign.config.SchedualServiceHi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; @RestController public class HiController { @Autowired SchedualServiceHi schedualServiceHi; @Value("${spring.application.name}") String appName; @GetMapping("/hi") public String sayHi(@RequestParam String name){ return schedualServiceHi.sayHiFromClientOne(name+appName); } @GetMapping("/") public String index(){ return "hello"; } }
UTF-8
Java
645
java
HiController.java
Java
[]
null
[]
package com.zp.feign.controller; import com.zp.feign.config.SchedualServiceHi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; @RestController public class HiController { @Autowired SchedualServiceHi schedualServiceHi; @Value("${spring.application.name}") String appName; @GetMapping("/hi") public String sayHi(@RequestParam String name){ return schedualServiceHi.sayHiFromClientOne(name+appName); } @GetMapping("/") public String index(){ return "hello"; } }
645
0.733333
0.733333
25
24.799999
21.061813
66
false
false
0
0
0
0
0
0
0.36
false
false
1
e37d724bf7f6af3733cc1970395977989f406f30
22,488,448,786,255
9929a5f270c580cd60494dfe96be8c64e0fda04f
/Java/ImgIdenfy.java
4b1357c05a3ba7c1ea41147ee9f8af5b7c4a205f
[ "MIT" ]
permissive
hxq7426/SWVerifyCode
https://github.com/hxq7426/SWVerifyCode
2bcfe900b989b817b209dcb78024dfc2437737fb
f589b341b92431be3f5356d2d2d586769377185f
refs/heads/master
2023-04-29T18:33:22.441000
2021-05-13T10:16:52
2021-05-13T10:16:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sw; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.URL; import java.util.Map; /** * @Author Czy * @Date 20/02/17 * @detail 验证码识别 */ public class ImgIdenfy { private int height = 22; private int width = 62; private int rgbThres = 150; public int[][] binaryImg(BufferedImage img) { int[][] imgArr = new int[this.height][this.width]; for (int x = 0; x < this.width; ++x) { for (int y = 0; y < this.height; ++y) { if (x == 0 || y == 0 || x == this.width - 1 || y == this.height - 1) { imgArr[y][x] = 1; continue; } int pixel = img.getRGB(x, y); if (((pixel & 0xff0000) >> 16) < this.rgbThres && ((pixel & 0xff00) >> 8) < this.rgbThres && (pixel & 0xff) < this.rgbThres) { imgArr[y][x] = 0; } else { imgArr[y][x] = 1; } } } return imgArr; } // 去掉干扰线 public void removeByLine(int[][] imgArr) { for (int y = 1; y < this.height - 1; ++y) { for (int x = 1; x < this.width - 1; ++x) { if (imgArr[y][x] == 0) { int count = imgArr[y][x - 1] + imgArr[y][x + 1] + imgArr[y + 1][x] + imgArr[y - 1][x]; if (count > 2) imgArr[y][x] = 1; } } } } // 裁剪 public int[][][] imgCut(int[][] imgArr, int[][] xCut, int[][] yCut, int num) { int[][][] imgArrArr = new int[num][yCut[0][1] - yCut[0][0]][xCut[0][1] - xCut[0][0]]; for (int i = 0; i < num; ++i) { for (int j = yCut[i][0]; j < yCut[i][1]; ++j) { for (int k = xCut[i][0]; k < xCut[i][1]; ++k) { imgArrArr[i][j-yCut[i][0]][k-xCut[i][0]] = imgArr[j][k]; } } } return imgArrArr; } // 转字符串 public String getString(int[][] imgArr){ StringBuilder s = new StringBuilder(); int unitHeight = imgArr.length; int unitWidth = imgArr[0].length; for (int y = 0; y < unitHeight; ++y) { for (int x = 0; x < unitWidth; ++x) { s.append(imgArr[y][x]); } } return s.toString(); } // 相同大小直接对比 private int comparedText(String s1,String s2){ int n = s1.length(); int percent = 0; for(int i = 0; i < n ; ++i) { if (s1.charAt(i) == s2.charAt(i)) percent++; } return percent; } /** * 匹配识别 * @param imgArrArr * @return */ public String matchCode(int [][][] imgArrArr){ StringBuilder s = new StringBuilder(); Map<String,String> charMap = CharMap.getCharMap(); for (int[][] imgArr : imgArrArr){ int maxMatch = 0; String tempRecord = ""; for(Map.Entry<String,String> m : charMap.entrySet()){ int percent = this.comparedText(this.getString(imgArr),m.getValue()); if(percent > maxMatch){ maxMatch = percent; tempRecord = m.getKey(); } } s.append(tempRecord); } return s.toString(); } // 写入硬盘 public void writeImage(BufferedImage sourceImg) { File imageFile = new File("v.jpg"); try (FileOutputStream outStream = new FileOutputStream(imageFile)) { ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(sourceImg, "jpg", out); byte[] data = out.toByteArray(); outStream.write(data); } catch (Exception e) { System.out.println(e.toString()); } } // 控制台打印 public void showImg(int[][] imgArr) { int unitHeight = imgArr.length; int unitWidth = imgArr[0].length; for (int y = 0; y < unitHeight; ++y) { for (int x = 0; x < unitWidth; ++x) { System.out.print(imgArr[y][x]); } System.out.println(); } } public static void main(String[] args) { ImgIdenfy imgIdenfy = new ImgIdenfy(); try (InputStream is = new URL("http://xxxxxxxxxxxxxxx/verifycode.servlet").openStream()) { BufferedImage sourceImg = ImageIO.read(is); imgIdenfy.writeImage(sourceImg); // 图片写入硬盘 int[][] imgArr = imgIdenfy.binaryImg(sourceImg); // 二值化 imgIdenfy.removeByLine(imgArr); // 去除干扰先 引用传递 int[][][] imgArrArr = imgIdenfy.imgCut(imgArr, new int[][]{new int[]{4, 13}, new int[]{14, 23}, new int[]{24, 33}, new int[]{34, 43}}, new int[][]{new int[]{4, 16}, new int[]{4, 16}, new int[]{4, 16}, new int[]{4, 16}}, 4); System.out.println(imgIdenfy.matchCode(imgArrArr)); // 识别 // imgIdenfy.showImg(imgArr); //控制台打印图片 // imgIdenfy.showImg(imgArrArr[0]); //控制台打印图片 // System.out.println(imgIdenfy.getString(imgArrArr[0])); } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
5,476
java
ImgIdenfy.java
Java
[ { "context": "ava.net.URL;\nimport java.util.Map;\n\n/**\n * @Author Czy\n * @Date 20/02/17\n * @detail 验证码识别\n */\n\npublic cl", "end": 267, "score": 0.9996802806854248, "start": 264, "tag": "USERNAME", "value": "Czy" } ]
null
[]
package com.sw; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.URL; import java.util.Map; /** * @Author Czy * @Date 20/02/17 * @detail 验证码识别 */ public class ImgIdenfy { private int height = 22; private int width = 62; private int rgbThres = 150; public int[][] binaryImg(BufferedImage img) { int[][] imgArr = new int[this.height][this.width]; for (int x = 0; x < this.width; ++x) { for (int y = 0; y < this.height; ++y) { if (x == 0 || y == 0 || x == this.width - 1 || y == this.height - 1) { imgArr[y][x] = 1; continue; } int pixel = img.getRGB(x, y); if (((pixel & 0xff0000) >> 16) < this.rgbThres && ((pixel & 0xff00) >> 8) < this.rgbThres && (pixel & 0xff) < this.rgbThres) { imgArr[y][x] = 0; } else { imgArr[y][x] = 1; } } } return imgArr; } // 去掉干扰线 public void removeByLine(int[][] imgArr) { for (int y = 1; y < this.height - 1; ++y) { for (int x = 1; x < this.width - 1; ++x) { if (imgArr[y][x] == 0) { int count = imgArr[y][x - 1] + imgArr[y][x + 1] + imgArr[y + 1][x] + imgArr[y - 1][x]; if (count > 2) imgArr[y][x] = 1; } } } } // 裁剪 public int[][][] imgCut(int[][] imgArr, int[][] xCut, int[][] yCut, int num) { int[][][] imgArrArr = new int[num][yCut[0][1] - yCut[0][0]][xCut[0][1] - xCut[0][0]]; for (int i = 0; i < num; ++i) { for (int j = yCut[i][0]; j < yCut[i][1]; ++j) { for (int k = xCut[i][0]; k < xCut[i][1]; ++k) { imgArrArr[i][j-yCut[i][0]][k-xCut[i][0]] = imgArr[j][k]; } } } return imgArrArr; } // 转字符串 public String getString(int[][] imgArr){ StringBuilder s = new StringBuilder(); int unitHeight = imgArr.length; int unitWidth = imgArr[0].length; for (int y = 0; y < unitHeight; ++y) { for (int x = 0; x < unitWidth; ++x) { s.append(imgArr[y][x]); } } return s.toString(); } // 相同大小直接对比 private int comparedText(String s1,String s2){ int n = s1.length(); int percent = 0; for(int i = 0; i < n ; ++i) { if (s1.charAt(i) == s2.charAt(i)) percent++; } return percent; } /** * 匹配识别 * @param imgArrArr * @return */ public String matchCode(int [][][] imgArrArr){ StringBuilder s = new StringBuilder(); Map<String,String> charMap = CharMap.getCharMap(); for (int[][] imgArr : imgArrArr){ int maxMatch = 0; String tempRecord = ""; for(Map.Entry<String,String> m : charMap.entrySet()){ int percent = this.comparedText(this.getString(imgArr),m.getValue()); if(percent > maxMatch){ maxMatch = percent; tempRecord = m.getKey(); } } s.append(tempRecord); } return s.toString(); } // 写入硬盘 public void writeImage(BufferedImage sourceImg) { File imageFile = new File("v.jpg"); try (FileOutputStream outStream = new FileOutputStream(imageFile)) { ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(sourceImg, "jpg", out); byte[] data = out.toByteArray(); outStream.write(data); } catch (Exception e) { System.out.println(e.toString()); } } // 控制台打印 public void showImg(int[][] imgArr) { int unitHeight = imgArr.length; int unitWidth = imgArr[0].length; for (int y = 0; y < unitHeight; ++y) { for (int x = 0; x < unitWidth; ++x) { System.out.print(imgArr[y][x]); } System.out.println(); } } public static void main(String[] args) { ImgIdenfy imgIdenfy = new ImgIdenfy(); try (InputStream is = new URL("http://xxxxxxxxxxxxxxx/verifycode.servlet").openStream()) { BufferedImage sourceImg = ImageIO.read(is); imgIdenfy.writeImage(sourceImg); // 图片写入硬盘 int[][] imgArr = imgIdenfy.binaryImg(sourceImg); // 二值化 imgIdenfy.removeByLine(imgArr); // 去除干扰先 引用传递 int[][][] imgArrArr = imgIdenfy.imgCut(imgArr, new int[][]{new int[]{4, 13}, new int[]{14, 23}, new int[]{24, 33}, new int[]{34, 43}}, new int[][]{new int[]{4, 16}, new int[]{4, 16}, new int[]{4, 16}, new int[]{4, 16}}, 4); System.out.println(imgIdenfy.matchCode(imgArrArr)); // 识别 // imgIdenfy.showImg(imgArr); //控制台打印图片 // imgIdenfy.showImg(imgArrArr[0]); //控制台打印图片 // System.out.println(imgIdenfy.getString(imgArrArr[0])); } catch (Exception e) { e.printStackTrace(); } } }
5,476
0.486502
0.467004
162
31.919754
26.104723
142
false
false
0
0
0
0
0
0
0.740741
false
false
1
84b149b26d079670f0601c49eb711b0d24ba2f96
30,107,720,746,211
8466dc151f30a33c231803371f1b87e208c4db8f
/src/interface_example/Interface_Example.java
f3053696f7248abcadd54110dc2a87aece2d3ffd
[]
no_license
VinothVinodhan/seldemo
https://github.com/VinothVinodhan/seldemo
f9e29d27b48180f92763cdbf68b3b3fd76a07523
01ed3f59681683489447a5fa7aaa31690ae94844
refs/heads/master
2022-04-23T06:00:39.112000
2020-04-16T13:57:13
2020-04-16T13:57:13
256,229,379
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package interface_example; public interface Interface_Example { /** * The Java compiler adds public and abstract keywords before the interface * method. * public abstract void interfaceMethod(); */ void interfaceMethod(); // It adds public, static and final keywords before data members. // public static final int a = 1 int a = 1; public void add(int x, int y); public void multi(int a, int b); public void show(int a, int b); }
UTF-8
Java
453
java
Interface_Example.java
Java
[]
null
[]
package interface_example; public interface Interface_Example { /** * The Java compiler adds public and abstract keywords before the interface * method. * public abstract void interfaceMethod(); */ void interfaceMethod(); // It adds public, static and final keywords before data members. // public static final int a = 1 int a = 1; public void add(int x, int y); public void multi(int a, int b); public void show(int a, int b); }
453
0.701987
0.697572
22
19.59091
21.870817
76
false
false
0
0
0
0
0
0
1.045455
false
false
1
0da123d9579ae6b7fb097bdb9dd9ca4921d4ccad
11,269,994,237,183
b0c26c68436388c5262a3e0f705fe9ff195a978e
/Graduation_Design/app/src/main/java/ml/amaze/design/bean/NutritionSummaryBean.java
b3f831618a5630f7cbfaa381225ac16a13657c0b
[]
no_license
Dhyt/test1
https://github.com/Dhyt/test1
fc4a99c1f0515c18a0cd9dcfa605a41f97fb3eb3
ad4deb5eee9d11504d014cb27002e5d70f9ab01c
refs/heads/master
2021-05-05T19:49:04.556000
2018-01-17T14:45:36
2018-01-17T14:45:36
117,849,843
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ml.amaze.design.bean; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Property; import org.greenrobot.greendao.annotation.Unique; import java.text.SimpleDateFormat; import java.util.Date; import ml.amaze.design.utils.Utils; import org.greenrobot.greendao.annotation.Generated; /** * @author hxj * @date 2017/12/18 0018 * 营养汇总,将每天摄入的能量,蛋白质,脂肪,碳水化合物存入数据库 */ @Entity public class NutritionSummaryBean { @Id private Long id; @Property(nameInDb = "date") @Unique private String date; @Property(nameInDb = "calory") private String calory; @Property(nameInDb = "protein") private String protein; @Property(nameInDb = "fat") private String fat; @Property(nameInDb = "carbohydrate") private String carbohydrate; @Property(nameInDb = "fiber_dietary") private String fiber_dietary; @Property(nameInDb = "vitamin_a") private String vitamin_a; @Property(nameInDb = "vitamin_c") private String vitamin_c; @Property(nameInDb = "vitamin_e") private String vitamin_e; @Property(nameInDb = "carotene") private String carotene; @Property(nameInDb = "thiamine") private String thiamine; @Property(nameInDb = "lactoflavin") private String lactoflavin; @Property(nameInDb = "niacin") private String niacin; @Property(nameInDb = "cholesterol") private String cholesterol; @Property(nameInDb = "magnesium") private String magnesium; @Property(nameInDb = "calcium") private String calcium; @Property(nameInDb = "iron") private String iron; @Property(nameInDb = "zinc") private String zinc; @Property(nameInDb = "copper") private String copper; @Property(nameInDb = "manganese") private String manganese; @Property(nameInDb = "kalium") private String kalium; @Property(nameInDb = "phosphor") private String phosphor; @Property(nameInDb = "natrium") private String natrium; @Property(nameInDb = "selenium") private String selenium; public NutritionSummaryBean() { this.id = null; this.date = getFormatDate(); this.calory = "0"; this.protein = "0"; this.fat = "0"; this.carbohydrate = "0"; this.fiber_dietary = "0"; this.vitamin_a = "0"; this.vitamin_c = "0"; this.vitamin_e = "0"; this.carotene = "0"; this.thiamine = "0"; this.lactoflavin = "0"; this.niacin = "0"; this.cholesterol = "0"; this.magnesium = "0"; this.calcium = "0"; this.iron = "0"; this.zinc = "0"; this.copper = "0"; this.manganese = "0"; this.kalium = "0"; this.phosphor = "0"; this.natrium = "0"; this.selenium = "0"; } public NutritionSummaryBean(NutritionSummaryBean nutritionSummaryBean, DietPlanBean dietPlanBean) { this.id=nutritionSummaryBean.getId(); this.calory = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCalory()) + Double.parseDouble(dietPlanBean.getCalory()), 1) + ""; this.protein = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getProtein()) + Double.parseDouble(dietPlanBean.getProtein()), 1) + ""; this.fat = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getFat()) + Double.parseDouble(dietPlanBean.getFat()), 1) + ""; this.carbohydrate = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCarbohydrate()) + Double.parseDouble(dietPlanBean.getCarbohydrate()), 1) + ""; this.fiber_dietary = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getFiber_dietary()) + Double.parseDouble(dietPlanBean.getFiber_dietary()), 1) + ""; this.vitamin_a = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getVitamin_a()) + Double.parseDouble(dietPlanBean.getVitamin_a()), 1) + ""; this.vitamin_c = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getVitamin_c()) + Double.parseDouble(dietPlanBean.getVitamin_c()), 1) + ""; this.vitamin_e = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getVitamin_e()) + Double.parseDouble(dietPlanBean.getVitamin_e()), 1) + ""; this.carotene = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCarotene()) + Double.parseDouble(dietPlanBean.getCarotene()), 1) + ""; this.thiamine = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getThiamine()) + Double.parseDouble(dietPlanBean.getThiamine()), 1) + ""; this.lactoflavin = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getLactoflavin()) + Double.parseDouble(dietPlanBean.getLactoflavin()), 1) + ""; this.niacin = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getNiacin()) + Double.parseDouble(dietPlanBean.getNiacin()), 1) + ""; this.cholesterol = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCholesterol()) + Double.parseDouble(dietPlanBean.getCholesterol()), 1) + ""; this.magnesium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getMagnesium()) + Double.parseDouble(dietPlanBean.getMagnesium()), 1) + ""; this.calcium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCalcium()) + Double.parseDouble(dietPlanBean.getCalcium()), 1) + ""; this.iron = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getIron()) + Double.parseDouble(dietPlanBean.getIron()), 1) + ""; this.zinc = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getZinc()) + Double.parseDouble(dietPlanBean.getZinc()), 1) + ""; this.copper = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCopper()) + Double.parseDouble(dietPlanBean.getCopper()), 1) + ""; this.manganese = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getManganese()) + Double.parseDouble(dietPlanBean.getManganese()), 1) + ""; this.kalium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getKalium()) + Double.parseDouble(dietPlanBean.getKalium()), 1) + ""; this.phosphor = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getPhosphor()) + Double.parseDouble(dietPlanBean.getPhosphor()), 1) + ""; this.natrium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getNatrium()) + Double.parseDouble(dietPlanBean.getNatrium()), 1) + ""; this.selenium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getSelenium()) + Double.parseDouble(dietPlanBean.getSelenium()), 1) + ""; this.date = getFormatDate(); } public NutritionSummaryBean(Long id, String calory, String protein, String fat, String carbohydrate) { this.id = id; this.calory = calory; this.protein = protein; this.fat = fat; this.carbohydrate = carbohydrate; this.date = getFormatDate(); } @Generated(hash = 1729413596) public NutritionSummaryBean(Long id, String date, String calory, String protein, String fat, String carbohydrate, String fiber_dietary, String vitamin_a, String vitamin_c, String vitamin_e, String carotene, String thiamine, String lactoflavin, String niacin, String cholesterol, String magnesium, String calcium, String iron, String zinc, String copper, String manganese, String kalium, String phosphor, String natrium, String selenium) { this.id = id; this.date = date; this.calory = calory; this.protein = protein; this.fat = fat; this.carbohydrate = carbohydrate; this.fiber_dietary = fiber_dietary; this.vitamin_a = vitamin_a; this.vitamin_c = vitamin_c; this.vitamin_e = vitamin_e; this.carotene = carotene; this.thiamine = thiamine; this.lactoflavin = lactoflavin; this.niacin = niacin; this.cholesterol = cholesterol; this.magnesium = magnesium; this.calcium = calcium; this.iron = iron; this.zinc = zinc; this.copper = copper; this.manganese = manganese; this.kalium = kalium; this.phosphor = phosphor; this.natrium = natrium; this.selenium = selenium; } private String getFormatDate() { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String s = sdf.format(date); return s; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getCalory() { return this.calory; } public void setCalory(String calory) { this.calory = calory; } public String getProtein() { return this.protein; } public void setProtein(String protein) { this.protein = protein; } public String getFat() { return this.fat; } public void setFat(String fat) { this.fat = fat; } public String getCarbohydrate() { return this.carbohydrate; } public void setCarbohydrate(String carbohydrate) { this.carbohydrate = carbohydrate; } public String getDate() { return this.date; } public void setDate(String date) { this.date = date; } public String getFiber_dietary() { return fiber_dietary; } public void setFiber_dietary(String fiber_dietary) { this.fiber_dietary = fiber_dietary; } public String getVitamin_a() { return vitamin_a; } public void setVitamin_a(String vitamin_a) { this.vitamin_a = vitamin_a; } public String getVitamin_c() { return vitamin_c; } public void setVitamin_c(String vitamin_c) { this.vitamin_c = vitamin_c; } public String getVitamin_e() { return vitamin_e; } public void setVitamin_e(String vitamin_e) { this.vitamin_e = vitamin_e; } public String getCarotene() { return carotene; } public void setCarotene(String carotene) { this.carotene = carotene; } public String getThiamine() { return thiamine; } public void setThiamine(String thiamine) { this.thiamine = thiamine; } public String getLactoflavin() { return lactoflavin; } public void setLactoflavin(String lactoflavin) { this.lactoflavin = lactoflavin; } public String getNiacin() { return niacin; } public void setNiacin(String niacin) { this.niacin = niacin; } public String getCholesterol() { return cholesterol; } public void setCholesterol(String cholesterol) { this.cholesterol = cholesterol; } public String getMagnesium() { return magnesium; } public void setMagnesium(String magnesium) { this.magnesium = magnesium; } public String getCalcium() { return calcium; } public void setCalcium(String calcium) { this.calcium = calcium; } public String getIron() { return iron; } public void setIron(String iron) { this.iron = iron; } public String getZinc() { return zinc; } public void setZinc(String zinc) { this.zinc = zinc; } public String getCopper() { return copper; } public void setCopper(String copper) { this.copper = copper; } public String getManganese() { return manganese; } public void setManganese(String manganese) { this.manganese = manganese; } public String getKalium() { return kalium; } public void setKalium(String kalium) { this.kalium = kalium; } public String getPhosphor() { return phosphor; } public void setPhosphor(String phosphor) { this.phosphor = phosphor; } public String getNatrium() { return natrium; } public void setNatrium(String natrium) { this.natrium = natrium; } public String getSelenium() { return selenium; } public void setSelenium(String selenium) { this.selenium = selenium; } }
UTF-8
Java
12,229
java
NutritionSummaryBean.java
Java
[ { "context": "bot.greendao.annotation.Generated;\n\n/**\n * @author hxj\n * @date 2017/12/18 0018\n * 营养汇总,将每天摄入的能量,蛋白质,脂肪,", "end": 397, "score": 0.9996232390403748, "start": 394, "tag": "USERNAME", "value": "hxj" } ]
null
[]
package ml.amaze.design.bean; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Property; import org.greenrobot.greendao.annotation.Unique; import java.text.SimpleDateFormat; import java.util.Date; import ml.amaze.design.utils.Utils; import org.greenrobot.greendao.annotation.Generated; /** * @author hxj * @date 2017/12/18 0018 * 营养汇总,将每天摄入的能量,蛋白质,脂肪,碳水化合物存入数据库 */ @Entity public class NutritionSummaryBean { @Id private Long id; @Property(nameInDb = "date") @Unique private String date; @Property(nameInDb = "calory") private String calory; @Property(nameInDb = "protein") private String protein; @Property(nameInDb = "fat") private String fat; @Property(nameInDb = "carbohydrate") private String carbohydrate; @Property(nameInDb = "fiber_dietary") private String fiber_dietary; @Property(nameInDb = "vitamin_a") private String vitamin_a; @Property(nameInDb = "vitamin_c") private String vitamin_c; @Property(nameInDb = "vitamin_e") private String vitamin_e; @Property(nameInDb = "carotene") private String carotene; @Property(nameInDb = "thiamine") private String thiamine; @Property(nameInDb = "lactoflavin") private String lactoflavin; @Property(nameInDb = "niacin") private String niacin; @Property(nameInDb = "cholesterol") private String cholesterol; @Property(nameInDb = "magnesium") private String magnesium; @Property(nameInDb = "calcium") private String calcium; @Property(nameInDb = "iron") private String iron; @Property(nameInDb = "zinc") private String zinc; @Property(nameInDb = "copper") private String copper; @Property(nameInDb = "manganese") private String manganese; @Property(nameInDb = "kalium") private String kalium; @Property(nameInDb = "phosphor") private String phosphor; @Property(nameInDb = "natrium") private String natrium; @Property(nameInDb = "selenium") private String selenium; public NutritionSummaryBean() { this.id = null; this.date = getFormatDate(); this.calory = "0"; this.protein = "0"; this.fat = "0"; this.carbohydrate = "0"; this.fiber_dietary = "0"; this.vitamin_a = "0"; this.vitamin_c = "0"; this.vitamin_e = "0"; this.carotene = "0"; this.thiamine = "0"; this.lactoflavin = "0"; this.niacin = "0"; this.cholesterol = "0"; this.magnesium = "0"; this.calcium = "0"; this.iron = "0"; this.zinc = "0"; this.copper = "0"; this.manganese = "0"; this.kalium = "0"; this.phosphor = "0"; this.natrium = "0"; this.selenium = "0"; } public NutritionSummaryBean(NutritionSummaryBean nutritionSummaryBean, DietPlanBean dietPlanBean) { this.id=nutritionSummaryBean.getId(); this.calory = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCalory()) + Double.parseDouble(dietPlanBean.getCalory()), 1) + ""; this.protein = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getProtein()) + Double.parseDouble(dietPlanBean.getProtein()), 1) + ""; this.fat = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getFat()) + Double.parseDouble(dietPlanBean.getFat()), 1) + ""; this.carbohydrate = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCarbohydrate()) + Double.parseDouble(dietPlanBean.getCarbohydrate()), 1) + ""; this.fiber_dietary = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getFiber_dietary()) + Double.parseDouble(dietPlanBean.getFiber_dietary()), 1) + ""; this.vitamin_a = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getVitamin_a()) + Double.parseDouble(dietPlanBean.getVitamin_a()), 1) + ""; this.vitamin_c = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getVitamin_c()) + Double.parseDouble(dietPlanBean.getVitamin_c()), 1) + ""; this.vitamin_e = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getVitamin_e()) + Double.parseDouble(dietPlanBean.getVitamin_e()), 1) + ""; this.carotene = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCarotene()) + Double.parseDouble(dietPlanBean.getCarotene()), 1) + ""; this.thiamine = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getThiamine()) + Double.parseDouble(dietPlanBean.getThiamine()), 1) + ""; this.lactoflavin = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getLactoflavin()) + Double.parseDouble(dietPlanBean.getLactoflavin()), 1) + ""; this.niacin = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getNiacin()) + Double.parseDouble(dietPlanBean.getNiacin()), 1) + ""; this.cholesterol = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCholesterol()) + Double.parseDouble(dietPlanBean.getCholesterol()), 1) + ""; this.magnesium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getMagnesium()) + Double.parseDouble(dietPlanBean.getMagnesium()), 1) + ""; this.calcium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCalcium()) + Double.parseDouble(dietPlanBean.getCalcium()), 1) + ""; this.iron = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getIron()) + Double.parseDouble(dietPlanBean.getIron()), 1) + ""; this.zinc = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getZinc()) + Double.parseDouble(dietPlanBean.getZinc()), 1) + ""; this.copper = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getCopper()) + Double.parseDouble(dietPlanBean.getCopper()), 1) + ""; this.manganese = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getManganese()) + Double.parseDouble(dietPlanBean.getManganese()), 1) + ""; this.kalium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getKalium()) + Double.parseDouble(dietPlanBean.getKalium()), 1) + ""; this.phosphor = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getPhosphor()) + Double.parseDouble(dietPlanBean.getPhosphor()), 1) + ""; this.natrium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getNatrium()) + Double.parseDouble(dietPlanBean.getNatrium()), 1) + ""; this.selenium = Utils.setDot(Double.parseDouble(nutritionSummaryBean.getSelenium()) + Double.parseDouble(dietPlanBean.getSelenium()), 1) + ""; this.date = getFormatDate(); } public NutritionSummaryBean(Long id, String calory, String protein, String fat, String carbohydrate) { this.id = id; this.calory = calory; this.protein = protein; this.fat = fat; this.carbohydrate = carbohydrate; this.date = getFormatDate(); } @Generated(hash = 1729413596) public NutritionSummaryBean(Long id, String date, String calory, String protein, String fat, String carbohydrate, String fiber_dietary, String vitamin_a, String vitamin_c, String vitamin_e, String carotene, String thiamine, String lactoflavin, String niacin, String cholesterol, String magnesium, String calcium, String iron, String zinc, String copper, String manganese, String kalium, String phosphor, String natrium, String selenium) { this.id = id; this.date = date; this.calory = calory; this.protein = protein; this.fat = fat; this.carbohydrate = carbohydrate; this.fiber_dietary = fiber_dietary; this.vitamin_a = vitamin_a; this.vitamin_c = vitamin_c; this.vitamin_e = vitamin_e; this.carotene = carotene; this.thiamine = thiamine; this.lactoflavin = lactoflavin; this.niacin = niacin; this.cholesterol = cholesterol; this.magnesium = magnesium; this.calcium = calcium; this.iron = iron; this.zinc = zinc; this.copper = copper; this.manganese = manganese; this.kalium = kalium; this.phosphor = phosphor; this.natrium = natrium; this.selenium = selenium; } private String getFormatDate() { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String s = sdf.format(date); return s; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getCalory() { return this.calory; } public void setCalory(String calory) { this.calory = calory; } public String getProtein() { return this.protein; } public void setProtein(String protein) { this.protein = protein; } public String getFat() { return this.fat; } public void setFat(String fat) { this.fat = fat; } public String getCarbohydrate() { return this.carbohydrate; } public void setCarbohydrate(String carbohydrate) { this.carbohydrate = carbohydrate; } public String getDate() { return this.date; } public void setDate(String date) { this.date = date; } public String getFiber_dietary() { return fiber_dietary; } public void setFiber_dietary(String fiber_dietary) { this.fiber_dietary = fiber_dietary; } public String getVitamin_a() { return vitamin_a; } public void setVitamin_a(String vitamin_a) { this.vitamin_a = vitamin_a; } public String getVitamin_c() { return vitamin_c; } public void setVitamin_c(String vitamin_c) { this.vitamin_c = vitamin_c; } public String getVitamin_e() { return vitamin_e; } public void setVitamin_e(String vitamin_e) { this.vitamin_e = vitamin_e; } public String getCarotene() { return carotene; } public void setCarotene(String carotene) { this.carotene = carotene; } public String getThiamine() { return thiamine; } public void setThiamine(String thiamine) { this.thiamine = thiamine; } public String getLactoflavin() { return lactoflavin; } public void setLactoflavin(String lactoflavin) { this.lactoflavin = lactoflavin; } public String getNiacin() { return niacin; } public void setNiacin(String niacin) { this.niacin = niacin; } public String getCholesterol() { return cholesterol; } public void setCholesterol(String cholesterol) { this.cholesterol = cholesterol; } public String getMagnesium() { return magnesium; } public void setMagnesium(String magnesium) { this.magnesium = magnesium; } public String getCalcium() { return calcium; } public void setCalcium(String calcium) { this.calcium = calcium; } public String getIron() { return iron; } public void setIron(String iron) { this.iron = iron; } public String getZinc() { return zinc; } public void setZinc(String zinc) { this.zinc = zinc; } public String getCopper() { return copper; } public void setCopper(String copper) { this.copper = copper; } public String getManganese() { return manganese; } public void setManganese(String manganese) { this.manganese = manganese; } public String getKalium() { return kalium; } public void setKalium(String kalium) { this.kalium = kalium; } public String getPhosphor() { return phosphor; } public void setPhosphor(String phosphor) { this.phosphor = phosphor; } public String getNatrium() { return natrium; } public void setNatrium(String natrium) { this.natrium = natrium; } public String getSelenium() { return selenium; } public void setSelenium(String selenium) { this.selenium = selenium; } }
12,229
0.647571
0.641982
383
30.767624
36.176399
170
false
false
0
0
0
0
0
0
0.577024
false
false
1
ca35e867100280f4a0885fe8d8da46358d5abcf5
27,797,028,404,449
2f3c04382a66dbf222c8587edd67a5df4bc80422
/src/com/cedar/cp/ejb/impl/message/MessageHelperSEJB.java
ef0358635455d6165b0c1be8455c5dc2cd17eac2
[]
no_license
arnoldbendaa/cppro
https://github.com/arnoldbendaa/cppro
d3ab6181cc51baad2b80876c65e11e92c569f0cc
f55958b85a74ad685f1360ae33c881b50d6e5814
refs/heads/master
2020-03-23T04:18:00.265000
2018-09-11T08:15:28
2018-09-11T08:15:28
141,074,966
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by: Fernflower v0.8.6 // Date: 12.08.2012 13:08:43 // Copyright: 2008-2012, Stiver // Home page: http://www.neshkov.com/ac_decompiler.html package com.cedar.cp.ejb.impl.message; import com.cedar.cp.api.base.ValidationException; import com.cedar.cp.dto.message.MessageEditorSessionCSO; import com.cedar.cp.dto.message.MessageImpl; import com.cedar.cp.dto.systemproperty.AllMailPropsELO; import com.cedar.cp.dto.systemproperty.SystemPropertyELO; import com.cedar.cp.dto.user.UserMessageAttributesForNameELO; import com.cedar.cp.ejb.api.message.MessageEditorSessionServer; import com.cedar.cp.ejb.impl.base.AbstractSession; import com.cedar.cp.ejb.impl.message.NewBackOfficeEmailSender; import com.cedar.cp.ejb.impl.systemproperty.SystemPropertyDAO; import com.cedar.cp.ejb.impl.user.UserDAO; import com.cedar.cp.util.Log; import java.rmi.RemoteException; import java.util.Iterator; import javax.ejb.EJBException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; public class MessageHelperSEJB extends AbstractSession implements SessionBean { private transient Log mLog = new Log(this.getClass()); public Object createNewMessage(MessageImpl data) { try { if(data.getMessageType() != 0) { UserDAO dao = new UserDAO(); StringBuffer mailAddress = null; Iterator e; if(data.getToEmailAddress() == null || data.getToEmailAddress().length() == 0) { if(data.getToUsers() != null) { e = data.getToUsers().iterator(); mailAddress = new StringBuffer(); while(e.hasNext()) { UserMessageAttributesForNameELO doSystemFrom = dao.getUserMessageAttributesForName((String)e.next()); if(doSystemFrom.hasNext()) { doSystemFrom.next(); if(doSystemFrom.getEMailAddress() != null && doSystemFrom.getEMailAddress().length() > 0) { if(mailAddress.length() > 0 && mailAddress.lastIndexOf(";") != mailAddress.length()) { mailAddress.append(";"); } mailAddress.append(doSystemFrom.getEMailAddress()); } } } } data.setToEmailAddress(mailAddress.toString()); } boolean doSystemFrom1 = false; if(data.getFromEmailAddress() == null || data.getFromEmailAddress().length() == 0) { if(data.getFromUsers() != null && data.getFromUsers().size() > 0) { e = data.getFromUsers().iterator(); mailAddress = new StringBuffer(); while(e.hasNext()) { UserMessageAttributesForNameELO spDao = dao.getUserMessageAttributesForName((String)e.next()); if(spDao.hasNext()) { spDao.next(); if(spDao.getEMailAddress() != null && spDao.getEMailAddress().length() > 0) { if(mailAddress.length() > 0 && mailAddress.lastIndexOf(";") != mailAddress.length()) { mailAddress.append(";"); } mailAddress.append(spDao.getEMailAddress()); } } } if(mailAddress.length() > 0) { data.setFromEmailAddress(mailAddress.toString()); } else { doSystemFrom1 = true; } } else { doSystemFrom1 = true; } } SystemPropertyDAO spDao1 = null; if(doSystemFrom1) { spDao1 = new SystemPropertyDAO(); SystemPropertyELO eList = spDao1.getSystemProperty("WEB: Alert from mail address"); eList.next(); if(eList.getValue().length() > 0) { data.setFromEmailAddress(eList.getValue()); } else { data.setFromEmailAddress("cp@coasolutions.com"); } } if(spDao1 == null) { spDao1 = new SystemPropertyDAO(); } AllMailPropsELO eList1 = spDao1.getAllMailProps(); NewBackOfficeEmailSender sender = new NewBackOfficeEmailSender(eList1); sender.send(data); } } catch (Exception var10) { this.mLog.warn("completeInsertSetup", "error tring to send email " + var10.getMessage()); } catch (Throwable var11) { var11.printStackTrace(); } try { if(data.getMessageType() != 1) { MessageEditorSessionServer e1 = new MessageEditorSessionServer(this.getInitialContext(), false); return e1.insertBackDoor(data); } } catch (Exception var9) { var9.printStackTrace(); } return null; } public Object autonomousInsert(MessageEditorSessionCSO cso) throws ValidationException, EJBException { return this.createNewMessage(cso.getEditorData()); } public void emptyFolder(int folderType, String userId) { MessageDAO dao = new MessageDAO(); dao.emptyFolder(folderType, userId); } public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {} public void ejbRemove() throws EJBException, RemoteException {} public void ejbActivate() throws EJBException, RemoteException {} public void ejbPassivate() throws EJBException, RemoteException {} public void ejbCreate() throws EJBException {} }
UTF-8
Java
5,906
java
MessageHelperSEJB.java
Java
[ { "context": "se {\r\n data.setFromEmailAddress(\"cp@coasolutions.com\");\r\n }\r\n }\r\n\r\n ", "end": 4318, "score": 0.9999257326126099, "start": 4299, "tag": "EMAIL", "value": "cp@coasolutions.com" } ]
null
[]
// Decompiled by: Fernflower v0.8.6 // Date: 12.08.2012 13:08:43 // Copyright: 2008-2012, Stiver // Home page: http://www.neshkov.com/ac_decompiler.html package com.cedar.cp.ejb.impl.message; import com.cedar.cp.api.base.ValidationException; import com.cedar.cp.dto.message.MessageEditorSessionCSO; import com.cedar.cp.dto.message.MessageImpl; import com.cedar.cp.dto.systemproperty.AllMailPropsELO; import com.cedar.cp.dto.systemproperty.SystemPropertyELO; import com.cedar.cp.dto.user.UserMessageAttributesForNameELO; import com.cedar.cp.ejb.api.message.MessageEditorSessionServer; import com.cedar.cp.ejb.impl.base.AbstractSession; import com.cedar.cp.ejb.impl.message.NewBackOfficeEmailSender; import com.cedar.cp.ejb.impl.systemproperty.SystemPropertyDAO; import com.cedar.cp.ejb.impl.user.UserDAO; import com.cedar.cp.util.Log; import java.rmi.RemoteException; import java.util.Iterator; import javax.ejb.EJBException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; public class MessageHelperSEJB extends AbstractSession implements SessionBean { private transient Log mLog = new Log(this.getClass()); public Object createNewMessage(MessageImpl data) { try { if(data.getMessageType() != 0) { UserDAO dao = new UserDAO(); StringBuffer mailAddress = null; Iterator e; if(data.getToEmailAddress() == null || data.getToEmailAddress().length() == 0) { if(data.getToUsers() != null) { e = data.getToUsers().iterator(); mailAddress = new StringBuffer(); while(e.hasNext()) { UserMessageAttributesForNameELO doSystemFrom = dao.getUserMessageAttributesForName((String)e.next()); if(doSystemFrom.hasNext()) { doSystemFrom.next(); if(doSystemFrom.getEMailAddress() != null && doSystemFrom.getEMailAddress().length() > 0) { if(mailAddress.length() > 0 && mailAddress.lastIndexOf(";") != mailAddress.length()) { mailAddress.append(";"); } mailAddress.append(doSystemFrom.getEMailAddress()); } } } } data.setToEmailAddress(mailAddress.toString()); } boolean doSystemFrom1 = false; if(data.getFromEmailAddress() == null || data.getFromEmailAddress().length() == 0) { if(data.getFromUsers() != null && data.getFromUsers().size() > 0) { e = data.getFromUsers().iterator(); mailAddress = new StringBuffer(); while(e.hasNext()) { UserMessageAttributesForNameELO spDao = dao.getUserMessageAttributesForName((String)e.next()); if(spDao.hasNext()) { spDao.next(); if(spDao.getEMailAddress() != null && spDao.getEMailAddress().length() > 0) { if(mailAddress.length() > 0 && mailAddress.lastIndexOf(";") != mailAddress.length()) { mailAddress.append(";"); } mailAddress.append(spDao.getEMailAddress()); } } } if(mailAddress.length() > 0) { data.setFromEmailAddress(mailAddress.toString()); } else { doSystemFrom1 = true; } } else { doSystemFrom1 = true; } } SystemPropertyDAO spDao1 = null; if(doSystemFrom1) { spDao1 = new SystemPropertyDAO(); SystemPropertyELO eList = spDao1.getSystemProperty("WEB: Alert from mail address"); eList.next(); if(eList.getValue().length() > 0) { data.setFromEmailAddress(eList.getValue()); } else { data.setFromEmailAddress("<EMAIL>"); } } if(spDao1 == null) { spDao1 = new SystemPropertyDAO(); } AllMailPropsELO eList1 = spDao1.getAllMailProps(); NewBackOfficeEmailSender sender = new NewBackOfficeEmailSender(eList1); sender.send(data); } } catch (Exception var10) { this.mLog.warn("completeInsertSetup", "error tring to send email " + var10.getMessage()); } catch (Throwable var11) { var11.printStackTrace(); } try { if(data.getMessageType() != 1) { MessageEditorSessionServer e1 = new MessageEditorSessionServer(this.getInitialContext(), false); return e1.insertBackDoor(data); } } catch (Exception var9) { var9.printStackTrace(); } return null; } public Object autonomousInsert(MessageEditorSessionCSO cso) throws ValidationException, EJBException { return this.createNewMessage(cso.getEditorData()); } public void emptyFolder(int folderType, String userId) { MessageDAO dao = new MessageDAO(); dao.emptyFolder(folderType, userId); } public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {} public void ejbRemove() throws EJBException, RemoteException {} public void ejbActivate() throws EJBException, RemoteException {} public void ejbPassivate() throws EJBException, RemoteException {} public void ejbCreate() throws EJBException {} }
5,894
0.563664
0.553505
146
38.452053
30.652735
122
false
false
0
0
0
0
0
0
0.520548
false
false
1
01ccdd22d0e22842a6a2f7d1267a5efb85536992
1,408,749,325,939
344fa732b48ed38563799c74a06987bf02d15361
/map-coloring-csp/src/Test.java
1ab433c92d5e23f36428a99cea8a7073e054f85c
[]
no_license
michelleshu/AI-Labs
https://github.com/michelleshu/AI-Labs
fcc8b23fce992d5bb8fdfd55921cacecd587acd8
f6cae0dd8a94817c4320affa9157a9be9524bcfd
refs/heads/master
2021-01-19T09:42:32.763000
2014-04-24T05:21:25
2014-04-24T05:21:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class Test { public class DomainValComparator implements Comparator<Pair> { public int compare(Pair p1, Pair p2) { return p1.b - p2.b; } } public static void main(String[] args) { // ArrayList<Integer> a = new ArrayList<Integer>(5); // a.add(5); // a.add(3); // a.add(7); // a.add(4); // a.add(2); // // System.out.println(a); // a.remove((Integer)7); // System.out.println(a); Test t = new Test(); ArrayList<Pair> pList = new ArrayList<Pair>(); pList.add(new Pair(3, 6)); pList.add(new Pair(7, 2)); pList.add(new Pair(4, 1)); pList.add(new Pair(6, 5)); pList.add(new Pair(8, 2)); pList.add(new Pair(5, 7)); Collections.sort(pList, t.new DomainValComparator()); for (int i = 0; i < pList.size(); i++) { System.out.println(pList.get(i).b); } } }
UTF-8
Java
897
java
Test.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class Test { public class DomainValComparator implements Comparator<Pair> { public int compare(Pair p1, Pair p2) { return p1.b - p2.b; } } public static void main(String[] args) { // ArrayList<Integer> a = new ArrayList<Integer>(5); // a.add(5); // a.add(3); // a.add(7); // a.add(4); // a.add(2); // // System.out.println(a); // a.remove((Integer)7); // System.out.println(a); Test t = new Test(); ArrayList<Pair> pList = new ArrayList<Pair>(); pList.add(new Pair(3, 6)); pList.add(new Pair(7, 2)); pList.add(new Pair(4, 1)); pList.add(new Pair(6, 5)); pList.add(new Pair(8, 2)); pList.add(new Pair(5, 7)); Collections.sort(pList, t.new DomainValComparator()); for (int i = 0; i < pList.size(); i++) { System.out.println(pList.get(i).b); } } }
897
0.622074
0.595318
39
22.02564
16.749262
63
false
false
0
0
0
0
0
0
2.461539
false
false
1
e032615519659f6e4b0dd0cab62747cd230bfa7a
8,813,272,938,897
419d7c3441f815d579f6599213b31116395c7c38
/src/pd/modules/MockStringExpansionFuzzer.java
7fdad8a2fe641ba2580343cb967d5f208c7d6ab1
[ "Apache-2.0" ]
permissive
phaupt/sipproxy
https://github.com/phaupt/sipproxy
101878de4fd59cabc9fc11d0d3d0477b57f2dbe7
c5524948f05a1a3b03696ffc59f89f08089d063c
refs/heads/master
2020-03-19T06:34:24.424000
2018-06-04T14:16:17
2018-06-04T14:16:17
136,034,393
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pd.modules; import testexec.IVariableReplacer; public class MockStringExpansionFuzzer implements IModule { public String expansionString; public int increment; public char[] charSet; public MockStringExpansionFuzzer(String expansionString, int increment) { this.expansionString = expansionString; this.increment = increment; } public MockStringExpansionFuzzer(int increment) { this.increment = increment; } public MockStringExpansionFuzzer(int increment, char[] charSet) { this.increment = increment; this.charSet = charSet; } public String getValue(IVariableReplacer variableReplacer) { // TODO Auto-generated method stub return null; } }
UTF-8
Java
804
java
MockStringExpansionFuzzer.java
Java
[]
null
[]
package pd.modules; import testexec.IVariableReplacer; public class MockStringExpansionFuzzer implements IModule { public String expansionString; public int increment; public char[] charSet; public MockStringExpansionFuzzer(String expansionString, int increment) { this.expansionString = expansionString; this.increment = increment; } public MockStringExpansionFuzzer(int increment) { this.increment = increment; } public MockStringExpansionFuzzer(int increment, char[] charSet) { this.increment = increment; this.charSet = charSet; } public String getValue(IVariableReplacer variableReplacer) { // TODO Auto-generated method stub return null; } }
804
0.660448
0.660448
33
22.363636
23.161905
77
false
false
0
0
0
0
0
0
0.393939
false
false
1
0961b98aa28974c3e0c2c3bf8712881af526674a
6,914,897,392,324
c572ee6361dcf16d5c4e7043b7e6eb496095b71e
/flink/src/main/java/com/example/base/format/Data.java
d42fa6b9a199e680327d85f79ce35f0b1ea5d6b8
[]
no_license
pawnZzz/study-java
https://github.com/pawnZzz/study-java
fce146ed482b43942d685cc2e38c4654e8e558a2
a2d65726abe1c86891ec32dbae77a4ddcf77041e
refs/heads/master
2023-07-21T20:55:36.525000
2023-07-12T07:21:31
2023-07-12T07:21:31
226,797,403
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.base.format; /** * @author zyc */ public class Data { }
UTF-8
Java
79
java
Data.java
Java
[ { "context": "package com.example.base.format;\n\n/**\n * @author zyc\n */\npublic class Data {\n}\n", "end": 52, "score": 0.9994727969169617, "start": 49, "tag": "USERNAME", "value": "zyc" } ]
null
[]
package com.example.base.format; /** * @author zyc */ public class Data { }
79
0.64557
0.64557
7
10.285714
11.080411
32
false
false
0
0
0
0
0
0
0.142857
false
false
1
b3a0d6f9d643cc0a76e85aca7af57bbcd99e7dc9
10,333,691,317,737
fc61679a8f083206dc7a37a5ff6b152b878d21b4
/app/src/main/java/com/emmanuj/todoo/db/DBTable.java
e67cc9b35916a1087a5cb339b5ae1d697bbd2773
[]
no_license
emmanuj/todoo
https://github.com/emmanuj/todoo
b7f5c894f948e787efc5a30c6ec7ca7b92da57fe
0123b7176304cd103fc7ccda878bb10517120d53
refs/heads/master
2018-01-09T01:15:50.539000
2015-11-30T23:52:28
2015-11-30T23:52:28
46,100,331
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.emmanuj.todoo.db; import java.util.ArrayList; import java.util.List; /** * Created by emmanuj on 11/12/15. */ public class DBTable { private String tableName; private final List<DBTableField> fields = new ArrayList<>(); public DBTable(String tableName) { this.tableName = tableName; } public DBTable() { } public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public List<DBTableField> getFields() { return fields; } public String[] getFieldNames(){ String [] fds = new String[fields.size()]; for(int i =0;i<fds.length;i++){ fds[i] = fields.get(i).getName(); } return fds; } public void addColumn(String columnName, String datatype, String... properties){ StringBuilder props = new StringBuilder(); for(String s: properties){ props.append(s).append(" "); } DBTableField f = new DBTableField(); f.setName(columnName); f.setType(datatype); f.setProperties(props.toString().trim()); fields.add(f); } public String createQuery(){ String query = "CREATE TABLE "+ tableName +"("; for(int i =0;i<fields.size();i++){ DBTableField f = fields.get(i); query +=f.getName()+" "+f.getType()+" "+f.getProperties(); if(i != fields.size()-1){ query +=","; }else{ query +=")"; } } return query; } public String dropQuery(){ return "DROP TABLE IF EXISTS "+ tableName; } }
UTF-8
Java
1,719
java
DBTable.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by emmanuj on 11/12/15.\n */\npublic class DBTable {\n priva", "end": 108, "score": 0.9996678233146667, "start": 101, "tag": "USERNAME", "value": "emmanuj" } ]
null
[]
package com.emmanuj.todoo.db; import java.util.ArrayList; import java.util.List; /** * Created by emmanuj on 11/12/15. */ public class DBTable { private String tableName; private final List<DBTableField> fields = new ArrayList<>(); public DBTable(String tableName) { this.tableName = tableName; } public DBTable() { } public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public List<DBTableField> getFields() { return fields; } public String[] getFieldNames(){ String [] fds = new String[fields.size()]; for(int i =0;i<fds.length;i++){ fds[i] = fields.get(i).getName(); } return fds; } public void addColumn(String columnName, String datatype, String... properties){ StringBuilder props = new StringBuilder(); for(String s: properties){ props.append(s).append(" "); } DBTableField f = new DBTableField(); f.setName(columnName); f.setType(datatype); f.setProperties(props.toString().trim()); fields.add(f); } public String createQuery(){ String query = "CREATE TABLE "+ tableName +"("; for(int i =0;i<fields.size();i++){ DBTableField f = fields.get(i); query +=f.getName()+" "+f.getType()+" "+f.getProperties(); if(i != fields.size()-1){ query +=","; }else{ query +=")"; } } return query; } public String dropQuery(){ return "DROP TABLE IF EXISTS "+ tableName; } }
1,719
0.549738
0.544503
74
22.229731
20.033449
84
false
false
0
0
0
0
0
0
0.445946
false
false
1
f6dd6ab8be3d5f528ef29136b8bf787497e503ee
17,557,826,369,932
028d6009f3beceba80316daa84b628496a210f8d
/uidesigner/com.nokia.sdt.uidesigner/src/com/nokia/sdt/uidesigner/ui/ContentsObject.java
08a2cba43816f89649a7c768a29f019b368aeb4e
[]
no_license
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
https://github.com/JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
fa50cafa69d3e317abf0db0f4e3e557150fd88b3
4420f338bc4e522c563f8899d81201857236a66a
refs/heads/master
2020-12-30T16:45:28.474000
2010-10-20T16:19:31
2010-10-20T16:19:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ package com.nokia.sdt.uidesigner.ui; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.emf.ecore.EObject; import com.nokia.sdt.uidesigner.ui.editparts.ContentsLayoutEditPart; import com.nokia.sdt.uidesigner.ui.figure.LayoutContentsFigure; import com.nokia.cpp.internal.api.utils.core.Check; /** * * This is the object that GEF considers the root model object. * The root container(s) hang off this object when the editor is open. */ public class ContentsObject { private ContentsLayoutEditPart editPart; private List rootContainers = new ArrayList(); private List listeners = new ArrayList(); public interface RootContainerAddedListener { public void rootContainerAdded(EObject root); } public ContentsObject() { } public void addRootContainer(EObject rootContainer) { Check.checkArg(rootContainer); this.rootContainers.add(rootContainer); fireRootContainerAdded(rootContainer); } public void setRootContainer(EObject rootContainer) { rootContainers.clear(); listeners.clear(); addRootContainer(rootContainer); } private void fireRootContainerAdded(EObject root) { for (Iterator iter = listeners.iterator(); iter.hasNext();) { RootContainerAddedListener listener = (RootContainerAddedListener) iter.next(); listener.rootContainerAdded(root); } } public void addListener(RootContainerAddedListener listener) { listeners.add(listener); } public void removeListener(RootContainerAddedListener listener) { listeners.remove(listener); } public LayoutContentsFigure getLayoutContentsFigure() { return (LayoutContentsFigure) editPart.getFigure(); } public void setEditPart(ContentsLayoutEditPart editPart) { Check.checkArg(editPart); this.editPart = editPart; } public List getRootContainers() { return rootContainers; } }
UTF-8
Java
2,388
java
ContentsObject.java
Java
[]
null
[]
/* * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ package com.nokia.sdt.uidesigner.ui; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.emf.ecore.EObject; import com.nokia.sdt.uidesigner.ui.editparts.ContentsLayoutEditPart; import com.nokia.sdt.uidesigner.ui.figure.LayoutContentsFigure; import com.nokia.cpp.internal.api.utils.core.Check; /** * * This is the object that GEF considers the root model object. * The root container(s) hang off this object when the editor is open. */ public class ContentsObject { private ContentsLayoutEditPart editPart; private List rootContainers = new ArrayList(); private List listeners = new ArrayList(); public interface RootContainerAddedListener { public void rootContainerAdded(EObject root); } public ContentsObject() { } public void addRootContainer(EObject rootContainer) { Check.checkArg(rootContainer); this.rootContainers.add(rootContainer); fireRootContainerAdded(rootContainer); } public void setRootContainer(EObject rootContainer) { rootContainers.clear(); listeners.clear(); addRootContainer(rootContainer); } private void fireRootContainerAdded(EObject root) { for (Iterator iter = listeners.iterator(); iter.hasNext();) { RootContainerAddedListener listener = (RootContainerAddedListener) iter.next(); listener.rootContainerAdded(root); } } public void addListener(RootContainerAddedListener listener) { listeners.add(listener); } public void removeListener(RootContainerAddedListener listener) { listeners.remove(listener); } public LayoutContentsFigure getLayoutContentsFigure() { return (LayoutContentsFigure) editPart.getFigure(); } public void setEditPart(ContentsLayoutEditPart editPart) { Check.checkArg(editPart); this.editPart = editPart; } public List getRootContainers() { return rootContainers; } }
2,388
0.741206
0.737856
87
25.448277
24.464264
82
false
false
0
0
0
0
0
0
1.068966
false
false
1
3a72f4df16f380da12843ff60af5d1369ec073cd
17,901,423,747,366
f49168987e3cfa0267c82254c2bece38c7c6e2ba
/ProjetOeuvreSpringJPA/src/main/java/com/epul/oeuvres/controle/AdherentControleur.java
486c80d2cbbfcae250adf99eb0c709aab4bab572
[]
no_license
Amoshalt/ProjetOeuvreSpringJPA
https://github.com/Amoshalt/ProjetOeuvreSpringJPA
6497e38ff948bbcdb0b47050c1e292c1c372748e
63fdce45a151539d806b4b1894c599500464e0f0
refs/heads/master
2021-04-18T18:51:46.372000
2018-03-28T11:57:47
2018-03-28T11:57:47
126,709,530
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epul.oeuvres.controle; import com.epul.oeuvres.dao.AdherentService; import com.epul.oeuvres.dao.Service; import com.epul.oeuvres.meserreurs.MonException; import com.epul.oeuvres.metier.AdherentEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Controller public class AdherentControleur { @RequestMapping(value = "listerAdherent.htm") public ModelAndView afficherLesStages(HttpServletRequest request, HttpServletResponse response) throws Exception { String destinationPage; try { // HttpSession session = request.getSession(); AdherentService unService = new AdherentService(); request.setAttribute("mesAdherents", unService.consulterListeAdherents()); destinationPage = "listerAdherent"; } catch (Exception e) { request.setAttribute("MesErreurs", e.getMessage()); destinationPage = "Erreur"; } return new ModelAndView(destinationPage); } @RequestMapping(value = "insererAdherent.htm") public ModelAndView insererAdherent(HttpServletRequest request, HttpServletResponse response) throws Exception { String destinationPage = ""; try { AdherentEntity unAdherent = new AdherentEntity(); unAdherent.setNomAdherent(request.getParameter("nomAdherent")); unAdherent.setPrenomAdherent(request.getParameter("prenomAdherent")); unAdherent.setVilleAdherent(request.getParameter("villeAdherent")); AdherentService unService = new AdherentService(); unService.insertAdherent(unAdherent); destinationPage = "home"; } catch (Exception e) { request.setAttribute("MesErreurs", e.getMessage()); destinationPage = "Erreur"; } return new ModelAndView(destinationPage); } @RequestMapping(value = "ajouterAdherent.htm") public ModelAndView ajouterAdherent(HttpServletRequest request, HttpServletResponse response) throws Exception { String destinationPage = ""; try { destinationPage = "ajouterAdherent"; } catch (Exception e) { request.setAttribute("MesErreurs", e.getMessage()); destinationPage = "Erreur"; } return new ModelAndView(destinationPage); } }
UTF-8
Java
2,549
java
AdherentControleur.java
Java
[]
null
[]
package com.epul.oeuvres.controle; import com.epul.oeuvres.dao.AdherentService; import com.epul.oeuvres.dao.Service; import com.epul.oeuvres.meserreurs.MonException; import com.epul.oeuvres.metier.AdherentEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Controller public class AdherentControleur { @RequestMapping(value = "listerAdherent.htm") public ModelAndView afficherLesStages(HttpServletRequest request, HttpServletResponse response) throws Exception { String destinationPage; try { // HttpSession session = request.getSession(); AdherentService unService = new AdherentService(); request.setAttribute("mesAdherents", unService.consulterListeAdherents()); destinationPage = "listerAdherent"; } catch (Exception e) { request.setAttribute("MesErreurs", e.getMessage()); destinationPage = "Erreur"; } return new ModelAndView(destinationPage); } @RequestMapping(value = "insererAdherent.htm") public ModelAndView insererAdherent(HttpServletRequest request, HttpServletResponse response) throws Exception { String destinationPage = ""; try { AdherentEntity unAdherent = new AdherentEntity(); unAdherent.setNomAdherent(request.getParameter("nomAdherent")); unAdherent.setPrenomAdherent(request.getParameter("prenomAdherent")); unAdherent.setVilleAdherent(request.getParameter("villeAdherent")); AdherentService unService = new AdherentService(); unService.insertAdherent(unAdherent); destinationPage = "home"; } catch (Exception e) { request.setAttribute("MesErreurs", e.getMessage()); destinationPage = "Erreur"; } return new ModelAndView(destinationPage); } @RequestMapping(value = "ajouterAdherent.htm") public ModelAndView ajouterAdherent(HttpServletRequest request, HttpServletResponse response) throws Exception { String destinationPage = ""; try { destinationPage = "ajouterAdherent"; } catch (Exception e) { request.setAttribute("MesErreurs", e.getMessage()); destinationPage = "Erreur"; } return new ModelAndView(destinationPage); } }
2,549
0.69439
0.69439
68
36.485294
29.862181
118
false
false
0
0
0
0
0
0
0.602941
false
false
1
75d033d9f8bf31a5b6152af5fd66a8f3d1e7eb21
17,901,423,748,451
83ef9cf4fa2d8c99a8a93ac8979473478b0f7cad
/metrics/src/main/java/pl/com/stream/metrics/model/BaseEntity.java
a0386f6eb5fab55a28fa46f5c5532ccec04e77ab
[]
no_license
miro007/workspace
https://github.com/miro007/workspace
6e763b83160b2282f67edee7600184cc1fe2ff2f
6bc99a2f04fdb4ba839d09be2752b8c9ced0d361
refs/heads/master
2020-05-03T04:45:11.238000
2014-03-08T11:11:31
2014-03-08T11:11:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.com.stream.metrics.model; import java.io.Serializable; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; import pl.com.stream.metrics.lib.Context; import pl.com.stream.metrics.repo.CommonRepository; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @MappedSuperclass @JsonIgnoreProperties(ignoreUnknown = true) public class BaseEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public void save(BaseEntity entity) { Context.getService(CommonRepository.class).save(entity); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
UTF-8
Java
792
java
BaseEntity.java
Java
[]
null
[]
package pl.com.stream.metrics.model; import java.io.Serializable; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; import pl.com.stream.metrics.lib.Context; import pl.com.stream.metrics.repo.CommonRepository; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @MappedSuperclass @JsonIgnoreProperties(ignoreUnknown = true) public class BaseEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public void save(BaseEntity entity) { Context.getService(CommonRepository.class).save(entity); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
792
0.760101
0.760101
33
22
20.24247
61
false
false
0
0
0
0
0
0
0.848485
false
false
1
d5604a6d6e353bbe6278fd8698ef7e1de73c5d18
3,564,822,916,848
0024c6603c97c5384e41e7c7f5efebd9f0a4648f
/wechat/src/main/java/com/chj/common/interceptor/WechatAuthInterceptor.java
08c0330c02e26e40f4bc022da78d0868828a84bc
[]
no_license
chen-derek/SpringBoot
https://github.com/chen-derek/SpringBoot
d7d63646ca9b5095a1c922b90a811f1a7cccfc8f
80475f49bbf1622bc5af2b6822a2521bf38fbcb6
refs/heads/master
2020-01-30T08:51:26.154000
2017-04-27T14:40:04
2017-04-27T14:40:04
66,276,275
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chj.common.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import com.chj.common.constants.MwebConstants; import com.chj.common.dto.WechatRestResponse; import com.chj.common.utils.StringUtils; import com.chj.common.utils.WechatOauthUtil; import com.chj.service.WechatService; /** * 授权认证,获取当前OpenID, * * @author haijing chen * */ @Component public class WechatAuthInterceptor extends HandlerInterceptorAdapter { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private WechatService wechatService; // 授权获取当前OpenID,如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&state=STATE。 public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String wechatOpenId = (String) request.getSession().getAttribute(MwebConstants.WECHAT_OPEN_ID); logger.info("wechatOpenId is [" + wechatOpenId + "]"); if (StringUtils.isNotEmpty(wechatOpenId)) { return true; } String state = request.getParameter("state"); String code = request.getParameter("code"); logger.info("state is [" + state + "] , code is [" + code + "]"); if (!StringUtils.isEmpty(state) && !StringUtils.isEmpty(code)) { logger.info("------------" + wechatService); WechatRestResponse accessTokenByCode = wechatService.getAccessTokenByCode(code); wechatOpenId = accessTokenByCode.getOpenid(); if (StringUtils.isEmpty(wechatOpenId)) { logger.info("Couldn't get wechatOpenId by the code from Wechat server,return 403 code."); response.sendError(403); return false; } request.getSession().setAttribute(MwebConstants.WECHAT_OPEN_ID, wechatOpenId); } else { String queryString = request.getQueryString(); String url = request.getRequestURI(); if (!StringUtils.isEmpty(queryString)) { url += "?" + queryString; } logger.info("request url = " + url); url = WechatOauthUtil.getOauthUrl(url); logger.info("redirect url = " + url); response.sendRedirect(url); return false; } return true; } }
UTF-8
Java
2,392
java
WechatAuthInterceptor.java
Java
[ { "context": "atService;\n\n/**\n * 授权认证,获取当前OpenID,\n * \n * @author haijing chen\n * \n */\n@Component\npublic class WechatAuthInterce", "end": 644, "score": 0.9996686577796936, "start": 632, "tag": "NAME", "value": "haijing chen" } ]
null
[]
package com.chj.common.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import com.chj.common.constants.MwebConstants; import com.chj.common.dto.WechatRestResponse; import com.chj.common.utils.StringUtils; import com.chj.common.utils.WechatOauthUtil; import com.chj.service.WechatService; /** * 授权认证,获取当前OpenID, * * @author <NAME> * */ @Component public class WechatAuthInterceptor extends HandlerInterceptorAdapter { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private WechatService wechatService; // 授权获取当前OpenID,如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&state=STATE。 public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String wechatOpenId = (String) request.getSession().getAttribute(MwebConstants.WECHAT_OPEN_ID); logger.info("wechatOpenId is [" + wechatOpenId + "]"); if (StringUtils.isNotEmpty(wechatOpenId)) { return true; } String state = request.getParameter("state"); String code = request.getParameter("code"); logger.info("state is [" + state + "] , code is [" + code + "]"); if (!StringUtils.isEmpty(state) && !StringUtils.isEmpty(code)) { logger.info("------------" + wechatService); WechatRestResponse accessTokenByCode = wechatService.getAccessTokenByCode(code); wechatOpenId = accessTokenByCode.getOpenid(); if (StringUtils.isEmpty(wechatOpenId)) { logger.info("Couldn't get wechatOpenId by the code from Wechat server,return 403 code."); response.sendError(403); return false; } request.getSession().setAttribute(MwebConstants.WECHAT_OPEN_ID, wechatOpenId); } else { String queryString = request.getQueryString(); String url = request.getRequestURI(); if (!StringUtils.isEmpty(queryString)) { url += "?" + queryString; } logger.info("request url = " + url); url = WechatOauthUtil.getOauthUrl(url); logger.info("redirect url = " + url); response.sendRedirect(url); return false; } return true; } }
2,386
0.747205
0.743766
68
33.205883
28.021818
118
false
false
0
0
0
0
0
0
1.970588
false
false
1
781221c74f1bc8b37544fc63a60301e7fac2f44a
6,914,897,403,833
2da3828c2de2fd7b777d2007384e38102a64d977
/speed-test/src/main/java/me/power/speed/test/symbol/shift/ShiftOperate.java
0f4441bf57abb940cece4694e15828ae76ac44ca
[]
no_license
520github/huge
https://github.com/520github/huge
8f7a6636956e2531812127cda6ae2e100686abc0
781c1778f9cf456a2d760d30f06a7db110ad4659
refs/heads/master
2022-12-25T14:08:30.658000
2021-07-20T09:31:02
2021-07-20T09:31:02
16,610,855
0
0
null
false
2022-12-09T22:51:10
2014-02-07T10:03:12
2021-07-20T09:31:15
2022-12-09T22:51:07
1,768
0
0
14
JavaScript
false
false
package me.power.speed.test.symbol.shift; //对负数的二进制解码,首先对其所有的位取反,然后加1,如: //-42 11010110 取反后为00101001 ,或41,然后加1,这样就得到了42 public class ShiftOperate { public static int intShiftLeft(int value, int step) { return value << step; } public static int intShiftRight(int value, int step) { return value >>= step; } public static int intShiftRightWithUnSign(int value, int step) { return value >>>= step; } //按位非,也叫补,也就是取反 public static int intNot(int value) { return ~value; } public static int intAnd(int value1, int value2) { return value1 & value2; } public static int intOr(int value1, int value2) { return value1 | value2; } //异或,按位异或运算符“^”,只有在两个比较的位不同时其结果是 1。否则,结果是零 public static int intXOr(int value1, int value2) { return value1 ^ value2; } }
GB18030
Java
1,011
java
ShiftOperate.java
Java
[]
null
[]
package me.power.speed.test.symbol.shift; //对负数的二进制解码,首先对其所有的位取反,然后加1,如: //-42 11010110 取反后为00101001 ,或41,然后加1,这样就得到了42 public class ShiftOperate { public static int intShiftLeft(int value, int step) { return value << step; } public static int intShiftRight(int value, int step) { return value >>= step; } public static int intShiftRightWithUnSign(int value, int step) { return value >>>= step; } //按位非,也叫补,也就是取反 public static int intNot(int value) { return ~value; } public static int intAnd(int value1, int value2) { return value1 & value2; } public static int intOr(int value1, int value2) { return value1 | value2; } //异或,按位异或运算符“^”,只有在两个比较的位不同时其结果是 1。否则,结果是零 public static int intXOr(int value1, int value2) { return value1 ^ value2; } }
1,011
0.673147
0.62819
36
20.861111
20.461554
65
false
false
0
0
0
0
0
0
1.416667
false
false
1
08fdf4b0defa91b160f4163ef3ccfc74cb17cb42
19,430,432,099,723
d5e3f58f0a23a4b6b1ac7cb12a63b1b2f5bd11ae
/N201911/src/main/java/N201911/N20191113/Client.java
44f50e7a02d23029ecf6a3eb1a30ef115ce10767
[]
no_license
F-Joah/everyday
https://github.com/F-Joah/everyday
e396fe0f33d12a6cc201f9dc1eccc360c1b3be49
c65bb06da0931e2db39936a8b5aea2273a6f4a02
refs/heads/master
2020-09-02T15:31:54.882000
2020-04-22T14:46:54
2020-04-22T14:46:54
219,249,306
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package N201911.N20191113; public class Client { public static void main(String[] args) { // 服务员 KFCWaiter waiter = new KFCWaiter(); // 套餐A MealA mealA = new MealA(); // 服务员准备套餐A waiter.setMealBuilder(mealA); // 获得套餐 Meal meal = waiter.construct(); System.out.println("<<<------******套餐A的组成部分******------>>>"); System.out.println(meal.getFood() + "------" + meal.getDrink()); } }
UTF-8
Java
518
java
Client.java
Java
[]
null
[]
package N201911.N20191113; public class Client { public static void main(String[] args) { // 服务员 KFCWaiter waiter = new KFCWaiter(); // 套餐A MealA mealA = new MealA(); // 服务员准备套餐A waiter.setMealBuilder(mealA); // 获得套餐 Meal meal = waiter.construct(); System.out.println("<<<------******套餐A的组成部分******------>>>"); System.out.println(meal.getFood() + "------" + meal.getDrink()); } }
518
0.516949
0.487288
19
23.842106
21.88069
72
false
false
0
0
0
0
0
0
0.368421
false
false
13
db3415d024bd849ad342d5f68fd12ba0eadabcc8
31,018,253,857,841
6011595432d3d2c1c620d7a0089d2cb68a330117
/LambdaExpression/src/LambdaExpressionAndTopicsLesson13/Donkey.java
2a6ea3e8068c704839ef9833305da9de7892e17a
[]
no_license
DarakhshanNaiyer/Practice-Labs
https://github.com/DarakhshanNaiyer/Practice-Labs
f76694a03a55e90211a745c6f45386605ae0085b
91313ac656102c64f4cc1e7f7a876eb7718ca4d9
refs/heads/master
2023-04-16T15:30:23.811000
2021-05-05T17:24:11
2021-05-05T17:24:11
364,654,225
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package LambdaExpressionAndTopicsLesson13; public interface Donkey { //interface for default method default void say () { //default method System.out.println("Hello, This is default method."); } void sayMore (String msg) ; //Abstract Method }
UTF-8
Java
251
java
Donkey.java
Java
[]
null
[]
package LambdaExpressionAndTopicsLesson13; public interface Donkey { //interface for default method default void say () { //default method System.out.println("Hello, This is default method."); } void sayMore (String msg) ; //Abstract Method }
251
0.74502
0.737052
9
26.888889
19.969112
55
false
false
0
0
0
0
0
0
1.111111
false
false
13
42f3f7dfaab48178f44c82820562371473a18305
515,396,093,592
e5431a10d8a82b382fa586724be9f804041fa0fe
/gaia-shared/src/main/java/gaia/crawl/io/ContentContentStream.java
cbb676a0e131b91dd062b9ad9830f177e7281497
[]
no_license
whlee21/gaia
https://github.com/whlee21/gaia
65ca1a45e3c85ac0a368a94827e53cf73834d48b
9abcb86b7c2ffc33c39ec1cf66a25e9d2144aae0
refs/heads/master
2022-12-26T14:06:44.067000
2014-05-19T16:15:47
2014-05-19T16:15:47
14,943,649
2
0
null
false
2022-12-14T20:22:44
2013-12-05T04:16:26
2019-01-22T17:14:17
2022-12-14T20:22:41
12,178
3
0
25
Java
false
false
package gaia.crawl.io; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.solr.common.util.ContentStreamBase; public class ContentContentStream extends ContentStreamBase { Content c; public ContentContentStream(Content c) { this.c = c; contentType = c.getFirstMetaValue("Content-Type"); if (contentType == null) { contentType = "application/octet-stream"; } name = c.getKey(); size = Long.valueOf(c.getData() != null ? c.getData().length : 0); } public InputStream getStream() throws IOException { return new ByteArrayInputStream(c.getData() != null ? c.getData() : new byte[0]); } }
UTF-8
Java
670
java
ContentContentStream.java
Java
[]
null
[]
package gaia.crawl.io; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.solr.common.util.ContentStreamBase; public class ContentContentStream extends ContentStreamBase { Content c; public ContentContentStream(Content c) { this.c = c; contentType = c.getFirstMetaValue("Content-Type"); if (contentType == null) { contentType = "application/octet-stream"; } name = c.getKey(); size = Long.valueOf(c.getData() != null ? c.getData().length : 0); } public InputStream getStream() throws IOException { return new ByteArrayInputStream(c.getData() != null ? c.getData() : new byte[0]); } }
670
0.728358
0.725373
24
26.916666
24.50326
83
false
false
0
0
0
0
0
0
1.416667
false
false
13
92b7b32b00a0c9fe714f849f2af78b2ae599bea7
3,899,830,343,744
9731e7c99fcdbf76e0cce52c3f81388fad8c3a86
/client/CardboardSample/src/main/java/com/google/vrtoolkit/cardboard/samples/treasurehunt/User.java
ea2f23be1f203841eb2634d6aed17c85bc930be2
[ "Apache-2.0" ]
permissive
911vs119/VRchatroom
https://github.com/911vs119/VRchatroom
4d3eecfcad9f58ca3b85f75b6793f832fef2499a
cddcca460aac88733f5588911cc398bb959de057
refs/heads/master
2021-01-11T15:36:16.456000
2015-02-16T07:09:23
2015-02-16T07:09:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.vrtoolkit.cardboard.samples.treasurehunt; /** * Created by squirrelrao on 14-12-3. */ public class User { private String ip; private float[] headPosition = new float[]{0f,0f,0f}; public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public float[] getHeadPostion(){ return headPosition; } public void setHeadPosition(float[] position){ this.headPosition = position; } }
UTF-8
Java
499
java
User.java
Java
[ { "context": "cardboard.samples.treasurehunt;\n\n/**\n * Created by squirrelrao on 14-12-3.\n */\npublic class User {\n\n private ", "end": 91, "score": 0.9996574521064758, "start": 80, "tag": "USERNAME", "value": "squirrelrao" } ]
null
[]
package com.google.vrtoolkit.cardboard.samples.treasurehunt; /** * Created by squirrelrao on 14-12-3. */ public class User { private String ip; private float[] headPosition = new float[]{0f,0f,0f}; public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public float[] getHeadPostion(){ return headPosition; } public void setHeadPosition(float[] position){ this.headPosition = position; } }
499
0.619238
0.603206
26
18.192308
18.786287
60
false
false
0
0
0
0
0
0
0.346154
false
false
13
62de48581a81ad5eedaf2d47fa9613cb96db0905
3,169,685,885,918
d3ee1b613edd37f8952c7fff679f2b337cb6ccf9
/project-1/src/main/java/com/revature/models/Employee.java
fbc87ec63fb70f6e3fb73226055df1a419605a42
[]
no_license
ConnorMRyan/legendary-pancake
https://github.com/ConnorMRyan/legendary-pancake
823a9818def6f841d1aaebef039253a80cb93646
e6d56bc1779df195204cd931f0ff74a6a1338f60
refs/heads/main
2023-01-18T18:26:56.827000
2020-12-02T13:20:16
2020-12-02T13:20:16
314,865,739
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.revature.models; import com.revature.utils.PasswordEncoder; import javax.persistence.*; import java.io.Serializable; import java.util.Objects; @Entity @Table(name = "ers_users",schema = "users") public class Employee implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ers_users_id") private int id; @Column(name = "user_first_name") private String firstName; @Column(name = "user_last_name") private String lastName; @Column(name = "ers_username") private String username; @Column(name = "ers_password") private String password; @Column(name = "user_email") private String email; @Column(name = "user_role_id") private int userRole; public Employee(String firstName, String lastName, String username, String password, String email, int userRole) { this.firstName = firstName; this.lastName = lastName; this.username = username; this.password = password; this.email = email; this.userRole = userRole; } public Employee() {} @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Employee)) return false; Employee employee = (Employee) o; return getId() == employee.getId() && getUserRole() == employee.getUserRole() && getFirstName().equals(employee.getFirstName()) && getLastName().equals(employee.getLastName()) && getUsername().equals(employee.getUsername()) && getPassword().equals(employee.getPassword()) && getEmail().equals(employee.getEmail()); } @Override public int hashCode() { return Objects.hash(getId(), getFirstName(), getLastName(), getUsername(), getPassword(), getEmail(), getUserRole()); } @Override public String toString() { return "Employee{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", username='" + username + '\'' + ", password='" + password + '\'' + ", email='" + email + '\'' + ", userRole=" + userRole + '}'; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getUserRole() { return userRole; } public void setUserRole(int userRole) { this.userRole = userRole; } public void setId(Integer id) { this.id = id; } }
UTF-8
Java
3,399
java
Employee.java
Java
[ { "context": " this.lastName = lastName;\n this.username = username;\n this.password = password;\n this.e", "end": 976, "score": 0.9974411725997925, "start": 968, "tag": "USERNAME", "value": "username" }, { "context": " this.username = username;\n this.password = password;\n this.email = email;\n this.userRol", "end": 1010, "score": 0.9989700317382812, "start": 1002, "tag": "PASSWORD", "value": "password" }, { "context": "lastName + '\\'' +\n \", username='\" + username + '\\'' +\n \", password='\" + passwor", "end": 2138, "score": 0.9875277280807495, "start": 2130, "tag": "USERNAME", "value": "username" }, { "context": "username + '\\'' +\n \", password='\" + password + '\\'' +\n \", email='\" + email + '\\", "end": 2189, "score": 0.995233952999115, "start": 2181, "tag": "PASSWORD", "value": "password" }, { "context": "\n\n public String getUsername() {\n return username;\n }\n\n public void setUsername(String userna", "end": 2798, "score": 0.5611355304718018, "start": 2790, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.revature.models; import com.revature.utils.PasswordEncoder; import javax.persistence.*; import java.io.Serializable; import java.util.Objects; @Entity @Table(name = "ers_users",schema = "users") public class Employee implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ers_users_id") private int id; @Column(name = "user_first_name") private String firstName; @Column(name = "user_last_name") private String lastName; @Column(name = "ers_username") private String username; @Column(name = "ers_password") private String password; @Column(name = "user_email") private String email; @Column(name = "user_role_id") private int userRole; public Employee(String firstName, String lastName, String username, String password, String email, int userRole) { this.firstName = firstName; this.lastName = lastName; this.username = username; this.password = <PASSWORD>; this.email = email; this.userRole = userRole; } public Employee() {} @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Employee)) return false; Employee employee = (Employee) o; return getId() == employee.getId() && getUserRole() == employee.getUserRole() && getFirstName().equals(employee.getFirstName()) && getLastName().equals(employee.getLastName()) && getUsername().equals(employee.getUsername()) && getPassword().equals(employee.getPassword()) && getEmail().equals(employee.getEmail()); } @Override public int hashCode() { return Objects.hash(getId(), getFirstName(), getLastName(), getUsername(), getPassword(), getEmail(), getUserRole()); } @Override public String toString() { return "Employee{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", username='" + username + '\'' + ", password='" + <PASSWORD> + '\'' + ", email='" + email + '\'' + ", userRole=" + userRole + '}'; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getUserRole() { return userRole; } public void setUserRole(int userRole) { this.userRole = userRole; } public void setId(Integer id) { this.id = id; } }
3,403
0.574875
0.574875
129
25.348837
21.712231
125
false
false
0
0
0
0
0
0
0.44186
false
false
13
75e6831331b02b2785d4414d3877abf51986f1ad
15,668,040,710,831
d4544cdade08f934f5711eaa92675e0dc138ddcb
/src/main/java/com/groupal/ecommerce/repository/RolRepository.java
76824710a281a846667f7cf91d8264a710b1708a
[]
no_license
alvaroquispe094/ecommerce-spring-boot-security-jpa-postgresql-hibernate
https://github.com/alvaroquispe094/ecommerce-spring-boot-security-jpa-postgresql-hibernate
8e6ca9394be1132cafe6f2a63ad64849edc096a6
d6dbf5fd01b13d96570b8846b09d3277d13fe0c0
refs/heads/master
2022-02-23T16:38:03.658000
2019-08-18T22:50:07
2019-08-18T22:50:07
197,862,826
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.groupal.ecommerce.repository; import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.groupal.ecommerce.model.Rol; @Transactional @Repository public interface RolRepository extends JpaRepository<Rol,Integer>{ }
UTF-8
Java
336
java
RolRepository.java
Java
[]
null
[]
package com.groupal.ecommerce.repository; import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.groupal.ecommerce.model.Rol; @Transactional @Repository public interface RolRepository extends JpaRepository<Rol,Integer>{ }
336
0.842262
0.842262
14
23.071428
24.010307
66
false
false
0
0
0
0
0
0
0.571429
false
false
13
7eed6f1a5467a3928fb43f31a7de2221e59b6fb4
27,238,682,605,578
156d0ebf112982d5dfd3f42d9a0f33a6ef19fa41
/DesgnPatterns/organizaation-heirarchy/src/com/techlabs/builder/OrganizationBuilder.java
6d6ba092bd385df814e279855e141430b4ae5df4
[]
no_license
pratikchaurasia/Swabhav-techlabs
https://github.com/pratikchaurasia/Swabhav-techlabs
a822f2e1360c2477dcf22af66c93364c125a30e5
a9772837af88741cbc101f7295c8c40e42823f77
refs/heads/master
2018-10-22T17:04:19.077000
2018-07-22T15:47:58
2018-07-22T15:47:58
119,146,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.techlabs.builder; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import com.techlabs.employee.Employee; import com.techlabs.parser.FileParser; public class OrganizationBuilder { private FileParser parser; private HashSet<Employee> empList; private List<Employee> employeeList = new ArrayList<Employee>(); private Map<Integer, Employee> employeeMap = new LinkedHashMap<Integer, Employee>(); private DisplayOrganizationalHeirarchy display; EmployeeDTO empDTO; public OrganizationBuilder(DisplayOrganizationalHeirarchy display,FileParser parser) throws FileNotFoundException, IOException { this.parser = parser; this.display=display; employeeList=build(); } public List<Employee> build() throws NumberFormatException, FileNotFoundException, IOException{ for(EmployeeDTO emp : parser.parse()){ employeeList.add(new Employee(Integer.parseInt(emp.getEmployeeId()), emp.getEmployeeName(), emp.getRole(), emp.getManagerId(), emp.getDate(), Integer.parseInt(emp.getSalary()), emp.getCommision(), emp.getDeptId())); } return employeeList; } public Employee getCEO() throws FileNotFoundException, IOException { for (Employee employee : employeeList) { if (employee.getManagerId().equals("NULL") == true) { employeeMap.put(employee.getEmployeeId(), employee); break; } } for (Employee employee : employeeList) { if (employee.getManagerId().equals("NULL") != true) { employeeMap.put(employee.getEmployeeId(), employee); } } for (Employee emp:employeeList){ if(employeeMap.containsKey(emp.getManagerId())){ employeeMap.get(emp.getManagerId()).addReportee(emp); } } return employeeMap.entrySet().iterator().next().getValue(); } public void DisplayHeirarchy() throws FileNotFoundException, IOException{ display.display(this); } }
UTF-8
Java
1,973
java
OrganizationBuilder.java
Java
[]
null
[]
package com.techlabs.builder; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import com.techlabs.employee.Employee; import com.techlabs.parser.FileParser; public class OrganizationBuilder { private FileParser parser; private HashSet<Employee> empList; private List<Employee> employeeList = new ArrayList<Employee>(); private Map<Integer, Employee> employeeMap = new LinkedHashMap<Integer, Employee>(); private DisplayOrganizationalHeirarchy display; EmployeeDTO empDTO; public OrganizationBuilder(DisplayOrganizationalHeirarchy display,FileParser parser) throws FileNotFoundException, IOException { this.parser = parser; this.display=display; employeeList=build(); } public List<Employee> build() throws NumberFormatException, FileNotFoundException, IOException{ for(EmployeeDTO emp : parser.parse()){ employeeList.add(new Employee(Integer.parseInt(emp.getEmployeeId()), emp.getEmployeeName(), emp.getRole(), emp.getManagerId(), emp.getDate(), Integer.parseInt(emp.getSalary()), emp.getCommision(), emp.getDeptId())); } return employeeList; } public Employee getCEO() throws FileNotFoundException, IOException { for (Employee employee : employeeList) { if (employee.getManagerId().equals("NULL") == true) { employeeMap.put(employee.getEmployeeId(), employee); break; } } for (Employee employee : employeeList) { if (employee.getManagerId().equals("NULL") != true) { employeeMap.put(employee.getEmployeeId(), employee); } } for (Employee emp:employeeList){ if(employeeMap.containsKey(emp.getManagerId())){ employeeMap.get(emp.getManagerId()).addReportee(emp); } } return employeeMap.entrySet().iterator().next().getValue(); } public void DisplayHeirarchy() throws FileNotFoundException, IOException{ display.display(this); } }
1,973
0.755702
0.755702
62
30.82258
35.728149
218
false
false
0
0
0
0
0
0
2.112903
false
false
13
a8958d93117d7f1239dc40e4bf23e7085e3d9c39
20,650,202,800,018
eee6c7610d0c0204652b67b37a4f63b0a81da89e
/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/MOTS/MOStaticTabuList.java
14019f327c2c686223ae523de33c1176326fef8a
[ "MIT" ]
permissive
TarasGit/jMetal
https://github.com/TarasGit/jMetal
0f4bf01519f1c43aa41b3a5dc00260a176f57d59
8d2b2527135b7c97115f2602456a04807d5a55be
refs/heads/master
2021-09-11T18:09:06.009000
2018-04-10T17:26:46
2018-04-10T17:26:46
114,406,145
0
0
null
true
2017-12-15T19:49:37
2017-12-15T19:49:37
2017-12-12T11:32:14
2017-12-15T12:10:31
135,733
0
0
0
null
false
null
package org.uma.jmetal.algorithm.multiobjective.MOTS; import java.util.Iterator; import org.apache.commons.collections4.queue.CircularFifoQueue; import org.uma.jmetal.solution.Solution; public final class MOStaticTabuList<S extends Solution<?>> implements MOTabuList<S> { private CircularFifoQueue<S> tabuList; public MOStaticTabuList(Integer size) { this.tabuList = new CircularFifoQueue<S>(size); } public MOStaticTabuList() { } @Override public void add(S solution) { tabuList.add(solution); } @Override public Boolean contains(S solution) { return tabuList.contains(solution); } @Override public Iterator<S> iterator() { return tabuList.iterator(); } }
UTF-8
Java
690
java
MOStaticTabuList.java
Java
[]
null
[]
package org.uma.jmetal.algorithm.multiobjective.MOTS; import java.util.Iterator; import org.apache.commons.collections4.queue.CircularFifoQueue; import org.uma.jmetal.solution.Solution; public final class MOStaticTabuList<S extends Solution<?>> implements MOTabuList<S> { private CircularFifoQueue<S> tabuList; public MOStaticTabuList(Integer size) { this.tabuList = new CircularFifoQueue<S>(size); } public MOStaticTabuList() { } @Override public void add(S solution) { tabuList.add(solution); } @Override public Boolean contains(S solution) { return tabuList.contains(solution); } @Override public Iterator<S> iterator() { return tabuList.iterator(); } }
690
0.756522
0.755072
35
18.714285
21.942225
85
false
false
0
0
0
0
0
0
0.885714
false
false
13
536dfc72365f4f781879ea8d78d3bb217eb28de8
8,718,783,659,772
26bc37da84d71b963a416286538a5611484297bd
/hrms/src/main/java/kodlamaio/hrms/dataAccess/abstracts/VerificationEmployerDao.java
e4566bcfcf6bedd29f35a332e57d229f7cbe31ed
[ "MIT" ]
permissive
rzayevsahil/HRMS
https://github.com/rzayevsahil/HRMS
a817c107bfc15bfc6efcc37cc71bc0aad349ff82
64f0c45338626b250164d8d8105460ea80392faf
refs/heads/main
2023-06-12T11:29:23.845000
2021-07-07T15:23:31
2021-07-07T15:23:31
366,253,294
37
8
MIT
false
2021-07-08T23:16:02
2021-05-11T04:20:24
2021-07-08T19:37:33
2021-07-07T15:23:32
883
29
1
1
Java
false
false
package kodlamaio.hrms.dataAccess.abstracts; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import kodlamaio.hrms.entities.concretes.VerificationEmployer; public interface VerificationEmployerDao extends JpaRepository<VerificationEmployer, Integer> { VerificationEmployer getById(int userId); @Query("From VerificationEmployer where is_verified=false") List<VerificationEmployer> getAllByVerifyFalse(); }
UTF-8
Java
506
java
VerificationEmployerDao.java
Java
[]
null
[]
package kodlamaio.hrms.dataAccess.abstracts; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import kodlamaio.hrms.entities.concretes.VerificationEmployer; public interface VerificationEmployerDao extends JpaRepository<VerificationEmployer, Integer> { VerificationEmployer getById(int userId); @Query("From VerificationEmployer where is_verified=false") List<VerificationEmployer> getAllByVerifyFalse(); }
506
0.841897
0.841897
16
30.625
30.287941
95
false
false
0
0
0
0
0
0
0.6875
false
false
13
7ef05b2a2e5ffe810e24e6b51269b81a1ddbf88e
24,575,802,926,106
32c975bf29edd59002aa3bd52d38d183b3f57b54
/src/main/java/br/com/dayanemt/dentistmanager/model/Procedure.java
4b1124c6f0759a55798d2b8ce56f3826ae5fcea1
[]
no_license
daymartins/dentist-manager
https://github.com/daymartins/dentist-manager
ff3d4328de3f74e9eb5444ffcfd46d65955a19cd
1ce534f2c0aa5362f7c5345e4c494098e3366954
refs/heads/master
2021-01-07T00:12:32.105000
2020-03-11T02:49:43
2020-03-11T02:49:43
241,522,236
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.dayanemt.dentistmanager.model; import br.com.dayanemt.dentistmanager.enums.ProcedureCategory; import javax.persistence.*; import java.util.Objects; import java.util.Set; @Entity public class Procedure { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private Double price; @Enumerated(EnumType.STRING) private ProcedureCategory procedureCategory; @OneToMany(mappedBy = "procedure") private Set<PatientProcedure> patientProcedures; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Procedure procedure = (Procedure) o; return Objects.equals(id, procedure.id); } @Override public int hashCode() { return Objects.hash(id); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public ProcedureCategory getProcedureCategory() { return procedureCategory; } public void setProcedureCategory(ProcedureCategory procedureCategory) { this.procedureCategory = procedureCategory; } public Set<PatientProcedure> getPatientProcedures() { return patientProcedures; } public void setPatientProcedures(Set<PatientProcedure> patientProcedures) { this.patientProcedures = patientProcedures; } }
UTF-8
Java
1,723
java
Procedure.java
Java
[]
null
[]
package br.com.dayanemt.dentistmanager.model; import br.com.dayanemt.dentistmanager.enums.ProcedureCategory; import javax.persistence.*; import java.util.Objects; import java.util.Set; @Entity public class Procedure { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private Double price; @Enumerated(EnumType.STRING) private ProcedureCategory procedureCategory; @OneToMany(mappedBy = "procedure") private Set<PatientProcedure> patientProcedures; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Procedure procedure = (Procedure) o; return Objects.equals(id, procedure.id); } @Override public int hashCode() { return Objects.hash(id); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public ProcedureCategory getProcedureCategory() { return procedureCategory; } public void setProcedureCategory(ProcedureCategory procedureCategory) { this.procedureCategory = procedureCategory; } public Set<PatientProcedure> getPatientProcedures() { return patientProcedures; } public void setPatientProcedures(Set<PatientProcedure> patientProcedures) { this.patientProcedures = patientProcedures; } }
1,723
0.656994
0.656994
77
21.376623
20.868816
79
false
false
0
0
0
0
0
0
0.363636
false
false
13
a149021c3059207d9c993ff5d6e5fbdcb8643200
12,816,182,480,126
a102601805208987a2234b74ee20b679f3f97fdd
/androidManager/src/main/java/com/centit/app/cmipThirtpart/cmippushmgr/PushTypeVo.java
6f68544ef945de28ba76d24b0cdd9fd6b2563f1d
[ "Apache-2.0" ]
permissive
pzhpengpeng/message
https://github.com/pzhpengpeng/message
50b5324f52b93cddf56633459e811e12426d0e89
12c4f6fc418e31cc05228c2cab3eac795709d126
refs/heads/master
2021-08-14T10:46:37.463000
2017-11-15T12:50:29
2017-11-15T12:50:29
293,481,088
1
0
Apache-2.0
true
2020-09-07T09:23:10
2020-09-07T09:23:09
2020-09-07T09:23:06
2017-11-15T12:50:57
524
0
0
0
null
false
false
package com.centit.app.cmipThirtpart.cmippushmgr; public class PushTypeVo { private String type; private String message; /** * 获取 message * * @return 返回 message * @author wang_ling */ public String getMessage() { return message; } /** * 设置 message * * @param message 对message进行赋值 * @author wang_ling */ public void setMessage(String message) { this.message = message; } public PushTypeVo() { super(); } public PushTypeVo(String type) { super(); this.type = type; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
UTF-8
Java
822
java
PushTypeVo.java
Java
[ { "context": "e\n * \n * @return 返回 message\n * @author wang_ling\n */\n public String getMessage()\n {\n ", "end": 224, "score": 0.9990946650505066, "start": 215, "tag": "USERNAME", "value": "wang_ling" }, { "context": "\n * @param message 对message进行赋值\n * @author wang_ling\n */\n public void setMessage(String message", "end": 398, "score": 0.9991405010223389, "start": 389, "tag": "USERNAME", "value": "wang_ling" } ]
null
[]
package com.centit.app.cmipThirtpart.cmippushmgr; public class PushTypeVo { private String type; private String message; /** * 获取 message * * @return 返回 message * @author wang_ling */ public String getMessage() { return message; } /** * 设置 message * * @param message 对message进行赋值 * @author wang_ling */ public void setMessage(String message) { this.message = message; } public PushTypeVo() { super(); } public PushTypeVo(String type) { super(); this.type = type; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
822
0.505
0.505
51
14.686275
12.200112
49
false
false
0
0
0
0
0
0
0.196078
false
false
13
12881e04f616de37ba1ba1fbe7a9ec4a51790d2c
16,544,214,085,236
ca610db19e74a1b676f26b5902e1416a0ff3a8d1
/ERP_web/src/main/java/snow/ave/erp/action/RoleAction.java
56ea0a417ac03096cd0a2ae539a71a8ab02cfc9f
[]
no_license
shadowonder/ERP_System
https://github.com/shadowonder/ERP_System
2685eb256d93752de79f247674bbca3d9a49b9a7
6884ccd1963c10248199b6eac41e2843e7d2bb6b
refs/heads/master
2020-04-29T14:52:57.384000
2019-03-18T05:29:01
2019-03-18T05:29:01
176,209,979
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package snow.ave.erp.action; import java.util.List; import com.alibaba.fastjson.JSON; import snow.ave.erp.biz.IRoleBiz; import snow.ave.erp.entity.Role; import snow.ave.erp.entity.Tree; /** * user Role Action * */ @SuppressWarnings("serial") public class RoleAction extends BaseAction<Role> { private IRoleBiz roleBiz; public void setRoleBiz(IRoleBiz roleBiz) { this.roleBiz = roleBiz; super.setBaseBiz(this.roleBiz); } public void getRoleMenus(){ List<Tree> menus = roleBiz.getRoleMenus(getUuid()); writeToPage(JSON.toJSONString(menus)); } private String checkedStr;//checked strings public String getCheckedStr() { return checkedStr; } public void setCheckedStr(String checkedStr) { this.checkedStr = checkedStr; } /** * Update role */ public void updateRoleMenus(){ try { System.out.println(checkedStr); roleBiz.updateRoleMenus(getUuid(), checkedStr); returnJSON(true, "Update success"); } catch (Exception e) { returnJSON(false, "Update Failed"); e.printStackTrace(); } } }
UTF-8
Java
1,049
java
RoleAction.java
Java
[]
null
[]
package snow.ave.erp.action; import java.util.List; import com.alibaba.fastjson.JSON; import snow.ave.erp.biz.IRoleBiz; import snow.ave.erp.entity.Role; import snow.ave.erp.entity.Tree; /** * user Role Action * */ @SuppressWarnings("serial") public class RoleAction extends BaseAction<Role> { private IRoleBiz roleBiz; public void setRoleBiz(IRoleBiz roleBiz) { this.roleBiz = roleBiz; super.setBaseBiz(this.roleBiz); } public void getRoleMenus(){ List<Tree> menus = roleBiz.getRoleMenus(getUuid()); writeToPage(JSON.toJSONString(menus)); } private String checkedStr;//checked strings public String getCheckedStr() { return checkedStr; } public void setCheckedStr(String checkedStr) { this.checkedStr = checkedStr; } /** * Update role */ public void updateRoleMenus(){ try { System.out.println(checkedStr); roleBiz.updateRoleMenus(getUuid(), checkedStr); returnJSON(true, "Update success"); } catch (Exception e) { returnJSON(false, "Update Failed"); e.printStackTrace(); } } }
1,049
0.714013
0.714013
53
18.792454
17.057459
53
false
false
0
0
0
0
0
0
1.415094
false
false
13
dbffee91049daa48ca3a88d5785341a410f0dceb
24,893,630,492,528
e48985fdf73f191445798e79ae2813e987cb150c
/src/test/_20_Member.java
9738a3345380fe20774935b9797df08c5e2f4062
[]
no_license
behappyleee/JavaTutorial
https://github.com/behappyleee/JavaTutorial
755212831fb2a79f614dbac3449118ab0b326633
83519e877fd8f236165ae0d672a0d5cbcce99366
refs/heads/master
2023-03-06T08:00:41.856000
2021-02-17T13:28:47
2021-02-17T13:28:47
339,708,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; public class _20_Member { private int memberId; private String memberName; public _20_Member() { } public _20_Member (int memberId, String memberName){ this.memberId=memberId; this.memberName=memberName; } public void setMemberId(int memberId){ this.memberId=memberId; } public int getMemberId(){ //public 오타 return this.memberId; } public void setMemberName(String memberName){ this.memberName=memberName; } public String getMemberName(){ return this.memberName; } public String toString (){ //toString 띄어쓰기함 return memberId +"는 이름은 : " + memberName; } }
UTF-8
Java
689
java
_20_Member.java
Java
[]
null
[]
package test; public class _20_Member { private int memberId; private String memberName; public _20_Member() { } public _20_Member (int memberId, String memberName){ this.memberId=memberId; this.memberName=memberName; } public void setMemberId(int memberId){ this.memberId=memberId; } public int getMemberId(){ //public 오타 return this.memberId; } public void setMemberName(String memberName){ this.memberName=memberName; } public String getMemberName(){ return this.memberName; } public String toString (){ //toString 띄어쓰기함 return memberId +"는 이름은 : " + memberName; } }
689
0.655172
0.646177
35
18.085714
17.086956
55
false
false
0
0
0
0
0
0
2.657143
false
false
13
55fbb1eeab36400fb8d9dd1046579fd4e6f68077
11,072,425,702,798
ebd634fce5dca70c3f1e5216e87cb35fb65bc59d
/src/handler/order/OrderUpProHandler.java
a0909ffba2265f2ace698884b31696207343c719
[]
no_license
thjang93/dahae
https://github.com/thjang93/dahae
a15b109fe86d51cc389084b224cf3edf82ee5940
1b5b7764da31f37468f2ee893f01034e36fed4dd
refs/heads/master
2020-12-29T14:05:56.433000
2020-02-08T10:57:23
2020-02-08T10:57:23
238,631,457
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package handler.order; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import handler.CommandHandler; import order.OrderDBBean; import order.OrderDataBean; public class OrderUpProHandler implements CommandHandler { @Override public String process(HttpServletRequest request, HttpServletResponse respose) throws Throwable { request.setCharacterEncoding("utf-8"); OrderDataBean orderDto = new OrderDataBean(); orderDto.setOrder_state(request.getParameter("order_state")); orderDto.setTrack_com(request.getParameter("track_com")); if( !request.getParameter("track_num").equals("") && request.getParameter("track_num") != null ){ orderDto.setTrack_num(Integer.parseInt(request.getParameter("track_num"))); } orderDto.setOrder_number(Integer.parseInt(request.getParameter("order_number"))); OrderDBBean orderDao = OrderDBBean.getInstance(); int result = orderDao.updateArticle(orderDto); request.setAttribute("result", result); return "/order/orderUpPro.jsp"; } }
UTF-8
Java
1,183
java
OrderUpProHandler.java
Java
[]
null
[]
package handler.order; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import handler.CommandHandler; import order.OrderDBBean; import order.OrderDataBean; public class OrderUpProHandler implements CommandHandler { @Override public String process(HttpServletRequest request, HttpServletResponse respose) throws Throwable { request.setCharacterEncoding("utf-8"); OrderDataBean orderDto = new OrderDataBean(); orderDto.setOrder_state(request.getParameter("order_state")); orderDto.setTrack_com(request.getParameter("track_com")); if( !request.getParameter("track_num").equals("") && request.getParameter("track_num") != null ){ orderDto.setTrack_num(Integer.parseInt(request.getParameter("track_num"))); } orderDto.setOrder_number(Integer.parseInt(request.getParameter("order_number"))); OrderDBBean orderDao = OrderDBBean.getInstance(); int result = orderDao.updateArticle(orderDto); request.setAttribute("result", result); return "/order/orderUpPro.jsp"; } }
1,183
0.6847
0.683855
37
29.972973
30.806709
105
false
false
0
0
0
0
0
0
1.189189
false
false
13
925c77ed10c56583f01f8282a9dfc2e93a635b3b
1,005,022,349,367
68e44e3943a568fe9e6a99523bc62281945a7bd6
/camunda/src/main/java/com/gonwan/toys/camunda/controller/ArticleWorkflowController.java
a50edbc955e7b1393981cc183160f56aa8d5d9c9
[]
no_license
gonwan/toys
https://github.com/gonwan/toys
cba914219b315ab532ed0a924f919683fbe627dc
9f0fe1fabc3b5403af26122e6b9c34d7333c5eb4
refs/heads/master
2023-07-27T07:12:04.631000
2023-07-12T06:47:59
2023-07-12T06:47:59
22,635,772
7
3
null
false
2023-05-05T02:41:44
2014-08-05T08:12:32
2022-12-14T22:29:12
2023-05-05T02:41:43
5,702
6
0
4
Java
false
false
package com.gonwan.toys.camunda.controller; import com.gonwan.toys.camunda.domain.Approval; import com.gonwan.toys.camunda.domain.Article; import com.gonwan.toys.camunda.service.ArticleWorkflowService; import org.camunda.bpm.engine.history.HistoricActivityInstance; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class ArticleWorkflowController { @Autowired private ArticleWorkflowService service; @PostMapping("/submit") public void submit(@RequestBody Article article) { service.startProcess(article); } @GetMapping("/tasks") public List<Article> getTasks(@RequestParam String assignee) { return service.getTasks(assignee); } @PostMapping("/review") public void review(@RequestBody Approval approval) { service.submitReview(approval); } @GetMapping("/history/list") public List<HistoricProcessInstance> historyList() { return service.historyList(); } @GetMapping("/history/get") public List<HistoricActivityInstance> historyGet(String id) { return service.historyGet(id); } @GetMapping("/definition/get") public List<String> definitionGet(String id) { return service.definitionGet(id); } }
UTF-8
Java
1,406
java
ArticleWorkflowController.java
Java
[]
null
[]
package com.gonwan.toys.camunda.controller; import com.gonwan.toys.camunda.domain.Approval; import com.gonwan.toys.camunda.domain.Article; import com.gonwan.toys.camunda.service.ArticleWorkflowService; import org.camunda.bpm.engine.history.HistoricActivityInstance; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class ArticleWorkflowController { @Autowired private ArticleWorkflowService service; @PostMapping("/submit") public void submit(@RequestBody Article article) { service.startProcess(article); } @GetMapping("/tasks") public List<Article> getTasks(@RequestParam String assignee) { return service.getTasks(assignee); } @PostMapping("/review") public void review(@RequestBody Approval approval) { service.submitReview(approval); } @GetMapping("/history/list") public List<HistoricProcessInstance> historyList() { return service.historyList(); } @GetMapping("/history/get") public List<HistoricActivityInstance> historyGet(String id) { return service.historyGet(id); } @GetMapping("/definition/get") public List<String> definitionGet(String id) { return service.definitionGet(id); } }
1,406
0.733286
0.733286
49
27.693878
22.909052
66
false
false
0
0
0
0
0
0
0.326531
false
false
13
379140dd2cc9b97c3e9dc16bdd67ffe8734343f2
1,005,022,347,647
c742cc5d181dd6105a26d586f513177a18e28250
/src/revision/BSearch_lc_kth_smallest_pair_distance.java
c9a530f195073479fa47d7ee85cb00abb31422c8
[]
no_license
gaurirawat/Coding
https://github.com/gaurirawat/Coding
a5542f71be5da538cc438a8d4070ce4c748ee044
d69fb40befbf9a30774b723fff90ae7cba384f7a
refs/heads/master
2023-02-20T00:33:31.632000
2021-01-22T11:49:14
2021-01-22T11:49:14
275,333,532
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package revision; import java.util.Arrays; //https://leetcode.com/problems/find-k-th-smallest-pair-distance/ public class BSearch_lc_kth_smallest_pair_distance { public int smallestDistancePair(int[] nums, int k) { Arrays.sort(nums); int l = 0; int r = nums[nums.length - 1] - nums[0]; int answer = 0; while (l <= r) { int mid = l + (r - l) / 2; int count = countPairsLessThanMid(nums, mid); if (count < k) { answer = mid; l = mid + 1; } else { r = mid - 1; } } return answer; } public int countPairsLessThanMid(int[] nums, int mid) { int count = 0; for (int i = 0; i < nums.length; ++i) { int invalidPair = nums[i] + mid; int pos = Arrays.binarySearch(nums, invalidPair); if (pos < 0) { pos = Math.abs(pos + 1); } while (pos != 0 && pos != nums.length && nums[pos - 1] == invalidPair) { --pos; } count += pos - i - 1; } return count; } }
UTF-8
Java
1,170
java
BSearch_lc_kth_smallest_pair_distance.java
Java
[]
null
[]
package revision; import java.util.Arrays; //https://leetcode.com/problems/find-k-th-smallest-pair-distance/ public class BSearch_lc_kth_smallest_pair_distance { public int smallestDistancePair(int[] nums, int k) { Arrays.sort(nums); int l = 0; int r = nums[nums.length - 1] - nums[0]; int answer = 0; while (l <= r) { int mid = l + (r - l) / 2; int count = countPairsLessThanMid(nums, mid); if (count < k) { answer = mid; l = mid + 1; } else { r = mid - 1; } } return answer; } public int countPairsLessThanMid(int[] nums, int mid) { int count = 0; for (int i = 0; i < nums.length; ++i) { int invalidPair = nums[i] + mid; int pos = Arrays.binarySearch(nums, invalidPair); if (pos < 0) { pos = Math.abs(pos + 1); } while (pos != 0 && pos != nums.length && nums[pos - 1] == invalidPair) { --pos; } count += pos - i - 1; } return count; } }
1,170
0.45812
0.446154
41
27.560976
20.27981
84
false
false
0
0
0
0
0
0
0.609756
false
false
13
f7be52f1db9907a15569ce5752d6f0dc47899b82
4,234,837,768,494
2e8336c191a0e32501bd80cff5de48fe002273be
/com.whd.system/src/main/java/com/whd/system/domain/BaseNotice.java
8cc18ffdf57e87e63261df7db377f7832b773431
[]
no_license
mxcfd/parent-maven
https://github.com/mxcfd/parent-maven
c8081efc2821176c9a80003b3f25d6bcab9e6fb5
2a9fbede7c53ea14a964df6b573bee709a3ea13d
refs/heads/master
2020-11-24T22:15:12.325000
2020-10-26T09:35:01
2020-10-27T00:38:49
228,361,118
0
0
null
false
2021-01-21T00:44:16
2019-12-16T10:26:47
2020-10-27T00:40:44
2021-01-21T00:44:14
15,176
0
0
8
JavaScript
false
false
package com.whd.system.domain; import java.util.LinkedHashMap; import java.util.Map; /** * BaseNotice entity. * 系统通知公告表 * @since 2012/06/22 * @version 1.0.1 * @author whd */ @SuppressWarnings("serial") public class BaseNotice implements java.io.Serializable { private String id; private String title; private String type; private String content;//内容 private String adduserid; private String adduser; private String adddate;//(DateUtil.fullTime() ) private String iswarn;//是否警示(y是,n否) private String warndate;//警示过期日期,过期后 iswarn=“n” public static Map<String,String> NOTICE_TYPE = new LinkedHashMap<String,String>(){ {put("1","通知公告");} {put("2","最新消息");} {put("3","规章制度");} {put("4","下载专区");} {put("9","其他");} }; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getAdduserid() { return adduserid; } public void setAdduserid(String adduserid) { this.adduserid = adduserid; } public String getAdduser() { return adduser; } public void setAdduser(String adduser) { this.adduser = adduser; } public String getAdddate() { return adddate; } public void setAdddate(String adddate) { this.adddate = adddate; } public String getIswarn() { return iswarn; } public void setIswarn(String iswarn) { this.iswarn = iswarn; } public String getWarndate() { return warndate; } public void setWarndate(String warndate) { this.warndate = warndate; } public static Map<String, String> getNoticeType() { return NOTICE_TYPE; } public static void setNoticeType(Map<String, String> noticeType) { NOTICE_TYPE = noticeType; } }
UTF-8
Java
2,089
java
BaseNotice.java
Java
[ { "context": "\n * @since 2012/06/22\n * @version 1.0.1\n * @author whd\n */\n\n@SuppressWarnings(\"serial\")\npublic class Bas", "end": 176, "score": 0.9996642470359802, "start": 173, "tag": "USERNAME", "value": "whd" } ]
null
[]
package com.whd.system.domain; import java.util.LinkedHashMap; import java.util.Map; /** * BaseNotice entity. * 系统通知公告表 * @since 2012/06/22 * @version 1.0.1 * @author whd */ @SuppressWarnings("serial") public class BaseNotice implements java.io.Serializable { private String id; private String title; private String type; private String content;//内容 private String adduserid; private String adduser; private String adddate;//(DateUtil.fullTime() ) private String iswarn;//是否警示(y是,n否) private String warndate;//警示过期日期,过期后 iswarn=“n” public static Map<String,String> NOTICE_TYPE = new LinkedHashMap<String,String>(){ {put("1","通知公告");} {put("2","最新消息");} {put("3","规章制度");} {put("4","下载专区");} {put("9","其他");} }; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getAdduserid() { return adduserid; } public void setAdduserid(String adduserid) { this.adduserid = adduserid; } public String getAdduser() { return adduser; } public void setAdduser(String adduser) { this.adduser = adduser; } public String getAdddate() { return adddate; } public void setAdddate(String adddate) { this.adddate = adddate; } public String getIswarn() { return iswarn; } public void setIswarn(String iswarn) { this.iswarn = iswarn; } public String getWarndate() { return warndate; } public void setWarndate(String warndate) { this.warndate = warndate; } public static Map<String, String> getNoticeType() { return NOTICE_TYPE; } public static void setNoticeType(Map<String, String> noticeType) { NOTICE_TYPE = noticeType; } }
2,089
0.685714
0.677694
115
16.356522
16.672911
83
false
false
0
0
0
0
0
0
1.321739
false
false
13
6b745e23891ddf78731715f8ce24a5e368592385
24,206,435,728,685
c035a692df3f0c1c6c92aa00ddd9c29481a27311
/eoto/xm/eoto/xm/Menu.java
efcd9e76da67358be54367fc96b5cf375748c7a4
[]
no_license
wohenjiujie/End-of-the-operation-4.0
https://github.com/wohenjiujie/End-of-the-operation-4.0
a1f75dc985e8c217e58d5cc3d7f04ac1dedac8ad
8a9a353266b53c986fd2f0b3a70d6a4979a28b7d
refs/heads/master
2020-07-29T23:48:54.600000
2019-09-21T15:11:17
2019-09-21T15:11:17
210,006,207
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package eoto.xm; import java.io.*; import java.util.*; public class Menu { @SuppressWarnings("resource") protected static void menu() throws IOException { while(true) { System.out.println("*******************"); System.out.println("* 1.宠物商店 *"); System.out.println("* 2.照看宠物 *"); System.out.println("* 3.修改信息 *"); System.out.println("* 4.客户活动 *"); System.out.println("* 5.退出系统 *"); System.out.println("*******************"); String cho=new Scanner(System.in).nextLine(); while((cho.equals("1")||cho.equals("2")|| cho.equals("3")||cho.equals("4")||cho.equals("5"))==false) { System.out.println("请输入正确的选项哦:"); cho=new Scanner(System.in).nextLine(); } if(cho.equals("1")) { Summit.type(true); } if(cho.equals("2")) { int result=Duplicate.check(Attributes.getHost()); if(result==0) { System.out.println("您还未领养任何宠物!oo\n\n"); } if(result>0) { System.out.println("正在读取你的宠物信息..."); HostInfo.sweetie(); } } if(cho.equals("3")) { Modify.choice(); } if(cho.equals("4")) { Lottery.ld(); } if(cho.equals("5")) { extracted(); } } } private static void extracted() throws IOException { System.out.println("感谢使用!!!"); Start.main(null); } }
UTF-8
Java
1,423
java
Menu.java
Java
[]
null
[]
package eoto.xm; import java.io.*; import java.util.*; public class Menu { @SuppressWarnings("resource") protected static void menu() throws IOException { while(true) { System.out.println("*******************"); System.out.println("* 1.宠物商店 *"); System.out.println("* 2.照看宠物 *"); System.out.println("* 3.修改信息 *"); System.out.println("* 4.客户活动 *"); System.out.println("* 5.退出系统 *"); System.out.println("*******************"); String cho=new Scanner(System.in).nextLine(); while((cho.equals("1")||cho.equals("2")|| cho.equals("3")||cho.equals("4")||cho.equals("5"))==false) { System.out.println("请输入正确的选项哦:"); cho=new Scanner(System.in).nextLine(); } if(cho.equals("1")) { Summit.type(true); } if(cho.equals("2")) { int result=Duplicate.check(Attributes.getHost()); if(result==0) { System.out.println("您还未领养任何宠物!oo\n\n"); } if(result>0) { System.out.println("正在读取你的宠物信息..."); HostInfo.sweetie(); } } if(cho.equals("3")) { Modify.choice(); } if(cho.equals("4")) { Lottery.ld(); } if(cho.equals("5")) { extracted(); } } } private static void extracted() throws IOException { System.out.println("感谢使用!!!"); Start.main(null); } }
1,423
0.549124
0.536177
51
24.745098
17.847769
65
false
false
0
0
0
0
0
0
3.294118
false
false
13
f644e07f0f0a97fdd20cfb35d9ccbc51166b244e
14,774,687,536,673
9abf1c80558586f60408c4741a827c9615fcd90d
/library/src/main/java/ie/programmer/filemq/service/FileLoader.java
9c06e11f941e1007386a008cc2efaf863ec372df
[]
no_license
ernan/filemq
https://github.com/ernan/filemq
464fb684f58227411d952cde5c5337d1fb775f91
9b3d450eef57187b13b1190615715209ece922b7
refs/heads/master
2016-08-11T07:13:33.617000
2016-02-01T22:23:56
2016-02-01T22:23:56
50,875,829
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ie.programmer.filemq.service; import android.content.AsyncTaskLoader; import android.content.Context; import android.os.FileObserver; import java.io.File; import java.util.Arrays; import java.util.List; public class FileLoader extends AsyncTaskLoader<List<String>> { private List<String> mFileNames; private InBoxObserver mInBoxObserver; private String mInBoxPath; public FileLoader(Context context, String inBoxPath) { super(context); mInBoxPath = inBoxPath; mInBoxObserver = new InBoxObserver(mInBoxPath); } @Override protected void onStartLoading() { super.onStartLoading(); mInBoxObserver.startWatching(); if (mFileNames != null) { deliverResult(mFileNames); } if (takeContentChanged() || mFileNames == null) { forceLoad(); } } @Override public List<String> loadInBackground() { File directory = new File(mInBoxPath); return Arrays.asList(directory.list()); } @Override public void deliverResult(List<String> data) { if (isReset()) { return; } mFileNames = data; if (isStarted()) { super.deliverResult(data); } } @Override protected void onStopLoading() { super.onStopLoading(); cancelLoad(); } @Override protected void onReset() { super.onReset(); mInBoxObserver.stopWatching(); clearResources(); } private void clearResources() { mFileNames = null; } private class InBoxObserver extends FileObserver { public InBoxObserver(String path) { super(path, FileObserver.CREATE | FileObserver.DELETE); } @Override public void onEvent(int event, String path) { onContentChanged(); } } }
UTF-8
Java
1,888
java
FileLoader.java
Java
[]
null
[]
package ie.programmer.filemq.service; import android.content.AsyncTaskLoader; import android.content.Context; import android.os.FileObserver; import java.io.File; import java.util.Arrays; import java.util.List; public class FileLoader extends AsyncTaskLoader<List<String>> { private List<String> mFileNames; private InBoxObserver mInBoxObserver; private String mInBoxPath; public FileLoader(Context context, String inBoxPath) { super(context); mInBoxPath = inBoxPath; mInBoxObserver = new InBoxObserver(mInBoxPath); } @Override protected void onStartLoading() { super.onStartLoading(); mInBoxObserver.startWatching(); if (mFileNames != null) { deliverResult(mFileNames); } if (takeContentChanged() || mFileNames == null) { forceLoad(); } } @Override public List<String> loadInBackground() { File directory = new File(mInBoxPath); return Arrays.asList(directory.list()); } @Override public void deliverResult(List<String> data) { if (isReset()) { return; } mFileNames = data; if (isStarted()) { super.deliverResult(data); } } @Override protected void onStopLoading() { super.onStopLoading(); cancelLoad(); } @Override protected void onReset() { super.onReset(); mInBoxObserver.stopWatching(); clearResources(); } private void clearResources() { mFileNames = null; } private class InBoxObserver extends FileObserver { public InBoxObserver(String path) { super(path, FileObserver.CREATE | FileObserver.DELETE); } @Override public void onEvent(int event, String path) { onContentChanged(); } } }
1,888
0.612818
0.612818
78
23.205128
18.125883
67
false
false
0
0
0
0
0
0
0.461538
false
false
13
1c7aeeaf89cc005bb55bd7e316bd2cefd260e9ba
936,302,891,058
fdcdd40ff669381a71cec8fa90e770936ad26a4e
/modules/web/src/com/haulmont/addon/imap/web/imapmailbox/ImapMailBoxBrowse.java
fed99cc24cd4b9610c9febff9c821a75737ba625
[ "Apache-2.0" ]
permissive
CodeFusionReactor/imap-addon
https://github.com/CodeFusionReactor/imap-addon
21b78aeb68c5f3e8ffe766b019571d17407f486b
e042f7feb9f642ae43d563946d25d3469782a809
refs/heads/master
2020-03-18T20:05:35.603000
2018-05-24T16:11:21
2018-05-24T16:11:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.haulmont.addon.imap.web.imapmailbox; import com.haulmont.cuba.gui.components.AbstractLookup; public class ImapMailBoxBrowse extends AbstractLookup { }
UTF-8
Java
164
java
ImapMailBoxBrowse.java
Java
[]
null
[]
package com.haulmont.addon.imap.web.imapmailbox; import com.haulmont.cuba.gui.components.AbstractLookup; public class ImapMailBoxBrowse extends AbstractLookup { }
164
0.841463
0.841463
6
26.5
26.27261
55
false
false
0
0
0
0
0
0
0.333333
false
false
13
1ee9705fde2bea34983bd291c7510840122012f9
36,034,775,638,713
ef9e4f4c042b9f911d854a70598733ffd036407c
/src/Solution018.java
80e25522f69bba2322ad1e75b349e2cadf2dba6b
[]
no_license
NanCarp/LeetCode
https://github.com/NanCarp/LeetCode
a0664f74a1db76ece9061f26ccf4336b82e3dc9f
925b7a034ef6b8ebfdbc0c67f6c6b8705d84841b
refs/heads/master
2021-01-01T19:08:33.971000
2019-05-22T14:07:45
2019-05-22T14:07:45
98,516,640
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by nanca on 12/18/2018. */ public class Solution018 { public static String longestCommonPrefix(String[] strs) { String r = ""; if (strs == null || strs.length < 1) { return ""; } String first = strs[0]; if ("".equals(first)) { return ""; } int x = 0; while (x < first.length()) { char c = first.charAt(x); boolean equal = true; for (int i = 1; i < strs.length; i++) { if (strs[i].length() <= x || strs[i].charAt(x) != c) { equal = false; break; } } if (!equal) { break; } x++; r+=c; } return r; } public static void main(String[] args) { System.out.println(longestCommonPrefix(new String[]{"flower", "flow", "flight"})); System.out.println(longestCommonPrefix(new String[]{"dog","racecar","car"})); System.out.println(longestCommonPrefix(new String[]{"c","c"})); } }
UTF-8
Java
1,112
java
Solution018.java
Java
[ { "context": "/**\n * Created by nanca on 12/18/2018.\n */\npublic class Solution018 {\n ", "end": 23, "score": 0.9989527463912964, "start": 18, "tag": "USERNAME", "value": "nanca" } ]
null
[]
/** * Created by nanca on 12/18/2018. */ public class Solution018 { public static String longestCommonPrefix(String[] strs) { String r = ""; if (strs == null || strs.length < 1) { return ""; } String first = strs[0]; if ("".equals(first)) { return ""; } int x = 0; while (x < first.length()) { char c = first.charAt(x); boolean equal = true; for (int i = 1; i < strs.length; i++) { if (strs[i].length() <= x || strs[i].charAt(x) != c) { equal = false; break; } } if (!equal) { break; } x++; r+=c; } return r; } public static void main(String[] args) { System.out.println(longestCommonPrefix(new String[]{"flower", "flow", "flight"})); System.out.println(longestCommonPrefix(new String[]{"dog","racecar","car"})); System.out.println(longestCommonPrefix(new String[]{"c","c"})); } }
1,112
0.444245
0.430755
38
28.263159
22.526808
90
false
false
0
0
0
0
0
0
0.710526
false
false
13
d33f050b116d98603b765c0c27b6ed8c9edfaf1b
38,070,590,119,916
8d8fc2310bb7035fa7e5d9c66a589498975f9081
/src/main/java/soy/maven/disk/dao/IUserDao.java
ca7a0a5a3c5d3890301856d1f9ef8bbebddf4992
[]
no_license
961094037/soy
https://github.com/961094037/soy
ccdbe6474ff8519248f29846bf12208315d0892d
f74d8cee8f467e8989bf7c0ba71eef9c3219404d
refs/heads/master
2020-12-24T05:59:17.837000
2016-12-22T10:14:18
2016-12-22T10:14:18
73,437,640
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package soy.maven.disk.dao; import soy.maven.disk.pojo.User; public interface IUserDao { int deleteByPrimaryKey(Integer id); int insert(User record); int insertSelective(User record); User selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(User record); int updateByPrimaryKey(User record); int selectByUserName(String Username); String selectPasswordByName(String userName); int selectIdByUserName(String username); }
UTF-8
Java
511
java
IUserDao.java
Java
[]
null
[]
package soy.maven.disk.dao; import soy.maven.disk.pojo.User; public interface IUserDao { int deleteByPrimaryKey(Integer id); int insert(User record); int insertSelective(User record); User selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(User record); int updateByPrimaryKey(User record); int selectByUserName(String Username); String selectPasswordByName(String userName); int selectIdByUserName(String username); }
511
0.700587
0.700587
23
20.304348
19.138931
49
false
false
0
0
0
0
0
0
0.478261
false
false
13
f3f90d44fbf23b2b3ed57779e63544ad984c9750
35,854,387,010,442
fa1467d6cd1134f6bded1e8044a32fa0c05cd271
/src/main/java/com/bingeox/wechatbot/constant/AirStatusEnum.java
12a097272eb5864e28d043200ebb1328b615a3ed
[]
no_license
bingeox/WechatBot
https://github.com/bingeox/WechatBot
2d1a3f538df143990127d693a164a744c6a34a99
1b2e434cc94d642c50787b27e81f01a611cac393
refs/heads/main
2023-07-09T07:33:03.094000
2021-03-30T12:06:39
2021-03-30T12:06:39
352,538,040
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bingeox.wechatbot.constant; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; /** * @description 空气质量 * @since 2021/3/30 **/ @Getter @AllArgsConstructor @NoArgsConstructor public enum AirStatusEnum { SUPER(50, "优"), GOOD(100, "良"), LIGHT(150, "轻度污染"), MODERATE(200, "中度污染"), HEAVY(300, "重度污染"), SERIOUS(3000, "严重污染"); private int code; private String status; }
UTF-8
Java
495
java
AirStatusEnum.java
Java
[]
null
[]
package com.bingeox.wechatbot.constant; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; /** * @description 空气质量 * @since 2021/3/30 **/ @Getter @AllArgsConstructor @NoArgsConstructor public enum AirStatusEnum { SUPER(50, "优"), GOOD(100, "良"), LIGHT(150, "轻度污染"), MODERATE(200, "中度污染"), HEAVY(300, "重度污染"), SERIOUS(3000, "严重污染"); private int code; private String status; }
495
0.676275
0.620843
25
17.040001
11.515138
39
false
false
0
0
0
0
0
0
0.72
false
false
13
54c1655340335bbd246dc346a99ad73b04c3ee3b
16,045,997,866,041
1dd9a9915e10f4255adbd54f65d59bc722658867
/yhdg-agent-server/src/main/java/cn/com/yusong/yhdg/agentserver/web/controller/security/basic/AlipayfwPayOrderController.java
f9b7a19e11b176ee5e71229a517728b865628ec1
[]
no_license
Vampx/yhdg-parent
https://github.com/Vampx/yhdg-parent
fe28a02a86b80ba9caff78e769e15f25fb5bcedf
e981887e98264aa5c2c499ca9dd9575e2ac32bce
refs/heads/master
2020-07-29T23:52:38.243000
2019-09-21T11:39:55
2019-09-21T11:39:55
210,007,134
0
2
null
true
2019-09-21T15:18:07
2019-09-21T15:18:06
2019-09-21T11:41:19
2019-09-21T11:40:48
25,646
0
0
0
null
false
false
package cn.com.yusong.yhdg.agentserver.web.controller.security.basic; import cn.com.yusong.yhdg.agentserver.service.basic.AlipayfwPayOrderService; import cn.com.yusong.yhdg.common.annotation.SecurityControl; import cn.com.yusong.yhdg.common.annotation.ViewModel; import cn.com.yusong.yhdg.common.domain.basic.AlipayfwPayOrder; import cn.com.yusong.yhdg.common.domain.basic.PayOrder; import cn.com.yusong.yhdg.common.entity.json.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @Controller @RequestMapping(value = "/security/basic/alipayfw_pay_order") public class AlipayfwPayOrderController extends SecurityController { @Autowired AlipayfwPayOrderService alipayfwPayOrderService; @SecurityControl(limits = "basic.AlipayfwPayOrder:list") @RequestMapping(value = "index.htm") public void index(Model model) { model.addAttribute(MENU_CODE_NAME, "basic.AlipayfwPayOrder:list"); model.addAttribute("SourceTypeEnum", PayOrder.SourceType.values()); model.addAttribute("StatusEnum", PayOrder.Status.values()); } @RequestMapping("page.htm") @ViewModel(ViewModel.JSON) @ResponseBody public PageResult page(AlipayfwPayOrder search) { return PageResult.successResult(alipayfwPayOrderService.findPage(search)); } @RequestMapping("find_list.htm") @ViewModel(ViewModel.JSON) @ResponseBody public PageResult findList(String mobile){ List<AlipayfwPayOrder> list = alipayfwPayOrderService.findList(mobile); return PageResult.successResult(list); } @ViewModel(ViewModel.INNER_PAGE) @RequestMapping("view.htm") public String view(String id, Model model) { AlipayfwPayOrder alipayfwPayOrder = alipayfwPayOrderService.find(id); if(alipayfwPayOrderService == null) { return SEGMENT_RECORD_NOT_FOUND; } model.addAttribute("SourceTypeEnum", PayOrder.SourceType.values()); model.addAttribute("StatusEnum", PayOrder.Status.values()); model.addAttribute("entity", alipayfwPayOrder); return "/security/basic/alipayfw_pay_order/view"; } @ViewModel(ViewModel.INNER_PAGE) @RequestMapping("view_alipayfw_pay_order.htm") public String viewAlipayfwPayOrder(Integer partnerId, String statsDate, Model model) { model.addAttribute("partnerId", partnerId); model.addAttribute("statsDate", statsDate); return "/security/basic/partner_in_out_cash/view_alipayfw_pay_order"; } }
UTF-8
Java
2,742
java
AlipayfwPayOrderController.java
Java
[]
null
[]
package cn.com.yusong.yhdg.agentserver.web.controller.security.basic; import cn.com.yusong.yhdg.agentserver.service.basic.AlipayfwPayOrderService; import cn.com.yusong.yhdg.common.annotation.SecurityControl; import cn.com.yusong.yhdg.common.annotation.ViewModel; import cn.com.yusong.yhdg.common.domain.basic.AlipayfwPayOrder; import cn.com.yusong.yhdg.common.domain.basic.PayOrder; import cn.com.yusong.yhdg.common.entity.json.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @Controller @RequestMapping(value = "/security/basic/alipayfw_pay_order") public class AlipayfwPayOrderController extends SecurityController { @Autowired AlipayfwPayOrderService alipayfwPayOrderService; @SecurityControl(limits = "basic.AlipayfwPayOrder:list") @RequestMapping(value = "index.htm") public void index(Model model) { model.addAttribute(MENU_CODE_NAME, "basic.AlipayfwPayOrder:list"); model.addAttribute("SourceTypeEnum", PayOrder.SourceType.values()); model.addAttribute("StatusEnum", PayOrder.Status.values()); } @RequestMapping("page.htm") @ViewModel(ViewModel.JSON) @ResponseBody public PageResult page(AlipayfwPayOrder search) { return PageResult.successResult(alipayfwPayOrderService.findPage(search)); } @RequestMapping("find_list.htm") @ViewModel(ViewModel.JSON) @ResponseBody public PageResult findList(String mobile){ List<AlipayfwPayOrder> list = alipayfwPayOrderService.findList(mobile); return PageResult.successResult(list); } @ViewModel(ViewModel.INNER_PAGE) @RequestMapping("view.htm") public String view(String id, Model model) { AlipayfwPayOrder alipayfwPayOrder = alipayfwPayOrderService.find(id); if(alipayfwPayOrderService == null) { return SEGMENT_RECORD_NOT_FOUND; } model.addAttribute("SourceTypeEnum", PayOrder.SourceType.values()); model.addAttribute("StatusEnum", PayOrder.Status.values()); model.addAttribute("entity", alipayfwPayOrder); return "/security/basic/alipayfw_pay_order/view"; } @ViewModel(ViewModel.INNER_PAGE) @RequestMapping("view_alipayfw_pay_order.htm") public String viewAlipayfwPayOrder(Integer partnerId, String statsDate, Model model) { model.addAttribute("partnerId", partnerId); model.addAttribute("statsDate", statsDate); return "/security/basic/partner_in_out_cash/view_alipayfw_pay_order"; } }
2,742
0.747265
0.747265
68
39.323528
27.025827
90
false
false
0
0
0
0
0
0
0.588235
false
false
13
beb52f6cbb46c06dbeab44a2e2cc4df915dcf01a
34,668,976,059,769
c5d08ad125bfb04a95375e01b96f2a2e5223e293
/src/com/microbox/model/SubmitMessageModelThread.java
0d284a6247e1c0894f81be26d3b04c729c9fb0ee
[]
no_license
yuzx99/AirShow
https://github.com/yuzx99/AirShow
36d4eadfd0fe15bf57bdb492f1d80a7d14ff4502
db75987ceea46cacec96275d06963564cfac67aa
refs/heads/master
2021-01-20T04:11:52.539000
2015-01-25T07:30:19
2015-01-25T07:30:19
27,589,253
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.microbox.model; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.json.JSONException; import org.json.JSONObject; import android.os.Bundle; import android.os.Handler; import android.os.Message; import com.microbox.config.ApiUrlConfig; import com.microbox.util.MBHttpUtils; public class SubmitMessageModelThread extends Thread { private String token; private String content; private Handler handler; public SubmitMessageModelThread(String token, String content, Handler handler) { super(); this.token = token; this.content = content; this.handler = handler; } @Override public void run() { // TODO Auto-generated method stub try { MBHttpUtils ru = new MBHttpUtils(); JSONObject param = new JSONObject(); param.put("token", token); param.put("content", content); String result = ru.restHttpPostJson(ApiUrlConfig.URL_SEND_MESSAGE, param); Message msg = new Message(); Bundle data = new Bundle(); data.putString("result", result); msg.setData(data); handler.sendMessage(msg); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
1,387
java
SubmitMessageModelThread.java
Java
[]
null
[]
package com.microbox.model; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.json.JSONException; import org.json.JSONObject; import android.os.Bundle; import android.os.Handler; import android.os.Message; import com.microbox.config.ApiUrlConfig; import com.microbox.util.MBHttpUtils; public class SubmitMessageModelThread extends Thread { private String token; private String content; private Handler handler; public SubmitMessageModelThread(String token, String content, Handler handler) { super(); this.token = token; this.content = content; this.handler = handler; } @Override public void run() { // TODO Auto-generated method stub try { MBHttpUtils ru = new MBHttpUtils(); JSONObject param = new JSONObject(); param.put("token", token); param.put("content", content); String result = ru.restHttpPostJson(ApiUrlConfig.URL_SEND_MESSAGE, param); Message msg = new Message(); Bundle data = new Bundle(); data.putString("result", result); msg.setData(data); handler.sendMessage(msg); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
1,387
0.724585
0.724585
57
23.333334
16.449106
69
false
false
0
0
0
0
0
0
2.105263
false
false
13
0b9815e78f0f0527ebed68c26c568c1bf52fd120
38,388,417,699,516
08f03aaee0c27fcfc862de60790ff380d51d0693
/src/forer/dictionary/Dictionary.java
63264ed7bf15ce2141b8fa6b3977dd9162152c52
[]
no_license
chavs1997/forer-mco152-spring-2018
https://github.com/chavs1997/forer-mco152-spring-2018
636d4bfe6c13f6cca6dc9c4b00892c87f534d16e
4f3179f62a58d72052218681f450e64f6cdaadaf
refs/heads/master
2021-05-02T07:39:12.430000
2018-05-17T21:40:29
2018-05-17T21:40:29
120,833,917
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package forer.dictionary; import java.io.*; import java.util.HashMap; import java.util.Map; public class Dictionary { File dictionary; Map<String, String> map; public Dictionary() throws IOException { File dictionary = new File("src\\forer\\Dictionary\\dictionary.txt"); this.dictionary = dictionary; Map<String, String> map = new HashMap<String, String>(); BufferedReader in = new BufferedReader(new FileReader(dictionary)); String line = ""; while ((line = in.readLine()) != null) { String[] parts = line.split(" ", 2); if (parts.length < 2) { String[] doubleParts = new String[2]; doubleParts[0] = parts[0]; doubleParts[1] = null; map.put(doubleParts[0], doubleParts[1]); } else { map.put(parts[0], parts[1]); } } in.close(); this.map = map; } public boolean contains(String word) throws IOException { return map.containsKey(word.toUpperCase()); } public String getDefinition(String word) throws IOException { String definition = null; String wordInDic = word.toUpperCase(); if (map.containsKey(wordInDic)) { definition = map.get(wordInDic); } return definition; } }
UTF-8
Java
1,156
java
Dictionary.java
Java
[]
null
[]
package forer.dictionary; import java.io.*; import java.util.HashMap; import java.util.Map; public class Dictionary { File dictionary; Map<String, String> map; public Dictionary() throws IOException { File dictionary = new File("src\\forer\\Dictionary\\dictionary.txt"); this.dictionary = dictionary; Map<String, String> map = new HashMap<String, String>(); BufferedReader in = new BufferedReader(new FileReader(dictionary)); String line = ""; while ((line = in.readLine()) != null) { String[] parts = line.split(" ", 2); if (parts.length < 2) { String[] doubleParts = new String[2]; doubleParts[0] = parts[0]; doubleParts[1] = null; map.put(doubleParts[0], doubleParts[1]); } else { map.put(parts[0], parts[1]); } } in.close(); this.map = map; } public boolean contains(String word) throws IOException { return map.containsKey(word.toUpperCase()); } public String getDefinition(String word) throws IOException { String definition = null; String wordInDic = word.toUpperCase(); if (map.containsKey(wordInDic)) { definition = map.get(wordInDic); } return definition; } }
1,156
0.673875
0.665225
52
21.23077
20.317305
71
false
false
0
0
0
0
0
0
1.980769
false
false
13
1fe869d15327ba131fcc688cb586ae10b7fee1ce
17,394,617,568,483
b3a22f749226b244ecf06952751625845d9398c7
/mblog-web/src/main/java/mblog/web/controller/desk/IndexController.java
1ad49192a40581fd98201d2868f227c2c1e026ac
[ "Apache-2.0" ]
permissive
zhangchaoToHub/mblog
https://github.com/zhangchaoToHub/mblog
e8ed2c62e508a99f3f2524267e1d80677ce230d5
9cec1546a58ec6e423c67869da83750f6a186978
refs/heads/master
2021-05-06T00:04:28.962000
2018-01-10T09:36:48
2018-01-10T09:36:48
116,926,842
4
4
null
null
null
null
null
null
null
null
null
null
null
null
null
/* +-------------------------------------------------------------------------- | Mblog [#RELEASE_VERSION#] | ======================================== | Copyright (c) 2014, 2015 mtons. All Rights Reserved | http://www.mtons.com | +--------------------------------------------------------------------------- */ package mblog.web.controller.desk; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import mblog.base.lang.Consts; import mblog.web.controller.BaseController; /** * @author langhsu * */ @Controller public class IndexController extends BaseController{ @RequestMapping(value= {"/", "/index"}) public String root(ModelMap model, HttpServletRequest request) { String order = ServletRequestUtils.getStringParameter(request, "ord", Consts.order.NEWEST); model.put("ord", order); return getView(Views.INDEX); } }
UTF-8
Java
1,049
java
IndexController.java
Java
[ { "context": "log.web.controller.BaseController;\n\n/**\n * @author langhsu\n *\n */\n@Controller\npublic class IndexController e", "end": 709, "score": 0.9996729493141174, "start": 702, "tag": "USERNAME", "value": "langhsu" } ]
null
[]
/* +-------------------------------------------------------------------------- | Mblog [#RELEASE_VERSION#] | ======================================== | Copyright (c) 2014, 2015 mtons. All Rights Reserved | http://www.mtons.com | +--------------------------------------------------------------------------- */ package mblog.web.controller.desk; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import mblog.base.lang.Consts; import mblog.web.controller.BaseController; /** * @author langhsu * */ @Controller public class IndexController extends BaseController{ @RequestMapping(value= {"/", "/index"}) public String root(ModelMap model, HttpServletRequest request) { String order = ServletRequestUtils.getStringParameter(request, "ord", Consts.order.NEWEST); model.put("ord", order); return getView(Views.INDEX); } }
1,049
0.620591
0.612965
36
28.138889
26.532112
93
false
false
0
0
0
0
0
0
0.888889
false
false
13
de2db9ee36a38dc5d145ef0262d0910d7d359f72
32,263,794,345,762
7ea37b55711404d962e38388c74ad13d7247c504
/branchitup/src/main/java/com/branchitup/service/AdminService.java
382ffd0556e5979a2871e4f395501bc1253fb5f5
[]
no_license
meirwinston/branchitup
https://github.com/meirwinston/branchitup
7164a8976e41d8e0b1673783f5bd742010ada41f
915600a3934a7b017b410cf99c3544e01ef1fd7d
refs/heads/master
2021-01-21T12:07:52.283000
2013-08-30T12:13:31
2013-08-30T12:13:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.branchitup.service; import org.hibernate.SessionFactory; public class AdminService { protected SessionFactory sessionFactory; protected MailService mailService; public void deleteUser(long userAccountId){ } public void sendIntroMail(String email){ } public void setSessionFactory(SessionFactory sessionFactory){ this.sessionFactory = sessionFactory; } public void setMailService(MailService mailService){ this.mailService = mailService; } }
UTF-8
Java
487
java
AdminService.java
Java
[]
null
[]
package com.branchitup.service; import org.hibernate.SessionFactory; public class AdminService { protected SessionFactory sessionFactory; protected MailService mailService; public void deleteUser(long userAccountId){ } public void sendIntroMail(String email){ } public void setSessionFactory(SessionFactory sessionFactory){ this.sessionFactory = sessionFactory; } public void setMailService(MailService mailService){ this.mailService = mailService; } }
487
0.780287
0.780287
25
18.48
20.331493
62
false
false
0
0
0
0
0
0
1.24
false
false
13
6ab54ed4edd09fb7e4dc11e0e5bfa1ff84594592
2,439,541,444,769
66905dae1ff94bc07456db72b65f1160b206e584
/common/src/de/yogularm/geometry/RectTrace.java
a4ccadc946616edef548f8deff1955d49665b54b
[]
no_license
Yogu/YogularmInfinite
https://github.com/Yogu/YogularmInfinite
167cb61ae61dfe55b2605310b3b926e4887ab440
2306f228a7cae016e8f2d3b19a15e149bc812529
refs/heads/master
2020-05-04T13:56:36.613000
2013-12-30T17:33:11
2013-12-30T17:33:11
2,336,141
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.yogularm.geometry; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** * Describes a rectangle following the * @author jan * */ public class RectTrace { private NumericFunction baseFunction; private Rect rectDimensions; private float startX; private float targetX; public RectTrace(NumericFunction baseFunction, Rect rectDimensions, float startX, float targetX) { this.baseFunction = baseFunction; this.rectDimensions = rectDimensions; this.startX = startX; this.targetX = targetX; } /** * Gets all grid cells that collide with this trace * @return a collection of grid cells */ public Collection<Point> getCollidingCells() { List<Point> list = new ArrayList<Point>(); IntegerRange xRange = getColumnRange(); for (int x = xRange.getMin(); x <= xRange.getMax(); x++) { IntegerRange yRange = getColumnYRange(x); for (int y = yRange.getMin(); y <= yRange.getMax(); y++) list.add(new Point(x, y)); } return list; } /** * Gets the range of grid positions this trace does overlap * * @return the range of grid columns */ public IntegerRange getColumnRange() { int minX = (int)Math.floor(Math.min(startX, targetX) + rectDimensions.getLeft()); int maxX = (int)Math.ceil(Math.max(startX, targetX) + rectDimensions.getRight()) - 1; // grid positions return new IntegerRange(minX, maxX); } /** * Gets the range of grid positions (vertically) the trace overlaps in the given grid column * * @param gridX the grid column * @return a range of grid rows */ public IntegerRange getColumnYRange(int gridX) { float totalLeftX = Math.min(startX, targetX) + rectDimensions.getLeft(); float totalRightX = Math.max(startX, targetX) + rectDimensions.getRight() - 1; // grid positions int leftX = gridX; int rightX = gridX + 1; // left cell edge touches right rect edge float funcX1 = Math.max(totalLeftX, leftX - rectDimensions.getRight()); float funcX2 = Math.min(totalRightX, rightX - rectDimensions.getLeft()); float funcMinY = baseFunction.getMinY(funcX1, funcX2); float funcMaxY = baseFunction.getMaxY(funcX1, funcX2); int minY = (int)Math.floor(funcMinY + rectDimensions.getBottom()); int maxY = (int)Math.ceil(funcMaxY + rectDimensions.getTop()) - 1; // grid positions return new IntegerRange(minY, maxY); } }
UTF-8
Java
2,359
java
RectTrace.java
Java
[ { "context": " * Describes a rectangle following the \n * @author jan\n *\n */\npublic class RectTrace {\n\tprivate NumericF", "end": 170, "score": 0.8129931688308716, "start": 167, "tag": "USERNAME", "value": "jan" } ]
null
[]
package de.yogularm.geometry; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** * Describes a rectangle following the * @author jan * */ public class RectTrace { private NumericFunction baseFunction; private Rect rectDimensions; private float startX; private float targetX; public RectTrace(NumericFunction baseFunction, Rect rectDimensions, float startX, float targetX) { this.baseFunction = baseFunction; this.rectDimensions = rectDimensions; this.startX = startX; this.targetX = targetX; } /** * Gets all grid cells that collide with this trace * @return a collection of grid cells */ public Collection<Point> getCollidingCells() { List<Point> list = new ArrayList<Point>(); IntegerRange xRange = getColumnRange(); for (int x = xRange.getMin(); x <= xRange.getMax(); x++) { IntegerRange yRange = getColumnYRange(x); for (int y = yRange.getMin(); y <= yRange.getMax(); y++) list.add(new Point(x, y)); } return list; } /** * Gets the range of grid positions this trace does overlap * * @return the range of grid columns */ public IntegerRange getColumnRange() { int minX = (int)Math.floor(Math.min(startX, targetX) + rectDimensions.getLeft()); int maxX = (int)Math.ceil(Math.max(startX, targetX) + rectDimensions.getRight()) - 1; // grid positions return new IntegerRange(minX, maxX); } /** * Gets the range of grid positions (vertically) the trace overlaps in the given grid column * * @param gridX the grid column * @return a range of grid rows */ public IntegerRange getColumnYRange(int gridX) { float totalLeftX = Math.min(startX, targetX) + rectDimensions.getLeft(); float totalRightX = Math.max(startX, targetX) + rectDimensions.getRight() - 1; // grid positions int leftX = gridX; int rightX = gridX + 1; // left cell edge touches right rect edge float funcX1 = Math.max(totalLeftX, leftX - rectDimensions.getRight()); float funcX2 = Math.min(totalRightX, rightX - rectDimensions.getLeft()); float funcMinY = baseFunction.getMinY(funcX1, funcX2); float funcMaxY = baseFunction.getMaxY(funcX1, funcX2); int minY = (int)Math.floor(funcMinY + rectDimensions.getBottom()); int maxY = (int)Math.ceil(funcMaxY + rectDimensions.getTop()) - 1; // grid positions return new IntegerRange(minY, maxY); } }
2,359
0.708775
0.704536
73
31.315069
28.341303
105
false
false
0
0
0
0
0
0
1.945205
false
false
13
8f6466ca71c8de8fca0741033a1ea09cf1170032
10,376,641,013,247
4bc5a84f115da1461187019ef20977765792853a
/ElectoralRoll/src/com/vimukti/electoralroll/Electoral.java
588a26dd6ad87120a8c335d783a24ecd18335737
[]
no_license
prasanna-kumar/ElectorFinder
https://github.com/prasanna-kumar/ElectorFinder
ce8a7dff93c3d0d5bbf71298c0db5f99e740695b
f76cd71c5ca4dabe169f64e137dda469b4845c36
refs/heads/master
2020-05-31T10:56:23.535000
2014-05-06T05:41:26
2014-05-06T05:41:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vimukti.electoralroll; import java.io.Serializable; @SuppressWarnings("serial") public class Electoral implements Serializable { public static final String TABLE_NAME = "electoral"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_SERIAL = "serial"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_VOTER_ID = "voter_id"; public static final String COLUMN_RELATIVE = "relative"; public static final String COLUMN_HOUSE_NO = "house_no"; public static final String COLUMN_AGE = "age"; public static final String COLUMN_GENDER = "gender"; public static final String COLUMN_PART_NO = "partno"; public static final String COLUMN_CONSTITUENCY = "constituency"; private long id; private int serial; private String name; private String voterId; private String relative; private String houseNo; private int age; private String gender; private int partNo; private int constituency; /** * @return the serial */ public int getSerial() { return serial; } /** * @param serial * the serial to set */ public void setSerial(int serial) { this.serial = serial; } /** * @return the name */ public String getName() { return name; } /** * @param name * the name to set */ public void setName(String name) { this.name = name; } /** * @return the voterId */ public String getVoterId() { return voterId; } /** * @param voterId * the voterId to set */ public void setVoterId(String voterId) { this.voterId = voterId; } /** * @return the relative */ public String getRelative() { return relative; } /** * @param relative * the relative to set */ public void setRelative(String relative) { this.relative = relative; } /** * @return the houseNo */ public String getHouseNo() { return houseNo; } /** * @param houseNo * the houseNo to set */ public void setHouseNo(String houseNo) { this.houseNo = houseNo; } /** * @return the age */ public int getAge() { return age; } /** * @param age * the age to set */ public void setAge(int age) { this.age = age; } /** * @return the gender */ public String getGender() { return gender; } /** * @param gender * the gender to set */ public void setGender(String gender) { this.gender = gender; } /** * @return the id */ public long getId() { return id; } /** * @param id * the id to set */ public void setId(long id) { this.id = id; } /** * @return the partNo */ public int getPartNo() { return partNo; } /** * @param partNo * the partNo to set */ public void setPartNo(int partNo) { this.partNo = partNo; } /** * @return the constituency */ public int getConstituency() { return constituency; } /** * @param constituency * the constituency to set */ public void setConstituency(int constituency) { this.constituency = constituency; } }
UTF-8
Java
3,087
java
Electoral.java
Java
[]
null
[]
package com.vimukti.electoralroll; import java.io.Serializable; @SuppressWarnings("serial") public class Electoral implements Serializable { public static final String TABLE_NAME = "electoral"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_SERIAL = "serial"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_VOTER_ID = "voter_id"; public static final String COLUMN_RELATIVE = "relative"; public static final String COLUMN_HOUSE_NO = "house_no"; public static final String COLUMN_AGE = "age"; public static final String COLUMN_GENDER = "gender"; public static final String COLUMN_PART_NO = "partno"; public static final String COLUMN_CONSTITUENCY = "constituency"; private long id; private int serial; private String name; private String voterId; private String relative; private String houseNo; private int age; private String gender; private int partNo; private int constituency; /** * @return the serial */ public int getSerial() { return serial; } /** * @param serial * the serial to set */ public void setSerial(int serial) { this.serial = serial; } /** * @return the name */ public String getName() { return name; } /** * @param name * the name to set */ public void setName(String name) { this.name = name; } /** * @return the voterId */ public String getVoterId() { return voterId; } /** * @param voterId * the voterId to set */ public void setVoterId(String voterId) { this.voterId = voterId; } /** * @return the relative */ public String getRelative() { return relative; } /** * @param relative * the relative to set */ public void setRelative(String relative) { this.relative = relative; } /** * @return the houseNo */ public String getHouseNo() { return houseNo; } /** * @param houseNo * the houseNo to set */ public void setHouseNo(String houseNo) { this.houseNo = houseNo; } /** * @return the age */ public int getAge() { return age; } /** * @param age * the age to set */ public void setAge(int age) { this.age = age; } /** * @return the gender */ public String getGender() { return gender; } /** * @param gender * the gender to set */ public void setGender(String gender) { this.gender = gender; } /** * @return the id */ public long getId() { return id; } /** * @param id * the id to set */ public void setId(long id) { this.id = id; } /** * @return the partNo */ public int getPartNo() { return partNo; } /** * @param partNo * the partNo to set */ public void setPartNo(int partNo) { this.partNo = partNo; } /** * @return the constituency */ public int getConstituency() { return constituency; } /** * @param constituency * the constituency to set */ public void setConstituency(int constituency) { this.constituency = constituency; } }
3,087
0.624879
0.624879
190
15.247369
15.700046
65
false
false
0
0
0
0
0
0
1.126316
false
false
13
13c9bb73f59531239b31cfa7f3822d1c6a3b03dd
31,499,290,172,604
9ee5d7766cc11303f1b3ada5b651d5ead39cc91c
/src/main/java/net/kenvanhoeylandt/solutions/day6/logic/LightGridPartOne.java
0f25d2d411155aaca6e86d5e6aa31b776401d7b9
[]
no_license
kenvanhoeylandt/Advent-of-Code-2015
https://github.com/kenvanhoeylandt/Advent-of-Code-2015
960acc697455b4959963d0ab070c097a727be657
98d9d76467b146f2d5df9cd9d57650fbe9e44bf9
refs/heads/master
2021-01-10T08:20:40.341000
2016-11-24T20:34:46
2016-11-24T20:34:46
47,570,158
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.kenvanhoeylandt.solutions.day6.logic; import net.kenvanhoeylandt.solutions.day6.data.Area; import java.util.Arrays; import java.util.stream.IntStream; public class LightGridPartOne implements LightGrid { private final boolean[][] mLights; private interface LightProcessor { boolean process(boolean input); } public LightGridPartOne() { mLights = new boolean[1000][1000]; IntStream.range(0, 1000).forEach(i -> Arrays.fill(mLights[i], false)); } @Override public void turnOn(Area area) { process(area, input -> true); } @Override public void turnOff(Area area) { process(area, input -> false); } @Override public void toggle(Area area) { process(area, input -> !input); } public void process(Area area, LightProcessor processor) { IntStream.rangeClosed(area.getFromX(), area.getToX()).forEach(x -> { IntStream.rangeClosed(area.getFromY(), area.getToY()).forEach(y -> { mLights[x][y] = processor.process(mLights[x][y]); }); }); } public long getLightsOnCount() { // Stream all X values return IntStream.range(0, mLights.length) .mapToLong( // Stream all Y values and count all the lights that are on x -> IntStream.range(0, mLights[x].length) .filter( y -> mLights[x][y]) // filter lights on .count() // count items that came through the filter ).sum(); } }
UTF-8
Java
1,362
java
LightGridPartOne.java
Java
[]
null
[]
package net.kenvanhoeylandt.solutions.day6.logic; import net.kenvanhoeylandt.solutions.day6.data.Area; import java.util.Arrays; import java.util.stream.IntStream; public class LightGridPartOne implements LightGrid { private final boolean[][] mLights; private interface LightProcessor { boolean process(boolean input); } public LightGridPartOne() { mLights = new boolean[1000][1000]; IntStream.range(0, 1000).forEach(i -> Arrays.fill(mLights[i], false)); } @Override public void turnOn(Area area) { process(area, input -> true); } @Override public void turnOff(Area area) { process(area, input -> false); } @Override public void toggle(Area area) { process(area, input -> !input); } public void process(Area area, LightProcessor processor) { IntStream.rangeClosed(area.getFromX(), area.getToX()).forEach(x -> { IntStream.rangeClosed(area.getFromY(), area.getToY()).forEach(y -> { mLights[x][y] = processor.process(mLights[x][y]); }); }); } public long getLightsOnCount() { // Stream all X values return IntStream.range(0, mLights.length) .mapToLong( // Stream all Y values and count all the lights that are on x -> IntStream.range(0, mLights[x].length) .filter( y -> mLights[x][y]) // filter lights on .count() // count items that came through the filter ).sum(); } }
1,362
0.68649
0.674009
64
20.28125
22.057785
72
false
false
0
0
0
0
0
0
1.703125
false
false
13
d8b19badcc39bbfb2fcf3c90cbe5629cd9774129
32,779,190,430,596
517a69efdc232a1ca247cd15dbc83432819a3c99
/src/test/java/org/cdac/gist/ApplicationTests.java
172721340b09258ce54a1832080c1f8c82d93d72
[]
no_license
rajjaiswalsaumya/spring-boot-min-config-webapp
https://github.com/rajjaiswalsaumya/spring-boot-min-config-webapp
afac4be5705dc031374e44e7d80afbc835e4f27a
6a63b59cead1b4beceae7b3fbc6aee7a4e3d94b1
refs/heads/master
2021-01-10T21:51:51.729000
2018-02-25T00:15:57
2018-02-25T00:15:57
30,010,635
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.cdac.gist; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * Developer : Rohit Gupta * File created on : 12-06-2015 at 05:44. * Description : This is simple Boot Application Runner Test Class aims to test context loads properly on a random port */ @RunWith(value = SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ApplicationTests { @Test public void contextLoads() { } }
UTF-8
Java
609
java
ApplicationTests.java
Java
[ { "context": "t.junit4.SpringRunner;\n\n\n/**\n * Developer : Rohit Gupta\n * File created on : 12-06-2015 at 05:44.\n * Des", "end": 241, "score": 0.9998785257339478, "start": 230, "tag": "NAME", "value": "Rohit Gupta" } ]
null
[]
package org.cdac.gist; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * Developer : <NAME> * File created on : 12-06-2015 at 05:44. * Description : This is simple Boot Application Runner Test Class aims to test context loads properly on a random port */ @RunWith(value = SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ApplicationTests { @Test public void contextLoads() { } }
604
0.753695
0.732348
23
25.434782
29.750887
119
false
false
0
0
0
0
0
0
0.217391
false
false
13
3d525a980270659e1d438a32551e49f7183323e5
17,480,516,919,312
844704937eb8038b2f970e5a2bbf0826a62d02c2
/2학년/Java/20200602/src/Cont02.java
4f61f0f25fda3ca78bf509d09f22255b327784a4
[]
no_license
KIM-CG/Programming
https://github.com/KIM-CG/Programming
0b769a48eae3606ec1b712353396b5db18fda101
0c5b20c2b4e70e45ade9e76c655d5a1976e8dfbc
refs/heads/master
2021-08-17T06:00:18.340000
2020-07-20T15:16:03
2020-07-20T15:16:03
205,544,121
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import static java.awt.event.InputEvent.CTRL_DOWN_MASK; class frame03 extends JFrame { JLabel jb = new JLabel("선택"); frame03() { setTitle("메뉴만들기"); setSize(500, 300); Container c = getContentPane(); c.setLayout(null); jb.setLocation(200, 100); jb.setSize(200, 50); c.add(jb); createMenu(); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); c.setFocusable(true); c.requestFocus(); } void createMenu() { JMenuBar mb = new JMenuBar(); JMenu file = new JMenu("파일(F)"); JMenuItem[] mi = new JMenuItem[8]; String[] str = {"새로 만들기(N)", "새 창(W)", "열기(O)..", "저장(S)", "다른 이름으로 저장(A)..", "페이지 설정(U)..", "인쇄(P)..", "끝내기(X)"}; for(int i = 0; i < 8; i++) { mi[i] = new JMenuItem(str[i]); switch (i) { case 0: mi[i].setAccelerator(KeyStroke.getKeyStroke('N', CTRL_DOWN_MASK)); break; case 1: mi[i].setAccelerator(KeyStroke.getKeyStroke('W', CTRL_DOWN_MASK)); break; case 2: mi[i].setAccelerator(KeyStroke.getKeyStroke('O', CTRL_DOWN_MASK)); break; case 3: mi[i].setAccelerator(KeyStroke.getKeyStroke('S', CTRL_DOWN_MASK)); break; case 4: mi[i].setAccelerator(KeyStroke.getKeyStroke('A', CTRL_DOWN_MASK)); break; case 5: mi[i].setAccelerator(KeyStroke.getKeyStroke('U', CTRL_DOWN_MASK)); break; case 6: mi[i].setAccelerator(KeyStroke.getKeyStroke('P', CTRL_DOWN_MASK)); break; case 7: mi[i].setAccelerator(KeyStroke.getKeyStroke('X', CTRL_DOWN_MASK)); } file.add(mi[i]).addActionListener(new MyAction()); if(i == 4 || i == 6) { file.addSeparator(); } } mb.add(file); setJMenuBar(mb); } class MyAction implements ActionListener { public void actionPerformed(ActionEvent e) { String n = e.getActionCommand(); jb.setText(n + "메뉴를 선택하였습니다."); } } } public class Cont02 { public static void main(String[] args) { new frame03(); } }
UTF-8
Java
2,696
java
Cont02.java
Java
[]
null
[]
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import static java.awt.event.InputEvent.CTRL_DOWN_MASK; class frame03 extends JFrame { JLabel jb = new JLabel("선택"); frame03() { setTitle("메뉴만들기"); setSize(500, 300); Container c = getContentPane(); c.setLayout(null); jb.setLocation(200, 100); jb.setSize(200, 50); c.add(jb); createMenu(); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); c.setFocusable(true); c.requestFocus(); } void createMenu() { JMenuBar mb = new JMenuBar(); JMenu file = new JMenu("파일(F)"); JMenuItem[] mi = new JMenuItem[8]; String[] str = {"새로 만들기(N)", "새 창(W)", "열기(O)..", "저장(S)", "다른 이름으로 저장(A)..", "페이지 설정(U)..", "인쇄(P)..", "끝내기(X)"}; for(int i = 0; i < 8; i++) { mi[i] = new JMenuItem(str[i]); switch (i) { case 0: mi[i].setAccelerator(KeyStroke.getKeyStroke('N', CTRL_DOWN_MASK)); break; case 1: mi[i].setAccelerator(KeyStroke.getKeyStroke('W', CTRL_DOWN_MASK)); break; case 2: mi[i].setAccelerator(KeyStroke.getKeyStroke('O', CTRL_DOWN_MASK)); break; case 3: mi[i].setAccelerator(KeyStroke.getKeyStroke('S', CTRL_DOWN_MASK)); break; case 4: mi[i].setAccelerator(KeyStroke.getKeyStroke('A', CTRL_DOWN_MASK)); break; case 5: mi[i].setAccelerator(KeyStroke.getKeyStroke('U', CTRL_DOWN_MASK)); break; case 6: mi[i].setAccelerator(KeyStroke.getKeyStroke('P', CTRL_DOWN_MASK)); break; case 7: mi[i].setAccelerator(KeyStroke.getKeyStroke('X', CTRL_DOWN_MASK)); } file.add(mi[i]).addActionListener(new MyAction()); if(i == 4 || i == 6) { file.addSeparator(); } } mb.add(file); setJMenuBar(mb); } class MyAction implements ActionListener { public void actionPerformed(ActionEvent e) { String n = e.getActionCommand(); jb.setText(n + "메뉴를 선택하였습니다."); } } } public class Cont02 { public static void main(String[] args) { new frame03(); } }
2,696
0.492692
0.478077
78
32.333332
25.02853
122
false
false
0
0
0
0
0
0
0.858974
false
false
13
2c41323b7a9f4a7654566a85b4630d4d0a20c62f
6,743,098,655,527
884f8f86d2a03f4ff6c24c4e49ebedebaef1fcbe
/Jewar/app/src/main/java/abanoubm/jewar/BookOwnersDisplayMap.java
0f6f047ec53f045b6e804a3cbaeff9ffa2a0adac
[ "MIT" ]
permissive
abanoubmilad/jewar
https://github.com/abanoubmilad/jewar
4b35f7ac110751a193c26097145e4cd0b73271b4
d96ce77fc5c82ef332c1a9d1fdd77e41ba0fac52
refs/heads/master
2020-06-14T11:29:01.373000
2017-06-30T12:25:44
2017-06-30T12:25:44
74,280,543
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package abanoubm.jewar; import android.Manifest; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Criteria; import android.location.Location; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.support.v4.content.ContextCompat; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.location.LocationListener; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class BookOwnersDisplayMap extends FragmentActivity implements OnMapReadyCallback, LocationListener { private String bookID; private Marker GPSMarker; private GoogleMap mMap; private Map<String, BookOwner> mMarkerInfoList = new HashMap<>(); private TextView name, email, mobile; private final int MAP_REQUEST_CODE = 600; private class DisplayOwnersTask extends AsyncTask<Void, Void, APIResponse> { private ProgressDialog pBar; @Override protected void onPreExecute() { pBar = new ProgressDialog(BookOwnersDisplayMap.this); pBar.setCancelable(false); pBar.setTitle("loading"); pBar.setMessage("searching for owners ...."); pBar.show(); } @Override protected void onPostExecute(APIResponse response) { if (getApplicationContext() == null) return; switch (response.getStatus()) { case -1: Toast.makeText(getApplicationContext(), "check your internet connection!", Toast.LENGTH_SHORT).show(); break; case 0: Toast.makeText(getApplicationContext(), "connection timeout, login first!", Toast.LENGTH_SHORT).show(); finish(); startActivity(new Intent(BookOwnersDisplayMap.this, SignIn.class)); break; case 3: Toast.makeText(getApplicationContext(), "no book owners found!!", Toast.LENGTH_SHORT).show(); finish(); break; case 7: ArrayList<BookOwner> owners = (ArrayList<BookOwner>) response.getData(); if (owners != null) { // mAdapter.clearThenAddAll(owners); if (owners.size() == 0) { Toast.makeText(getApplicationContext(), "no book owners found!", Toast.LENGTH_SHORT).show(); finish(); } for (BookOwner owner : owners) { mMarkerInfoList.put(mMap.addMarker(new MarkerOptions() .position( new LatLng(owner.getLat(), owner.getLng())) .title("\u200e" + owner.getName()) .draggable(false)).getId(), owner); } } else { Toast.makeText(getApplicationContext(), "error while trying to search! try again!", Toast.LENGTH_SHORT).show(); } break; default: break; } pBar.dismiss(); } @Override protected APIResponse doInBackground(Void... params) { return JewarApi.get_owners_of_book(bookID); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); name = (TextView) findViewById(R.id.name); email = (TextView) findViewById(R.id.email); mobile = (TextView) findViewById(R.id.mobile); bookID = getIntent().getStringExtra("book_id"); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Override public void onLocationChanged(Location location) { if (mMap == null) return; if (GPSMarker != null) GPSMarker.remove(); GPSMarker = mMap.addMarker(new MarkerOptions() .position( new LatLng(location.getLatitude(), location .getLongitude())) .draggable(false) .title("your GPS current location is here!") .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_CYAN))); } @Override public void onMapReady(GoogleMap map) { mMap = map; new DisplayOwnersTask().execute(); if (Build.VERSION.SDK_INT < 23 || ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { setGPSMarkerlocation(); } else { ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}, MAP_REQUEST_CODE); } map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { BookOwner owner = mMarkerInfoList.get(marker.getId()); if (owner != null) { name.setText(owner.getName()); email.setText(owner.getEmail()); mobile.setText(owner.getMobile()); } return false; } }); } private void setGPSMarkerlocation() { mMap.setMyLocationEnabled(true); LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE); Location myLocation = locationManager.getLastKnownLocation(locationManager .getBestProvider(new Criteria(), false)); if (myLocation != null) { GPSMarker = mMap.addMarker(new MarkerOptions() .position( new LatLng(myLocation.getLatitude(), myLocation .getLongitude())) .draggable(false) .title("your GPS current location is here!") .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_CYAN))); } } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == MAP_REQUEST_CODE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) setGPSMarkerlocation(); } } }
UTF-8
Java
8,048
java
BookOwnersDisplayMap.java
Java
[]
null
[]
package abanoubm.jewar; import android.Manifest; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Criteria; import android.location.Location; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.support.v4.content.ContextCompat; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.location.LocationListener; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class BookOwnersDisplayMap extends FragmentActivity implements OnMapReadyCallback, LocationListener { private String bookID; private Marker GPSMarker; private GoogleMap mMap; private Map<String, BookOwner> mMarkerInfoList = new HashMap<>(); private TextView name, email, mobile; private final int MAP_REQUEST_CODE = 600; private class DisplayOwnersTask extends AsyncTask<Void, Void, APIResponse> { private ProgressDialog pBar; @Override protected void onPreExecute() { pBar = new ProgressDialog(BookOwnersDisplayMap.this); pBar.setCancelable(false); pBar.setTitle("loading"); pBar.setMessage("searching for owners ...."); pBar.show(); } @Override protected void onPostExecute(APIResponse response) { if (getApplicationContext() == null) return; switch (response.getStatus()) { case -1: Toast.makeText(getApplicationContext(), "check your internet connection!", Toast.LENGTH_SHORT).show(); break; case 0: Toast.makeText(getApplicationContext(), "connection timeout, login first!", Toast.LENGTH_SHORT).show(); finish(); startActivity(new Intent(BookOwnersDisplayMap.this, SignIn.class)); break; case 3: Toast.makeText(getApplicationContext(), "no book owners found!!", Toast.LENGTH_SHORT).show(); finish(); break; case 7: ArrayList<BookOwner> owners = (ArrayList<BookOwner>) response.getData(); if (owners != null) { // mAdapter.clearThenAddAll(owners); if (owners.size() == 0) { Toast.makeText(getApplicationContext(), "no book owners found!", Toast.LENGTH_SHORT).show(); finish(); } for (BookOwner owner : owners) { mMarkerInfoList.put(mMap.addMarker(new MarkerOptions() .position( new LatLng(owner.getLat(), owner.getLng())) .title("\u200e" + owner.getName()) .draggable(false)).getId(), owner); } } else { Toast.makeText(getApplicationContext(), "error while trying to search! try again!", Toast.LENGTH_SHORT).show(); } break; default: break; } pBar.dismiss(); } @Override protected APIResponse doInBackground(Void... params) { return JewarApi.get_owners_of_book(bookID); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); name = (TextView) findViewById(R.id.name); email = (TextView) findViewById(R.id.email); mobile = (TextView) findViewById(R.id.mobile); bookID = getIntent().getStringExtra("book_id"); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Override public void onLocationChanged(Location location) { if (mMap == null) return; if (GPSMarker != null) GPSMarker.remove(); GPSMarker = mMap.addMarker(new MarkerOptions() .position( new LatLng(location.getLatitude(), location .getLongitude())) .draggable(false) .title("your GPS current location is here!") .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_CYAN))); } @Override public void onMapReady(GoogleMap map) { mMap = map; new DisplayOwnersTask().execute(); if (Build.VERSION.SDK_INT < 23 || ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { setGPSMarkerlocation(); } else { ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}, MAP_REQUEST_CODE); } map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { BookOwner owner = mMarkerInfoList.get(marker.getId()); if (owner != null) { name.setText(owner.getName()); email.setText(owner.getEmail()); mobile.setText(owner.getMobile()); } return false; } }); } private void setGPSMarkerlocation() { mMap.setMyLocationEnabled(true); LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE); Location myLocation = locationManager.getLastKnownLocation(locationManager .getBestProvider(new Criteria(), false)); if (myLocation != null) { GPSMarker = mMap.addMarker(new MarkerOptions() .position( new LatLng(myLocation.getLatitude(), myLocation .getLongitude())) .draggable(false) .title("your GPS current location is here!") .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_CYAN))); } } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == MAP_REQUEST_CODE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) setGPSMarkerlocation(); } } }
8,048
0.572192
0.57008
214
36.612148
27.252266
135
false
false
0
0
0
0
0
0
0.565421
false
false
13
fb86d03fba74efdd58443fabf51bd4f5d4b22d15
15,865,609,224,509
945939798a410146eb6a6141e07894636d60a297
/src/main/java/com/epam/firstaid/dto/DataDTO.java
2d2268a17d40c937a9fc5994d16e5d72f366c833
[]
no_license
HPeterf/Mentoring
https://github.com/HPeterf/Mentoring
1e3c6f7c6b6a2cf1755c69954aafb8ea5c7480c6
e98561281d5d55b71727efa5c19441a16a0cdee2
refs/heads/master
2022-05-03T08:24:30.042000
2020-02-11T18:03:30
2020-02-11T18:03:30
234,137,596
0
0
null
false
2022-04-27T21:19:59
2020-01-15T17:42:20
2020-02-11T18:03:45
2022-04-27T21:19:59
70
0
0
2
Java
false
false
package com.epam.firstaid.dto; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @Getter @Setter @EqualsAndHashCode @JsonIgnoreProperties(ignoreUnknown = true) public class DataDTO { @JsonProperty("employee") private EmployeeDTO employeeDTO; @JsonProperty("approver") private ApproverDTO approverDTO; private Long id; @JsonProperty("type") private TypeDTO typeDTO; private Long duration; @JsonProperty("status") private StatusDTO statusDTO; private Long endDate; private Long startDate; private Long processInstanceId; private String vacationForm; private boolean confirmativeDocumentAvailable; }
UTF-8
Java
784
java
DataDTO.java
Java
[]
null
[]
package com.epam.firstaid.dto; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @Getter @Setter @EqualsAndHashCode @JsonIgnoreProperties(ignoreUnknown = true) public class DataDTO { @JsonProperty("employee") private EmployeeDTO employeeDTO; @JsonProperty("approver") private ApproverDTO approverDTO; private Long id; @JsonProperty("type") private TypeDTO typeDTO; private Long duration; @JsonProperty("status") private StatusDTO statusDTO; private Long endDate; private Long startDate; private Long processInstanceId; private String vacationForm; private boolean confirmativeDocumentAvailable; }
784
0.790816
0.790816
41
18.121952
16.729111
61
false
false
0
0
0
0
0
0
0.414634
false
false
13
3c0ac7e7723a6bfd643cf2517fd649f693314aa7
20,839,181,354,286
ab277a72b736efdc05ea02360ae8d8fdc107e39d
/app/src/main/java/com/quangtd/qgifmaker/screen/complete/CompleteActivity.java
95b7a63522a57579fe4aad7873e8550cb87da313
[]
no_license
quangtd95/QGif
https://github.com/quangtd95/QGif
20928b61d51bbd4c9c56f1aecc8aac214c39b26d
d92f060126f569438b09ac1e78a9dfd32baf0261
refs/heads/master
2020-05-28T08:41:44.458000
2019-05-21T03:13:37
2019-05-21T03:13:37
188,943,178
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.quangtd.qgifmaker.screen.complete; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.content.FileProvider; import android.text.TextUtils; import android.widget.ImageView; import android.widget.TextView; import com.quangtd.qgifmaker.R; import com.quangtd.qgifmaker.common.Constants; import com.quangtd.qgifmaker.common.GlideApp; import com.quangtd.qgifmaker.common.base.BaseActivity; import java.io.File; /** * Created by quang.td95@gmail.com * on 9/29/2018. */ public class CompleteActivity extends BaseActivity<CompletePresenter> implements CompleteView { private ImageView mImvGif; private ImageView imvBack; private ImageView imvShare; private TextView tvShare; private TextView mTvResultPath; private String mResultPath; @Override protected int getIdLayout() { return R.layout.activity_complete; } @Override protected void bindData() { Bundle bundle = getIntent().getExtras(); if (bundle != null) { String resultPath = bundle.getString(Constants.BUNDLE_KEY_PATH_GIF); if (TextUtils.isEmpty(resultPath)) { //TODO: finish(); } else { mResultPath = resultPath; mTvResultPath.setText(resultPath); GlideApp.with(this).load(resultPath).into(mImvGif); } } else { //TODO: finish(); } } @Override protected void initViews() { mImvGif = findViewById(R.id.imvGif); imvBack = findViewById(R.id.imvBack); imvShare = findViewById(R.id.imvShare); tvShare = findViewById(R.id.tvShare); mTvResultPath = findViewById(R.id.tvResultPath); } @Override protected void initActions() { imvBack.setOnClickListener(v -> finish()); imvShare.setOnClickListener(v -> shareGif(mResultPath)); tvShare.setOnClickListener(v -> shareGif(mResultPath)); } private void shareGif(String resourceName) { Uri apkURI = FileProvider.getUriForFile( this, this.getApplicationContext() .getPackageName() + ".provider", new File(resourceName)); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("image/gif"); shareIntent.putExtra(Intent.EXTRA_STREAM, apkURI); startActivity(Intent.createChooser(shareIntent, "Share Gif")); } public static void startCompleteActivity(Context context, String resultPath) { Intent intent = new Intent(context, CompleteActivity.class); Bundle bundle = new Bundle(); bundle.putString(Constants.BUNDLE_KEY_PATH_GIF, resultPath); intent.putExtras(bundle); context.startActivity(intent); } }
UTF-8
Java
2,908
java
CompleteActivity.java
Java
[ { "context": "Activity;\n\nimport java.io.File;\n\n/**\n * Created by quang.td95@gmail.com\n * on 9/29/2018.\n */\npublic class CompleteActivit", "end": 547, "score": 0.9999135136604309, "start": 527, "tag": "EMAIL", "value": "quang.td95@gmail.com" } ]
null
[]
package com.quangtd.qgifmaker.screen.complete; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.content.FileProvider; import android.text.TextUtils; import android.widget.ImageView; import android.widget.TextView; import com.quangtd.qgifmaker.R; import com.quangtd.qgifmaker.common.Constants; import com.quangtd.qgifmaker.common.GlideApp; import com.quangtd.qgifmaker.common.base.BaseActivity; import java.io.File; /** * Created by <EMAIL> * on 9/29/2018. */ public class CompleteActivity extends BaseActivity<CompletePresenter> implements CompleteView { private ImageView mImvGif; private ImageView imvBack; private ImageView imvShare; private TextView tvShare; private TextView mTvResultPath; private String mResultPath; @Override protected int getIdLayout() { return R.layout.activity_complete; } @Override protected void bindData() { Bundle bundle = getIntent().getExtras(); if (bundle != null) { String resultPath = bundle.getString(Constants.BUNDLE_KEY_PATH_GIF); if (TextUtils.isEmpty(resultPath)) { //TODO: finish(); } else { mResultPath = resultPath; mTvResultPath.setText(resultPath); GlideApp.with(this).load(resultPath).into(mImvGif); } } else { //TODO: finish(); } } @Override protected void initViews() { mImvGif = findViewById(R.id.imvGif); imvBack = findViewById(R.id.imvBack); imvShare = findViewById(R.id.imvShare); tvShare = findViewById(R.id.tvShare); mTvResultPath = findViewById(R.id.tvResultPath); } @Override protected void initActions() { imvBack.setOnClickListener(v -> finish()); imvShare.setOnClickListener(v -> shareGif(mResultPath)); tvShare.setOnClickListener(v -> shareGif(mResultPath)); } private void shareGif(String resourceName) { Uri apkURI = FileProvider.getUriForFile( this, this.getApplicationContext() .getPackageName() + ".provider", new File(resourceName)); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("image/gif"); shareIntent.putExtra(Intent.EXTRA_STREAM, apkURI); startActivity(Intent.createChooser(shareIntent, "Share Gif")); } public static void startCompleteActivity(Context context, String resultPath) { Intent intent = new Intent(context, CompleteActivity.class); Bundle bundle = new Bundle(); bundle.putString(Constants.BUNDLE_KEY_PATH_GIF, resultPath); intent.putExtras(bundle); context.startActivity(intent); } }
2,895
0.658184
0.654746
89
31.674158
22.939968
95
false
false
0
0
0
0
0
0
0.595506
false
false
13
68101070bc00585723ca100d3ee3c04f779f9f1e
7,138,235,676,144
65e6876cc5c29ee2070bee6cb906ba60a145e6ef
/src/main/java/com/sizatn/springdemo/common/utils/XMLParser.java
324b30c74188093c614c296716f182d7106634d0
[]
no_license
sizatn/springdemo
https://github.com/sizatn/springdemo
f259406edd4ab1ef09d773749726dcfc2f2b6003
6160b9be72cbc643f66a4d8c1cbe06c6f3d418cd
refs/heads/master
2020-05-28T09:10:11.685000
2018-06-27T01:43:22
2018-06-27T01:43:22
93,988,664
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sizatn.springdemo.common.utils; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.input.SAXBuilder; public class XMLParser { private static final Log log = LogFactory.getLog(XMLParser.class); private String xmlString = null; private File xmlFile = null; private String encoding = "UTF-8"; private Document document = null; private Map propertyCache = new HashMap(); public XMLParser(String xmlString) throws Exception{ this.xmlString = xmlString; this.document = this.parseDocument(this.xmlString); } public XMLParser(String xmlString,String encoding) throws Exception{ this.xmlString = xmlString; this.encoding = encoding; this.document = this.parseDocument(this.xmlString); } public XMLParser(File xmlFile) throws Exception{ this.xmlFile = xmlFile; this.document = this.parseDocument(this.xmlFile); } /** * Returns the value of the specified property. * @param name the name of the property to get. * @return the value of the specified property. */ public String getProperty(String name) { if (propertyCache.containsKey(name)) { return (String) this.getPropertyCache().get(name); } Element element = this.getDocument().getRootElement(); return this.getProperty(element, name, name); } private String getProperty(Element element,String name,String key) { if(element==null) return null; /* if (propertyCache.containsKey(key)) { return (String) this.getPropertyCache().get(key); } */ String resultValue = null; String[] propName = this.parsePropertyName(name); int len = propName.length; for (int i = 0; i < len; i++) { //System.out.println(i+"\t"+propName[i]+"\t"+element); if(i==len-1){ resultValue = element.getTextTrim(); } else{ String attributeValue = element.getAttributeValue(propName[i+1]); element = element.getChild(propName[i+1]); if(element==null && StringUtils.isNotEmpty(attributeValue) && i==len-2){ resultValue = attributeValue; break; } } if(element==null){ resultValue = null; break; } } if(resultValue!=null){ this.getPropertyCache().put(key, resultValue); } return resultValue; } public int getPropertyNum(String name){ return this.getPropertyNum(this.getDocument().getRootElement(), name); } public int getPropertyNum(String prefix,int no,String postfix){ Element ele = this.getElement(prefix, no); return this.getPropertyNum(ele, postfix); } public String getProperty(String prefix,int no,String postfix) { String key = prefix+"."+no+"."+postfix; if (this.getPropertyCache().containsKey(key)) { return (String) this.getPropertyCache().get(key); } Element ele = this.getElement(prefix,no); if(ele!=null){ return this.getProperty(ele,postfix,key); } return null; } public String getProperty(String prefix1,int no1,String prefix2,int no2,String postfix) { String key = prefix1+"."+no1+"."+prefix2+"."+no2+"."+postfix; if (this.getPropertyCache().containsKey(key)) { return (String) this.getPropertyCache().get(key); } Element ele = this.getElement(prefix1,no1); ele = this.getElement(ele,prefix2, no2); return this.getProperty(ele, postfix, key); } private Element getElement(Element element,String prefix,int no){ String[] propName = parsePropertyName(prefix); int len = propName.length; List eleList = null; for (int i = 0; i < len;) { //System.out.println(element); if(i==len-1){ //if(element.getChild(propName[i])!=null) eleList = element.getChildren(); break; } else{ i++; element = element.getChild(propName[i]); if (element == null) { break; } } } if(eleList!=null){ int eleSize = eleList.size(); if(no>eleSize-1){ return null; } Element tmpEle = (Element)eleList.get(no); return tmpEle; } return null; } private Element getElement(String prefix,int no) { return this.getElement(this.getDocument().getRootElement(), prefix, no); /* String[] propName = parsePropertyName(prefix); int len = propName.length; List eleList = null; Element element = this.getDocument().getRootElement(); for (int i = 0; i < len;) { //System.out.println(element); if(i==len-1){ //if(element.getChild(propName[i])!=null) eleList = element.getChildren(); break; } else{ i++; element = element.getChild(propName[i]); if (element == null) { break; } } } if(eleList!=null){ int eleSize = eleList.size(); if(no>eleSize-1){ return null; } Element tmpEle = (Element)eleList.get(no); return tmpEle; } return null; */ } private int getPropertyNum(Element element,String name){ //System.out.println(element); int num = 0; String[] propName = this.parsePropertyName(name); int len = propName.length; for (int i = 0; i < len;) { if(i==len-1){ num = element.getChildren().size(); break; } else{ i++; //System.out.println("# = "+propName[i]); element = element.getChild(propName[i]); //System.out.println(i+"="+element); //System.out.println("=============="); if (element == null) { break; } } } return num; } public void clear(){ this.propertyCache.clear(); } public Map getPropertyCache() { return propertyCache; } public void setPropertyCache(Map propertyCache) { this.propertyCache = propertyCache; } public String getXmlString() { return xmlString; } public void setXmlString(String xmlString) { this.xmlString = xmlString; } public Document getDocument() { return document; } public void setDocument(Document document) { this.document = document; } private Document parseDocument(String xmlString) throws Exception{ Document doc = null; try { SAXBuilder builder = new SAXBuilder(); DataUnformatFilter format = new DataUnformatFilter(); builder.setXMLFilter(format); if(StringUtils.isEmpty(this.encoding)){ doc = builder.build(new java.io.ByteArrayInputStream(xmlString.getBytes())); } else{ doc = builder.build(new java.io.ByteArrayInputStream(xmlString.getBytes(this.encoding))); } } catch (Exception ex) { log.error(ex); throw ex; } return doc; } private Document parseDocument(File xmlFile) throws Exception{ Document doc = null; try { SAXBuilder builder = new SAXBuilder(); DataUnformatFilter format = new DataUnformatFilter(); builder.setXMLFilter(format); doc = builder.build(xmlFile); } catch (Exception ex) { log.error(ex); throw ex; } return doc; } /** * Returns an array representation of the given Jive property. Jive * properties are always in the format "prop.name.is.this" which would be * represented as an array of four Strings. * @param name the name of the Jive property. * @return an array representation of the given Jive property. */ private String[] parsePropertyName(String name) { // Figure out the number of parts of the name (this becomes the size // of the resulting array). int size = 1; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '.') { size++; } } String[] propName = new String[size]; // Use a StringTokenizer to tokenize the property name. StringTokenizer tokenizer = new StringTokenizer(name, "."); int i = 0; while (tokenizer.hasMoreTokens()) { propName[i] = tokenizer.nextToken(); i++; } return propName; } public static void main(String[] args) { // String xml = "<request><head><target>road</target><type>create</type><encoding>GBK</encoding><title>新增路口信息</title></head><body><fields><id>234</id><name>解放路口</name><parentId>-1</parentId></fields></body></request>"; // XMLParser parser = new XMLParser(xml); // System.out.println("value = "+parser.getProperty("request.head.type")); /* String xml1 = "<request><head version=\"1.0.0.0\" target=\"roleDept\" type=\"update\" encoding=\"UTF-8\"/><body><fields><roleId>roleIda</roleId><list><union id=\"2\" deptId=\"22\"/><union id=\"3\" deptId=\"33\"/></list></fields></body></request>"; XMLParser parser = null; try { parser = new XMLParser(xml1); } catch (Exception e) { e.printStackTrace(); } //System.out.println("roleId = "+parser.getProperty("request.body.fields.roleId")); //System.out.println("num = "+parser.getPropertyNum("request.body.fields.list")); System.out.println("num = "+parser.getPropertyNum("request.body.fields.list")); System.out.println("value = "+parser.getProperty("request.body.fields.list", 1, "union.deptId")); */ /* String sqlConfigFile = "D:/work/tiip/standard/tiip_sanshui/project/tiipWeb/WebContent/WEB-INF/config/sql/oracle-9i.xml"; log.debug("SQL配置文件:"+sqlConfigFile); try { XMLParser parser = new XMLParser(new File(sqlConfigFile)); System.out.println(parser.getProperty("param-config.punish.punishAnalysisReport")); } catch (Exception e) { e.printStackTrace(); } */ /* String sqlConfigFile = "D:/work/tiip/standard/tiip_v2/project/tiipWeb/WebContent/WEB-INF/config/version/oracle-9i.xml"; try { XMLParser xmlParser = new XMLParser(new File(sqlConfigFile)); int size = xmlParser.getPropertyNum("version-config"); boolean found = true; System.out.println("size = "+size); for(int i=0;i<size;i++){ if(found){ String versionNo = xmlParser.getProperty("version-config", i, "version.no"); int sqlSize = xmlParser.getPropertyNum("version-config", i, "version"); for(int j=0;j<sqlSize;j++){ String sql = xmlParser.getProperty("version-config", i, "version", j, "sql"); System.out.println(sql); } } } } catch (Exception e) { e.printStackTrace(); } *//* String xml = "<?xml version=\"1.0\" encoding=\"GBK\"?> <root><head><code>1</code> <message>数据下载成功!</message> </head> <body> <rownum>1</rownum> <vehicle id=\"0\"> <ltgg>215/75R15</ltgg> <hlj>1430</hlj> <xsjg>0</xsjg> <clpp2>#</clpp2> <ccrq>2003-05-01</ccrq> <fprq>1900-01-01</fprq> <fzrq>2003-08-11</fzrq> <zsxxdz>陕西西安莲湖区北院111号中院50号</zsxxdz>" + "<hgzbh>#</hgzbh>"+ "<zj>3380</zj>"+ "<syxz>A</syxz>"+ "<hdzk>5</hdzk>"+ "<glbm>610100</glbm>"+ "<csys>G</csys>"+ "<zzcmc>保定长城汽车股份有限公司</zzcmc>"+ "<sfzmhm>610104196003071114</sfzmhm>"+ "<lsh>#</lsh>"+ "<rlzl>A</rlzl>"+ "<qlj>1450</qlj>"+ "<clly>1</clly>"+ "<cwkc>5035</cwkc>"+ "<xzqh>610100</xzqh>"+ "<zdyzt>#</zdyzt>"+ "<hbdbqk>#</hbdbqk>"+ "<qpzk>2</qpzk>"+ "<clsbdh>LZACA2GA13A001888</clsbdh>"+ "<lts>4</lts>"+ "<jbr>#</jbr>"+ "<yzbm1>710012</yzbm1>"+ "<cwkk>1740</cwkk>"+ "<bz>#</bz>"+ "<qmbh>#</qmbh>"+ "<cwkg>1670</cwkg>"+ "<xsrq>1900-01-01</xsrq>"+ "<zdjzshs>0</zdjzshs>"+ "<hxnbgd>405</hxnbgd>"+ "<zzxxdz>#</zzxxdz>"+ "<syr>张民强</syr>"+ "<fzjg>陕A</fzjg>"+ "<gcjk>A</gcjk>"+ "<hpzl>02</hpzl>"+ "<pl>2237</pl>"+ "<hdfs>A</hdfs>"+ "<yxqz>2009-07-31</yxqz>"+ "<zs>2</zs>"+ "<xgzl>#</xgzl>"+ "<lxdh>8402838</lxdh>"+ "<hphm>A12345</hphm>"+ "<zzl>2245</zzl>"+ "<clxh>CC1021AR</clxh>"+ "<zzz>#</zzz>"+ "<bzcs></bzcs>"+ "<yxh></yxh>"+ "<gbthps>10</gbthps>"+ "<xsdw>#</xsdw>"+ "<fdjxh>491QE</fdjxh>"+ "<pzbh1>0126488</pzbh1>"+ "<fhgzrq>2008-09-22</fhgzrq>"+ "<gl>0</gl>"+ "<bxzzrq>2009-09-24</bxzzrq>"+ "<zzxzqh>#</zzxzqh>"+ "<zqyzl>0</zqyzl>"+ "<llpz2>#</llpz2>"+ "<hxnbkd>1465</hxnbkd>"+ "<jkpzhm>#</jkpzhm>"+ "<fdjrq>2003-08-11</fdjrq>"+ "<zzg>156</zzg>"+ "<nszmbh>610025843</nszmbh>"+ "<cllx>H31</cllx>"+ "<jkpz>#</jkpz>"+ "<zbzl>1420</zbzl>"+ "<fdjh>D030486980</fdjh>"+ "<djzsbh>610000212430</djzsbh>"+ "<bdjcs>0</bdjcs>"+ "<djrq>2008-09-19</djrq> "+ "<gxrq>2008-09-22</gxrq> "+ "<ccdjrq>2003-07-28</ccdjrq> "+ "<hdzzl>500</hdzzl> "+ "<hpzk>0</hpzk> "+ "<hxnbcd>1865</hxnbcd> "+ "<qzbfqz>2018-07-28</qzbfqz> "+ "<dybj>0</dybj> "+ "<zsxzqh>610104</zsxzqh> "+ "<sfzmmc>A</sfzmmc> "+ "<pzbh2>#</pzbh2> "+ "<hmbh>#</hmbh> "+ "<llpz1>A</llpz1> "+ "<dabh>#</dabh> "+ "<yzbm2>#</yzbm2> "+ "<zxxs>1</zxxs> "+ "<nszm>1</nszm> "+ "<zt>A</zt> "+ "<bpcs>0</bpcs> "+ "<clpp1>长城</clpp1>"+ "</vehicle> </body></root>"; XMLParser parser; try { parser = new XMLParser(xml); System.out.println(Integer.parseInt(parser.getProperty("root.body.rownum"))); System.out.println(parser.getProperty("root.body.vehicle.clpp1")); System.out.println(parser.getProperty("root.body.vehicle.clpp2")); System.out.println(parser.getProperty("root.body.vehicle.zsxxdz")); System.out.println(parser.getProperty("root.body.vehicle.clsbdh")); System.out.println(parser.getProperty("root.body.vehicle.csys")); System.out.println(parser.getProperty("root.body.vehicle.syr")); System.out.println(parser.getProperty("root.body.vehicle.lxdh")); System.out.println(parser.getProperty("root.body.vehicle.yzbm1")); } catch (Exception e) { e.printStackTrace(); } */ String xml= new String("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +"<response><head><code>0</code><message>成功</message></head>" +"<body><xh>44010094394814</xh><hpzl>02</hpzl><hphm>A88888</hphm>" +"<syr>广州金利来城市房产有限公司 (曾智雄)</syr><zsxxdz>广州金利来城市房产有限公司 </zsxxdz>" +"<lxdh>38780800-816</lxdh><cllx>k33</cllx><clpp1>劳斯莱斯</clpp1><csys>H</csys>" +"<clxh>SCAZN00CZRCX</clxh><yzbm1>000000</yzbm1></body></response>"); XMLParser parser; try { System.out.println(new String(xml.getBytes("UTF-8"),"GBK")); parser = new XMLParser(xml); System.out.println(parser.getProperty("response.head.code")); System.out.println(parser.getProperty("response.head.message")); System.out.println(parser.getProperty("response.body.syr")); System.out.println(parser.getProperty("response.body.zsxxdz")); System.out.println(parser.getProperty("response.body.lxdh")); System.out.println(parser.getProperty("response.body.clpp1")); System.out.println(parser.getProperty("response.body.clxh")); System.out.println(parser.getProperty("response.body.csys")); System.out.println(parser.getProperty("response.body.cllx")); } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
15,183
java
XMLParser.java
Java
[ { "context": " prefix,int no,String postfix) {\t\t\r\n\t\tString key = prefix+\".\"+no+\".\"+postfix;\r\n\t\tif (this.getPropertyCache().con", "end": 2913, "score": 0.7265739440917969, "start": 2902, "tag": "KEY", "value": "prefix+\".\"+" }, { "context": ",String postfix) {\t\t\r\n\t\tString key = prefix+\".\"+no+\".\"+postfix;\r\n\t\tif (this.getPropertyCache().contains", "end": 2915, "score": 0.6067802309989929, "start": 2915, "tag": "KEY", "value": "" }, { "context": "ng postfix) {\t\t\r\n\t\tString key = prefix+\".\"+no+\".\"+postfix;\r\n\t\tif (this.getPropertyCache().containsKey(key))", "end": 2927, "score": 0.6758551001548767, "start": 2920, "tag": "KEY", "value": "postfix" }, { "context": " prefix2,int no2,String postfix) {\r\n\t\tString key = prefix1+\".\"+no1+\".\"+prefix2+\".\"+no2+\".\"+postfix;\r\n\t\tif (this.getPropertyCache().containsKey(key)) ", "end": 3334, "score": 0.9481768012046814, "start": 3286, "tag": "KEY", "value": "prefix1+\".\"+no1+\".\"+prefix2+\".\"+no2+\".\"+postfix;" } ]
null
[]
package com.sizatn.springdemo.common.utils; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.input.SAXBuilder; public class XMLParser { private static final Log log = LogFactory.getLog(XMLParser.class); private String xmlString = null; private File xmlFile = null; private String encoding = "UTF-8"; private Document document = null; private Map propertyCache = new HashMap(); public XMLParser(String xmlString) throws Exception{ this.xmlString = xmlString; this.document = this.parseDocument(this.xmlString); } public XMLParser(String xmlString,String encoding) throws Exception{ this.xmlString = xmlString; this.encoding = encoding; this.document = this.parseDocument(this.xmlString); } public XMLParser(File xmlFile) throws Exception{ this.xmlFile = xmlFile; this.document = this.parseDocument(this.xmlFile); } /** * Returns the value of the specified property. * @param name the name of the property to get. * @return the value of the specified property. */ public String getProperty(String name) { if (propertyCache.containsKey(name)) { return (String) this.getPropertyCache().get(name); } Element element = this.getDocument().getRootElement(); return this.getProperty(element, name, name); } private String getProperty(Element element,String name,String key) { if(element==null) return null; /* if (propertyCache.containsKey(key)) { return (String) this.getPropertyCache().get(key); } */ String resultValue = null; String[] propName = this.parsePropertyName(name); int len = propName.length; for (int i = 0; i < len; i++) { //System.out.println(i+"\t"+propName[i]+"\t"+element); if(i==len-1){ resultValue = element.getTextTrim(); } else{ String attributeValue = element.getAttributeValue(propName[i+1]); element = element.getChild(propName[i+1]); if(element==null && StringUtils.isNotEmpty(attributeValue) && i==len-2){ resultValue = attributeValue; break; } } if(element==null){ resultValue = null; break; } } if(resultValue!=null){ this.getPropertyCache().put(key, resultValue); } return resultValue; } public int getPropertyNum(String name){ return this.getPropertyNum(this.getDocument().getRootElement(), name); } public int getPropertyNum(String prefix,int no,String postfix){ Element ele = this.getElement(prefix, no); return this.getPropertyNum(ele, postfix); } public String getProperty(String prefix,int no,String postfix) { String key = prefix+"."+no+"."+postfix; if (this.getPropertyCache().containsKey(key)) { return (String) this.getPropertyCache().get(key); } Element ele = this.getElement(prefix,no); if(ele!=null){ return this.getProperty(ele,postfix,key); } return null; } public String getProperty(String prefix1,int no1,String prefix2,int no2,String postfix) { String key = prefix1+"."+no1+"."+prefix2+"."+no2+"."+postfix; if (this.getPropertyCache().containsKey(key)) { return (String) this.getPropertyCache().get(key); } Element ele = this.getElement(prefix1,no1); ele = this.getElement(ele,prefix2, no2); return this.getProperty(ele, postfix, key); } private Element getElement(Element element,String prefix,int no){ String[] propName = parsePropertyName(prefix); int len = propName.length; List eleList = null; for (int i = 0; i < len;) { //System.out.println(element); if(i==len-1){ //if(element.getChild(propName[i])!=null) eleList = element.getChildren(); break; } else{ i++; element = element.getChild(propName[i]); if (element == null) { break; } } } if(eleList!=null){ int eleSize = eleList.size(); if(no>eleSize-1){ return null; } Element tmpEle = (Element)eleList.get(no); return tmpEle; } return null; } private Element getElement(String prefix,int no) { return this.getElement(this.getDocument().getRootElement(), prefix, no); /* String[] propName = parsePropertyName(prefix); int len = propName.length; List eleList = null; Element element = this.getDocument().getRootElement(); for (int i = 0; i < len;) { //System.out.println(element); if(i==len-1){ //if(element.getChild(propName[i])!=null) eleList = element.getChildren(); break; } else{ i++; element = element.getChild(propName[i]); if (element == null) { break; } } } if(eleList!=null){ int eleSize = eleList.size(); if(no>eleSize-1){ return null; } Element tmpEle = (Element)eleList.get(no); return tmpEle; } return null; */ } private int getPropertyNum(Element element,String name){ //System.out.println(element); int num = 0; String[] propName = this.parsePropertyName(name); int len = propName.length; for (int i = 0; i < len;) { if(i==len-1){ num = element.getChildren().size(); break; } else{ i++; //System.out.println("# = "+propName[i]); element = element.getChild(propName[i]); //System.out.println(i+"="+element); //System.out.println("=============="); if (element == null) { break; } } } return num; } public void clear(){ this.propertyCache.clear(); } public Map getPropertyCache() { return propertyCache; } public void setPropertyCache(Map propertyCache) { this.propertyCache = propertyCache; } public String getXmlString() { return xmlString; } public void setXmlString(String xmlString) { this.xmlString = xmlString; } public Document getDocument() { return document; } public void setDocument(Document document) { this.document = document; } private Document parseDocument(String xmlString) throws Exception{ Document doc = null; try { SAXBuilder builder = new SAXBuilder(); DataUnformatFilter format = new DataUnformatFilter(); builder.setXMLFilter(format); if(StringUtils.isEmpty(this.encoding)){ doc = builder.build(new java.io.ByteArrayInputStream(xmlString.getBytes())); } else{ doc = builder.build(new java.io.ByteArrayInputStream(xmlString.getBytes(this.encoding))); } } catch (Exception ex) { log.error(ex); throw ex; } return doc; } private Document parseDocument(File xmlFile) throws Exception{ Document doc = null; try { SAXBuilder builder = new SAXBuilder(); DataUnformatFilter format = new DataUnformatFilter(); builder.setXMLFilter(format); doc = builder.build(xmlFile); } catch (Exception ex) { log.error(ex); throw ex; } return doc; } /** * Returns an array representation of the given Jive property. Jive * properties are always in the format "prop.name.is.this" which would be * represented as an array of four Strings. * @param name the name of the Jive property. * @return an array representation of the given Jive property. */ private String[] parsePropertyName(String name) { // Figure out the number of parts of the name (this becomes the size // of the resulting array). int size = 1; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '.') { size++; } } String[] propName = new String[size]; // Use a StringTokenizer to tokenize the property name. StringTokenizer tokenizer = new StringTokenizer(name, "."); int i = 0; while (tokenizer.hasMoreTokens()) { propName[i] = tokenizer.nextToken(); i++; } return propName; } public static void main(String[] args) { // String xml = "<request><head><target>road</target><type>create</type><encoding>GBK</encoding><title>新增路口信息</title></head><body><fields><id>234</id><name>解放路口</name><parentId>-1</parentId></fields></body></request>"; // XMLParser parser = new XMLParser(xml); // System.out.println("value = "+parser.getProperty("request.head.type")); /* String xml1 = "<request><head version=\"1.0.0.0\" target=\"roleDept\" type=\"update\" encoding=\"UTF-8\"/><body><fields><roleId>roleIda</roleId><list><union id=\"2\" deptId=\"22\"/><union id=\"3\" deptId=\"33\"/></list></fields></body></request>"; XMLParser parser = null; try { parser = new XMLParser(xml1); } catch (Exception e) { e.printStackTrace(); } //System.out.println("roleId = "+parser.getProperty("request.body.fields.roleId")); //System.out.println("num = "+parser.getPropertyNum("request.body.fields.list")); System.out.println("num = "+parser.getPropertyNum("request.body.fields.list")); System.out.println("value = "+parser.getProperty("request.body.fields.list", 1, "union.deptId")); */ /* String sqlConfigFile = "D:/work/tiip/standard/tiip_sanshui/project/tiipWeb/WebContent/WEB-INF/config/sql/oracle-9i.xml"; log.debug("SQL配置文件:"+sqlConfigFile); try { XMLParser parser = new XMLParser(new File(sqlConfigFile)); System.out.println(parser.getProperty("param-config.punish.punishAnalysisReport")); } catch (Exception e) { e.printStackTrace(); } */ /* String sqlConfigFile = "D:/work/tiip/standard/tiip_v2/project/tiipWeb/WebContent/WEB-INF/config/version/oracle-9i.xml"; try { XMLParser xmlParser = new XMLParser(new File(sqlConfigFile)); int size = xmlParser.getPropertyNum("version-config"); boolean found = true; System.out.println("size = "+size); for(int i=0;i<size;i++){ if(found){ String versionNo = xmlParser.getProperty("version-config", i, "version.no"); int sqlSize = xmlParser.getPropertyNum("version-config", i, "version"); for(int j=0;j<sqlSize;j++){ String sql = xmlParser.getProperty("version-config", i, "version", j, "sql"); System.out.println(sql); } } } } catch (Exception e) { e.printStackTrace(); } *//* String xml = "<?xml version=\"1.0\" encoding=\"GBK\"?> <root><head><code>1</code> <message>数据下载成功!</message> </head> <body> <rownum>1</rownum> <vehicle id=\"0\"> <ltgg>215/75R15</ltgg> <hlj>1430</hlj> <xsjg>0</xsjg> <clpp2>#</clpp2> <ccrq>2003-05-01</ccrq> <fprq>1900-01-01</fprq> <fzrq>2003-08-11</fzrq> <zsxxdz>陕西西安莲湖区北院111号中院50号</zsxxdz>" + "<hgzbh>#</hgzbh>"+ "<zj>3380</zj>"+ "<syxz>A</syxz>"+ "<hdzk>5</hdzk>"+ "<glbm>610100</glbm>"+ "<csys>G</csys>"+ "<zzcmc>保定长城汽车股份有限公司</zzcmc>"+ "<sfzmhm>610104196003071114</sfzmhm>"+ "<lsh>#</lsh>"+ "<rlzl>A</rlzl>"+ "<qlj>1450</qlj>"+ "<clly>1</clly>"+ "<cwkc>5035</cwkc>"+ "<xzqh>610100</xzqh>"+ "<zdyzt>#</zdyzt>"+ "<hbdbqk>#</hbdbqk>"+ "<qpzk>2</qpzk>"+ "<clsbdh>LZACA2GA13A001888</clsbdh>"+ "<lts>4</lts>"+ "<jbr>#</jbr>"+ "<yzbm1>710012</yzbm1>"+ "<cwkk>1740</cwkk>"+ "<bz>#</bz>"+ "<qmbh>#</qmbh>"+ "<cwkg>1670</cwkg>"+ "<xsrq>1900-01-01</xsrq>"+ "<zdjzshs>0</zdjzshs>"+ "<hxnbgd>405</hxnbgd>"+ "<zzxxdz>#</zzxxdz>"+ "<syr>张民强</syr>"+ "<fzjg>陕A</fzjg>"+ "<gcjk>A</gcjk>"+ "<hpzl>02</hpzl>"+ "<pl>2237</pl>"+ "<hdfs>A</hdfs>"+ "<yxqz>2009-07-31</yxqz>"+ "<zs>2</zs>"+ "<xgzl>#</xgzl>"+ "<lxdh>8402838</lxdh>"+ "<hphm>A12345</hphm>"+ "<zzl>2245</zzl>"+ "<clxh>CC1021AR</clxh>"+ "<zzz>#</zzz>"+ "<bzcs></bzcs>"+ "<yxh></yxh>"+ "<gbthps>10</gbthps>"+ "<xsdw>#</xsdw>"+ "<fdjxh>491QE</fdjxh>"+ "<pzbh1>0126488</pzbh1>"+ "<fhgzrq>2008-09-22</fhgzrq>"+ "<gl>0</gl>"+ "<bxzzrq>2009-09-24</bxzzrq>"+ "<zzxzqh>#</zzxzqh>"+ "<zqyzl>0</zqyzl>"+ "<llpz2>#</llpz2>"+ "<hxnbkd>1465</hxnbkd>"+ "<jkpzhm>#</jkpzhm>"+ "<fdjrq>2003-08-11</fdjrq>"+ "<zzg>156</zzg>"+ "<nszmbh>610025843</nszmbh>"+ "<cllx>H31</cllx>"+ "<jkpz>#</jkpz>"+ "<zbzl>1420</zbzl>"+ "<fdjh>D030486980</fdjh>"+ "<djzsbh>610000212430</djzsbh>"+ "<bdjcs>0</bdjcs>"+ "<djrq>2008-09-19</djrq> "+ "<gxrq>2008-09-22</gxrq> "+ "<ccdjrq>2003-07-28</ccdjrq> "+ "<hdzzl>500</hdzzl> "+ "<hpzk>0</hpzk> "+ "<hxnbcd>1865</hxnbcd> "+ "<qzbfqz>2018-07-28</qzbfqz> "+ "<dybj>0</dybj> "+ "<zsxzqh>610104</zsxzqh> "+ "<sfzmmc>A</sfzmmc> "+ "<pzbh2>#</pzbh2> "+ "<hmbh>#</hmbh> "+ "<llpz1>A</llpz1> "+ "<dabh>#</dabh> "+ "<yzbm2>#</yzbm2> "+ "<zxxs>1</zxxs> "+ "<nszm>1</nszm> "+ "<zt>A</zt> "+ "<bpcs>0</bpcs> "+ "<clpp1>长城</clpp1>"+ "</vehicle> </body></root>"; XMLParser parser; try { parser = new XMLParser(xml); System.out.println(Integer.parseInt(parser.getProperty("root.body.rownum"))); System.out.println(parser.getProperty("root.body.vehicle.clpp1")); System.out.println(parser.getProperty("root.body.vehicle.clpp2")); System.out.println(parser.getProperty("root.body.vehicle.zsxxdz")); System.out.println(parser.getProperty("root.body.vehicle.clsbdh")); System.out.println(parser.getProperty("root.body.vehicle.csys")); System.out.println(parser.getProperty("root.body.vehicle.syr")); System.out.println(parser.getProperty("root.body.vehicle.lxdh")); System.out.println(parser.getProperty("root.body.vehicle.yzbm1")); } catch (Exception e) { e.printStackTrace(); } */ String xml= new String("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +"<response><head><code>0</code><message>成功</message></head>" +"<body><xh>44010094394814</xh><hpzl>02</hpzl><hphm>A88888</hphm>" +"<syr>广州金利来城市房产有限公司 (曾智雄)</syr><zsxxdz>广州金利来城市房产有限公司 </zsxxdz>" +"<lxdh>38780800-816</lxdh><cllx>k33</cllx><clpp1>劳斯莱斯</clpp1><csys>H</csys>" +"<clxh>SCAZN00CZRCX</clxh><yzbm1>000000</yzbm1></body></response>"); XMLParser parser; try { System.out.println(new String(xml.getBytes("UTF-8"),"GBK")); parser = new XMLParser(xml); System.out.println(parser.getProperty("response.head.code")); System.out.println(parser.getProperty("response.head.message")); System.out.println(parser.getProperty("response.body.syr")); System.out.println(parser.getProperty("response.body.zsxxdz")); System.out.println(parser.getProperty("response.body.lxdh")); System.out.println(parser.getProperty("response.body.clpp1")); System.out.println(parser.getProperty("response.body.clxh")); System.out.println(parser.getProperty("response.body.csys")); System.out.println(parser.getProperty("response.body.cllx")); } catch (Exception e) { e.printStackTrace(); } } }
15,183
0.623226
0.595176
493
28.44422
30.084658
345
false
false
0
0
0
0
0
0
2.811359
false
false
13
dff0fe58e9fde4771248f3410aa08fa9725bfef9
33,638,183,929,205
027a98772b5ebbde2b487063716ee13fba21757e
/src/KmeansClustering/Main_clustering.java
540c5439b5b1d94fc84e20b18eeebcc8e8dd4982
[]
no_license
khalilzqz/BaseAlgorithm
https://github.com/khalilzqz/BaseAlgorithm
feb69ed3dc2ba0f7d932d4093060c65e98897563
cec498cae7cfc13c3ef801c4758251297ec0bba2
refs/heads/master
2020-12-30T14:12:59.693000
2017-05-15T03:36:47
2017-05-15T03:36:47
91,290,935
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package KmeansClustering; import java.io.IOException; import java.util.LinkedHashMap; import org.jfree.ui.RefineryUtilities; public class Main_clustering { public static LinkedHashMap<String, LinkedHashMap<Integer, Double>> dataset_sse_k_plot = new LinkedHashMap<String, LinkedHashMap<Integer, Double>>(); public static LinkedHashMap<String, LinkedHashMap<Integer, Double>> dataset_NMI_k_plot = new LinkedHashMap<String, LinkedHashMap<Integer, Double>>(); public static void main(String[] args) throws IOException { String input = "D:/DataForMining/K_means_Clustering/yeastData"; // datasetName, Epsilon for centroid start LinkedHashMap<String, Integer> datasets = new LinkedHashMap<String, Integer>(); datasets.put(input + ".csv", 100); /* * "dermatologyData.csv datasets.put("ecoliData.csv",100); * datasets.put("glassData.csv",100); * datasets.put("soybeanData.csv",100); * datasets.put("vowelsData.csv",100); * datasets.put("yeastData.csv",100); */ Clustering_Models cm = new Clustering_Models(); cm.KmeansAlgo(datasets); for (String dataset : dataset_sse_k_plot.keySet()) { XYSeriesPlot demo = new XYSeriesPlot(dataset, dataset_sse_k_plot.get(dataset), "SSE"); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); } for (String dataset : dataset_NMI_k_plot.keySet()) { XYSeriesPlot demo = new XYSeriesPlot(dataset, dataset_NMI_k_plot.get(dataset), "NMI"); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); } } }
UTF-8
Java
1,556
java
Main_clustering.java
Java
[]
null
[]
package KmeansClustering; import java.io.IOException; import java.util.LinkedHashMap; import org.jfree.ui.RefineryUtilities; public class Main_clustering { public static LinkedHashMap<String, LinkedHashMap<Integer, Double>> dataset_sse_k_plot = new LinkedHashMap<String, LinkedHashMap<Integer, Double>>(); public static LinkedHashMap<String, LinkedHashMap<Integer, Double>> dataset_NMI_k_plot = new LinkedHashMap<String, LinkedHashMap<Integer, Double>>(); public static void main(String[] args) throws IOException { String input = "D:/DataForMining/K_means_Clustering/yeastData"; // datasetName, Epsilon for centroid start LinkedHashMap<String, Integer> datasets = new LinkedHashMap<String, Integer>(); datasets.put(input + ".csv", 100); /* * "dermatologyData.csv datasets.put("ecoliData.csv",100); * datasets.put("glassData.csv",100); * datasets.put("soybeanData.csv",100); * datasets.put("vowelsData.csv",100); * datasets.put("yeastData.csv",100); */ Clustering_Models cm = new Clustering_Models(); cm.KmeansAlgo(datasets); for (String dataset : dataset_sse_k_plot.keySet()) { XYSeriesPlot demo = new XYSeriesPlot(dataset, dataset_sse_k_plot.get(dataset), "SSE"); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); } for (String dataset : dataset_NMI_k_plot.keySet()) { XYSeriesPlot demo = new XYSeriesPlot(dataset, dataset_NMI_k_plot.get(dataset), "NMI"); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); } } }
1,556
0.728149
0.716581
47
32.106384
35.635406
150
false
false
0
0
0
0
0
0
2.276596
false
false
13
c5dca5820b23ade54c666c96eef99aaa2fcc4b25
31,147,102,890,450
0cd85b9f7f930cc69302679b983c8ccf40bd07b7
/src/main/java/com/service/StatusReceiverImpl.java
60f6285e3174d709a3b85455ce13defe46bd34ce
[]
no_license
anandProDev/RailStatusTracker
https://github.com/anandProDev/RailStatusTracker
dda7db71fc6db027e9fa76321ec7229159d12bed
3b1ae9b4f886f35b0f02a8aa8175359c94ccfd54
refs/heads/master
2021-01-25T14:56:40.770000
2018-05-11T15:09:32
2018-05-11T15:09:32
123,739,759
0
1
null
false
2018-05-09T11:00:06
2018-03-03T23:19:49
2018-05-02T10:15:47
2018-05-09T11:00:05
119
0
1
0
Java
false
null
package com.service; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Splitter; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.JsonNode; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.request.GetRequest; import com.model.RailStatus; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.web.util.UriComponentsBuilder; import java.net.UnknownHostException; import java.text.SimpleDateFormat; import java.util.*; @Component public class StatusReceiverImpl implements StatusReceiver { private static final Logger LOGGER = LogManager.getLogger(StatusReceiverImpl.class); private final String transportApiId; private final String transportApiKey; private final String startTime; private final String endTime; private final ObjectMapper mapper; private final DelayTrackerServiceImpl delayTrackerServiceImpl; private final String transportApiUrl; SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm") ; int requestCount = 0; List<ConfigMapperHolder> configMapperHolder = new ArrayList<>(); @Autowired public StatusReceiverImpl(@Value("${transportApi.app.live.trains.url}") String transportApiUrl, @Value("${transportApi.app.id}") String transportApiId, @Value("${transportApi.app.key}")String transportApiKey, @Value("${app.source.destination.map}") String sourceDestinationList, @Value("${application.process.startTime}") String startTime, @Value("${application.process.endTime}") String endTime, ObjectMapper mapper, DelayTrackerServiceImpl delayTrackerServiceImpl) { this.transportApiUrl = transportApiUrl; this.transportApiId = transportApiId; this.transportApiKey = transportApiKey; this.startTime = startTime; this.endTime = endTime; Splitter.on(",").split(sourceDestinationList) .forEach(data -> {String[] values = data.split(":"); configMapperHolder.add(new ConfigMapperHolder(values[0], values[1])); } ); this.mapper = mapper; this.delayTrackerServiceImpl = delayTrackerServiceImpl; } @Override public void receiveFeeds() { getStatus(); } private boolean withinTimeRange() { try{ Date now = dateFormat.parse(dateFormat.format(new Date(Calendar.getInstance().getTimeInMillis()))); if(now.after(dateFormat.parse(startTime)) && now.before(dateFormat.parse(endTime))) return true; }catch (Exception e){ LOGGER.info("Outside time range"); return false; } LOGGER.info("Outside time range"); return false; } @Scheduled(cron = "${app.call.transportApi.cron}") public void getStatus() { LOGGER.info("Get status call"); System.out.println("Starting to process"); if(!withinTimeRange()) return; //https://transportapi.com/v3/uk/train/station/{from}/live.json? // app_id={app_id}&app_key={app_kep}&darwin=true& // destination={destination}&train_status=passenger configMapperHolder.forEach(config -> { Map<String, String> fields = new HashMap<>(); fields.put("from", config.getKey()); fields.put("app_id", transportApiId); fields.put("app_key", transportApiKey); fields.put("destination", config.getValue()); try { GetRequest getRequest = Unirest.get(UriComponentsBuilder.fromUriString(transportApiUrl).buildAndExpand(fields).toString()); System.out.println("Request count : " + ++requestCount); System.out.println("RequestTime:" + Calendar.getInstance().getTime()); HttpResponse<JsonNode> jsonNodeHttpResponse = getRequest.asJson(); RailStatus railStatus = mapper.readValue(jsonNodeHttpResponse.getBody().toString(), RailStatus.class); delayTrackerServiceImpl.processDelays(railStatus); } catch (UnknownHostException unknownHostException){ LOGGER.error("Could not connect to host ", unknownHostException); } catch (Exception e) { e.printStackTrace(); } }); } class ConfigMapperHolder{ private final String key; private final String value; public String getKey() { return key; } public String getValue() { return value; } public ConfigMapperHolder(String key, String value){ this.key = key; this.value = value; } } }
UTF-8
Java
5,206
java
StatusReceiverImpl.java
Java
[]
null
[]
package com.service; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Splitter; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.JsonNode; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.request.GetRequest; import com.model.RailStatus; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.web.util.UriComponentsBuilder; import java.net.UnknownHostException; import java.text.SimpleDateFormat; import java.util.*; @Component public class StatusReceiverImpl implements StatusReceiver { private static final Logger LOGGER = LogManager.getLogger(StatusReceiverImpl.class); private final String transportApiId; private final String transportApiKey; private final String startTime; private final String endTime; private final ObjectMapper mapper; private final DelayTrackerServiceImpl delayTrackerServiceImpl; private final String transportApiUrl; SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm") ; int requestCount = 0; List<ConfigMapperHolder> configMapperHolder = new ArrayList<>(); @Autowired public StatusReceiverImpl(@Value("${transportApi.app.live.trains.url}") String transportApiUrl, @Value("${transportApi.app.id}") String transportApiId, @Value("${transportApi.app.key}")String transportApiKey, @Value("${app.source.destination.map}") String sourceDestinationList, @Value("${application.process.startTime}") String startTime, @Value("${application.process.endTime}") String endTime, ObjectMapper mapper, DelayTrackerServiceImpl delayTrackerServiceImpl) { this.transportApiUrl = transportApiUrl; this.transportApiId = transportApiId; this.transportApiKey = transportApiKey; this.startTime = startTime; this.endTime = endTime; Splitter.on(",").split(sourceDestinationList) .forEach(data -> {String[] values = data.split(":"); configMapperHolder.add(new ConfigMapperHolder(values[0], values[1])); } ); this.mapper = mapper; this.delayTrackerServiceImpl = delayTrackerServiceImpl; } @Override public void receiveFeeds() { getStatus(); } private boolean withinTimeRange() { try{ Date now = dateFormat.parse(dateFormat.format(new Date(Calendar.getInstance().getTimeInMillis()))); if(now.after(dateFormat.parse(startTime)) && now.before(dateFormat.parse(endTime))) return true; }catch (Exception e){ LOGGER.info("Outside time range"); return false; } LOGGER.info("Outside time range"); return false; } @Scheduled(cron = "${app.call.transportApi.cron}") public void getStatus() { LOGGER.info("Get status call"); System.out.println("Starting to process"); if(!withinTimeRange()) return; //https://transportapi.com/v3/uk/train/station/{from}/live.json? // app_id={app_id}&app_key={app_kep}&darwin=true& // destination={destination}&train_status=passenger configMapperHolder.forEach(config -> { Map<String, String> fields = new HashMap<>(); fields.put("from", config.getKey()); fields.put("app_id", transportApiId); fields.put("app_key", transportApiKey); fields.put("destination", config.getValue()); try { GetRequest getRequest = Unirest.get(UriComponentsBuilder.fromUriString(transportApiUrl).buildAndExpand(fields).toString()); System.out.println("Request count : " + ++requestCount); System.out.println("RequestTime:" + Calendar.getInstance().getTime()); HttpResponse<JsonNode> jsonNodeHttpResponse = getRequest.asJson(); RailStatus railStatus = mapper.readValue(jsonNodeHttpResponse.getBody().toString(), RailStatus.class); delayTrackerServiceImpl.processDelays(railStatus); } catch (UnknownHostException unknownHostException){ LOGGER.error("Could not connect to host ", unknownHostException); } catch (Exception e) { e.printStackTrace(); } }); } class ConfigMapperHolder{ private final String key; private final String value; public String getKey() { return key; } public String getValue() { return value; } public ConfigMapperHolder(String key, String value){ this.key = key; this.value = value; } } }
5,206
0.636381
0.635229
145
34.90345
29.666962
139
false
false
0
0
0
0
0
0
0.593103
false
false
13
bfbd7982b4ce4b16daf3f48e01783880a597e0aa
32,298,154,130,314
cbdb5bb1b37e4896441b3eafa4e5da49d5e4d053
/src/main/java/com/sunflower/threadpool/monitor/Test.java
c4f0635dc6eb19b8285713ee693f4e42e811821c
[ "Apache-2.0" ]
permissive
lifeng-it/sunflower-threadpool
https://github.com/lifeng-it/sunflower-threadpool
ffd2effbeb46f4d076654731eab65f919efff5b6
bf98e24efe73c57199a0c5a9c781ffa97a6f0d9f
refs/heads/main
2022-12-29T04:28:11.365000
2020-10-16T08:06:50
2020-10-16T08:06:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sunflower.threadpool.monitor; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor.AbortPolicy; import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; /** * @author songhengliang * @date 2020/10/9 */ @Slf4j public class Test { private static final String THREAD_POOL_NAME = "test_thread_pool"; public static void main(String[] args) { MonitoringThreadPool monitoringThreadPool = new MonitoringThreadPool(THREAD_POOL_NAME, 10, 20, 0, TimeUnit.SECONDS, new LinkedBlockingDeque<>(), new ThreadFactoryBuilder().setNameFormat(THREAD_POOL_NAME + "-%d").setDaemon(true).build(), new AbortPolicy()); for (int i = 0; i < Integer.MAX_VALUE; i++) { monitoringThreadPool.execute(new TestTask(i)); try { Thread.sleep(10L); } catch (InterruptedException e) { e.printStackTrace(); } } } private static class TestTask implements Runnable { private int i; public TestTask(int i) { this.i = i; } @Override public void run() { try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } log.info("task execute {}", i); System.out.println("task execute " + i); } } }
UTF-8
Java
1,665
java
Test.java
Java
[ { "context": "\nimport lombok.extern.slf4j.Slf4j;\n\n/**\n * @author songhengliang\n * @date 2020/10/9\n */\n@Slf4j\npublic class Test {", "end": 364, "score": 0.9942176938056946, "start": 351, "tag": "USERNAME", "value": "songhengliang" } ]
null
[]
package com.sunflower.threadpool.monitor; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor.AbortPolicy; import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; /** * @author songhengliang * @date 2020/10/9 */ @Slf4j public class Test { private static final String THREAD_POOL_NAME = "test_thread_pool"; public static void main(String[] args) { MonitoringThreadPool monitoringThreadPool = new MonitoringThreadPool(THREAD_POOL_NAME, 10, 20, 0, TimeUnit.SECONDS, new LinkedBlockingDeque<>(), new ThreadFactoryBuilder().setNameFormat(THREAD_POOL_NAME + "-%d").setDaemon(true).build(), new AbortPolicy()); for (int i = 0; i < Integer.MAX_VALUE; i++) { monitoringThreadPool.execute(new TestTask(i)); try { Thread.sleep(10L); } catch (InterruptedException e) { e.printStackTrace(); } } } private static class TestTask implements Runnable { private int i; public TestTask(int i) { this.i = i; } @Override public void run() { try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } log.info("task execute {}", i); System.out.println("task execute " + i); } } }
1,665
0.572973
0.55976
58
27.706896
25.053741
115
false
false
0
0
0
0
0
0
0.482759
false
false
13
ece5eecd8ad3fe7da5a0e3e027ddf7b95a24a4a8
3,977,139,787,233
9f00a191dc91def4e62351ed3b902b2467ccd73d
/app/src/main/java/rodrigo/javier/movies/retrofit/TheMovieApiInterface.java
35f77a51c0dd8e6f3912e83bcd5055f140db6b82
[]
no_license
Javi-Hub/Movies_Android
https://github.com/Javi-Hub/Movies_Android
d156972a2d1fbf50ec2796f185396758655c71cf
a17b7d75c7c0455a27c5b8e8de59c4bee28c6983
refs/heads/master
2023-04-07T10:31:21.031000
2021-04-21T16:14:34
2021-04-21T16:14:34
323,297,502
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rodrigo.javier.movies.retrofit; import retrofit2.Call; import retrofit2.http.GET; import rodrigo.javier.movies.beans.MoviesApiResult; public interface TheMovieApiInterface { @GET("movie/popular?api_key=f60067a1481cd9254310b37a0022dbd7&language=es-ES&page=1") Call<MoviesApiResult> getMovies(); }
UTF-8
Java
317
java
TheMovieApiInterface.java
Java
[ { "context": "ieApiInterface {\n\n @GET(\"movie/popular?api_key=f60067a1481cd9254310b37a0022dbd7&language=es-ES&page=1\")\n Call<MoviesApiResult>", "end": 249, "score": 0.999724268913269, "start": 217, "tag": "KEY", "value": "f60067a1481cd9254310b37a0022dbd7" } ]
null
[]
package rodrigo.javier.movies.retrofit; import retrofit2.Call; import retrofit2.http.GET; import rodrigo.javier.movies.beans.MoviesApiResult; public interface TheMovieApiInterface { @GET("movie/popular?api_key=f60067a1481cd9254310b37a0022dbd7&language=es-ES&page=1") Call<MoviesApiResult> getMovies(); }
317
0.798107
0.716088
13
23.384615
26.140268
88
false
false
0
0
0
0
0
0
0.384615
false
false
13
3abb4836364bebd638880c850e8e8a4bd9c8581d
1,340,029,830,729
9f004c3df4413eb826c229332d95130a1d5c8457
/src/akshay/CharFrequency.java
178afef668087b3b3ce01975219e60f89102c491
[]
no_license
MayurSTechnoCredit/JAVATechnoJuly2021
https://github.com/MayurSTechnoCredit/JAVATechnoJuly2021
dd8575c800e8f0cac5bab8d5ea32b25f7131dd0d
3a422553a0d09b6a99e528c73cc2b8efe260a07a
refs/heads/master
2023-08-22T14:43:37.980000
2021-10-16T06:33:34
2021-10-16T06:33:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*Program 1: find frequency of given character from user defined string. use scanner class to take word and character from user. input : word -> technocredits ch -> e output : e -> 2 */ package akshay; import java.util.Scanner; public class CharFrequency { int getCharFrequency(String input, char ch) { int count = 0; for(int index = 0; index < input.length(); index++ ) { if(input.charAt(index)== ch) { count++; } } return count; } public static void main(String[] args) { CharFrequency charfrequency = new CharFrequency(); //String word = "technocredits"; System.out.println("Please enter the string:"); Scanner scanner = new Scanner(System.in); String word = scanner.next(); char ch = word.charAt(1); System.out.println("Frequency of char " + ch + " :" +charfrequency.getCharFrequency(word, ch)); } }
UTF-8
Java
858
java
CharFrequency.java
Java
[]
null
[]
/*Program 1: find frequency of given character from user defined string. use scanner class to take word and character from user. input : word -> technocredits ch -> e output : e -> 2 */ package akshay; import java.util.Scanner; public class CharFrequency { int getCharFrequency(String input, char ch) { int count = 0; for(int index = 0; index < input.length(); index++ ) { if(input.charAt(index)== ch) { count++; } } return count; } public static void main(String[] args) { CharFrequency charfrequency = new CharFrequency(); //String word = "technocredits"; System.out.println("Please enter the string:"); Scanner scanner = new Scanner(System.in); String word = scanner.next(); char ch = word.charAt(1); System.out.println("Frequency of char " + ch + " :" +charfrequency.getCharFrequency(word, ch)); } }
858
0.672494
0.666667
33
25
23.67968
97
false
false
0
0
0
0
0
0
1.69697
false
false
13
8297aa48b7354551046a274cd6a7f80a11a948a3
9,191,230,014,899
6c440e154d869e424b8d4f8354e9cd23b1953603
/Progetto-02/src/java/Console/src/it/unibo/console/serial/SerialCommChannel.java
8e2e4930931657cf26f026b3b324cfce47a6be26
[ "MIT" ]
permissive
MatteoRagazzini/IoT-Projects
https://github.com/MatteoRagazzini/IoT-Projects
19bfc826923b5c20a033926739169cb9bcd44953
a8298e4e649264c9cf803c6876d6bd5006f1389c
refs/heads/main
2023-02-10T11:35:27.847000
2021-01-03T10:52:25
2021-01-03T10:52:25
325,400,359
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.unibo.console.serial; import java.util.concurrent.*; import jssc.*; /** * Comm channel implementation based on serial port. * * @author aricci * */ public class SerialCommChannel implements CommChannel, SerialPortEventListener { private SerialPort serialPort; private BlockingQueue<String> queue; private StringBuffer currentMsg = new StringBuffer(""); public SerialCommChannel(String port, int rate) throws Exception { queue = new ArrayBlockingQueue<String>(100); serialPort = new SerialPort(port); try { serialPort.openPort(); serialPort.setParams(rate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT); // serialPort.addEventListener(this, SerialPort.MASK_RXCHAR); serialPort.addEventListener(this); } catch (SerialPortException ex) { System.out.println("There are an error on writing string to port т: " + ex); } // add event listeners } @Override public void sendMsg(String msg) { char[] array = (msg+"\n").toCharArray(); byte[] bytes = new byte[array.length]; for (int i = 0; i < array.length; i++){ bytes[i] = (byte) array[i]; } try { synchronized (serialPort) { serialPort.writeBytes(bytes); } } catch(Exception ex){ ex.printStackTrace(); } } @Override public String receiveMsg() throws InterruptedException { return queue.take(); } @Override public boolean isMsgAvailable() { return !queue.isEmpty(); } /** * This should be called when you stop using the port. * This will prevent port locking on platforms like Linux. */ public void close() { try { if (serialPort != null) { serialPort.removeEventListener(); serialPort.closePort(); } } catch (Exception ex) { ex.printStackTrace(); } } /** * Handle an event on the serial port. Read the data and print it. */ // public void serialEvent(SerialPortEvent event) { // /* if there are bytes received in the input buffer */ // if (event.isRXCHAR()) { // try { // /* // * event.getEventValue()) => number of bytes in the input buffer // * readString() => read the specified number of bytes // */ // String msg = serialPort.readString(event.getEventValue()); // // int index = msg.indexOf("\n"); // if (index >= 0) { // currentMsg.append(msg.substring(0, index)); // queue.put(currentMsg.toString()); // currentMsg.setLength(0); // if (index + 1 < msg.length()) { // currentMsg.append(msg.substring(index + 1)); // } // } else { // currentMsg.append(msg); // } // } catch (Exception ex) { // ex.printStackTrace(); // System.out.println("Error in receiving string from COM-port: " + ex); // } // } // } public void serialEvent(SerialPortEvent event) { /* if there are bytes received in the input buffer */ if (event.isRXCHAR()) { try { String msg = serialPort.readString(event.getEventValue()); msg = msg.replaceAll("\r", ""); currentMsg.append(msg); boolean goAhead = true; while(goAhead) { String msg2 = currentMsg.toString(); int index = msg2.indexOf("\n"); if (index >= 0) { queue.put(msg2.substring(0, index)); currentMsg = new StringBuffer(""); if (index + 1 < msg2.length()) { currentMsg.append(msg2.substring(index + 1)); } } else { goAhead = false; } } } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error in receiving string from COM-port: " + ex); } } } }
UTF-8
Java
4,214
java
SerialCommChannel.java
Java
[ { "context": "mplementation based on serial port.\n * \n * @author aricci\n *\n */\npublic class SerialCommChannel implements ", "end": 158, "score": 0.9980614185333252, "start": 152, "tag": "USERNAME", "value": "aricci" } ]
null
[]
package it.unibo.console.serial; import java.util.concurrent.*; import jssc.*; /** * Comm channel implementation based on serial port. * * @author aricci * */ public class SerialCommChannel implements CommChannel, SerialPortEventListener { private SerialPort serialPort; private BlockingQueue<String> queue; private StringBuffer currentMsg = new StringBuffer(""); public SerialCommChannel(String port, int rate) throws Exception { queue = new ArrayBlockingQueue<String>(100); serialPort = new SerialPort(port); try { serialPort.openPort(); serialPort.setParams(rate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT); // serialPort.addEventListener(this, SerialPort.MASK_RXCHAR); serialPort.addEventListener(this); } catch (SerialPortException ex) { System.out.println("There are an error on writing string to port т: " + ex); } // add event listeners } @Override public void sendMsg(String msg) { char[] array = (msg+"\n").toCharArray(); byte[] bytes = new byte[array.length]; for (int i = 0; i < array.length; i++){ bytes[i] = (byte) array[i]; } try { synchronized (serialPort) { serialPort.writeBytes(bytes); } } catch(Exception ex){ ex.printStackTrace(); } } @Override public String receiveMsg() throws InterruptedException { return queue.take(); } @Override public boolean isMsgAvailable() { return !queue.isEmpty(); } /** * This should be called when you stop using the port. * This will prevent port locking on platforms like Linux. */ public void close() { try { if (serialPort != null) { serialPort.removeEventListener(); serialPort.closePort(); } } catch (Exception ex) { ex.printStackTrace(); } } /** * Handle an event on the serial port. Read the data and print it. */ // public void serialEvent(SerialPortEvent event) { // /* if there are bytes received in the input buffer */ // if (event.isRXCHAR()) { // try { // /* // * event.getEventValue()) => number of bytes in the input buffer // * readString() => read the specified number of bytes // */ // String msg = serialPort.readString(event.getEventValue()); // // int index = msg.indexOf("\n"); // if (index >= 0) { // currentMsg.append(msg.substring(0, index)); // queue.put(currentMsg.toString()); // currentMsg.setLength(0); // if (index + 1 < msg.length()) { // currentMsg.append(msg.substring(index + 1)); // } // } else { // currentMsg.append(msg); // } // } catch (Exception ex) { // ex.printStackTrace(); // System.out.println("Error in receiving string from COM-port: " + ex); // } // } // } public void serialEvent(SerialPortEvent event) { /* if there are bytes received in the input buffer */ if (event.isRXCHAR()) { try { String msg = serialPort.readString(event.getEventValue()); msg = msg.replaceAll("\r", ""); currentMsg.append(msg); boolean goAhead = true; while(goAhead) { String msg2 = currentMsg.toString(); int index = msg2.indexOf("\n"); if (index >= 0) { queue.put(msg2.substring(0, index)); currentMsg = new StringBuffer(""); if (index + 1 < msg2.length()) { currentMsg.append(msg2.substring(index + 1)); } } else { goAhead = false; } } } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error in receiving string from COM-port: " + ex); } } } }
4,214
0.550914
0.546167
149
27.275167
23.0613
87
false
false
0
0
0
0
0
0
2.09396
false
false
13
1992f851475be86d1f2940e9084f71a85bd48a69
16,793,322,188,995
d75c400af828f25f02754e98ec55749769d80435
/Viva001.java
9330aa83d4c7043fbe44b1ae47265768b06c9044
[]
no_license
Shraddhasaini/javaOOPS
https://github.com/Shraddhasaini/javaOOPS
b9657322042ee6728b70db157b039ea72d08a6a1
5aec18070dadc016d422dcab8f0da7ec447ca47c
refs/heads/master
2021-07-12T03:04:30.067000
2020-07-28T04:43:54
2020-07-28T04:43:54
170,635,873
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.*; class Viva001{ public static void main(String args[]){ List<String> map = new ArrayList<String>(); System.out.println("Enter the input"); Scanner input=new Scanner(System.in); String a =input.nextLine(); map.add(a); for(String item:map){ System.out.println(item); if(item == "not"){ System.out.println("String is not negative"); }} System.out.println("String is negative"); } }
UTF-8
Java
465
java
Viva001.java
Java
[]
null
[]
import java.io.*; import java.util.*; class Viva001{ public static void main(String args[]){ List<String> map = new ArrayList<String>(); System.out.println("Enter the input"); Scanner input=new Scanner(System.in); String a =input.nextLine(); map.add(a); for(String item:map){ System.out.println(item); if(item == "not"){ System.out.println("String is not negative"); }} System.out.println("String is negative"); } }
465
0.63871
0.632258
17
26.411764
16.146603
53
false
false
0
0
0
0
0
0
0.588235
false
false
13
abec30df8f60524b8d58a80dc5cf7d8f74cf2ed4
33,243,046,878,242
6d6760b51af72e82c748f023163b92e9d4f42340
/src/main/java/org/example/supermercado/usecases/RegistrarSucursalUseCase.java
8b146ef450c8ada71df702bf3c1503d8e53fc95b
[]
no_license
juanfelipejg/RetoDDD-Factura
https://github.com/juanfelipejg/RetoDDD-Factura
6a7361769dd7010e195bd7de23351fba51f5c9ec
bd7a445ab32c9799c05ecdac4ca0b106b40e47e9
refs/heads/master
2023-03-29T06:13:01.237000
2021-03-25T19:50:45
2021-03-25T19:50:45
351,563,053
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.example.supermercado.usecases; import co.com.sofka.business.generic.BusinessException; import co.com.sofka.business.generic.UseCase; import co.com.sofka.business.support.RequestCommand; import co.com.sofka.business.support.ResponseEvents; import org.example.supermercado.domain.Factura; import org.example.supermercado.domain.commands.AgregarSucursal; public class RegistrarSucursalUseCase extends UseCase<RequestCommand<AgregarSucursal>,ResponseEvents> { @Override public void executeUseCase(RequestCommand<AgregarSucursal> agregarSucursalRequestCommand) { var command = agregarSucursalRequestCommand.getCommand(); var factura = Factura.from(command.getFacturaId(), retrieveEvents()); if(factura.getEstaGenerada()){ throw new BusinessException(factura.identity().value(), "No puede agregar una Sucursal a una factura generada"); } try{ factura.agregarSucursal(command.getSucursalId(),command.getCiudad(),command.getTelefono(),command.getDireccion()); emit().onResponse(new ResponseEvents(factura.getUncommittedChanges())); }catch (RuntimeException e){ emit().onError(new BusinessException(factura.identity().value(), e.getMessage())); } } }
UTF-8
Java
1,277
java
RegistrarSucursalUseCase.java
Java
[]
null
[]
package org.example.supermercado.usecases; import co.com.sofka.business.generic.BusinessException; import co.com.sofka.business.generic.UseCase; import co.com.sofka.business.support.RequestCommand; import co.com.sofka.business.support.ResponseEvents; import org.example.supermercado.domain.Factura; import org.example.supermercado.domain.commands.AgregarSucursal; public class RegistrarSucursalUseCase extends UseCase<RequestCommand<AgregarSucursal>,ResponseEvents> { @Override public void executeUseCase(RequestCommand<AgregarSucursal> agregarSucursalRequestCommand) { var command = agregarSucursalRequestCommand.getCommand(); var factura = Factura.from(command.getFacturaId(), retrieveEvents()); if(factura.getEstaGenerada()){ throw new BusinessException(factura.identity().value(), "No puede agregar una Sucursal a una factura generada"); } try{ factura.agregarSucursal(command.getSucursalId(),command.getCiudad(),command.getTelefono(),command.getDireccion()); emit().onResponse(new ResponseEvents(factura.getUncommittedChanges())); }catch (RuntimeException e){ emit().onError(new BusinessException(factura.identity().value(), e.getMessage())); } } }
1,277
0.743931
0.743931
30
41.566666
39.45435
126
false
false
0
0
0
0
0
0
0.666667
false
false
13
b6ad064bb34a0692cc3f3908f66d736894917de9
32,023,276,162,413
30b368d8c191296cdfdc8ec8683d6918016bb3b8
/src/main/java/session/Session.java
3de14673bb083ba4e27cc4caf6e80c16233efb2a
[]
no_license
FP-July/PicEngine
https://github.com/FP-July/PicEngine
940ec9b67e31d3fbc58ee8a7d2bd583d2185d1f9
16b07e66322b893761d4c10efe4b1efa3db65a91
refs/heads/master
2021-01-01T04:41:16.564000
2017-07-27T11:52:10
2017-07-27T11:52:10
97,222,597
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package session; public class Session { public Session(String sessionID2, long expireTime2) { this.setSessionID(sessionID2); this.setExpireTime(expireTime2); } public String getSessionID() { return SessionID; } public void setSessionID(String sessionID) { SessionID = sessionID; } public long getExpireTime() { return expireTime; } public void setExpireTime(long expireTime) { this.expireTime = expireTime; } private String SessionID; private long expireTime; }
UTF-8
Java
493
java
Session.java
Java
[]
null
[]
package session; public class Session { public Session(String sessionID2, long expireTime2) { this.setSessionID(sessionID2); this.setExpireTime(expireTime2); } public String getSessionID() { return SessionID; } public void setSessionID(String sessionID) { SessionID = sessionID; } public long getExpireTime() { return expireTime; } public void setExpireTime(long expireTime) { this.expireTime = expireTime; } private String SessionID; private long expireTime; }
493
0.744422
0.736308
28
16.642857
16.488556
54
false
false
0
0
0
0
0
0
1.25
false
false
13
d06284db5f128799b28a635c30df8482a0a943c4
6,511,170,429,127
adbc3a062a4bfb5d34d7f84b354b41bd7d96c419
/src/com/security/TTPEntity.java
adbfda8b432f40fc54ae5a62ad6fb8ff7530cd0a
[]
no_license
zdoonio/SecureClient
https://github.com/zdoonio/SecureClient
fe944582dfc851b5b6bdf9ceb0a76f3e1da9a235
bd01d0448a936b0d4d9f24e9c3bf4ca2838ba4be
refs/heads/master
2020-06-10T06:30:02.586000
2016-12-15T14:49:36
2016-12-15T14:49:36
76,052,664
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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.security; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; /** * * @author Karol * TODO : make encryption and decryption of messages */ public class TTPEntity { public enum algorithms {DES, DESede, AES}; public enum modes {CBC, ECB}; public final int sessionKeyLen; public final String cipherAlgorithm; public final String cipherMode; public final String ciphModPad; /** * Distributed key used for encrypting or decrypting * the secret key used for communication. * Currently only AES key. */ private SecretKey distrKey; /** * Generated session key. Alice's key. */ private SecretKey generatedKey; /** * Decrypted session key. Bob's key. */ private SecretKey decryptedKey; /** * Final session key agreed on by two entities, * used for encryption and decryption of communication. */ private SecretKey sessionKey; /** * Create an instance of TTPEntity with the algorithm and mode * for decrypting and encrypting of messages - communication between * this and another TTPEntity instance. * * @param algorithm * @param mode */ public TTPEntity(algorithms algorithm, modes mode) { switch(algorithm) { case DES : cipherAlgorithm = "DES"; sessionKeyLen = 68 / 8; break; case DESede : cipherAlgorithm = "DESede"; sessionKeyLen = 168 / 8; break; default : cipherAlgorithm = "AES"; sessionKeyLen = 128 / 8; break; } if(mode.equals(modes.CBC)) { cipherMode = "CBC"; } else { cipherMode = "ECB"; } ciphModPad = cipherAlgorithm + "/" + cipherMode + "/PKCS5Padding"; } /** * To be used only with creating TTP instance. * @param key */ protected void setDistrKey(SecretKey key) { distrKey = key; } /** * Generation of a session key. * If an instance is Alice, she can generate * the session key and then agree on it. * The session key depends on the algorithm chosen * for decryption and encryption of messages. */ public void generateAndAgreeOnSessionKey() { SecretKey key = generateKey(sessionKeyLen, cipherAlgorithm); generatedKey = key; agreeOnGeneratedKey(generatedKey); } /** * Encryption of a session key. * This to be used only when an instance is Alice. * This encyption should be send to TTP. * * @param iv - initialization vector, for the algorithm used is AES in CBC mode. * @return * @throws NoSuchAlgorithmException * @throws NoSuchPaddingException * @throws InvalidKeyException * @throws InvalidAlgorithmParameterException * @throws IllegalBlockSizeException * @throws BadPaddingException */ public byte[] encryptSessionKey(IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, distrKey, iv); byte[] sessionKeyByte = cipher.doFinal(sessionKey.getEncoded()); return sessionKeyByte; } /** * Decryption of the session key. * This to be used only when an instance is Bob. * Encryption is received from TTP. * Then, because encrypted is session key, after decryption * instance agrees on the decrypted session key. * * @param sessionKeyDec - the session key to be decrypted * @param iv - initialization vector, for the algortihm used is AES in CBC mode * @throws NoSuchAlgorithmException * @throws NoSuchPaddingException * @throws InvalidKeyException * @throws InvalidAlgorithmParameterException * @throws IllegalBlockSizeException * @throws BadPaddingException */ public void decryptAndAgreeOnSessionKey(byte[] sessionKeyDec, IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, distrKey, iv); byte[] decrypted = cipher.doFinal(sessionKeyDec); SecretKey sk = new SecretKeySpec(decrypted, cipherAlgorithm); decryptedKey = sk; agreeOnDecryptedKey(decryptedKey); } private void agreeOnGeneratedKey(SecretKey key) { sessionKey = key; } private void agreeOnDecryptedKey(SecretKey key){ sessionKey = key; } /** * Util for generating the random key * of given keyLen and with given algorithm. * @param keyLen - the length of the key to be generated * @param algorithm - string representing algorithm to be used for generation * @return generated SecretKey */ private static SecretKey generateKey(int keyLen, String algorithm) { SecureRandom random = new SecureRandom(); byte[] keyByte = new byte[keyLen]; random.nextBytes(keyByte); SecretKey key = new SecretKeySpec(keyByte, algorithm); return key; } public byte[] encryptMessage(String message) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { byte[] ciphertext = encryptMessage(message, null); return ciphertext; } public byte[] encryptMessage(String message, IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance(ciphModPad); if(iv == null) cipher.init(Cipher.ENCRYPT_MODE, sessionKey); else cipher.init(Cipher.ENCRYPT_MODE, sessionKey, iv); byte[] ciphertext = cipher.doFinal(message.getBytes()); return ciphertext; } public String decryptMessage(byte[] ciphertext) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { String decryption = decryptMessage(ciphertext, null); return decryption; } public String decryptMessage(byte[] ciphertext, IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance(ciphModPad); if(iv == null) cipher.init(Cipher.DECRYPT_MODE, sessionKey); else cipher.init(Cipher.DECRYPT_MODE, sessionKey, iv); byte[] messageBytes = cipher.doFinal(ciphertext); return new String(messageBytes); } }
UTF-8
Java
8,041
java
TTPEntity.java
Java
[ { "context": "avax.crypto.spec.SecretKeySpec;\n\n/**\n *\n * @author Karol\n * TODO : make encryption and decryption of messa", "end": 686, "score": 0.996709942817688, "start": 681, "tag": "NAME", "value": "Karol" }, { "context": "strKey;\n \n /**\n * Generated session key. Alice's key.\n */\n private SecretKey generatedKey", "end": 1247, "score": 0.6779673099517822, "start": 1242, "tag": "NAME", "value": "Alice" }, { "context": "tedKey;\n \n /**\n * Decrypted session key. Bob's key.\n */\n private SecretKey decryptedKey", "end": 1345, "score": 0.8921304941177368, "start": 1342, "tag": "NAME", "value": "Bob" }, { "context": "eration of a session key.\n * If an instance is Alice, she can generate \n * the session key and the", "end": 2780, "score": 0.8939584493637085, "start": 2775, "tag": "NAME", "value": "Alice" }, { "context": ". \n * This to be used only when an instance is Alice.\n * This encyption should be send to TTP.\n ", "end": 3263, "score": 0.9307600259780884, "start": 3258, "tag": "NAME", "value": "Alice" }, { "context": "y.\n * This to be used only when an instance is Bob.\n * Encryption is received from TTP.\n * T", "end": 4252, "score": 0.8916321396827698, "start": 4249, "tag": "NAME", "value": "Bob" } ]
null
[]
/* * 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.security; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; /** * * @author Karol * TODO : make encryption and decryption of messages */ public class TTPEntity { public enum algorithms {DES, DESede, AES}; public enum modes {CBC, ECB}; public final int sessionKeyLen; public final String cipherAlgorithm; public final String cipherMode; public final String ciphModPad; /** * Distributed key used for encrypting or decrypting * the secret key used for communication. * Currently only AES key. */ private SecretKey distrKey; /** * Generated session key. Alice's key. */ private SecretKey generatedKey; /** * Decrypted session key. Bob's key. */ private SecretKey decryptedKey; /** * Final session key agreed on by two entities, * used for encryption and decryption of communication. */ private SecretKey sessionKey; /** * Create an instance of TTPEntity with the algorithm and mode * for decrypting and encrypting of messages - communication between * this and another TTPEntity instance. * * @param algorithm * @param mode */ public TTPEntity(algorithms algorithm, modes mode) { switch(algorithm) { case DES : cipherAlgorithm = "DES"; sessionKeyLen = 68 / 8; break; case DESede : cipherAlgorithm = "DESede"; sessionKeyLen = 168 / 8; break; default : cipherAlgorithm = "AES"; sessionKeyLen = 128 / 8; break; } if(mode.equals(modes.CBC)) { cipherMode = "CBC"; } else { cipherMode = "ECB"; } ciphModPad = cipherAlgorithm + "/" + cipherMode + "/PKCS5Padding"; } /** * To be used only with creating TTP instance. * @param key */ protected void setDistrKey(SecretKey key) { distrKey = key; } /** * Generation of a session key. * If an instance is Alice, she can generate * the session key and then agree on it. * The session key depends on the algorithm chosen * for decryption and encryption of messages. */ public void generateAndAgreeOnSessionKey() { SecretKey key = generateKey(sessionKeyLen, cipherAlgorithm); generatedKey = key; agreeOnGeneratedKey(generatedKey); } /** * Encryption of a session key. * This to be used only when an instance is Alice. * This encyption should be send to TTP. * * @param iv - initialization vector, for the algorithm used is AES in CBC mode. * @return * @throws NoSuchAlgorithmException * @throws NoSuchPaddingException * @throws InvalidKeyException * @throws InvalidAlgorithmParameterException * @throws IllegalBlockSizeException * @throws BadPaddingException */ public byte[] encryptSessionKey(IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, distrKey, iv); byte[] sessionKeyByte = cipher.doFinal(sessionKey.getEncoded()); return sessionKeyByte; } /** * Decryption of the session key. * This to be used only when an instance is Bob. * Encryption is received from TTP. * Then, because encrypted is session key, after decryption * instance agrees on the decrypted session key. * * @param sessionKeyDec - the session key to be decrypted * @param iv - initialization vector, for the algortihm used is AES in CBC mode * @throws NoSuchAlgorithmException * @throws NoSuchPaddingException * @throws InvalidKeyException * @throws InvalidAlgorithmParameterException * @throws IllegalBlockSizeException * @throws BadPaddingException */ public void decryptAndAgreeOnSessionKey(byte[] sessionKeyDec, IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, distrKey, iv); byte[] decrypted = cipher.doFinal(sessionKeyDec); SecretKey sk = new SecretKeySpec(decrypted, cipherAlgorithm); decryptedKey = sk; agreeOnDecryptedKey(decryptedKey); } private void agreeOnGeneratedKey(SecretKey key) { sessionKey = key; } private void agreeOnDecryptedKey(SecretKey key){ sessionKey = key; } /** * Util for generating the random key * of given keyLen and with given algorithm. * @param keyLen - the length of the key to be generated * @param algorithm - string representing algorithm to be used for generation * @return generated SecretKey */ private static SecretKey generateKey(int keyLen, String algorithm) { SecureRandom random = new SecureRandom(); byte[] keyByte = new byte[keyLen]; random.nextBytes(keyByte); SecretKey key = new SecretKeySpec(keyByte, algorithm); return key; } public byte[] encryptMessage(String message) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { byte[] ciphertext = encryptMessage(message, null); return ciphertext; } public byte[] encryptMessage(String message, IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance(ciphModPad); if(iv == null) cipher.init(Cipher.ENCRYPT_MODE, sessionKey); else cipher.init(Cipher.ENCRYPT_MODE, sessionKey, iv); byte[] ciphertext = cipher.doFinal(message.getBytes()); return ciphertext; } public String decryptMessage(byte[] ciphertext) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { String decryption = decryptMessage(ciphertext, null); return decryption; } public String decryptMessage(byte[] ciphertext, IvParameterSpec iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance(ciphModPad); if(iv == null) cipher.init(Cipher.DECRYPT_MODE, sessionKey); else cipher.init(Cipher.DECRYPT_MODE, sessionKey, iv); byte[] messageBytes = cipher.doFinal(ciphertext); return new String(messageBytes); } }
8,041
0.660987
0.659246
232
33.659481
25.820677
96
false
false
0
0
0
0
0
0
0.564655
false
false
13
4e463d2299ba744b0b10072968668e99a121bb6e
17,008,070,498,256
4d4174be85c78f5544c297c24eb0a3d0ddf83d35
/src/main/java/za/co/discovery/dto/AtmAllocationDTO.java
d4262722b739c49e6745d15a7e2187cb55aa3497
[]
no_license
magebanz/mybank
https://github.com/magebanz/mybank
0d895e93de8e87ea8655481ae9bf77476eb7add8
ac5d4b35237eeb66f152c02759a5d96d08c3553c
refs/heads/master
2021-03-04T21:02:16.810000
2020-03-11T00:27:08
2020-03-11T00:27:08
246,050,719
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package za.co.discovery.dto; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; public class AtmAllocationDTO { private int atmAllocationID; private AtmDTO atm; private List<DenominationDTO> denominations = new ArrayList<>(); private BigDecimal atmTotal; private int count; public int getAtmAllocationID() { return atmAllocationID; } public void setAtmAllocationID(int atmAllocationID) { this.atmAllocationID = atmAllocationID; } public AtmDTO getAtm() { return atm; } public void setAtm(AtmDTO atm) { this.atm = atm; } public List<DenominationDTO> getDenominations() { return denominations; } public void setDenominations(List<DenominationDTO> denominations) { this.denominations = denominations; } public BigDecimal getAtmTotal() { return atmTotal; } public void setAtmTotal(BigDecimal atmTotal) { this.atmTotal = atmTotal; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } }
UTF-8
Java
1,147
java
AtmAllocationDTO.java
Java
[]
null
[]
package za.co.discovery.dto; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; public class AtmAllocationDTO { private int atmAllocationID; private AtmDTO atm; private List<DenominationDTO> denominations = new ArrayList<>(); private BigDecimal atmTotal; private int count; public int getAtmAllocationID() { return atmAllocationID; } public void setAtmAllocationID(int atmAllocationID) { this.atmAllocationID = atmAllocationID; } public AtmDTO getAtm() { return atm; } public void setAtm(AtmDTO atm) { this.atm = atm; } public List<DenominationDTO> getDenominations() { return denominations; } public void setDenominations(List<DenominationDTO> denominations) { this.denominations = denominations; } public BigDecimal getAtmTotal() { return atmTotal; } public void setAtmTotal(BigDecimal atmTotal) { this.atmTotal = atmTotal; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } }
1,147
0.656495
0.656495
53
20.64151
19.031349
71
false
false
0
0
0
0
0
0
0.358491
false
false
13
19e438a2aae2bceba7c0ec0607080687cf737d67
17,643,725,657,202
2ce52323b7fdcecd5e7820ec7b994d12fad6d4c6
/src/app/api/APIHandler.java
fc71646fefc7f35ffe794ef1ee60d1189a4fb42b
[]
no_license
romaszkm/NBP_Visualizer
https://github.com/romaszkm/NBP_Visualizer
b3fe35d79a778dbacaa28c0e9cddacb4b6e25308
6536a90a8c29bd9cf081f2fb0957a08a09399782
refs/heads/master
2021-04-06T20:01:18.085000
2018-03-16T09:16:20
2018-03-16T09:16:20
125,434,659
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.api; import app.api.xml.ArrayOfExchangeRatesTable; import app.api.xml.ExchangeRatesTable; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import java.io.InputStream; import java.net.URL; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.List; public class APIHandler { private static final String ADDRESS = "http://api.nbp.pl/api/exchangerates/tables/"; private static final String FORMAT = "?format=xml"; private static final int FETCH_TRIES = 5; private static APIHandler instance = new APIHandler(); public static APIHandler getInstance() { return instance; } private APIHandler() { } public List<ExchangeRatesTable> getTableForDate(Calendar from, Calendar to) { ArrayOfExchangeRatesTable ret = null; for (int i = 1; i <= FETCH_TRIES; i++) { try { System.out.println("API: Try no. " + i + ": Fetching data from " + from.getTime() + " to " + to.getTime()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); JAXBContext jaxbContext = JAXBContext.newInstance(ArrayOfExchangeRatesTable.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); URL url = new URL(ADDRESS + "A/" + sdf.format(from.getTime()) + "/" + sdf.format(to.getTime()) + FORMAT); InputStream stream = url.openStream(); ret = ((ArrayOfExchangeRatesTable) jaxbUnmarshaller.unmarshal(stream)); break; } catch (Exception e) { System.out.println("API: FAILED"); } } return ret != null ? ret.getExchangeRatesTable() : null; } }
UTF-8
Java
1,750
java
APIHandler.java
Java
[]
null
[]
package app.api; import app.api.xml.ArrayOfExchangeRatesTable; import app.api.xml.ExchangeRatesTable; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import java.io.InputStream; import java.net.URL; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.List; public class APIHandler { private static final String ADDRESS = "http://api.nbp.pl/api/exchangerates/tables/"; private static final String FORMAT = "?format=xml"; private static final int FETCH_TRIES = 5; private static APIHandler instance = new APIHandler(); public static APIHandler getInstance() { return instance; } private APIHandler() { } public List<ExchangeRatesTable> getTableForDate(Calendar from, Calendar to) { ArrayOfExchangeRatesTable ret = null; for (int i = 1; i <= FETCH_TRIES; i++) { try { System.out.println("API: Try no. " + i + ": Fetching data from " + from.getTime() + " to " + to.getTime()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); JAXBContext jaxbContext = JAXBContext.newInstance(ArrayOfExchangeRatesTable.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); URL url = new URL(ADDRESS + "A/" + sdf.format(from.getTime()) + "/" + sdf.format(to.getTime()) + FORMAT); InputStream stream = url.openStream(); ret = ((ArrayOfExchangeRatesTable) jaxbUnmarshaller.unmarshal(stream)); break; } catch (Exception e) { System.out.println("API: FAILED"); } } return ret != null ? ret.getExchangeRatesTable() : null; } }
1,750
0.638857
0.637714
49
34.714287
32.694004
123
false
false
0
0
0
0
0
0
0.591837
false
false
13
680c7e5e0019d1511d0f8bea70efcf6f3d7a4922
21,303,037,794,869
20673baba3faccd221be936055c3e7f5ff401a9c
/src/main/java/com/iwhere/platform/comm/dao/mybatis/model/LikesKey.java
89a93047d22f5bedd8ef89e21471f3ca871264e9
[]
no_license
wenbronk/platform
https://github.com/wenbronk/platform
188470bedef527a8633f93f5495714dd6b4afcef
f31a7bc08f2de553dd80dd67c43274c922825017
refs/heads/master
2018-09-20T00:53:30.150000
2018-06-06T10:49:40
2018-06-06T10:49:40
104,339,307
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.iwhere.platform.comm.dao.mybatis.model; /** * * This class was generated by MyBatis Generator. * This class corresponds to the database table likes * * @mbg.generated do_not_delete_during_merge */ public class LikesKey { /** * Database Column Remarks: * 用户ID * * This field was generated by MyBatis Generator. * This field corresponds to the database column likes.user_id * * @mbg.generated */ private Long userId; /** * Database Column Remarks: * 被点赞用户ID * * This field was generated by MyBatis Generator. * This field corresponds to the database column likes.like_user_id * * @mbg.generated */ private Long likeUserId; /** * Database Column Remarks: * 团队编号 * * This field was generated by MyBatis Generator. * This field corresponds to the database column likes.team_num * * @mbg.generated */ private String teamNum; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column likes.user_id * * @return the value of likes.user_id * * @mbg.generated */ public Long getUserId() { return userId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.user_id * * @param userId the value for likes.user_id * * @mbg.generated */ public void setUserId(Long userId) { this.userId = userId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column likes.like_user_id * * @return the value of likes.like_user_id * * @mbg.generated */ public Long getLikeUserId() { return likeUserId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.like_user_id * * @param likeUserId the value for likes.like_user_id * * @mbg.generated */ public void setLikeUserId(Long likeUserId) { this.likeUserId = likeUserId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column likes.team_num * * @return the value of likes.team_num * * @mbg.generated */ public String getTeamNum() { return teamNum; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.team_num * * @param teamNum the value for likes.team_num * * @mbg.generated */ public void setTeamNum(String teamNum) { this.teamNum = teamNum; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public static LikesKey.Builder builder() { return new LikesKey.Builder(); } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public static class Builder { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ private LikesKey obj; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder() { this.obj = new LikesKey(); } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.user_id * * @param userId the value for likes.user_id * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder userId(Long userId) { obj.setUserId(userId); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.like_user_id * * @param likeUserId the value for likes.like_user_id * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder likeUserId(Long likeUserId) { obj.setLikeUserId(likeUserId); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.team_num * * @param teamNum the value for likes.team_num * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder teamNum(String teamNum) { obj.setTeamNum(teamNum); return this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public LikesKey build() { return this.obj; } } /** * This enum was generated by MyBatis Generator. * This enum corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public enum Column { userId("user_id"), likeUserId("like_user_id"), teamNum("team_num"), like("like"); /** * This field was generated by MyBatis Generator. * This field corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ private final String column; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String value() { return this.column; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String getValue() { return this.column; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ Column(String column) { this.column = column; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String desc() { return this.column + " DESC"; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String asc() { return this.column + " ASC"; } } }
UTF-8
Java
8,051
java
LikesKey.java
Java
[ { "context": "@mbg.generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n public stati", "end": 3009, "score": 0.9951624274253845, "start": 3004, "tag": "USERNAME", "value": "itfsw" }, { "context": "@mbg.generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n public stati", "end": 3325, "score": 0.9925645589828491, "start": 3320, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n priv", "end": 3606, "score": 0.9911496639251709, "start": 3601, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 3890, "score": 0.9931557178497314, "start": 3885, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 4296, "score": 0.9910289645195007, "start": 4291, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 4755, "score": 0.9940029382705688, "start": 4750, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 5219, "score": 0.9909342527389526, "start": 5214, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 5594, "score": 0.9905270338058472, "start": 5589, "tag": "USERNAME", "value": "itfsw" }, { "context": "@mbg.generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n public enum ", "end": 5899, "score": 0.9911906719207764, "start": 5894, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n priv", "end": 6286, "score": 0.993199348449707, "start": 6281, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 6577, "score": 0.9844710826873779, "start": 6572, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n Colu", "end": 7236, "score": 0.9988136291503906, "start": 7231, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 7566, "score": 0.9984607696533203, "start": 7561, "tag": "USERNAME", "value": "itfsw" }, { "context": ".generated\n * @project https://github.com/itfsw/mybatis-generator-plugin\n */\n publ", "end": 7903, "score": 0.9989816546440125, "start": 7898, "tag": "USERNAME", "value": "itfsw" } ]
null
[]
package com.iwhere.platform.comm.dao.mybatis.model; /** * * This class was generated by MyBatis Generator. * This class corresponds to the database table likes * * @mbg.generated do_not_delete_during_merge */ public class LikesKey { /** * Database Column Remarks: * 用户ID * * This field was generated by MyBatis Generator. * This field corresponds to the database column likes.user_id * * @mbg.generated */ private Long userId; /** * Database Column Remarks: * 被点赞用户ID * * This field was generated by MyBatis Generator. * This field corresponds to the database column likes.like_user_id * * @mbg.generated */ private Long likeUserId; /** * Database Column Remarks: * 团队编号 * * This field was generated by MyBatis Generator. * This field corresponds to the database column likes.team_num * * @mbg.generated */ private String teamNum; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column likes.user_id * * @return the value of likes.user_id * * @mbg.generated */ public Long getUserId() { return userId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.user_id * * @param userId the value for likes.user_id * * @mbg.generated */ public void setUserId(Long userId) { this.userId = userId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column likes.like_user_id * * @return the value of likes.like_user_id * * @mbg.generated */ public Long getLikeUserId() { return likeUserId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.like_user_id * * @param likeUserId the value for likes.like_user_id * * @mbg.generated */ public void setLikeUserId(Long likeUserId) { this.likeUserId = likeUserId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column likes.team_num * * @return the value of likes.team_num * * @mbg.generated */ public String getTeamNum() { return teamNum; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.team_num * * @param teamNum the value for likes.team_num * * @mbg.generated */ public void setTeamNum(String teamNum) { this.teamNum = teamNum; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public static LikesKey.Builder builder() { return new LikesKey.Builder(); } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public static class Builder { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ private LikesKey obj; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder() { this.obj = new LikesKey(); } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.user_id * * @param userId the value for likes.user_id * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder userId(Long userId) { obj.setUserId(userId); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.like_user_id * * @param likeUserId the value for likes.like_user_id * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder likeUserId(Long likeUserId) { obj.setLikeUserId(likeUserId); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column likes.team_num * * @param teamNum the value for likes.team_num * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Builder teamNum(String teamNum) { obj.setTeamNum(teamNum); return this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public LikesKey build() { return this.obj; } } /** * This enum was generated by MyBatis Generator. * This enum corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public enum Column { userId("user_id"), likeUserId("like_user_id"), teamNum("team_num"), like("like"); /** * This field was generated by MyBatis Generator. * This field corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ private final String column; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String value() { return this.column; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String getValue() { return this.column; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ Column(String column) { this.column = column; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String desc() { return this.column + " DESC"; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table likes * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public String asc() { return this.column + " ASC"; } } }
8,051
0.577033
0.577033
286
27.076923
23.168304
79
false
false
0
0
0
0
0
0
0.104895
false
false
13
ed00a5a14e22f1a51b68dc9d977b773d0553b8ee
25,340,307,055,365
14b9d73db41f13ce7be236b0fef9bdff0369dc65
/guns-admin-agent/src/main/java/com/stylefeng/guns/admin/modular/areas/service/impl/CitiesServiceImpl.java
f2aa3c8a245011cefd1fc313d82e59405360fe2b
[]
no_license
bellmit/xishiweb
https://github.com/bellmit/xishiweb
3c28612980dc5da27a23777053f0b5e289a80592
808a4ebf181a9379d4119e2cfdabaf7a19a2558a
refs/heads/master
2022-11-10T11:11:56.278000
2020-06-22T13:32:45
2020-06-22T13:32:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stylefeng.guns.admin.modular.areas.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.admin.modular.areas.service.ICitiesService; import com.stylefeng.guns.persistence.dao.CitiesMapper; import com.stylefeng.guns.persistence.model.Cities; import org.springframework.stereotype.Service; /** * <p> * 城市 服务实现类 * </p> * * @author stylefeng * @since 2019-07-23 */ @Service public class CitiesServiceImpl extends ServiceImpl<CitiesMapper, Cities> implements ICitiesService { }
UTF-8
Java
553
java
CitiesServiceImpl.java
Java
[ { "context": "ice;\n\n/**\n * <p>\n * 城市 服务实现类\n * </p>\n *\n * @author stylefeng\n * @since 2019-07-23\n */\n@Service\npublic class Ci", "end": 400, "score": 0.9995965361595154, "start": 391, "tag": "USERNAME", "value": "stylefeng" } ]
null
[]
package com.stylefeng.guns.admin.modular.areas.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.admin.modular.areas.service.ICitiesService; import com.stylefeng.guns.persistence.dao.CitiesMapper; import com.stylefeng.guns.persistence.model.Cities; import org.springframework.stereotype.Service; /** * <p> * 城市 服务实现类 * </p> * * @author stylefeng * @since 2019-07-23 */ @Service public class CitiesServiceImpl extends ServiceImpl<CitiesMapper, Cities> implements ICitiesService { }
553
0.790353
0.77551
20
25.950001
29.134987
100
false
false
0
0
0
0
0
0
0.35
false
false
13
162b5324ee0f750d100d1c14f4586ed6d7dd80b1
2,061,584,311,902
c1dd222826a09511c60c05f8444df80e362a4d6d
/app/src/main/java/com/stesso/android/widget/QuantityView.java
156a57facb8c90c9059113b2be7a57fb4d569256
[]
no_license
flamegit/stesso
https://github.com/flamegit/stesso
f7484cb8446198e22080fff73e0e084d584161bc
b3e03838d0c3a4829752bb5ed13ece522a68114e
refs/heads/master
2020-04-01T13:21:12.568000
2019-12-02T12:41:12
2019-12-02T12:41:12
153,249,112
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stesso.android.widget; import android.content.Context; import android.graphics.Color; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.stesso.android.R; /** * Quantity view to add and remove quantities */ public class QuantityView extends LinearLayout implements View.OnClickListener { private ImageView mAddView, mRemoveView; private TextView mTextViewQuantity; int quantity,maxQuantity,hintCount; public interface OnQuantityChangeListener { void onQuantityChanged(int base, boolean programmatically,boolean minus); void onLimitReached(); void onMinReached(); } private OnQuantityChangeListener onQuantityChangeListener; public QuantityView(Context context) { super(context); init(); } public QuantityView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public void setQuantityChangeListener(OnQuantityChangeListener listener){ onQuantityChangeListener=listener; } private void init() { maxQuantity=50; int dp8 = pxFromDp(8); int dp20 = pxFromDp(20); int dp36 = pxFromDp(36); mAddView = new ImageView(getContext()); mAddView.setImageResource(R.drawable.ic_add_black_24dp); mAddView.setBackground(getResources().getDrawable(R.drawable.circl_gray_bg)); mRemoveView = new ImageView(getContext()); mRemoveView.setImageResource(R.drawable.ic_remove_black_24dp); mRemoveView.setBackground(getResources().getDrawable(R.drawable.circl_gray_bg)); mTextViewQuantity = new TextView(getContext()); mTextViewQuantity.setGravity(Gravity.CENTER); mTextViewQuantity.setTextSize(15); setQuantity(1); mTextViewQuantity.setBackgroundColor(getResources().getColor(R.color.space)); LayoutParams params=new LayoutParams(dp36, dp20); params.setMargins(dp8,0,dp8,0); setOrientation(HORIZONTAL); addView(mRemoveView,new LayoutParams(dp20, dp20)); addView(mTextViewQuantity, params); addView(mAddView, new LayoutParams(dp20, dp20)); mAddView.setOnClickListener(this); mRemoveView.setOnClickListener(this); } @Override public void onClick(View v) { if(!isEnabled()){ return; } if (v == mAddView) { if (quantity + 1 > maxQuantity) { if (onQuantityChangeListener != null) onQuantityChangeListener.onLimitReached(); } else { //quantity += 1; if (onQuantityChangeListener != null) onQuantityChangeListener.onQuantityChanged(quantity, false,false); } } else if (v == mRemoveView) { if (quantity <=1) { if (onQuantityChangeListener != null) onQuantityChangeListener.onMinReached(); } else { //quantity -= 1; //mTextViewQuantity.setText(String.valueOf(quantity)); if (onQuantityChangeListener != null) onQuantityChangeListener.onQuantityChanged(quantity, false,true); } } } public int getQuantity(){ return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; mTextViewQuantity.setText(String.valueOf(this.quantity)); } private int pxFromDp(final float dp) { return (int) (dp * getResources().getDisplayMetrics().density); } public void minus(){ quantity-=1; setQuantity(quantity); } public void add(){ quantity+=1; setQuantity(quantity); } }
UTF-8
Java
3,836
java
QuantityView.java
Java
[]
null
[]
package com.stesso.android.widget; import android.content.Context; import android.graphics.Color; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.stesso.android.R; /** * Quantity view to add and remove quantities */ public class QuantityView extends LinearLayout implements View.OnClickListener { private ImageView mAddView, mRemoveView; private TextView mTextViewQuantity; int quantity,maxQuantity,hintCount; public interface OnQuantityChangeListener { void onQuantityChanged(int base, boolean programmatically,boolean minus); void onLimitReached(); void onMinReached(); } private OnQuantityChangeListener onQuantityChangeListener; public QuantityView(Context context) { super(context); init(); } public QuantityView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public void setQuantityChangeListener(OnQuantityChangeListener listener){ onQuantityChangeListener=listener; } private void init() { maxQuantity=50; int dp8 = pxFromDp(8); int dp20 = pxFromDp(20); int dp36 = pxFromDp(36); mAddView = new ImageView(getContext()); mAddView.setImageResource(R.drawable.ic_add_black_24dp); mAddView.setBackground(getResources().getDrawable(R.drawable.circl_gray_bg)); mRemoveView = new ImageView(getContext()); mRemoveView.setImageResource(R.drawable.ic_remove_black_24dp); mRemoveView.setBackground(getResources().getDrawable(R.drawable.circl_gray_bg)); mTextViewQuantity = new TextView(getContext()); mTextViewQuantity.setGravity(Gravity.CENTER); mTextViewQuantity.setTextSize(15); setQuantity(1); mTextViewQuantity.setBackgroundColor(getResources().getColor(R.color.space)); LayoutParams params=new LayoutParams(dp36, dp20); params.setMargins(dp8,0,dp8,0); setOrientation(HORIZONTAL); addView(mRemoveView,new LayoutParams(dp20, dp20)); addView(mTextViewQuantity, params); addView(mAddView, new LayoutParams(dp20, dp20)); mAddView.setOnClickListener(this); mRemoveView.setOnClickListener(this); } @Override public void onClick(View v) { if(!isEnabled()){ return; } if (v == mAddView) { if (quantity + 1 > maxQuantity) { if (onQuantityChangeListener != null) onQuantityChangeListener.onLimitReached(); } else { //quantity += 1; if (onQuantityChangeListener != null) onQuantityChangeListener.onQuantityChanged(quantity, false,false); } } else if (v == mRemoveView) { if (quantity <=1) { if (onQuantityChangeListener != null) onQuantityChangeListener.onMinReached(); } else { //quantity -= 1; //mTextViewQuantity.setText(String.valueOf(quantity)); if (onQuantityChangeListener != null) onQuantityChangeListener.onQuantityChanged(quantity, false,true); } } } public int getQuantity(){ return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; mTextViewQuantity.setText(String.valueOf(this.quantity)); } private int pxFromDp(final float dp) { return (int) (dp * getResources().getDisplayMetrics().density); } public void minus(){ quantity-=1; setQuantity(quantity); } public void add(){ quantity+=1; setQuantity(quantity); } }
3,836
0.647289
0.636601
118
31.516949
25.173208
96
false
false
0
0
0
0
0
0
0.686441
false
false
13
73395a5a922d030f1ba51f32b9c813ec716ebf1c
31,628,139,179,389
649af0a9d2d97621e47a5e936c1838dc2e274558
/app/src/main/java/com/example/labrevision/SecondActivity.java
8fe3e125afa52f7f7aa09b1fb97dbe1d57cc87eb
[]
no_license
ChalanaJanith/LabRevision
https://github.com/ChalanaJanith/LabRevision
bd511732ebff5b8c4c4bfc6ed669519dd4a8ae3b
1c9b8027ab441c8e8876741be2dc2d060efffd0f
refs/heads/master
2022-12-06T08:53:03.119000
2020-08-18T10:01:43
2020-08-18T10:01:43
288,419,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.labrevision; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; public class SecondActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); Intent intent2 = getIntent(); String Reader = intent2.getStringExtra("ReaderName"); Toast toast = Toast.makeText(getApplicationContext(),"Welcome " + Reader + "...please enter what you read",Toast.LENGTH_SHORT); toast.show(); } }
UTF-8
Java
661
java
SecondActivity.java
Java
[]
null
[]
package com.example.labrevision; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; public class SecondActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); Intent intent2 = getIntent(); String Reader = intent2.getStringExtra("ReaderName"); Toast toast = Toast.makeText(getApplicationContext(),"Welcome " + Reader + "...please enter what you read",Toast.LENGTH_SHORT); toast.show(); } }
661
0.72466
0.721634
22
29.045454
31.216949
135
false
false
0
0
0
0
0
0
0.590909
false
false
13
a1e1100bc5930441edf8272eafad46d4cf3783f8
14,671,608,338,627
b908f05db3b8014a1705c1ebd2cbc5c90a1a01f3
/System/util/GDialog.java
6a571f43a0a29c83203e994f8fc9bbf3467504f5
[]
no_license
RavelMaurice/Geometrics-Graphic-Editor
https://github.com/RavelMaurice/Geometrics-Graphic-Editor
e9489bb1ddf72d620b9342a79210247ae0c7354b
f4da446b08447bf3d0924c0307b49cd6d665a39b
refs/heads/master
2022-11-30T05:31:47.430000
2020-08-19T00:19:24
2020-08-19T00:19:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; import java.awt.Color; import java.awt.Rectangle; import javax.swing.JOptionPane; import shape.GShape; import system.GUIText; @SuppressWarnings("serial") public class GDialog extends JOptionPane { public static void showExceptionDialog(Exception e) { String title = "Exception"; String content = "Exception Occurred!"; if (GUIText.isLoaded()) { title = GUIText.get(5); content = GUIText.get(6); } showMessageDialog(null, content, title, ERROR_MESSAGE); } public static void showAttributesDialog(GShape shape) { String content = ""; Rectangle bounds = shape.getBounds(); content += GUIText.get(75) + " : " + bounds.getWidth() + GUIText.get(82) + "\n"; content += GUIText.get(76) + " : " + bounds.getHeight() + GUIText.get(82) + "\n"; Color c = shape.getPaintColor(); content += GUIText.get(77) + " : " + c.getRed() + "," + c.getGreen() + "," + c.getBlue() + "\n"; content += GUIText.get(78) + " : " + shape.getOpacity() * 100 + "%" + "\n"; showMessageDialog(null, content, GUIText.get(74), INFORMATION_MESSAGE); } public static void showBackUpDialog() { String title = GUIText.get(81); String content = GUIText.get(80); showMessageDialog(null, content, title, INFORMATION_MESSAGE); } }
UTF-8
Java
1,270
java
GDialog.java
Java
[]
null
[]
package util; import java.awt.Color; import java.awt.Rectangle; import javax.swing.JOptionPane; import shape.GShape; import system.GUIText; @SuppressWarnings("serial") public class GDialog extends JOptionPane { public static void showExceptionDialog(Exception e) { String title = "Exception"; String content = "Exception Occurred!"; if (GUIText.isLoaded()) { title = GUIText.get(5); content = GUIText.get(6); } showMessageDialog(null, content, title, ERROR_MESSAGE); } public static void showAttributesDialog(GShape shape) { String content = ""; Rectangle bounds = shape.getBounds(); content += GUIText.get(75) + " : " + bounds.getWidth() + GUIText.get(82) + "\n"; content += GUIText.get(76) + " : " + bounds.getHeight() + GUIText.get(82) + "\n"; Color c = shape.getPaintColor(); content += GUIText.get(77) + " : " + c.getRed() + "," + c.getGreen() + "," + c.getBlue() + "\n"; content += GUIText.get(78) + " : " + shape.getOpacity() * 100 + "%" + "\n"; showMessageDialog(null, content, GUIText.get(74), INFORMATION_MESSAGE); } public static void showBackUpDialog() { String title = GUIText.get(81); String content = GUIText.get(80); showMessageDialog(null, content, title, INFORMATION_MESSAGE); } }
1,270
0.661417
0.643307
54
22.518518
26.597647
98
false
false
0
0
0
0
0
0
1.425926
false
false
13
6d52758a62d6a406f388702ddbb333cdec76a7d7
2,731,599,220,436
683b6360dbf7c9807844d5a7188b20250f8856ce
/app/src/main/java/android/ics/com/winner7/HomeActivity.java
dea7ae96f9adfb9e4a551b0d1aae6ca1bc995650
[]
no_license
NothingbutPro/Winner7
https://github.com/NothingbutPro/Winner7
b9d19605782b8b551a997d837af523d6c3716d13
153834d6a5b33da34b3f069b08e82ff84e833b62
refs/heads/master
2020-06-23T00:05:30.288000
2019-10-10T13:26:50
2019-10-10T13:26:50
198,439,238
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package android.ics.com.winner7; import android.app.ProgressDialog; import android.content.Intent; import android.ics.com.winner7.KotlinActivities.LatestWinners; import android.ics.com.winner7.KotlinActivities.WinnerHistoryActivity; import android.ics.com.winner7.Utils.AppPreference; import android.ics.com.winner7.Utils.Connectivity; import android.ics.com.winner7.Utils.HttpHandler; import android.ics.com.winner7.Utils.SessionManager; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.util.Log; import android.view.View; import android.support.v4.view.GravityCompat; import android.support.v7.app.ActionBarDrawerToggle; import android.view.MenuItem; import android.support.design.widget.NavigationView; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.squareup.picasso.Picasso; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Iterator; import java.util.Locale; import javax.net.ssl.HttpsURLConnection; import de.hdodenhof.circleimageview.CircleImageView; public class HomeActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { LinearLayout btn_play; Button btPrice, bt_winner, bt_latest, bt_test; CircleImageView profile_image1; SessionManager manager; TextView amountTxt, amountTxt1; LinearLayout volet, upcomming; TextView tstDate, tstTime; String server_url; TextView peoName; String strType; LinearLayout linear1, linear2; Button refer_btn; String communStr = "http://ihisaab.in/winnerseven/uploads/userprofile/"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // strType = getIntent().getExtras().getString("Type"); manager = new SessionManager(this); try { Log.e("type is" , ""+strType); strType = getIntent().getExtras().getString("Type"); }catch (Exception e) { strType= AppPreference.getType(HomeActivity.this); e.printStackTrace(); } Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); btn_play = (LinearLayout) findViewById(R.id.btn_play); btPrice = (Button) findViewById(R.id.btPrice); bt_winner = (Button) findViewById(R.id.bt_winner); bt_latest = (Button) findViewById(R.id.bt_latest); bt_test = (Button) findViewById(R.id.bt_test); refer_btn = (Button) findViewById(R.id.refer_btn); amountTxt = (TextView) findViewById(R.id.amountTxt); amountTxt1 = (TextView) findViewById(R.id.amountTxt1); tstDate = (TextView) findViewById(R.id.tstDate); tstTime = (TextView) findViewById(R.id.tstTime); peoName = (TextView) findViewById(R.id.peoName); volet = (LinearLayout) findViewById(R.id.walletli); upcomming = (LinearLayout) findViewById(R.id.upcomming); linear1 = (LinearLayout) findViewById(R.id.linear1); linear2 = (LinearLayout) findViewById(R.id.linear2); profile_image1 = (CircleImageView) findViewById(R.id.profile_image1); FloatingActionButton fab = findViewById(R.id.fab); if (strType.equals("1")) { linear1.setVisibility(View.VISIBLE); linear2.setVisibility(View.GONE); } else if (strType.equals("2")) { linear2.setVisibility(View.VISIBLE); linear1.setVisibility(View.GONE); } Date c = Calendar.getInstance().getTime(); System.out.println("Current time => " + c); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); String formattedDate = df.format(c); tstDate.setText(formattedDate); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); btn_play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, QuizStartActivity.class); startActivity(intent); } }); btPrice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, ListPriceActivity.class); startActivity(intent); } }); bt_winner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, WinnerHistoryActivity.class); startActivity(intent); // val intent = Intent(v.getContext(), WinnerHistoryActivity::class.java) // startActivity(Intent(this, WinnerHistoryActivity::class.java)) // startActivity(intent); } }); bt_latest.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, LatestWinners.class); startActivity(intent); } }); bt_test.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, TestSeriesActivity.class); startActivity(intent); } }); profile_image1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, ProfileActivity.class); startActivity(intent); } }); volet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, VoletActivity.class); startActivity(intent); } }); upcomming.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* Intent intent = new Intent(HomeActivity.this, TestSeriesActivity.class); startActivity(intent);*/ } }); refer_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent= new Intent(HomeActivity.this,RefferUserActivity.class); startActivity(intent); } }); if (Connectivity.isNetworkAvailable(this)) { new SendJsonServer().execute(); } else { Toast.makeText(this, "No Internet", Toast.LENGTH_SHORT).show(); } if (Connectivity.isNetworkAvailable(this)) { new GetExamDetails().execute(); } else { Toast.makeText(this, "No Internet", Toast.LENGTH_SHORT).show(); } if (Connectivity.isNetworkAvailable(this)) { new GetProfilDetails().execute(); } else { Toast.makeText(this, "NO Internet", Toast.LENGTH_SHORT).show(); } /* final Handler someHandler = new Handler(getMainLooper()); someHandler.postDelayed(new Runnable() { @Override public void run() { tstTime.setText(new SimpleDateFormat("HH:mm", Locale.US).format(new Date())); someHandler.postDelayed(this, 1000); } }, 10);*/ DrawerLayout drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.home, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_home) { // Handle the camera action } else if (id == R.id.nav_gallery) { } else if (id == R.id.nav_slideshow) { } else if (id == R.id.nav_tools) { } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { manager.logoutUser(); Intent intent2 = new Intent(HomeActivity.this, ChoiceActivity.class); startActivity(intent2); finish(); } DrawerLayout drawer = findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } //----------------------------------------------------- class SendJsonServer extends AsyncTask<String, String, String> { ProgressDialog dialog; protected void onPreExecute() { dialog = new ProgressDialog(HomeActivity.this); dialog.show(); } protected String doInBackground(String... arg0) { try { URL url = new URL("https://winner7quiz.com/api/getamountuser"); JSONObject postDataParams = new JSONObject(); postDataParams.put("user_id", AppPreference.getId(HomeActivity.this)); Log.e("postDataParamsgetamount", postDataParams.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000 /* milliseconds*/); conn.setConnectTimeout(15000 /*milliseconds*/); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); OutputStream os = conn.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); writer.write(getPostDataString(postDataParams)); writer.flush(); writer.close(); os.close(); int responseCode = conn.getResponseCode(); if (responseCode == HttpsURLConnection.HTTP_OK) { /*BufferedReader in = new BufferedReader(new InputStreamReader( conn.getInputStream())); StringBuffer sb = new StringBuffer(""); String line = ""; while ((line = in.readLine()) != null) { StringBuffer Ss = sb.append(line); Log.e("Ss", Ss.toString()); sb.append(line); break; } in.close(); return sb.toString(); */ BufferedReader r = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder result = new StringBuilder(); String line; while ((line = r.readLine()) != null) { result.append(line); } r.close(); return result.toString(); } else { return new String("false : " + responseCode); } } catch (Exception e) { return new String("Exception: " + e.getMessage()); } } @Override protected void onPostExecute(String result) { if (result != null) { dialog.dismiss(); // JSONObject jsonObject = null; Log.e("HomeJsonDataToServer>>>", result.toString()); try { JSONObject jsonObject = new JSONObject(result); String responce = jsonObject.getString("responce"); String massage = jsonObject.getString("massage"); amountTxt.setText(massage); // amountTxt1.setText(massage); if (responce.equalsIgnoreCase("true")) { } else { } } catch (JSONException e) { Toast.makeText(HomeActivity.this, "Network Problem", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } } public String getPostDataString(JSONObject params) throws Exception { StringBuilder result = new StringBuilder(); boolean first = true; Iterator<String> itr = params.keys(); while (itr.hasNext()) { String key = itr.next(); Object value = params.get(key); if (first) first = false; else result.append("&"); result.append(URLEncoder.encode(key, "UTF-8")); result.append("="); result.append(URLEncoder.encode(value.toString(), "UTF-8")); } return result.toString(); } } //-------------------------------------------------------- class GetExamDetails extends AsyncTask<String, String, String> { String output = ""; ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new ProgressDialog(HomeActivity.this); dialog.setMessage("Processing"); dialog.setCancelable(true); dialog.show(); super.onPreExecute(); } @Override protected String doInBackground(String... params) { try { server_url = "https://winner7quiz.com/api/getquiztime"; } catch (Exception e) { e.printStackTrace(); } Log.e("sever_url>>>>>>>>>", server_url); output = HttpHandler.makeServiceCall(server_url); System.out.println("getcomment_url" + output); return output; } @Override protected void onPostExecute(String output) { if (output == null) { dialog.dismiss(); } else { try { dialog.dismiss(); JSONObject obj = new JSONObject(output); String responce = obj.getString("responce"); if (responce.equals("true")) { JSONArray data_array = obj.getJSONArray("massage"); for (int i = 0; i < data_array.length(); i++) { JSONObject c = data_array.getJSONObject(i); String id = c.getString("id"); String quiztime = c.getString("quiztime"); String type = c.getString("type"); tstTime.setText(quiztime); } } else { Toast.makeText(HomeActivity.this, "Some Problem!!", Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); // dialog.dismiss(); } super.onPostExecute(output); } } } //------------------------------------------------------- class GetProfilDetails extends AsyncTask<String, String, String> { String output = ""; ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new ProgressDialog(HomeActivity.this); dialog.setMessage("Processing"); dialog.setCancelable(true); dialog.show(); super.onPreExecute(); } @Override protected String doInBackground(String... params) { try { server_url = "https://winner7quiz.com/api/getuserdetails?user_id=" + AppPreference.getId(HomeActivity.this); } catch (Exception e) { e.printStackTrace(); } Log.e("sever_url>>>>>>>>>", server_url); output = HttpHandler.makeServiceCall(server_url); System.out.println("getcomment_url" + output); return output; } @Override protected void onPostExecute(String output) { if (output == null) { dialog.dismiss(); } else { try { dialog.dismiss(); JSONObject obj = new JSONObject(output); String responce = obj.getString("responce"); if (responce.equals("true")) { JSONArray data_array = obj.getJSONArray("data"); for (int i = 0; i < data_array.length(); i++) { JSONObject c = data_array.getJSONObject(i); String user_id = c.getString("user_id"); String name = c.getString("name"); String email = c.getString("email"); String password = c.getString("password"); String mobile = c.getString("mobile"); String address = c.getString("address"); String type = c.getString("type"); String reffercode = c.getString("reffercode"); String bankstatus = c.getString("bankstatus"); String walletbal = c.getString("walletbal"); String image = c.getString("image"); String status = c.getString("status"); peoName.setText(name); Picasso.with(HomeActivity.this) .load(communStr + image) .placeholder(R.drawable.prf) .into(profile_image1); } } else { Toast.makeText(HomeActivity.this, "Some Problem!!", Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); // dialog.dismiss(); } super.onPostExecute(output); } } } }
UTF-8
Java
20,606
java
HomeActivity.java
Java
[ { "context": "itr.hasNext()) {\n\n String key = itr.next();\n Object value = params.get(key)", "end": 14844, "score": 0.6019569635391235, "start": 14840, "tag": "KEY", "value": "next" }, { "context": " String password = c.getString(\"password\");\n String mobile = c.", "end": 19345, "score": 0.9239479303359985, "start": 19337, "tag": "PASSWORD", "value": "password" } ]
null
[]
package android.ics.com.winner7; import android.app.ProgressDialog; import android.content.Intent; import android.ics.com.winner7.KotlinActivities.LatestWinners; import android.ics.com.winner7.KotlinActivities.WinnerHistoryActivity; import android.ics.com.winner7.Utils.AppPreference; import android.ics.com.winner7.Utils.Connectivity; import android.ics.com.winner7.Utils.HttpHandler; import android.ics.com.winner7.Utils.SessionManager; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.util.Log; import android.view.View; import android.support.v4.view.GravityCompat; import android.support.v7.app.ActionBarDrawerToggle; import android.view.MenuItem; import android.support.design.widget.NavigationView; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.squareup.picasso.Picasso; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Iterator; import java.util.Locale; import javax.net.ssl.HttpsURLConnection; import de.hdodenhof.circleimageview.CircleImageView; public class HomeActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { LinearLayout btn_play; Button btPrice, bt_winner, bt_latest, bt_test; CircleImageView profile_image1; SessionManager manager; TextView amountTxt, amountTxt1; LinearLayout volet, upcomming; TextView tstDate, tstTime; String server_url; TextView peoName; String strType; LinearLayout linear1, linear2; Button refer_btn; String communStr = "http://ihisaab.in/winnerseven/uploads/userprofile/"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // strType = getIntent().getExtras().getString("Type"); manager = new SessionManager(this); try { Log.e("type is" , ""+strType); strType = getIntent().getExtras().getString("Type"); }catch (Exception e) { strType= AppPreference.getType(HomeActivity.this); e.printStackTrace(); } Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); btn_play = (LinearLayout) findViewById(R.id.btn_play); btPrice = (Button) findViewById(R.id.btPrice); bt_winner = (Button) findViewById(R.id.bt_winner); bt_latest = (Button) findViewById(R.id.bt_latest); bt_test = (Button) findViewById(R.id.bt_test); refer_btn = (Button) findViewById(R.id.refer_btn); amountTxt = (TextView) findViewById(R.id.amountTxt); amountTxt1 = (TextView) findViewById(R.id.amountTxt1); tstDate = (TextView) findViewById(R.id.tstDate); tstTime = (TextView) findViewById(R.id.tstTime); peoName = (TextView) findViewById(R.id.peoName); volet = (LinearLayout) findViewById(R.id.walletli); upcomming = (LinearLayout) findViewById(R.id.upcomming); linear1 = (LinearLayout) findViewById(R.id.linear1); linear2 = (LinearLayout) findViewById(R.id.linear2); profile_image1 = (CircleImageView) findViewById(R.id.profile_image1); FloatingActionButton fab = findViewById(R.id.fab); if (strType.equals("1")) { linear1.setVisibility(View.VISIBLE); linear2.setVisibility(View.GONE); } else if (strType.equals("2")) { linear2.setVisibility(View.VISIBLE); linear1.setVisibility(View.GONE); } Date c = Calendar.getInstance().getTime(); System.out.println("Current time => " + c); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); String formattedDate = df.format(c); tstDate.setText(formattedDate); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); btn_play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, QuizStartActivity.class); startActivity(intent); } }); btPrice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, ListPriceActivity.class); startActivity(intent); } }); bt_winner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, WinnerHistoryActivity.class); startActivity(intent); // val intent = Intent(v.getContext(), WinnerHistoryActivity::class.java) // startActivity(Intent(this, WinnerHistoryActivity::class.java)) // startActivity(intent); } }); bt_latest.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, LatestWinners.class); startActivity(intent); } }); bt_test.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, TestSeriesActivity.class); startActivity(intent); } }); profile_image1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, ProfileActivity.class); startActivity(intent); } }); volet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, VoletActivity.class); startActivity(intent); } }); upcomming.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* Intent intent = new Intent(HomeActivity.this, TestSeriesActivity.class); startActivity(intent);*/ } }); refer_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent= new Intent(HomeActivity.this,RefferUserActivity.class); startActivity(intent); } }); if (Connectivity.isNetworkAvailable(this)) { new SendJsonServer().execute(); } else { Toast.makeText(this, "No Internet", Toast.LENGTH_SHORT).show(); } if (Connectivity.isNetworkAvailable(this)) { new GetExamDetails().execute(); } else { Toast.makeText(this, "No Internet", Toast.LENGTH_SHORT).show(); } if (Connectivity.isNetworkAvailable(this)) { new GetProfilDetails().execute(); } else { Toast.makeText(this, "NO Internet", Toast.LENGTH_SHORT).show(); } /* final Handler someHandler = new Handler(getMainLooper()); someHandler.postDelayed(new Runnable() { @Override public void run() { tstTime.setText(new SimpleDateFormat("HH:mm", Locale.US).format(new Date())); someHandler.postDelayed(this, 1000); } }, 10);*/ DrawerLayout drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.home, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_home) { // Handle the camera action } else if (id == R.id.nav_gallery) { } else if (id == R.id.nav_slideshow) { } else if (id == R.id.nav_tools) { } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { manager.logoutUser(); Intent intent2 = new Intent(HomeActivity.this, ChoiceActivity.class); startActivity(intent2); finish(); } DrawerLayout drawer = findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } //----------------------------------------------------- class SendJsonServer extends AsyncTask<String, String, String> { ProgressDialog dialog; protected void onPreExecute() { dialog = new ProgressDialog(HomeActivity.this); dialog.show(); } protected String doInBackground(String... arg0) { try { URL url = new URL("https://winner7quiz.com/api/getamountuser"); JSONObject postDataParams = new JSONObject(); postDataParams.put("user_id", AppPreference.getId(HomeActivity.this)); Log.e("postDataParamsgetamount", postDataParams.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(15000 /* milliseconds*/); conn.setConnectTimeout(15000 /*milliseconds*/); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); OutputStream os = conn.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); writer.write(getPostDataString(postDataParams)); writer.flush(); writer.close(); os.close(); int responseCode = conn.getResponseCode(); if (responseCode == HttpsURLConnection.HTTP_OK) { /*BufferedReader in = new BufferedReader(new InputStreamReader( conn.getInputStream())); StringBuffer sb = new StringBuffer(""); String line = ""; while ((line = in.readLine()) != null) { StringBuffer Ss = sb.append(line); Log.e("Ss", Ss.toString()); sb.append(line); break; } in.close(); return sb.toString(); */ BufferedReader r = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder result = new StringBuilder(); String line; while ((line = r.readLine()) != null) { result.append(line); } r.close(); return result.toString(); } else { return new String("false : " + responseCode); } } catch (Exception e) { return new String("Exception: " + e.getMessage()); } } @Override protected void onPostExecute(String result) { if (result != null) { dialog.dismiss(); // JSONObject jsonObject = null; Log.e("HomeJsonDataToServer>>>", result.toString()); try { JSONObject jsonObject = new JSONObject(result); String responce = jsonObject.getString("responce"); String massage = jsonObject.getString("massage"); amountTxt.setText(massage); // amountTxt1.setText(massage); if (responce.equalsIgnoreCase("true")) { } else { } } catch (JSONException e) { Toast.makeText(HomeActivity.this, "Network Problem", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } } public String getPostDataString(JSONObject params) throws Exception { StringBuilder result = new StringBuilder(); boolean first = true; Iterator<String> itr = params.keys(); while (itr.hasNext()) { String key = itr.next(); Object value = params.get(key); if (first) first = false; else result.append("&"); result.append(URLEncoder.encode(key, "UTF-8")); result.append("="); result.append(URLEncoder.encode(value.toString(), "UTF-8")); } return result.toString(); } } //-------------------------------------------------------- class GetExamDetails extends AsyncTask<String, String, String> { String output = ""; ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new ProgressDialog(HomeActivity.this); dialog.setMessage("Processing"); dialog.setCancelable(true); dialog.show(); super.onPreExecute(); } @Override protected String doInBackground(String... params) { try { server_url = "https://winner7quiz.com/api/getquiztime"; } catch (Exception e) { e.printStackTrace(); } Log.e("sever_url>>>>>>>>>", server_url); output = HttpHandler.makeServiceCall(server_url); System.out.println("getcomment_url" + output); return output; } @Override protected void onPostExecute(String output) { if (output == null) { dialog.dismiss(); } else { try { dialog.dismiss(); JSONObject obj = new JSONObject(output); String responce = obj.getString("responce"); if (responce.equals("true")) { JSONArray data_array = obj.getJSONArray("massage"); for (int i = 0; i < data_array.length(); i++) { JSONObject c = data_array.getJSONObject(i); String id = c.getString("id"); String quiztime = c.getString("quiztime"); String type = c.getString("type"); tstTime.setText(quiztime); } } else { Toast.makeText(HomeActivity.this, "Some Problem!!", Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); // dialog.dismiss(); } super.onPostExecute(output); } } } //------------------------------------------------------- class GetProfilDetails extends AsyncTask<String, String, String> { String output = ""; ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new ProgressDialog(HomeActivity.this); dialog.setMessage("Processing"); dialog.setCancelable(true); dialog.show(); super.onPreExecute(); } @Override protected String doInBackground(String... params) { try { server_url = "https://winner7quiz.com/api/getuserdetails?user_id=" + AppPreference.getId(HomeActivity.this); } catch (Exception e) { e.printStackTrace(); } Log.e("sever_url>>>>>>>>>", server_url); output = HttpHandler.makeServiceCall(server_url); System.out.println("getcomment_url" + output); return output; } @Override protected void onPostExecute(String output) { if (output == null) { dialog.dismiss(); } else { try { dialog.dismiss(); JSONObject obj = new JSONObject(output); String responce = obj.getString("responce"); if (responce.equals("true")) { JSONArray data_array = obj.getJSONArray("data"); for (int i = 0; i < data_array.length(); i++) { JSONObject c = data_array.getJSONObject(i); String user_id = c.getString("user_id"); String name = c.getString("name"); String email = c.getString("email"); String password = c.getString("<PASSWORD>"); String mobile = c.getString("mobile"); String address = c.getString("address"); String type = c.getString("type"); String reffercode = c.getString("reffercode"); String bankstatus = c.getString("bankstatus"); String walletbal = c.getString("walletbal"); String image = c.getString("image"); String status = c.getString("status"); peoName.setText(name); Picasso.with(HomeActivity.this) .load(communStr + image) .placeholder(R.drawable.prf) .into(profile_image1); } } else { Toast.makeText(HomeActivity.this, "Some Problem!!", Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); // dialog.dismiss(); } super.onPostExecute(output); } } } }
20,608
0.548627
0.545715
578
34.65052
25.694216
124
false
false
0
0
0
0
0
0
0.595156
false
false
13
191f4a537b29399a5ab3b32ceaaa37470dd8bbf0
8,220,567,452,193
219cc645714c987ce86a2e292178e42223bccf6a
/vmscheduler-springboot/src/main/java/com/vmware/vmscheduler/vmschedulerspringboot/service/VMSchedulerService.java
dc9d793ed9648bc5c7eac1d36bc0c1064ec68fb8
[]
no_license
YifeiCN/Virtual-Machine-Scheduler
https://github.com/YifeiCN/Virtual-Machine-Scheduler
28a4fb7b106e40ea605591025bcdd713b0817ae0
6a8bc7e57994f644e83b2fbb7f53936d788ee51f
refs/heads/main
2023-02-14T22:12:20.632000
2021-01-01T13:57:33
2021-01-01T13:57:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vmware.vmscheduler.vmschedulerspringboot.service; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.vmware.vmscheduler.vmschedulerspringboot.entity.Host; import com.vmware.vmscheduler.vmschedulerspringboot.entity.VirtualMachine; @Service public class VMSchedulerService { private HostService hostService; private VirtualMachineService vmService; @Autowired public VMSchedulerService(HostService hostService,VirtualMachineService vmService) { this.hostService = hostService; this.vmService = vmService; } /*Inputs: * - VM set V , * - PM set P in the data center, and * - initial VM/PM mapping M. *Outputs: * - updated VM/PM mapping M. */ public HashMap<Integer,Integer> offlineServerLoad(int failedMigLimit, List<VirtualMachine> vms, List<Host> hosts, HashMap<Integer,Integer> hmap) { int failedMig = 0; double[][] hostOccupiedMag = new double[hosts.size()][2]; for(int i = 0; i<hosts.size(); i++) { Host h = hosts.get(i); hostOccupiedMag[i][0] = h.getHostId(); hostOccupiedMag[i][1] = calOccupiedMagnitude(h.getAllotedCpuCount(),h.getAllotedMemorySizeMiB()); } sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy for(int i = hostOccupiedMag.length-1; i>=0; i--) { //starting from least loaded Host h = hostService.findById((int)hostOccupiedMag[i][0]); //PM i HashMap<Integer,Integer> backupMap = new HashMap<Integer, Integer>(); backupMap.putAll(hmap); // M backup double[][] backedUpHostOccupiedMag = hostOccupiedMag.clone(); // P backup int noOfVmsOnHostI = vmService.findAllById(h.getHostId()).size(); double[][] vmOccupiedMag = new double[noOfVmsOnHostI][2]; int p = 0; for(int l = 0; l<vms.size(); l++) { // of all vms if(vms.get(l).getHostId() == h.getHostId() ) { //ones on PM i VirtualMachine vm = vms.get(l); vmOccupiedMag[p][0] = vm.getVmId(); vmOccupiedMag[p][1] = calOccupiedMagnitude(vm.getCpuCount(),vm.getMemorySizeMiB()); p++; } } sortbyColumnDesc(vmOccupiedMag); //descending order int noOfVmsLeftToMigrate = noOfVmsOnHostI; for(int j=0; j< vmOccupiedMag.length; j++) { //vms on PM i for(int k=0; k<= i; k++) { //hosts starting from most loaded Host host = hostService.findById((int)hostOccupiedMag[k][0]); // PM k VirtualMachine vm = vmService.findById((int)vmOccupiedMag[j][0]); //V[i][j] if(doesVMFitInHost(host,vm) == true) { hmap.replace(vm.getVmId(), host.getHostId()); int newHostCpuCount = host.getAllotedCpuCount() + vm.getCpuCount(); int newHostMemorySize = host.getAllotedMemorySizeMiB() + vm.getMemorySizeMiB(); hostOccupiedMag[k][1] = calOccupiedMagnitude(newHostCpuCount,newHostMemorySize); sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy noOfVmsLeftToMigrate -= 1; } } } if(noOfVmsLeftToMigrate == 0) { hostOccupiedMag = backedUpHostOccupiedMag.clone(); hmap.putAll(backupMap); failedMig += 1; } if(failedMig >= failedMigLimit) { System.out.println("No. of Failed Migrations crossed the set limit."); return null; } } return hmap; } private double calOccupiedMagnitude(int cpuCount, int memorySizeMiB ) { double result = Math.sqrt((cpuCount)*(cpuCount) +(memorySizeMiB)*(memorySizeMiB)); System.out.println(result); return result; } private void sortbyColumnDesc(double arr[][]) { Arrays.sort(arr, new Comparator<double[]>() { public int compare(final double[] entry1, final double[] entry2) { if (entry1[1] < entry2[1]) return 1; else return -1; } }); } private boolean doesVMFitInHost(Host host, VirtualMachine vm) { int vmCpuCount = vm.getCpuCount(); int vmMemorySize = vm.getMemorySizeMiB(); int hostRemainingCpuCount = host.getCpuCount()-host.getAllotedCpuCount(); int hostRemainingMemorySize = host.getMemorySizeMiB()-host.getAllotedMemorySizeMiB(); if((vmCpuCount <= hostRemainingCpuCount) && (vmMemorySize <= hostRemainingMemorySize)) { return true; } else { return false; } } public int onlineServerLoad(VirtualMachine vm, List<Host> hosts) { /*Inputs: * - VM v , * - PM set P in the data center, and * - initial VM/PM mapping M. *Outputs: * - updated VM/PM mapping M */ double[][] hostOccupiedMag = new double[hosts.size()][2]; for(int i = 0; i<hosts.size(); i++) { Host h = hosts.get(i); hostOccupiedMag[i][0] = h.getHostId(); hostOccupiedMag[i][1] = calOccupiedMagnitude(h.getAllotedCpuCount(),h.getAllotedMemorySizeMiB()); } sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy for(int i=0;i<hosts.size();i++) { Host host = hostService.findById((int)hostOccupiedMag[i][0]); //PM i if(doesVMFitInHost(host,vm) == true) { //place vm on host //hmap.replace(vm.getVmId(), host.getHostId()); //int newHostCpuCount = host.getAllotedCpuCount() + vm.getCpuCount(); //int newHostMemorySize = host.getAllotedMemorySizeMiB() + vm.getMemorySizeMiB(); //hostOccupiedMag[i][1] = calOccupiedMagnitude(newHostCpuCount,newHostMemorySize); //sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy return host.getHostId(); } } return -1; //reject request for v } }
UTF-8
Java
5,517
java
VMSchedulerService.java
Java
[]
null
[]
package com.vmware.vmscheduler.vmschedulerspringboot.service; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.vmware.vmscheduler.vmschedulerspringboot.entity.Host; import com.vmware.vmscheduler.vmschedulerspringboot.entity.VirtualMachine; @Service public class VMSchedulerService { private HostService hostService; private VirtualMachineService vmService; @Autowired public VMSchedulerService(HostService hostService,VirtualMachineService vmService) { this.hostService = hostService; this.vmService = vmService; } /*Inputs: * - VM set V , * - PM set P in the data center, and * - initial VM/PM mapping M. *Outputs: * - updated VM/PM mapping M. */ public HashMap<Integer,Integer> offlineServerLoad(int failedMigLimit, List<VirtualMachine> vms, List<Host> hosts, HashMap<Integer,Integer> hmap) { int failedMig = 0; double[][] hostOccupiedMag = new double[hosts.size()][2]; for(int i = 0; i<hosts.size(); i++) { Host h = hosts.get(i); hostOccupiedMag[i][0] = h.getHostId(); hostOccupiedMag[i][1] = calOccupiedMagnitude(h.getAllotedCpuCount(),h.getAllotedMemorySizeMiB()); } sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy for(int i = hostOccupiedMag.length-1; i>=0; i--) { //starting from least loaded Host h = hostService.findById((int)hostOccupiedMag[i][0]); //PM i HashMap<Integer,Integer> backupMap = new HashMap<Integer, Integer>(); backupMap.putAll(hmap); // M backup double[][] backedUpHostOccupiedMag = hostOccupiedMag.clone(); // P backup int noOfVmsOnHostI = vmService.findAllById(h.getHostId()).size(); double[][] vmOccupiedMag = new double[noOfVmsOnHostI][2]; int p = 0; for(int l = 0; l<vms.size(); l++) { // of all vms if(vms.get(l).getHostId() == h.getHostId() ) { //ones on PM i VirtualMachine vm = vms.get(l); vmOccupiedMag[p][0] = vm.getVmId(); vmOccupiedMag[p][1] = calOccupiedMagnitude(vm.getCpuCount(),vm.getMemorySizeMiB()); p++; } } sortbyColumnDesc(vmOccupiedMag); //descending order int noOfVmsLeftToMigrate = noOfVmsOnHostI; for(int j=0; j< vmOccupiedMag.length; j++) { //vms on PM i for(int k=0; k<= i; k++) { //hosts starting from most loaded Host host = hostService.findById((int)hostOccupiedMag[k][0]); // PM k VirtualMachine vm = vmService.findById((int)vmOccupiedMag[j][0]); //V[i][j] if(doesVMFitInHost(host,vm) == true) { hmap.replace(vm.getVmId(), host.getHostId()); int newHostCpuCount = host.getAllotedCpuCount() + vm.getCpuCount(); int newHostMemorySize = host.getAllotedMemorySizeMiB() + vm.getMemorySizeMiB(); hostOccupiedMag[k][1] = calOccupiedMagnitude(newHostCpuCount,newHostMemorySize); sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy noOfVmsLeftToMigrate -= 1; } } } if(noOfVmsLeftToMigrate == 0) { hostOccupiedMag = backedUpHostOccupiedMag.clone(); hmap.putAll(backupMap); failedMig += 1; } if(failedMig >= failedMigLimit) { System.out.println("No. of Failed Migrations crossed the set limit."); return null; } } return hmap; } private double calOccupiedMagnitude(int cpuCount, int memorySizeMiB ) { double result = Math.sqrt((cpuCount)*(cpuCount) +(memorySizeMiB)*(memorySizeMiB)); System.out.println(result); return result; } private void sortbyColumnDesc(double arr[][]) { Arrays.sort(arr, new Comparator<double[]>() { public int compare(final double[] entry1, final double[] entry2) { if (entry1[1] < entry2[1]) return 1; else return -1; } }); } private boolean doesVMFitInHost(Host host, VirtualMachine vm) { int vmCpuCount = vm.getCpuCount(); int vmMemorySize = vm.getMemorySizeMiB(); int hostRemainingCpuCount = host.getCpuCount()-host.getAllotedCpuCount(); int hostRemainingMemorySize = host.getMemorySizeMiB()-host.getAllotedMemorySizeMiB(); if((vmCpuCount <= hostRemainingCpuCount) && (vmMemorySize <= hostRemainingMemorySize)) { return true; } else { return false; } } public int onlineServerLoad(VirtualMachine vm, List<Host> hosts) { /*Inputs: * - VM v , * - PM set P in the data center, and * - initial VM/PM mapping M. *Outputs: * - updated VM/PM mapping M */ double[][] hostOccupiedMag = new double[hosts.size()][2]; for(int i = 0; i<hosts.size(); i++) { Host h = hosts.get(i); hostOccupiedMag[i][0] = h.getHostId(); hostOccupiedMag[i][1] = calOccupiedMagnitude(h.getAllotedCpuCount(),h.getAllotedMemorySizeMiB()); } sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy for(int i=0;i<hosts.size();i++) { Host host = hostService.findById((int)hostOccupiedMag[i][0]); //PM i if(doesVMFitInHost(host,vm) == true) { //place vm on host //hmap.replace(vm.getVmId(), host.getHostId()); //int newHostCpuCount = host.getAllotedCpuCount() + vm.getCpuCount(); //int newHostMemorySize = host.getAllotedMemorySizeMiB() + vm.getMemorySizeMiB(); //hostOccupiedMag[i][1] = calOccupiedMagnitude(newHostCpuCount,newHostMemorySize); //sortbyColumnDesc(hostOccupiedMag); //descending order of occupancy return host.getHostId(); } } return -1; //reject request for v } }
5,517
0.685336
0.67863
151
35.536423
30.161327
147
false
false
0
0
0
0
0
0
3.145695
false
false
13