blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
132
| path
stringlengths 2
382
| src_encoding
stringclasses 34
values | length_bytes
int64 9
3.8M
| score
float64 1.5
4.94
| int_score
int64 2
5
| detected_licenses
listlengths 0
142
| license_type
stringclasses 2
values | text
stringlengths 9
3.8M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
7690521f5be115b062ac988d74c07fbd2c989bdf
|
Java
|
GregGGregGreG/training-epam-2016
|
/MyApplication/app/src/main/java/com/example/mikhail_sianko/myapplication/model/TwitterSearchResponse.java
|
UTF-8
| 1,016
| 2.5625
| 3
|
[
"Apache-2.0"
] |
permissive
|
package com.example.mikhail_sianko.myapplication.model;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class TwitterSearchResponse {
private List<TwitterSearchStatus> mTwitterSearchStatuses = new ArrayList<>();
public TwitterSearchResponse(String json) throws JSONException {
JSONObject jsonObject = new JSONObject(json);
if (jsonObject.has("statuses")) {
JSONArray statusesJsonArray = jsonObject.getJSONArray("statuses");
for (int i = 0; i < statusesJsonArray.length(); i++) {
JSONObject statusObject = statusesJsonArray.getJSONObject(i);
TwitterSearchStatus twitterSearchStatus = new TwitterSearchStatus(statusObject);
mTwitterSearchStatuses.add(twitterSearchStatus);
}
}
}
public List<TwitterSearchStatus> getTwitterSearchStatuses() {
return mTwitterSearchStatuses;
}
}
| true
|
b680cbaba7fa70ba91b76688ebb2e1b22ac92220
|
Java
|
ahdahddl/cytoscape
|
/csplugins/trunk/ucsd/kono/RDFScape/src/fr/pasteur/sysbio/rdfscape/computing/TermsNode.java
|
UTF-8
| 3,497
| 2.546875
| 3
|
[] |
no_license
|
/**
* Copyright 2006 Andrea Splendiani
* Released under GPL license
*/
package fr.pasteur.sysbio.rdfscape.computing;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
/*
* Created on Oct 14, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author andrea
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class TermsNode implements CompNode,CompValueNode {
ArrayList myTerms=new ArrayList();
ArrayList myOperations=new ArrayList();
/**
*
*/
public TermsNode() {
super();
}
/* (non-Javadoc)
* @see compNode#dump()
*/
public String dump() {
String answer=new String();
answer=answer.concat("Addition(");
for (int i = 0; i < myTerms.size(); i++) {
answer=answer.concat((String)myOperations.get(i));
answer=answer.concat(((CompNode)myTerms.get(i)).dump()+" ");
}
answer=answer.concat(")");
return answer;
}
/**
* @param myNode
* @param string
*/
public void add(CompNode myNode, String string) {
//System.out.println("ADD");
myTerms.add(myNode);
myOperations.add(string);
}
/* (non-Javadoc)
* @see fr.pasteur.sysbio.rdfscape.computing.CompNode#collectPatterns(java.util.ArrayList)
*/
public boolean collectPatterns(ArrayList patternCollection) {
//System.out.println("T");
for (Iterator iter = myTerms.iterator(); iter.hasNext();) {
CompNode child = (CompNode) iter.next();
child.collectPatterns(patternCollection);
}
return true;
}
/* (non-Javadoc)
* @see fr.pasteur.sysbio.rdfscape.computing.CompNode#optimizeTree(fr.pasteur.sysbio.rdfscape.computing.EvaluationNode, fr.pasteur.sysbio.rdfscape.computing.CompNode)
*/
public CompNode optimizeTree(EvaluationNode eval, CompNode parent) {
//System.out.println("OT");
/*
for (int i=0 ; i<myTerms.size(); i++) {
System.out.println(i+);
CompNode child = (CompNode) myTerms.get(i);
optimizeTree(eval,child);
}
System.out.println("+");
*/
/*
* Here we should add a step to pre-compute products
*/
if(myTerms.size()==1) {
eval.optAction++;
return (CompNode)myTerms.get(0);
}
else return this;
}
/* (non-Javadoc)
* @see fr.pasteur.sysbio.rdfscape.computing.CompValueNode#computePartial(fr.pasteur.sysbio.rdfscape.computing.EvaluationNode, java.util.Hashtable, java.util.Hashtable, java.util.ArrayList[])
*/
public boolean computePartial(EvaluationNode eval, Hashtable geneMapper, Hashtable conditionMapper, ArrayList[] context) {
boolean answer=true;
//System.out.println("T");
for (Iterator iter = myTerms.iterator(); iter.hasNext();) {
CompValueNode child = (CompValueNode) iter.next();
answer=answer&&child.computePartial(eval, geneMapper, conditionMapper,context);
}
return answer;
}
/* (non-Javadoc)
* @see fr.pasteur.sysbio.rdfscape.computing.CompValueNode#computeTotal(double[][], boolean)
*/
public double computeTotal(double[][] expressionData) {
double result=0;
for (int i=0;i<myTerms.size(); i++) {
CompValueNode child = (CompValueNode) myTerms.get(i);
String myOp=(String)(myOperations.get(i));
if(myOp.equals("+")) result=result+child.computeTotal(expressionData);
if(myOp.equals("-")) result=result-child.computeTotal(expressionData);
System.out.println("Computing TermsNode: "+result);
}
return result;
}
}
| true
|
01d98e7664cbbb6243fed88e0ea946a0113fc394
|
Java
|
itstc/TheIrisProject
|
/app/src/main/java/com/team7/cmput301/android/theirisproject/activity/ViewRecordActivity.java
|
UTF-8
| 1,887
| 2.421875
| 2
|
[] |
no_license
|
/*
* Copyright (c) Team 7, CMPUT301, University of Alberta - All Rights Reserved. You may use, distribute, or modify this code under terms and conditions of the Code of Students Behavior at University of Alberta
*/
package com.team7.cmput301.android.theirisproject.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;
import com.team7.cmput301.android.theirisproject.R;
import com.team7.cmput301.android.theirisproject.controller.RecordController;
import com.team7.cmput301.android.theirisproject.model.Record;
import com.team7.cmput301.android.theirisproject.task.Callback;
/**
* ViewRecordActivity used to view a record
*
* @author jtfwong
* */
public class ViewRecordActivity extends AppCompatActivity {
private TextView title;
private TextView desc;
private TextView date;
private RecordController controller;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_record);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
controller = new RecordController(getIntent());
title = findViewById(R.id.record_title);
desc = findViewById(R.id.record_description);
date = findViewById(R.id.record_date);
}
@Override
protected void onStart() {
super.onStart();
controller.getRecordData(new Callback<Record>() {
@Override
public void onComplete(Record res) {
render(res);
}
});
}
private void render(Record newState) {
title.setText(newState.getTitle());
desc.setText(newState.getDesc());
date.setText(newState.getDate().toString());
}
}
| true
|
e50083bfe29fc8683885836f361e59f679d5e0c0
|
Java
|
infinispan/infinispan
|
/query/src/test/java/org/infinispan/query/test/Transaction.java
|
UTF-8
| 941
| 2.234375
| 2
|
[
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] |
permissive
|
package org.infinispan.query.test;
import java.io.Serializable;
import org.infinispan.api.annotations.indexing.Basic;
import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoFactory;
import org.infinispan.protostream.annotations.ProtoField;
@Indexed(index = "transactionIndex")
public class Transaction implements Serializable {
private final int size;
private final String script;
@ProtoFactory
public Transaction(int size, String script) {
this.size = size;
this.script = script;
}
@Basic
@ProtoField(number = 1, defaultValue = "0")
public int getSize() {
return size;
}
@Basic
@ProtoField(number = 2)
public String getScript() {
return script;
}
@Override
public String toString() {
return "Transaction{" +
"size=" + size +
", script='" + script + '\'' +
'}';
}
}
| true
|
bcbbea59f92652e3b2a57c9e0955bbcec73f07f9
|
Java
|
xzs603/codeLearning
|
/odinms/src/main/java/net/sf/odinms/client/messages/CommandProcessorMBean.java
|
UTF-8
| 247
| 1.554688
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
Jiongorz. Src. Command.java
JiongorzBBs : http://bbs.jiongorz.com
AdminQQ:307586193
Command
*/
package net.sf.odinms.client.messages;
public interface CommandProcessorMBean {
String processCommandJMX(int cserver, int mapid, String command);
}
| true
|
20aa4bbf6c7196d954d4db731d2bbf2693a316a1
|
Java
|
dinukanadeeshan/Pharmacy-System
|
/PharmacySystemServer/src/com/redonz/pms/server/pool/connection/DBConnectionDriver.java
|
UTF-8
| 2,224
| 2.421875
| 2
|
[] |
no_license
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.redonz.pms.server.pool.connection;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Logger;
/**
*
* @author Nadeeshan
*/
public class DBConnectionDriver implements Driver{
private static DBConnectionDriver driver;
private final String PREFIX = "jdbc:pool";
private DBConnectionPool pool;
private DBConnectionDriver(DBConnectionPool pool, String className) throws SQLException, ClassNotFoundException {
this.pool = pool;
DriverManager.registerDriver(this);
Class.forName(className);
}
public DBConnectionPool getConnectionPool(){
return pool;
}
public static DBConnectionDriver initializeDriver(String url, String user, String password, String className) throws SQLException, ClassNotFoundException{
if (driver == null) {
driver = new DBConnectionDriver(new DBConnectionPool(url, user, password),className);
}
return driver;
}
@Override
public Connection connect(String url, Properties info) throws SQLException {
if (acceptsURL(url)) {
return pool.getConnection();
}
throw new SQLException("Invalid url : "+url);
}
@Override
public boolean acceptsURL(String url) throws SQLException {
if (url.startsWith(PREFIX)) {
return true;
}
return false;
}
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
return new DriverPropertyInfo[]{};
}
@Override
public int getMajorVersion() {
return 1;
}
@Override
public int getMinorVersion() {
return 0;
}
@Override
public boolean jdbcCompliant() {
return false;
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return null;
}
}
| true
|
240f1cc55c4b74aae5f0041452e23dcc5098492e
|
Java
|
ojss/toolx
|
/app/src/main/java/com/projectx/toolx/unit_converter.java
|
UTF-8
| 1,850
| 2.078125
| 2
|
[] |
no_license
|
package com.projectx.toolx;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class unit_converter extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_unit_convertor);
}
public void tListener(View view)
{
Intent intent = new Intent(getApplicationContext(), TemperatureActivity.class);
startActivity(intent);
}
public void dListener(View view)
{
Intent intent = new Intent(getApplicationContext(), DistanceActivity.class);
startActivity(intent);
}
public void wListener(View view)
{
Intent intent = new Intent(getApplicationContext(), WeightActivity.class);
startActivity(intent);
}
public void aListener(View view)
{
Intent intent = new Intent(getApplicationContext(), AreaActivity.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_unit_convertor, 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);
}
}
| true
|
fa81e1ee3d525bd47c06dfcc7a923c97a08694b1
|
Java
|
llsok/ycdemo
|
/76/C76-S2-Tpllp-ebook/src/com/yc/easyweb/dao/PayTypeDao.java
|
GB18030
| 3,594
| 2.28125
| 2
|
[] |
no_license
|
package com.yc.easyweb.dao;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper;
import com.yc.easyweb.bean.Book;
import com.yc.easyweb.bean.Notice;
import com.yc.easyweb.bean.PayType;
import com.yc.easyweb.common.DbHelper;
/**
* PayTypedao
*
* @author psq
*
*/
public class PayTypeDao {
// ѯ
public List<PayType> selectAll(PayType payType) throws IOException {
StringBuffer sb = new StringBuffer();
sb.append(" select eopaytypeid,eopayname,eopaystate,eopaytemp from paytype where 1=1 ");
if (payType != null) {
if (payType.getEopaytypeid() != 0) {
sb.append(" and eopaytypeid = " + payType.getEopaytypeid() );
}
if (payType.getEopayname() != null) {
sb.append(" and eopayname like'%" + payType.getEopayname()+"%'" );
}
}
sb.append(" order by eopaytypeid desc");
List<PayType> list = DbHelper.selectAll(sb.toString(), null, PayType.class);
return list;
}
// ѯ
public PayType selectSingle(PayType payType) throws IOException {
StringBuffer sb = new StringBuffer();
sb.append(" select eopaytypeid,eopayname,eopaystate,eopaytemp from paytype where 1=1 ");
if (payType != null) {
if (payType.getEopaytypeid() != 0) {
sb.append(" and eopaytypeid = " + payType.getEopaytypeid() );
}
if (payType.getEopayname() != null) {
sb.append(" and eopayname like'%" + payType.getEopayname()+"%'" );
}
}
sb.append(" order by eopaytypeid desc");
return DbHelper.selectSingle(sb.toString(), null, PayType.class);
}
//
public int insert(PayType payType) throws SQLException {
String sql = "insert into paytype(eopaytypeid,eopayname,eostatetemp,eopaystate) " + " values(null,?,?,default);";
return DbHelper.update(sql, payType.getEopayname(),payType.getEopaytemp());
}
// ɾ
public int delete(PayType payType) throws SQLException {
StringBuffer sb = new StringBuffer();
if (payType == null) {
return 0;
}
sb.append("delete from paytype where 1=1 ");
if (payType != null) {
if (payType.getEopaytypeid() != 0) {
sb.append(" and eopaytypeid = " + payType.getEopaytypeid() );
}
if (payType.getEopayname() != null) {
sb.append(" and eopayname ='" + payType.getEopayname()+"'" );
}
}
return DbHelper.update(sb.toString(), null);
}
//
public int update(PayType payTypeNew,PayType payTypeOld) {
StringBuffer sb = new StringBuffer();
if (payTypeOld== null || payTypeNew== null) {
return 0;
}
sb.append("update paytype set eopaytemp='' ");
if (payTypeNew.getEopayname() != null && !payTypeNew.getEopayname().isEmpty()) {
sb.append(" , eopayname = '" + payTypeNew.getEopayname() +"'");
}
if (payTypeNew.getEopaytemp() != null && !payTypeNew.getEopaytemp().isEmpty()) {
sb.append(" , eopaytemp = '" + payTypeNew.getEopaytemp() +"'");
}
if(payTypeNew.getEopaystate() != 0){
sb.append(" , eopaystate = " + payTypeNew.getEopaystate());
}
if(payTypeNew.getEopaytypeid() != 0){
sb.append(" , eopaytypeid = " + payTypeNew.getEopaytypeid());
}
sb.append(" where 1=1 ");
if (payTypeOld.getEopaytypeid() != 0) {
sb.append(" and eopaytypeid = " + payTypeOld.getEopaytypeid() );
}
if (payTypeOld.getEopayname() != null) {
sb.append(" and eopayname ='" + payTypeOld.getEopayname()+"'" );
}
return DbHelper.update(sb.toString(), null);
}
}
| true
|
fceb8918dfe3e9123015570a1361b7144114074e
|
Java
|
talkin/BookShelf
|
/src/main/java/com/app/domain/User.java
|
UTF-8
| 1,677
| 2.171875
| 2
|
[] |
no_license
|
package com.app.domain;
/**
* Created by jtao on 3/14/15.
*/
public class User {
private String name;
private String password;
private String birthday;
private String location;
private String email;
private String gender;
private String receiveEmail;
private String comments;
private String notes;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getReceiveEmail() {
return receiveEmail;
}
public void setReceiveEmail(String receiveEmail) {
this.receiveEmail = receiveEmail;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
}
| true
|
cedd245a7677b28f78a24913ced6fee29a08c579
|
Java
|
pijiedeng/pjs-game
|
/src/main/java/com/pj/model/StageCondition.java
|
UTF-8
| 1,156
| 2.890625
| 3
|
[] |
no_license
|
package com.pj.model;
/**
* Created on 2019/5/13 18:42
* 条件类 / condition also means role
* @author pj Deng
*/
public class StageCondition {
private boolean caseThree ;
private boolean caseFive ;
private boolean caseThreeAndFive ;
public StageCondition() {
}
/**
* 根据序号得出规则 / get role by index number
* @param index pupil's index number
*/
public StageCondition(Integer index) {
this.caseThree = (index % 3 == 0);
this.caseFive = (index % 5 == 0);
this.caseThreeAndFive = (index % 3 == 0 && index % 5 == 0);
}
//setter and getter
public boolean isCaseThree() {
return caseThree;
}
public void setCaseThree(boolean caseThree) {
this.caseThree = caseThree;
}
public boolean isCaseFive() {
return caseFive;
}
public void setCaseFive(boolean caseFive) {
this.caseFive = caseFive;
}
public boolean isCaseThreeAndFive() {
return caseThreeAndFive;
}
public void setCaseThreeAndFive(boolean caseThreeAndFive) {
this.caseThreeAndFive = caseThreeAndFive;
}
}
| true
|
e1a46912005b4cc6e3f70ddb725587da7fddf958
|
Java
|
GLAU-TND/assignment-1-ssroyal
|
/src/execution/Main.java
|
UTF-8
| 1,813
| 3.359375
| 3
|
[] |
no_license
|
/*
Saurabh's Contact List App is a simple contacts management Application
Allows to add ,search and delete contacts
Created by IntelliJ IDEA Ultimate, 2019
User: ssroyal
@author Saurabh Saraswat
* @version 1.0;
*/
package execution;
import Definition.MyContacts;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
MyContacts user = new MyContacts();
boolean response = true;
do {
System.out.println("Welcome to Saurabh's Contact List App\n" +
"Press 1 to add a new contact\n" +
"Press 2 to view all contacts\n" +
"Press 3 to search for a contact\n" +
"Press 4 to delete a contact\n" +
"Press 5 to exit program ");
String str = sc.next();
if (str.length() > 1) {
System.out.println("Invalid Option");
continue;
}
char choice = str.charAt(0);
switch (choice) {
case '1':
user.addContact();
break;
case '2':
user.viewContacts();
break;
case '3':
user.searchContact();
break;
case '4':
user.deleteContact();
break;
case '5':
System.out.println("Thank You");
System.out.println("Have a great Day");
response = false;
break;
default:
System.out.println("Invalid Option");
}
} while (response);
sc.close();
}
}
| true
|
81c5f4758123f9c745e2de1a1f3daeeb73b03039
|
Java
|
nathena/yingks-infra
|
/src/main/java/com/yingks/wx/msg/SubscribeMessage.java
|
UTF-8
| 802
| 2.09375
| 2
|
[] |
no_license
|
package com.yingks.wx.msg;
/**
* 关注/取消关注事件
* @Title: SubscribeMessage.java
* @Package com.yingks.wx.msg
* @author nathena
* @date 2016年8月4日 下午1:45:43
* @version V1.0
* @UpdateHis:
* TODO
*/
public class SubscribeMessage extends AbstractEventMessage {
/**
* @Fields serialVersionUID
*/
private static final long serialVersionUID = 1L;
//事件KEY值,qrscene_为前缀,后面为二维码的参数值
private String EventKey;
//二维码的ticket,可用来换取二维码图片
private String Ticket;
public String getEventKey() {
return EventKey;
}
public void setEventKey(String eventKey) {
EventKey = eventKey;
}
public String getTicket() {
return Ticket;
}
public void setTicket(String ticket) {
Ticket = ticket;
}
}
| true
|
027ef7633511205255215bbcd9c166d5aa0ec703
|
Java
|
0-Avalon-0/Web
|
/File/src/main/java/com/application/service/ProjectService.java
|
UTF-8
| 1,077
| 1.960938
| 2
|
[] |
no_license
|
package com.application.service;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.application.bean.CusProject;
import com.application.bean.PSetting;
import com.application.dao.ProjectDao;
import com.application.status.Status;
@Service
public class ProjectService implements IProjectService{
@Autowired
private ProjectDao projectDao;
public Status createProject(CusProject cusProject, HttpServletRequest httpServletRequest) {
return projectDao.createProject(cusProject, httpServletRequest);
}
public Status searchProject(int pid, HttpServletRequest httpServletRequest) {
return projectDao.searchProject(pid, httpServletRequest);
}
public Status getSetting(int pid, HttpServletRequest httpServletRequest) {
return projectDao.getSetting(pid, httpServletRequest);
}
public Status updateSetting(int pid, PSetting pSetting, HttpServletRequest httpServletRequest) {
return projectDao.updateSetting(pid, pSetting, httpServletRequest);
}
}
| true
|
45895bba11dfb24f30cf7d20294c44ffe93a1441
|
Java
|
13525846841/ConSonP
|
/app/src/main/java/com/yksj/consultation/son/home/InstitutionHomeActivity.java
|
UTF-8
| 11,416
| 1.617188
| 2
|
[] |
no_license
|
package com.yksj.consultation.son.home;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.squareup.okhttp.Request;
import com.yksj.consultation.adapter.FamousDoctorAreaSelectAdapter;
import com.yksj.consultation.son.R;
import com.yksj.consultation.son.consultation.bean.MyEvent;
import com.yksj.consultation.son.consultation.main.HomePageActivity;
import com.yksj.consultation.son.fragment.InstitutionHomeFragment;
import com.yksj.consultation.son.listener.OnRecyclerTypeClickListener;
import com.yksj.healthtalk.entity.SelectChildCityEntity;
import com.yksj.healthtalk.entity.SelectProvinceEntity;
import com.yksj.healthtalk.net.http.HttpRestClient;
import com.yksj.healthtalk.net.http.OkHttpClientManager;
import org.apache.http.message.BasicNameValuePair;
import java.util.ArrayList;
import java.util.List;
import de.greenrobot.event.EventBus;
public class InstitutionHomeActivity extends FragmentActivity implements View.OnClickListener, OnRecyclerTypeClickListener {
private PopupWindow popupWindow;
private ImageView insHomeMore;
private List<SelectProvinceEntity.AreaBean> provinceList = new ArrayList<>();
private List<SelectChildCityEntity.AreaBean> childCityList = new ArrayList<>();
private FamousDoctorAreaSelectAdapter cityAdapter;
private FamousDoctorAreaSelectAdapter provinceAdapter;
private String provinceAreaCode = "";//城市编码
private String cityAreaCode = "";//城市编码
private LinearLayout otherAreaLinear;
public static final int EVENT_HOME_MSG = 0x232323;
private TextView tvHomeAddress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_institution_home);
initView();
}
private void initView() {
popupWindow = new PopupWindow(this);
Button title_back = (Button) findViewById(R.id.title_back);
title_back.setOnClickListener(this);
insHomeMore = (ImageView) findViewById(R.id.insHomeMore);
insHomeMore.setOnClickListener(this);
LinearLayout insHomeCitySelect = (LinearLayout) findViewById(R.id.insHomeCitySelect);
insHomeCitySelect.setOnClickListener(this);
LinearLayout insHomeTijian = (LinearLayout) findViewById(R.id.insHomeTijian);
insHomeTijian.setOnClickListener(this);
LinearLayout insHomeTuozhan = (LinearLayout) findViewById(R.id.insHomeTuozhan);
insHomeTuozhan.setOnClickListener(this);
LinearLayout insHomeKangfu = (LinearLayout) findViewById(R.id.insHomeKangfu);
insHomeKangfu.setOnClickListener(this);
LinearLayout insHomeXingque = (LinearLayout) findViewById(R.id.insHomeXingque);
insHomeXingque.setOnClickListener(this);
EditText insHomeSearchEdt = (EditText) findViewById(R.id.insHomeSearchEdt);
insHomeSearchEdt.setFocusable(false);
insHomeSearchEdt.setOnClickListener(this);
ImageView insHomeImg= (ImageView) findViewById(R.id.insHomeImg);
Glide.with(this).load(R.drawable.top_image).centerCrop().into(insHomeImg);
tvHomeAddress = (TextView) findViewById(R.id.tvHomeAddress);
TabLayout insHomeTabLayout = (TabLayout) findViewById(R.id.insHomeTabLayout);
ViewPager insHomePager = (ViewPager) findViewById(R.id.insHomePager);
insHomePager.setOffscreenPageLimit(3);
final List<Fragment> fragmentList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
fragmentList.add(InstitutionHomeFragment.newInstance(i, ""));
}
insHomePager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
});
insHomeTabLayout.setupWithViewPager(insHomePager);
insHomeTabLayout.getTabAt(0).setText("热门");
insHomeTabLayout.getTabAt(1).setText("新入");
insHomeTabLayout.getTabAt(2).setText("附近");
//更多地区选择
RecyclerView provinceRecycler = (RecyclerView) findViewById(R.id.provinceRecycler);
provinceAdapter = new FamousDoctorAreaSelectAdapter(this, provinceList, 1);
provinceAdapter.setOnRecyclerClick(this);
provinceRecycler.setLayoutManager(new LinearLayoutManager(this));
provinceRecycler.setAdapter(provinceAdapter);
RecyclerView childCityRecycler = (RecyclerView) findViewById(R.id.childCityRecycler);
cityAdapter = new FamousDoctorAreaSelectAdapter(this, childCityList, 2);
cityAdapter.setOnRecyclerClick(this);
childCityRecycler.setLayoutManager(new LinearLayoutManager(this));
childCityRecycler.setAdapter(cityAdapter);
otherAreaLinear = (LinearLayout) findViewById(R.id.otherAreaLinear);
otherAreaLinear.setOnClickListener(this);
//type 1是省 2是市
loadDataProvince(1);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.title_back:
finish();
break;
case R.id.insHomeSearchEdt:
startActivity(new Intent(this, HomePageActivity.class));
break;
case R.id.insHomeMore:
insMorePopup();
break;
case R.id.insHomeCitySelect:
otherAreaLinear.setVisibility(View.VISIBLE);
break;
case R.id.insHomeTijian:
Intent intent1 = new Intent(this, InstitutionListActivity.class);
intent1.putExtra(InstitutionListActivity.SORT, 0);
intent1.putExtra("addressCode", cityAreaCode);
startActivity(intent1);
break;
case R.id.insHomeTuozhan:
Intent intent2 = new Intent(this, InstitutionListActivity.class);
intent2.putExtra(InstitutionListActivity.SORT, 1);
intent2.putExtra("addressCode", cityAreaCode);
startActivity(intent2);
break;
case R.id.insHomeKangfu:
Intent intent3 = new Intent(this, InstitutionListActivity.class);
intent3.putExtra(InstitutionListActivity.SORT, 2);
intent3.putExtra("addressCode", cityAreaCode);
startActivity(intent3);
break;
case R.id.insHomeXingque:
Intent intent4 = new Intent(this, InstitutionListActivity.class);
intent4.putExtra(InstitutionListActivity.SORT, 3);
intent4.putExtra("addressCode", cityAreaCode);
startActivity(intent4);
break;
case R.id.myIns:
Intent intent = new Intent(this, InstitutionListActivity.class);
intent.putExtra(InstitutionListActivity.SORT, -1);
startActivity(intent);
popupWindow.dismiss();
break;
case R.id.joinIns:
startActivity(new Intent(this, InstitutionJoinActivity.class));
popupWindow.dismiss();
break;
case R.id.parentLayout:
popupWindow.dismiss();
break;
case R.id.otherAreaLinear:
otherAreaLinear.setVisibility(View.GONE);
break;
}
}
private void insMorePopup() {
popupWindow.setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
View inflate = View.inflate(this, R.layout.popupwindow_instituion_home_more, null);
inflate.findViewById(R.id.myIns).setOnClickListener(this);
inflate.findViewById(R.id.joinIns).setOnClickListener(this);
inflate.findViewById(R.id.parentLayout).setOnClickListener(this);
inflate.findViewById(R.id.line).setOnClickListener(this);
popupWindow.setContentView(inflate);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00000000")));
popupWindow.setOutsideTouchable(true);
popupWindow.showAsDropDown(insHomeMore);
}
String address = "";
@Override
public void setOnCliCkListener(View view, int position, int type) {
if (type == 1) {
childCityList.clear();
provinceAreaCode = provinceList.get(position).getAREA_CODE();
// areaCode= provinceList.get(position).getAREA_CODE();
address = provinceList.get(position).getAREA_NAME2();
provinceAreaCode = provinceList.get(position).getAREA_CODE();
loadDataProvince(2);
provinceAdapter.setSelectProvince(position);
provinceAdapter.notifyDataSetChanged();
} else {
SelectChildCityEntity.AreaBean areaBean = childCityList.get(position);
cityAreaCode = areaBean.getAREA_CODE();
otherAreaLinear.setVisibility(View.GONE);
EventBus.getDefault().post(new MyEvent(cityAreaCode, EVENT_HOME_MSG));
tvHomeAddress.setText(address);
}
}
private void loadDataProvince(final int type) {
List<BasicNameValuePair> pairs = new ArrayList<>();
pairs.add(new BasicNameValuePair("op", "findArea"));
if (type == 2) {
pairs.add(new BasicNameValuePair("area_code", provinceAreaCode));
}
HttpRestClient.doGetProvinceSee(pairs, new OkHttpClientManager.ResultCallback<String>() {
@Override
public void onError(Request request, Exception e) {
}
@Override
public void onResponse(String response) {
Gson gson = new Gson();
if (type == 1) {
SelectProvinceEntity selectProvinceEntity = gson.fromJson(response, SelectProvinceEntity.class);
List<SelectProvinceEntity.AreaBean> area = selectProvinceEntity.getArea();
provinceList.addAll(area);
provinceAdapter.notifyDataSetChanged();
} else {
SelectChildCityEntity childCityEntity = gson.fromJson(response, SelectChildCityEntity.class);
List<SelectChildCityEntity.AreaBean> area = childCityEntity.getArea();
childCityList.addAll(area);
// childCityList.add(0, null);
cityAdapter.notifyDataSetChanged();
}
}
}, this);
}
}
| true
|
7adf98627f9be36f7a3acfbb0f9241a8709fd340
|
Java
|
khaledm99/TeamE3DungeonCrawler
|
/src/model/Entity.java
|
UTF-8
| 1,561
| 3.046875
| 3
|
[] |
no_license
|
package model;
/**
* Classname: Entity
*
* Version: 0
*
* Author: William Ho
*
* Description: Creates an entity class to hold various variables. The parent class of Player and Enemy.
*
*/
public class Entity {
private int hp;
private int stamina;
private int xcoord;
private int ycoord;
private String name;
private String type;
private int level;
// private Inventory inventory = new Inventory();
// Getter method for hp
public int getHp() {
return hp;
}
// Getter method for stamina
public int getStamina() {
return stamina;
}
// Setter method for stamina
public void setStamina(int stamina) {
this.stamina = stamina;
}
// Setter method for hp
public void setHp(int hp) {
this.hp = hp;
}
// Getter method for xcoord
public int getXcoord() {
return xcoord;
}
// Setter method for xcoord
public void setXcoord(int xcoord) {
this.xcoord = xcoord;
}
// Getter method for ycoord
public int getYcoord() {
return ycoord;
}
// Setter method for ycoord
public void setYcoord(int ycoord) {
this.ycoord = ycoord;
}
// Getter method for name
public String getName() {
return name;
}
// Setter method for name
public void setName(String name) {
this.name = name;
}
// Getter method for type
public String getType() {
return type;
}
// Setter method for type
public void setType(String type) {
this.type = type;
}
// Getter method for level
public int getLevel() {
return level;
}
// Setter method for level
public void setLevel(int level) {
this.level = level;
}
}
| true
|
e562129076f7dae80d3a698e4a2b85eb49577561
|
Java
|
Akamoto529/java-tasks
|
/src/main/java/ru/mail/polis/homework/io/Directories.java
|
UTF-8
| 2,180
| 3.671875
| 4
|
[] |
no_license
|
package ru.mail.polis.homework.io;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.concurrent.atomic.AtomicInteger;
public class Directories {
/**
* Реализовать рекурсивное удаление всех файлов и дерикторий из директороии по заданному пути.
* Метод должен возвращать количество удаленных файлов и директорий.
* Если директории по существующему пути нет, то возвращаем 0.
* Написать двумя способами. С использованием File
* 2 балла
*/
public static int removeWithFile(String path) {
int count = 0;
File file = new File(path);
if (!file.exists()) {
return count;
}
if (file.isDirectory()) {
for (String str : file.list()) {
count += removeWithFile(path + "/" + str);
}
}
return file.delete() ? count + 1 : count;
}
/**
* С использованием Path
* 2 балла
*/
public static int removeWithPath(String path) throws IOException {
AtomicInteger atomicCount = new AtomicInteger();
Path filePath = Paths.get(path);
if (Files.notExists(filePath)) {
return 0;
}
Files.walkFileTree(filePath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
atomicCount.incrementAndGet();
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
atomicCount.incrementAndGet();
return FileVisitResult.CONTINUE;
}
});
return atomicCount.intValue();
}
}
| true
|
c7e68f6b3a96cab1f34d0ab182befbcb1d1500bf
|
Java
|
eqdushu/android
|
/app/src/main/java/com/tmacbo/eqdushu/ui/settting/SettingView.java
|
UTF-8
| 374
| 1.53125
| 2
|
[] |
no_license
|
package com.tmacbo.eqdushu.ui.settting;
import com.tmacbo.eqdushu.common.base.BaseRequestContract;
/**
* @Author tmacbo
* @Since on 2017/11/27 23:22
* @mail tang_bo@hotmail.com
* @Description TODO
*/
public interface SettingView<T> extends BaseRequestContract<T> {
String getMobile();
String getSmsCode();
String getPrePassWord();
String getNewPassWord();
}
| true
|
916584ea6825e614cab0cea60d807e37c8fc0f79
|
Java
|
lilmo/IntraPoste
|
/IntraPoste/src/tests/bdd/agence/EmptyTest.java
|
UTF-8
| 528
| 2.34375
| 2
|
[] |
no_license
|
package tests.bdd.agence;
import static org.junit.Assert.*;
import java.util.ArrayList;
import metier.Agence;
import org.junit.Before;
import org.junit.Test;
import bdd.AgenceDAO;
public class EmptyTest {
ArrayList<Agence> agences;
@Before
public void setUp() throws Exception {
AgenceDAO.insert("AB", "AGNEAU");
AgenceDAO.insert("CD", "BOEUF");
AgenceDAO.insert("EF", "POULE");
AgenceDAO.empty();
agences = AgenceDAO.selectAll();
}
@Test
public void test() {
assertTrue(agences.isEmpty());
}
}
| true
|
68a8c58c5f8f1dd6097b0b43adc44f1f61849c55
|
Java
|
OpenNTF/org.openntf.domino
|
/domino/core/src/main/java/org/openntf/domino/design/AnyFormOrSubform.java
|
UTF-8
| 2,010
| 2.15625
| 2
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"ICU",
"MIT",
"BSD-2-Clause"
] |
permissive
|
/**
* Copyright © 2013-2021 The OpenNTF Domino API Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openntf.domino.design;
import java.util.List;
import org.openntf.domino.utils.xml.XMLNodeList;
/**
* @author jgallagher
*
*/
public interface AnyFormOrSubform extends DesignBaseNamed {
public FormField addField();
public FormFieldList getFields();
public void swapFields(final int a, final int b);
/**
* @return list of subform nodes identified by subformref XML element
* @since ODA 4.1.0
*/
public XMLNodeList getSubformNodes();
/**
* Gets names of coded subforms included the Form / Subform design. Computed subforms don't have a name attribute.
*
* @return list of name attributes from subform nodes
* @since ODA 4.1.0
*/
public List<String> getExplicitSubforms();
/**
* Iterates recursively through explicit subforms to retrieve all explicit descendant subforms
*
* @param existingSubforms
* list of subforms previously collected for this Form / Subform or ancestors. This ensures the same subform is not added and
* inspected again.
* @return the modified existingSubforms list
* @since ODA 4.1.0
*/
public List<String> getExplicitSubformsRecursive(List<String> existingSubforms);
/**
* Gets names of formula for any computed subforms included the Form / Subform design
*
* @return list of formulas from subform nodes
* @since ODA 4.1.0
*/
public List<String> getComputedSubforms();
}
| true
|
cc02f8b3c48c44793c78ee7ca4899c7c4f69a803
|
Java
|
zoo123520/tmall_ssm
|
/src/main/java/com/entor/dao/impl/PropertyDaoImpl.java
|
UTF-8
| 480
| 1.96875
| 2
|
[] |
no_license
|
package com.entor.dao.impl;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.entor.dao.PropertyDao;
import com.entor.entity.Property;
@Repository("propertyDao")
public class PropertyDaoImpl extends BaseDaoImpl<Property> implements PropertyDao{
private final String namespace = "Property";
@Override
public List<Property> queryByCid(int id) {
return getSqlSession().selectList(namespace+".queryByCid", id);
}
}
| true
|
28a070e2724a7e99a7f244eb9c6bbc6b674e4918
|
Java
|
diazamaliana/rplrakbuku
|
/Sourcecode/app/src/main/java/com/example/rakbuku/rakbuku/Lend.java
|
UTF-8
| 10,791
| 1.773438
| 2
|
[] |
no_license
|
package com.example.rakbuku.rakbuku;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.OnProgressListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.util.HashMap;
import java.util.Map;
public class Lend extends AppCompatActivity {
//UI
private EditText midJudulLend, midPenulisLend, midPenerbitLend, midTipeLend, midKotaLender, midEmailLender, midHargaLend;
private Button midLendBtn;
private ImageButton midUploadBuku;
//Auth
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
//Cloud Firestore
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private static final String TAG = "FiturLend";
private static final String KEY_JUDUL = "Judul";
private static final String KEY_EMAIL = "Email";
private static final String KEY_PENULIS = "Penulis";
private static final String KEY_PENERBIT = "Penerbit";
private static final String KEY_KOTALENDER = "KotaLender";
private static final String KEY_TIPE = "Tipe";
private static final String KEY_HARGA = "Harga";
private static final String KEY_URLBOOK = "UrlBook";
//Storage
FirebaseStorage storage;
StorageReference storageRef, imageRef;
private static final int Selected = 100;
ProgressDialog progressDialog;
UploadTask uploadTask;
Uri uriBook;
//TextView YourUriImage;
TextView YourUriBook;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lend);
midJudulLend = (EditText) findViewById(R.id.idJudulLend);
midPenulisLend = (EditText) findViewById(R.id.idPenulisLend);
midPenerbitLend = (EditText) findViewById(R.id.idPenerbitLend);
midEmailLender = (EditText) findViewById(R.id.idEmailLender);
midTipeLend = (EditText) findViewById(R.id.idTipeLend);
midHargaLend = (EditText) findViewById(R.id.idHargaLend);
midKotaLender =(EditText) findViewById(R.id.KotaLender);
midLendBtn = (Button) findViewById(R.id.LendBtn);
midUploadBuku = (ImageButton) findViewById(R.id.UploadBook);
YourUriBook = (TextView) findViewById(R.id.TextUrlBook);
storage = FirebaseStorage.getInstance();
storageRef = storage.getReference();
midUploadBuku.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ChooseImage();
}
});
}
public void ChooseImage(){
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, Selected);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent){
super.onActivityResult(requestCode, resultCode,imageReturnedIntent);
switch (requestCode){
case Selected:
if (resultCode == RESULT_OK){
uriBook = imageReturnedIntent.getData();
UploadFoto();
}
}
}
public void UploadFoto() {
imageRef = storageRef.child("books").child(uriBook.getLastPathSegment());
progressDialog = new ProgressDialog(this);
progressDialog.setMax(100);
progressDialog.setMessage("Mengunggah...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.show();
progressDialog.setCancelable(false);
uploadTask = imageRef.putFile(uriBook);
uploadTask.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
progressDialog.incrementProgressBy((int) progress);
}
});
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception exception) {
Toast.makeText(getApplicationContext(),"Failed!",Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Uri downloadUrl = taskSnapshot.getDownloadUrl();
String urlbook = downloadUrl.toString();
progressDialog.dismiss();
YourUriBook.setText(urlbook);
}
});
}
public void lend(View v) {
String Judul = midJudulLend.getText().toString();
String Penulis = midPenulisLend.getText().toString();
String Penerbit = midPenerbitLend.getText().toString();
String Tipe = midTipeLend.getText().toString();
String KotaLender = midKotaLender.getText().toString();
String Email = midEmailLender.getText().toString();
String Harga = midHargaLend.getText().toString();
String UrlBook = YourUriBook.getText().toString();
mAuth = FirebaseAuth.getInstance();
if (TextUtils.isEmpty(Judul))
{
Toast.makeText(getApplicationContext(), "Data belum terisi dengan lengkap", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(Penulis))
{
Toast.makeText(getApplicationContext(), "Data belum terisi dengan lengkap", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(Penerbit))
{
Toast.makeText(getApplicationContext(), "Data belum terisi dengan lengkap", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(Tipe))
{
Toast.makeText(getApplicationContext(), "Data belum terisi dengan lengkap", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(KotaLender))
{
Toast.makeText(getApplicationContext(), "Masukkan Password", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(Email))
{
Toast.makeText(getApplicationContext(), "Masukkan Password", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(Harga))
{
Toast.makeText(getApplicationContext(), "Masukkan Password", Toast.LENGTH_SHORT).show();
return;
}
else if (TextUtils.isEmpty(UrlBook))
{
Toast.makeText(getApplicationContext(), "Masukkan Password", Toast.LENGTH_SHORT).show();
return;
}
else {
//mauth.createUserWithEmailAndPassword(Email, Pass).addOnCompleteListener(SignUp.this, new OnCompleteListener<AuthResult>() {
// @Override
//public void onComplete(@NonNull Task<AuthResult> task) {
// Toast.makeText(SignUp.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
//if (task.isSuccessful()) {
//Simpan User di Database
Map<String, Object> rakbukulend = new HashMap<>();
rakbukulend.put(KEY_JUDUL, Judul);
rakbukulend.put(KEY_EMAIL, Email);
rakbukulend.put(KEY_PENULIS, Penulis);
rakbukulend.put(KEY_PENERBIT, Penerbit);
rakbukulend.put(KEY_KOTALENDER, KotaLender);
rakbukulend.put(KEY_TIPE, Tipe);
rakbukulend.put(KEY_HARGA, Harga);
rakbukulend.put(KEY_URLBOOK, UrlBook);
db.collection("Book").document().set(rakbukulend)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(Lend.this, "Buku berhasil ditambahkan!", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(Lend.this, "Coba Lagi!", Toast.LENGTH_SHORT).show();
Log.d(TAG, e.toString());
}
});
//Masuk ke Account
Intent SignUpintent = new Intent(Lend.this, Account.class);
startActivity(SignUpintent);
finish();
}
}
}
| true
|
2c5e8754ca522269d606ed0e8285e313762a916f
|
Java
|
three1bro/imitationmall
|
/mall-admin/src/main/java/cn/threo/imitationmall/controller/UmsPermissionController.java
|
UTF-8
| 2,079
| 2.078125
| 2
|
[] |
no_license
|
package cn.threo.imitationmall.controller;
import cn.threo.imitationmall.common.CommonResult;
import cn.threo.imitationmall.dto.UmsPermissionNode;
import cn.threo.imitationmall.model.UmsPermission;
import cn.threo.imitationmall.service.UmsPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author threo
* 后台用户权限管理
*/
@RestController
@Api(tags = "UmsPermissionController")
@RequestMapping("/permission")
public class UmsPermissionController {
@Autowired
private UmsPermissionService permissionService;
@ApiOperation("添加权限")
@PostMapping("/create")
public CommonResult create(@RequestBody UmsPermission permission) {
int count = permissionService.create(permission);
return count > 0 ?
CommonResult.success(count) :
CommonResult.failed();
}
@ApiOperation("修改权限")
@PostMapping("/update/{id}")
public CommonResult update(@PathVariable Long id, @RequestBody UmsPermission permission) {
int count = permissionService.update(id, permission);
return count > 0 ?
CommonResult.success(count) :
CommonResult.failed();
}
@ApiOperation("删除权限")
@PostMapping("/delete")
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = permissionService.delete(ids);
return count > 0 ?
CommonResult.success(count) :
CommonResult.failed();
}
@ApiOperation("获取所有权限列表")
@GetMapping("/list")
public CommonResult<List<UmsPermission>> list() {
return CommonResult.success(permissionService.list());
}
@ApiOperation("获取层级权限列表")
@GetMapping("/tList")
public CommonResult<List<UmsPermissionNode>> tList() {
return CommonResult.success(permissionService.tList());
}
}
| true
|
efe7723118112f1f0afc7aa02089aea0fed72d3d
|
Java
|
tigerliuwu/j2eeproject
|
/projectmanager/src/edu/pm/uc/risk/bo/RiskCreateBO.java
|
UTF-8
| 478
| 2.046875
| 2
|
[] |
no_license
|
package edu.pm.uc.risk.bo;
import edu.pm.base.PMBaseBusinessObject;
import edu.pm.base.PMBaseDAO;
import edu.pm.vo.Risks;
public class RiskCreateBO extends PMBaseBusinessObject {
private Risks vo;
Long id;
private PMBaseDAO dao = new PMBaseDAO(Risks.class);
public Long getId() {
return id;
}
public RiskCreateBO(Risks vo) {
this.vo = vo;
}
protected void performBusinessLogic() {
id = (Long) dao.save(vo);
}
}
| true
|
ba8ba8ebffaba3e508bd965c9a583608b6edbe25
|
Java
|
jsteenbeeke/wicket-i18n-plugin
|
/src/test/java/nl/topicus/onderwijs/wicket/i18n/plugin/util/WicketKeyExtractorTest.java
|
UTF-8
| 474
| 2.109375
| 2
|
[] |
no_license
|
package nl.topicus.onderwijs.wicket.i18n.plugin.util;
import static org.junit.Assert.*;
import java.io.File;
import java.util.Set;
import org.junit.Test;
public class WicketKeyExtractorTest
{
@Test
public void testExtractor()
{
Set<String> extractedKeys =
WicketKeyExtractor.extractKeys(new File(
"src/test/resources/WicketKeyExtractorTest.html"));
assertEquals(1, extractedKeys.size());
assertTrue(extractedKeys.contains("wicket.key.extractor"));
}
}
| true
|
10700a7f2fbe8f69ccf946aedf06b2f237822ee4
|
Java
|
himanshut0305/abctrap
|
/app/src/main/java/com/qedplus/particles/services/ContentUpdateService.java
|
UTF-8
| 2,204
| 2.328125
| 2
|
[] |
no_license
|
package com.qedplus.particles.services;
import android.content.Context;
import android.util.Log;
import com.qedplus.particles.db.Book;
import com.qedplus.particles.db.Chapter;
import com.qedplus.particles.db.SchoolClass;
import com.qedplus.particles.db.Subject;
import com.qedplus.particles.db.Topic;
import com.qedplus.particles.extras.AppDatabase;
import com.qedplus.particles.extras.PrefManager;
import com.qedplus.particles.extras.Utility;
import java.util.List;
public class ContentUpdateService {
private boolean foundToUpdate = false;
private int topicUpdated = 0;
public interface UITask{
void afterTask(boolean foundToUpdate, int topicsUpdated);
}
private ContentUpdateService.UITask uiTask;
public ContentUpdateService() { }
public void updateContentForChapter(final Context context, final String subjectName, final String chapterName, ContentUpdateService.UITask task) {
this.uiTask = task;
PrefManager prefManager = new PrefManager(context);
final int schoolYear = prefManager.getSchoolYear();
final String schoolCode = prefManager.getSchoolDetails().getSchoolCode();
DBService dbService = new DBService(new DBService.BackgroundDBTask() {
@Override
public void task() {
AppDatabase db = AppDatabase.getAppDatabase(context);
Subject subject = db.subjectDao().findByName(subjectName);
Book book = db.bookDao().findBySubjectAndSchoolYear(subject.getSubjectId(), schoolYear);
Chapter chapter = db.chapterDao().getByNameAndSubject(chapterName, subject.getSubjectId());
List<Topic> topics = db.topicDao().findAllByChapter(chapter.getChapterId());
for (Topic topic : topics) {
foundToUpdate = Utility.getSlidesForTopicIfUpdated(context, book.getName(), chapterName, topic);
if(foundToUpdate)
topicUpdated++;
}
}
@Override
public void afterTask() {
uiTask.afterTask(foundToUpdate, topicUpdated);
}
});
dbService.execute();
}
}
| true
|
4b183b948625978b74572b15c8c1aaae2a27be83
|
Java
|
smillo/numeri-primi
|
/src/Compute.java
|
UTF-8
| 183
| 1.867188
| 2
|
[] |
no_license
|
import java.math.BigInteger;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Compute extends Remote {
long executeTask(Task t) throws RemoteException;
}
| true
|
114dc9b25ab0e8941c58cab20e52c65ebfe0755c
|
Java
|
mbolaitu/gpp
|
/src/main/Main.java
|
UTF-8
| 1,882
| 2.359375
| 2
|
[] |
no_license
|
package main;
import affichage.FenetrageDemandeConge;
import affichage.FenetrageEmployer;
import affichage.FenetrageListeEmploye;
import db.Oracle;
import java.util.logging.Level;
import java.util.logging.Logger;
import utilitaire.UtilDate;
public class Main {
public static void main(String[] args) {
try {
//new FenetrageEmployer().setVisible(true);
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
/*java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);*/
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
//new FenetrageEmployer().setVisible(true);
//new FenetrageListeEmploye().setVisible(true);
//new FenetrageDemandeConge().setVisible(true);
System.out.println(UtilDate.getDatezao());
System.out.println(UtilDate.getHeurezao());
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
}
| true
|
18854f0fb80950b6bb86918c8dd378c261b23fe0
|
Java
|
Atroshonok/RCShopModular
|
/Services/src/main/java/com/atroshonok/services/impl/ProductServiceImpl.java
|
UTF-8
| 6,679
| 2.34375
| 2
|
[] |
no_license
|
/**
*
*/
package com.atroshonok.services.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.atroshonok.dao.IProductDao;
import com.atroshonok.dao.entities.Product;
import com.atroshonok.dao.entities.vo.ClientFilter;
import com.atroshonok.dao.exceptions.DaoException;
import com.atroshonok.services.IProductService;
import com.atroshonok.services.exceptions.ErrorAddingPoductServiceException;
import com.atroshonok.services.exceptions.ErrorUpdatingPoductServiceException;
import com.atroshonok.services.exceptions.ServiceException;
/**
* @author Atroshonok Ivan
*
*/
@Service
@Transactional
public class ProductServiceImpl implements IProductService {
private static final String ERR_MSG_FILTER_INVALID = "The given client filter contains an invalid data!";
private static final String ERR_MSG_DEL_PRODUCT = "Error deleting a product!";
private static final String ERR_MSG_SAVE_PRODUCT = "Error saving a product!";
private static final String ERR_MSG_UPDATE_PRODUCT = "Error updating a product!";
private static Logger log = Logger.getLogger(ProductServiceImpl.class);
@Autowired
private IProductDao productDao;
@Autowired
private MessageSource messageSource;
@Override
public List<Product> getProductsByCategoryId(Serializable categoryId) {
log.info("Starting method getProductsByCategoryId(long categoryId)");
List<Product> products = new ArrayList<>();
;
try {
products = productDao.getProductsByCategoryId(categoryId);
} catch (DataAccessException e) {
log.error("Error getting products by category = " + categoryId);
}
log.info("Ending method getProductsByCategoryId(long categoryId)");
return products;
}
@Override
public List<Product> getAllProducts() {
log.info("Starting method getAllProducts()");
List<Product> products = productDao.getAllProducts();
log.info("Ending method getAllProducts()");
return products;
}
@Override
public Product getProductById(Serializable productId) {
log.info("Starting method getProductById(Serializable productId)");
Product product = null;
try {
product = productDao.get(productId);
log.info("Got product: " + product);
} catch (DaoException e) {
log.error("Error getting product by id = " + productId);
}
log.info("Ending method getProductById(Serializable productId)");
return product;
}
@Override
public void updateProduct(Product product) throws ErrorUpdatingPoductServiceException {
log.info("Starting method updateProductInDatabase(Product product)");
try {
productDao.saveOrUpdate(product);
log.info("Updated product: " + product);
} catch (DaoException e) {
log.error("Error updating the product: " + product, e);
throw new ErrorUpdatingPoductServiceException(messageSource.getMessage("error.update.product", null, ERR_MSG_UPDATE_PRODUCT, Locale.getDefault()), e);
}
log.info("Ending method updateProductInDatabase(Product product)");
}
@Override
// ToDatabase is extra. please rename the method
public Serializable addNewProductToDatabase(Product product) throws ErrorAddingPoductServiceException {
log.info("Starting method addNewProductToDatabase(Product product)");
Serializable id = null; //Warning:(93, 20) Variable 'id' initializer 'null' is redundant - thanks to mu Intellij IDEA
try {
id = productDao.save(product);
log.info("Saved product to DB: " + product);
} catch (DaoException e) {
log.error("Error saving the product: " + product, e);
throw new ErrorAddingPoductServiceException(messageSource.getMessage("error.save.product", null, ERR_MSG_SAVE_PRODUCT, Locale.getDefault()), e);
}
log.info("Ending method addNewProductToDatabase(Product product)");
return id;
}
@Override
public List<Product> getProductsByClientFilter(ClientFilter clientFilter) throws ServiceException {
boolean isValidFilter = validateClientFilterFields(clientFilter);
List<Product> results = new ArrayList<>();
try {
if (isValidFilter) {
results = productDao.getProductsByClientFilter(clientFilter);
} else {
throw new ServiceException(messageSource.getMessage("client.filter.wrong", null, ERR_MSG_FILTER_INVALID, Locale.getDefault()));
}
} catch (DataAccessException e) {
log.error("Error gettting products by client filter. ", e);
}
return results;
}
private boolean validateClientFilterFields(ClientFilter clientFilter) {
if (clientFilter == null) {
return false;
}
List<Long> categories = clientFilter.getFilterCategoriesId();
Double priceFrom = clientFilter.getFilterPriceFrom();
Double priceTo = clientFilter.getFilterPriceTo();
if (categories == null) {
return false;
} else if (categories.isEmpty()) {
return false;
}
if (clientFilter.getCurrentPage() <= 0) {
return false;
}
if (priceFrom < 0) {
return false;
}
if ((priceTo < 0) || (priceTo < priceFrom)) {
return false;
}
if (clientFilter.getItemsPerPage() <= 0) {
return false;
}
if (clientFilter.getSorting() < 0) {
return false;
}
return true;
}
@Override
@Transactional(readOnly = true)
public long getTotalProductsCount() {
long totalCount = productDao.getTotalProductsCount();
return totalCount;
}
// for pagination
@Override
@Transactional(readOnly = true)
public long getProductsCountAccordingClientFilter(ClientFilter clientFilter) throws ServiceException {
boolean isValidFilter = validateClientFilterFields(clientFilter);
long result = 0;
if (isValidFilter) {
result = productDao.getProductsCountAccordingClientFilter(clientFilter);
} else {
throw new ServiceException(messageSource.getMessage("client.filter.wrong", null, ERR_MSG_FILTER_INVALID, Locale.getDefault()));
}
return result;
}
@Override
public void deleteProduct(Product product) throws ServiceException {
try {
productDao.delete(product);
} catch (DaoException e) {
log.error("Error deleting product. ");
throw new ServiceException(messageSource.getMessage("error.delete.product", null, ERR_MSG_DEL_PRODUCT, Locale.getDefault()), e);
}
}
}
| true
|
9250b7b8c1715f6e29c1077a1d935ccb4f60333f
|
Java
|
abozanona/hsoubIO
|
/app/src/main/java/com/rond/hsoub/Main2Activity.java
|
UTF-8
| 15,370
| 1.601563
| 2
|
[] |
no_license
|
package com.rond.hsoub;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.util.Pair;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.rond.hsoub.API.CustomAPI;
import com.rond.hsoub.API.CustomAPIEnum;
import com.rond.hsoub.API.DownloadImageTask;
import com.rond.hsoub.API.JsonLinks;
import com.rond.hsoub.Classes.DBHelper;
import com.rond.hsoub.Classes.GeneralInstances;
import com.rond.hsoub.Classes.Serialization;
import com.rond.hsoub.Models.community;
import java.util.ArrayList;
import de.hdodenhof.circleimageview.CircleImageView;
public class Main2Activity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
public static Main2Activity instance;
@SafeVarargs
public final void setFragment(android.support.v4.app.Fragment newFragment, Pair<String, String>... Parms){
Bundle bundle = new Bundle();
for (Pair<String, String> Parm : Parms) bundle.putString(Parm.first, Parm.second);
newFragment.setArguments(bundle);
android.support.v4.app.FragmentTransaction fragmentTransaction =
getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, newFragment).addToBackStack("TAG_FRAGMENT");
fragmentTransaction.commit();
}
public void showPopup(View anchorView) {
//// TODO: 12/24/2016 Check with large lines of text
View popupView = getLayoutInflater().inflate(R.layout.fragment_add_new_post, null);
PopupWindow popupWindow = new PopupWindow(popupView, Toolbar.LayoutParams.MATCH_PARENT, Toolbar.LayoutParams.WRAP_CONTENT, true);
final TextView btnAddLink = (TextView) popupView.findViewById(R.id.btnAddLink);
final TextView btnAddComment = (TextView) popupView.findViewById(R.id.btnAddComment);
final EditText txtCommunity = (EditText) popupView.findViewById(R.id.txtCommunity);
final EditText txtDirectLink = (EditText) popupView.findViewById(R.id.txtDirectLink);
final EditText txtFillTitle = (EditText) popupView.findViewById(R.id.txtFillTitle);
final EditText txtDescription = (EditText) popupView.findViewById(R.id.txtDescription);
final CheckBox ckbxOpenTerms = (CheckBox) popupView.findViewById(R.id.ckbxOpenTerms);
final Button btnSendTopic = (Button) popupView.findViewById(R.id.btnSendTopic);
txtFillTitle.setFocusableInTouchMode(true);
txtFillTitle.requestFocus();
if(txtFillTitle.requestFocus()) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
btnAddLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btnAddLink.setBackgroundColor(Color.parseColor("#FFAA00"));
btnAddComment.setBackgroundColor(Color.parseColor("#FFFFFF"));
txtDirectLink.setVisibility(View.VISIBLE);
txtDescription.setVisibility(View.GONE);
}
});
btnAddComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btnAddLink.setBackgroundColor(Color.parseColor("#FFFFFF"));
btnAddComment.setBackgroundColor(Color.parseColor("#FFAA00"));
txtDirectLink.setVisibility(View.GONE);
txtDescription.setVisibility(View.VISIBLE);
}
});
//tv.setText(....);
// If the PopupWindow should be focusable
popupWindow.setFocusable(true);
// If you need the PopupWindow to dismiss when when touched outside
popupWindow.setBackgroundDrawable(new ColorDrawable(0x99CCCCCC));
int location[] = new int[2];
// Get the View's(the one that was clicked in the Fragment) location
anchorView.getLocationOnScreen(location);
// Using location, the PopupWindow will be displayed right under anchorView
popupWindow.showAtLocation(anchorView, Gravity.CENTER, location[0], location[1] + anchorView.getHeight());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences sharedPref = getSharedPreferences("hsoub", Context.MODE_PRIVATE);
boolean isLoggedIn = sharedPref.getBoolean("login", false);
instance = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
//Set the fragment initially
android.support.v4.app.FragmentTransaction fragmentTransaction =
getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, new MainFragment()).addToBackStack("TAG_FRAGMENT");
fragmentTransaction.commit();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close){
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
drawerView.bringToFront();
drawerView.requestLayout();
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
}
};
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
//navViewMenu
final Menu menu = navigationView.getMenu();
final SubMenu subMenu = menu.addSubMenu(getResources().getString(R.string.communities));
new CustomAPI(CustomAPIEnum.getLatestCommunities){
@Override
public void getLatestCommunitiesListener(ArrayList<community> Communities) {
// TODO: 12/30/2016 :/
if(Communities==null){
Communities=(ArrayList<community>) Serialization.deserializeObject(new DBHelper(getApplicationContext()).getDictionary("communityDrawer"));
}
if(Communities!=null) {
new DBHelper(getApplicationContext()).setDictionary("communityDrawer",Serialization.serializeObject(Communities));
for (int i = 0; i < Communities.size(); i++) {
MenuItem item = subMenu.add(Communities.get(i).getName());
final int finalI = i;
final ArrayList<community> finalCommunities = Communities;
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
setFragment(new PostsListFragment(), new Pair<>("link", JsonLinks.get_more_posts(finalCommunities.get(finalI).getID())));
return false;
}
});
item.setIcon(R.drawable.ic_search);
}
}
MenuItem itemSeeMoreCommunities = subMenu.add(getResources().getString(R.string.see_more_communities));
itemSeeMoreCommunities.setIcon(R.drawable.ic_search);
itemSeeMoreCommunities.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
setFragment(new communitiesFragment());
return false;
}
});
}
}.execute("{\"s\":\"\",\"search_community_slug\":\"\",\"community_ids\":[]}");
View headerView = navigationView.getHeaderView(0);
TextView lblUserName = (TextView) headerView.findViewById(R.id.username);
TextView lblEmail = (TextView) headerView.findViewById(R.id.email);
CircleImageView imgProfileImage = (CircleImageView)headerView.findViewById(R.id.profile_image);
View.OnClickListener openProfile = new View.OnClickListener() {
@Override
public void onClick(View v) {
setFragment(new profileFragment(),new Pair<>("userName",GeneralInstances.user.getUserLink()));
}
};
if(isLoggedIn) {
lblUserName.setOnClickListener(openProfile);
lblEmail.setOnClickListener(openProfile);
imgProfileImage.setOnClickListener(openProfile);
}
FloatingActionButton fabSettings = (FloatingActionButton) headerView.findViewById(R.id.fabSettings);
fabSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setFragment(new settingsFragment());
}
});
final FloatingActionButton fabAddNewTopic = (FloatingActionButton) findViewById(R.id.fabAddNewTopic);
fabAddNewTopic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
showPopup(fabAddNewTopic);
}
});
if(!isLoggedIn){
//fabAddNewTopic.setVisibility(View.GONE);
fabSettings.setVisibility(View.GONE);
lblUserName.setText(getResources().getString(R.string.hello_user));
lblEmail.setText(getResources().getString(R.string.hello_email));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
imgProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.profile, getApplicationContext().getTheme()));
} else {
imgProfileImage.setImageDrawable(getResources().getDrawable(R.drawable.profile));
}
menu.findItem(R.id.nav_my_profile).setVisible(false);
menu.findItem(R.id.nav_notifications).setVisible(false);
menu.findItem(R.id.nav_messages).setVisible(false);
menu.findItem(R.id.nav_settings).setVisible(false);
//// TODO: 12/24/2016 hide notification & messages buttons in top options menu
} else {
fabAddNewTopic.setVisibility(View.VISIBLE);
fabSettings.setVisibility(View.VISIBLE);
lblUserName.setText(getResources().getString(R.string.hello_user_known).replace("X",GeneralInstances.user.getFirst_name()));
lblEmail.setText(GeneralInstances.user.getEmail());
new DownloadImageTask(imgProfileImage)
.execute(GeneralInstances.user.getAvatar());
menu.findItem(R.id.nav_my_profile).setVisible(true);
menu.findItem(R.id.nav_notifications).setVisible(true);
menu.findItem(R.id.nav_messages).setVisible(true);
menu.findItem(R.id.nav_settings).setVisible(true);
}
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else if (getFragmentManager().getBackStackEntryCount() > 1) {
getFragmentManager().popBackStack();
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
// Retrieve the SearchView and plug it into SearchManager
final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
query = query.replaceAll(" ", "+");
setFragment(new PostsListFragment(), new Pair<>("link", JsonLinks.searchLink(query)), new Pair<>("searchPrefix", "{\"s\":\"" + query + "\",\"search_community_slug\":\"\",\"filter\":\"popular\",\"in\":\"posts\",\"post_ids\":["));
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_message) {
setFragment(new messagesFragment());
} else if(id == R.id.action_notification){
setFragment(new notificationsFragment());
}
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_my_profile) {
setFragment(new profileFragment(),new Pair<>("userName",GeneralInstances.user.getUserLink()));
} else if (id == R.id.nav_notifications) {
setFragment(new notificationsFragment());
} else if (id == R.id.nav_messages) {
setFragment(new messagesFragment());
} else if (id == R.id.nav_settings) {
setFragment(new settingsFragment());
} else if (id == R.id.nav_posts_list) {
setFragment(new MainFragment());
} else if (id == R.id.nav_about_website) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(JsonLinks.web_about_hsoub));
startActivity(intent);
} else if (id == R.id.nav_about_app) {
setFragment(new webBrowserFragment());
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| true
|
beac54dcbb1abb4ed42c8d654c46c9e00d98c814
|
Java
|
wpitt3/nikoli-puzzles
|
/src/main/java/dulcinea/nikoli/builder/Grid.java
|
UTF-8
| 2,283
| 3.09375
| 3
|
[] |
no_license
|
package dulcinea.nikoli.builder;
import java.util.ArrayList;
import java.util.List;
import java.util.function.IntFunction;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Grid {
private Integer width;
private Integer height;
private List<Region> regions;
private List<List<Cell>> cells;
protected Grid(Integer width, Integer height, List<List<Cell>> cells) {
this.width = width;
this.height = height;
this.cells = cells;
this.regions = new ArrayList<>();
}
public Integer getWidth() {
return width;
}
public Integer getHeight() {
return height;
}
public List<Region> getRegions() {
return regions;
}
public void setRegions(List<Region> regions) {
this.regions = regions;
}
public List<List<Cell>> getCells() {
return cells;
}
public List<Cell> getFlatCells() {
return cells.stream().flatMap(List::stream).collect(Collectors.toList());
}
public void setCell(Integer x, Integer y, Cell cell) {
cells.get(x).set(y, cell);
}
public void setCell(Integer x, Integer y, Integer value) {
cells.get(x).get(y).setValue(value);
}
public Cell getCell(Integer x, Integer y) {
return cells.get(x).get(y);
}
boolean isComplete() {
return cells.stream().flatMap(List::stream).allMatch(cell -> cell == null || cell.getValue()!= null);
}
String printCells() {
return "#" + runXFTimes(height, "#\n#", (y -> runXFTimes(width, "", ( x ->
this.getCell(x, y) != null && this.getCell(x, y).getValue() != null ? this.getCell(x, y).getValue().toString() : " "
)))) + "#";
}
String printPossibles() {
return "#" + runXFTimes(height, "#\n#\n#", (y -> runXFTimes(3, "#\n#", (yPos -> runXFTimes(width, " ", ( x -> runXFTimes(3, "", (xPos -> {
Integer value = 1 + yPos*3+xPos;
return this.getCell(x, y).getPossibles().contains(value) ? value.toString() : " ";
})))))))) + "#";
}
private static String runXFTimes(int x, String joiner, IntFunction<String> f) {
return IntStream.range(0, x).mapToObj( f ).collect(Collectors.joining(joiner));
}
}
| true
|
c68662cafb06253d388d4c12e76eeb7e251fe171
|
Java
|
fredplusplus/staysharp
|
/src/GasStation.java
|
UTF-8
| 725
| 3.125
| 3
|
[
"MIT"
] |
permissive
|
public class GasStation {
/**
* http://oj.leetcode.com/problems/gas-station/
*/
public int canCompleteCircuit(int[] gas, int[] cost) {
int[] netCost = new int[2 * gas.length];
for (int i = 0; i < gas.length; i++) {
netCost[i] = gas[i] - cost[i];
}
for (int i = gas.length; i < 2 * gas.length; i++) {
netCost[i] = netCost[i - gas.length];
}
int startPoint = 0;
int count = 0;
int tank = 0;
for (int i = 0; i < netCost.length; i++) {
tank += netCost[i];
if (tank < 0) {
count = 0;
tank = 0;
startPoint = i + 1;
} else {
count++;
if (count == gas.length) {
break;
}
}
}
if (count == gas.length) {
return startPoint;
} else {
return -1;
}
}
}
| true
|
b79550773d4dabd589e57a01cb40731d494b6f8d
|
Java
|
dlev-/SportsScheduler
|
/src/base/CrossoverPreference.java
|
UTF-8
| 107
| 1.664063
| 2
|
[] |
no_license
|
package base;
public enum CrossoverPreference {
NO_CROSSOVERS,
UP,
DOWN,
UP_OR_DOWN,
ANY_DIVISION,
}
| true
|
1e2af3e502ffc96c1af8a73ac53476bb4f5f36c3
|
Java
|
vijaykumbam/capg_lab5
|
/Lab5Workspace/src/com/capg/vijay/lab5/exec2/FibonaciClass.java
|
UTF-8
| 279
| 3.109375
| 3
|
[] |
no_license
|
package com.capg.vijay.lab5.exec2;
public class FibonaciClass {
static void getFibo(int number)
{
int a=1; int b=1; int fibo=0;
for(int loop =1;loop<number;loop++)
{
fibo = a+b;
a=b;
b=fibo;
}
System.out.println("The fibo of "+number+" is: " +fibo);
}
}
| true
|
98d072e0ca57ae4b94ddb46dc1b07a2fc8059581
|
Java
|
mo3athBaioud/bluestome
|
/ssi-common-model/src/com/ssi/dal/usgs/domain/EarthQuakeInfo.java
|
UTF-8
| 2,164
| 2.03125
| 2
|
[] |
no_license
|
package com.ssi.dal.usgs.domain;
import java.io.Serializable;
import java.util.Date;
public class EarthQuakeInfo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
// 序列号
private Integer id;
// 发布时间
private String date = "";
// 纬度
private String latitude = "";
// 经度
private String longitude = "";
// 震源深度
private Float depth = 0f;
// 震级
private Float magnitude = 0f;
// 备注
private String comments = "";
// 连接的URL
private String url = "";
private Date createtime = new Date();
private Date modifytime;
//地震详情
private EarthQuakeDetail detail;
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public Float getDepth() {
return depth;
}
public void setDepth(Float depth) {
this.depth = depth;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public Float getMagnitude() {
return magnitude;
}
public void setMagnitude(Float magnitude) {
this.magnitude = magnitude;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getModifytime() {
return modifytime;
}
public void setModifytime(Date modifytime) {
this.modifytime = modifytime;
}
public EarthQuakeDetail getDetail() {
return detail;
}
public void setDetail(EarthQuakeDetail detail) {
this.detail = detail;
}
}
| true
|
50bfa6702747c99e38ff8c0a1e81cb5a7690366a
|
Java
|
Exiaoxinghaha/naga
|
/naga-server/src/main/java/hipeer/naga/server/controller/MonitorController.java
|
UTF-8
| 2,647
| 2.046875
| 2
|
[] |
no_license
|
package hipeer.naga.server.controller;
import hipeer.naga.entity.cluster.HdfsEntity;
import hipeer.naga.entity.cluster.YarnEntity;
import hipeer.naga.exception.SystemConstants;
import hipeer.naga.server.BaseController;
import hipeer.naga.server.service.MonitorService;
import hipeer.naga.utils.DateUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/naga/v1/monitor")
public class MonitorController extends BaseController {
@Autowired
MonitorService monitorService;
@GetMapping(value = "hdfs_metric")
public Object getLastestHdfsSummary(){
return getSucessResult(SystemConstants.SYSTEM_SUCESS, monitorService.findHdfsSummary(DateUtils.getNowDate()));
}
@GetMapping(value = "yarn_metric")
public Object getLastestYarnSummary(){
return getSucessResult(SystemConstants.SYSTEM_SUCESS, monitorService.findYarnSummary(DateUtils.getNowDate()));
}
@GetMapping(value = "hdfs_metric/chart")
public Object getHdfsSummaryList(){
String startTime = DateUtils.format(TimeZone.getDefault().getRawOffset());
String endTime = DateUtils.getNowDate();
List<String> columns = Arrays.stream(FieldUtils.getAllFields(HdfsEntity.class))
.map(Field::getName).collect(Collectors.toList());
List<HdfsEntity> hdfsEntities = monitorService.findHdfsSummaryBetween(startTime, endTime);
Map<String, Object> result = new HashMap<>();
result.put("columns", columns);
result.put("rows", hdfsEntities);
return getSucessResult(SystemConstants.SYSTEM_SUCESS, result);
}
@GetMapping(value = "yarn_metric/chart")
public Object getYarnSummaryList(){
String startTime = DateUtils.format(TimeZone.getDefault().getRawOffset());
String endTime = DateUtils.getNowDate();
List<String> columns = Arrays.stream(FieldUtils.getAllFields(YarnEntity.class))
.map(Field::getName).collect(Collectors.toList());
List<YarnEntity> yarnEntities = monitorService.findYarnSummaryBetween(startTime, endTime);
Map<String, Object> result = new HashMap<>();
result.put("columns", columns);
result.put("rows", yarnEntities);
return getSucessResult(SystemConstants.SYSTEM_SUCESS, result);
}
}
| true
|
fd0cff42d6a28b107e5e259d9082f7e34a60121d
|
Java
|
KobeGong/TasksApp
|
/app/src/main/java/defpackage/dhj.java
|
UTF-8
| 2,028
| 1.9375
| 2
|
[] |
no_license
|
package defpackage;
/* renamed from: dhj reason: default package */
/* compiled from: PG */
public abstract class dhj {
private static volatile boolean e = false;
public int a;
public int b = 100;
public int c = Integer.MAX_VALUE;
public defpackage.dhm d;
public static defpackage.dhj a(java.io.InputStream inputStream) {
if (inputStream != null) {
return new defpackage.dhl(inputStream);
}
byte[] bArr = defpackage.dim.b;
return a(bArr, 0, bArr.length, false);
}
public abstract int a();
public abstract defpackage.djo a(defpackage.djx djx, defpackage.dhw dhw);
public abstract void a(int i);
public abstract double b();
public abstract boolean b(int i);
public abstract float c();
public abstract int c(int i);
public abstract long d();
public abstract void d(int i);
public abstract long e();
public abstract void e(int i);
public abstract int f();
public abstract long g();
public abstract int h();
public abstract boolean i();
public abstract java.lang.String j();
public abstract java.lang.String k();
public abstract defpackage.dha l();
public abstract int m();
public abstract int n();
public abstract int o();
public abstract long p();
public abstract int q();
public abstract long r();
/* access modifiers changed from: 0000 */
public abstract long s();
public abstract boolean t();
public abstract int u();
public static defpackage.dhj a(byte[] bArr, int i, int i2, boolean z) {
defpackage.dhk dhk = new defpackage.dhk(bArr, i, i2);
try {
dhk.c(i2);
return dhk;
} catch (defpackage.dir e2) {
throw new java.lang.IllegalArgumentException(e2);
}
}
dhj() {
}
public static int f(int i) {
return (i >>> 1) ^ (-(i & 1));
}
public static long a(long j) {
return (j >>> 1) ^ (-(1 & j));
}
}
| true
|
ed7aacc339d111af69908956179c881055574a83
|
Java
|
xaoei/x-space
|
/src/main/java/me/leiho/blog/services/impls/ManageIndexSettingServiceImpl.java
|
UTF-8
| 2,070
| 2.1875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package me.leiho.blog.services.impls;
import me.leiho.blog.entities.XIndexSetting;
import me.leiho.blog.mappers.XIndexSettingMapper;
import me.leiho.blog.services.ManageIndexSettingService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ManageIndexSettingServiceImpl implements ManageIndexSettingService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private XIndexSettingMapper xIndexSettingMapper;
public String getUploadSettings(List<XIndexSetting> settings) {
for (XIndexSetting xIndexSetting : settings) {
if (xIndexSetting.getId() == null || StringUtils.isBlank(xIndexSetting.getHeadImage()) || StringUtils.isBlank(xIndexSetting.getTitle()) || xIndexSetting.getArticleId() == null || StringUtils.isBlank(xIndexSetting.getContent())) {
return "有的地方没有填";
}
}
try {
for (XIndexSetting xIndexSetting : settings) {
xIndexSetting.setUpdateTime(new Date());
xIndexSettingMapper.updateByPrimaryKeySelective(xIndexSetting);
}
} catch (Exception e) {
return "数据库保存出错";
}
return "ok";
}
public String getUploadSetting(XIndexSetting setting) {
if (setting.getId() == null || StringUtils.isBlank(setting.getHeadImage()) || StringUtils.isBlank(setting.getTitle()) || setting.getArticleId() == null || StringUtils.isBlank(setting.getContent()) || StringUtils.isBlank(setting.getFeeling())) {
return "有的地方没有填";
}
try {
setting.setUpdateTime(new Date());
xIndexSettingMapper.updateByPrimaryKeySelective(setting);
} catch (Exception e) {
return "数据库保存出错";
}
return "ok";
}
}
| true
|
41e4c3f56bf8801debc18da9c84b489fdb1605ef
|
Java
|
sam38k0/ShShop
|
/src/com/shshop/response/OrderInfo.java
|
UTF-8
| 2,025
| 2.484375
| 2
|
[] |
no_license
|
package com.shshop.response;
import com.shshop.domain.Order;
import com.shshop.domain.OrderState;
import com.shshop.domain.Product;
public class OrderInfo {
private boolean isAvailable = true;
private Product product;
private Order order;
private OrderState orderState;
private String imagePath;
private int shippingPrice;
private boolean unchecked = false;
public OrderInfo(Order order, OrderState orderState, Product product, String imagePath, int quantity, int shippingPrice) {
this.setOrder(order);
this.setProduct(product);
this.setImagePath(imagePath);
this.setQuantity(quantity);
this.setShippingPrice(shippingPrice);
this.setOrderState(orderState);
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public boolean isOpen(){
return this.product.isOnOpen();
}
public int getProductTotalPrice(){
return getProduct().getPrice() * getQuantity();
}
public int getQuantity() {
return getOrder().getAmount();
}
public void setQuantity(int quantity) {
getOrder().setAmount(quantity);
}
public String getImagePath() {
return imagePath;
}
public void setImagePath(String imagePath) {
this.imagePath = imagePath;
}
public int getPrice() {
return product.getPrice() * order.getAmount();
}
public int getShippingPrice() {
return shippingPrice;
}
public void setShippingPrice(int shippingPrice) {
this.shippingPrice = shippingPrice;
}
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public OrderState getOrderState() {
return orderState;
}
public void setOrderState(OrderState orderState) {
this.orderState = orderState;
}
public boolean isAvailable() {
return isAvailable;
}
public void setAvailable(boolean isAvailable) {
this.isAvailable = isAvailable;
}
public boolean getUnchecked() {
return unchecked;
}
public void setUnchecked(boolean unchecked) {
this.unchecked = unchecked;
}
}
| true
|
47bbadd6dbe35b08ac6803106c202594f4ba4a3d
|
Java
|
moronicgeek/SwaggerCloud
|
/core/src/main/java/com/github/moronicgeek/swagger/cloud/model/ApplicationRegistrationMetadata.java
|
UTF-8
| 2,349
| 2.390625
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.github.moronicgeek.swagger.cloud.model;
import java.util.Objects;
/**
* Created by muhammedpatel on 2016/08/06.
*/
public class ApplicationRegistrationMetadata {
private int id;
private String name;
private String swaggerUrl;
private String groupId;
private int port;
private String host;
public ApplicationRegistrationMetadata(String name, String swaggerUrl, String groupId, int port, String host) {
this.name = name;
this.swaggerUrl = swaggerUrl;
this.groupId = groupId;
this.port = port;
this.host = host;
}
public ApplicationRegistrationMetadata() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSwaggerUrl() {
return swaggerUrl;
}
public void setSwaggerUrl(String swaggerUrl) {
this.swaggerUrl = swaggerUrl;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ApplicationRegistrationMetadata metadata = (ApplicationRegistrationMetadata) o;
return id == metadata.id &&
Objects.equals(name, metadata.name) &&
Objects.equals(swaggerUrl, metadata.swaggerUrl) &&
Objects.equals(groupId, metadata.groupId);
}
@Override
public int hashCode() {
return Objects.hash(id, name, swaggerUrl, groupId);
}
@Override
public String toString() {
return "ApplicationRegistrationMetadata{" +
"id=" + id +
", name='" + name + '\'' +
", swaggerUrl='" + swaggerUrl + '\'' +
", groupId='" + groupId + '\'' +
'}';
}
}
| true
|
6b1580dbf541dc2a4e72d66f61dc9adc5a570bc5
|
Java
|
delamet/SchoolPlanner
|
/app/src/main/java/com/example/jackson/schoolplanner/SchoolPlanner/HwAddEdit/SchoolPlannerHWEditActivity.java
|
UTF-8
| 935
| 2.296875
| 2
|
[] |
no_license
|
package com.example.jackson.schoolplanner.SchoolPlanner.HwAddEdit;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import com.example.jackson.schoolplanner.SingleFragmentActivity;
import com.example.jackson.schoolplanner.Task.HomeworkAssignment;
/**
* Created by Jackson on 7/30/17.
*/
public class SchoolPlannerHWEditActivity extends SingleFragmentActivity {
private static final String HW_KEY = "hw_key";
public static Intent getIntent(Context context, HomeworkAssignment hw){
Intent intent = new Intent(context, SchoolPlannerHWEditActivity.class);
intent.putExtra(HW_KEY, hw);
return intent;
}
@Override
protected Fragment createFragment() {
Intent intent = getIntent();
HomeworkAssignment hw = intent.getExtras().getParcelable(HW_KEY);
return SchoolPlannerHWAddEditFragment.newInstance(hw);
}
}
| true
|
37010be2606496dd931a5e2294fdb856fa27c147
|
Java
|
htdrajiv/DE_Courses_Mum
|
/ASD/Lab6/ChainOfResponsibility/lab/src/Main.java
|
UTF-8
| 1,084
| 2.75
| 3
|
[] |
no_license
|
/**
* Created by Rajiv on 4/1/2017.
*/
public class Main {
public static void main(String[] args){
DomesticOrderHandler domesticOrderHandler = new DomesticOrderHandler();
InternationalOrderHandler internationalOrderHandler = new InternationalOrderHandler();
LargeOrderHandler largeOrderHandler = new LargeOrderHandler();
MostFavoredCustomerOrderHandler mostFavoredCustomerOrderHandler = new MostFavoredCustomerOrderHandler();
mostFavoredCustomerOrderHandler.setNextOrderHandler(largeOrderHandler);
largeOrderHandler.setNextOrderHandler(internationalOrderHandler);
internationalOrderHandler.setNextOrderHandler(domesticOrderHandler);
OrderReceiver orderReceiver = new OrderReceiver();
orderReceiver.setOrderHandler(mostFavoredCustomerOrderHandler);
Order order1 = new Order ("1000", 35500, false,new Customer( "Rukko kei"));
Order order2 = new Order ("1001", 55520, true,new Customer( "Suzi Santro"));
Order order3 = new Order ("1002", 35690, false,new Customer( "Midas Mikky"));
}
}
| true
|
5781b5f4d15c8b21489142f5d765c0b8253dce3f
|
Java
|
cabani/android-baley-labeye
|
/app/src/main/java/com/ticandroid/baley_labeye/activities/ui/museum/MuseumFragment.java
|
UTF-8
| 5,991
| 2.390625
| 2
|
[
"MIT"
] |
permissive
|
package com.ticandroid.baley_labeye.activities.ui.museum;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.ticandroid.baley_labeye.R;
import com.ticandroid.baley_labeye.adapter.MuseumListFSAdapter;
import com.ticandroid.baley_labeye.beans.MuseumBean;
/**
* Museum Fragment used to display the list of museum available on the app.
*
* @author Baley
* @author Labeye
* @see Fragment
*/
public class MuseumFragment extends Fragment {
/**
* Current activity's layout.
**/
private static final int LAYOUT = R.layout.fragment_museum;
/**
* Current activity's used recycler view.
**/
private static final int RECYCLER_VIEW = R.id.recycler_view;
/**
* Search bar used to filter our data.
**/
private static final int SEARCH_BAR = R.id.search_bar;
/**
* Firesore query path to fetch museum elements.
**/
private static final String QUERY_PATH = "museums";
/**
* Firestore instance.
**/
private transient final FirebaseFirestore firebaseFirestore = FirebaseFirestore.getInstance();
/**
* Museum adapater to display the element.
**/
private transient MuseumListFSAdapter adapter;
/**
* Options to be displayed.
*/
private transient FirestoreRecyclerOptions<MuseumBean> options;
/**
* Creates a new museum fragment instance.
*
* @return a new MuseumFragment
*/
public static MuseumFragment newInstance() {
return new MuseumFragment();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(LAYOUT, container, false);
Log.d(this.getClass().toString(), "start of onCreate method");
// Search view initilizaition
SearchView searchView = root.findViewById(SEARCH_BAR);
searchView.setOnQueryTextListener(new SearchBarListener());
// Fetch firestore data
options = generateQuery();
adapter = new MuseumListFSAdapter(root.getContext(), options);
// Place it in the recycler view
RecyclerView recyclerView = root.findViewById(RECYCLER_VIEW);
recyclerView.setLayoutManager(new LinearLayoutManager(this.getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
Log.d(this.getClass().toString(), "end of onCreate method");
return root;
}
@Override
public void onStop() {
super.onStop();
adapter.stopListening();
Log.i(this.getClass().toString(), "listening stopped");
}
@Override
public void onStart() {
super.onStart();
adapter.startListening();
Log.i(this.getClass().toString(), "listening started");
}
/**
* Generates a query to fetch some specific data.
*
* @param startsWith sequence at the begining of the research
* @return the options matching the sequence
*/
private FirestoreRecyclerOptions<MuseumBean> generateQuery(String startsWith) {
Log.d(this.getClass().toString(), String.format(
"method with %s called",
startsWith == null ? "null" : startsWith)
);
FirestoreRecyclerOptions<MuseumBean> newOptions;
if (startsWith == null || startsWith.length() == 0) {
newOptions = generateQuery();
} else {
Query query;
// The purpose is to make a query 'BEGIN WITH'
query = firebaseFirestore.collection(QUERY_PATH)
.orderBy("nomDuMusee")
// The \uf8ff sequence is an escape sequence for any
.startAt(startsWith)
.endAt(String.format("%s\uf8ff", startsWith));
Log.d(this.getClass().getName(), String.format("options updated with %s parameter", startsWith));
newOptions = new FirestoreRecyclerOptions.Builder<MuseumBean>().setQuery(query, MuseumBean.class).build();
}
return newOptions;
}
/**
* Generates a query to fetch all data.
*
* @return all the options
*/
private FirestoreRecyclerOptions<MuseumBean> generateQuery() {
Query query;
query = firebaseFirestore.collection(QUERY_PATH).orderBy("nomDuMusee");
Log.d(this.getClass().getName(), "options reseted with default");
return new FirestoreRecyclerOptions.Builder<MuseumBean>().setQuery(query, MuseumBean.class).build();
}
/**
* Class used to add a listener to our searchbar.
*/
private class SearchBarListener implements SearchView.OnQueryTextListener {
@Override
public boolean onQueryTextChange(String newText) {
Log.d(this.getClass().toString(), String.format("%s input change", newText));
// If the entry is empty, that means, the user wants to see everything
if (null == newText || newText.length() == 0) {
options = generateQuery();
adapter.updateOptions(options);
Log.d(this.getClass().getName(), "UI updated in consequence");
}
return true;
}
@Override
public boolean onQueryTextSubmit(String query) {
Log.d(this.getClass().getName(), String.format("%s searched", query));
options = generateQuery(query);
adapter.updateOptions(options);
return true;
}
}
}
| true
|
d1a9ee97897ac6f47b251592327e0d70a46af012
|
Java
|
markim94/team_cadi
|
/0521/app/src/main/java/org/techtown/cadiproject01/MainActivity.java
|
UTF-8
| 1,249
| 2.53125
| 3
|
[] |
no_license
|
package org.techtown.cadiproject01;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
public static final int REQUEST_CODE_SECOND = 101; //요청코드 101로 정의
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button); //버튼 객체 참조
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), SecondActivity.class); //context객체 참조후 전달
startActivityForResult(intent, REQUEST_CODE_SECOND); //ForResult의 경우는 새로 띄운 액티비티로 부터 응답 받을 수 있다.
Toast.makeText(getApplicationContext(),"request_code: " + REQUEST_CODE_SECOND,Toast.LENGTH_SHORT).show(); //요청코드 토스트 메시지
}
});
}
}
| true
|
6ab5aae2ede5a4335f416f2c9996c68338a216c0
|
Java
|
astute22/web-p
|
/backup/WebContent/ImgUploadServlet.java
|
UTF-8
| 2,548
| 2.078125
| 2
|
[] |
no_license
|
package kr.co.jtimes.reporter.imagecontainer.common.web;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import kr.co.jtimes.common.vo.NewsCategoryVo;
import kr.co.jtimes.common.vo.NewsTypeVo;
import kr.co.jtimes.reporter.imagecontainer.common.dao.TBImageDao;
import kr.co.jtimes.reporter.imagecontainer.common.vo.TbImageVo;
import kr.co.jtimes.reporter.profile.common.vo.ReporterEmployeeVo;
@WebServlet("/reporter/upload.html")
@MultipartConfig()
public class ImgUploadServlet extends HttpServlet{
private static final String SAVED_DIRECTORY = "C:\\web_eclipse\\web_workspace\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp0\\wtpwebapps\\semi-project-1team\\imgstore\\"; //경로
@Override
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
Part part = req.getPart("file-upload");
String imgname = req.getParameter("imgname");
long ImgSize = part.getSize();
String item = part.getContentType();
String fType = item.substring(item.indexOf("/")+1, item.length());
String path = SAVED_DIRECTORY + imgname + "." + fType;
part.write(path);
TbImageVo tbImageVo = new TbImageVo();
tbImageVo.setImgLocation(req.getParameter("loc"));
tbImageVo.setImgTitle(imgname);
tbImageVo.setImgAlt(req.getParameter("contents"));
tbImageVo.setImgPath(path);
tbImageVo.setImgAlterState("N");
System.out.println(tbImageVo.toString());
ReporterEmployeeVo reporter = new ReporterEmployeeVo();
reporter.setReporterNo(1);
tbImageVo.setReporter(reporter);
NewsTypeVo newsType = new NewsTypeVo();
newsType.setNewsTypeNo(Integer.parseInt(req.getParameter("newstype")));
tbImageVo.setNewsType(newsType);
NewsCategoryVo category = new NewsCategoryVo();
category.setCategoryNo(Integer.parseInt(req.getParameter("newscat")));
tbImageVo.setCategory(category);
tbImageVo.setImgType(fType);
tbImageVo.setImgSize(String.valueOf(ImgSize));
System.out.println(tbImageVo.toString());
TBImageDao dao = new TBImageDao();
try {
dao.addtbImageVo(tbImageVo);
} catch (SQLException e) {
throw new ServletException(e);
}
res.sendRedirect("/reporter/imageContainer/index.jsp");
}
}
| true
|
3a861253d8203d567e60f1cd79da4fc1bd923535
|
Java
|
darren573/MyDemo
|
/app/src/main/java/com/darren/mydemo/activity/PictureActivity.java
|
UTF-8
| 1,209
| 1.835938
| 2
|
[] |
no_license
|
package com.darren.mydemo.activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.darren.mydemo.R;
import com.darren.mydemo.bean.ResultPicture;
public class PictureActivity extends AppCompatActivity {
private WebView wv_pic;
private Intent intent;
private ResultPicture resultPicture;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_picture);
findViews();
setEvent();
}
private void setEvent() {
intent=getIntent();
resultPicture=intent.getExtras().getParcelable("picture");
wv_pic.loadUrl(resultPicture.getPicUrl());
WebSettings setting = wv_pic.getSettings();
setting.setJavaScriptEnabled(true);
wv_pic.setWebViewClient(new WebViewClient());
wv_pic.setWebChromeClient(new WebChromeClient());
}
private void findViews() {
wv_pic= (WebView) findViewById(R.id.wv_pic);
}
}
| true
|
2633a8ca51ede2c8896a0cb85d028b559c1d8b7c
|
Java
|
cs2103jan2016-w15-4j/main
|
/src/dooyit/storage/CategoryController.java
|
UTF-8
| 1,227
| 2.6875
| 3
|
[] |
no_license
|
//@@author A0124586Y
package dooyit.storage;
import java.io.IOException;
import java.util.ArrayList;
import dooyit.common.datatype.CategoryData;
/**
* The CategoryController is a facade class for the StorageController to save or
* load categories
*
* @author Dex
*
*/
public class CategoryController {
private CategorySaver categorySaver;
private CategoryLoader categoryLoader;
public CategoryController(String path) {
categoryLoader = new CategoryLoader(path);
categorySaver = new CategorySaver(path);
}
/**
* Saves the list of categories.
*
* @param tasks
* A list of CategoryData to be saved
*
* @return Returns true if categories are saved successfully, otherwise returns
* false
*
* @throws IOException
* If the save file cannot be accessed
*/
public boolean save(ArrayList<CategoryData> categories) throws IOException {
return categorySaver.save(categories);
}
/**
* Loads the list of categories from the save file.
*
* @return A list of CategoryData to be loaded
*
* @throws IOException
* If loading fails
*/
public ArrayList<CategoryData> load() throws IOException {
return categoryLoader.load();
}
}
| true
|
08c2278420c89c980443cb7e03dc74162e416611
|
Java
|
suyuNJ/flink
|
/iot/rule-engine-mgmt/src/main/java/cn/suyu/iot/enginemgmt/yarn/enums/ApplicationStateEnum.java
|
UTF-8
| 1,240
| 2.515625
| 3
|
[] |
no_license
|
package cn.suyu.iot.enginemgmt.yarn.enums;
/**
* session状态(state)
*/
public enum ApplicationStateEnum {
/**
* 运行
*/
RUNNING("RUNNING","运行"),
/**
* 完成
*/
FINISHED("FINISHED","完成"),
/**
* 失败
*/
FAILED("FAILED","失败"),
/**
* 取消
*/
KILLED("KILLED","取消");
/**
* 编号
*/
private String code;
/**
* 描述
*/
private String desc;
/**
* 私有构造函数
* @param code
* @param desc
*/
ApplicationStateEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static ApplicationStateEnum getDataSourceEnum(Integer code){
for (ApplicationStateEnum dataSourceEnum : ApplicationStateEnum.values()) {
if(dataSourceEnum.code.equals(code)) {
return dataSourceEnum;
}
}
return null;
}
}
| true
|
2c3ad9663b7668d721fa86f8d33808b9b9a24a33
|
Java
|
HuaZhongAndroid/HanShan
|
/tongzijunyh/src/com/bm/util/CacheUtil.java
|
UTF-8
| 2,096
| 2.34375
| 2
|
[] |
no_license
|
package com.bm.util;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.Map;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class CacheUtil {
private static final String SPNAME = "CacheUtil_SPNAME";
public static void save(Context context, String key,Map<String,String> map, Serializable object)
{
try{
Gson gson = new GsonBuilder().create();
key += gson.toJson(map);
String serStr = gson.toJson(object);
// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
// ObjectOutputStream objectOutputStream = new ObjectOutputStream(
// byteArrayOutputStream);
// objectOutputStream.writeObject(object);
// String serStr = byteArrayOutputStream.toString("ISO-8859-1");
// objectOutputStream.close();
// byteArrayOutputStream.close();
final SharedPreferences sp = context.getSharedPreferences(SPNAME, Context.MODE_PRIVATE);
sp.edit().putString(key, serStr).commit();
Log.d("", "缓存成功");
}catch(Exception e)
{
e.printStackTrace();
}
}
public static Object read(Context context, String key, Map<String,String> map, Type t)
{
try{
Log.d("", "缓存读取中...");
Gson gson = new GsonBuilder().create();
key += gson.toJson(map);
final SharedPreferences sp = context.getSharedPreferences(SPNAME, Context.MODE_PRIVATE);
String str = sp.getString(key, null);
if(str == null)
return null;
// ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes("ISO-8859-1"));
// ObjectInputStream objectInputStream = new ObjectInputStream(
// byteArrayInputStream);
// Object o = objectInputStream.readObject();
// objectInputStream.close();
// byteArrayInputStream.close();
Object o = gson.fromJson(str, t);
Log.d("", "缓存读取完成");
return o;
}catch(Exception e)
{
e.printStackTrace();
return null;
}
}
}
| true
|
1b5dbb7825f91543cc7ed471fd177abdfc1fa6d6
|
Java
|
cococbx/OA
|
/app/src/main/java/com/wanhuiyuan/szoa/dialog/ProgressDialog.java
|
UTF-8
| 1,555
| 2.21875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.wanhuiyuan.szoa.dialog;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.cec.szoa.R;
public class ProgressDialog {
private static Dialog loadingDialog = null;
public static Dialog show(Context context) {
return show(context, "");
}
public static Dialog show(Context context, String msg) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.progreses_dialog, null);
LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);
TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);
Animation animation = AnimationUtils.loadAnimation(context,
R.anim.loading_animation);
((ImageView) v.findViewById(R.id.img)).startAnimation(animation);
if ("".equals(msg))
tipTextView.setText("加载中,请稍后");
else
tipTextView.setText(msg);
loadingDialog = new Dialog(context, R.style.progress_style_dialog);
loadingDialog.setCancelable(false);
loadingDialog.setContentView(layout, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT));
loadingDialog.show();
return loadingDialog;
}
public static void dismiss() {
if (null != loadingDialog) {
loadingDialog.dismiss();
loadingDialog = null;
}
}
}
| true
|
5381eca973e01defc27e7ec545ea863c36901d00
|
Java
|
vinodjagwani/catering-service
|
/src/test/java/de/caterwings/catering/service/impl/CateringProductServiceImplTest.java
|
UTF-8
| 2,375
| 1.992188
| 2
|
[] |
no_license
|
package de.caterwings.catering.service.impl;
import de.caterwings.catering.AbstractCateringTest;
import de.caterwings.catering.entity.CateringProductEntity;
import de.caterwings.catering.repository.CateringProductReactiveRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.domain.Example;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class CateringProductServiceImplTest extends AbstractCateringTest {
@Mock
private CateringProductReactiveRepository cateringProductReactiveRepository;
@InjectMocks
private CateringProductServiceImpl cateringProductServiceImpl;
@Test
public void findByIdTest() {
when(cateringProductReactiveRepository.findById(any(String.class))).thenReturn(Mono.just(getCateringProductEntity()));
cateringProductServiceImpl.findById("324234");
verify(cateringProductReactiveRepository, times(1)).findById(any(String.class));
}
@Test
public void deleteTest() {
when(cateringProductReactiveRepository.delete(any(CateringProductEntity.class))).thenReturn(Mono.empty());
cateringProductServiceImpl.delete(getCateringProductEntity());
verify(cateringProductReactiveRepository, times(1)).delete(any(CateringProductEntity.class));
}
@Test
public void findAllTest() {
when(cateringProductReactiveRepository.findAll(any(Example.class))).thenReturn(Flux.just(getCateringProductEntity()));
cateringProductServiceImpl.findAll(Example.of(getCateringProductEntity()));
verify(cateringProductReactiveRepository, times(1)).findAll(any(Example.class));
}
@Test
public void createTest() {
final CateringProductEntity entity = getCateringProductEntity();
when(cateringProductReactiveRepository.save(any(CateringProductEntity.class))).thenReturn(Mono.just(entity));
cateringProductServiceImpl.create(entity);
verify(cateringProductReactiveRepository, times(1)).save(any(CateringProductEntity.class));
}
}
| true
|
1aee16201807c5bd8781942b2d8557232cae9d96
|
Java
|
shanghuxiaozi/oa
|
/oa_interface/src/main/java/com/friends/service/PayService.java
|
UTF-8
| 847
| 1.835938
| 2
|
[] |
no_license
|
package com.friends.service;
import java.util.List;
import org.springframework.data.domain.PageRequest;
import com.friends.entity.Pay;
import com.friends.entity.vo.PayDynamicQueryVo;
import com.friends.utils.Result;
public interface PayService {
public Result queryDynamic(PayDynamicQueryVo payDynamicQueryVo);
public Pay add(Pay t);
public void delete(Pay t);
public Pay updateSelective(Pay t);
public Pay queryById(String id);
public List<Pay> queryByExample(Pay t);
public List<Pay> queryByExamplePageable(Pay t,PageRequest pageRequest);
public void batchAdd(List<Pay> ts);
public void batchDelete(List<Pay> ts);
// 根据银行卡查薪资
public Pay queryByIdcard(String bankCardNumber);
// 根据各参数 查询受邀用户
public List<Pay> queryByParam(String pay, String account,String username,int regular);
}
| true
|
122065566755f3b72e1d03337b93cfe978c5de68
|
Java
|
lengweiping1983/ai-cms
|
/cms-service/src/main/java/com/ai/cms/injection/bean/MovieBean.java
|
UTF-8
| 4,676
| 1.789063
| 2
|
[] |
no_license
|
package com.ai.cms.injection.bean;
import com.ai.cms.injection.enums.InjectionItemTypeEnum;
public class MovieBean extends ObjectBean {
private String Type;
private String FileURL;
private String PlayURL;
private String SourceDRMType;
private String DestDRMType;
private String AudioType;
private String ScreenFormat;
private String ClosedCaptioning;
private String MediaSpec;
private String Result;
private String ErrorDescription;
private String OCSURL;
private String Duration;
private String FileSize;
private String BitRateType;
private String VideoType;
private String AudioFormat;
private String Resolution;
private String VideoProfile;
private String SystemLayer;
private String ServiceType;
private String Name;
private String Definition;
private String Bitrate;
private String FileMd5;
private String CdnPlatform;
public MovieBean() {
ElementType = InjectionItemTypeEnum.MOVIE.getValue();
}
public String getType() {
return Type;
}
public void setType(String type) {
Type = type;
}
public String getFileURL() {
return FileURL;
}
public void setFileURL(String fileURL) {
FileURL = fileURL;
}
public String getPlayURL() {
return PlayURL;
}
public void setPlayURL(String playURL) {
PlayURL = playURL;
}
public String getSourceDRMType() {
return SourceDRMType;
}
public void setSourceDRMType(String sourceDRMType) {
SourceDRMType = sourceDRMType;
}
public String getDestDRMType() {
return DestDRMType;
}
public void setDestDRMType(String destDRMType) {
DestDRMType = destDRMType;
}
public String getAudioType() {
return AudioType;
}
public void setAudioType(String audioType) {
AudioType = audioType;
}
public String getScreenFormat() {
return ScreenFormat;
}
public void setScreenFormat(String screenFormat) {
ScreenFormat = screenFormat;
}
public String getClosedCaptioning() {
return ClosedCaptioning;
}
public void setClosedCaptioning(String closedCaptioning) {
ClosedCaptioning = closedCaptioning;
}
public String getOCSURL() {
return OCSURL;
}
public void setOCSURL(String oCSURL) {
OCSURL = oCSURL;
}
public String getDuration() {
return Duration;
}
public void setDuration(String duration) {
Duration = duration;
}
public String getFileSize() {
return FileSize;
}
public void setFileSize(String fileSize) {
FileSize = fileSize;
}
public String getBitRateType() {
return BitRateType;
}
public void setBitRateType(String bitRateType) {
BitRateType = bitRateType;
}
public String getVideoType() {
return VideoType;
}
public void setVideoType(String videoType) {
VideoType = videoType;
}
public String getAudioFormat() {
return AudioFormat;
}
public void setAudioFormat(String audioFormat) {
AudioFormat = audioFormat;
}
public String getResolution() {
return Resolution;
}
public void setResolution(String resolution) {
Resolution = resolution;
}
public String getVideoProfile() {
return VideoProfile;
}
public void setVideoProfile(String videoProfile) {
VideoProfile = videoProfile;
}
public String getSystemLayer() {
return SystemLayer;
}
public void setSystemLayer(String systemLayer) {
SystemLayer = systemLayer;
}
public String getServiceType() {
return ServiceType;
}
public void setServiceType(String serviceType) {
ServiceType = serviceType;
}
public String getResult() {
return Result;
}
public void setResult(String result) {
Result = result;
}
public String getErrorDescription() {
return ErrorDescription;
}
public void setErrorDescription(String errorDescription) {
ErrorDescription = errorDescription;
}
public String getMediaSpec() {
return MediaSpec;
}
public void setMediaSpec(String mediaSpec) {
MediaSpec = mediaSpec;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDefinition() {
return Definition;
}
public void setDefinition(String definitionFlag) {
Definition = definitionFlag;
}
public String getBitrate() {
return Bitrate;
}
public void setBitrate(String bitrate) {
Bitrate = bitrate;
}
public String getFileMd5() {
return FileMd5;
}
public void setFileMd5(String fileMd5) {
FileMd5 = fileMd5;
}
public String getCdnPlatform() {
return CdnPlatform;
}
public void setCdnPlatform(String cdnPlatform) {
CdnPlatform = cdnPlatform;
}
}
| true
|
3d6b503102a08656a64667d1eb67fe395bd61575
|
Java
|
omoutenet/demo-spring-boot
|
/src/main/java/ch/ebu/ipush/dto/NewsDTO.java
|
UTF-8
| 4,354
| 2.109375
| 2
|
[
"Apache-2.0"
] |
permissive
|
package ch.ebu.ipush.dto;
import ch.ebu.ipush.fwk.DateUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.File;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class NewsDTO extends AbstractDTO implements Comparable<NewsDTO> {
private String member;
private String state;
private String author;
private String type;
@JsonProperty("from-offer-version")
private Integer fromOfferVersion;
private NewsmlDTO newsml;
private List<String> recipientsList;
private List<File> files;
private Integer version;
private Integer downloads;
@JsonProperty("identifiers")
private IdentifierDTO identifiers;
private MetadataDTO metadata;
@JsonProperty("iaro-state")
private String iaroState;
@JsonProperty("last-update-info")
private LastUpdateInfoDTO lastUpdateInfo;
public String getMember() {
return member;
}
public void setMember(String member) {
this.member = member;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getFromOfferVersion() {
return fromOfferVersion;
}
public void setFromOfferVersion(Integer fromOfferVersion) {
this.fromOfferVersion = fromOfferVersion;
}
public NewsmlDTO getNewsml() {
return newsml;
}
public void setNewsml(NewsmlDTO newsml) {
this.newsml = newsml;
}
public List<String> getRecipientsList() {
return recipientsList;
}
public void setRecipientsList(ArrayList<String> recipientsList) {
this.recipientsList = recipientsList;
}
public List<File> getFiles() {
return files;
}
public void setFiles(ArrayList<File> files) {
this.files = files;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public Integer getDownloads() {
return downloads;
}
public void setDownloads(Integer downloads) {
this.downloads = downloads;
}
public IdentifierDTO getIdentifiers() {
return identifiers;
}
public void setIdentifiers(IdentifierDTO identifiers) {
this.identifiers = identifiers;
}
public MetadataDTO getMetadata() {
return metadata;
}
public void setMetadata(MetadataDTO metadata) {
this.metadata = metadata;
}
public String getIaroState() {
return iaroState;
}
public void setIaroState(String iaroState) {
this.iaroState = iaroState;
}
public LastUpdateInfoDTO getLastUpdateInfo() {
return lastUpdateInfo;
}
public void setLastUpdateInfo(LastUpdateInfoDTO lastUpdateInfo) {
this.lastUpdateInfo = lastUpdateInfo;
}
@Override
public String toString() {
return "News{" +
"member='" + member + '\'' +
", state='" + state + '\'' +
", author='" + author + '\'' +
", type='" + type + '\'' +
", fromOfferVersion=" + fromOfferVersion +
", newsml=" + newsml +
", recipientsList=" + recipientsList +
", files=" + files +
", version=" + version +
", downloads=" + downloads +
", identifiers=" + identifiers +
", metadata=" + metadata +
", iaroState='" + iaroState + '\'' +
", lastUpdateInfo=" + lastUpdateInfo +
'}';
}
private LocalDateTime getTimeStamp() {
return DateUtil.convertToLocalDateTime(getLastUpdateInfo().getTstamp());
}
@Override
public int compareTo(NewsDTO o) {
if (this == o) {
return 0;
}
return getTimeStamp().compareTo(o.getTimeStamp());
}
}
| true
|
9066fb65dbe24f5eaef12cd04c41c4c304e9099e
|
Java
|
djimenezc/Java-exercises-
|
/src/com/company/hackerrank/java/OneDArray.java
|
UTF-8
| 1,024
| 3.328125
| 3
|
[] |
no_license
|
package com.company.hackerrank.java;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class OneDArray {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String firstLine = s.nextLine();
String secondLine = s.nextLine();
// String firstLine = "5";
// String secondLine = "1 -2 4 -5 1";
int negativeSubArrayCounter = 0;
List<String> numbersArray = Arrays.asList(secondLine.split(" "));
for (int i = 0; i < Integer.parseInt(firstLine); i++) {
int tempCounter = 0;
for (int j = i; j < Integer.parseInt(firstLine); j++) {
tempCounter += Integer.parseInt(numbersArray.get(j));
if(tempCounter < 0) {
negativeSubArrayCounter++;
// System.out.println("["+i+","+j+"]");
}
}
}
System.out.println(negativeSubArrayCounter);
}
}
| true
|
83db9f7d0e77d8749cb240ce5c800684a80034cd
|
Java
|
regina14/NiuKe
|
/Leetcode/DecodeWays.java
|
UTF-8
| 1,198
| 3.375
| 3
|
[] |
no_license
|
package Leetcode;
public class DecodeWays {
public static int numDecodings(String s) {
if (s == null || s.length() == 0){
return 0;
}
int len = s.length();
int[] dp = new int[len + 1];
dp[0] = 1;
dp[1] = isValid(s.substring(0, 1))? 1 : 0;
for (int i = 2; i <= len; i++){
if (isValid(s.substring(i - 1, i))){
dp[i] += dp[i - 1];
}
if (isValid(s.substring(i - 2, i))){
dp[i] += dp[i - 2];
}
}
printArrayList(dp);
return dp[len];
}
public static void printArrayList(int[] nums) {
System.out.print("Array List: ");
if(nums != null){
for(int n: nums) {
System.out.print(n + " ");
}
}
System.out.println();
}
public static boolean isValid(String s){
int val = Integer.parseInt(s);
int len = s.length();
if (val <= 0 || val > 26 || (len > 1 && s.charAt(0) == '0')){
return false;
}
return true;
}
public static void main(String[] args) {
numDecodings("12");
}
}
| true
|
c6dba3442d45e030b53f1856e32369f08d2c4a2b
|
Java
|
Aleks1696/UA.training
|
/src/main/java/homework/task_registrationFormDAO/app/controller/InputController.java
|
UTF-8
| 1,071
| 2.28125
| 2
|
[] |
no_license
|
package homework.task_registrationFormDAO.app.controller;
import homework.task_registrationFormDAO.app.view.View;
import java.util.ResourceBundle;
import static homework.block_6_task_registrationForm.app.controller.Regex.*;
import static homework.block_6_task_registrationForm.app.view.Messages.EMAIL_MESSAGE;
import static homework.block_6_task_registrationForm.app.view.Messages.NICK_NAME_MESSAGE;
public class InputController {
private String nickName;
private String email;
public void getInput(UtilityController uController) {
String nickNameRegex;
if (String.valueOf(View.bundle.getLocale()).equals("ua")) {
nickNameRegex = UA_NICK_NAME_REGEX;
} else {
nickNameRegex = US_NICK_NAME_REGEX;
}
nickName = uController.inputValueWithScanner(NICK_NAME_MESSAGE, nickNameRegex);
email = uController.inputValueWithScanner(EMAIL_MESSAGE, EMAIL_REGEX);
}
public String getNickName() {
return nickName;
}
public String getEmail() {
return email;
}
}
| true
|
0ab5023274b8c940019fedcef72515c5d68f449e
|
Java
|
sergonzalezgomez/Pr-ctica3-GestionNBA
|
/src/gestionNBA/util/Util.java
|
UTF-8
| 2,958
| 3.265625
| 3
|
[] |
no_license
|
package gestionNBA.util;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
public class Util {
/**
* Método que muestra un JOptionPane de tipo error con el mensaje que se le pasa por parámetro.
*
* @param mensaje String recibida por el método.
*/
public static void mostrarDialogoError(String mensaje) {
JOptionPane.showMessageDialog(null, mensaje, "Error", JOptionPane.ERROR_MESSAGE);
}
/**
* Método que muestra un JOptionPane de tipo YES/NO option con el mensaje que se le pasa por parámetro.
*
* @param mensaje String recibida por el método.
*
* @return JOptionPande de tipo YES/NO option.
*/
public static int mostrarDialogoSiNo(String mensaje) {
ResourceBundle resourceBundle = ResourceBundle.getBundle("idiomaResourceBundle");
return JOptionPane.showConfirmDialog(null, mensaje, resourceBundle.getString("texto.tituloMostrarDialogoSiNo"), JOptionPane.YES_NO_OPTION);
}
/**
* Método que recibe y devuelve un ImageIcon y lo reescala con los valores de alto y ancho
* que se le pasan por parámetro.
*
* @param icon ImageIcon recibida por el método.
* @param alto int recibida por el método.
* @param ancho int recibida por el método.
*
* @return iconoEscalado que es la imagen reescalada.
*/
public static ImageIcon escalarImageIcon( ImageIcon icon, int alto, int ancho) {
Image imagen = icon.getImage();
Image imagenEscalada = imagen.getScaledInstance(ancho, alto, Image.SCALE_SMOOTH);
ImageIcon iconoEscalado = new ImageIcon(imagenEscalada);
return iconoEscalado;
}
/**
* Método que carga el fichero de preferencias.conf y con ello define el idioma de la aplicacción.
*
* @return locale, con ello se define el idioma de la aplicacción.
*/
public static Locale obtenerLocale() {
Locale locale = null;
Properties properties = new Properties();
try {
properties.load(new FileReader("data/preferencias.conf"));
String pais = properties.getProperty("pais");
String idioma = properties.getProperty("idioma");
if(pais.equals("UK")){
locale = new Locale("en", "UK");
}
} catch (IOException e) {
e.printStackTrace();
}
if(locale == null){
locale = new Locale("es", "ES");
}
return locale;
}
/**
* Método que crea el directorio data (donde se guarda el fichero preferencias.conf) si no existiese.
*/
public static void crearSiNoExisteDirectorioDatos(){
File directorio = new File("data");
if(!directorio.exists()) {
directorio.mkdir();
}
}
}
| true
|
7414484e3d0ec85d4d144b21d825296ec598c6f9
|
Java
|
dimhat-zero/ng-solr
|
/ng-solr/src/main/java/com/jianla/ng/solr/service/NewsServiceImpl.java
|
UTF-8
| 2,430
| 2.40625
| 2
|
[] |
no_license
|
package com.jianla.ng.solr.service;
import java.util.Arrays;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.solr.core.query.result.HighlightEntry;
import org.springframework.data.solr.core.query.result.HighlightEntry.Highlight;
import org.springframework.data.solr.core.query.result.HighlightPage;
import com.jianla.ng.solr.model.News;
import com.jianla.ng.solr.model.SortableNews;
import com.jianla.ng.solr.repository.NewsRepository;
public class NewsServiceImpl implements NewsService {
private NewsRepository newsDao;
private static final Sort SORT_BY_PUBLISHTIME_DESC=new Sort(Sort.Direction.DESC,SortableNews.PUBLISH_TIME.getName());
private Sort getDefaultSort(){
return SORT_BY_PUBLISHTIME_DESC;
}
@Override
public News saveOrUpdate(News news) {
return newsDao.save(news);
}
@Override
public void saveOrUpdate(List<News> newsList) {
newsDao.save(newsList);
}
@Override
public void delete(String id) {
newsDao.delete(id);
}
@Override
public Page<News> query(String terms, Pageable page) {
return newsDao.find(terms, page, getDefaultSort());
}
@Override
public Page<News> queryByKeyword(String keyword, Pageable page) {
News news=new News();
news.setKeywords(Arrays.asList(keyword));
return newsDao.find(news, page, getDefaultSort());
}
@Override
public Page<News> query(News news, Pageable page) {
return newsDao.find(news, page, getDefaultSort());
}
@Override
public Page<News> queryForHighlight(News news,Pageable page){
HighlightPage<News> highlightList = newsDao.findHighlight(news, page, getDefaultSort());
for(HighlightEntry<News> highlightEntry:highlightList.getHighlighted()){
News newsEntity = highlightEntry.getEntity();
for(Highlight highlight:highlightEntry.getHighlights()){
if(highlight.getField().getName().equals("content")){
newsEntity.setContent(highlight.getSnipplets().get(0));//多值,这里只有一个值
}else if(highlight.getField().getName().equals("title")){
newsEntity.setTitle(highlight.getSnipplets().get(0));
}
}
}
return highlightList;
}
@Override
public List<News> queryRelated(String docId, int count) {
return newsDao.findRelated(docId, count);
}
public void setNewsDao(NewsRepository newsDao) {
this.newsDao = newsDao;
}
}
| true
|
bf023d4005a329813d2b07e66e594202a2de667c
|
Java
|
ycymio/opendaylight-adsal-controller
|
/config/yang-test/src/main/yang-gen-config/org/opendaylight/controller/config/yang/test/impl/NotStateBeanInternal.java
|
UTF-8
| 645
| 1.882813
| 2
|
[] |
no_license
|
package org.opendaylight.controller.config.yang.test.impl;
public class NotStateBeanInternal {
private org.opendaylight.controller.config.api.DependencyResolver dependencyResolver;
private java.lang.String element2;
public NotStateBeanInternal () {
super();
}
public void injectDependencyResolver(org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
this.dependencyResolver = dependencyResolver;
}
public java.lang.String getElement2() {
return element2;
}
public void setElement2(java.lang.String element2) {
this.element2 = element2;
}
}
| true
|
c04138c9444f63c8ca4efefa0860feb405beba46
|
Java
|
kbrady3/Random-Array
|
/RandomTenBrady.java
|
UTF-8
| 2,311
| 3.75
| 4
|
[] |
no_license
|
//Kabrina Brady
public class RandomTenBrady {
public static void main(String[] args) {
int max = 10;
int randMax = 20;
int increment = 1;
int[] randomArray = new int[max];
int rand = 0;
int lengthArray = randomArray.length;
int highest = 0;
int lowest = randMax+1;
//Must terminate when i < max, not <=. If <=, goes up to index 10, which doesn't exist.
for (int i = 0; i < max; i++){
//Generates random number between 1 and 20
rand = (int) (Math.random() * randMax) + increment;
//Assigns random number to randomArray[i]
randomArray[i] = rand;
}
System.out.println("Every element in the array: ");
for (int item: randomArray){
System.out.printf(String.valueOf(item) + " ");
}
System.out.println();
System.out.println("Every item at an even index: ");
for (int i = 0; i < lengthArray; i++){
if (i % 2 == 0){
System.out.printf(randomArray[i] + " ");
}
}
System.out.println();
System.out.println("Every even element: ");
for (int i = 0; i < lengthArray; i++){
if (randomArray[i] % 2 == 0){
System.out.printf(randomArray[i] + " ");
}
}
System.out.println();
System.out.println("Backwards array: ");
for (int i = max-1; i >= 0; i--){
System.out.printf(randomArray[i] + " ");
}
System.out.println();
System.out.println("First element: ");
System.out.printf(randomArray[0] + " ");
System.out.println();
System.out.println("Last element: ");
System.out.printf(randomArray[max-1] + " ");
System.out.println();
System.out.println("Highest element: ");
for (int item: randomArray){
if (item > highest){
highest = item;
}
}
System.out.printf(String.valueOf(highest));
System.out.println();
System.out.println("Lowest element: ");
for (int item: randomArray){
if (item < lowest){
lowest = item;
}
}
System.out.printf(String.valueOf(lowest));
}
}
| true
|
6887ff826fcf3fb9a08ee99db71e5c0354b77fe5
|
Java
|
jinalparshwa/BeanStringNew
|
/app/src/main/java/com/beanstringnew/Activity/Notification_activity.java
|
UTF-8
| 14,009
| 1.539063
| 2
|
[] |
no_license
|
package com.beanstringnew.Activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.beanstringnew.Adapter.Adapter_Notification_list;
import com.beanstringnew.Controller.Acitvity_comunator;
import com.beanstringnew.Controller.Activity_indicator;
import com.beanstringnew.Controller.Configr;
import com.beanstringnew.Controller.Connection;
import com.beanstringnew.Controller.DialogBox;
import com.beanstringnew.Controller.Fb_invites_beans;
import com.beanstringnew.Json_model.JSON;
import com.beanstringnew.Model.Model_notification;
import com.beanstringnew.Model.Model_profile;
import com.beanstringnew.Myapplication;
import com.beanstringnew.R;
import com.beanstringnew.Shared.Pref_Master;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.share.model.AppInviteContent;
import com.facebook.share.widget.AppInviteDialog;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import bolts.AppLinks;
/**
* Created by Admin on 7/22/2017.
*/
public class Notification_activity extends AppCompatActivity {
Pref_Master pref;
Context context = this;
Activity_indicator obj_dialog;
public static boolean flag_loading = false;
Adapter_Notification_list adapter;
ArrayList<Model_notification> array = new ArrayList<>();
ArrayList<Model_notification> array_j = new ArrayList<>();
ListView list_notification;
String res_message;
TextView notext;
ImageView facebook_invite, drawer, imageView, notification, search;
ArrayList<Model_profile> Array_user = new ArrayList<>();
LinearLayout llmybean;
TextView upload_count, noti_count;
CallbackManager callbackManager;
AppInviteDialog appInviteDialog;
String image_url = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_notification);
pref = new Pref_Master(context);
obj_dialog = new Activity_indicator(context);
notext = (TextView) findViewById(R.id.notext);
list_notification = (ListView) findViewById(R.id.list_notification);
adapter = new Adapter_Notification_list(context, array, pref);
obj_dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
FacebookSdk.sdkInitialize(context);
callbackManager = CallbackManager.Factory.create();
Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
if (targetUrl != null) {
Log.i("Activity", "App Link Target URL: " + targetUrl.toString());
}
list_notification.setAdapter(adapter);
upload_count = (TextView) findViewById(R.id.upload_count);
noti_count = (TextView) findViewById(R.id.noti_count);
imageView = (ImageView) findViewById(R.id.imageView);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Notification_activity.this, Home_Social.class);
intent.putExtra("fragmentcode", Configr.Fragment_ID.MainFragment);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});
notification = (ImageView) findViewById(R.id.notification);
search = (ImageView) findViewById(R.id.search);
search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Notification_activity.this, Search_activity.class);
startActivity(intent);
finish();
}
});
facebook_invite = (ImageView) findViewById(R.id.facebook_invite);
facebook_invite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
open_dialog();
}
});
drawer = (ImageView) findViewById(R.id.drawer);
drawer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Notification_activity.this, My_profile_activity.class);
startActivity(intent);
finish();
}
});
llmybean = (LinearLayout) findViewById(R.id.llmybean);
llmybean.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Notification_activity.this, My_Beans_Activity_new.class);
startActivity(intent);
finish();
}
});
Myapplication.getInstance().trackScreenView("Notification Screen");
beans_Count();
}
public void open_dialog() {
appInviteDialog = new AppInviteDialog(this);
appInviteDialog.registerCallback(callbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
@Override
public void onSuccess(AppInviteDialog.Result result) {
Fb_invites_beans.beans_Count(context, obj_dialog, pref, Array_user);
Log.d("Succes", "Success");
}
@Override
public void onCancel() {
Log.d("Result", "Cancelled");
}
@Override
public void onError(FacebookException exception) {
Log.d("Result", "Error " + exception.getMessage());
}
});
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(Configr.app_link)
.setPreviewImageUrl(image_url)
.build();
appInviteDialog.show(content);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onBackPressed() {
super.onBackPressed();
Intent i = new Intent(Notification_activity.this, Home_Social.class);
i.putExtra("fragmentcode", Configr.Fragmentt_ID.Main);
startActivity(i);
finish();
}
@Override
public void onResume() {
//obj_dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
super.onResume();
array.clear();
Model_notification model = new Model_notification();
model.setLimit("0");
array_j.add(model);
get_notification();
beans_Count();
}
public void get_notification() {
obj_dialog.show();
String url = Configr.app_url + "getnotification";
String json = "";
json = JSON.json_notification(array_j, pref, "getnotification");
HashMap<String, String> param = new HashMap<>();
param.put("data", json);
Response.Listener<String> lis_pat = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Response", response);
obj_dialog.dismiss();
try {
JSONObject jobj = new JSONObject(response);
String res_flag = jobj.getString("status");
String res_msg = jobj.getString("message");
if (res_flag.equals("200")) {
JSONArray jarray = new JSONArray(jobj.getString("data"));
for (int i = 0; i < jarray.length(); i++) {
Model_notification model = new Model_notification();
JSONObject jobj1 = jarray.getJSONObject(i);
Log.e("Naughty id", jobj1.getString("notification_id"));
model.setNoti_id(jobj1.getString("notification_id"));
model.setDesc(jobj1.getString("desc"));
model.setProfile(jobj1.getString("propic"));
model.setTime(jobj1.getString("time"));
model.setNoti_status(jobj1.getString("notification_status"));
model.setUserid(jobj1.getString("userid"));
Log.e("Postuserid-->", jobj1.getString("userid"));
if (jobj1.has("postid")) {
model.setPostid(jobj1.getString("postid"));
} else {
model.setPostid("");
}
array.add(model);
Log.e("array_sizeee", "" + array.size());
}
adapter.notifyDataSetChanged();
flag_loading = false;
if (array.size() == 0) {
notext.setVisibility(View.VISIBLE);
list_notification.setVisibility(View.GONE);
} else {
notext.setVisibility(View.GONE);
list_notification.setVisibility(View.VISIBLE);
}
} else {
if (array.size() == 0) {
notext.setVisibility(View.VISIBLE);
list_notification.setVisibility(View.GONE);
} else {
notext.setVisibility(View.GONE);
list_notification.setVisibility(View.VISIBLE);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
};
Response.ErrorListener lis_error = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// signup.setClickable(true);
obj_dialog.dismiss();
Toast.makeText(context, "" + Configr.Message, Toast.LENGTH_SHORT).show();
}
};
Connection.postconnection(url, param, Configr.getHeaderParam(), context, lis_pat, lis_error);
}
public void beans_Count() {
obj_dialog.show();
String url = Configr.app_url + "beanscount";
String json = "";
json = JSON.add(Array_user, pref, "beanscount");
HashMap<String, String> param = new HashMap<>();
param.put("data", json);
Response.Listener<String> lis_pat = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Response", response);
obj_dialog.dismiss();
String toastMsg = "";
toastMsg = "";
try {
JSONObject jobj = new JSONObject(response);
String res_flag = jobj.getString("status");
String res_msg = jobj.getString("message");
String otp = "", userid = "";
if (res_flag.equals("200")) {
JSONArray jarray = new JSONArray(jobj.getString("data"));
Array_user.clear();
for (int i = 0; i < jarray.length(); i++) {
Model_profile model = new Model_profile();
JSONObject jobj1 = jarray.getJSONObject(i);
model.setBeans(jobj1.getString("beans"));
model.setNoti_count(jobj1.getString("notification"));
image_url = jobj1.getString("url");
if (model.getNoti_count().equals("0")) {
noti_count.setVisibility(View.GONE);
} else {
noti_count.setVisibility(View.VISIBLE);
noti_count.setText(jobj1.getString("notification"));
}
upload_count.setText(jobj1.getString("beans"));
// noti_count.setText(jobj1.getString("notification"));
Array_user.add(model);
}
} else {
DialogBox.alert_popup(context, res_msg);
}
} catch (Exception e) {
e.printStackTrace();
}
}
};
Response.ErrorListener lis_error = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// signup.setClickable(true);
obj_dialog.dismiss();
Toast.makeText(context, "" + Configr.Message, Toast.LENGTH_SHORT).show();
}
};
Connection.postconnection(url, param, Configr.getHeaderParam(), context, lis_pat, lis_error);
}
}
| true
|
09a1a761ce81ca1ef64432c2f8f8fe2c96d3fa17
|
Java
|
cha63506/CompSecurity
|
/Entertainment/xfinity_source/src/com/github/ignition/support/cache/CachedModel.java
|
UTF-8
| 1,018
| 1.914063
| 2
|
[] |
no_license
|
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.github.ignition.support.cache;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.IOException;
public abstract class CachedModel
implements Parcelable
{
private String id;
private long transactionId;
public CachedModel()
{
transactionId = 0x8000000000000000L;
}
public CachedModel(Parcel parcel)
throws IOException
{
transactionId = 0x8000000000000000L;
readFromParcel(parcel);
}
public int describeContents()
{
return 0;
}
public void readFromParcel(Parcel parcel)
throws IOException
{
id = parcel.readString();
transactionId = parcel.readLong();
}
public void writeToParcel(Parcel parcel, int i)
{
parcel.writeString(id);
parcel.writeLong(transactionId);
}
}
| true
|
12cc0c4dfef16d697fcf7931d2a91a7ee6b3e389
|
Java
|
leonlibraries/LeetCode
|
/1223. Dice Roll Simulation/Solution.java
|
UTF-8
| 3,442
| 3.34375
| 3
|
[] |
no_license
|
class Solution {
private static final long MOD = 1_000_000_000L + 7;
public static void main(String[] args) {
Solution s = new Solution();
int n = 30;
int[] rollMax = new int[]{2, 3, 1, 2, 1, 2};
System.out.println("sum=" + s.dieSimulator(n, rollMax));
}
/**
* 有一个骰子模拟器会每次投掷的时候生成一个 1 到 6 的随机数。
*
* 不过我们在使用它时有个约束,就是使得投掷骰子时,连续 掷出数字 i 的次数不能超过 rollMax[i](i 从 1 开始编号)。
*
* 现在,给你一个整数数组 rollMax 和一个整数 n,请你来计算掷 n 次骰子可得到的不同点数序列的数量。
*
* 假如两个序列中至少存在一个元素不同,就认为这两个序列是不同的。由于答案可能很大,所以请返回 模 10^9 + 7 之后的结果。
*
*
* @param n 1 <= n <= 5000
* @param rollMax 1 <= rollMax[i] <= 15 && rollMax.length == 6
* @return
*/
public int dieSimulator(int n, int[] rollMax) {
long[][] dp = new long[7][n + 1];
for (int i = 0; i < n; i++) {
dp = bfs(dp, i, n, rollMax);
}
return (int) (sum(dp) % MOD);
}
/**
* 我们假设 0<k<N
*
*
* 设第 k 次 摇骰子函数 U(x,y) 次数
*
* 第一次 第二次
*
* U(1,1)=1 => U(1,2) x (假设 rollMax[1]=1)
* U(2,1) 1
* U(3,1) 1
* U(4,1) 1
* U(5,1) 1
* U(6,1) 1
*
* U(2,1)=1 => U(1,1) 1
* U(2,2) x (假设 rollMax[2]=1)
* U(3,1) 1 (和上面合并)
* U(4,1) 1 (和上面合并)
* U(5,1) 1 (和上面合并)
* U(6,1) 1
*
* U(3,1)=1 ...
* U(4,1)=1 ...
* U(5,1)=1 ...
* U(6,1)=1 ...
*
* @param dp
* @param n
* @param rollMax
* @return
*/
private long[][] bfs(long[][] dp, int i, int n, int[] rollMax) {
if (i == 0) {
for (int j = 1; j <= 6; j++) {
dp[j][1] = 1;
}
return dp;
}
long[][] newDp = new long[7][n + 1];
for (int j = 1; j <= 6; j++) {
long[] fn = dp[j];
for (int k = 1; k < fn.length; k++) {
if (fn[k] > 0) {
split(newDp, j, k, fn[k], rollMax);
}
}
}
return newDp;
}
/**
* 展开
*
* @param dp
* @param ln lastNum
* @param lrt lastRepeatTimes
* @param p
* @param rollMax
*/
private void split(long[][] dp, int ln, int lrt, long p, int[] rollMax) {
boolean breakOut = lrt >= rollMax[ln - 1];
for (int j = 1; j <= 6; j++) {
if (j == ln) {
dp[j][lrt + 1] += breakOut ? 0 : p;
dp[j][lrt + 1] = dp[j][lrt + 1] % MOD;
} else {
dp[j][1] += p;
dp[j][1] = dp[j][1] % MOD;
}
}
}
/**
* 汇总
*
* @param dp
* @return
*/
private long sum(long[][] dp) {
long sum = 0L;
for (long[] item : dp) {
for (long value : item) {
sum += value;
}
}
return sum;
}
}
| true
|
e4ce30048c7ecd04c3e570b220f2b75c1d42344d
|
Java
|
augustocardoso07/learning
|
/MOOCs/Algorithms Part I/week2/src/Permutation.java
|
UTF-8
| 866
| 2.890625
| 3
|
[] |
no_license
|
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;
public class Permutation {
public static void main(String[] args) {
int k = 0;
if (args.length == 1) {
k = Integer.parseInt(args[0]);
}
RandomizedQueue<String> q = new RandomizedQueue<String>();
double i = 0;
while (!StdIn.isEmpty() && k != 0) {
String word = StdIn.readString();
if (q.size() == k) {
i++;
double p = StdRandom.uniform();
if (p <= k/(k + i)) {
q.dequeue();
q.enqueue(word);
}
} else {
q.enqueue(word);
}
}
for (String var : q) {
StdOut.println(var);
}
}
}
| true
|
92aef2e7764398d900cf2ef433b41fe1cba2c4b3
|
Java
|
deepcrawler/TVStreamerLib
|
/core/src/com/TVCastLib/device/DevicePickerAdapter.java
|
UTF-8
| 2,673
| 2.296875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.TVCastLib.device;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.TVCastLib.discovery.DiscoveryManager;
import java.util.HashMap;
public class DevicePickerAdapter extends ArrayAdapter<ConnectableDevice> {
int resource, textViewResourceId, subTextViewResourceId;
HashMap<String, ConnectableDevice> currentDevices = new HashMap<String, ConnectableDevice>();
Context context;
DevicePickerAdapter(Context context) {
this(context, android.R.layout.simple_list_item_2);
}
DevicePickerAdapter(Context context, int resource) {
this(context, resource, android.R.id.text1, android.R.id.text2);
}
DevicePickerAdapter(Context context, int resource, int textViewResourceId, int subTextViewResourceId) {
super(context, resource, textViewResourceId);
this.context = context;
this.resource = resource;
this.textViewResourceId = textViewResourceId;
this.subTextViewResourceId = subTextViewResourceId;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if (convertView == null) {
view = View.inflate(getContext(), resource, null);
}
ConnectableDevice device = this.getItem(position);
//
String text;
if (device.getFriendlyName() != null) {
text = device.getFriendlyName();
}
else {
text = device.getModelName();
}
view.setBackgroundColor(Color.BLACK);
TextView textView = (TextView) view.findViewById(textViewResourceId);
textView.setText(text);
textView.setTextColor(Color.WHITE);
boolean isDebuggable = (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
boolean hasNoFilters = DiscoveryManager.getInstance().getCapabilityFilters().size() == 0;
String serviceNames = device.getConnectedServiceNames();
boolean hasServiceNames = (serviceNames != null && serviceNames.length() > 0);
boolean shouldShowServiceNames = false;//hasServiceNames && (isDebuggable || hasNoFilters);
TextView subTextView = (TextView) view.findViewById(subTextViewResourceId);
if (shouldShowServiceNames) {
subTextView.setText(serviceNames);
subTextView.setTextColor(Color.WHITE);
} else {
subTextView.setText(null);
}
return view;
}
}
| true
|
c80639154afabc7ad2b0a7685145c13225088d00
|
Java
|
SessionK2/Project01
|
/Module01/src/com/zs/test/provider.java
|
UTF-8
| 951
| 2.6875
| 3
|
[] |
no_license
|
package com.zs.test;
import java.util.ArrayList;
/**
* @author zhangsen
* @date 2020/4/22 17:37
* @remark
*/
public class provider {
/*public static void main(String[] args) {
System.out.println("hello!");
String straaa = new String();
int aa = straaa.length();
Date date = new Date();
}
public static void main(String[] args) {
}*/
public static void main(String[] args) {
String[] str = new String[]{"sen","zhang","qin"};
//inf
if (str == null) {
}
//inn
if (str != null) {
}
ArrayList<String> list = new ArrayList<>();
/*//list.for
for (String s : list) {
}
//list.fori
for (int i = 0; i < list.size(); i++) {
}
//list.forr
for (int i = list.size() - 1; i >= 0; i--) {
}*/
}
}
| true
|
a151f810f55d843a6774332153cdbc3683ac732e
|
Java
|
mattssonj/will-it-rain
|
/src/main/java/com/willitrain/app/Meteorologist.java
|
UTF-8
| 729
| 2.640625
| 3
|
[] |
no_license
|
package com.willitrain.app;
import org.json.JSONArray;
import org.json.JSONObject;
public class Meteorologist {
private String forecastData;
public Meteorologist(String forecastData) {
this.forecastData = forecastData;
}
public boolean willItRain() {
JSONObject json = new JSONObject(forecastData);
JSONArray array = json.getJSONArray("list");
for (int i = 0; i < 8; i++) {
JSONObject currentInterval = array.getJSONObject(i);
JSONArray weatherInfo = currentInterval.getJSONArray("weather");
if (weatherInfo.getJSONObject(0).get("main").equals("Rain")) {
return true;
}
}
return false;
}
}
| true
|
6e7dc2594c3ae99e34108dfcebe5de7489faa95e
|
Java
|
RepositorySaving/hylex-core
|
/src/main/java/com/uzm/hylex/core/party/BukkitParty.java
|
UTF-8
| 604
| 2.4375
| 2
|
[] |
no_license
|
package com.uzm.hylex.core.party;
import com.uzm.hylex.core.api.party.Party;
import com.uzm.hylex.core.api.party.PartyPlayer;
import org.bukkit.entity.Player;
import java.util.HashSet;
public class BukkitParty extends Party {
private HashSet<Player> lockedOnParty = new HashSet<>();
public BukkitParty(String leader) {
super(leader, 0);
}
@Override
public PartyPlayer buildPlayer(String name) {
return new BukkitPartyPlayer(name);
}
@Override
public void delete()
{
this.destroy();
}
public HashSet<Player> getLockedOnParty() {
return lockedOnParty;
}
}
| true
|
77908b60fcc5538d9277a3f49c8bbd2625152ec1
|
Java
|
TomaszPiotrowicz/kurs
|
/src/main/java/main/java/pl/com/tomasz/kuchnia/java14/Stringtest/String_test.java
|
UTF-8
| 1,643
| 3.21875
| 3
|
[] |
no_license
|
package main.java.pl.com.tomasz.kuchnia.java14.Stringtest;
public class String_test {
//TODO :SHOWE REFERENCWz
public static void main(String[] args) {
String name = "Tomasz";
String theSame = name;
String secondName = new String ("Tomasz");
String surname = "Piotrowicz";
System.out.println("My name: + name");
System.out.println("My surname : + Piotrowicz");
System.out.println("name, number of letters:" + name.length());
System.out.println( "Surmane, Number of letters : " + surname.length());
// System.out.println("Chat at index 6:" + name.charAt(6
// ));
// System.out.println("Chat at index 7" + name.charAt(7));
System.out.println( "Chat at index 1" + name.charAt(1
));
System.out.println("My new surname:" + surname.substring(2,5));
String newTheSame = theSame.replace('a', 'o');
System.out.println("Replace:" + theSame.replace ( 'a','o' ));
System.out.println("My surname :" + newTheSame);
System.out.println("my name : " + name);
System.out.println("theSame: " + theSame);
String hello = "hello";
System.out.println(hello + "java");
hello = hello + "java";
System.out.println(hello);
System.out.println(5+6);
System.out.println("5 + 6 :" + (5+6)) ;
System.out.println(5+6+ "-5+6");
System.out.println("5+6 :" + 5+6);
System.out.println("J" + 7);
System.out.println('J' + 7);
// wywołuje wartość liczbową j
System.out.println('J');
System.out.println((int)'J');
}
}
| true
|
b91f929aac71ea685bb40ea9b79d0df162654992
|
Java
|
eunjiChung/SW_22
|
/UI/java/hello22/hellochat/ChatListActivity.java
|
UTF-8
| 1,342
| 2.46875
| 2
|
[] |
no_license
|
package hello22.hellochat;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class ChatListActivity extends AppCompatActivity {
//친구창의 리스트뷰와 비슷하게
//이벤트 : click -> 채팅룸이동
//이벤트 : longclick -> 채팅룸을 삭제할까요? 팝업창 -> yes 선택 시 채팅방에서 퇴장 후, 채팅리스트에서 삭제
private long lastTimeBackPressed;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat_list);
}
public void ClickFriendButton(View v)
{
Intent intent = new Intent(this,FriendListActivity.class);
startActivity(intent);
}
public void ClickSettingButton(View v)
{
Intent intent = new Intent(this,SettingActivity.class);
startActivity(intent);
}
@Override
public void onBackPressed()
{
if(System.currentTimeMillis() - lastTimeBackPressed < 1500) {
finish();
return;
}
Toast.makeText(this, "Back Button Double Click, System Exit.",Toast.LENGTH_SHORT).show();
lastTimeBackPressed = System.currentTimeMillis();
}
}
| true
|
1abc4a149d4235d4ed236527ffae7159d62cc3e2
|
Java
|
cfischera/APCS
|
/Data Structures/src/Tree.java
|
UTF-8
| 6,499
| 3.671875
| 4
|
[
"MIT"
] |
permissive
|
/**
* This Tree Class implements a Binary Search Tree
* Interface which stores data in a fashion so that
* all values less than the root are stored on the left,
* and all the values greater are stored on the right.
* @author ColinFischer
* Date Last Modified: 7 February 2017
*/
public class Tree implements BSTree
{
private TreeNode root;
/**
* This constructor creates an empty Tree.
*/
public Tree()
{
root = null;
}
/**
* Adds a TreeNode to the Tree Object.
*/
public void add(Comparable c)
{
root = add(root, c);
}
/**
* Private helper to add a TreeNode to the Tree recursively.
*/
private TreeNode add(TreeNode r, Comparable c)
{
if (r==null)
r = new TreeNode(c, null, null);
else
if (c.compareTo((Comparable)(r.getValue()))<0)
r.setLeftChild(add(r.getLeftChild(), c));
else
r.setRightChild(add(r.getRightChild(), c));
return r;
}
/**
* Searches for a specific element in the Tree.
*/
public boolean search(Comparable c)
{
return search(c, root);
}
/**
* Private helper to search for a value recursively.
*/
private boolean search(Comparable c, TreeNode r)
{
if (r==null)
return false;
else
{
if(c.equals((Comparable)r.getValue()))
return true;
else
return (search(c, r.getLeftChild())
|| search(c, r.getRightChild()));
}
}
/**
* Returns the maximum levels of TreeNodes.
*/
public int height()
{
return height(root);
}
/**
* Private helper to return the height of the Tree.
*/
private int height(TreeNode r)
{
if(r==null)
return 0;
else
return 1 + Math.max(height(r.getLeftChild()),
height(r.getRightChild()));
}
/**
* Converts the values contained in a Tree into a
* String in order from Parent, LeftChild, RightChild.
*/
public String toStringPreOrder()
{
if(root==null)
return "Tree is empty.";
else
return toStringPreOrder(root);
}
/**
* Private helper to convert values in the Tree to String
* in order from Parent, LeftChild, RightChild.
*/
private String toStringPreOrder(TreeNode r)
{
if(r==null)
return "";
else
return "( "+r.getValue()+
" "+toStringPreOrder
(r.getLeftChild())+
toStringPreOrder
(r.getRightChild())+")";
}
/**
* Converts the values contained in a Tree into a
* String in order from LeftChild, Parent, RightChild.
*/
public String toStringInOrder()
{
if(root==null)
return "Tree is empty.";
else
return toStringInOrder(root);
}
/**
* Private helper to convert values in the Tree to String
* in order from LeftChild, Parent, RightChild.
*/
private String toStringInOrder(TreeNode r)
{
if(r==null)
return "";
else
return "("+toStringInOrder
(r.getLeftChild())+
" "+ r.getValue()+
" "+ toStringInOrder
(r.getRightChild())+")";
}
/**
* Removes a TreeNode with the passed value.
*/
public void remove(Comparable c)
{
remove(c, root);
}
/**
* Private recursive method that removes TreeNodes depending
* on how many children they have.
*/
private void remove(Comparable c, TreeNode r)
{
TreeNode delNode = findDelNode(c, r);
TreeNode delParent = findDelParent(c, r);
boolean isLeftChild = false;
if(delParent.getLeftChild()==delNode)
isLeftChild = true;
if(delNode.getLeftChild()==null
&&delNode.getRightChild()==null)
{
if(delNode==root)
root = null;
else
{
if(isLeftChild)
delParent.setLeftChild(null);
else
delParent.setRightChild(null);
}
}
else if(delNode.getLeftChild()==null
||delNode.getRightChild()==null)
{
if(delNode==root)
{
if(delNode.getLeftChild()==null)
{
if(root.getLeftChild()!=null)
root = root.getLeftChild();
else
root = root.getRightChild();
}
}
else
{
if(delNode.getLeftChild()==null)
{
if(isLeftChild)
delParent.setLeftChild(delNode.getRightChild());
else
delParent.setRightChild(delNode.getLeftChild());
}
}
}
else
{
TreeNode smallRight = findSmallRight(delNode);
TreeNode parentRight = findParentRight(delNode);
remove(smallRight.getValue(), parentRight);
if(delNode==root)
{
root = smallRight;
}
else
{
if(isLeftChild)
delParent.setLeftChild(smallRight);
else
delParent.setRightChild(smallRight);
}
smallRight.setLeftChild(delNode.getLeftChild());
if(delNode.getRightChild()!=smallRight)
smallRight.setRightChild(delNode.getRightChild());
}
}
/**
* Returns the TreeNode that is to be deleted.
*/
private TreeNode findDelNode(Comparable c, TreeNode r)
{
TreeNode t = null;
if(search(c))
{
t = r;
while(!t.getValue().equals(c))
{
if(t.getValue().compareTo(c)<0)
t = t.getRightChild();
else
t = t.getLeftChild();
}
}
return t;
}
/**
* Returns the parent of the TreeNode that is to be deleted.
*/
private TreeNode findDelParent(Comparable c, TreeNode r)
{
TreeNode t = null;
TreeNode p = null;
if(search(c))
{
t = r;
if(t.getValue().equals(c)
||t.getLeftChild().getValue().equals(c)
||t.getRightChild().getValue().equals(c))
return t;
else
{
if(t.getValue().compareTo(c)<0)
t = t.getRightChild();
else
t = t.getLeftChild();
}
while(!t.getValue().equals(c))
{
p = t;
if(t.getValue().compareTo(c)<0)
t = t.getRightChild();
else
t = t.getLeftChild();
}
}
return p;
}
/**
* Returns the least valued TreeNode in the right subtree
* of the TreeNode that is to be deleted.
*/
private TreeNode findSmallRight(TreeNode d)
{
TreeNode s = d.getRightChild();
while(s.getLeftChild()!=null)
s = s.getLeftChild();
return s;
}
/**
* Returns the parent of the least valued TreeNode in the right
* subtree of the TreeNode that is to be deleted.
*/
private TreeNode findParentRight(TreeNode d)
{
TreeNode s = d.getRightChild();
TreeNode p = s;
if(s.getLeftChild()!=null)
s = s.getLeftChild();
while(s.getLeftChild()!=null)
{
p = s;
s = s.getLeftChild();
}
return p;
}
}
| true
|
39b796ca261ad1c142e4c326e61373321a9101be
|
Java
|
nicolaemorcov/haircut-app-1
|
/commons/src/main/java/com/commons/manager/objectmanagers/ObjectManagerContext.java
|
UTF-8
| 812
| 2.171875
| 2
|
[] |
no_license
|
package com.commons.manager.objectmanagers;
import java.util.List;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
public interface ObjectManagerContext {
public void persist(Object o);
public void merge(Object o);
<E extends Object> E getSingleResult(Class<E> entityClass,
String sql, Object... args);
<E extends Object> List<E> getResultList(Class<E> entityClass,
String sql, Object... args);
<E extends Object> TypedQuery<E> createQuery(String sql, Class<E> entityClass);
<E extends Object> TypedQuery<E> createQuery(String sql);
public void executeQuery(Query query);
public void executeUpdate(String sql, Object... args);
// public void delete(Class<?> type, Serializable id);
public void delete(Object o);
public Query createNaticeQuery(String sql);
}
| true
|
7453f0b000a7a1b566aa55b203d11b91cfe775d9
|
Java
|
Qijian-Gan/RealtimeDataManagement
|
/target/generated-sources/cxf/org/tmdd/_303/messages/ResponsePlanLogDetails.java
|
UTF-8
| 7,568
| 1.554688
| 2
|
[] |
no_license
|
package org.tmdd._303.messages;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
/**
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><objectClass xmlns="http://www.tmdd.org/303/messages" xmlns:c2c="http://www.ntcip.org/c2c-message-administration" xmlns:itis="http://www.ITIS-Adopted-03-00-02" xmlns:lrms="http://www.LRMS-Adopted-02-00-00" xmlns:ntcip="http://www.ntcip.org/c2f-object-references" xmlns:xs="http://www.w3.org/2001/XMLSchema">ResponsePlan</objectClass>
* </pre>
*
*
* <p>Java class for ResponsePlanLogDetails complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ResponsePlanLogDetails">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="command-status" type="{http://www.tmdd.org/303/messages}Response-plan-command-status"/>
* <element name="object-type" type="{http://www.tmdd.org/303/messages}Response-plan-command-object-type"/>
* <element name="object-id" type="{http://www.tmdd.org/303/messages}Organization-resource-identifier"/>
* <element name="command-text" type="{http://www.tmdd.org/303/messages}Response-plan-informational-text"/>
* <element name="command-acknowledgement-text" type="{http://www.tmdd.org/303/messages}Response-plan-informational-text"/>
* <element name="command-sent-time" type="{http://www.tmdd.org/303/messages}DateTimeZone" minOccurs="0"/>
* <element name="acknowledgement-received-time" type="{http://www.tmdd.org/303/messages}DateTimeZone" minOccurs="0"/>
* <any processContents='lax' namespace='##other' minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponsePlanLogDetails", propOrder = {
"commandStatus",
"objectType",
"objectId",
"commandText",
"commandAcknowledgementText",
"commandSentTime",
"acknowledgementReceivedTime",
"any"
})
public class ResponsePlanLogDetails
implements Serializable
{
private final static long serialVersionUID = -1L;
@XmlElement(name = "command-status", required = true)
@XmlSchemaType(name = "anySimpleType")
protected String commandStatus;
@XmlElement(name = "object-type", required = true)
@XmlSchemaType(name = "anySimpleType")
protected String objectType;
@XmlElement(name = "object-id", required = true)
protected String objectId;
@XmlElement(name = "command-text", required = true)
protected String commandText;
@XmlElement(name = "command-acknowledgement-text", required = true)
protected String commandAcknowledgementText;
@XmlElement(name = "command-sent-time")
protected DateTimeZone commandSentTime;
@XmlElement(name = "acknowledgement-received-time")
protected DateTimeZone acknowledgementReceivedTime;
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the commandStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCommandStatus() {
return commandStatus;
}
/**
* Sets the value of the commandStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCommandStatus(String value) {
this.commandStatus = value;
}
/**
* Gets the value of the objectType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getObjectType() {
return objectType;
}
/**
* Sets the value of the objectType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setObjectType(String value) {
this.objectType = value;
}
/**
* Gets the value of the objectId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getObjectId() {
return objectId;
}
/**
* Sets the value of the objectId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setObjectId(String value) {
this.objectId = value;
}
/**
* Gets the value of the commandText property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCommandText() {
return commandText;
}
/**
* Sets the value of the commandText property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCommandText(String value) {
this.commandText = value;
}
/**
* Gets the value of the commandAcknowledgementText property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCommandAcknowledgementText() {
return commandAcknowledgementText;
}
/**
* Sets the value of the commandAcknowledgementText property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCommandAcknowledgementText(String value) {
this.commandAcknowledgementText = value;
}
/**
* Gets the value of the commandSentTime property.
*
* @return
* possible object is
* {@link DateTimeZone }
*
*/
public DateTimeZone getCommandSentTime() {
return commandSentTime;
}
/**
* Sets the value of the commandSentTime property.
*
* @param value
* allowed object is
* {@link DateTimeZone }
*
*/
public void setCommandSentTime(DateTimeZone value) {
this.commandSentTime = value;
}
/**
* Gets the value of the acknowledgementReceivedTime property.
*
* @return
* possible object is
* {@link DateTimeZone }
*
*/
public DateTimeZone getAcknowledgementReceivedTime() {
return acknowledgementReceivedTime;
}
/**
* Sets the value of the acknowledgementReceivedTime property.
*
* @param value
* allowed object is
* {@link DateTimeZone }
*
*/
public void setAcknowledgementReceivedTime(DateTimeZone value) {
this.acknowledgementReceivedTime = value;
}
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
* {@link Element }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
* {@link Element }
*
*/
public void setAny(Object value) {
this.any = value;
}
}
| true
|
4af6f3cdfa6f416b0aacdab70f087375bbdd8033
|
Java
|
dstmath/OppoR15
|
/app/src/main/java/java/security/GeneralSecurityException.java
|
UTF-8
| 424
| 2.421875
| 2
|
[] |
no_license
|
package java.security;
public class GeneralSecurityException extends Exception {
private static final long serialVersionUID = 894798122053539237L;
public GeneralSecurityException(String msg) {
super(msg);
}
public GeneralSecurityException(String message, Throwable cause) {
super(message, cause);
}
public GeneralSecurityException(Throwable cause) {
super(cause);
}
}
| true
|
9ea5a2636f0046121239cf4de7cb3bdad117e6a4
|
Java
|
cnvdya/IMEAPro
|
/IEP-Webapp/src/main/java/edu/sjsu/ieptracker/dto/GuardianDto.java
|
UTF-8
| 1,481
| 2.21875
| 2
|
[] |
no_license
|
package edu.sjsu.ieptracker.dto;
import java.io.Serializable;
public class GuardianDto implements Serializable{
private String guardianName;
private String relation;
private String contactNo;
private String address;
private String primaryContact;
private String createDate;
private int studentID;
public String getGuardianName() {
return guardianName;
}
public void setGuardianName(String guardianName) {
this.guardianName = guardianName;
}
public int getStudentID() {
return studentID;
}
public void setStudentID(int studentID) {
this.studentID = studentID;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
public String getContactNo() {
return contactNo;
}
public void setContactNo(String contactNo) {
this.contactNo = contactNo;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPrimaryContact() {
return primaryContact;
}
public void setPrimaryContact(String primaryContact) {
this.primaryContact = primaryContact;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
}
| true
|
8695e989a1a70c19cb425e42303591e5eb7b30fc
|
Java
|
WeiTianLiang/Foursage-
|
/app/src/main/java/com/example/wtl/foursage20/Adapter/All_Act_Adapter.java
|
UTF-8
| 7,728
| 1.953125
| 2
|
[] |
no_license
|
package com.example.wtl.foursage20.Adapter;
/**
* 所有活动适配器
* Created by WTL on 2018/3/7.
*/
import android.content.Context;
import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.wtl.foursage20.Activity.DetailsActActivity;
import com.example.wtl.foursage20.Activity.EditActActivity;
import com.example.wtl.foursage20.Activity.MainActivity;
import com.example.wtl.foursage20.Class.Act;
import com.example.wtl.foursage20.R;
import com.example.wtl.foursage20.Tool.Drop_Down_Dialog;
import com.example.wtl.foursage20.Tool.Good_Animation;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
public class All_Act_Adapter extends RecyclerView.Adapter<All_Act_Adapter.ViewHolder>{
private List<Act> actList;//创建列表
private Context context;
private Drop_Down_Dialog dropDownDialog;
//创建引用函数
public All_Act_Adapter(List<Act> actlist,Context context) {
this.actList = actlist;
this.context = context;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
/*从context中获取一个布局填充器将xml转换成view*/
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.act_card,parent,false);
/*将view赋给viewHolder对象*/
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(final ViewHolder holder,final int position) {
/*指向当前选中位置*/
Act act = actList.get(position);
/*添加数据*/
holder.acter_head.setImageResource(act.getActer_head());
holder.acter_name.setText(act.getActer_name());
holder.acter_sex.setImageResource(act.getActer_sex());
holder.acter_age.setText(act.getActer_age());
holder.acter_city.setText(act.getActer_city());
holder.acter_university.setText(act.getActer_university());
holder.send_time.setText(act.getSend_time());
holder.act_name.setText(act.getAct_name());
holder.act_type.setText(act.getAct_type());
holder.act_begin_time.setText(act.getAct_begin_time());
holder.act_place.setText(act.getAct_place());
holder.now_people_number.setText(act.getNow_people_number());
holder.all_people_number.setText(act.getAll_people_number());
holder.join_head.setImageResource(act.getJoin_head());
holder.look_number.setText(act.getLook_number());
holder.act_good_num.setText(act.getAct_good_num());
holder.act_message_num.setText(act.getAct_message_num());
/*实现下拉框*/
holder.drop_down_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dropDownDialog = new Drop_Down_Dialog(context);
dropDownDialog.show();
Window window = dropDownDialog.getWindow();
window.setGravity(Gravity.CENTER);
dropDownDialog.setdeleteOnClickListener(new Drop_Down_Dialog.ondeleteOnClickListener() {
@Override
public void ondeleteClick() {
delete(position);
dropDownDialog.dismiss();
}
});
}
});
/*实现点赞评论*/
holder.act_good.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(holder.act_good.getDrawable().getCurrent().getConstantState().equals(context.getResources().getDrawable(R.mipmap.act_good).getConstantState())) {
holder.act_good.setImageResource(R.mipmap.touch_act_good);
Good_Animation.Enlarge(holder.act_good);
} else {
holder.act_good.setImageResource(R.mipmap.act_good);
}
}
});
holder.detailed_act.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, DetailsActActivity.class);
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return actList.size();
}
//删除节点
public void delete(int postion) {
actList.remove(postion);
notifyItemRemoved(postion);
notifyItemRangeChanged(postion, actList.size() - postion);
}
static class ViewHolder extends RecyclerView.ViewHolder {
/*获取数据的*/
CircleImageView acter_head;//活动发送者头像
TextView acter_name;//活动发送者名字
ImageView acter_sex;//活动发送者性别
TextView acter_age;//活动发送者年龄
TextView acter_city;//活动发送者所在城市
TextView acter_university;//活动发送者所在学校
TextView send_time;//活动发送的时间
TextView act_name;//当前活动的名称
TextView act_type;//当前活动的类型
TextView act_begin_time;//当前活动开始时间
TextView act_place;//当前活动的地址
TextView now_people_number;//已报名人数
TextView all_people_number;//活动的最大人数
CircleImageView join_head;//参加人的头像
TextView look_number;//浏览次数
TextView act_good_num;//点赞次数
TextView act_message_num;//评论次数
/*实现功能的*/
ImageView act_good;//点赞
ImageView drop_down_img;//下拉框图标
LinearLayout detailed_act;//进入详情
public ViewHolder(View view) {
super(view);
acter_head = (CircleImageView) view.findViewById(R.id.acter_head);
acter_name = (TextView) view.findViewById(R.id.acter_name);
acter_sex = (ImageView) view.findViewById(R.id.acter_sex);
acter_age = (TextView) view.findViewById(R.id.acter_age);
acter_city = (TextView) view.findViewById(R.id.acter_city);
acter_university = (TextView) view.findViewById(R.id.acter_university);
send_time = (TextView) view.findViewById(R.id.send_time);
act_name = (TextView) view.findViewById(R.id.act_name);
act_type = (TextView) view.findViewById(R.id.act_type);
act_begin_time = (TextView) view.findViewById(R.id.act_begin_time);
act_place = (TextView) view.findViewById(R.id.act_place);
now_people_number = (TextView) view.findViewById(R.id.now_people_number);
all_people_number = (TextView) view.findViewById(R.id.all_people_number);
join_head = (CircleImageView) view.findViewById(R.id.join_head);
look_number = (TextView) view.findViewById(R.id.look_number);
act_good_num = (TextView) view.findViewById(R.id.act_good_num);
act_message_num = (TextView) view.findViewById(R.id.act_message_num);
act_good = (ImageView) view.findViewById(R.id.act_good);
drop_down_img = (ImageView) view.findViewById(R.id.drop_down_img);
detailed_act = (LinearLayout) view.findViewById(R.id.detailed_act);
}
}
}
| true
|
c5b40b9d6a8380d415dfb3b55f94ef6908277e84
|
Java
|
lshain-android-source/tools-idea
|
/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java
|
UTF-8
| 7,630
| 1.859375
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util.indexing;
import com.intellij.openapi.vfs.InvalidVirtualFileAccessException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileWithId;
import com.intellij.openapi.vfs.newvfs.FileAttribute;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.util.containers.ConcurrentHashMap;
import com.intellij.util.io.DataInputOutputUtil;
import gnu.trove.TObjectLongHashMap;
import gnu.trove.TObjectLongProcedure;
import org.jetbrains.annotations.Nullable;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.concurrent.ArrayBlockingQueue;
/**
* @author Eugene Zhuravlev
* Date: Dec 25, 2007
*/
public class IndexingStamp {
private IndexingStamp() {
}
/**
* The class is meant to be accessed from synchronized block only
*/
private static class Timestamps {
private static final FileAttribute PERSISTENCE = new FileAttribute("__index_stamps__", 1, false);
private TObjectLongHashMap<ID<?, ?>> myIndexStamps;
private boolean myIsDirty = false;
private Timestamps(@Nullable DataInputStream stream) throws IOException {
if (stream != null) {
try {
long dominatingIndexStamp = DataInputOutputUtil.readTIME(stream);
while(stream.available() > 0) {
ID<?, ?> id = ID.findById(DataInputOutputUtil.readINT(stream));
if (id != null) {
long stamp = IndexInfrastructure.getIndexCreationStamp(id);
if (myIndexStamps == null) myIndexStamps = new TObjectLongHashMap<ID<?, ?>>(5, 0.98f);
if (stamp <= dominatingIndexStamp) myIndexStamps.put(id, stamp);
}
}
}
finally {
stream.close();
}
}
}
private void writeToStream(final DataOutputStream stream) throws IOException {
if (myIndexStamps != null && !myIndexStamps.isEmpty()) {
final long[] dominatingIndexStamp = new long[1];
myIndexStamps.forEachEntry(
new TObjectLongProcedure<ID<?, ?>>() {
@Override
public boolean execute(ID<?, ?> a, long b) {
dominatingIndexStamp[0] = Math.max(dominatingIndexStamp[0], b);
return true;
}
}
);
DataInputOutputUtil.writeTIME(stream, dominatingIndexStamp[0]);
myIndexStamps.forEachEntry(new TObjectLongProcedure<ID<?, ?>>() {
@Override
public boolean execute(final ID<?, ?> id, final long timestamp) {
try {
DataInputOutputUtil.writeINT(stream, id.getUniqueId());
return true;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
});
} else {
DataInputOutputUtil.writeTIME(stream, DataInputOutputUtil.timeBase);
}
}
public long get(ID<?, ?> id) {
return myIndexStamps != null? myIndexStamps.get(id) : 0L;
}
public void set(ID<?, ?> id, long tmst) {
try {
if (tmst < 0) {
if (myIndexStamps == null) return;
myIndexStamps.remove(id);
return;
}
if (myIndexStamps == null) myIndexStamps = new TObjectLongHashMap<ID<?, ?>>(5, 0.98f);
myIndexStamps.put(id, tmst);
}
finally {
myIsDirty = true;
}
}
public boolean isDirty() {
return myIsDirty;
}
}
private static final ConcurrentHashMap<VirtualFile, Timestamps> myTimestampsCache = new ConcurrentHashMap<VirtualFile, Timestamps>();
private static final int CAPACITY = 100;
private static final ArrayBlockingQueue<VirtualFile> myFinishedFiles = new ArrayBlockingQueue<VirtualFile>(CAPACITY);
public static boolean isFileIndexed(VirtualFile file, ID<?, ?> indexName, final long indexCreationStamp) {
try {
return getIndexStamp(file, indexName) == indexCreationStamp;
}
catch (RuntimeException e) {
final Throwable cause = e.getCause();
if (!(cause instanceof IOException)) {
throw e; // in case of IO exceptions consider file unindexed
}
}
return false;
}
public static long getIndexStamp(VirtualFile file, ID<?, ?> indexName) {
synchronized (getStripedLock(file)) {
Timestamps stamp = createOrGetTimeStamp(file);
if (stamp != null) return stamp.get(indexName);
return 0;
}
}
private static Timestamps createOrGetTimeStamp(VirtualFile file) {
if (file instanceof NewVirtualFile && file.isValid()) {
Timestamps timestamps = myTimestampsCache.get(file);
if (timestamps == null) {
final DataInputStream stream = Timestamps.PERSISTENCE.readAttribute(file);
try {
timestamps = new Timestamps(stream);
}
catch (IOException e) {
throw new RuntimeException(e);
}
myTimestampsCache.put(file, timestamps);
}
return timestamps;
}
return null;
}
public static void update(final VirtualFile file, final ID<?, ?> indexName, final long indexCreationStamp) {
synchronized (getStripedLock(file)) {
try {
Timestamps stamp = createOrGetTimeStamp(file);
if (stamp != null) stamp.set(indexName, indexCreationStamp);
}
catch (InvalidVirtualFileAccessException ignored /*ok to ignore it here*/) {
}
}
}
public static void flushCaches() {
flushCache(null);
myTimestampsCache.clear();
}
public static void flushCache(@Nullable VirtualFile finishedFile) {
if (finishedFile == null || !myFinishedFiles.offer(finishedFile)) {
VirtualFile[] files = null;
synchronized (myFinishedFiles) {
int size = myFinishedFiles.size();
if ((finishedFile == null && size > 0) || size == CAPACITY) {
files = myFinishedFiles.toArray(new VirtualFile[size]);
myFinishedFiles.clear();
}
}
if (files != null) {
for(VirtualFile file:files) {
synchronized (getStripedLock(file)) {
Timestamps timestamp = myTimestampsCache.remove(file);
if (timestamp == null) continue;
try {
if (timestamp.isDirty() && file.isValid()) {
final DataOutputStream sink = Timestamps.PERSISTENCE.writeAttribute(file);
timestamp.writeToStream(sink);
sink.close();
}
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
if (finishedFile != null) myFinishedFiles.offer(finishedFile);
}
}
private static final Object[] ourLocks = new Object[16];
static {
for(int i = 0; i < ourLocks.length; ++i) ourLocks[i] = new Object();
}
private static Object getStripedLock(VirtualFile file) {
if (!(file instanceof NewVirtualFile)) return 0;
int id = ((NewVirtualFile)file).getId();
return ourLocks[(id & 0xFF) % ourLocks.length];
}
}
| true
|
4d3f5a5bf55ac47629ba7e1df5dc9bb6f902ac54
|
Java
|
Horazon1985/MathTool
|
/src/mathtool/component/components/DevelopersDialogGUI.java
|
UTF-8
| 2,909
| 2.390625
| 2
|
[] |
no_license
|
package mathtool.component.components;
import abstractexpressions.expression.classes.Expression;
import java.awt.Color;
import java.io.IOException;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import mathtool.lang.translator.Translator;
public class DevelopersDialogGUI extends JDialog {
private static final String PATH_LOGO_MATHTOOL = "icons/MathToolLogo.png";
private static final String RESOURCE_PREFIX = "html/MathToolDevelopers";
private static final String RESOURCE_ENDING = ".html";
private static final String GUI_DevelopersDialogGUI_ABOUT = "GUI_DevelopersDialogGUI_ABOUT";
private final JEditorPane developersArea;
private final JScrollPane scrollPaneDevelopers;
private static DevelopersDialogGUI instance = null;
private DevelopersDialogGUI(int mathToolGuiX, int mathToolGuiY, int mathToolGuiWidth, int mathToolGuiHeight) {
setTitle(Translator.translateOutputMessage(GUI_DevelopersDialogGUI_ABOUT));
setLayout(null);
setResizable(false);
setAlwaysOnTop(true);
this.setBounds((mathToolGuiWidth - 505)/2 + mathToolGuiX, (mathToolGuiHeight - 530)/2 + mathToolGuiY, 505, 530);
this.getContentPane().setBackground(Color.white);
// Logo laden
JPanel panel = new JPanel();
add(panel);
panel.add(new JLabel(new ImageIcon(getClass().getResource(PATH_LOGO_MATHTOOL))));
panel.setBounds(0, -5, 500, 150);
panel.setVisible(true);
// About-Datei laden
developersArea = new JEditorPane();
developersArea.setContentType("text/html");
add(developersArea);
developersArea.setBounds(20, 170, 460, 270);
developersArea.setEditable(false);
scrollPaneDevelopers = new JScrollPane(developersArea);
scrollPaneDevelopers.setBounds(20, 170, 460, 310);
scrollPaneDevelopers.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
add(scrollPaneDevelopers);
URL helpURL = HelpDialogGUI.class.getResource(RESOURCE_PREFIX + Expression.getLanguage().toString() + RESOURCE_ENDING);
if (helpURL != null) {
try {
developersArea.setPage(helpURL);
} catch (IOException e) {
}
}
validate();
repaint();
}
public static DevelopersDialogGUI getInstance(int mathtoolGuiX, int mathtoolGuiY, int mathtoolGuiWidth, int mathtoolGuiHeight) {
if (instance == null) {
instance = new DevelopersDialogGUI(mathtoolGuiX, mathtoolGuiY, mathtoolGuiWidth, mathtoolGuiHeight);
}
return instance;
}
}
| true
|
2edd985a01ac7ff6f2ffe747d6b5a38d77512806
|
Java
|
kangyongku/TeachingHubElementary
|
/src/kr/co/kumsung/thub/domain/BoardConfig.java
|
UTF-8
| 5,278
| 1.742188
| 2
|
[] |
no_license
|
package kr.co.kumsung.thub.domain;
import kr.co.kumsung.thub.util.Validate;
public class BoardConfig {
public int boardId;
public String boardName = "";
public String boardType = "";
public String boardFlag = "";
public String headerSection = "";
public String footerSection = "";
public String useCategory;
public String useWrite;
public String useReply;
public String useFileUpload;
public String useComment;
public String useMovie;
public String useLink;
public String useRecommend;
public String useSns;
public String useAnnmsList;
public String useAnnmsView;
public String allowFileTypes;
public int allowFileCount;
public int allowFileSize;
public String regDate;
public String regId;
public String modifyDate;
public String modifyId;
public int totalArticles;
public String modifyRegDate;
public int getBoardId() {
return boardId;
}
public void setBoardId(int boardId) {
this.boardId = boardId;
}
public String getBoardName() {
return boardName;
}
public void setBoardName(String boardName) {
this.boardName = boardName;
}
public String getBoardType() {
return boardType;
}
public void setBoardType(String boardType) {
this.boardType = boardType;
}
public String getBoardFlag() {
return boardFlag;
}
public void setBoardFlag(String boardFlag) {
this.boardFlag = boardFlag;
}
public String getHeaderSection() {
return headerSection;
}
public void setHeaderSection(String headerSection) {
this.headerSection = headerSection;
}
public String getFooterSection() {
return footerSection;
}
public void setFooterSection(String footerSection) {
this.footerSection = footerSection;
}
public String getUseCategory() {
return useCategory;
}
public void setUseCategory(String useCategory) {
this.useCategory = useCategory;
}
public String getUseWrite() {
return useWrite;
}
public void setUseWrite(String useWrite) {
this.useWrite = useWrite;
}
public String getUseReply() {
return useReply;
}
public void setUseReply(String useReply) {
this.useReply = useReply;
}
public String getUseFileUpload() {
return useFileUpload;
}
public void setUseFileUpload(String useFileUpload) {
this.useFileUpload = useFileUpload;
}
public String getUseComment() {
return useComment;
}
public void setUseComment(String useComment) {
this.useComment = useComment;
}
public String getUseMovie() {
return useMovie;
}
public void setUseMovie(String useMovie) {
this.useMovie = useMovie;
}
public String getUseLink() {
return useLink;
}
public void setUseLink(String useLink) {
this.useLink = useLink;
}
public String getUseRecommend() {
return useRecommend;
}
public void setUseRecommend(String useRecommend) {
this.useRecommend = useRecommend;
}
public String getUseSns() {
return useSns;
}
public void setUseSns(String useSns) {
this.useSns = useSns;
}
public String getUseAnnmsList() {
return useAnnmsList;
}
public void setUseAnnmsList(String useAnnmsList) {
this.useAnnmsList = useAnnmsList;
}
public String getUseAnnmsView() {
return useAnnmsView;
}
public void setUseAnnmsView(String useAnnmsView) {
this.useAnnmsView = useAnnmsView;
}
public String getAllowFileTypes() {
return allowFileTypes;
}
public void setAllowFileTypes(String allowFileTypes) {
this.allowFileTypes = allowFileTypes;
}
public int getAllowFileCount() {
return allowFileCount;
}
public void setAllowFileCount(int allowFileCount) {
this.allowFileCount = allowFileCount;
}
public int getAllowFileSize() {
return allowFileSize;
}
public void setAllowFileSize(int allowFileSize) {
this.allowFileSize = allowFileSize;
}
public String getRegDate() {
return regDate;
}
public void setRegDate(String regDate) {
this.regDate = regDate;
}
public String getRegId() {
return regId;
}
public void setRegId(String regId) {
this.regId = regId;
}
public String getModifyDate() {
return modifyDate;
}
public void setModifyDate(String modifyDate) {
this.modifyDate = modifyDate;
}
public String getModifyId() {
return modifyId;
}
public void setModifyId(String modifyId) {
this.modifyId = modifyId;
}
public int getTotalArticles() {
return totalArticles;
}
public void setTotalArticles(int totalArticles) {
this.totalArticles = totalArticles;
}
public String getModifyRegDate() {
return modifyRegDate;
}
public void setModifyRegDate(String modifyRegDate) {
this.modifyRegDate = modifyRegDate;
}
public String getBoardFlagName() {
if( !Validate.isEmpty(boardFlag) )
{
if( boardFlag.equals("PDS") )
return "열린학습자료";
else if( boardFlag.equals("CMT"))
return "선생님행복마당";
else if( boardFlag.equals("CS"))
return "CS관리";
else if( boardFlag.equals("CA"))
return "창의적체험활동";
else if( boardFlag.equals("M1"))
return "학생참여수업";
else if( boardFlag.equals("M2"))
return "자유학년제·창체";
else if( boardFlag.equals("M3"))
return "나눔소통";
}
return "";
}
}
| true
|
bed98ee3d8d136c3aba0ffb2eb74580835f783bd
|
Java
|
chipkaramit/MovieApp
|
/app/src/main/java/com/amit/systemplusassignment/view/MovieDetailsActivity.java
|
UTF-8
| 1,916
| 2.1875
| 2
|
[] |
no_license
|
package com.amit.systemplusassignment.view;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;
import com.amit.systemplusassignment.R;
import com.bumptech.glide.Glide;
public class MovieDetailsActivity extends AppCompatActivity {
ImageView backDropPath;
TextView movieOverview;
String backDrop , overview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie_details);
// toolbar fancy stuff
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Intent intent = getIntent();
backDrop = intent.getStringExtra("BACKDROP_PATH");
overview = intent.getStringExtra("OVERVIEW");
// movieModels = intent.getSerializableExtra("movieList");
initViews();
getMovieDetailsData();
}
private void initViews()
{
backDropPath = findViewById(R.id.img_movie_details);
movieOverview = findViewById(R.id.tv_movie_overview);
}
private void getMovieDetailsData()
{
/* for(int i=0; i<movieModels.size(); i++)
{*/
Glide.with(this)
.load(backDrop)
.placeholder(R.mipmap.ic_launcher)
.into(backDropPath);
movieOverview.setText(overview);
// }
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
public void onBackPressed() {
finish();
super.onBackPressed();
}
}
| true
|
29d2efd36f368db26bfce67b4a6047d6cb3528df
|
Java
|
fioletti-smeup/provider-mc
|
/src/main/java/com/smeup/provider/smeup/connector/as400/operations/DataQueueWriter.java
|
UTF-8
| 2,607
| 1.914063
| 2
|
[] |
no_license
|
package com.smeup.provider.smeup.connector.as400.operations;
import java.io.IOException;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400SecurityException;
import com.ibm.as400.access.DataQueue;
import com.ibm.as400.access.ErrorCompletingRequestException;
import com.ibm.as400.access.IllegalObjectTypeException;
import com.ibm.as400.access.ObjectDoesNotExistException;
import com.ibm.as400.access.QSYSObjectPathName;
import com.smeup.provider.log.Logged;
import com.smeup.provider.model.CommunicationException;
import com.smeup.provider.model.SmeupSession;
import com.smeup.provider.smeup.connector.as400.FUNParser;
import com.smeup.provider.smeup.connector.as400.InputCalculator;
@Logged
@ApplicationScoped
public class DataQueueWriter {
public static final String QUEUE_LIB = "SMEUPUIDQ";
private static final String IN_QUEUE_PREFIX = "ECTS";
@Inject
private InputCalculator inputCalculator;
@Inject
private Instance<AS400> as400;
@Inject
private SmeupSession smeupSession;
public void writeToQueue(final String fun) throws CommunicationException {
try {
createDataQueue(IN_QUEUE_PREFIX).write(getInputCalculator()
.toDataQueueEntryAsString(new FUNParser().parse(fun)));
} catch (IOException | AS400SecurityException
| ErrorCompletingRequestException | IllegalObjectTypeException
| InterruptedException | ObjectDoesNotExistException e) {
throw new CommunicationException(e);
}
}
private DataQueue createDataQueue(final String outQueuePrefix) {
final DataQueue dataQueue = new DataQueue(getAS400().get(),
new QSYSObjectPathName(QUEUE_LIB,
outQueuePrefix + getSmeupSession().getSessionId(),
"DTAQ").getPath());
return dataQueue;
}
public Instance<AS400> getAS400() {
return this.as400;
}
public void setAS400(final Instance<AS400> as400) {
this.as400 = as400;
}
public SmeupSession getSmeupSession() {
return this.smeupSession;
}
public void setSmeupSession(final SmeupSession smeupSession) {
this.smeupSession = smeupSession;
}
public InputCalculator getInputCalculator() {
return this.inputCalculator;
}
public void setInputCalculator(final InputCalculator inputCalculator) {
this.inputCalculator = inputCalculator;
}
}
| true
|
2558ab4a355c05e1457f9b27833bddc0cf00f555
|
Java
|
Yacent/GridWorldStage2
|
/Part2/src/SpiralBugRunner.java
|
UTF-8
| 551
| 2.9375
| 3
|
[] |
no_license
|
import info.gridworld.actor.Actor;
import info.gridworld.actor.ActorWorld;
import info.gridworld.grid.Location;
import info.gridworld.grid.UnboundedGrid;
/**
* This class runs a world that contains a spiral bug,
* added a given location.
*
* @author joyeecheung
*/
public class SpiralBugRunner
{
public static void main(String[] args)
{
UnboundedGrid<Actor> grid = new UnboundedGrid<Actor>();
ActorWorld world = new ActorWorld(grid);
world.add(new Location(8, 8), new SpiralBug(2));
world.show();
}
}
| true
|
24677fb54bc7aa7f091e52734369270fb1762ee9
|
Java
|
EvgeniyShipov/Social-Network
|
/chat/src/test/java/ChatTest.java
|
UTF-8
| 605
| 2.515625
| 3
|
[] |
no_license
|
import org.junit.Test;
import static org.junit.Assert.*;
public class ChatTest {
Profile profile1 = new Profile("John", 25);
Profile profile2 = new Profile("Sara", 23);
Profile profile3 = new Profile("Demid", 24);
Chat chat = new Chat(profile1, profile2);
@Test
public void sendMessage1() throws Exception {
chat.sendMessage("Hello!");
assert(chat.getMessageList().contains("Hello!"));
}
@Test
public void addCompanion1() throws Exception {
chat.addCompanion(profile3);
assert (chat.getCompanionList().contains(profile3));
}
}
| true
|
b456442dc5c6a915c369883db849505aa8057a39
|
Java
|
marinaserranomontes/OpenTokRTC-Android-1
|
/src/com/tokbox/android/opentokrtc/Participant.java
|
UTF-8
| 2,343
| 2.265625
| 2
|
[] |
no_license
|
package com.tokbox.android.opentokrtc;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import com.opentok.android.BaseVideoRenderer;
import com.opentok.android.OpentokError;
import com.opentok.android.Stream;
import com.opentok.android.Subscriber;
public class Participant extends Subscriber {
private static final String LOGTAG = "Participant";
private String mUserId;
private String mName;
private Context mContext;
protected Boolean mSubscriberVideoOnly = false;
private ChatRoomActivity mActivity;
public Participant(Context context, Stream stream) {
super(context, stream);
this.mContext = context;
this.mActivity = (ChatRoomActivity) this.mContext;
setmName("User" + ((int)(Math.random()*1000)));
this.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
}
public String getmUserId() {
return mUserId;
}
public void setmUserId(String name) {
this.mUserId = name;
}
public String getmName() {
return mName;
}
public void setmName(String name) {
this.mName = name;
}
public Boolean getmSubscriberVideoOnly() {
return mSubscriberVideoOnly;
}
@Override
protected void onVideoDisabled() {
super.onVideoDisabled();
Log.i(LOGTAG, "Video quality changed. It is disabled for the subscriber");
mSubscriberVideoOnly = true;
mActivity.setAudioOnlyView(true);
}
@Override
protected void onVideoDataReceived() {
super.onVideoDataReceived();
Log.i(LOGTAG, "First frame received");
mActivity.updateLoadingSub();
}
@Override
protected void onError(OpentokError error) {
super.onError(error);
showErrorDialog(error);
}
private void showErrorDialog(OpentokError error) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
this.mContext);
alertDialogBuilder.setTitle("OpenTokRTC Error");
alertDialogBuilder
.setMessage(error.getMessage())
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
mActivity.finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
| true
|
ac390cb4304f5f25cd51027c9007d209dcb81d8b
|
Java
|
koendeschacht/remote-exec
|
/src/main/java/be/bagofwords/exec/RemoteClassAnnotationPreprocessor.java
|
UTF-8
| 4,295
| 2.265625
| 2
|
[] |
no_license
|
package be.bagofwords.exec;
import com.sun.source.util.TreePath;
import com.sun.source.util.Trees;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* Created by koen on 5/05/17.
*/
public class RemoteClassAnnotationPreprocessor extends AbstractProcessor {
private String[] possiblePrefixes = {"src/main/java/", "", "java/"};
private String[] resourcesDirNames = {"resources", "assets"};
private Trees trees;
public RemoteClassAnnotationPreprocessor() {
System.out.println("Generated " + getClass());
}
@Override
public synchronized void init(ProcessingEnvironment env) {
super.init(env);
trees = Trees.instance(env);
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
Set<? extends Element> elementsAnnotatedWith = env.getElementsAnnotatedWith(RemoteClass.class);
for (Element element : elementsAnnotatedWith) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Found Remote class " + element);
final TreePath treePath = trees.getPath(element);
try {
String path = treePath.getCompilationUnit().getSourceFile().getName();
File resourcesDir = null;
String simplifiedPath = null;
for (int i = 0; i < possiblePrefixes.length && resourcesDir == null; i++) {
for (int j = 0; j < resourcesDirNames.length && resourcesDir == null; j++) {
String prefix = possiblePrefixes[i];
String resourceDirName = resourcesDirNames[j];
String parentDir = path.replaceFirst(prefix + ".*$", "");
resourcesDir = new File(parentDir, resourceDirName);
// System.out.println("Resources dir " + resourcesDir.getAbsolutePath() + " " + resourcesDir.exists());
if (!resourcesDir.exists()) {
resourcesDir = null;
} else {
int prefixInd = path.indexOf(prefix);
simplifiedPath = path.substring(prefixInd + prefix.length());
break;
}
}
}
CharSequence source = treePath.getCompilationUnit().getSourceFile().getCharContent(false);
if (resourcesDir != null) {
File remoteClassesDir = new File(resourcesDir, "remote-exec");
File outputFile = new File(remoteClassesDir, simplifiedPath + ".remote");
File parentDir = outputFile.getParentFile();
if (!parentDir.exists() && !parentDir.mkdirs()) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Could not generate directory " + parentDir.getAbsolutePath());
}
BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile));
writer.write(source.toString());
writer.close();
} else {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Could not find resources dir for " + element);
}
} catch (IOException e) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "IOException while handling " + element + " : " + e.getMessage());
}
}
return true;
}
@Override
public Set<String> getSupportedAnnotationTypes() {
return new HashSet<>(Collections.singletonList(RemoteClass.class.getName()));
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latestSupported();
}
}
| true
|
019cb144b2f79b367a2e9380c321bb4d3f0ea938
|
Java
|
lukovicperisa/KosarkaskaLigaWeb
|
/build/generated-sources/ap-source-output/model/Utakmica_.java
|
UTF-8
| 771
| 1.71875
| 2
|
[] |
no_license
|
package model;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
import model.Klub;
import model.Kolo;
@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2019-02-22T15:36:30")
@StaticMetamodel(Utakmica.class)
public class Utakmica_ {
public static volatile SingularAttribute<Utakmica, Integer> poenaDomaci;
public static volatile SingularAttribute<Utakmica, Integer> poenaGosti;
public static volatile SingularAttribute<Utakmica, Kolo> kolo;
public static volatile SingularAttribute<Utakmica, Integer> utakmicaID;
public static volatile SingularAttribute<Utakmica, Klub> gost;
public static volatile SingularAttribute<Utakmica, Klub> domacin;
}
| true
|
23975cab6d893e9a14f03622987c31c753a86281
|
Java
|
qconrad/severe-weather-alerts
|
/app/src/main/java/com/severeweatheralerts/RecyclerViews/AddressClickListener.java
|
UTF-8
| 245
| 1.796875
| 2
|
[] |
no_license
|
package com.severeweatheralerts.RecyclerViews;
import android.location.Address;
import androidx.recyclerview.widget.RecyclerView;
public interface AddressClickListener {
void onAddressClick(Address alert, RecyclerView.ViewHolder holder);
}
| true
|
e55a26f4bfc5e32d517444c3111ae35b7645f8c8
|
Java
|
Kim-tae-yong/jorofi
|
/core/src/main/java/ch/shimbawa/jorofi/data/Dataset.java
|
UTF-8
| 2,269
| 2.984375
| 3
|
[] |
no_license
|
package ch.shimbawa.jorofi.data;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/** Internal (input) data set */
public class Dataset {
private List<NamedPoint> points = new ArrayList<NamedPoint>();
private List<Route> routes = new ArrayList<Route>();
public NamedPoint findOrAddNearestPoint(BigDecimal lon, BigDecimal lat,
BigDecimal ele, String name) {
NamedPoint bestPoint = null;
double bestDist = 10000;
for (NamedPoint point : points) {
double dist = point.distanceTo(lon, lat);
if (dist < 1 && (bestPoint == null || bestDist > dist)) {
bestPoint = point;
bestDist = dist;
}
}
if (bestPoint != null) {
return bestPoint;
}
NamedPoint point = new NamedPoint();
point.setLongitude(lon);
point.setLatitude(lat);
point.setAltitude(ele);
point.setName(name);
points.add(point);
return point;
}
public void addPoint(NamedPoint point) {
points.add(point);
}
public void addRoute(Route route) {
routes.add(route);
}
public String getStats() {
return points.size() + " points and " + routes.size() + " routes";
}
/** @return all points with name starting with "start-" */
public List<NamedPoint> getStartPoints() {
List<NamedPoint> selectedPoints = new ArrayList<NamedPoint>();
for (NamedPoint point : points) {
String pointName = point.getName();
if (pointName != null && pointName.startsWith("start-")) {
selectedPoints.add(point);
}
}
return selectedPoints;
}
public List<Route> getRoutesFromPoint(Point itPoint) {
List<Route> selectedRoutes = new ArrayList<Route>();
for (Route route : routes) {
if (route.getPoints().get(0).getId() == itPoint.getId()) {
selectedRoutes.add(route);
}
}
return selectedRoutes;
}
public void dump() {
for (NamedPoint point : points) {
System.out.println("Point " + point.getId() + ", name="
+ point.getName());
}
for (Route route : routes) {
System.out.println("Route " + route.getId() + ", dist="
+ route.getDistance());
for (Point point : route.getPoints()) {
System.out.println(point);
}
}
}
public List<NamedPoint> getPoints() {
return points;
}
}
| true
|
51a034c3f09f53100ab0d062ec5e6c424df47e0a
|
Java
|
dimestef/Dodi
|
/src/main/java/com/example/controllers/FootballController.java
|
UTF-8
| 3,371
| 2.296875
| 2
|
[] |
no_license
|
package com.example.controllers;
import com.example.entity.*;
import com.example.services.FootballService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class FootballController {
@Autowired
private FootballService footballService;
/* Working */
@RequestMapping(value = "/getAllClubs", method = RequestMethod.GET)
public List<Club> getAllClubs() {
return footballService.getAllClubs();
}
/* Working */
@RequestMapping(value = "/deleteClub/{id}", method = RequestMethod.DELETE)
public void deleteClub(@PathVariable Long id) {
footballService.deleteClub(id);
}
/* Working */
@RequestMapping(value = "/addClub", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void addClub(@RequestBody Club club) {
footballService.addClub(club);
}
/* Working */
@RequestMapping(value = "/getAllFootballers", method = RequestMethod.GET)
public List<Footballer> getAllFootballers() {
return footballService.getAllFootballers();
}
/* Working */
@RequestMapping(value = "/deleteFootballer/{id}", method = RequestMethod.DELETE)
public void deleteFootballer(@PathVariable Long id) {
footballService.deleteFootballer(id);
}
/* Working */
@RequestMapping(value = "/addFootballer", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void addClub(@RequestBody Footballer footballer) {
footballService.addFootballer(footballer);
}
/* Working */
@RequestMapping(value = "/showFootballerSkills/{id}", method = RequestMethod.GET)
public Skill showFootballerSkills(@PathVariable Long id) {
return footballService.showFootballerSkills(id);
}
/* Working */
@RequestMapping(value = "/updateSkill", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void updateSkill(@RequestBody Skill skill) {
footballService.updateSkill(skill);
}
/* Working */
@RequestMapping(value = "/getAllCountry", method = RequestMethod.GET)
public List<Country> getAllCountry() {
return footballService.getAllCountry();
}
/* Working */
@RequestMapping(value = "/getAllAcademy", method = RequestMethod.GET)
public List<Academy> getAllAcademy() {
return footballService.getAllAcademy();
}
/* Working */
@RequestMapping(value = "/makeContract", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void updateSkill(@RequestBody Contract contract) {
footballService.makeContract(contract);
}
/* Working */
@RequestMapping(value = "/getAllManagers", method = RequestMethod.GET)
public List<Manager> getAllManagers() {
return footballService.getAllManagers();
}
/* Working */
@RequestMapping(value = "/addNewManager", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void addNewManager(@RequestBody Manager manager) {
footballService.addNewManager(manager);
}
}
| true
|
2250ce941a6ff2e0dfaf4829ec9d0c31f34d96ac
|
Java
|
XiaoMingZhe/blackBoard
|
/src/main/java/com/blackboard/dto/LCompanyUser.java
|
UTF-8
| 443
| 1.875
| 2
|
[] |
no_license
|
package com.blackboard.dto;
public class LCompanyUser {
private String companyName;//公司名
private String enterpriseId;//企业ID
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
}
| true
|
916babc2beac069db6d47eeb7dc02ac09e24a964
|
Java
|
SSAlan504101/Java
|
/GreatestCommonDivisorMethod.java
|
UTF-8
| 1,314
| 3.890625
| 4
|
[] |
no_license
|
//Seth Soileau
//Greatest Common Divisor Method
import java.util.Scanner;
public class GreatestCommonDivisorMethod {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n1 = 0;
int n2 = 0;
//Checks user input validation for non-integers
do {
System.out.print("Enter first integer: ");
while(!input.hasNextInt()) {
System.out.println("That's not a integer! Try Again!");
input.next();
System.out.print("Please enter the first integer: ");
}
n1 = input.nextInt();
System.out.print("Enter second integer: ");
while(!input.hasNextInt()) {
System.out.println("That's not a integer! Try Again!");
input.next();
System.out.print("Please enter the second integer: ");
}
n2 = input.nextInt();
System.out.println("The greatest common divisor for " + n1 + " and " + n2 +
" is " + GCD(n1, n2));
} while (!input.hasNextInt());
}
public static int GCD(int n1, int n2) {
int GCD = 1; //The initial GCD is 1
int x = 2; //Possible GCD
while (x <= n1 && x <= n2) {
if (n1 % x == 0 && n2 % x == 0)
GCD = x; //Updating GCD
x++;
}
return GCD; //Return GCD
}
}
| true
|
9e5eaed3e783cbbf60a33c75698ba50ede0518ad
|
Java
|
osmarbraz/triangulo2c
|
/src/main/java/EntTriangulo.java
|
UTF-8
| 1,542
| 3.640625
| 4
|
[
"MIT"
] |
permissive
|
/**
* Classe da Entidade da Aplicação.
*
* @author Osmar de Oliveira Braz Junior
* @created 14 de Abril de 2007
*/
public class EntTriangulo {
private double altura;
private double base;
/**
* Construtor para o objeto EntTriangulo.
*/
public EntTriangulo() {
setBase(0);
setAltura(0);
}
/**
* Constructor for the EntTriangulo object
*
* @param base Description of the Parameter
* @param altura Description of the Parameter
*/
public EntTriangulo(double base, double altura) {
setBase(base);
setAltura(altura);
}
/**
* Gets the altura attribute of the EntTriangulo object
*
* @return The altura value
*/
public double getAltura() {
return altura;
}
/**
* Gets the area attribute of the EntTriangulo object
*
* @return The area value
*/
public double getArea() {
return ((getBase() * getAltura()) / 2.0);
}
/**
* Gets the base attribute of the EntTriangulo object
*
* @return The base value
*/
public double getBase() {
return base;
}
/**
* Sets the altura attribute of the EntTriangulo object
*
* @param altura The new altura value
*/
public void setAltura(double altura) {
this.altura = altura;
}
/**
* Sets the base attribute of the EntTriangulo object
*
* @param base The new base value
*/
public void setBase(double base) {
this.base = base;
}
}
| true
|
c504e6a34ac9d9e0ebad0d08e748dd5aa45bdfc3
|
Java
|
srb76/final-project-team_16_decision_app
|
/app/src/main/java/edu/oregonstate/choosy/AddNewDecisionActivity.java
|
UTF-8
| 3,300
| 2.453125
| 2
|
[] |
no_license
|
package edu.oregonstate.choosy;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
<<<<<<< HEAD
import android.os.AsyncTask;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.util.Log;
import java.io.IOException;
import java.net.URL;
=======
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
>>>>>>> 9599acdd23b1f2ccaf590f90f1192c5b62334905
public class AddNewDecisionActivity extends AppCompatActivity {
private TextView quoteView;
private final static String TAG = MainActivity.class.getSimpleName();
private EditText mOption1;
private EditText mOption2;
private Button mSubmit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_new_decision);
<<<<<<< HEAD
quoteView = (TextView)findViewById(R.id.TV_quote);
getQuote();
}
private void getQuote() {
String quoteURL = QuoteUtils.buildQuoteURL("inspire");
new QuoteFetchTask().execute(quoteURL);
}
public class QuoteFetchTask extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected String doInBackground(String... urls) {
String quoteURL = urls[0];
String quote = null;
try {
quote = NetworkUtils.doHTTPGet(quoteURL);
} catch (IOException e) {
e.printStackTrace();
}
return quote;
}
@Override
protected void onPostExecute(String s) {
if (s != null) {
String quote = QuoteUtils.parseQuoteJSON(s);
Log.d(TAG, "quote fetched: " + quote);
quoteView.setText(quote);
}
}
=======
mOption1 = (EditText)findViewById(R.id.ET_new_option_1);
mOption2 = (EditText)findViewById(R.id.ET_new_option_2);
mSubmit = (Button)findViewById(R.id.button_submit);
mSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String first = mOption1.getText().toString();
String second = mOption2.getText().toString();
if( !TextUtils.isEmpty(first) && !TextUtils.isEmpty(second)) {
ChoosyDatabase db = new ChoosyDatabase(getApplicationContext());
DecisionUtils.decisionObject toAdd = new DecisionUtils.decisionObject(first, second);
if(db.addDecision(toAdd) ) {
//Added successfully
}
else {
//Already exists
}
//Display a toast or notification? Or even navigate back to main activity
//Clear edit text fields
mOption1.setText("");
mOption2.setText("");
}
}
});
>>>>>>> 9599acdd23b1f2ccaf590f90f1192c5b62334905
}
}
| true
|
1af7c0a5390cf1c2ee547bb1a83fcb9dcd51f27b
|
Java
|
AxelCCp/JAVA-15-APLICACION-MIA
|
/src/Aplicacion/A2_PrincipalMain.java
|
UTF-8
| 274
| 1.890625
| 2
|
[] |
no_license
|
package Aplicacion;
import javax.swing.JFrame;
public class A2_PrincipalMain {
public static void main(String[]args) {
//
A0_MarcoJframe mimarco = new A0_MarcoJframe();
mimarco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mimarco.setVisible(true);
//
}
}
| true
|
5206d69d7f35bf04e192b15416e3748d4c01b944
|
Java
|
LF19980827/TTMS
|
/src/entity/Ischedule.java
|
UTF-8
| 2,424
| 2.640625
| 3
|
[] |
no_license
|
package entity;
import java.sql.Timestamp;
import java.util.Date;
/**
* @author LFuser
* @create 2019-05-23-12:51
* 放映计划
*/
public class Ischedule {
private int sched_id; //计划ID
private int studio_id; //演出厅ID
private int play_id; //电影ID
private String sched_time_String; //演出时间
private double sched_ticket_price; //票价
private int sched_status; //状态
private Timestamp sched_time;
public int getSched_id() {
return sched_id;
}
public void setSched_id(int sched_id) {
this.sched_id = sched_id;
}
public int getStudio_id() {
return studio_id;
}
public void setStudio_id(int studio_id) {
this.studio_id = studio_id;
}
public int getPlay_id() {
return play_id;
}
public void setPlay_id(int play_id) {
this.play_id = play_id;
}
public String getSched_time_String() {
return sched_time_String;
}
public void setSched_time_String(String sched_time_String) {
this.sched_time_String = sched_time_String;
}
public Date getSched_time() {
return sched_time;
}
public void setSched_time(Timestamp sched_time) {
this.sched_time = sched_time;
}
public double getSched_ticket_price() {
return sched_ticket_price;
}
public void setSched_ticket_price(double sched_ticket_price) {
this.sched_ticket_price = sched_ticket_price;
}
public int getSched_status() {
return sched_status;
}
public void setSched_status(int sched_status) {
this.sched_status = sched_status;
}
public void TraDate(){
try {
sched_time = Timestamp.valueOf(sched_time_String);
} catch (Exception e) {
System.out.println("时间字符串格式有误");
e.printStackTrace();
}
}
@Override
public String toString() {
return "Ischedule{" +
"sched_id=" + sched_id +
", studio_id=" + studio_id +
", play_id=" + play_id +
", sched_time_String='" + sched_time_String + '\'' +
", sched_ticket_price=" + sched_ticket_price +
", sched_status=" + sched_status +
", sched_time=" + sched_time +
'}';
}
}
| true
|
8a01d85c15ff8cce703da52b6a24540b47d07f49
|
Java
|
Motzny/apollo
|
/app/src/main/java/com/jasnymocny/apollo/Player.java
|
UTF-8
| 1,898
| 2.8125
| 3
|
[] |
no_license
|
package com.jasnymocny.apollo;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
class Player implements Parcelable {
private ArrayList<String> thingsYouSaid = new ArrayList<String>();
private boolean lost = false;
private String name;
private int color;
private byte score = 0;
public byte getScore() {
return score;
}
String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
ArrayList<String> getThingsYouSaid() {
return thingsYouSaid;
}
void addThingYouSaid(String thingYouSaid) {
this.thingsYouSaid.add(thingYouSaid);
}
int getColor() {
return color;
}
public boolean isLost() {
return lost;
}
void loose() {
lost = true;
}
public Player(String name, int color){
this.name = name;
this.color = color;
}
@Override
public String toString() {
return getName() + " " + isLost() + " " + getScore() + "|" + thingsYouSaid;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeStringList(thingsYouSaid);
parcel.writeByte((byte) (lost ? 1 : 0));
parcel.writeString(name);
}
public void score() {
score += 1;
}
protected Player(Parcel in) {
thingsYouSaid = in.createStringArrayList();
lost = in.readByte() != 0;
name = in.readString();
}
public static final Creator<Player> CREATOR = new Creator<Player>() {
@Override
public Player createFromParcel(Parcel in) {
return new Player(in);
}
@Override
public Player[] newArray(int size) {
return new Player[size];
}
};
}
| true
|
9b79f7d2c7677ecb2685c57aaaa798f16aa23ef5
|
Java
|
riya7989/Playing-Cards
|
/homework4/src/main/java/edu/northeastern/ccs/cs5500/homework4/card/KaSuitComparator.java
|
UTF-8
| 549
| 2.953125
| 3
|
[] |
no_license
|
package edu.northeastern.ccs.cs5500.homework4.card;
import java.util.Comparator;
import edu.northeastern.ccs.cs5500.homework4.diErbao.Ka;
/**
* The comparator class that sorts the Chinese cards by order of their suits.
*
* @author Riya Nadkarni
* @version 10-19-2018
*/
public class KaSuitComparator implements Comparator<Ka> {
@Override
public int compare(Ka one, Ka two) {
int result = 0;
if (one.getSuit() < two.getSuit()) {
result = -1;
} else if (one.getSuit() > two.getSuit()) {
result = 1;
}
return result;
}
}
| true
|
4fd768b4e8a3a3fc43bbafc1ec59e3f1b3e4f046
|
Java
|
xw103/DepthExploit
|
/app/src/main/java/org/exploit/depth/example/MainActivity.java
|
UTF-8
| 2,166
| 2.546875
| 3
|
[] |
no_license
|
/**
* 在所有继承自DepthActivity的类中,`this`已弃用,并使用`that`代替
* 例如:Toast.makeText(that,"test",Toast.LENGTH_SHORT).show();
*/
package org.exploit.depth.example;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.view.Surface;
import android.widget.Toast;
import org.exploit.depth.activity.DepthActivity;
import org.exploit.depth.internal.RootIPCReceiver;
import org.exploit.depth.utils.IPCUtils;
import org.exploit.depth.widget.SurfaceBufferView;
import bin.androidlua.LuaRunner;
public class MainActivity extends DepthActivity {
private final RootIPCReceiver<Test> ipcReceiver = new RootIPCReceiver<Test>(that, 0) {
@Override
public void onConnect(Test ipc) {
try {
Log.e("test",ipc.test());
Toast.makeText(that, ipc.test(), Toast.LENGTH_SHORT).show();
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void onDisconnect(Test ipc) {
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new SurfaceBufferView(that, new SurfaceBufferView.SurfaceBufferListener() {
@Override
public void onSurfaceCreate(Surface surface) {
}
@Override
public void onSurfaceChanged(Surface surface) {
}
@Override
public boolean onSurfaceDestroyed(Surface surface) {
return false;
}
@Override
public void onSurfaceUpdated(Surface surface) {
}
});
try {
LuaRunner runner = new LuaRunner();
runner.run("print(888)".getBytes(),"test");
runner.close();
} catch (Exception e) {
e.printStackTrace();
}
IPCUtils.startIPC(that, ipcReceiver, null, null, line -> {
//接收输出(可为NULL)
System.out.println(line);
});
}
}
| true
|
71e6271a9bce8194a6852988785ce63ac77d4386
|
Java
|
iriFly/BasicJava
|
/interfaces/sandbox/Exercise.java
|
UTF-8
| 930
| 2.984375
| 3
|
[] |
no_license
|
package interfaces.sandbox;
public class Exercise {
public static void main(String[] args) {
//111 = 2^0 + 2^1 + 2^2
//int dec_value = 1*(2^2) + 1*(2^1) + 1*(2^0) = 7
System.out.println(7>>1);
// 0111 - 7
// 0011 - 2 pow 0 plus 2 pow 1 1 plus 2 's gel'jk aan 3
// 0111 >> 0011 >> 0001
// 0111 << 1110 <<
// = 1*(2^3) + 1*(2^2) + 1*(2^1) + 0*(2^0) = 14
// = 8 + 4 + 2 + 0 = 14
// 0000 0111 << 0000 1110 << 0001 1100
// (0 maal 2 pow 0) + (0 maal 2 pow 1) + (1 maal 2 pow 2) + (1 maal 2 pow 3) + (1 maal 2 pow 4)
// 0 + 0 + 2 + 4 + 8 + 16
System.out.println(7>>2);
System.out.println(7<<1);
System.out.println(7<<2);
System.out.println(7>>>1);
System.out.println(7>>>4);
System.out.println(7>>>16);
System.out.println(7<<32);
}
}
| true
|
f507fefe5a3fa65b45488663fe02b69e07dac1c9
|
Java
|
ksgldy/spring-cloud-learning
|
/idc-mongo/src/main/java/cn/idea360/mongo/flow/UpperLeft.java
|
UTF-8
| 158
| 1.585938
| 2
|
[] |
no_license
|
package cn.idea360.mongo.flow;
import lombok.Data;
/**
* 左上角坐标
*/
@Data
public class UpperLeft {
private double x;
private double y;
}
| true
|