blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d904b01b868788424f0f4316728dd485ba973afd
|
3b99672285cdd97878910bed7a2e188dd29ff065
|
/PalindromeNumber.java
|
d50ce8966d443ee703cca5319a0531a965c52b21
|
[] |
no_license
|
mohdshahbazmirza/DSA
|
ccd47e58d3dd53832dfc0d756ba30e257ea8a2c3
|
64e4a43e45d47cfa2837ccc8f8e7b365f262d778
|
refs/heads/master
| 2023-08-10T18:55:18.643181 | 2021-09-27T18:24:31 | 2021-09-27T18:24:31 | 378,571,982 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 270 |
java
|
class Solution {
public boolean isPalindrome(int x) {
int sum=0;
if(x<0)
return false;
String s=new String(x+"");
StringBuilder sb=new StringBuilder(s);
sb.reverse();
return sb.toString().equals(s);
}
}
|
[
"[email protected]"
] | |
e88d78cc1575d580bd442c4876f67b845cfb2faf
|
6a220af1fcc9a1c7e6ddda68c1fd1f4a65558eda
|
/UUM_2/src/main/java/main.java
|
7620f456c2232396f8db4d86527c015165b2433a
|
[] |
no_license
|
bishajitchakraborty/University_Management_System
|
d47e06118f86e074cf72f2968d835ecb4e8a1d14
|
4a7a576dc438d75249b36b2741da4efebcc746b5
|
refs/heads/master
| 2023-06-07T03:29:55.380956 | 2021-07-02T18:58:38 | 2021-07-02T18:58:38 | 382,245,713 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 813 |
java
|
import Bean.*;
import DAO.CampusDAO;
import DAO.CourseDAO;
import DAO.ProgrammeDAO;
import DAO.UserDAO;
import Helper.factoryProvider;
import Table.CourseTable;
import org.hibernate.Cache;
import org.hibernate.Session;
import org.hibernate.Transaction;
import javax.xml.crypto.Data;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.ListIterator;
public class main {
public static void main(String[] args) {
/*String s ="CAE0111 smsdkm : Koushik sarker";
String[] arr = s.split(":");
for (String s1:arr){
System.out.println(s1.trim());
}*/
UserDAO ud = new UserDAO();
User u = (User) ud.selectUserByUNameAndPass("aan","skdm");
System.out.println(u);
}
}
|
[
"[email protected]"
] | |
2b3914b3da3975ccd88c8ced305653de88d3c91f
|
25b98cf5850ac7ee99e27328ea44f5dedf7b0ccd
|
/business/src/main/java/com/neuedu/config/RedisAspect.java
|
b45db5116dd44957663182424615526006ce1ebf
|
[] |
no_license
|
sanyepiaoxue/fy2020
|
186ae944e21c10bc75cc2da64d3512b4c0bd289a
|
7663a91c4321f3409996a649b04d1a91aa86483b
|
refs/heads/master
| 2022-12-11T12:49:42.213532 | 2020-03-11T03:50:35 | 2020-03-11T03:50:35 | 240,021,608 | 0 | 0 | null | 2022-05-20T21:28:31 | 2020-02-12T13:37:46 |
Java
|
UTF-8
|
Java
| false | false | 2,120 |
java
|
package com.neuedu.config;
import com.google.gson.Gson;
import com.neuedu.common.RedisApi;
import com.neuedu.common.ServerResponse;
import com.neuedu.utils.MD5Utils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Aspect//声明切面类
@Component
public class RedisAspect {
@Autowired
RedisApi redisApi;
//1.定义切入点execution表达式
@Pointcut("execution(public * com.neuedu.service.impl.CategoryServiceImpl.get*(..))")
public void test(){
}
//2.环绕通知
@Around("test()")
public Object around(ProceedingJoinPoint joinPoint){
StringBuffer stringBuffer = new StringBuffer();
//类名
String className = joinPoint.getSignature().getDeclaringType().getName();
stringBuffer.append(className);
String name = joinPoint.getSignature().getName();//方法名
stringBuffer.append(name);
Object[] args = joinPoint.getArgs();
for (Object o:args){//参数值
stringBuffer.append(o);
}
//缓存key
String cacheKey = MD5Utils.getMD5Code(stringBuffer.toString());
System.out.println(cacheKey);
//从缓存中读取数据
String cacheValue = redisApi.get(cacheKey);
Gson gson = new Gson();
if (cacheValue == null){//缓存中没有数据
try {
Object o = joinPoint.proceed();//执行目标方法,读取db
String valueStr = gson.toJson(o);
//写入缓存
redisApi.set(cacheKey,valueStr);
return o;
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}else {//缓存中有数据
ServerResponse serverResponse = gson.fromJson(cacheValue,ServerResponse.class);
return serverResponse;
}
return null;
}
}
|
[
"[email protected]"
] | |
992da0f742fc95baa0d5899dfdd3611c74e34712
|
6fc1240c9ae2a7b3d8eead384668e1f4b58d47da
|
/assignments/criollok/unit2/HW09FarmSystem/HW09FarmSystem/src/ec/espe/edu/farm/model/FarmAnimal.java
|
96bf91a54b3c7abd584392028e26bf9cae0c1d6d
|
[] |
no_license
|
elascano/ESPE202105-OOP-TC-3730
|
38028e870d4de004cbbdf82fc5f8578126f8ca32
|
4275a03d410cf6f1929b1794301823e990fa0ef4
|
refs/heads/main
| 2023-08-09T13:24:26.898865 | 2021-09-13T17:08:10 | 2021-09-13T17:08:10 | 371,089,640 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,740 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ec.espe.edu.farm.model;
import java.util.Calendar;
import java.util.Date;
/**
*
* @author Kevin Criollo BetaSoftwareTech ESPE-DCCO
*/
public class FarmAnimal {
private int id;
private String breed;
private Date bornOn;
public int getAgeInMonths(int day, int month, int year){
//TODO Compute the age in months
Calendar start = Calendar.getInstance();
start.set(year, month-1, day);
Calendar current = Calendar.getInstance();
return getBornOn().getMonth();
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the breed
*/
public String getBreed() {
return breed;
}
/**
* @param breed the breed to set
*/
public void setBreed(String breed) {
this.breed = breed;
}
/**
* @return the bornOn
*/
public Date getBornOn() {
return bornOn;
}
/**
* @param bornOn the bornOn to set
*/
public void setBornOn(Date bornOn) {
this.bornOn = bornOn;
}
public FarmAnimal(int id, String breed, Date bornOn) {
this.id = id;
this.breed = breed;
this.bornOn = bornOn;
}
@Override
public String toString() {
return "FarmAnimal{" + "id=" + getId() + ", breed=" + getBreed() + ", bornOn=" + getBornOn() + '}';
}
}
|
[
"[email protected]"
] | |
e158312e76eacad90beac9435b10dd5be1d94bbd
|
d4061b0169186b36adb13a19a5ce72aa2e2c7572
|
/cloudhystrix/eureka-consumer-ribbon-hystrix/src/main/java/com/cloud/spring/eurekaconsumerribbonhystrix/ConsumerService.java
|
4946c94c943622d0c23d9f0e0a111ba6f48fd41c
|
[] |
no_license
|
chaochaoGT/cloud-hystrix
|
56a7aa8e40a8c136d5a16cba5580bde98634bf8a
|
bb09b1e303751319e434dcffed9fa0f80b48f4bf
|
refs/heads/master
| 2020-03-27T19:30:54.586727 | 2018-09-01T11:32:35 | 2018-09-01T11:32:35 | 146,994,056 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 673 |
java
|
package com.cloud.spring.eurekaconsumerribbonhystrix;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class ConsumerService {
@Autowired
RestTemplate restTemplate;
@HystrixCommand(fallbackMethod = "fallback")
public String consumer() {
return restTemplate.getForObject("http://eureka-clientA/dc", String.class);
}
public String fallback() {
return restTemplate.getForObject("http://eureka-clientB/dc1", String.class);
}
}
|
[
"[email protected]"
] | |
457526532bc6e10bb60b5106c173d421f3a4cfbb
|
f47cc9a62fd1adc63147fac81fcea02c40efb189
|
/source/jaxme-jm/src/main/java/org/apache/ws/jaxme/impl/JMSAXMixedElementParser.java
|
447af98a3cad5f15a99da9f82e7360865f166110
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
sisbell/jaxme
|
d0ac8959776372ec3e604fd19c6c05ef2fd11a41
|
2429182048ae672cbadc734ac8983fdd99bbeb76
|
refs/heads/master
| 2021-01-19T15:30:09.964605 | 2012-07-10T09:09:36 | 2012-07-10T09:09:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,219 |
java
|
/*
* Copyright 2006 The Apache Software Foundation
*
* 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.apache.ws.jaxme.impl;
import java.util.List;
/** A subclass of {@link org.apache.ws.jaxme.impl.JMSAXElementParser}
* for parsing complex elements.
*/
public abstract class JMSAXMixedElementParser extends JMSAXElementParser {
protected abstract List getContentList();
protected void normalize() {
List list = getContentList();
boolean previousIsString = false;
for (int i = list.size()-1; i >= 0; i--) {
Object o = list.get(i);
if (o instanceof StringBuffer) {
if (previousIsString) {
StringBuffer sb = (StringBuffer) o;
sb.append((String) list.remove(i+1));
}
list.set(i, o.toString());
previousIsString = true;
} else if (o instanceof String) {
if (previousIsString) {
list.set(i, (String) o + (String) list.remove(i+1));
}
previousIsString = true;
} else {
previousIsString = false;
}
}
}
public void addText(char[] pBuffer, int pOffset, int pLength) {
java.util.List list = getContentList();
StringBuffer sb = null;
if (list.size() > 0) {
java.lang.Object _3 = list.get(list.size()-1);
if (_3 instanceof StringBuffer) {
sb = (StringBuffer) _3;
}
}
if (sb == null) {
sb = new StringBuffer();
list.add(sb);
}
sb.append(pBuffer, pOffset, pLength);
}
}
|
[
"[email protected]"
] | |
e310ac0561e08d5a177f0eae0d562eb48b70f7b5
|
fba814aacefab242237a82eb377563c5be4b875f
|
/app/src/main/java/me/kimhieu/yummy/ecommerceproject/login/LoginActivity.java
|
ae159b6d1d79ab21f296aa3fa311c4bd5d1ba7a8
|
[] |
no_license
|
nhatsinh92/yummy-ecommerce
|
a0fc5f07c952fe9ef5590ef3ab5423c57afef361
|
aae478867eabb86a730f24249a180609613395ba
|
refs/heads/master
| 2021-01-09T20:04:37.947781 | 2016-06-25T08:53:55 | 2016-06-25T08:53:55 | 60,360,444 | 0 | 0 | null | 2016-06-25T08:53:56 | 2016-06-03T16:01:13 |
Java
|
UTF-8
|
Java
| false | false | 2,848 |
java
|
package me.kimhieu.yummy.ecommerceproject.login;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import com.auth0.lock.Lock;
import com.auth0.lock.LockActivity;
import me.kimhieu.yummy.ecommerceproject.MainActivity;
import me.kimhieu.yummy.ecommerceproject.R;
import me.kimhieu.yummy.ecommerceproject.explore.ExploreActivity;
import me.kimhieu.yummy.ecommerceproject.onsale.OnSaleActivity;
import me.kimhieu.yummy.ecommerceproject.utils.ExploreLibrary;
import me.kimhieu.yummy.ecommerceproject.utils.YummySession;
import static com.auth0.lock.Lock.AUTHENTICATION_ACTION;
public class LoginActivity extends AppCompatActivity {
private LocalBroadcastManager broadcastManager;
private ImageButton imageButtonSignIn;
private ImageButton imageButtonCreateAccount;
private BroadcastReceiver authenticationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
YummySession.userProfile = intent.getParcelableExtra(Lock.AUTHENTICATION_ACTION_PROFILE_PARAMETER);
YummySession.selectedItemPosition = 0;
final Intent newIntent = new Intent(LoginActivity.this, ExploreActivity.class);
newIntent.putExtras(intent);
startActivity(newIntent);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// Find view by Id
imageButtonSignIn = (ImageButton) findViewById(R.id.image_button_sign_in);
imageButtonCreateAccount = (ImageButton) findViewById(R.id.image_button_create_account);
// Set click event
imageButtonSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, LockActivity.class));
}
});
imageButtonCreateAccount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, SignUpActivity.class));
}
});
// Listen from Auth0
broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.registerReceiver(authenticationReceiver, new IntentFilter(AUTHENTICATION_ACTION));
}
@Override
protected void onDestroy() {
super.onDestroy();
broadcastManager.unregisterReceiver(authenticationReceiver);
}
}
|
[
"[email protected]"
] | |
9834f88b6f2fa6b9f151ef7225bb4c6ad0fc8371
|
8e5435288c133a86d45f7c715b5aab2373009090
|
/JavaHandbook/src/main/java/org/arunsiddharth/DynamicProgramming/ShortestPossibleSupersequence.java
|
946560b300d91deadb7d393c2854355550983505
|
[] |
no_license
|
arunsiddharth/Whisper
|
db1414d7dfc2b7ba4e1cbcb9701aaed5a67681e1
|
2966255eb37902e213f075695a2fef5c6604b964
|
refs/heads/main
| 2023-05-05T17:52:13.002400 | 2021-05-27T16:03:06 | 2021-05-27T16:03:06 | 324,918,625 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 153 |
java
|
package org.arunsiddharth.DynamicProgramming;
public class ShortestPossibleSupersequence {
public static void main(String[] args){
}
}
|
[
"[email protected]"
] | |
853ee794873af9fd05ffd0eb1d53b224bdc0808d
|
aef9a95106eaf24b85104f4536d20cf7341506a6
|
/src/main/java/br/com/bianeck/creational/abstractfactory/caso4/EnginolaCPU.java
|
1e9f4bb89d76078cc9c235b8b460f88e783dcdb2
|
[
"MIT"
] |
permissive
|
JElvisBL/designpatternstutorial
|
a3b4952af57998e83b8743ac5797be1fd8027184
|
3e5f92d4cc2f8ae098b66c73236e7a8498932d5a
|
refs/heads/master
| 2022-04-22T09:19:19.415037 | 2020-01-22T01:42:36 | 2020-01-22T01:42:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 98 |
java
|
package br.com.bianeck.creational.abstractfactory.caso4;
public class EnginolaCPU extends CPU{
}
|
[
"[email protected]"
] | |
2369396762f3e2ecdf5bf9aafdaa37e3813b0990
|
26e0472d936798b7d812d6e6cc5ba22ea7877f1f
|
/src/main/java/org/demo/model/Person.java
|
3d82c845ca09cbe8a043a1a1bd012abf0c600869
|
[] |
no_license
|
cnduffield/demo-web-service
|
44812b72297230f75f208958907d75b16b82f38f
|
6e5c3b76a9ed89f2c6cb99d67f77eef8736ee55c
|
refs/heads/master
| 2021-01-19T17:57:36.556139 | 2017-08-22T20:07:45 | 2017-08-22T20:07:45 | 101,101,850 | 0 | 0 | null | 2017-08-22T19:54:05 | 2017-08-22T19:54:05 | null |
UTF-8
|
Java
| false | false | 855 |
java
|
package org.demo.model;
import org.springframework.data.annotation.Id;
public class Person {
private String id;
private String firstName;
private String lastName;
private String governmentId;
private String email;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getGovernmentId() {
return governmentId;
}
public void setGovernmentId(String governmentId) {
this.governmentId = governmentId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Id
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
|
[
"[email protected]"
] | |
a5698c63586d688360bef11ee4eb540324f72168
|
1c0df66bdc53d84aea6f7aa1f0183cf6f8392ab1
|
/temp/src/minecraft/net/minecraft/client/gui/GuiDisconnected.java
|
0970f1de6bb4be03eb5dfb9a93b6583fff16a3b8
|
[] |
no_license
|
yuwenyong/Minecraft-1.9-MCP
|
9b7be179db0d7edeb74865b1a78d5203a5f75d08
|
bc89baf1fd0b5d422478619e7aba01c0b23bd405
|
refs/heads/master
| 2022-05-23T00:52:00.345068 | 2016-03-11T21:47:32 | 2016-03-11T21:47:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,253 |
java
|
package net.minecraft.client.gui;
import java.io.IOException;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.ITextComponent;
public class GuiDisconnected extends GuiScreen {
private String field_146306_a;
private ITextComponent field_146304_f;
private List<String> field_146305_g;
private final GuiScreen field_146307_h;
private int field_175353_i;
public GuiDisconnected(GuiScreen p_i45020_1_, String p_i45020_2_, ITextComponent p_i45020_3_) {
this.field_146307_h = p_i45020_1_;
this.field_146306_a = I18n.func_135052_a(p_i45020_2_, new Object[0]);
this.field_146304_f = p_i45020_3_;
}
protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException {
}
public void func_73866_w_() {
this.field_146292_n.clear();
this.field_146305_g = this.field_146289_q.func_78271_c(this.field_146304_f.func_150254_d(), this.field_146294_l - 50);
this.field_175353_i = this.field_146305_g.size() * this.field_146289_q.field_78288_b;
this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 100, this.field_146295_m / 2 + this.field_175353_i / 2 + this.field_146289_q.field_78288_b, I18n.func_135052_a("gui.toMenu", new Object[0])));
}
protected void func_146284_a(GuiButton p_146284_1_) throws IOException {
if(p_146284_1_.field_146127_k == 0) {
this.field_146297_k.func_147108_a(this.field_146307_h);
}
}
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
this.func_146276_q_();
this.func_73732_a(this.field_146289_q, this.field_146306_a, this.field_146294_l / 2, this.field_146295_m / 2 - this.field_175353_i / 2 - this.field_146289_q.field_78288_b * 2, 11184810);
int i = this.field_146295_m / 2 - this.field_175353_i / 2;
if(this.field_146305_g != null) {
for(String s : this.field_146305_g) {
this.func_73732_a(this.field_146289_q, s, this.field_146294_l / 2, i, 16777215);
i += this.field_146289_q.field_78288_b;
}
}
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
}
}
|
[
"[email protected]"
] | |
f0cf97995650dfe586c75626441900a2bdef3acb
|
8af1164bac943cef64e41bae312223c3c0e38114
|
/results-java/JetBrains--kotlin/087eec45211fa3ba37cb6c49eb35589517e849ba/before/KotlinGotoTestGenerated.java
|
e6dd38063e09b602b65269712d7af51d9271121b
|
[] |
no_license
|
fracz/refactor-extractor
|
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
|
dd5e82bfcc376e74a99e18c2bf54c95676914272
|
refs/heads/master
| 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,158 |
java
|
/*
* Copyright 2010-2014 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 org.jetbrains.jet.plugin.navigation;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
import java.io.File;
import java.util.regex.Pattern;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.test.InnerTestClasses;
import org.jetbrains.jet.test.TestMetadata;
import org.jetbrains.jet.plugin.navigation.AbstractKotlinGotoTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@InnerTestClasses({KotlinGotoTestGenerated.GotoClass.class, KotlinGotoTestGenerated.GotoSymbol.class})
public class KotlinGotoTestGenerated extends AbstractKotlinGotoTest {
@TestMetadata("idea/testData/navigation/gotoClass")
public static class GotoClass extends AbstractKotlinGotoTest {
public void testAllFilesPresentInGotoClass() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/navigation/gotoClass"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("enumEntries.kt")
public void testEnumEntries() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/enumEntries.kt");
}
@TestMetadata("inClassObject.kt")
public void testInClassObject() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/inClassObject.kt");
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/innerClass.kt");
}
@TestMetadata("localDeclarations.kt")
public void testLocalDeclarations() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/localDeclarations.kt");
}
@TestMetadata("noImplementationTrait.kt")
public void testNoImplementationTrait() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/noImplementationTrait.kt");
}
@TestMetadata("simpleClass.kt")
public void testSimpleClass() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/simpleClass.kt");
}
@TestMetadata("simpleObject.kt")
public void testSimpleObject() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/simpleObject.kt");
}
@TestMetadata("traitWithFunImplement.kt")
public void testTraitWithFunImplement() throws Exception {
doClassTest("idea/testData/navigation/gotoClass/traitWithFunImplement.kt");
}
}
@TestMetadata("idea/testData/navigation/gotoSymbol")
public static class GotoSymbol extends AbstractKotlinGotoTest {
public void testAllFilesPresentInGotoSymbol() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/navigation/gotoSymbol"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("functions.kt")
public void testFunctions() throws Exception {
doSymbolTest("idea/testData/navigation/gotoSymbol/functions.kt");
}
@TestMetadata("javaMethods.kt")
public void testJavaMethods() throws Exception {
doSymbolTest("idea/testData/navigation/gotoSymbol/javaMethods.kt");
}
@TestMetadata("properties.kt")
public void testProperties() throws Exception {
doSymbolTest("idea/testData/navigation/gotoSymbol/properties.kt");
}
@TestMetadata("stdLibArrayListOf.kt")
public void testStdLibArrayListOf() throws Exception {
doSymbolTest("idea/testData/navigation/gotoSymbol/stdLibArrayListOf.kt");
}
@TestMetadata("stdLibArrayListOfNoSources.kt")
public void testStdLibArrayListOfNoSources() throws Exception {
doSymbolTest("idea/testData/navigation/gotoSymbol/stdLibArrayListOfNoSources.kt");
}
@TestMetadata("stdLibJoinToString.kt")
public void testStdLibJoinToString() throws Exception {
doSymbolTest("idea/testData/navigation/gotoSymbol/stdLibJoinToString.kt");
}
}
public static Test suite() {
TestSuite suite = new TestSuite("KotlinGotoTestGenerated");
suite.addTestSuite(GotoClass.class);
suite.addTestSuite(GotoSymbol.class);
return suite;
}
}
|
[
"[email protected]"
] | |
7b8b92da044169f120d6b752e1f2c882d5c43993
|
e171b00da70670df9c13f1bacd6e5e12f12462a5
|
/final project report/3rd Increment/BowlPredictorA/gen/com/umkc/bigdata/boulpredictora/BuildConfig.java
|
5ae9e21729c3299577a5bb5c69bf455b45a2d931
|
[] |
no_license
|
tmrhc/Big-Data-Analytic-s-and-Apps-Project
|
6922920ef43edcedf114fef18a295f1f11bf9924
|
b3d10de19254a6817a7d60ca4290f23d981281df
|
refs/heads/master
| 2016-09-05T13:49:53.730433 | 2014-08-01T06:29:21 | 2014-08-01T06:29:21 | 21,059,989 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 173 |
java
|
/** Automatically generated file. DO NOT MODIFY */
package com.umkc.bigdata.boulpredictora;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
|
[
"[email protected]"
] | |
fe795ea939358a597014d1e35bd9d701bb502f49
|
dc81649732414dee4d552a240b25cb3d055799b1
|
/src/test/java/org/assertj/core/api/atomic/longarray/AtomicLongArrayAssert_containsExactly_Test.java
|
6ee23098997036ee9bea72e1086fe3bba9031000
|
[
"Apache-2.0"
] |
permissive
|
darkliang/assertj-core
|
e40de697a5ac19db7a652178963a523dfe6f89ff
|
4a25dab7b99f292d158dc8118ac84dc7b4933731
|
refs/heads/integration
| 2021-05-16T23:22:49.013854 | 2020-05-31T12:36:31 | 2020-05-31T12:36:31 | 250,513,505 | 1 | 0 |
Apache-2.0
| 2020-06-02T09:25:54 | 2020-03-27T11:11:36 |
Java
|
UTF-8
|
Java
| false | false | 1,225 |
java
|
/*
* 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.
*
* Copyright 2012-2020 the original author or authors.
*/
package org.assertj.core.api.atomic.longarray;
import static org.assertj.core.test.LongArrays.arrayOf;
import static org.mockito.Mockito.verify;
import org.assertj.core.api.AtomicLongArrayAssert;
import org.assertj.core.api.AtomicLongArrayAssertBaseTest;
public class AtomicLongArrayAssert_containsExactly_Test extends AtomicLongArrayAssertBaseTest {
@Override
protected AtomicLongArrayAssert invoke_api_method() {
return assertions.containsExactly(1, 2);
}
@Override
protected void verify_internal_effects() {
verify(arrays).assertContainsExactly(info(), internalArray(), arrayOf(1, 2));
}
}
|
[
"[email protected]"
] | |
6c5f0c2f9063ba855201272e53247a363452e61c
|
b8437fca14c8803cd3ac24340aff6169b433ae3c
|
/MMS_Vendetta/src/main/java/com/mms/activity/RegisterActivity.java
|
6bb01490a3f28b6ddb5130c15f514a5134a9e2ee
|
[] |
no_license
|
blu3-b1rd/mms_vendetta
|
d1ce6caa951e5e24c022f3d62c2eab7a2ccbb74f
|
374d04fd1c231d3317f7614d97fa30d0e0b610c0
|
refs/heads/master
| 2021-05-28T00:41:52.434627 | 2014-04-25T02:34:39 | 2014-04-25T02:34:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,836 |
java
|
package com.mms.activity;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import android.app.DatePickerDialog;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.analytics.HitBuilders;
import com.mms.util.LoginType;
import com.mms.vendetta.R;
import com.mms.app.MMSApplication;
import com.mms.app.MMSPreferences;
import com.mms.model.MMSResponse;
import com.mms.model.MMSUser;
import com.mms.request.CreateUserRequest;
import com.mms.request.MMSAsyncRequest;
import com.mms.request.MMSAsyncRequest.OnMMSRequestFinishedListener;
public class RegisterActivity extends ActionBarActivity
implements OnMMSRequestFinishedListener, DatePickerDialog.OnDateSetListener {
private TextView nameField;
private TextView birthdayField;
private Spinner genderField;
private TextView usernameField;
private TextView emailField;
private TextView passwordField;
private TextView confirmPasswordField;
private Calendar selectedDate;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getSupportActionBar().hide();
this.overridePendingTransition(R.anim.push_right_in,
R.anim.push_right_out);
this.setContentView(R.layout.activity_register);
this.init();
((MMSApplication) this.getApplication()).getTracker(MMSApplication.TrackerName.APP_TRACKER)
.send(new HitBuilders.AppViewBuilder().build());
}
private void init(){
this.nameField = (TextView) this.findViewById(R.id.edit_name);
this.birthdayField = (Button) this.findViewById(R.id.edit_birthday);
this.genderField = (Spinner) this.findViewById(R.id.edit_gender);
this.usernameField = (TextView) this.findViewById(R.id.edit_username);
this.emailField = (TextView) this.findViewById(R.id.edit_email);
this.passwordField = (TextView) this.findViewById(R.id.password_field);
this.confirmPasswordField = (TextView) this.findViewById(R.id.password_conf_field);
this.selectedDate = Calendar.getInstance();
this.setDateOnButton();
}
public void onDateClicked(View view) {
int year = this.selectedDate.get(Calendar.YEAR);
int month = this.selectedDate.get(Calendar.MONTH);
int day = this.selectedDate.get(Calendar.DAY_OF_MONTH);
new DatePickerDialog(this, this, year, month, day).show();
}
public void onDateSet(DatePicker view, int year, int month, int day) {
this.selectedDate.set(year, month, day);
this.setDateOnButton();
}
private void setDateOnButton(){
int year = this.selectedDate.get(Calendar.YEAR);
int day = this.selectedDate.get(Calendar.DAY_OF_MONTH);
this.birthdayField.setText(new StringBuilder("")
.append(year).append(" / ")
.append(this.selectedDate.getDisplayName(Calendar.MONTH,
Calendar.LONG, Locale.getDefault())).append(" / ")
.append(day).toString());
}
public void onRegisterClicked(View view) {
if (this.validateData()) {
this.findViewById(R.id.button_register).setEnabled(false);
this.findViewById(R.id.register_form_container).setVisibility(
View.GONE);
this.findViewById(R.id.progress).setVisibility(View.VISIBLE);
new MMSAsyncRequest(this).execute(new CreateUserRequest(
this.nameField.getText().toString(),
this.emailField.getText().toString(),
this.usernameField.getText().toString(),
this.genderField.getSelectedItem().toString(),
LoginType.EMAIL,
this.getSelectedDateString(),
this.passwordField.getText().toString()));
} else {
Toast.makeText(this, R.string.error_verify_data, Toast.LENGTH_SHORT).show();
}
}
private static final String DATE_FORMAT = "yyyy-MM-dd";
private String getSelectedDateString(){
SimpleDateFormat dateFormater = new SimpleDateFormat(
DATE_FORMAT, Locale.getDefault());
return dateFormater.format(this.selectedDate.getTime());
}
@Override
public void onMMSRequestFinished(MMSResponse response) {
try {
switch(response.getStatus()){
case MMS_SUCCESS:
this.onSuccessfulResponse(response);
break;
default:
this.onErrorResponse(response);
break;
}
} catch(Exception e){
e.printStackTrace();
this.onRequestFailed();
}
}
protected void onRequestFailed() {
this.findViewById(R.id.button_register).setEnabled(true);
this.findViewById(R.id.register_form_container).setVisibility(
View.VISIBLE);
this.findViewById(R.id.progress).setVisibility(View.GONE);
}
protected void onSuccessfulResponse(MMSResponse response) {
MMSApplication app = (MMSApplication) this.getApplication();
app.setUser((MMSUser) response.getContent());
MMSPreferences.saveString(MMSPreferences.DISPLAY_NAME,
app.getUser().getName());
Toast.makeText(this, R.string.notice_register_successful, Toast.LENGTH_SHORT).show();
this.finish();
}
protected void onErrorResponse(MMSResponse response) {
this.findViewById(R.id.button_register).setEnabled(true);
this.findViewById(R.id.register_form_container).setVisibility(
View.VISIBLE);
this.findViewById(R.id.progress).setVisibility(View.GONE);
Toast.makeText(this, response.getMessage(), Toast.LENGTH_LONG).show();
}
private boolean validateData() {
boolean flag = true;
if(this.nameField.getText().toString().isEmpty()){
this.highlight(this.nameField);
flag = false;
}
if(this.usernameField.getText().toString().isEmpty()){
this.highlight(this.usernameField);
flag = false;
}
if(this.emailField.getText().toString().isEmpty()){
this.highlight(this.emailField);
flag = false;
}
if(this.passwordField.getText().toString().isEmpty()){
this.highlight(this.passwordField);
flag = false;
}
if(this.confirmPasswordField.getText().toString().isEmpty()){
this.highlight(this.confirmPasswordField);
flag = false;
}
if(!this.passwordField.getText().toString()
.equals(this.confirmPasswordField.getText().toString())){
this.highlight(this.passwordField);
this.highlight(this.confirmPasswordField);
flag = false;
}
if(!this.validBirthDate()){
Toast.makeText(this, R.string.error_invalid_date, Toast.LENGTH_LONG).show();
flag = false;
}
return flag;
}
private boolean validBirthDate(){
Date current = new Date();
long milisDiff = current.getTime() - this.selectedDate.getTimeInMillis();
if(milisDiff < 0){ return false; }
long yearMilis = 1000L * 60 * 60 * 24 * 365;
int yearsDiff = (int) (milisDiff / yearMilis);
if(yearsDiff < 10){
return false;
}
return true;
}
private void highlight(View view) {
view.setBackgroundColor(Color.parseColor("#11DD1E2F"));
}
}
|
[
"[email protected]"
] | |
23c91fa9cfb4213a203c7bcdb2cffbc48d9fb4b8
|
b82e0c665953aa5605a9d030a4410ad121005ba9
|
/MobileCourse/src/com/assignment/mobilecourse/AssignmentAdd.java
|
bb3cfd6c56bef890f90b101c8a6dcd6065f44b28
|
[] |
no_license
|
JWilson9/Android-Development
|
cc003b4935d1ea3834ee42fbd0a8a1c05815f537
|
063133d1fcb6176f967eb5f46541d037465f428a
|
refs/heads/master
| 2021-01-12T05:02:36.596988 | 2017-01-02T12:26:07 | 2017-01-02T12:26:07 | 77,831,688 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,847 |
java
|
/*
*TITLE: MOBILE COURSE
*
*Author: James Wilson DT211/3 Kevin Street
*
*All work is done by James Wilson, and owned by James Wilson
*
*Designed, programmed, and tested by James Wilson
*
*CopyRight of James Wilson
*
*27/11/14
*
*/
package com.assignment.mobilecourse;
import android.app.Activity;
import android.app.Dialog;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class AssignmentAdd extends Activity implements OnClickListener {
Button Add_assignment;
EditText Assignment_name, Assignment_due;
// assigning edittext and buttons to where they are located
// in the xml file
// setting the content view
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_assignment_add);
Assignment_name = (EditText) findViewById(R.id.AssignmentName);
Assignment_due = (EditText) findViewById(R.id.AssignmentDue);
Add_assignment = (Button) findViewById(R.id.bAddAssignment);
Add_assignment.setOnClickListener(this);
}
// when a button it clicked it does the following
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
// added sound to my button so when it clicks it executes the following
MediaPlayer addSound = MediaPlayer.create(AssignmentAdd.this,
R.raw.assadded);
switch (arg0.getId()) {
// if the add button is clickd it does the following
case R.id.bAddAssignment:
boolean didItWork = true;
try {
// getting the text from the assignment name and due
// and putting them into AssignmentName, AssignmentDue
String AssignmentName = Assignment_name.getText().toString();
String AssignmentDue = Assignment_due.getText().toString();
//AssignmentEntry is now the db var
//opening to insert
MyDbManager AssignmentEntry = new MyDbManager(
AssignmentAdd.this);
AssignmentEntry.open();
AssignmentEntry.insertNewAssign(AssignmentName, AssignmentDue);
AssignmentEntry.close();
//catch and exeception
//if it works or if it didnt, it prints out
//what is appropriate
} catch (Exception e) {
didItWork = false;
String error = e.toString();
Dialog d = new Dialog(this);
d.setTitle("oh dear");
TextView tv = new TextView(this);
tv.setText(error);
d.show();
} finally {
if (didItWork) {
addSound.start();
Dialog d = new Dialog(this);
d.setTitle("Assignment Added");
TextView tv = new TextView(this);
tv.setText("Success");
d.show();
}
}
break;
}
}
}
|
[
"[email protected]"
] | |
8eaf60a507c20f200cc9256266792191a3a330ac
|
b38e87295ab6e2cdf004dec2a2e5042f230ba47f
|
/src/steganography/MyDialog.java
|
98501e65a0073669b3499a1c84af27ceb5122fc1
|
[] |
no_license
|
abhijeet-adarsh/Steganography
|
d102c9688659662b89c2dcdbba43af5be405cd58
|
67f360a13377ed983bbd729094fd8df5dc8db7ac
|
refs/heads/master
| 2021-03-13T00:06:23.705839 | 2011-02-04T08:45:42 | 2011-02-04T08:45:42 | 1,325,884 | 19 | 10 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,309 |
java
|
package steganography;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class MyDialog extends JDialog implements ActionListener {
JFrame frame;
private JTextArea textArea;
private JButton button11;
MyDialog(Frame frame, String title) {
super(frame,title,true);
textArea = new JTextArea();
button11 = new JButton("OK");
button11.addActionListener(this);
JScrollPane scrollPane = new JScrollPane(textArea);
getContentPane().add(scrollPane);
getContentPane().add(BorderLayout.SOUTH,button11);
setSize(400, 400);
setLocationRelativeTo(frame);
}
public String getText() throws NullPointerException{
if(textArea.getText()==""){
Component veiw = null;
JOptionPane.showMessageDialog(veiw,
"Please Enter Your Message", "Error!",
JOptionPane.ERROR_MESSAGE);
throw new NullPointerException("Please enter message");
}
else return textArea.getText();
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==button11){
setVisible(false);
}
}
}
|
[
"[email protected]"
] | |
d5da1b457ada9dd741184849e61a9a45bc56a77b
|
23822c88d81cf23b5ccaed4cdf2cd43962c83120
|
/common/src/main/java/org/common/Observer.java
|
9217357d04845752348efd487ab0ff48ab0567d9
|
[] |
no_license
|
guzfernandez/miRMIApp
|
762795931e14f9b491255068614c156b54c92715
|
ad4c7a641f83f6cd9ed2e3ce77d5d3c119e90a4c
|
refs/heads/master
| 2020-06-11T07:44:26.693276 | 2016-12-13T19:27:05 | 2016-12-13T19:27:05 | 75,730,746 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,213 |
java
|
package org.common;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
public interface Observer extends Remote, Serializable{
public void mostrarJugadores() throws RemoteException;
public void actualizarTimer(int segundo) throws RemoteException;
public void empezarPartida(Jugador jugador) throws RemoteException;
public void setJugador(Jugador jugador) throws RemoteException;
public Jugador getJugador() throws RemoteException;
public void actualizarPosicionJugador(int posAnterior, int jugadorPos, int posicion) throws RemoteException;
public void cambiarTurno(int posJugador, Jugador jugador) throws RemoteException;
public void comprarPropiedad(Jugador jugador, int posicion) throws RemoteException;
public void acciones(Jugador jugador, List<String> acciones) throws RemoteException;
public void pagarMulta(Jugador dueño, int cantidad) throws RemoteException;
public void venderPropiedad(Jugador jugador, int posicion) throws RemoteException;
public void ganador(Jugador jugador) throws RemoteException;
public void perdedor(Jugador jugador) throws RemoteException;
public void actualizarListaJugadores() throws RemoteException;
}
|
[
"[email protected]"
] | |
fc25342ed61b5a7c07017884fe0fb91f3f760a17
|
b77a4d5bd23a3f69e90e5e01508fbc3687a432f5
|
/weblogger-business/src/main/java/org/apache/roller/weblogger/business/search/IndexManager.java
|
d7df4445ed11033e44f234a145c1f83708b0ae0d
|
[
"Apache-2.0",
"LicenseRef-scancode-jdom",
"BSD-3-Clause"
] |
permissive
|
JavaQualitasCorpus/roller-5.0.1
|
59abb7cbd8389c47b27e0a341a3746dacfd2df88
|
08e7be2b36b148a2e293948e3664177953b83124
|
refs/heads/master
| 2023-08-13T19:29:24.333161 | 2020-05-29T15:53:22 | 2020-05-29T15:53:22 | 167,005,068 | 0 | 1 |
NOASSERTION
| 2022-07-08T19:05:18 | 2019-01-22T14:09:12 |
HTML
|
UTF-8
|
Java
| false | false | 2,793 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
package org.apache.roller.weblogger.business.search;
import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.business.InitializationException;
import org.apache.roller.weblogger.business.search.operations.IndexOperation;
import org.apache.roller.weblogger.pojos.WeblogEntry;
import org.apache.roller.weblogger.pojos.Weblog;
/**
* Interface to Roller's Lucene-based search facility.
* @author Dave Johnson
*/
public interface IndexManager
{
/** Does index need to be rebuild */
public abstract boolean isInconsistentAtStartup();
/** Remove user from index, returns immediately and operates in background */
public void removeWebsiteIndex(Weblog website) throws WebloggerException;
/** Remove entry from index, returns immediately and operates in background */
public void removeEntryIndexOperation(WeblogEntry entry) throws WebloggerException;
/** Add entry to index, returns immediately and operates in background */
public void addEntryIndexOperation(WeblogEntry entry) throws WebloggerException;
/** R-index entry, returns immediately and operates in background */
public void addEntryReIndexOperation(WeblogEntry entry) throws WebloggerException;
/** Execute operation immediately */
public abstract void executeIndexOperationNow(final IndexOperation op);
/**
* Release all resources associated with Roller session.
*/
public abstract void release();
/**
* Initialize the search system.
*
* @throws InitializationException If there is a problem during initialization.
*/
public void initialize() throws InitializationException;
/** Shutdown to be called on application shutdown */
public abstract void shutdown();
public abstract void rebuildWebsiteIndex(Weblog website) throws WebloggerException;
public abstract void rebuildWebsiteIndex() throws WebloggerException;
}
|
[
"[email protected]"
] | |
593b0550142e5b836e892fced8ff5c8ba5bba09d
|
991c05764cfdac7aaf9330e86fb418bbca4553ac
|
/src/fsw/DataPntStr.java
|
4753779ef46db3c48b772af043f3e4d2b1695c4d
|
[] |
no_license
|
govtmirror/CARE
|
b57ff7094376d4cf1c550cd59a5d0cd402a4778f
|
5635af22ebb6c0aaa5303c5a95c3784f38021150
|
refs/heads/master
| 2021-01-12T07:47:11.076769 | 2015-09-26T12:47:28 | 2015-09-26T12:47:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,747 |
java
|
package fsw;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import ccsds.CcsdsTlmPkt;
/**
* Provide a base class for all raw data to string conversions.
*
* TODO - Resolve byte flip issue either here or in network classes.
*
* @author David McComas
*/
public abstract class DataPntStr {
static final public int IDX_MSG_ID = 0;
static final public int IDX_SEQ_CNT = 1;
static final public int IDX_LEN = 2;
static final public int IDX_SEC = 3;
static final public int IDX_SUBSEC = 4;
static final public int HDR_LEN = 5;
public DataPntStr () {
} // End DataPntstr()
/**
*
* @param rawData
* @param rawIndex
* @return
*/
public abstract String byteToStr(byte[] rawData, int rawIndex);
static final public void hdrBytesToStr(String[] tlmStrArray, CcsdsTlmPkt TlmMsg) {
tlmStrArray[0] = String.valueOf((TlmMsg.getStreamId()));
tlmStrArray[IDX_SEQ_CNT] = String.valueOf((TlmMsg.getSeqCount()));
tlmStrArray[2] = String.valueOf((TlmMsg.getLength()));
tlmStrArray[3] = "Seconds"; // TODO - Seconds
tlmStrArray[4] = "SubSeconds"; // TODO - SubSeconds
} // End hdrBytesToStr()
/***************************************************************************
**
** Helper methods that provide generic TLM-to-String parsing
**
** TODO - Make length variable with better line formats
*/
static public String ParseRawData(byte[] RawData)
{
String Message = new String();
Message = "\n---------------------------------\nPacket: App ID = 0x";
Message += ByteToHexStr(RawData[1])+ ByteToHexStr(RawData[0]) + "\n";
//return ( (( (Packet[CCSDS_IDX_STREAM_ID] & 0x00FF) | (Packet[CCSDS_IDX_STREAM_ID+1] << 8)) & CCSDS_MSK_MSG_ID) );
//Truncate to 16 bytes since it's just a warm fuzzy
int DataLen = 16;
if (RawData.length < 16) DataLen = RawData.length;
for (int i=0; i < DataLen; i++)
{
Message += ByteToHexStr(RawData[i]) + " ";
}
return Message;
} // End ParseRawData()
/*
** There's probably an easier way but I was having problems with sign extension
** and not knowing Java well I just hacked a solution.
*/
static public String ByteToHexStr(byte Byte)
{
String HexStr = Integer.toHexString((short)Byte&0x00FF); // Need to mask to prevent long strings
if (HexStr.length() == 1)
HexStr = "0" + HexStr;
else if (HexStr.length() > 2)
HexStr = "**";
return HexStr.toUpperCase();
} // End ByteToHexStr()
/**
* Convert unsigned 8-bit data to a string.
*
* @param rawData
* @param rawIndex
* @return
*/
static public String Uint8ToStr(byte[] rawData, int rawIndex) {
return String.valueOf( (0x00FF & rawData[rawIndex])); // I think this solves unsigned
} // End Uint8ToStr()
/**
* Convert unsigned 16-bit data to a string.
*
* @param rawData
* @param rawIndex
* @return
*/
static public String Uint16ToStr(byte[] rawData, int rawIndex) {
int intResult; // 32 bit signed integer
// Must mask the low bits because it is promoted to an int and will sign extend. Tried short but no luck
if (true) {
intResult = ((rawData[rawIndex] & 0x00FF) | (int)(rawData[rawIndex+1] << 8));
}
else {
intResult = (rawData[rawIndex+1]|(( (rawData[rawIndex] & 0x00FF) << 8)));
}
return Integer.toString(intResult);
} // End Uint16ToStr()
/**
* Convert unsigned 32-bit data to a string. Java doesn't have unsigned
* integers. Use 'long' that should be 64 bits and avoid sign bit
*
* @param rawData
* @param rawIndex
* @return
*/
static public String Uint32ToStr(byte[] rawData, int rawIndex)
{
int intA,intB;
int intResult; // 32 bit signed integer
if (true) {
intA = ((rawData[rawIndex] & 0x0000FFFF) | (int)(rawData[rawIndex+1] << 8));
intB = ((rawData[rawIndex+2] & 0x0000FFFF) | (int)(rawData[rawIndex+3] << 8));
intResult = ((intA & 0x0000FFFF) | (intB << 16));
}
else {
// TBD
intA = ((rawData[rawIndex] & 0x00FF) | (int)(rawData[rawIndex+1] << 8));
intB = ((rawData[rawIndex+2] & 0x00FF) | (int)(rawData[rawIndex+3] << 8));
intResult = ((intB & 0x0000FFFF) | ((intA << 16)));
}
//return Integer.toString(intResult);
return Integer.toHexString(intResult);
} // End Uint32ToStr ()
} // End class DataPntStr
|
[
"[email protected]"
] | |
c71a208024f96242d153ecb0bd58c7ad2067b199
|
8758de583eb4da2500194044f9158820a6c5aefa
|
/app/src/main/java/com/example/administrator/ditu/SMSBroadcastReceiver.java
|
4a897b4451980740e29fc61afee8e0664d9bfb0d
|
[] |
no_license
|
baotiange/btgditu
|
acac900e3c4c576cd8d1b9751d59f8318744a000
|
d9de8556a1596292e07452078c95cad5651ca09e
|
refs/heads/master
| 2020-02-26T16:50:14.376906 | 2016-10-21T10:22:39 | 2016-10-21T10:22:39 | 71,555,138 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,534 |
java
|
package com.example.administrator.ditu;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.util.Log;
import com.baidu.location.BDLocation;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpCookie;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by Administrator on 2016/10/18.
*/
public class SMSBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SmsMessage msg = null;
Object[] pdusObj = (Object[]) intent.getExtras().get("pdus");
for (Object p : pdusObj) {
msg= SmsMessage.createFromPdu((byte[]) p);
String msgTxt =msg.getMessageBody();//得到消息的内容
String senderNumber = msg.getOriginatingAddress();
MainActivity edg=new MainActivity();
if (msgTxt.equals("where are you")) {
SmsManager manager=SmsManager.getDefault();
String text=String.valueOf(edg.dingwei.longitude)+"/"+String.valueOf(edg.dingwei.latitude);
manager.sendTextMessage(senderNumber,null,text,null,null);
}
}
}
}
|
[
"[email protected]"
] | |
44279fde0db50052cecccde4bc7da9b93ddde3cb
|
b4c47b649e6e8b5fc48eed12fbfebeead32abc08
|
/android/util/SparseArray.java
|
94ded90a74a79bcc8154d91e34358813e46df1db
|
[] |
no_license
|
neetavarkala/miui_framework_clover
|
300a2b435330b928ac96714ca9efab507ef01533
|
2670fd5d0ddb62f5e537f3e89648d86d946bd6bc
|
refs/heads/master
| 2022-01-16T09:24:02.202222 | 2018-09-01T13:39:50 | 2018-09-01T13:39:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,061 |
java
|
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
package android.util;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.GrowingArrayUtils;
import libcore.util.EmptyArray;
// Referenced classes of package android.util:
// ContainerHelpers
public class SparseArray
implements Cloneable
{
public SparseArray()
{
this(10);
}
public SparseArray(int i)
{
mGarbage = false;
if(i == 0)
{
mKeys = EmptyArray.INT;
mValues = EmptyArray.OBJECT;
} else
{
mValues = ArrayUtils.newUnpaddedObjectArray(i);
mKeys = new int[mValues.length];
}
mSize = 0;
}
private void gc()
{
int i = mSize;
int j = 0;
int ai[] = mKeys;
Object aobj[] = mValues;
for(int k = 0; k < i;)
{
Object obj = aobj[k];
int l = j;
if(obj != DELETED)
{
if(k != j)
{
ai[j] = ai[k];
aobj[j] = obj;
aobj[k] = null;
}
l = j + 1;
}
k++;
j = l;
}
mGarbage = false;
mSize = j;
}
public void append(int i, Object obj)
{
if(mSize != 0 && i <= mKeys[mSize - 1])
{
put(i, obj);
return;
}
if(mGarbage && mSize >= mKeys.length)
gc();
mKeys = GrowingArrayUtils.append(mKeys, mSize, i);
mValues = GrowingArrayUtils.append(mValues, mSize, obj);
mSize = mSize + 1;
}
public void clear()
{
int i = mSize;
Object aobj[] = mValues;
for(int j = 0; j < i; j++)
aobj[j] = null;
mSize = 0;
mGarbage = false;
}
public SparseArray clone()
{
SparseArray sparsearray = null;
SparseArray sparsearray1 = (SparseArray)super.clone();
sparsearray = sparsearray1;
sparsearray1.mKeys = (int[])mKeys.clone();
sparsearray = sparsearray1;
sparsearray1.mValues = (Object[])mValues.clone();
sparsearray = sparsearray1;
_L2:
return sparsearray;
CloneNotSupportedException clonenotsupportedexception;
clonenotsupportedexception;
if(true) goto _L2; else goto _L1
_L1:
}
public volatile Object clone()
throws CloneNotSupportedException
{
return clone();
}
public void delete(int i)
{
i = ContainerHelpers.binarySearch(mKeys, mSize, i);
if(i >= 0 && mValues[i] != DELETED)
{
mValues[i] = DELETED;
mGarbage = true;
}
}
public Object get(int i)
{
return get(i, null);
}
public Object get(int i, Object obj)
{
i = ContainerHelpers.binarySearch(mKeys, mSize, i);
if(i < 0 || mValues[i] == DELETED)
return obj;
else
return mValues[i];
}
public int indexOfKey(int i)
{
if(mGarbage)
gc();
return ContainerHelpers.binarySearch(mKeys, mSize, i);
}
public int indexOfValue(Object obj)
{
if(mGarbage)
gc();
for(int i = 0; i < mSize; i++)
if(mValues[i] == obj)
return i;
return -1;
}
public int indexOfValueByValue(Object obj)
{
if(mGarbage)
gc();
for(int i = 0; i < mSize; i++)
{
if(obj == null)
{
if(mValues[i] == null)
return i;
continue;
}
if(obj.equals(mValues[i]))
return i;
}
return -1;
}
public int keyAt(int i)
{
if(mGarbage)
gc();
return mKeys[i];
}
public void put(int i, Object obj)
{
int j = ContainerHelpers.binarySearch(mKeys, mSize, i);
if(j >= 0)
{
mValues[j] = obj;
} else
{
int k = j;
if(k < mSize && mValues[k] == DELETED)
{
mKeys[k] = i;
mValues[k] = obj;
return;
}
j = k;
if(mGarbage)
{
j = k;
if(mSize >= mKeys.length)
{
gc();
j = ContainerHelpers.binarySearch(mKeys, mSize, i);
}
}
mKeys = GrowingArrayUtils.insert(mKeys, mSize, j, i);
mValues = GrowingArrayUtils.insert(mValues, mSize, j, obj);
mSize = mSize + 1;
}
}
public void remove(int i)
{
delete(i);
}
public void removeAt(int i)
{
if(mValues[i] != DELETED)
{
mValues[i] = DELETED;
mGarbage = true;
}
}
public void removeAtRange(int i, int j)
{
for(j = Math.min(mSize, i + j); i < j; i++)
removeAt(i);
}
public Object removeReturnOld(int i)
{
i = ContainerHelpers.binarySearch(mKeys, mSize, i);
if(i >= 0 && mValues[i] != DELETED)
{
Object obj = mValues[i];
mValues[i] = DELETED;
mGarbage = true;
return obj;
} else
{
return null;
}
}
public void setValueAt(int i, Object obj)
{
if(mGarbage)
gc();
mValues[i] = obj;
}
public int size()
{
if(mGarbage)
gc();
return mSize;
}
public String toString()
{
if(size() <= 0)
return "{}";
StringBuilder stringbuilder = new StringBuilder(mSize * 28);
stringbuilder.append('{');
int i = 0;
while(i < mSize)
{
if(i > 0)
stringbuilder.append(", ");
stringbuilder.append(keyAt(i));
stringbuilder.append('=');
Object obj = valueAt(i);
if(obj != this)
stringbuilder.append(obj);
else
stringbuilder.append("(this Map)");
i++;
}
stringbuilder.append('}');
return stringbuilder.toString();
}
public Object valueAt(int i)
{
if(mGarbage)
gc();
return mValues[i];
}
private static final Object DELETED = new Object();
private boolean mGarbage;
private int mKeys[];
private int mSize;
private Object mValues[];
}
|
[
"[email protected]"
] | |
f3a6d113bca5a28e6b87aaf04fb566a3a1accddc
|
3588d2cb552ee19d6610564251048b479bb32b52
|
/sp-basedata/src/main/java/com/jiangshun/sp/basedata/extend/HandleResult.java
|
c5d619c799d99238c355354e6b41b3bc77026047
|
[] |
no_license
|
l8r/spsystem
|
93d2e8d907473038abf78bd4ded020d600b7ee7e
|
63ad75a1c6156e8906c86d801d6d467d3c3437b1
|
refs/heads/master
| 2021-04-03T08:57:15.535846 | 2018-10-22T06:59:25 | 2018-10-22T06:59:25 | 124,766,005 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 783 |
java
|
package com.jiangshun.sp.basedata.extend;
public class HandleResult<T> {
private String status;
private T data;
private String msg;
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public HandleResult() {
this.status = "200";
}
public HandleResult(String code) {
this.status = code;
}
public HandleResult(String code, T data) {
this.status = code;
this.data = data;
}
public HandleResult(String code, T data, String msg) {
this.status = code;
this.data = data;
this.msg = msg;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
|
[
"[email protected]"
] | |
f35603bf73460dda4a181c540f6a6404b2e32369
|
f747b7a762339777dc68a0d8d5602c67d62c2721
|
/src/main/java/com/timerchina/spider/dao/GetJSONResult.java
|
7324b28e803ea4c23e81c723e8a43ffe245ec2f8
|
[] |
no_license
|
cc8848/spider-2
|
1774c084ed5435dc06547c70dec49967b3d27828
|
83112948f45d3b7d2092f3c29a3ae7cd3b6f138e
|
refs/heads/master
| 2021-06-09T04:17:17.860667 | 2017-01-10T04:40:00 | 2017-01-10T04:40:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 493 |
java
|
package com.timerchina.spider.dao;
import net.sf.json.JSONArray;
import com.timerchina.spider.bean.SpiderResult;
import com.timerchina.spider.dao.SpiderCrawlerResultDao;
/**
* 返回JSON格式的结果
* @author [email protected]
* @time 2014-7-18 上午09:51:13
*/
public class GetJSONResult implements SpiderCrawlerResultDao {
/*
* 返回JSON格式的结果
*/
public Object getSpiderResult(SpiderResult spiderResult) {
return JSONArray.fromObject(spiderResult);
}
}
|
[
"[email protected]"
] | |
bff29e57bcbfcc91a9086e5ad2f0acc1f201cfda
|
6f93b780cbbf740dcda17fdcb5f718f98df0ccc9
|
/app/src/main/java/com/teamdonut/eatto/ui/UserDetailDialog.java
|
bd0e57285565b265ba032b37515be71be8121845
|
[] |
no_license
|
boostcampth/boostcamp3_D
|
f925d1ad325acd018288337dbcece514922d269e
|
1512b0081a9e65c5f5a44b45ecc31265b573740e
|
refs/heads/develop
| 2021-07-01T02:15:08.308410 | 2020-09-21T04:42:43 | 2020-09-21T04:42:43 | 166,049,968 | 5 | 6 | null | 2019-10-14T16:11:10 | 2019-01-16T14:03:03 |
Java
|
UTF-8
|
Java
| false | false | 1,282 |
java
|
package com.teamdonut.eatto.ui;
import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
import com.teamdonut.eatto.R;
import com.teamdonut.eatto.databinding.UserDetailDialogBinding;
public class UserDetailDialog extends DialogFragment {
UserDetailDialogBinding binding;
@Override
public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null) {
int matchParent = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(matchParent, matchParent);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
}
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.user_detail_dialog, null, false);
return binding.getRoot();
}
}
|
[
"[email protected]"
] | |
12ca4350d41f9e2a4873015ee9d810e8151f31fe
|
ef830bb18e1f432122e1c9523d4c807c9ef077a5
|
/src/main/java/com/taobao/api/request/QimenItemsTagQueryRequest.java
|
c925581a155dee010c01768016cfa62a91f7757c
|
[] |
no_license
|
daiyuok/TopSecuritySdk
|
bb424c5808bd103079cbbbfcb56689a73259a24d
|
8ac8eb48b88158a741c820a940564fd0b876e9db
|
refs/heads/master
| 2021-01-22T06:49:05.025064 | 2017-03-01T06:19:42 | 2017-03-01T06:19:42 | 81,789,925 | 2 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,339 |
java
|
package com.taobao.api.request;
import com.taobao.api.internal.util.RequestCheckUtils;
import java.util.Map;
import com.taobao.api.ApiRuleException;
import com.taobao.api.BaseTaobaoRequest;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.QimenItemsTagQueryResponse;
/**
* TOP API: taobao.qimen.items.tag.query request
*
* @author top auto create
* @since 1.0, 2016.07.04
*/
public class QimenItemsTagQueryRequest extends BaseTaobaoRequest<QimenItemsTagQueryResponse> {
/**
* 线上淘宝商品ID,long,必填
*/
private String itemIds;
public void setItemIds(String itemIds) {
this.itemIds = itemIds;
}
public String getItemIds() {
return this.itemIds;
}
public String getApiMethodName() {
return "taobao.qimen.items.tag.query";
}
public Map<String, String> getTextParams() {
TaobaoHashMap txtParams = new TaobaoHashMap();
txtParams.put("item_ids", this.itemIds);
if(this.udfParams != null) {
txtParams.putAll(this.udfParams);
}
return txtParams;
}
public Class<QimenItemsTagQueryResponse> getResponseClass() {
return QimenItemsTagQueryResponse.class;
}
public void check() throws ApiRuleException {
RequestCheckUtils.checkNotEmpty(itemIds, "itemIds");
RequestCheckUtils.checkMaxListSize(itemIds, 20, "itemIds");
}
}
|
[
"[email protected]"
] | |
a77aaacee454f092ef9c457b7983f7eff7c6aa13
|
a4874952a63a252023a2a1aeffb8eefd650e9e65
|
/app/src/main/java/com/example/lojacelular/data/network/model/RepositoryMenuPrincipal.java
|
bb89bb4f7abfb6eadbfc9870b9a164a677b8ed1d
|
[] |
no_license
|
luizFelipeBarbosaCode/lojaCelular
|
fb02a8d27f249c66d5c7849dc9eb24c9dd36c56f
|
9e02dc175b04530868c98208897bf423986013bd
|
refs/heads/master
| 2022-12-18T08:55:24.351164 | 2020-09-19T16:20:54 | 2020-09-19T16:20:54 | 296,905,910 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 921 |
java
|
package com.example.lojacelular.data.network.model;
import com.example.lojacelular.R;
import com.example.lojacelular.ui.MenuPrincipal.CelularesClass;
import java.util.ArrayList;
public class RepositoryMenuPrincipal
{
// metodo que é chamado na camada Presenter onde fica responsavel pela criação da tabela de celulares
public ArrayList<CelularesClass> criacaoListaCelulares()
{
ArrayList<CelularesClass> listaMenuPrincipal = new ArrayList<>();
listaMenuPrincipal.add(new CelularesClass(R.drawable.celular1,"CELULAR 1 ","","","","",""));
listaMenuPrincipal.add(new CelularesClass(R.drawable.celular2,"CELULAR 2 ","","","","",""));
listaMenuPrincipal.add(new CelularesClass(R.drawable.celular3,"CELULAR 3 ","","","","",""));
listaMenuPrincipal.add(new CelularesClass(R.drawable.celular4,"CELULAR 4 ","","","","",""));
return listaMenuPrincipal;
}
}
|
[
"[email protected]"
] | |
5830370b930f60acded4da45ce496258bcb20641
|
fee1b269233dab9b9bda4b738d48299d72e8a024
|
/src/main/java/com/tranjt/mortgageplan/MortgagePlanApplication.java
|
1771b289309c0d219fa68c4bb003ae820b36d62e
|
[] |
no_license
|
tranjt/mortgage-plan
|
0cacaabbbd30c194d1d69e0fdbb5c849376658e0
|
56aafe954e9ff15874c536e9b8617d0b89ad4564
|
refs/heads/master
| 2023-09-03T20:47:58.076205 | 2021-11-14T22:38:52 | 2021-11-14T22:38:52 | 426,768,759 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 329 |
java
|
package com.tranjt.mortgageplan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MortgagePlanApplication {
public static void main(String[] args) {
SpringApplication.run(MortgagePlanApplication.class, args);
}
}
|
[
"[email protected]"
] | |
e05e57ebf0747fd02746e7f3a7952ab952b3c00f
|
8c73f38ec4426598b69712c09117febe921612d7
|
/src/org/sosy_lab/cpachecker/util/CFATraversal.java
|
7ac23a8e0ef3df64b31e167a3dd166d11bd3106c
|
[
"Apache-2.0"
] |
permissive
|
TommesDee/cpachecker
|
7c07f97f0d6493e8e1c37395ac290baa21149245
|
63c4d3aa409cf5e3ef942ae532c2baa7a355a825
|
refs/heads/master
| 2021-01-17T05:33:54.675253 | 2014-03-03T21:43:00 | 2014-03-03T21:43:00 | 14,956,754 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 17,502 |
java
|
/*
* CPAchecker is a tool for configurable software verification.
* This file is part of CPAchecker.
*
* Copyright (C) 2007-2012 Dirk Beyer
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* CPAchecker web page:
* http://cpachecker.sosy-lab.org
*/
package org.sosy_lab.cpachecker.util;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.sosy_lab.cpachecker.cfa.model.CFAEdge;
import org.sosy_lab.cpachecker.cfa.model.CFANode;
import org.sosy_lab.cpachecker.cfa.model.MultiEdge;
import org.sosy_lab.cpachecker.cfa.model.c.CFunctionCallEdge;
import org.sosy_lab.cpachecker.cfa.model.c.CFunctionReturnEdge;
import org.sosy_lab.cpachecker.cfa.model.c.CFunctionSummaryEdge;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
/**
* This class provides strategies for iterating through a CFA
* (a set of {@link CFANode}s connected by {@link CFAEdge}s).
* Strategies differ for example in the direction (forwards/backwards),
* and whether summary edges are recognized.
*
* Instances of this class are always immutable, thread-safe and may be re-used.
* Thus, care must be taken when calling methods of this class which return a
* CFATraversal instance. This never mutate the instance on which they are called!
*
* Right code:
* <code>
* CFATraversal traversal = CFATraversal.allEdgesForward();
* traversal = traversal.backwards();
* traversal.traverse(...);
* </code>
*
* Wrong code:
* <code>
* CFATraversal traversal = CFATraversal.allEdgesForward();
* traversal.backwards(); // WRONG!!! Has no effect!
* traversal.traverse(...);
* </code>
*
* For traversing the CFA, a {@link CFAVisitor} needs to be given.
* Several default implementations are available.
*
* Important: The instances of this class do not track a set of already visited
* nodes. Thus a visitor may be called several times for a single node.
* If the visitor never specifies to stop the traversal and the CFA contains loops,
* this will produce an infinite loop!
* It is strongly recommended to use the {@link NodeCollectingCFAVisitor} to
* prevent this and visit each node only once (wrap your own visitor in it).
*/
public class CFATraversal {
private static final Function<CFANode, Iterable<CFAEdge>> FORWARD_EDGE_SUPPLIER
= new Function<CFANode, Iterable<CFAEdge>>() {
@Override
public Iterable<CFAEdge> apply(CFANode node) {
return CFAUtils.allLeavingEdges(node);
}
};
private static final Function<CFANode, Iterable<CFAEdge>> BACKWARD_EDGE_SUPPLIER
= new Function<CFANode, Iterable<CFAEdge>>() {
@Override
public Iterable<CFAEdge> apply(CFANode node) {
return CFAUtils.allEnteringEdges(node);
}
};
// function providing the outgoing edges for a CFANode
private final Function<CFANode, Iterable<CFAEdge>> edgeSupplier;
// function providing the successor node of an edge
private final Function<CFAEdge, CFANode> successorSupplier;
// predicate for whether an edge should be ignored
private final Predicate<CFAEdge> ignoreEdge;
protected CFATraversal(Function<CFANode, Iterable<CFAEdge>> pEdgeSupplier,
Function<CFAEdge, CFANode> pSuccessorSupplier, Predicate<CFAEdge> pIgnoreEdge) {
edgeSupplier = pEdgeSupplier;
successorSupplier = pSuccessorSupplier;
ignoreEdge = pIgnoreEdge;
}
/**
* Returns a default instance of this class, which iterates forward through
* the CFA, visiting all nodes and edges in a DFS-like strategy.
*/
public static final CFATraversal dfs() {
return new CFATraversal(FORWARD_EDGE_SUPPLIER, CFAUtils.TO_SUCCESSOR,
Predicates.<CFAEdge>alwaysFalse());
}
/**
* Returns a new instance of this class which behaves exactly like the current
* instance, except its traversal direction is reversed (e.g., going backwards
* instead of going forwards).
*/
public CFATraversal backwards() {
if (edgeSupplier == FORWARD_EDGE_SUPPLIER) {
return new CFATraversal(BACKWARD_EDGE_SUPPLIER, CFAUtils.TO_PREDECESSOR, ignoreEdge);
} else if (edgeSupplier == BACKWARD_EDGE_SUPPLIER) {
return new CFATraversal(FORWARD_EDGE_SUPPLIER, CFAUtils.TO_SUCCESSOR, ignoreEdge);
} else {
throw new AssertionError();
}
}
/**
* Returns a new instance of this class which behaves exactly like the current
* instance, except it ignores summary edges ({@link CFunctionSummaryEdge}s).
* It will not call the visitor for them, and it will not follow this edge
* during traversing.
*/
public CFATraversal ignoreSummaryEdges() {
return new CFATraversal(edgeSupplier,
successorSupplier,
Predicates.<CFAEdge>or(ignoreEdge,
Predicates.instanceOf(CFunctionSummaryEdge.class)));
}
/**
* Returns a new instance of this class which behaves exactly like the current
* instance, except it ignores function call and return edges.
* It will not call the visitor for them, and it will not follow this edge
* during traversing. Thus it will always stay inside the current function.
*/
@SuppressWarnings("unchecked")
public CFATraversal ignoreFunctionCalls() {
return new CFATraversal(edgeSupplier,
successorSupplier,
Predicates.<CFAEdge>or(
ignoreEdge,
Predicates.instanceOf(CFunctionCallEdge.class),
Predicates.instanceOf(CFunctionReturnEdge.class)
));
}
/**
* Traverse through the CFA according to the strategy represented by the
* current instance, starting at a given node and passing each
* encountered node and edge to a given visitor.
* @param startingNode The starting node.
* @param visitor The visitor to notify.
*/
public void traverse(final CFANode startingNode, final CFATraversal.CFAVisitor visitor) {
Deque<CFANode> toProcess = new ArrayDeque<>();
toProcess.addLast(startingNode);
while (!toProcess.isEmpty()) {
CFANode n = toProcess.removeLast();
CFATraversal.TraversalProcess result = visitor.visitNode(n);
if (result == TraversalProcess.ABORT) {
return;
}
if (result != TraversalProcess.SKIP) {
for (CFAEdge edge : edgeSupplier.apply(n)) {
if (ignoreEdge.apply(edge)) {
continue;
}
result = visitor.visitEdge(edge);
if (result == TraversalProcess.ABORT) {
return;
}
if (result != TraversalProcess.SKIP) {
toProcess.addLast(successorSupplier.apply(edge));
}
}
}
}
return;
}
/**
* Traverse through the CFA according to the strategy represented by the
* current instance, starting at a given node and passing each
* encountered node and edge to a given visitor.
*
* Each node will be visited only once.
* This method does the same as wrapping the given visitor in a
* {@link NodeCollectingCFAVisitor} and calling {@link #traverse(CFANode, CFAVisitor)}.
*
* @param startingNode The starting node.
* @param visitor The visitor to notify.
*/
public void traverseOnce(final CFANode startingNode, final CFATraversal.CFAVisitor visitor) {
traverse(startingNode, new NodeCollectingCFAVisitor(visitor));
}
/**
* Traverse through the CFA according to the strategy represented by the
* current instance, starting at a given node and collecting all encountered nodes.
* @param startingNode The starting node.
* @return A modifiable reference to the set of visited nodes.
*/
public Set<CFANode> collectNodesReachableFrom(final CFANode startingNode) {
NodeCollectingCFAVisitor visitor = new NodeCollectingCFAVisitor();
this.traverse(startingNode, visitor);
return visitor.getVisitedNodes();
}
// --- Useful visitor implementations ---
/**
* An implementation of {@link CFAVisitor} which does two things:
* - It keeps a set of all visited nodes, and provides this set after the traversal process.
* - It prevents the traversal process from visiting a node twice.
*
* Because of the last point it is suggested to always use this visitor.
*
* Instances of this visitor may be re-used.
* In this case, the following uses will re-use the set of visited nodes from
* the first time (i.e., a node visited in the first traversal will not be
* visited in the second traversal)
*/
public final static class NodeCollectingCFAVisitor extends ForwardingCFAVisitor {
private final Set<CFANode> visitedNodes = new HashSet<>();
/**
* Creates a new instance which delegates calls to another visitor, but
* never calls that visitor twice for the same node.
* @param pDelegate The visitor to delegate to.
*/
public NodeCollectingCFAVisitor(CFAVisitor pDelegate) {
super(pDelegate);
}
/**
* Convenience constructor for cases when you only need the functionality
* of this visitor and no other visitor.
*/
public NodeCollectingCFAVisitor() {
super(DefaultCFAVisitor.INSTANCE);
}
@Override
public TraversalProcess visitNode(CFANode pNode) {
if (visitedNodes.add(pNode)) {
return super.visitNode(pNode);
}
return TraversalProcess.SKIP;
}
/**
* Get the set of nodes this visitor has seen so far.
* This set may be modified by the caller. Nodes put in this set will not be
* visited by this visitor, nodes removed from this set may be visited again.
*
* This method may be called even before the first time this visitor is used.
* The returned set may not be modified during a traversal process.
*
* @return A modifiable reference to the set of visited nodes.
*/
public Set<CFANode> getVisitedNodes() {
return visitedNodes;
}
}
/**
* An implementation of {@link CFAVisitor} which keeps track of all visited
* edges.
*/
public final static class EdgeCollectingCFAVisitor extends ForwardingCFAVisitor {
private final List<CFAEdge> visitedEdges = new ArrayList<>();
/**
* Creates a new instance which delegates calls to another visitor.
* @param pDelegate The visitor to delegate to.
*/
public EdgeCollectingCFAVisitor(CFAVisitor pDelegate) {
super(pDelegate);
}
/**
* Convenience constructor for cases when you only need the functionality
* of this visitor and a {@link NodeCollectingCFAVisitor}.
*/
public EdgeCollectingCFAVisitor() {
super(new NodeCollectingCFAVisitor());
}
@Override
public TraversalProcess visitEdge(CFAEdge pEdge) {
visitedEdges.add(pEdge);
return super.visitEdge(pEdge);
}
/**
* Get the list of edges this visitor has seen so far in chronological order.
* The list may contain edges twice, if they were visited several times.
* Note that this is not the case if the {@link NodeCollectingCFAVisitor}
* is used.
*
* The returned list may be modified, but not during the traversal process.
* This will have no effect on the visitor, aside from the results of future
* calls to this method.
*
* @return A reference to the set of visited nodes.
*/
public List<CFAEdge> getVisitedEdges() {
return visitedEdges;
}
}
/**
* An implementation of {@link CFAVisitor} which delegates to several other
* visitors.
* All visitors will be called in the same order for each edge and node.
* If one visitor returns ABORT, the other visitors will still be called,
* and ABORT is returned.
* If one visitor returns SKIP, the other visitors will still be called,
* and SKIP is returned if none of them returned ABORT.
* Otherweise CONTINUE is returned.
*/
public static class CompositeCFAVisitor implements CFAVisitor {
private final ImmutableList<CFAVisitor> visitors;
public CompositeCFAVisitor(Iterable<CFAVisitor> pVisitors) {
visitors = ImmutableList.copyOf(pVisitors);
}
public CompositeCFAVisitor(CFAVisitor... pVisitors) {
visitors = ImmutableList.copyOf(pVisitors);
}
@Override
public TraversalProcess visitEdge(CFAEdge pEdge) {
TraversalProcess totalResult = TraversalProcess.CONTINUE;
for (CFAVisitor visitor : visitors) {
TraversalProcess result = visitor.visitEdge(pEdge);
if (result == TraversalProcess.ABORT) {
totalResult = TraversalProcess.ABORT;
} else if (result == TraversalProcess.SKIP && totalResult != TraversalProcess.ABORT) {
totalResult = TraversalProcess.SKIP;
}
}
return totalResult;
}
@Override
public TraversalProcess visitNode(CFANode pNode) {
TraversalProcess totalResult = TraversalProcess.CONTINUE;
for (CFAVisitor visitor : visitors) {
TraversalProcess result = visitor.visitNode(pNode);
if (result == TraversalProcess.ABORT) {
totalResult = TraversalProcess.ABORT;
} else if (result == TraversalProcess.SKIP && totalResult != TraversalProcess.ABORT) {
totalResult = TraversalProcess.SKIP;
}
}
return totalResult;
}
}
/**
* An implementation of {@link CFAVisitor} that delegates to another visitor
* and splits {@link MultiEdge}s into their contained edges during the process.
*
* No additional CFANodes are visited, only edges.
* The edges of one MultiEdge are always handled in one sequence
* from start to end (forwads), with no other edges or nodes in between,
* regardless of the actual CFATraversal instance.
* Thus it is best to use this implementation only with CFATraversal.dfs().
*/
public static class SplitMultiEdgesCFAVisitor extends CFATraversal.ForwardingCFAVisitor {
protected SplitMultiEdgesCFAVisitor(CFAVisitor pDelegate) {
super(pDelegate);
}
@Override
public TraversalProcess visitEdge(CFAEdge pEdge) {
if (pEdge instanceof MultiEdge) {
for (CFAEdge edge : ((MultiEdge)pEdge).getEdges()) {
TraversalProcess result = visitEdge(edge);
if (result != TraversalProcess.CONTINUE) {
return result;
}
}
return TraversalProcess.CONTINUE;
} else {
return super.visitEdge(pEdge);
}
}
}
// --- Types and classes for implementors of CFAVisitors
/**
* Interface for CFA traversal visitors used by {@link CFATraversal#traverse(CFANode, CFAVisitor)}.
*
* If any of these method throws an exception, the traversal process is
* immediately aborted and the exception is passed to the caller.
*
* @see CFATraversal
*/
public static interface CFAVisitor {
/**
* Called for each edge the traversal process encounters.
* @param edge The current CFAEdge.
* @return A value of {@link TraversalProcess} to steer the traversal process.
*/
TraversalProcess visitEdge(CFAEdge edge);
/**
* Called for each node the traversal process encounters.
* @param node The current CFANode.
* @return A value of {@link TraversalProcess} to steer the traversal process.
*/
TraversalProcess visitNode(CFANode node);
}
/**
* An enum for possible actions a visitor can tell the traversal strategy to
* do next.
*/
public static enum TraversalProcess {
/**
* Continue normally.
*/
CONTINUE,
/**
* Skip following the currently handled node or edge (i.e., the successors won't be visited).
*/
SKIP,
/**
* Completely abort the traversal process (forgetting all nodes and edges which are still to be visited).
*/
ABORT;
}
/**
* A default implementation of {@link CFAVisitor} which does nothing and
* always returns {@link TraversalProcess#CONTINUE}.
*/
public static class DefaultCFAVisitor implements CFAVisitor {
private static final CFAVisitor INSTANCE = new DefaultCFAVisitor();
@Override
public TraversalProcess visitEdge(CFAEdge pEdge) {
return TraversalProcess.CONTINUE;
}
@Override
public TraversalProcess visitNode(CFANode pNode) {
return TraversalProcess.CONTINUE;
}
}
/**
* A default implementation of {@link CFAVisitor} which forwards everything to
* another visitor.
*/
public abstract static class ForwardingCFAVisitor implements CFAVisitor {
protected final CFAVisitor delegate;
protected ForwardingCFAVisitor(CFAVisitor pDelegate) {
delegate = pDelegate;
}
@Override
public TraversalProcess visitEdge(CFAEdge pEdge) {
return delegate.visitEdge(pEdge);
}
@Override
public TraversalProcess visitNode(CFANode pNode) {
return delegate.visitNode(pNode);
}
}
}
|
[
"[email protected]"
] | |
5f5a524063b332936bb023319ff29f51ce290ea6
|
459eef3edd22a5ddf20fc8e8d77d594d74e53bb0
|
/TP-AD_Common/TP-AD_Common/src/beans/MercaderiaBean.java
|
cda2d6528e2dfb74e00bc4c4bc8bc761fb650e9c
|
[] |
no_license
|
SebastianSz84/MisProyectos
|
1337056541afce268575249a3a5de1e8cbba45cd
|
74e4be4871309b89c99a924ebfa86d77ddc30f62
|
refs/heads/master
| 2020-04-14T14:49:50.152632 | 2015-12-21T17:32:43 | 2015-12-21T17:32:43 | 36,565,005 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,749 |
java
|
package beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public abstract class MercaderiaBean implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
protected int idMercaderia;
protected float alto;
protected float ancho;
protected float profundidad;
protected String fragilidad;
protected boolean apilable;
protected int cantApilable;
protected String condDeViaje;
protected String indicacionesManpulacion;
protected String coordenadasDestino;
protected RemitoBean remito;
protected List<MovimientoBean> movimientos;
protected PedidoBean pedido;
protected DepositoBean deposito;
public MercaderiaBean(float alto, float ancho, float profundidad,String fragilidad, boolean aplicable, int cantApilable,
String condDeViaje, String indicacionesManpulacion, String coordenadasDestino, RemitoBean remito, PedidoBean pedido, DepositoBean deposito) {
this.alto = alto;
this.ancho = ancho;
this.profundidad = profundidad;
this.fragilidad = fragilidad;
this.apilable = aplicable;
this.cantApilable = cantApilable;
this.condDeViaje = condDeViaje;
this.indicacionesManpulacion = indicacionesManpulacion;
this.coordenadasDestino = coordenadasDestino;
this.movimientos = new ArrayList<MovimientoBean>();
this.remito=remito;
this.pedido=pedido;
this.deposito=deposito;
}
public MercaderiaBean()
{
this.movimientos = new ArrayList<MovimientoBean>();
}
public int getIdMercaderia() {
return idMercaderia;
}
public void setIdMercaderia(int idMercaderia) {
this.idMercaderia = idMercaderia;
}
public RemitoBean getRemito() {
return remito;
}
public void setRemito(RemitoBean remito) {
this.remito = remito;
}
public List<MovimientoBean> getMovimientos() {
return movimientos;
}
public void setMovimientos(ArrayList<MovimientoBean> movimientos) {
this.movimientos = movimientos;
}
public float getAlto() {
return alto;
}
public float getAncho() {
return ancho;
}
public float getProfundidad() {
return profundidad;
}
public String getFragilidad() {
return fragilidad;
}
public boolean isApilable() {
return apilable;
}
public int getCantApilable() {
return cantApilable;
}
public String getCondDeViaje() {
return condDeViaje;
}
public String getIndicacionesManpulacion() {
return indicacionesManpulacion;
}
public String getCoordenadasDestino() {
return coordenadasDestino;
}
public void setAlto(float alto) {
this.alto = alto;
}
public void setAncho(float ancho) {
this.ancho = ancho;
}
public void setProfundidad(float profundidad) {
this.profundidad = profundidad;
}
public void setFragilidad(String fragilidad) {
this.fragilidad = fragilidad;
}
public void setApilable(boolean apilable) {
this.apilable = apilable;
}
public void setCantApilable(int cantApilable) {
this.cantApilable = cantApilable;
}
public void setCondDeViaje(String condDeViaje) {
this.condDeViaje = condDeViaje;
}
public void setIndicacionesManpulacion(String indicacionesManpulacion) {
this.indicacionesManpulacion = indicacionesManpulacion;
}
public void setCoordenadasDestino(String coordenadasDestino) {
this.coordenadasDestino = coordenadasDestino;
}
public void addMovimiento (MovimientoBean movimiento) {
this.movimientos.add(movimiento);
}
public PedidoBean getPedido() {
return pedido;
}
public void setPedido(PedidoBean pedido) {
this.pedido = pedido;
}
public void setMovimientos(List<MovimientoBean> movimientos) {
this.movimientos = movimientos;
}
public DepositoBean getDeposito() {
return deposito;
}
public void setDeposito(DepositoBean deposito) {
this.deposito = deposito;
}
}
|
[
"[email protected]"
] | |
df877d015e896157c2004404d2f5b6497df3f8ba
|
46a2e8aecb290b264a9897df12e83d8e48574844
|
/src/com/zhao/contorller/SstudentServlet.java
|
78a5b9a9c26e6a47ff192d8880fde3ceec727c8b
|
[] |
no_license
|
zhaoxianghui/Repository1
|
7ce57c81bcea0303054efd81fc68846d916dd5d5
|
7a47668531b453c3442a802668eef3ca86c70bc1
|
refs/heads/master
| 2020-09-21T08:38:20.799220 | 2016-09-06T07:31:43 | 2016-09-06T07:31:43 | 67,481,791 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,237 |
java
|
package com.zhao.contorller;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zhao.entity.Student;
import com.zhao.entity.User;
import com.zhao.model.UserModel;
import com.zhao.model.impl.UserModelImpl;
import com.zhao.util.*;
public class SstudentServlet extends HttpServlet{
private UserModel userModel=new UserModelImpl();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
this.doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
String mobile=req.getParameter("mobile");
String times=req.getParameter("times");
String cid=req.getParameter("cid");
System.out.println(mobile);
List<Student> studentList=userModel.loadAllStudent();
req.setAttribute("student", studentList);
req.setAttribute("date", new Date());
req.getRequestDispatcher("view/Sstudent.jsp").forward(req, resp);
}
}
|
[
"[email protected]"
] | |
d73f28d0836ca467a6338e8537a94fc943491b38
|
2d843beee836ac01790023bc467db65ab308d41f
|
/app/src/main/java/com/betall/app/fragment/RootFragment.java
|
41990536b847c04fad20cc97f3a9de8197ad4641
|
[] |
no_license
|
ZJEdward/Betall
|
e5e052d03d14a4e9347572b24b13952c701daadb
|
4e9573e9dfc104408fdfaf7d8cdef47ca63e40b6
|
refs/heads/master
| 2020-03-13T19:01:12.931623 | 2018-04-27T04:36:52 | 2018-04-27T04:36:52 | 131,245,975 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,459 |
java
|
package com.betall.app.fragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import com.betall.app.R;
import com.qmuiteam.qmui.util.QMUIResHelper;
import com.qmuiteam.qmui.widget.QMUITabSegment;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by fly on 2018/1/29.
*/
public class RootFragment extends BaseFragment {
@BindView(R.id.viewPager)
ViewPager viewPager;
@BindView(R.id.tabBar)
QMUITabSegment tabBar;
private List<BaseFragment> fragments = new ArrayList<>();
@Override
protected View onCreateView() {
LayoutInflater inflater = LayoutInflater.from(this.getActivity());
View view = inflater.inflate(R.layout.fragment_root, null);
ButterKnife.bind(this, view);
this.initTabBar();
this.initViewPagers();
return view;
}
private void initTabBar() {
int normalColor = QMUIResHelper.getAttrColor(getActivity(), R.attr.qmui_config_color_gray_6);
int selectColor = QMUIResHelper.getAttrColor(getActivity(), R.attr.qmui_config_color_blue);
tabBar.setDefaultNormalColor(normalColor);
tabBar.setDefaultSelectedColor(selectColor);
QMUITabSegment.Tab homeTab = new QMUITabSegment.Tab(
ContextCompat.getDrawable(getContext(), R.mipmap.icon_tabbar_component),
ContextCompat.getDrawable(getContext(), R.mipmap.icon_tabbar_component_selected),
"首页", false
);
QMUITabSegment.Tab demoTab = new QMUITabSegment.Tab(
ContextCompat.getDrawable(getContext(), R.mipmap.icon_tabbar_util),
ContextCompat.getDrawable(getContext(), R.mipmap.icon_tabbar_util_selected),
"演示", false
);
QMUITabSegment.Tab meTab = new QMUITabSegment.Tab(
ContextCompat.getDrawable(getContext(), R.mipmap.icon_tabbar_lab),
ContextCompat.getDrawable(getContext(), R.mipmap.icon_tabbar_lab_selected),
"我的", false
);
tabBar.addTab(homeTab)
.addTab(demoTab)
.addTab(meTab);
tabBar.notifyDataChanged();
}
private void initViewPagers() {
HomeFragment homeFragment = new HomeFragment();
DemoFragment demoFragment = new DemoFragment();
MeFragment meFragment = new MeFragment();
fragments.add(homeFragment);
fragments.add(demoFragment);
fragments.add(meFragment);
this.viewPager.setAdapter(this.createAdapter());
// 联动
tabBar.setupWithViewPager(viewPager, false);
}
private FragmentPagerAdapter createAdapter() {
return new FragmentPagerAdapter(getActivity().getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
};
}
@Override
protected boolean canDragBack() {
return false;
}
}
|
[
"[email protected]"
] | |
f902a1a03695749c0b7f66176aac9ab667657fd0
|
9da217a135799afb8faaa3fb5aa3ac15efc202f9
|
/src/Autor.java
|
ce16e58ae759e2bd6ff74bcda8687437a68fe91f
|
[] |
no_license
|
Dinius10/jejejejejejejeje
|
a8b97b69998099886692e6d829efbbf4914533a3
|
45a39f6c880056eeb1887e20a9dc279c40b83cfe
|
refs/heads/master
| 2022-12-05T02:25:25.029645 | 2020-08-29T06:12:35 | 2020-08-29T06:12:35 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 460 |
java
|
import java.util.List;
public class Autor {
//ATRIBUTOS
String nombre;
List<Titulo> titulos;
//metodo constructor por defecto
public Autor(){
}
//sobrecarga de constructores
public Autor(String nombre) {
this.nombre = nombre;
}
//sobrecarga de constructor
public Autor(String nombre, List<Titulo> titulos) {
this.nombre = nombre;
this.titulos = titulos;
}
}
|
[
"[email protected]"
] | |
2152fc25527838391ec19c407094219a7769e1b6
|
76d408a52cde51ebb55826c0a7df434d4242f934
|
/Projet_Bhary_Ayman/src/projet/bahry/Joueur.java
|
461b49681dcd82e14c3f4b912e605babea187fc0
|
[] |
no_license
|
hugobossss/bhary
|
a8b6e734ff1c64afa24567a6f1b9200fde1ec62e
|
5e3c1433f238da5ffecfdbf98552a2bf0db0c4d2
|
refs/heads/master
| 2020-05-06T13:20:09.372668 | 2019-05-09T14:25:42 | 2019-05-09T14:25:42 | 180,128,649 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 493 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package projet.bahry;
import java.util.ArrayList;
/**
*
* @author adahbi
*/
public class Joueur {
private String CouleurJoueur;
private String NomJoueur;
private int Statut;
private ArrayList<Item>ListItem;
private Trace Trace;
private double [] Vitesse[];
}
|
[
"[email protected]"
] | |
e0ebf467ad74a12b952a4f9bdfd11e510a9058f3
|
88ab401009bfd6f518a12cd5b50f886d367efed5
|
/gen/com/facebook/android/R.java
|
53cd9096aa275849c134e722a6aff1eac0606843
|
[] |
no_license
|
pratiknaik/dc-go-home
|
1e71de0cfeebfec9d7f26c5e2aea135a453c1ae8
|
5c20e5a3decbff52091b18811a472962b502632c
|
refs/heads/master
| 2021-01-19T17:47:48.221821 | 2013-09-07T20:27:06 | 2013-09-07T20:27:06 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,426 |
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.facebook.android;
public final class R {
public static final class id {
public static final int com_facebook_picker_title = 0x7f04000a;
public static final int com_facebook_picker_row_activity_circle = 0x7f040006;
public static final int com_facebook_usersettingsfragment_login_button = 0x7f040017;
public static final int com_facebook_usersettingsfragment_logo_image = 0x7f040015;
public static final int com_facebook_picker_checkbox = 0x7f040007;
public static final int normal = 0x7f040001;
public static final int com_facebook_usersettingsfragment_profile_name = 0x7f040016;
public static final int com_facebook_picker_search_text = 0x7f040014;
public static final int picker_subtitle = 0x7f040012;
public static final int com_facebook_picker_title_bar_stub = 0x7f040010;
public static final int com_facebook_picker_profile_pic_stub = 0x7f040009;
public static final int com_facebook_picker_image = 0x7f040008;
public static final int com_facebook_picker_activity_circle = 0x7f040004;
public static final int com_facebook_picker_top_bar = 0x7f04000d;
public static final int com_facebook_picker_list_section_header = 0x7f04000c;
public static final int com_facebook_picker_title_bar = 0x7f040011;
public static final int com_facebook_login_activity_progress_bar = 0x7f040005;
public static final int com_facebook_picker_checkbox_stub = 0x7f04000b;
public static final int com_facebook_picker_divider = 0x7f04000f;
public static final int com_facebook_picker_list_view = 0x7f040003;
public static final int small = 0x7f040000;
public static final int large = 0x7f040002;
public static final int com_facebook_search_bar_view = 0x7f040013;
public static final int com_facebook_picker_done_button = 0x7f04000e;
}
public static final class style {
public static final int com_facebook_loginview_default_style = 0x7f080000;
public static final int com_facebook_loginview_silver_style = 0x7f080001;
}
public static final class color {
public static final int com_facebook_picker_search_bar_background = 0x7f060000;
public static final int com_facebook_blue = 0x7f060002;
public static final int com_facebook_usersettingsfragment_connected_text_color = 0x7f060003;
public static final int com_facebook_usersettingsfragment_not_connected_text_color = 0x7f060005;
public static final int com_facebook_picker_search_bar_text = 0x7f060001;
public static final int com_facebook_usersettingsfragment_connected_shadow_color = 0x7f060004;
public static final int com_facebook_loginview_text_color = 0x7f060006;
}
public static final class string {
public static final int com_facebook_placepicker_subtitle_were_here_only_format = 0x7f07000d;
public static final int com_facebook_requesterror_relogin = 0x7f070015;
public static final int com_facebook_loginview_logged_in_using_facebook = 0x7f070004;
public static final int com_facebook_dialogloginactivity_ok_button = 0x7f070000;
public static final int com_facebook_loginview_log_out_button = 0x7f070001;
public static final int com_facebook_nearby = 0x7f070010;
public static final int com_facebook_requesterror_permissions = 0x7f070018;
public static final int com_facebook_placepicker_subtitle_catetory_only_format = 0x7f07000c;
public static final int com_facebook_loginview_log_in_button = 0x7f070002;
public static final int com_facebook_usersettingsfragment_logged_in = 0x7f070009;
public static final int com_facebook_choose_friends = 0x7f07000f;
public static final int com_facebook_placepicker_subtitle_format = 0x7f07000b;
public static final int com_facebook_loginview_logged_in_as = 0x7f070003;
public static final int com_facebook_requesterror_web_login = 0x7f070014;
public static final int com_facebook_usersettingsfragment_not_logged_in = 0x7f07000a;
public static final int com_facebook_loginview_log_out_action = 0x7f070005;
public static final int com_facebook_requesterror_reconnect = 0x7f070017;
public static final int com_facebook_internet_permission_error_message = 0x7f070013;
public static final int com_facebook_internet_permission_error_title = 0x7f070012;
public static final int com_facebook_requesterror_password_changed = 0x7f070016;
public static final int com_facebook_logo_content_description = 0x7f070007;
public static final int com_facebook_usersettingsfragment_log_in_button = 0x7f070008;
public static final int com_facebook_loading = 0x7f070011;
public static final int com_facebook_loginview_cancel_action = 0x7f070006;
public static final int com_facebook_picker_done_button_text = 0x7f07000e;
}
public static final class layout {
public static final int com_facebook_picker_checkbox = 0x7f030003;
public static final int com_facebook_placepickerfragment = 0x7f03000a;
public static final int com_facebook_login_activity_layout = 0x7f030001;
public static final int com_facebook_picker_activity_circle_row = 0x7f030002;
public static final int com_facebook_picker_title_bar_stub = 0x7f030009;
public static final int com_facebook_friendpickerfragment = 0x7f030000;
public static final int com_facebook_picker_list_row = 0x7f030005;
public static final int com_facebook_picker_image = 0x7f030004;
public static final int com_facebook_picker_list_section_header = 0x7f030006;
public static final int com_facebook_placepickerfragment_list_row = 0x7f03000b;
public static final int com_facebook_picker_title_bar = 0x7f030008;
public static final int com_facebook_picker_search_box = 0x7f030007;
public static final int com_facebook_usersettingsfragment = 0x7f03000d;
public static final int com_facebook_search_bar_layout = 0x7f03000c;
}
public static final class styleable {
public static final int com_facebook_place_picker_fragment_search_text = 2;
public static final int[] com_facebook_friend_picker_fragment = { 0x7f010007 };
public static final int com_facebook_profile_picture_view_is_cropped = 1;
public static final int com_facebook_login_view_logout_text = 3;
public static final int com_facebook_login_view_login_text = 2;
public static final int com_facebook_picker_fragment_title_bar_background = 5;
public static final int com_facebook_friend_picker_fragment_multi_select = 0;
public static final int[] com_facebook_place_picker_fragment = { 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b };
public static final int com_facebook_profile_picture_view_preset_size = 0;
public static final int com_facebook_login_view_fetch_user_info = 1;
public static final int com_facebook_login_view_confirm_logout = 0;
public static final int com_facebook_picker_fragment_extra_fields = 1;
public static final int com_facebook_picker_fragment_title_text = 3;
public static final int[] com_facebook_picker_fragment = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 };
public static final int com_facebook_picker_fragment_done_button_background = 6;
public static final int com_facebook_place_picker_fragment_results_limit = 1;
public static final int com_facebook_picker_fragment_done_button_text = 4;
public static final int com_facebook_picker_fragment_show_title_bar = 2;
public static final int[] com_facebook_profile_picture_view = { 0x7f010010, 0x7f010011 };
public static final int com_facebook_picker_fragment_show_pictures = 0;
public static final int[] com_facebook_login_view = { 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f };
public static final int com_facebook_place_picker_fragment_show_search_box = 3;
public static final int com_facebook_place_picker_fragment_radius_in_meters = 0;
}
public static final class drawable {
public static final int com_facebook_picker_list_selector = 0x7f020014;
public static final int com_facebook_button_check = 0x7f020004;
public static final int com_facebook_picker_default_separator_color = 0x7f020022;
public static final int com_facebook_button_check_on = 0x7f020006;
public static final int com_facebook_profile_picture_blank_portrait = 0x7f02001b;
public static final int com_facebook_picker_list_selector_background_transition = 0x7f020015;
public static final int com_facebook_button_grey_pressed = 0x7f020009;
public static final int com_facebook_picker_list_selector_disabled = 0x7f020016;
public static final int com_facebook_picker_magnifier = 0x7f020017;
public static final int com_facebook_button_grey_focused = 0x7f020007;
public static final int com_facebook_picker_top_button = 0x7f020018;
public static final int com_facebook_button_blue_pressed = 0x7f020003;
public static final int com_facebook_button_blue = 0x7f020000;
public static final int com_facebook_loginbutton_silver = 0x7f02000e;
public static final int com_facebook_profile_picture_blank_square = 0x7f02001c;
public static final int com_facebook_logo = 0x7f02000f;
public static final int com_facebook_usersettingsfragment_background_gradient = 0x7f02001f;
public static final int com_facebook_top_button = 0x7f02001e;
public static final int com_facebook_close = 0x7f02000a;
public static final int com_facebook_picker_list_longpressed = 0x7f020012;
public static final int com_facebook_top_background = 0x7f02001d;
public static final int com_facebook_place_default_icon = 0x7f020019;
public static final int com_facebook_picker_list_pressed = 0x7f020013;
public static final int com_facebook_list_section_header_background = 0x7f02000d;
public static final int com_facebook_profile_default_icon = 0x7f02001a;
public static final int com_facebook_button_blue_focused = 0x7f020001;
public static final int com_facebook_button_blue_normal = 0x7f020002;
public static final int com_facebook_picker_item_background = 0x7f020010;
public static final int com_facebook_picker_list_focused = 0x7f020011;
public static final int com_facebook_list_divider = 0x7f02000c;
public static final int com_facebook_inverse_icon = 0x7f02000b;
public static final int com_facebook_button_check_off = 0x7f020005;
public static final int com_facebook_button_grey_normal = 0x7f020008;
}
public static final class attr {
public static final int preset_size = 0x7f010010;
public static final int radius_in_meters = 0x7f010008;
public static final int is_cropped = 0x7f010011;
public static final int fetch_user_info = 0x7f01000d;
public static final int show_title_bar = 0x7f010002;
public static final int show_search_box = 0x7f01000b;
public static final int done_button_text = 0x7f010004;
public static final int extra_fields = 0x7f010001;
public static final int login_text = 0x7f01000e;
public static final int multi_select = 0x7f010007;
public static final int title_text = 0x7f010003;
public static final int results_limit = 0x7f010009;
public static final int search_text = 0x7f01000a;
public static final int show_pictures = 0x7f010000;
public static final int title_bar_background = 0x7f010005;
public static final int logout_text = 0x7f01000f;
public static final int confirm_logout = 0x7f01000c;
public static final int done_button_background = 0x7f010006;
}
public static final class dimen {
public static final int com_facebook_loginview_text_size = 0x7f050009;
public static final int com_facebook_loginview_compound_drawable_padding = 0x7f050008;
public static final int com_facebook_profilepictureview_preset_size_normal = 0x7f05000b;
public static final int com_facebook_picker_divider_width = 0x7f050001;
public static final int com_facebook_usersettingsfragment_profile_picture_width = 0x7f050002;
public static final int com_facebook_profilepictureview_preset_size_small = 0x7f05000a;
public static final int com_facebook_picker_place_image_size = 0x7f050000;
public static final int com_facebook_loginview_padding_right = 0x7f050005;
public static final int com_facebook_usersettingsfragment_profile_picture_height = 0x7f050003;
public static final int com_facebook_loginview_padding_bottom = 0x7f050007;
public static final int com_facebook_loginview_padding_left = 0x7f050004;
public static final int com_facebook_loginview_padding_top = 0x7f050006;
public static final int com_facebook_profilepictureview_preset_size_large = 0x7f05000c;
}
}
|
[
"[email protected]"
] | |
e89d333f1049a26a44a4e75eb91cc08f16a356bf
|
3b53c1ff0d5d1b1089e0bfadeb0b3e29067d5653
|
/src/com/mahdi/service/dao/UserDao.java
|
2acb3c6475c2d167a55597f320890e915fc83eab
|
[] |
no_license
|
Mahdihp/TestJavaEEServlet
|
5956109e9009382e804685e6f9da1a925c3a8795
|
0d2ef5809ec57dfe3bfc8e0286d5cf004ab414d3
|
refs/heads/master
| 2020-03-25T07:04:06.884689 | 2018-08-04T17:15:42 | 2018-08-04T17:15:42 | 143,539,532 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,444 |
java
|
package com.mahdi.service.dao;
import com.mahdi.service.model.DaoException;
import com.mahdi.service.model.Entity;
import com.mahdi.service.model.UserEntity;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class UserDao extends Dao {
public UserDao() throws Exception {
}
public boolean login(String username, String password) throws DaoException {
String sql = "SELECT * FROM user WHERE username LIKE ? AND password LIKE ?";
PreparedStatement ps = null;
try {
ps = connection.prepareStatement(sql);
ps.setString(1, username);
ps.setString(2, password);
ResultSet rs = ps.executeQuery();
rs.last();
if (rs.getRow() == 0)
return false;
else
return true;
} catch (SQLException e) {
throw new DaoException(e);
}
}
@Override
public void create(Entity entity) throws SQLException {
UserEntity bookEntity = (UserEntity) entity;
String sql = "INSERT INTO user (username,password) VALUES(?,?);";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1, bookEntity.getUsername());
ps.setString(2, bookEntity.getPassword());
ps.executeUpdate();
}
@Override
public Entity read(int id) throws SQLException {
String sql = "SELECT * FROM user WHERE id=?;";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
rs.next();
int idBook = rs.getInt("id");
String username = rs.getString("username");
String password = rs.getString("password");
return new UserEntity(idBook, username, password);
}
@Override
public void update(Entity entity) throws SQLException {
UserEntity bookEntity = (UserEntity) entity;
String sql = "UPDATE user SET username=?,password=? WHERE id=?;";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1, bookEntity.getUsername());
ps.setString(2, bookEntity.getPassword());
ps.setInt(3, bookEntity.getId());
ps.executeUpdate();
}
@Override
public void delete(int id) throws SQLException {
String sql = "DELETE FROM user WHERE id=?;";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setInt(1, id);
ps.executeUpdate();
}
@Override
public Entity[] readAll() throws SQLException {
String sql = "SELECT * FROM user";
UserEntity[] be = null;
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
rs.last();// move to last row
be = new UserEntity[rs.getRow()]; // get row count
rs.beforeFirst(); // move to first row
int i = 0;
while (rs.next()) {
int idBook = rs.getInt("id");
String username = rs.getString("username");
String password = rs.getString("password");
be[i] = new UserEntity(idBook, username, password);
i++;
}
return be;
}
@Override
public void empty() throws SQLException {
String sql = "DELETE FROM user";
PreparedStatement ps = connection.prepareStatement(sql);
ps.executeUpdate();
}
}
|
[
"[email protected]"
] | |
132714b68653a02a4895feb4e9ff56d58e96d9b7
|
40c3043e0bb2aac174006644aefb33a792e8f5bb
|
/app/src/main/java/com/lazy2b/app/interfaces/ICameraOptHandler.java
|
fd9c27c3fc5f0abf93d8d0e4936e0da076369be2
|
[
"Apache-2.0"
] |
permissive
|
lazy2b/LazyDemo
|
a26a2626a89e5708766d3d5c9a0a9e68abade80f
|
58b8af71c9aaacaba8789387efaa356219ca6d3b
|
refs/heads/master
| 2021-01-20T20:47:46.286603 | 2017-02-16T06:36:15 | 2017-02-16T06:36:15 | 64,460,906 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 505 |
java
|
/**
* 项目名:Lazy2b
* 包 名:com.lazy2b.app.interfaces
* 文件名:ICameraOptHandler.java
* 创 建:2016年6月21日下午4:10:13
* Copyright © 2016, GDQL All Rights Reserved.
*/
package com.lazy2b.app.interfaces;
/**
* 类名: ICameraOptHandler <br/>
* 描述: TODO. <br/>
* 功能: TODO. <br/>
*
* @author E-mail:Administrator
* @version $Id: ICameraOptHandler.java 16 2016-06-28 06:45:05Z lazy2b $
*/
public interface ICameraOptHandler {
void takePic();
}
|
[
"[email protected]"
] | |
c7dc009660f64e70a178d08dd0b5e95ccc8d2940
|
b7534fd757c8a35676bc78d197f0536f957c9452
|
/src/GPA.java
|
0473d36d4dfdbf29c6527ab3b0977156a161ce28
|
[] |
no_license
|
NathanCarbee/GPA-Calculator
|
ad305dacf9540b0875579b3f579563b1c0405da0
|
f4ad843badafe0ea98619fd55a9c2864ece00fbc
|
refs/heads/master
| 2020-12-24T19:04:30.625337 | 2016-05-13T11:59:24 | 2016-05-13T11:59:24 | 58,735,906 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,451 |
java
|
import java.util.Scanner;
public class GPA {
public static void main(String[] args) {
//Number of classes
int a = 1;
double b = .5;
int c;
int d;
String newLine = System.getProperty("line.separator");
Scanner in = new Scanner(System.in);
//1 credit(s)
System.out.print("Number of full year classes: ");
c = in.nextInt();
//0.5 credit(s)
System.out.print("Number of half year classes: ");
d = in.nextInt();
System.out.print(newLine);
//Ouputs the number of credits earned
System.out.print((a * c) + (b * d));
System.out.print(newLine);
System.out.print(newLine);
//Grades in these classes
int e;
int f;
int g;
int h;
int i;
int j;
int k;
//weighted
double l;
//Half year classes
System.out.print("Half Year Class 1 Grade: ");
e = in.nextInt();
System.out.print("Half Year Class 2 Grade: ");
f = in.nextInt();
//Full year classes
System.out.print("Full Year Class 1 Grade: ");
g = in.nextInt();
System.out.print("Full Year Class 2 Grade: ");
h = in.nextInt();
System.out.print("Full Year Class 3 Grade: ");
i = in.nextInt();
System.out.print("Full Year Class 4 Grade: ");
j = in.nextInt();
System.out.print("Full Year Class 5 Grade: ");
k = in.nextInt();
System.out.print(newLine);
System.out.print(newLine);
//Outputs total of Half Year Classes
System.out.print("Half Year Class 1: " + e * 0.5);
System.out.print(newLine);
System.out.print("Half Year Class 2: " + f * 0.5);
System.out.print(newLine);
//Outputs total of Full Year Classes
System.out.print("Full Year Classes: " + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1)));
System.out.print(newLine);
//Outputs HY + FY
System.out.print("All Together: " + (((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))));
System.out.print(newLine);
//Outputs HY + FY Turned into generic numeric values
System.out.print("0.0-4.0 Range All Together: " + (((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25);
System.out.print(newLine);
System.out.print(newLine);
//Outputs Un-Weighted GPA
System.out.print("Un-Weighted GPA: " + (((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
System.out.print(newLine);
System.out.print(newLine);
System.out.print("Are there any ");
System.out.print(newLine);
System.out.print("CP/AP/IB/Honors classes?");
System.out.print(newLine);
System.out.print("If so, how many? If none, type '0': ");
l = in.nextDouble();
if (l == 0){
System.out.print(newLine);
System.out.print("Un-Weighted GPA: " + (((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 1){
System.out.print(newLine);
System.out.print("Weighted GPA (1): " + (10.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 2){
System.out.print(newLine);
System.out.print("Weighted GPA (2): " + (18.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 3){
System.out.print(newLine);
System.out.print("Weighted GPA (3): " + (26.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 4){
System.out.print(newLine);
System.out.print("Weighted GPA (4): " + (34.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 5){
System.out.print(newLine);
System.out.print("Weighted GPA (5): " + (42.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 6){
System.out.print(newLine);
System.out.print("Weighted GPA (6): " + (50.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
else
{
if (l == 7){
System.out.print(newLine);
System.out.print("Weighted GPA (7): " + (54.5 + ((f * 0.5) + (e * 0.5)) + ((g * 1) + (h * 1) + (i * 1) + (j * 1) + (k * 1))) / 25 / (c + d));
}
}
}
}
}
}
}
}
}
}
|
[
"[email protected]"
] | |
e0ed4cc6da6d566b870e56cfd3b3c701d5427485
|
498b329209ac6b048876d33c229be694416c0fe0
|
/HealthCareInternetPortal/src/main/java/edu/neu/model/Useraccount.java
|
caf27fe4903c7b8c48e37fe7c5ce3fee5b0afa68
|
[] |
no_license
|
dasarianudeep/healthcareinternet
|
af6ff393d54a8afdd20443bb1673413a035c43cb
|
e34651df25a6eccffb52837266a0addc6e930723
|
refs/heads/master
| 2021-01-10T12:48:57.305949 | 2016-03-15T18:00:45 | 2016-03-15T18:00:45 | 50,638,059 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,779 |
java
|
package edu.neu.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
public class Useraccount implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private int useraccountid;
@NotEmpty(message="Username cannot be left empty")
@Pattern(regexp="^[a-zA-Z]+$", message="Should contain only characters")
@Size(min=6,message="Username should be of minimum length 6")
private String username;
@NotEmpty(message="Password cannot be left empty")
private String password;
@OneToOne
@JoinColumn(name="EmployeeID")
@Valid
private Employee employee;
@NotEmpty(message="Role cannot be left empty")
private String role;
public Useraccount()
{
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public int getUseraccountid() {
return useraccountid;
}
public void setUseraccountid(int useraccountid) {
this.useraccountid = useraccountid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public String toString()
{
return username;
}
}
|
[
"[email protected]"
] | |
ec66d7e8ecfefe34442bfb075f6c6b935574f81a
|
ae3cd9373278feab2a296237973a358b1dca9b94
|
/src/main/java/cn/succy/alarm/mq/AlarmMessageQueue.java
|
ea845771eb5c6ef170a685801309bdb2754172e9
|
[] |
no_license
|
Succy/lg-alarm-sb
|
28511b96c82515527edbea8f11863fc4efdd562f
|
1c99c1b05f5ca2298d4d90ddab931e77ce42be07
|
refs/heads/master
| 2020-04-07T13:21:24.624255 | 2018-03-22T09:47:58 | 2018-03-22T09:47:58 | 124,215,386 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,025 |
java
|
package cn.succy.alarm.mq;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import cn.succy.alarm.entity.SysConf;
import cn.succy.alarm.util.SysConfHelper;
import cn.succy.alarm.util.TemplateModel;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* 警报消息队列,实现自MessageQueue接口
* 内部通过BlockingQueue实现
*/
@Slf4j
public class AlarmMessageQueue<T> implements MessageQueue<T> {
private static final Log logger = LogFactory.get();
private static AlarmMessageQueue<TemplateModel> alarmMessageQueue = null;
private BlockingQueue<T> blockingQueue;
public AlarmMessageQueue() {
SysConf sysConf = SysConfHelper.getSysConf();
Integer size = sysConf.getMessageQueueSize();
int defaultSize = 100;
if (size != null && size != 0) {
defaultSize = size;
}
log.info("Max message queue size: {}", defaultSize);
this.blockingQueue = new LinkedBlockingQueue<>(defaultSize);
}
public static AlarmMessageQueue<TemplateModel> me() {
if (null == alarmMessageQueue) {
alarmMessageQueue = new AlarmMessageQueue<>();
}
return alarmMessageQueue;
}
@Override
public boolean push(T msg) {
try {
// 当可用空间为0时,阻塞等待有空间再插入
this.blockingQueue.put(msg);
} catch (InterruptedException e) {
log.error("AlarmMessageQueue push element failure");
return false;
}
return true;
}
@Override
public T pull() {
try {
// 当队列中没有可读消息时,阻塞等待
return this.blockingQueue.take();
} catch (InterruptedException e) {
log.error("AlarmMessageQueue pull element failure");
}
return null;
}
@Override
public int size() {
return this.blockingQueue.size();
}
}
|
[
"[email protected]"
] | |
fb41bc458bce1a8f02b7e6b0af9b52704b55f134
|
fb7d7b587ffc0ff0b86cfa46940149cf5e4663c8
|
/sfs-server/src/test/java/org/sfs/integration/java/func/PutObject.java
|
addd5d014818e24d056ef5845f7c4c8cc417b635
|
[
"Apache-2.0"
] |
permissive
|
pitchpoint-solutions/sfs
|
9c9d231118d7bf37c9d5672d070a527a1435f3e9
|
d62387f494b369c819e03e5dc9e97b39a9fc85b0
|
refs/heads/master
| 2022-11-11T22:48:48.868752 | 2019-12-13T18:32:07 | 2019-12-13T18:32:07 | 69,255,078 | 94 | 14 |
Apache-2.0
| 2022-10-04T23:43:10 | 2016-09-26T13:53:44 |
Java
|
UTF-8
|
Java
| false | false | 4,289 |
java
|
/*
* Copyright 2016 The Simple File Server Authors
*
* 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.sfs.integration.java.func;
import com.google.common.collect.ListMultimap;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientRequest;
import io.vertx.core.http.HttpClientResponse;
import io.vertx.core.logging.Logger;
import org.sfs.rx.ObservableFuture;
import org.sfs.rx.RxHelper;
import rx.Observable;
import rx.functions.Func1;
import static com.google.common.collect.ArrayListMultimap.create;
import static com.google.common.net.HttpHeaders.AUTHORIZATION;
import static io.vertx.core.buffer.Buffer.buffer;
import static io.vertx.core.logging.LoggerFactory.getLogger;
import static org.sfs.integration.java.help.AuthorizationFactory.Producer;
public class PutObject implements Func1<Void, Observable<HttpClientResponse>> {
private static final Logger LOGGER = getLogger(PutObject.class);
private final HttpClient httpClient;
private final String accountName;
private final String containerName;
private final String objectName;
private final Producer auth;
private final byte[] data;
private final ListMultimap<String, String> headers;
private boolean logRequestBody;
private boolean chunked;
public PutObject(HttpClient httpClient, String accountName, String containerName, String objectName, Producer auth, byte[] data, ListMultimap<String, String> headers) {
this.httpClient = httpClient;
this.accountName = accountName;
this.containerName = containerName;
this.objectName = objectName;
this.auth = auth;
this.headers = headers;
this.data = data;
}
public PutObject(HttpClient httpClient, String accountName, String containerName, String objectName, Producer auth, byte[] data) {
this(httpClient, accountName, containerName, objectName, auth, data, create());
}
public PutObject setHeader(String name, String value) {
headers.removeAll(name);
headers.put(name, value);
return this;
}
public PutObject setHeader(String name, String value, String... values) {
headers.removeAll(name);
headers.put(name, value);
for (String v : values) {
headers.put(name, v);
}
return this;
}
public boolean isChunked() {
return chunked;
}
public PutObject setChunked(boolean chunked) {
this.chunked = chunked;
return this;
}
@Override
public Observable<HttpClientResponse> call(Void aVoid) {
return auth.toHttpAuthorization()
.flatMap(new Func1<String, Observable<HttpClientResponse>>() {
@Override
public Observable<HttpClientResponse> call(String s) {
ObservableFuture<HttpClientResponse> handler = RxHelper.observableFuture();
HttpClientRequest httpClientRequest =
httpClient.put("/openstackswift001/" + accountName + "/" + containerName + "/" + objectName, handler::complete)
.exceptionHandler(handler::fail)
.setTimeout(20000)
.putHeader(AUTHORIZATION, s);
for (String entry : headers.keySet()) {
httpClientRequest = httpClientRequest.putHeader(entry, headers.get(entry));
}
httpClientRequest.setChunked(isChunked());
httpClientRequest.end(buffer(data));
return handler
.single();
}
});
}
}
|
[
"[email protected]"
] | |
9b37e314371ec3cebe14252b885c3b5ddfb89abf
|
752b8db6d6b430aca9d9637c6227e0aef4a9e54b
|
/src/main/java/roo/ph/repository/AuthorRepositoryCustom.java
|
02cf9c75edd8a139af71c7e479c3093cb53f33c6
|
[] |
no_license
|
dkubrakov/ph1
|
892a24e2f2dfbfe42243234fb0cf46421216f8aa
|
53ceb5395e963c2c9b71509b05d6b325ffa9e896
|
refs/heads/master
| 2020-04-12T17:00:47.576049 | 2018-12-20T21:59:19 | 2018-12-20T21:59:19 | 162,631,616 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 323 |
java
|
package roo.ph.repository;
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepositoryCustom;
import roo.ph.domain.Author;
/**
* = AuthorRepositoryCustom
TODO Auto-generated class documentation
*
*/
@RooJpaRepositoryCustom(entity = Author.class)
public interface AuthorRepositoryCustom {
}
|
[
"[email protected]"
] | |
c57728dbd7d61965167328120b9a096ace1327cb
|
3a198be08e3a70b92a9d7450e44dfbc197963726
|
/src/org/artcccj/leetcode/link/ListNode.java
|
c7a21f3c67c50265573a7fa50355cb726e1317b9
|
[] |
no_license
|
artcccj/leetcode
|
324cfcb89377e68990934a06e7d293694c253469
|
8a728b5a0b4148cad6470d5336ab86540c538335
|
refs/heads/main
| 2023-04-04T23:02:07.736682 | 2021-04-19T21:22:40 | 2021-04-19T21:22:40 | 356,785,196 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 595 |
java
|
package org.artcccj.leetcode.link;
import java.util.ArrayList;
import java.util.List;
public class ListNode {
int val;
ListNode next;
public ListNode() {
}
public ListNode(int val) {
this.val = val;
}
public ListNode(int val, ListNode next) {
this.val = val;
this.next = next;
}
@Override
public String toString() {
List<Integer> list = new ArrayList<>();
ListNode c = this;
while (c != null) {
list.add(c.val);
c = c.next;
}
return list.toString();
}
}
|
[
"[email protected]"
] | |
d49bbeeab9cf1e083c076f098887562f0c2e82ad
|
ceeea83e2553c0ffef73bb8d3dc784477e066531
|
/e-Finance/src/com/svs/finance/dao/impl/C_VoucherPurchasesDAOImpl.java
|
649719281827c28b860a87146060172da111f1ae
|
[
"Apache-2.0"
] |
permissive
|
anupammaiti/ERP
|
99bf67f9335a2fea96e525a82866810875bc8695
|
8c124deb41c4945c7cd55cc331b021eae4100c62
|
refs/heads/master
| 2020-08-13T19:30:59.922232 | 2019-10-09T17:04:58 | 2019-10-09T17:04:58 | 215,025,440 | 1 | 0 |
Apache-2.0
| 2019-10-14T11:26:11 | 2019-10-14T11:26:10 | null |
UTF-8
|
Java
| false | false | 1,084 |
java
|
package com.svs.finance.dao.impl;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.svs.finance.bean.VocherPurchaseBean;
import com.svs.finance.dao.IN_VoucherPurchasesDAO;
public class C_VoucherPurchasesDAOImpl implements IN_VoucherPurchasesDAO {
private HibernateTemplate ht;
private List grouplist;
private boolean insertorupdate=false;
private Session session;
@Autowired
public void setSessionFactory(SessionFactory sessionfactory){
ht=new HibernateTemplate(sessionfactory);
session=sessionfactory.openSession();
}
@Override
public boolean generateVoucherPurchases(VocherPurchaseBean voucherpurchases) {
// TODO Auto-generated method stub
try{
long id=(long)ht.save(voucherpurchases);
if(id!=0){
insertorupdate=true;
}else{
insertorupdate=false;
}
}catch(Exception ex){
ex.printStackTrace();
}
return insertorupdate;
}
}
|
[
"[email protected]"
] | |
e28a6b2da1752227df6d9bc465135268b2e27bbf
|
1eebb2025068fe1c51ed3cc5bf1deb0e5e49e5f6
|
/march-concurrent/src/main/java/com/abin/lee/march/svr/concurrent/lru/LruShootCache.java
|
84d93aac36eb6edc19c0c558021481e6856b78ee
|
[
"MIT"
] |
permissive
|
zondahuman/march-svr
|
7febd6a0884d57ea2d08bb2d56fec394659353fe
|
9e12d6549fd8ad122cbc2e02390ad1af57c42f70
|
refs/heads/master
| 2021-01-01T16:47:01.154468 | 2018-05-18T08:48:53 | 2018-05-18T08:48:53 | 97,918,739 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,104 |
java
|
package com.abin.lee.march.svr.concurrent.lru;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by abin on 2018/1/18 23:19.
* march-svr
* com.abin.lee.march.svr.concurrent.lru
* https://www.cnblogs.com/liuyang0/p/6664586.html
*/
public class LruShootCache<K, V> {
private final int MAX_CACHE_SIZE;
private final float DEFAULT_LOAD_FACTORY = 0.75f;
LinkedHashMap<K, V> map;
public LruShootCache(int cacheSize) {
MAX_CACHE_SIZE = cacheSize;
int capacity = (int)Math.ceil(MAX_CACHE_SIZE / DEFAULT_LOAD_FACTORY) + 1;
/*
* 第三个参数设置为true,代表linkedlist按访问顺序排序,可作为LRU缓存
* 第三个参数设置为false,代表按插入顺序排序,可作为FIFO缓存
*/
map = new LinkedHashMap<K, V>(capacity, DEFAULT_LOAD_FACTORY, true) {
@Override
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
return size() > MAX_CACHE_SIZE;
}
};
}
public synchronized void put(K key, V value) {
map.put(key, value);
}
public synchronized V get(K key) {
return map.get(key);
}
public synchronized void remove(K key) {
map.remove(key);
}
public synchronized Set<Map.Entry<K, V>> getAll() {
return map.entrySet();
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
for (Map.Entry<K, V> entry : map.entrySet()) {
stringBuilder.append(String.format("%s: %s ", entry.getKey(), entry.getValue()));
}
return stringBuilder.toString();
}
public static void main(String[] args) {
LruShootCache<Integer, Integer> lru1 = new LruShootCache<>(5);
lru1.put(1, 1);
lru1.put(2, 2);
lru1.put(3, 3);
System.out.println(lru1);
lru1.get(1);
System.out.println(lru1);
lru1.put(4, 4);
lru1.put(5, 5);
lru1.put(6, 6);
System.out.println(lru1);
}
}
|
[
"[email protected]"
] | |
3f1e0c007b184ac419feb322bce899b4d90b1470
|
9f4e7bde6f53364af80d9b66d194b431e82c050c
|
/feign-demo1/src/main/java/com/dayong/demo/feign/config/FeignConfiguration.java
|
b4ffd7901a82d015aa9de99af77c52f75cef856f
|
[] |
no_license
|
dayongchan/feign-invoke
|
cc78594b2e78b09e07f6da7c94d8ae077883b4c3
|
2de98ea53aaac97b1e4be41b19e26cf962d2842a
|
refs/heads/main
| 2023-04-18T04:28:37.975026 | 2021-04-29T11:47:24 | 2021-04-29T11:47:24 | 362,790,220 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,317 |
java
|
package com.dayong.demo.feign.config;
import com.alibaba.fastjson.JSON;
import com.dayong.demo.feign.common.Result;
import feign.Response;
import feign.Util;
import feign.codec.ErrorDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
@Configuration
public class FeignConfiguration {
@Bean
public ErrorDecoder errorDecoder() {
return new MyFeignErrorDecoder();
}
public class MyFeignErrorDecoder implements ErrorDecoder {
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public Exception decode(String methodKey, Response response) {
Exception exception = null;
try {
int status = response.status();
if (status != 200) {
String json = Util.toString(response.body().asReader());
Result result = JSON.parseObject(json, Result.class);
exception = new RuntimeException(result.getMsg(), result.getCause());
}
} catch (IOException ex) {
logger.error(ex.getMessage(), ex);
}
return exception;
}
}
}
|
[
"[email protected]"
] | |
e654de5dc9141961dbceee8b70965975e32c3e42
|
2e6a112bfe9cdb05cbb213acefa025141ed7c543
|
/src/main/java/weka/attributeSelection/RerankingSearch.java
|
fdd4cac1f9edc32c4749f841b2300bd0fbdcef79
|
[] |
no_license
|
UCLM-SIMD/FastFeatureSelection
|
3271cdc4166a903a2e674c39cc80ffc524872f58
|
018e2999c6cd7ee7fe0364f1049ba02a1f184b8b
|
refs/heads/master
| 2021-01-08T20:25:57.825856 | 2020-02-21T12:24:38 | 2020-02-21T12:24:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 31,222 |
java
|
package weka.attributeSelection;
import weka.core.Attribute;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.Tag;
import weka.core.Utils;
import weka.core.SelectedTag;
import weka.core.Capabilities.Capability;
import weka.filters.Filter;
import weka.filters.supervised.attribute.Discretize;
import weka.filters.unsupervised.attribute.Remove;
import weka.attributeSelection.Ranker;
import java.util.Enumeration;
import java.util.Vector;
/**
* <!-- globalinfo-start --> Meta-Search algorithm. It first creates an univariate ranking of all
* attributes in decreasing order given an information-theory-based
* AttributeEvaluator; then, the ranking is split in blocks of size B, and a
* ASSearch is run for the first block. Given the selected attributes, the rest
* of the ranking is re-ranked based on conditional IG of each attribute given the selected
* attributes so far. Then ASSearch is run again on the first current
* block, and so on. Search stops when no attribute is selected in current block. For more
* information, see <br/>
* <br/>
* Pablo Bermejo et. al. Fast wrapper feature subset selection in
* high-dimensional datasets by means of filter re-ranking. Knowledge-Based
* Systems. Volume 25 Issue 1. February 2012.
* <p/>
* <!-- globalinfo-end -->
*
* <!-- technical-bibtex-start --> BibTeX:
*
* <pre>
* @article{BermejoRerank,
* author = "Pablo Bermejo and Luis de la Ossa and Jose A. Gamez and Jose M. Puerta",
* title = "Fast wrapper feature subset selection in high-dimensional datasets by means of filter re-ranking",
* journal = "Knowledge-Based Systems",
* number = "1",
* pages = " - ",
* year = "2012",
* doi = "DOI: 10.1016/j.knosys.2011.01.015",
* }
*
* </pre>
* <p/>
* <!-- technical-bibtex-end -->
*
* <!-- options-start --> Valid options are:
*
*
* <pre>
* -method <num>
* Specifies the method used to re-ranking attributes
* (default 0: CMIM)
* </pre>
*
* <pre>
* -blockSize <num>
* Specifies the size of blocks over which search is performed
* (default 20)
* </pre>
*
*
* <pre>
* -rankingMeasure <num>
* information-theory-based univariate attribute evaluator to create first ranking
* (default 0: Information Gain)
* </pre>
*
* <pre>
* -search <ASSearch algorithm>
* Class name of ASSearch search algorithm to be used over blocks.
* Place any options of the search algorithm LAST on the command line
* following a "--". eg.:
* -search weka.attributeSelection.GreedyStepwise ... -- -C
* </pre>
* <p/>
*
*
*
* <!-- options-end -->
*
* @author Pablo Bermejo ([email protected])
* @version $Revision: 1.1 $
*/
public class RerankingSearch extends ASSearch implements OptionHandler {
/** for serialisation */
static final long serialVersionUID = -6538648431457629831L;
/** Re-rank method */
protected int m_rerankMethod = CMIM;
/** Block size */
protected int m_B = 20;
protected boolean m_equalWidth=false;
/**
* Uni-varaite Attribute evaluator respect to the class. This is used to
* create the first ranking of attributes. It should be an information-based
* evaluation
*/
protected int m_informationBasedEvaluator = IG;
/** search algorithm applied over block to select attributes */
protected ASSearch m_searchAlgorithm = new weka.attributeSelection.GreedyStepwise();
/** attribute set evaluator applied in search */
protected ASEvaluation m_ASEval;
/** Total time (ms) spent in search */
protected double m_searchTime_ms;
/** Time (ms) spent in re-ranking */
protected double m_rerankingTime_ms;
/** Total number of blocks over which search was performed */
protected int m_blocksSearched;
/** selected attributes */
protected int[] m_selected;
/** Fleuret's Conditional Mutual Information Maximization */
public static final int CMIM = 0;
/** Battiti's Mutual Information-Based Feature Selection */
public static final int MIFS = 1;
/** Peng's Max-Relevance and Min-Redundancy */
public static final int MRMR = 2;
public static final int IG = 0;
public static final int SU = 1;
/** ranking of attributes in decreasing order given m_univariateEvaluator */
protected int[] m_ranking;
/**
* merit of each attribute evaluated by m_univariateEvaluator.
* Position i refers to attribute i in training data
*/
protected double[] m_attributes_merits_globalIndexes;
public static final Tag[] TAGS_RERANK = {
new Tag(CMIM,
"Fleuret's Conditional Mutual Information Maximization."),
new Tag(MIFS,
"Battiti's Mutual Information-Based Feature Selection."),
new Tag(MRMR, "Peng's Max-Relevance and Min-Redundancy") };
public static final Tag[] TAGS_INFORMATION_BASED_EVAL = {
new Tag(IG, "Information Gain."),
new Tag(SU, "Symmetrical Uncertainty."), };
public RerankingSearch() {
resetOptions();
}
/**
* Performs search
*
* @param ASEval
* the attribute evaluator to guide the search
* @param data
* the training instances.
* @return an array (not necessarily ordered) of selected attribute indexes
* @throws Exception
* if the search can't be completed
*/
@Override
public int[] search(ASEvaluation ASEval, Instances data) throws Exception {
if (!(ASEval instanceof SubsetEvaluator)) {
throw new Exception(m_ASEval.getClass().getName() + " is not a "
+ "Subset evaluator!");
}
m_selected = new int[0];
long start = System.currentTimeMillis();
String startSet_relativeIndexes = "";
int[] lastGlobalSelected = null;
boolean anySelected = true;
// discretize data for ranking and re-ranking computations
Instances discretized_data=discretize(data);
createUnivariateRanking(discretized_data);
while (anySelected) {
m_blocksSearched++;
Instances block;
if(ASEval.getCapabilities().handles(Capability.NUMERIC_ATTRIBUTES)){
block = projectBlock(data);
} else block=projectBlock(discretized_data);
((StartSetHandler) m_searchAlgorithm)
.setStartSet(startSet_relativeIndexes);
m_ASEval = (ASEvaluation.makeCopies(ASEval, 1))[0];
m_ASEval.buildEvaluator(block);
int[] atts = m_searchAlgorithm.search(m_ASEval, block);
startSet_relativeIndexes = getStartSetString(atts.length);
m_selected = getGlobalIndexes(atts, block, data);
if (different(m_selected, lastGlobalSelected)
&& m_ranking.length != 0) {
lastGlobalSelected = m_selected;
rerank(discretized_data);
} else
anySelected = false;
}
m_searchTime_ms = System.currentTimeMillis() - start;
return m_selected;
}
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
*
* <pre>
* -method <num>
* Specifies the method used to re-ranking attributes
* (default 0: CMIM)
* </pre>
*
* <pre>
* -blockSize <num>
* Specifies the size of blocks over which search is performed
* (default 20)
* </pre>
*
*
* <pre>
* -rankingMeasure <num>
* information-theory-based univariate attribute evaluator to create first ranking
* (default 0: Information Gain)
* </pre>
*
* <pre>
* -search <ASSearch algorithm>
* Class name of ASSearch search algorithm to be used over blocks.
* Place any options of the search algorithm LAST on the command line
* following a "--". eg.:
* -search weka.attributeSelection.GreedyStepwise ... -- -C
* </pre>
*
*/
@Override
public void setOptions(String[] options) throws Exception {
resetOptions();
String selectionString = Utils.getOption("method", options);
if (selectionString.length() != 0) {
setRerankMethod(new SelectedTag(Integer.parseInt(selectionString),
TAGS_RERANK));
}
selectionString = Utils.getOption("blockSize", options);
if (selectionString.length() != 0) {
setB(Integer.parseInt(selectionString));
}
selectionString = Utils.getOption("rankingMeasure", options);
if (selectionString.length() != 0)
setInformationBasedEvaluator(new SelectedTag(
Integer.parseInt(selectionString),
TAGS_INFORMATION_BASED_EVAL));
selectionString = Utils.getOption("search", options);
if (selectionString.length() != 0){
String[] searchSpec=Utils.splitOptions(selectionString);
String searchName=searchSpec[0];
searchSpec[0]="";
setSearchAlgorithm(ASSearch.forName(searchName, searchSpec));
}
}
/**
* get a String[] describing the value set for all options
*
* @return String[] describing the options
*/
@Override
public String[] getOptions() {
int length=8;
String[] options = new String[length];
String[] searchOptions=new String[0];
if(m_searchAlgorithm instanceof OptionHandler)
searchOptions=((OptionHandler)getSearchAlgorithm()).getOptions();
int current = 0;
options[current++] = "-method";
options[current++] = "" + getRerankMethod().getSelectedTag().getID();
options[current++] = "-blockSize";
options[current++] = "" + getB();
options[current++] = "-rankingMeasure";
options[current++] = ""
+ getInformationBasedEvaluator().getSelectedTag().getID();
options[current++] = "-search";
options[current++] = getSearchSpec();
return options;
}
/**
* It creates a ranking of attributes in decreasing order of merit, given
* the chosen attribute evaluator. It initiates m_ranking[] with the indexes
* of attributes ranked in decreasing order of merit.
* Furthermore, it initiates m_attributes_merits_globalIndexes[] with
* the merit of attributes (index i refers to the merit of attribute i in data).
*
* @param data
* from which to build evaluator
* @throws Exception
*/
protected void createUnivariateRanking(Instances data) throws Exception {
AttributeEvaluator eval = null;
switch (m_informationBasedEvaluator) {
case IG:
eval = new weka.attributeSelection.InfoGainAttributeEval();
break;
case SU:
eval = new weka.attributeSelection.SymmetricalUncertAttributeEval();
break;
default:
throw new Exception("Unknown attribute evaluator: "
+ m_informationBasedEvaluator);
}
((ASEvaluation) eval).buildEvaluator(data);
Ranker ranker = new Ranker();
ranker.search((ASEvaluation) eval, data);
double[][] r = ranker.rankedAttributes();
m_ranking = new int[data.numAttributes() - 1];
m_attributes_merits_globalIndexes = new double[data.numAttributes() - 1];
for (int i = 0; i < m_ranking.length; i++) {
m_ranking[i] = (int) r[i][0];
m_attributes_merits_globalIndexes[m_ranking[i]] = r[i][1];
}
}
/**
*
* It projects data over attributes selected up to know + first m_B
* attributes in ranking + the class attribute. Then, it removes first
* m_B attributes from m_ranking.
*
* @param data
* from which to project attributes to create a block
*
* @return Intances object with block over which to perform search
* @throws Exception
*/
protected Instances projectBlock(Instances data) throws Exception {
Instances block;
int numberToCopy = (m_B <= m_ranking.length) ? m_B : m_ranking.length;
int[] atts = new int[m_selected.length + numberToCopy + 1];
System.arraycopy(m_selected, 0, atts, 0, m_selected.length);
System.arraycopy(m_ranking, 0, atts, m_selected.length, numberToCopy);
atts[atts.length - 1] = data.numAttributes() - 1;
Remove myfilter = new Remove();
myfilter.setAttributeIndicesArray(atts);
myfilter.setInvertSelection(true);
myfilter.setInputFormat(data);
block = Filter.useFilter(data, myfilter);
int classIndex = block.numAttributes() - 1;
block.setClassIndex(classIndex);
// remove block's attributes from ranking
int[] newRanking = new int[m_ranking.length - numberToCopy];
System.arraycopy(m_ranking, numberToCopy, newRanking, 0,
newRanking.length);
m_ranking = newRanking;
return block;
}
/**
* It converts the indexes of attributes in relative[] referring to
* relativeData, to the indexes of the referred attributes in globalInstances
* data.
*
* @param relative
* attributes indexes selected in previous block
* @param relativeData
* previous block
* @param globalData
* original data with all the attributes
* @return the global index of attributes selected in previous block
*/
protected int[] getGlobalIndexes(int[] relative, Instances relativeData,
Instances globalData) {
int[] global = new int[relative.length];
for (int i = 0; i < relative.length; i++) {
String name = relativeData.attribute(relative[i]).name();
global[i] = globalData.attribute(name).index();
}
return global;
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
**/
@Override
public Enumeration<Option> listOptions() {
Vector<Option> newVector = new Vector<Option>();
newVector.addElement(new Option(
"\tSpecifies the method used to re-ranking attributes\n"
+ "\t(default 0: CMIM)", "method", 1, "-method <num>"));
newVector
.addElement(new Option(
"\tSpecifies the size of blocks over which search is performed\n"
+ "\t(default 20)", "blockSize", 1,
"-blockSize <num>"));
newVector
.addElement(new Option(
"\tInformation-theory-based univariate attribute evaluator to create first ranking\n"
+ "\t(default 0: Information Gain)",
"rankingMeasure", 1, "-rankingMeasure <num>"));
newVector
.addElement(new Option(
"\tClass name of ASSearch search algorithm to be used over blocks.\n"
+ "\tPlace any options of the search algorithm LAST on the command line following a '--'. eg.:\n"
+ "\t -search weka.attributeSelection.GreedyStepwise ... -- -C\n"
+ "\t(default: weka.attributeSelection.GreeyStepwise)",
"search", 1, "-search <search algorithm>"));
return newVector.elements();
}
/**
* re-rank remaining attributes in m_ranking[] given m_selected[]
*
* @param data
* original training data
*/
protected void rerank(Instances data) throws Exception {
long start = System.currentTimeMillis();
//if B is very small, first block search might not select any features, so we do
//not rerank and just expand later the block with next B features.
if(m_selected.length>0){
switch (m_rerankMethod) {
case CMIM:
rerankCMIM(data);
break;
case MIFS:
rerankMIFS_MRMR(data, 0.5);
break;
case MRMR:
rerankMIFS_MRMR(data, 1 / m_selected.length);
break;
default:
throw new Exception("Unknown rerank method: " + m_rerankMethod);
}
}
m_rerankingTime_ms += System.currentTimeMillis() - start;
}
/**
* Creates a string of attributes indexes separated by commas. Since
* attributes selected in the preivous block are appended at the beginning
* of the new block, we know the relative indexes start by 0.
*
* @param numberSelected
* cardinaility of attributes selected in previous block
* @return String with start set indexes for next block
*/
protected String getStartSetString(int numberSelected) {
String ss = "";
if (numberSelected == 0)
return ss;
for (int i = 0; i < numberSelected - 1; i++)
ss += (i + 1) + ","; // indexes in a startset start by 1
ss += numberSelected;
return ss;
}
/**
* check if two arrays contain the same values, in any order
*
* @param a
* []
* @param b
* []
* @return true if a[] and b[] do not have the same integer values
*/
protected boolean different(int a[], int b[]) {
if (a == null || b == null)
return true;
if (a.length != b.length)
return true;
for (int n : a) {
if (!isIn(n, b))
return true;
}
return false;
}
/**
* Check if value n is in array
*
* @param n
* @param array
* @return true if n is in array in any position
*/
protected boolean isIn(int n, int array[]) {
for (int m : array)
if (n == m)
return true;
return false;
}
/**
* Get a deep copy of the search algorithm used over blocks
*
* @return deep copy of current m_searchAlgorithm
*/
public ASSearch getSearchAlgorithm() {
return m_searchAlgorithm;
}
/**
* set the search algorithm to use over blocks in ranking
*
* @param m_searchAlgorithm
* new search algorithm to be used over blocks
*/
public void setSearchAlgorithm(ASSearch search) throws Exception{
if(!(search instanceof StartSetHandler)){
throw new Exception("Search algorithm needs to be a StartSetHandler! (for reranking porpuses)");
}
m_searchAlgorithm = search;
}
/**
* Get method used for re-ranking
*
* @return SelectedTag indicating the type of re-ranking
*/
public SelectedTag getRerankMethod() {
return new SelectedTag(m_rerankMethod, TAGS_RERANK);
}
/**
* Set method to use for re-ranking
*
* @param newType
* the type of re-rerank method desired
*/
public void setRerankMethod(SelectedTag newType) throws Exception {
if (newType.getTags() == TAGS_RERANK) {
m_rerankMethod = newType.getSelectedTag().getID();
} else {
throw new Exception("Wrong SelectedTag: "
+ newType.getSelectedTag().getID());
}
}
/**
* total time in milliseconds spent during the search
*
* @return double search time in milliseconds
*/
public double getSearchTime_ms() {
return m_searchTime_ms;
}
/**
* time in milliseconds spent during the search in re-ranking computations
*
* @return double time spent in re-ranking
*/
public double getRerankingTime_ms() {
return m_rerankingTime_ms;
}
/**
* get number of blocks attributes in ranking over which search has been
* performed. This is the number of re-rankings performed + 1
*
* @return int number of blocks searched
*/
public int getBlocksSearched() {
return m_blocksSearched;
}
/**
* get size of blocks over which search is performed
*
* @return m_B size (cardinality) of blocks over which search is performed
*/
public int getB() {
return m_B;
}
/**
* set size of blocks (cardinality) over which search is performed
*
* @param B
*/
public void setB(int B) {
m_B = B;
}
/**
* * Get method used to crate first univariate ranking
*
* @return SelectedTag evaluator used to generate the original ranking
*/
public SelectedTag getInformationBasedEvaluator() {
return new SelectedTag(m_informationBasedEvaluator,
TAGS_INFORMATION_BASED_EVAL);
}
/**
* set evaluator to create univariate ranking
*
* @param newType
* the information-based univariate evaluation to create first
* ranking
*/
public void setInformationBasedEvaluator(SelectedTag newType)
throws Exception {
if (newType.getTags() == TAGS_INFORMATION_BASED_EVAL) {
m_informationBasedEvaluator = newType.getSelectedTag().getID();
} else {
throw new Exception("Wrong SelectedTag: "
+ newType.getSelectedTag().getID());
}
}
/**
* reset all options to their default values
*/
public void resetOptions() {
m_rerankMethod = CMIM;
m_B = 20;
m_informationBasedEvaluator = IG;
m_searchAlgorithm = new weka.attributeSelection.GreedyStepwise();
}
/**
* Returns the tip text for this property.
*
* @return tip text for this property suitable for displaying in the
* explorer/experimenter gui
*/
public String rerankMethodTipText() {
return new String(
"Type of IG(X;C|S) approximation for re-ranking remaining attributes in ranking after"
+ " the current block has ben processed and S is the current subset of selected attributes.");
}
/**
* get list of attributes selected in search
*
* @return int[] of attributes selected
*/
public int[] getSelected() {
int[] copy = new int[m_selected.length];
System.arraycopy(m_selected, 0, copy, 0, m_selected.length);
return copy;
}
/**
* Returns the tip text for this property.
*
* @return tip text for this property suitable for displaying in the
* explorer/experimenter gui
*/
public String bTipText() {
return new String("Size of each block to split ranking.");
}
/**
* Returns the tip text for m_univariteEvaluator
*
* @return tip text for displaying in the explorer/experimenter gui
*/
public String informationBasedEvaluatorTipText() {
return new String(
"Evaluator used to create former ranking of attributes respect to "
+ "the class.");
}
/**
* Returns the tip text for this property.
*
* @return tip text for this property suitable for displaying in the
* explorer/experimenter gui
*/
public String searchAlgorithmTipText() {
return new String("ASSearch algorithm to run over blocks.");
}
/**
* Returns a string describing this search method
*
* @return a description of the search suitable for displaying in the
* explorer/experimenter gui
*/
public String globalInfo() {
return "Meta-Search algorithm. It first creates an univariate ranking of all "
+"attributes in decreasing order given an information-theory-based "
+"AttributeEvaluator; then, the ranking is split in blocks of size B, and a "
+"ASSearch is run for the first block. Given the selected attributes, the rest "
+"of the ranking is re-ranked based on conditional IG of each attribute given the selected "
+"attributes so far. Then ASSearch is run again on the first current "
+"block, and so on. Search stops when no attribute is selected in current block. For more "
+"information, see "
+"\"Pablo Bermejo et. al. Fast wrapper feature subset selection in "
+"high-dimensional datasets by means of filter re-ranking. Knowledge-Based "
+"Systems. Volume 25 Issue 1. February 2012\".";
}
/**
* Description of the search
*
* @return String
*/
@Override
public String toString() {
String results = "Selected attributes: ";
for (int i : m_selected)
results += i + " ";
results += "\nTotal Search Time in milliseconds: " + getSearchTime_ms();
results += "\nReranking Time in milliseconds: " + getRerankingTime_ms();
results += "\nBlocks searched: " + getBlocksSearched();
results += "\nAttribute Evaluator during search: "
+ m_ASEval.toString();
results += "\nOptions of RerankingSearch:\n";
String[] options = getOptions();
for (String s : options)
results += s + " ";
return results;
}
/**
* Modifies m_ranking ordering attributes in decreasing order of Fleuret's
* CMIM approximation of I(Xi;C|m_selected) for all Xi in m_ranking. CMIM
* approximates this value with formula: max_Xi min_Xj I(Xi;C|m_selected)
* for all Xi in m_ranking and all Xj in m_selected
*
* @param data from which to compute conditional mutual informations
*
*/
protected void rerankCMIM(Instances data) throws Exception {
double[][] I_XiC_givenS = new double[m_ranking.length][m_selected.length];
for (int i = 0; i < m_ranking.length; i++) {
for (int j = 0; j < m_selected.length; j++) {
I_XiC_givenS[i][j] = getConditionalMutualInformation(
m_ranking[i], data.numAttributes() - 1, m_selected[j],
data);
}
}
int[] maxToMin = minMaxOrder(I_XiC_givenS);
I_XiC_givenS = null;
int[] auxRanking = new int[m_ranking.length];
for (int i = 0; i < auxRanking.length; i++) {
auxRanking[i] = m_ranking[maxToMin[i]];
}
m_ranking = auxRanking;
}
/**
* Modifies m_ranking ordering attributes in decreasing order of approximation
* of I(Xi;C|m_selected) for all Xi in m_ranking, and all
* Xj in m_selected.
* MIFS approximates this value with Battiti's formula:
* I(Xi,C) - (0.5* sum I(Xi,Xj)).
* MRMR approximates this value with Peng's formula:
* I(Xi,C) - (1/|S| * sum I(Xi,Xj)).
* Thus, the only difference between both methods is
* the multiplicaton factor
*
* @param data to compute mutual information values
* @param factor double value used to multiply by mutual informations
*/
protected void rerankMIFS_MRMR(Instances data, double factor)
throws Exception {
double[] sumI_XiXj = new double[m_ranking.length];
for (int i = 0; i < m_ranking.length; i++) {
for (int j = 0; j < m_selected.length; j++) {
sumI_XiXj[i] += getMutualInformation(m_ranking[i],
m_selected[j], data);
}
}
double[] values = new double[m_ranking.length];
for (int i = 0; i < m_ranking.length; i++) {
values[i] = getMutualInformation(m_ranking[i],
data.numAttributes() - 1, data) - (factor * sumI_XiXj[i]);
}
sumI_XiXj = null;
int[] minToMax = weka.core.Utils.stableSort(values);
int[] maxToMin = new int[minToMax.length];
for (int i = 0; i < maxToMin.length; i++) {
maxToMin[i] = minToMax[minToMax.length - 1 - i];
}
minToMax = null;
int[] auxRanking = new int[m_ranking.length];
for (int i = 0; i < auxRanking.length; i++) {
auxRanking[i] = m_ranking[maxToMin[i]];
}
m_ranking = auxRanking;
}
/**
*
*
* @param I_XiC_givenXj
* conditional information I(X;C|m_selected) for all Xi in
* training data
* @return int[] indexes in first dimension of I_XiC_givenXj , sorted in
* decreasing order of max_Xi min_Xj I(Xi;C|m_selected)
*
*/
protected int[] minMaxOrder(double[][] I_XiC_givenXj) {
int[][] minToMax = new int[I_XiC_givenXj.length][I_XiC_givenXj[0].length];
for (int i = 0; i < minToMax.length; i++) {
minToMax[i] = weka.core.Utils.stableSort(I_XiC_givenXj[i]);
}
double[] values = new double[I_XiC_givenXj.length];
for (int i = 0; i < I_XiC_givenXj.length; i++) {
values[i] = I_XiC_givenXj[i][minToMax[i][0]];
}
int[] minToMax2 = weka.core.Utils.stableSort(values);
int[] maxToMin = new int[minToMax2.length];
for (int i = 0; i < maxToMin.length; i++) {
maxToMin[i] = minToMax2[minToMax2.length - 1 - i];
}
return maxToMin;
}
/**
* Computes I(X;Y|Z)
*
* @param posX
* index of att X
* @param posY
* index of att Y
* @param posZ
* index of conditioning attribute Z
* @param data
* training data
* @return double conditional mutual information I(X;Y|Z)
* @throws Exception
*/
protected double getConditionalMutualInformation(int posX, int posY,
int posZ, Instances data) throws Exception {
// get number of states per attribute
int nx = data.attribute(posX).numValues();
int ny = data.attribute(posY).numValues();
int nz = data.attribute(posZ).numValues();
// compute necessary distributions
double[] pz = getMarginalProb(posZ, data);
double[][] pxz = getJointXY(posX, posZ, data);
double[][] pyz = getJointXY(posY, posZ, data);
double[][][] pxyz = getJointXYZ(posX, posY, posZ, data);
// compute conditional mutual information
double cmi = 0.0;
for (int z = 0; z < nz; z++)
for (int y = 0; y < ny; y++)
for (int x = 0; x < nx; x++)
if (pxyz[x][y][z] == 0.0)
cmi += 0.0;
else
cmi += (pxyz[x][y][z] * Utils
.log2((pz[z] * pxyz[x][y][z])
/ (pxz[x][z] * pyz[y][z])));
return cmi;
}
/**
* Computes I(X;Y)
*
* @param posX
* index of att X
* @param posY
* index of att Y
* @param data
* training data
* @return double mutual information I(X;Y)
* @throws Exception
*/
protected double getMutualInformation(int posX, int posY, Instances data) {
// get number of states per attribute
int nx = data.attribute(posX).numValues();
int ny = data.attribute(posY).numValues();
// compute necessary distributions
double[] px = getMarginalProb(posX, data);
double[] py = getMarginalProb(posY, data);
double[][] pxy = getJointXY(posX, posY, data);
// compute mutual information
double mi = 0.0;
for (int y = 0; y < ny; y++)
for (int x = 0; x < nx; x++)
if (pxy[x][y] == 0.0)
mi += 0.0;
else
mi += (pxy[x][y] * Utils.log2(pxy[x][y] / (px[x] * py[y])));
return mi;
}
/**
* Compute joint probability por attribute pX and pY in data
*
* @return double[][] joint probabilities
*/
protected double[][] getJointXY(int pX, int pY, Instances data) {
int nvX = data.attribute(pX).numValues();
int nvY = data.attribute(pY).numValues();
double[][] prob = new double[nvX][nvY];
double tot = data.numInstances();
for (int i = 0; i < nvX; i++)
for (int j = 0; j < nvY; j++)
prob[i][j] = 0.0;
Instance row = null;
for (int j = 0; j < data.numInstances(); j++) {
row = data.instance(j);
prob[(int) row.value(pX)][(int) row.value(pY)]++;
}
// normalize
for (int i = 0; i < nvX; i++)
for (int j = 0; j < nvY; j++) {
prob[i][j] /= tot;
}
return prob;
}
/**
* Compute joint probability por attribute pX, pY and pZ in data
*
* @return double[][] joint probabilities
*/
protected double[][][] getJointXYZ(int pX, int pY, int pZ, Instances data) {
int nvX = data.attribute(pX).numValues();
int nvY = data.attribute(pY).numValues();
int nvZ = data.attribute(pZ).numValues();
double[][][] prob = new double[nvX][nvY][nvZ];
double tot = data.numInstances();
for (int i = 0; i < nvX; i++)
for (int j = 0; j < nvY; j++)
for (int k = 0; k < nvZ; k++)
prob[i][j][k] = 0.0;
Instance row = null;
for (int j = 0; j < data.numInstances(); j++) {
row = data.instance(j);
prob[(int) row.value(pX)][(int) row.value(pY)][(int) row.value(pZ)]++;
}
// normalize
for (int i = 0; i < nvX; i++)
for (int j = 0; j < nvY; j++)
for (int k = 0; k < nvZ; k++) {
prob[i][j][k] /= tot;
}
return prob;
}
/**
* Computes marginal probability for attribute with index pos, in data
*
* @return double[] marginal probabilities of index pos
*/
protected double[] getMarginalProb(int pos, Instances data) {
int nv = data.attribute(pos).numValues();
double[] prob = new double[nv];
double tot = data.numInstances();
Instance row = null;
for (int j = 0; j < data.numInstances(); j++) {
row = data.instance(j);
prob[(int) row.value(pos)]++;
}
// normalize
for (int i = 0; i < nv; i++)
prob[i] /= tot;
return prob;
}
public void setDiscretizeByEqualWidth(boolean b){
m_equalWidth=b;
}
protected String getSearchSpec() {
ASSearch s = m_searchAlgorithm;
if (s instanceof OptionHandler) {
return s.getClass().getName() + " "
+ Utils.joinOptions(((OptionHandler)s).getOptions());
}
return s.getClass().getName();
}
protected Instances discretize(Instances data) throws Exception{
Instances d=null;
if (data.checkForAttributeType(Attribute.NUMERIC)) {
if(!m_equalWidth){
Discretize myfilter = new Discretize();
myfilter.setInputFormat(data);
d = Filter.useFilter(data, myfilter);
}
else{
weka.filters.unsupervised.attribute.Discretize equalWidth =
new weka.filters.unsupervised.attribute.Discretize();
try {
System.out.println("ATTENTION!!: NUMERIC ATTRIBUTES DISCRETIZED WITH 2 BINS");
equalWidth.setInputFormat(data);
equalWidth.setBins(2);
d = Filter.useFilter(data, equalWidth);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
}
} else return data;
return d;
}
}
|
[
"[email protected]"
] | |
26938c6a6dcf56a99b79235be8cd571078a6ad42
|
17be20ba82b8106958311cc5aca7fb84814f17d8
|
/server/src/test/java/org/eurekastreams/server/action/execution/stream/StoreStreamHashTagsForActivityStrategyImplTest.java
|
93c8fc5b1bf0fab012edf8543ea53cb9ce5973c4
|
[] |
no_license
|
chrisdugan/eurekastreams
|
dbeeafb3806f593168b1d14bf3479b7f7ca1371a
|
72aa50a594c99aba72cae9f37b9d03b139e80728
|
refs/heads/master
| 2021-01-20T21:34:41.746276 | 2011-05-13T14:45:53 | 2011-05-13T14:45:53 | 1,743,693 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,284 |
java
|
/*
* Copyright (c) 2010 Lockheed Martin Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eurekastreams.server.action.execution.stream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.eurekastreams.server.domain.strategies.HashTagExtractor;
import org.eurekastreams.server.domain.stream.Activity;
import org.eurekastreams.server.domain.stream.BaseObjectType;
import org.eurekastreams.server.domain.stream.HashTag;
import org.eurekastreams.server.domain.stream.StreamHashTag;
import org.eurekastreams.server.domain.stream.StreamScope;
import org.eurekastreams.server.domain.stream.StreamScope.ScopeType;
import org.eurekastreams.server.persistence.mappers.InsertMapper;
import org.eurekastreams.server.persistence.mappers.chained.DecoratedPartialResponseDomainMapper;
import org.eurekastreams.server.persistence.mappers.requests.PersistenceRequest;
import org.eurekastreams.server.persistence.mappers.stream.ActivityContentExtractor;
import org.eurekastreams.server.search.modelview.OrganizationModelView;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.jmock.lib.legacy.ClassImposteriser;
import org.junit.Test;
/**
* Test fixture for StoreStreamHashTagsForActivityStrategyImpl.
*/
public class StoreStreamHashTagsForActivityStrategyImplTest
{
/**
* Context for building mock objects.
*/
private final Mockery context = new JUnit4Mockery()
{
{
setImposteriser(ClassImposteriser.INSTANCE);
}
};
/**
* Hashtag extractor.
*/
private final HashTagExtractor hashTagExtractor = context.mock(HashTagExtractor.class);
/**
* Content extractor - pulls out content for hashtag parsing.
*/
private final ActivityContentExtractor contentExtractor = context.mock(ActivityContentExtractor.class);
/**
* Mapper to store hash tags to an activity.
*/
private final DecoratedPartialResponseDomainMapper<List<String>, List<HashTag>> hashTagMapper = context
.mock(DecoratedPartialResponseDomainMapper.class);
/**
* Mapper to insert stream hashtags.
*/
private final InsertMapper<StreamHashTag> streamHashTagInsertMapper = context.mock(InsertMapper.class);
/**
* Mock activity.
*/
private final Activity activity = context.mock(Activity.class);
/**
* Stream scope.
*/
private StreamScope streamScope = context.mock(StreamScope.class);
/**
* base object.
*/
private HashMap<String, String> baseObject = context.mock(HashMap.class);
/**
* Test execute on a stream type we don't handle.
*/
@Test
public void testExecuteUnhandledStreamType()
{
context.checking(new Expectations()
{
{
allowing(activity).getId();
will(returnValue(3L));
allowing(activity).getRecipientStreamScope();
will(returnValue(streamScope));
oneOf(streamScope).getScopeType();
will(returnValue(ScopeType.ORGANIZATION));
}
});
StoreStreamHashTagsForActivityStrategy sut = buildSut();
sut.execute(activity);
context.assertIsSatisfied();
}
/**
* Test execute with no hashtags.
*/
@Test
public void testExecuteWithNoHashTags()
{
final String groupShortName = "sdlkjfsd";
final String content = "hi #there #potato";
final List<String> hashTagContents = new ArrayList<String>();
context.checking(new Expectations()
{
{
allowing(activity).getId();
will(returnValue(3L));
allowing(activity).getRecipientStreamScope();
will(returnValue(streamScope));
oneOf(streamScope).getScopeType();
will(returnValue(ScopeType.GROUP));
oneOf(streamScope).getUniqueKey();
will(returnValue(groupShortName));
oneOf(activity).getBaseObjectType();
will(returnValue(BaseObjectType.NOTE));
oneOf(activity).getBaseObject();
will(returnValue(baseObject));
oneOf(contentExtractor).extractContent(BaseObjectType.NOTE, baseObject);
will(returnValue(content));
oneOf(hashTagExtractor).extractAll(content);
will(returnValue(hashTagContents));
}
});
StoreStreamHashTagsForActivityStrategy sut = buildSut();
sut.execute(activity);
context.assertIsSatisfied();
}
/**
* Test execute with no hashtags.
*/
@Test
public void testExecuteOnPrivateActivity()
{
final String groupShortName = "sdlkjfsd";
final String content = "hi #there #potato";
final List<String> hashTagContents = new ArrayList<String>();
hashTagContents.add("#there");
hashTagContents.add("#potato");
final List<HashTag> hashTags = new ArrayList<HashTag>();
hashTags.add(new HashTag("#there"));
hashTags.add(new HashTag("#potato"));
context.checking(new Expectations()
{
{
allowing(activity).getId();
will(returnValue(3L));
allowing(activity).getRecipientStreamScope();
will(returnValue(streamScope));
oneOf(streamScope).getScopeType();
will(returnValue(ScopeType.GROUP));
oneOf(streamScope).getUniqueKey();
will(returnValue(groupShortName));
oneOf(activity).getBaseObjectType();
will(returnValue(BaseObjectType.NOTE));
oneOf(activity).getBaseObject();
will(returnValue(baseObject));
allowing(activity).getPostedTime();
will(returnValue(new Date()));
oneOf(contentExtractor).extractContent(BaseObjectType.NOTE, baseObject);
will(returnValue(content));
oneOf(hashTagExtractor).extractAll(content);
will(returnValue(hashTagContents));
oneOf(hashTagMapper).execute(hashTagContents);
will(returnValue(hashTags));
// two hashtag inserts - one for each hashtag to the group
oneOf(streamHashTagInsertMapper).execute(with(any(PersistenceRequest.class)));
oneOf(streamHashTagInsertMapper).execute(with(any(PersistenceRequest.class)));
}
});
StoreStreamHashTagsForActivityStrategy sut = buildSut();
sut.execute(activity);
context.assertIsSatisfied();
}
/**
* Test execute with no hashtags.
*/
@Test
public void testExecuteOnPublicActivity()
{
final String groupShortName = "sdlkjfsd";
final String content = "hi #there #potato";
final List<String> hashTagContents = new ArrayList<String>();
hashTagContents.add("#there");
hashTagContents.add("#potato");
final List<HashTag> hashTags = new ArrayList<HashTag>();
hashTags.add(new HashTag("#there"));
hashTags.add(new HashTag("#potato"));
final List<OrganizationModelView> orgModelViews = new ArrayList<OrganizationModelView>();
OrganizationModelView org1 = new OrganizationModelView();
OrganizationModelView org2 = new OrganizationModelView();
OrganizationModelView org3 = new OrganizationModelView();
OrganizationModelView org4 = new OrganizationModelView();
orgModelViews.add(org1);
orgModelViews.add(org2);
orgModelViews.add(org3);
orgModelViews.add(org4);
org1.setShortName("foo");
org2.setShortName("bar");
org2.setShortName("potato");
org2.setShortName("carrot");
context.checking(new Expectations()
{
{
allowing(activity).getId();
will(returnValue(3L));
allowing(activity).getRecipientStreamScope();
will(returnValue(streamScope));
oneOf(streamScope).getScopeType();
will(returnValue(ScopeType.GROUP));
oneOf(streamScope).getUniqueKey();
will(returnValue(groupShortName));
oneOf(activity).getBaseObjectType();
will(returnValue(BaseObjectType.NOTE));
oneOf(activity).getBaseObject();
will(returnValue(baseObject));
allowing(activity).getPostedTime();
will(returnValue(new Date()));
oneOf(contentExtractor).extractContent(BaseObjectType.NOTE, baseObject);
will(returnValue(content));
oneOf(hashTagExtractor).extractAll(content);
will(returnValue(hashTagContents));
oneOf(hashTagMapper).execute(hashTagContents);
will(returnValue(hashTags));
// 2 hashtag inserts - two for hashtags
exactly(2).of(streamHashTagInsertMapper).execute(with(any(PersistenceRequest.class)));
}
});
StoreStreamHashTagsForActivityStrategy sut = buildSut();
sut.execute(activity);
context.assertIsSatisfied();
}
/**
* Build the system under test.
*
* @return the system under test
*/
private StoreStreamHashTagsForActivityStrategy buildSut()
{
return new StoreStreamHashTagsForActivityStrategyImpl(hashTagExtractor, contentExtractor, hashTagMapper,
streamHashTagInsertMapper);
}
}
|
[
"[email protected]"
] | |
2b098bb04c60c738ef6b311ebe42db939f1cad5c
|
32243efd4e27d6078972753b00bcd4795ee858c7
|
/client/system_common/src/main/java/com/msj/goods/service/IntegralService.java
|
50719fbda47260bcc1e6470914ca70175d4332f3
|
[] |
no_license
|
sunli7758521/blue_client
|
296b20cde31f09457de98d842fcd5f21901785e4
|
b507bf35e71d5c16299cfd403c1f9ccf5f5e7029
|
refs/heads/master
| 2022-12-26T04:31:24.903615 | 2019-06-04T04:59:04 | 2019-06-04T05:00:10 | 189,973,261 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 811 |
java
|
package com.msj.goods.service;
import com.baomidou.mybatisplus.service.IService;
import com.github.pagehelper.PageInfo;
import com.msj.goods.entity.Integral;
import com.msj.goods.entity.SysUser;
import java.util.Map;
/**
* <p>
* 积分表 服务类
* </p>
*
* @author sun li
* @since 2018-11-05
*/
public interface IntegralService extends IService<Integral> {
/**
* 查询所有积分榜展示数据
* 以及所有的检索条件
*/
PageInfo<Map> selectAllList(SysUser user, Integer pageSize, Integer pageNum, Integer times, String deptId, String postId, String typeId, String spTime1, String spTime2, String search);
Integral selectdan(Integer userId);
int updatexiugai(Integer integralId,Integer countIntegral,Integer addIntegral,Integer goodCountIntegral );
}
|
[
"[email protected]"
] | |
98a4af2f79024543ea5b5e08848a794056e1501d
|
99f09827d3b88119b1fba0154017f6f110a6a7ac
|
/bee_bpm/src/org/beeblos/bpm/core/error/WStepAlreadyLockedException.java
|
3ed2bf6018e963d6b1718a07559a79eccc580905
|
[] |
no_license
|
ndubikin/beeblos
|
70854e9eb827f8313deedd06ab8aff34ed022891
|
21ebe41b86618c679b1fb76d5e6cb7de257565ce
|
refs/heads/master
| 2022-09-05T13:27:30.942138 | 2022-08-11T20:47:38 | 2022-08-11T20:47:38 | 98,414,952 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 672 |
java
|
/**
*
*/
package org.beeblos.bpm.core.error;
/**
* @author Roger
*
*/
public class WStepAlreadyLockedException extends Exception {
/**
*
*/
private static final long serialVersionUID = 24652353247973549L;
/**
*
*/
public WStepAlreadyLockedException() {
}
/**
* @param arg0
*/
public WStepAlreadyLockedException(String arg0) {
super(arg0);
}
/**
* @param arg0
*/
public WStepAlreadyLockedException(Throwable arg0) {
super(arg0);
}
/**
* @param arg0
* @param arg1
*/
public WStepAlreadyLockedException(String arg0, Throwable arg1) {
super(arg0, arg1);
}
}
|
[
"ndubikin@2fb576a0-0bdd-42ec-9e08-7f43f70b2762"
] |
ndubikin@2fb576a0-0bdd-42ec-9e08-7f43f70b2762
|
023672e195114207e11487849c5397de3c0dd737
|
02fee85faee7988be1deb99a9979a3b7e7d9e8e9
|
/src/com/codecool/webPractice/MyHandler.java
|
5bbb3b496cd44c75d47424f05a15b6194a341717
|
[] |
no_license
|
CodecoolBP20173/java-ee-webroute-adamGrob
|
729a30593a51e6960f59fc3c13eae81f21e7cca6
|
fc9037d9e4c7ba968cac236793f447b279c1e0c5
|
refs/heads/master
| 2020-03-18T09:48:03.922095 | 2018-05-27T19:46:20 | 2018-05-27T19:46:20 | 134,580,636 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,409 |
java
|
package com.codecool.webPractice;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
class MyHandler implements HttpHandler {
private static int counter = 0;
private int index;
MyHandler() {
this.index = counter;
counter++;
}
static void handleRequests (HttpExchange requestData, String response) throws IOException {
requestData.sendResponseHeaders(200, response.length());
OutputStream os = requestData.getResponseBody();
os.write(response.getBytes());
os.close();
}
@Override
public void handle(HttpExchange httpExchange) throws IOException {
MyRoute server = new MyRoute();
try {
Method[] routeList = routeMethodList();
routeList[index].invoke(server, httpExchange);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
private Method[] routeMethodList() throws ClassNotFoundException {
return Class.forName("com.codecool.webPractice.MyRoute").getDeclaredMethods();
}
}
|
[
"[email protected]"
] | |
4b3ed85f87c8586ff76b952fda02ed1fce3b3f18
|
229a97e1b53dcb845d8891540bf467299b4d4f0f
|
/FAQ/src/main/java/peri/fun/service/IUserMemberService.java
|
03a04d179278c55d6f88517577f79134c061f7fa
|
[] |
no_license
|
helloBosom/FAQ_Version1.0
|
3811a9aad1d9828d30572ec4a23cc548257eaae6
|
d9167d3e081ebbd26d2825dda9c0620e4790f0de
|
refs/heads/master
| 2021-04-26T21:48:26.932153 | 2018-04-11T10:20:05 | 2018-04-11T10:20:05 | 124,161,111 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 367 |
java
|
package peri.fun.service;
import peri.fun.model.User;
import peri.fun.model.UserMember;
import java.util.List;
public interface IUserMemberService {
public boolean addUser(UserMember user);
public List<UserMember> query();
public boolean lock(String USERID);
public boolean deblock(String USERID);
public boolean validateUser(User user);
}
|
[
"[email protected]"
] | |
1725dfb639d42349fcbcd3893a6073f55bcd0c3a
|
8a42a738c736163dcc470f13f716d6f6070ad5e2
|
/app/src/main/java/com/example/easyshop/ui/home/HomeFragment.java
|
739e1cb0759b3a8dcde50afa3fc5911d10994ab5
|
[] |
no_license
|
Meitalbuzi/EasyShop
|
2af9f0e9b0d3b0f8d98fe834cde39323b4f8469a
|
5d1a554efae3a7165f34b8d139f31063ff238c7a
|
refs/heads/master
| 2022-12-02T09:01:09.545485 | 2020-08-20T10:33:39 | 2020-08-20T10:33:39 | 288,957,487 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,154 |
java
|
package com.example.easyshop.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.easyshop.R;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.activity_login, container, false);
/*final TextView textView = root.findViewById(R.id.text_home);
homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});*/
return root;
}
}
|
[
"[email protected]"
] | |
d6598c5396ee2a7e7ccea2b58fcda85df4908346
|
ffd02054cac47c2cd088e35ca47ab16c01d85354
|
/VendorApp/src/main/java/org/srh/vipapp/hbm/hql/VendorBranchQuery.java
|
e2aaa97e440cf66a7934247ea2932430c1a65fd0
|
[] |
no_license
|
SRH-SDP-2018-Oct/sdpoctober2018-projects-group2-vendors-integration-platform
|
8a2afc932ae950964c2edd6fc6e626dfc3437234
|
63c306043d91d7f585c760cd38e4a4871032b5b7
|
refs/heads/master
| 2020-04-08T12:50:03.090737 | 2018-12-18T12:46:41 | 2018-12-18T12:46:41 | 159,363,530 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 422 |
java
|
package org.srh.vipapp.hbm.hql;
public final class VendorBranchQuery {
private VendorBranchQuery() {}
public static final String GET_ALL_VENDOR_BRANCHES_$P1 = "vendorId";
public static final String GET_ALL_VENDOR_BRANCHES_$N = "GET_ALL_VENDOR_BRANCHES";
public static final String GET_ALL_VENDOR_BRANCHES_$Q = "FROM VendorBranch "
+ " WHERE deleteFlag=0 AND vendorId=:"+GET_ALL_VENDOR_BRANCHES_$P1;
}
|
[
"[email protected]"
] | |
acea6f505535c141facc1548a65ce2fd50980019
|
d7fdc952e7646702378c7a24f7b6226f42d2d7f3
|
/model/src/main/java/org/openo/sdno/model/servicemodel/common/enumeration/LabelModeType.java
|
7e2c731f5662d70f79a3d1e4ab760c868dcfbe4c
|
[
"CC-BY-4.0",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
open-o/sdno-l2vpn
|
df93643444e6eac91e4b1eda3f160cdd179a37fc
|
9ef15a96fde6e2528ace968e19ea33b77b628e27
|
refs/heads/master
| 2021-01-19T13:12:45.758963 | 2017-03-20T07:30:11 | 2017-03-20T07:30:11 | 88,072,289 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,651 |
java
|
/*
* Copyright 2016 Huawei Technologies Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openo.sdno.model.servicemodel.common.enumeration;
import org.codehaus.jackson.annotate.JsonCreator;
import org.openo.sdno.wanvpn.util.EnumUtil;
import org.openo.sdno.wanvpn.util.ModelEnum;
/**
* The enumeration class of label mode type.<br>
*
* @author
* @version SDNO 0.5 2016-6-6
*/
public enum LabelModeType implements ModelEnum {
PER_INSTANCE("PerInstance"), PER_ROUTE("PerRoute");
private String alias;
/**
* Constructor<br>
*
* @param alias Name used in serialization.
* @since SDNO 0.5
*/
private LabelModeType(String alias) {
this.alias = alias;
}
@Override
public String getAlias() {
return alias;
}
@Override
public String toString() {
return alias;
}
/**
* @param name Can be name or alias.
* @return Enumeration instance
* @since SDNO 0.5
*/
@JsonCreator
public static LabelModeType fromName(String name) {
return EnumUtil.valueOf(LabelModeType.class, name);
}
}
|
[
"[email protected]"
] | |
f4a9dac416300c912e9bae369080f1a1897ad06a
|
7d5b4d687057fd689d4d53eb559fae1f45d91ab0
|
/yiran-admin/src/main/java/com/yiran/web/controller/member/MemberTrBankAccountController.java
|
2b4186499dd53c9e30e5ad606689df86e9161456
|
[
"Apache-2.0"
] |
permissive
|
jackCode1991/myStore
|
7d805a75a520c7111319db76073ecddbf60c318a
|
01bd39233b8da8838905b509484162f35cf4bef2
|
refs/heads/master
| 2022-11-21T16:28:29.140184 | 2020-01-17T07:21:31 | 2020-01-17T07:21:31 | 234,493,429 | 1 | 1 |
Apache-2.0
| 2022-11-16T07:36:31 | 2020-01-17T07:18:19 |
Java
|
UTF-8
|
Java
| false | false | 4,307 |
java
|
package com.yiran.web.controller.member;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yiran.common.annotation.Log;
import com.yiran.common.enums.BusinessType;
import com.yiran.member.domain.MemberTrBankAccount;
import com.yiran.member.service.IMemberTrBankAccountService;
import com.yiran.framework.web.base.BaseController;
import com.yiran.common.page.TableDataInfo;
import com.yiran.common.base.AjaxResult;
import com.yiran.common.config.Global;
import com.yiran.common.utils.poi.ExcelUtil;
/**
* 个人银行卡 信息操作处理
*
* @author yiran
* @date 2019-03-30
*/
@Controller
@RequestMapping("/member/memberTrBankAccount")
public class MemberTrBankAccountController extends BaseController
{
private String prefix = "member/memberTrBankAccount";
@Autowired
private IMemberTrBankAccountService memberTrBankAccountService;
@RequiresPermissions("member:memberTrBankAccount:view")
@GetMapping()
public String memberTrBankAccount()
{
return prefix + "/memberTrBankAccount";
}
/**
* 查询个人银行卡列表
*/
@RequiresPermissions("member:memberTrBankAccount:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(MemberTrBankAccount memberTrBankAccount)
{
startPage();
List<MemberTrBankAccount> list = memberTrBankAccountService.selectMemberTrBankAccountList(memberTrBankAccount);
return getDataTable(list);
}
/**
* 导出个人银行卡列表
*/
@RequiresPermissions("member:memberTrBankAccount:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(MemberTrBankAccount memberTrBankAccount)
{
List<MemberTrBankAccount> list = memberTrBankAccountService.selectMemberTrBankAccountList(memberTrBankAccount);
ExcelUtil<MemberTrBankAccount> util = new ExcelUtil<MemberTrBankAccount>(MemberTrBankAccount.class);
return util.exportExcel(list, "memberTrBankAccount");
}
/**
* 新增个人银行卡
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存个人银行卡
*/
@RequiresPermissions("member:memberTrBankAccount:add")
@Log(title = "个人银行卡", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(MemberTrBankAccount memberTrBankAccount)
{
if(DEMOENABLED.equals(Global.isDemoEnabled())){
return error("当前模式是演示模式不能修改数据");
}
return toAjax(memberTrBankAccountService.insertMemberTrBankAccount(memberTrBankAccount));
}
/**
* 修改个人银行卡
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
{
MemberTrBankAccount memberTrBankAccount = memberTrBankAccountService.selectMemberTrBankAccountById(id);
mmap.put("memberTrBankAccount", memberTrBankAccount);
return prefix + "/edit";
}
/**
* 修改保存个人银行卡
*/
@RequiresPermissions("member:memberTrBankAccount:edit")
@Log(title = "个人银行卡", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(MemberTrBankAccount memberTrBankAccount)
{
if(DEMOENABLED.equals(Global.isDemoEnabled())){
return error("当前模式是演示模式不能修改数据");
}
return toAjax(memberTrBankAccountService.updateMemberTrBankAccount(memberTrBankAccount));
}
/**
* 删除个人银行卡
*/
@RequiresPermissions("member:memberTrBankAccount:remove")
@Log(title = "个人银行卡", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
if(DEMOENABLED.equals(Global.isDemoEnabled())){
return error("当前模式是演示模式不能修改数据");
}
return toAjax(memberTrBankAccountService.deleteMemberTrBankAccountByIds(ids));
}
}
|
[
"[email protected]"
] | |
6a6e3e9a108b895a7905246af235a04134f109b7
|
18b20a45faa4cf43242077e9554c0d7d42667fc2
|
/HelicoBacterMod/build/tmp/expandedArchives/forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-sources.jar_db075387fe30fb93ccdc311746149f9d/net/minecraft/world/gen/feature/EndGatewayFeature.java
|
82a6c1d71deffa85800b039e65d2d1dce1086a75
|
[] |
no_license
|
qrhlhplhp/HelicoBacterMod
|
2cbe1f0c055fd5fdf97dad484393bf8be32204ae
|
0452eb9610cd70f942162d5b23141b6bf524b285
|
refs/heads/master
| 2022-07-28T16:06:03.183484 | 2021-03-20T11:01:38 | 2021-03-20T11:01:38 | 347,618,857 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,348 |
java
|
package net.minecraft.world.gen.feature;
import com.mojang.datafixers.Dynamic;
import java.util.Random;
import java.util.function.Function;
import net.minecraft.block.Blocks;
import net.minecraft.tileentity.EndGatewayTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
public class EndGatewayFeature extends Feature<EndGatewayConfig> {
public EndGatewayFeature(Function<Dynamic<?>, ? extends EndGatewayConfig> p_i49881_1_) {
super(p_i49881_1_);
}
public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> generator, Random rand, BlockPos pos, EndGatewayConfig config) {
for(BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-1, -2, -1), pos.add(1, 2, 1))) {
boolean flag = blockpos.getX() == pos.getX();
boolean flag1 = blockpos.getY() == pos.getY();
boolean flag2 = blockpos.getZ() == pos.getZ();
boolean flag3 = Math.abs(blockpos.getY() - pos.getY()) == 2;
if (flag && flag1 && flag2) {
BlockPos blockpos1 = blockpos.toImmutable();
this.setBlockState(worldIn, blockpos1, Blocks.END_GATEWAY.getDefaultState());
config.func_214700_b().ifPresent((p_214624_3_) -> {
TileEntity tileentity = worldIn.getTileEntity(blockpos1);
if (tileentity instanceof EndGatewayTileEntity) {
EndGatewayTileEntity endgatewaytileentity = (EndGatewayTileEntity)tileentity;
endgatewaytileentity.setExitPortal(p_214624_3_, config.func_214701_c());
tileentity.markDirty();
}
});
} else if (flag1) {
this.setBlockState(worldIn, blockpos, Blocks.AIR.getDefaultState());
} else if (flag3 && flag && flag2) {
this.setBlockState(worldIn, blockpos, Blocks.BEDROCK.getDefaultState());
} else if ((flag || flag2) && !flag3) {
this.setBlockState(worldIn, blockpos, Blocks.BEDROCK.getDefaultState());
} else {
this.setBlockState(worldIn, blockpos, Blocks.AIR.getDefaultState());
}
}
return true;
}
}
|
[
"[email protected]"
] | |
d0f74d50f7c8644cabf61ff0ff0803074af2b14b
|
62937f2f15ecac7a15c796538ed9c221f2346740
|
/HW6/test/src/edu/umb/cs680/hw06/DirectoryTest.java
|
2d46d9c3fcfc004fbf4c0bb530c9769419a08606
|
[] |
no_license
|
Jim-Jin001/CS680
|
53b2e4c4999b659d517f54428e6f66f4a6cbac9b
|
b3d151d427b97221b5a10019e213df2c769fbd56
|
refs/heads/master
| 2022-03-15T09:50:37.474867 | 2019-12-13T06:28:26 | 2019-12-13T06:28:26 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,277 |
java
|
package edu.umb.cs680.hw06;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.BeforeAll;
import java.util.LinkedList;
import java.time.LocalDateTime;
import org.junit.jupiter.api.Test;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class DirectoryTest {
static private LocalDateTime testDate1 = LocalDateTime.now();
static private LocalDateTime testDate2 = LocalDateTime.now();
static Directory root = new Directory(null, "Root", 0, testDate1);
static Directory home = new Directory(null, "Home", 0, testDate1);
static Directory applications = new Directory(null, "Applications", 0, testDate1);
static Directory code = new Directory(null, "Code", 0, testDate2);
static File a = new File(null, "a", 1, testDate1);
static File b = new File(null, "b", 2, testDate2);
static File c = new File(null, "c", 3, testDate1);
static File d = new File(null, "d", 4, testDate2);
static File e = new File(null, "e", 5, testDate2);
static File f = new File(null, "f", 6, testDate2);
private String[] dirToStringArray(Directory d) {
String parentName = null;
Directory parent = d.getParent();
if(parent != null) {
parentName = parent.getName();
}
// isFile, getName, getSize, getCreationTime, getParent, isDirectory,
// getTotalSize,countChildren
String[] dirInfo = {String.valueOf(d.isFile()), d.getName(), Integer.toString(d.getSize()),
d.getCreationTime().toString(), parentName, String.valueOf(d.isDirectory()),
Integer.toString(d.getTotalSize()), Integer.toString(d.countChildren())};
return dirInfo;
}
@BeforeAll
static void init() {
// append child directory to root
root.appendChild(home);
root.appendChild(applications);
// append child directory to home
home.appendChild(code);
//apend child file to applications
applications.appendChild(a);
applications.appendChild(b);
// apend child file to home
home.appendChild(c);
home.appendChild(d);
// apend child file to code
code.appendChild(e);
code.appendChild(f);
}
@Test
public void verifyDirectoryEqualityRoot() {
String[] expected = {"false", "Root", "0", testDate1.toString(), null, "true", "21", "2"};
Directory dir = root;
String[] actual = dirToStringArray(dir);
assertArrayEquals(actual, expected);
}
@Test
public void verifyDirectoryEqualityHome() {
String[] expected = { "false", "Home", "0", testDate1.toString(), "Root", "true", "18", "3"};
Directory dir = home;
String[] actual = dirToStringArray(dir);
assertArrayEquals(actual, expected);
}
@Test
public void verifyDirectoryEqualityCode() {
String[] expected = { "false", "Code", "0", testDate2.toString(), "Home", "true", "11", "2"};
Directory dir = code;
String[] actual = dirToStringArray(dir);
assertArrayEquals(actual, expected);
}
}
|
[
"[email protected]"
] | |
6024e953e328f1ace8b5f3471d098ab56fb1385f
|
416dfeebb8eb3e0970b666f6f40ee9f1b42e9744
|
/wfx-api/src/main/java/com/yougou/wfx/commodity/api/front/ICommodityCatb2cFrontApi.java
|
f343be19b5f4d2eed9c0b07be7aded89acc8baf0
|
[] |
no_license
|
cashflow5/wfx-api-server
|
ad61d82bea1966b3188eea408996e4fd680808a0
|
c2d32c4f6c558d8b66d9b4face92e1570e5a27c9
|
refs/heads/master
| 2021-01-20T18:09:49.842604 | 2016-07-20T10:24:10 | 2016-07-20T10:24:10 | 63,767,414 | 2 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,448 |
java
|
/*
* 版本信息
* 日期 2016-03-24 11:14:00
* 版权声明Copyright (C) 2011- 2016 YouGou Information Technology Co.,Ltd
* All Rights Reserved.
* 本软件为优购科技开发研制,未经本公司正式书面同意,其他任何个人、团体不得
* 使用、复制、修改或发布本软件。
*/
package com.yougou.wfx.commodity.api.front;
import com.yougou.wfx.commodity.dto.input.CommodityCatb2cPageInputDto;
import com.yougou.wfx.commodity.dto.output.CommodityCatb2cOutputDto;
import com.yougou.wfx.commodity.dto.output.CommodityExtendPropItemOutputDto;
import com.yougou.wfx.commodity.dto.output.CommodityExtendPropValueOutputDto;
import com.yougou.wfx.dto.base.PageModel;
/**
* ICommodityCatb2cFrontApi
* @author li.j1
* @Date 创建时间:2016-03-24 11:14:01
*/
public interface ICommodityCatb2cFrontApi{
/**
* 获取基础分类分页数据
*/
PageModel<CommodityCatb2cOutputDto> findCommodityCatb2cPage(CommodityCatb2cPageInputDto pageInputDto,PageModel<CommodityCatb2cOutputDto> pageModel);
/**
* 获取商品属性项列表
* @param pageModel
* @return
*/
PageModel<CommodityExtendPropItemOutputDto> findCommodityExtendPropItemPage(PageModel pageModel);
/**
* 获取商品属性项值列表
* @param pageModel
* @return
*/
PageModel<CommodityExtendPropValueOutputDto> findCommodityExtendPropValuePage(PageModel pageModel);
}
|
[
"[email protected]"
] | |
23cc605fa084014053d829e107cd288b9cccadc1
|
6e32669fbfd2035ee9dd913c97394216fa2f1026
|
/src/com/innerclass/InnerClass02.java
|
ac50a474506da1cf9e8e69133a74d1ea35ed1884
|
[] |
no_license
|
Little-fat-pig/gather
|
759aaf917c8392c9225815652c9cfd128cdc4b07
|
66bc7e3089c5d65dd1df0efcc0ef3974cbf7abe1
|
refs/heads/master
| 2022-12-16T19:24:30.414270 | 2020-09-14T06:23:31 | 2020-09-14T06:23:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 701 |
java
|
package com.innerclass;
public class InnerClass02 {
//静态内部类
// private String name="赵六";
private String pwd="14789";
private static String nicheng="天天大傻瓜";
private static String name="是是是";
public static class Inner{
String name="王五";
public void query(){
System.out.println(InnerClass02.name);
System.out.println(new InnerClass02().pwd);
System.out.println(InnerClass02.nicheng);
System.out.println(name);
}
}
public static void main(String[] args) {
Inner i=new Inner();
// InnerClass02 ic=new InnerClass02();
i.query();
}
}
|
[
"[email protected]"
] | |
d89e82f63214a1c2db7748ec4f5d946d9b63b14f
|
f5fce142b898a4e89dec0ec430e5acc4055b68ed
|
/src/main/java/cn/org/wm/generator/util/paranamer/NullParanamer.java
|
edfd5326fa33f911dedffffbf4b01e8df245bd50
|
[] |
no_license
|
taopixiang/code-generator
|
0836b0b00d15918bc649bb6655b0ab86ce02182c
|
9809b4e09f33d196db2950c71f35d3d7993facad
|
refs/heads/master
| 2022-12-17T01:07:01.937888 | 2020-09-21T04:51:28 | 2020-09-21T04:51:28 | 297,232,912 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,271 |
java
|
/***
*
* Copyright (c) 2007 Paul Hammant
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package cn.org.wm.generator.util.paranamer;
import java.lang.reflect.AccessibleObject;
/**
* Implementation of Paranamer which adheres to the NullObject pattern
*
* @author Paul Hammant
*/
public class NullParanamer implements Paranamer {
public String[] lookupParameterNames(AccessibleObject methodOrConstructor) {
return new String[0];
}
public String[] lookupParameterNames(AccessibleObject methodOrConstructor, boolean throwExceptionIfMissing) {
if (throwExceptionIfMissing) {
throw new ParameterNamesNotFoundException("NullParanamer implementation predictably finds no parameter names");
}
return new String[0];
}
}
|
[
"[email protected]"
] | |
b1ddcb3232aee556258d76561b382743ff5d9341
|
d26bfd3a4d3841d65dc09e665c6ccc9d1002b2f4
|
/src/main/java/com/cos/springlegacy/JsonController.java
|
9b8930b23fdb8f69e9c6fa8e28aec79e98ddce8f
|
[] |
no_license
|
codingspecialist/spring-legacy-test
|
e6975e201353f623c4718ef007320343cc4a1977
|
2f4b3d6035ecc662392b419d964c3d19e2b10b33
|
refs/heads/master
| 2022-12-23T17:45:04.782113 | 2020-01-31T03:24:32 | 2020-01-31T03:24:32 | 237,346,658 | 0 | 1 | null | 2022-12-16T01:02:18 | 2020-01-31T02:32:40 |
Java
|
UTF-8
|
Java
| false | false | 1,223 |
java
|
package com.cos.springlegacy;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cos.springlegacy.dto.RequestJsonDto;
import com.google.gson.Gson;
@Controller
public class JsonController {
// 스프링은 form의 name값 혹은 쿼리스트링만 오브젝트로 자동 변환!!
@RequestMapping(value = "/jsonTest", method = RequestMethod.POST)
public @ResponseBody RequestJsonDto jsonTest(@RequestBody RequestJsonDto requestJsonDto) { // {제이슨}
System.out.println(requestJsonDto.getId());
return requestJsonDto;
}
// http://localhost:8080/springlegacy/jsonHome/1
@RequestMapping(value = "/jsonHome/{num}", method = RequestMethod.GET)
public String jsonHome(@PathVariable int num) {
System.out.println("num : "+num);
return "jsonHome";
}
}
|
[
"[email protected]"
] | |
98e973498564853c455ce91ba76fcaea1e7fdb92
|
995f73d30450a6dce6bc7145d89344b4ad6e0622
|
/Mate20-9.0/src/main/java/com/android/server/wm/IHwAppWindowContainerController.java
|
b3dc9a6e7d3edd47abb5893eaa3ece1448a3bf03
|
[] |
no_license
|
morningblu/HWFramework
|
0ceb02cbe42585d0169d9b6c4964a41b436039f5
|
672bb34094b8780806a10ba9b1d21036fd808b8e
|
refs/heads/master
| 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 643 |
java
|
package com.android.server.wm;
import android.content.pm.ApplicationInfo;
import android.os.IBinder;
import android.view.IApplicationToken;
import com.android.server.AttributeCache;
public interface IHwAppWindowContainerController {
int continueHwStartWindow(String str, AttributeCache.Entry entry, ApplicationInfo applicationInfo, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, IBinder iBinder, IApplicationToken iApplicationToken, RootWindowContainer rootWindowContainer, boolean z8);
IBinder getTransferFrom(ApplicationInfo applicationInfo);
boolean isHwStartWindowEnabled(String str);
}
|
[
"[email protected]"
] | |
4b2f06c7102d32604f2a2df3d19d0be22fa3bb14
|
9d1f49b039be77eb45e5d60699429cb7c3d493d7
|
/javac/src/main/java/com/bigbade/processorcodeapi/javac/nodes/VariableLeaf.java
|
884ff218d948a47d6cfcfa35c0ac8dc862262f7a
|
[] |
no_license
|
BigBadE/processorcodeapi
|
28c4dffc10d48749efa2df371ce410c6e2e641fc
|
a4f2550c45f7df45d8193b293b195fa1e6f20ef9
|
refs/heads/master
| 2023-06-15T17:04:21.496506 | 2021-07-21T01:59:48 | 2021-07-21T01:59:48 | 343,537,003 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 779 |
java
|
package com.bigbade.processorcodeapi.javac.nodes;
import com.bigbade.processorcodeapi.api.leaf.IVariableLeaf;
import com.bigbade.processorcodeapi.javac.utils.JavacInternals;
import com.sun.tools.javac.tree.JCTree;
import lombok.Getter;
import javax.lang.model.element.VariableElement;
@SuppressWarnings("unused")
public class VariableLeaf implements IVariableLeaf {
@Getter
private final VariableElement variableElement;
private final JCTree.JCVariableDecl variableDecl;
private final JavacInternals internals;
public VariableLeaf(VariableElement element, JavacInternals internals) {
this.variableElement = element;
this.internals = internals;
variableDecl = (JCTree.JCVariableDecl) internals.getTrees().getTree(element);
}
}
|
[
"[email protected]"
] | |
dedc67ca211c386b5eb2bf267a56d29f13a6a54e
|
5167980f3532254af290b9fac0ca66b47d64e7e4
|
/javaStmt/src/part1/whileloop/BreakDemo.java
|
eafa9166f4ae95f515dceec1c93b82b03ab98d10
|
[] |
no_license
|
vivio98/java-Stmt
|
b28864e0858cf7290ea9ba9a16514e1b8bba1fb3
|
081aaab5fb981425390bc95695acfdc6861ec763
|
refs/heads/master
| 2021-01-23T06:25:33.816039 | 2015-07-03T05:33:50 | 2015-07-03T05:40:08 | 38,474,005 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 918 |
java
|
package part1.whileloop;
import java.util.Scanner;
/*
* @ 0615
* @ Author : ;
* @Story : 더하려는 숫자를 입력후 브레이크 기능을 두는 구문;
*/
public class BreakDemo {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("더하려는 정수값을 입력하세요");
/*
* 지금 까지는 결정된 숫자의 카운트 값 만큼만 입력했는데
* 이제 부터는 동적으로 스톱기능을 부여합니다
*/
System.out.println("멈추시려면 -1 을 입력하세요");
int num=0,sum=0;
/*
*while 문에서 condition 에 true 라고 주면,
*무한루프 구문이 된다.
*/
while (true) {
num = scanner.nextInt();
if (num == -1) {
break; // -1 이 입력되면 반복을 종료한다.
}
sum += num;
}
System.out.println("합계"+sum);
}
}
|
[
"[email protected]"
] | |
c9b8e77d71b41ea158fe94e9ecf440cc3b202d9e
|
e756591e75d8672996a15fa3d419b38d1fd4038c
|
/BeyondSkoolCommon/src/main/java/com/beyondskool/vo/RoleVO.java
|
036c0c1066b2150b67711ceaa8356bda8b7146d3
|
[] |
no_license
|
pnikhil/J2EE-Project-BeyondSkool
|
bfbbc25dc8f2666de940674a18db94f04e4ff36e
|
06f43a6ddf95ad6194ec529669bb1d99c1eb80fd
|
refs/heads/master
| 2021-05-02T05:24:03.925025 | 2018-02-09T15:03:14 | 2018-02-09T15:03:14 | 120,919,683 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 735 |
java
|
package com.beyondskool.vo;
public class RoleVO {
private String roleId;
private String roleName;
private int serialNo;
private String roleDesc;
public String getRoleDesc() {
return roleDesc;
}
public void setRoleDesc(String roleDesc) {
this.roleDesc = roleDesc;
}
public RoleVO(String roleId) {
this.roleId = roleId;
}
public RoleVO() {
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public int getSerialNo() {
return serialNo;
}
public void setSerialNo(int serialNo) {
this.serialNo = serialNo;
}
}
|
[
"[email protected]"
] | |
44bbe24b0694b9b2dc1655c3e057b6f7a9e4615b
|
0720ea63c8ae24d69f235fea08e3e2bc2a831584
|
/Longest_Palindromic_Substring.java
|
2dd8c7f0475cfa8d0cdab0ff4d46fee17e9410d1
|
[] |
no_license
|
newATyork/leetcode_Java
|
9885fe4faec94486b10d259e0062a3b0ebe65da2
|
6fd919f3bd0213954625ebf58266150ef87f8e5f
|
refs/heads/master
| 2021-01-15T23:30:18.607258 | 2013-09-08T02:17:22 | 2013-09-08T02:17:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 671 |
java
|
public class Solution {
public String longestPalindrome(String s) {
// Start typing your Java solution below
// DO NOT write main() function
String lps = s.substring(0,1);
for( int i = 0; i < s.length() - 1; ++i )
{
String tmp = expand( s, i, i );
lps = tmp.length() > lps.length() ? tmp : lps;
tmp = expand( s, i, i + 1 );
lps = tmp.length() > lps.length() ? tmp : lps;
}
return lps;
}
public String expand( String str, int c1, int c2 )
{
int left = c1;
int right = c2;
while( left >= 0 && right < str.length() && str.charAt(left) == str.charAt(right) )
{
left--;
right++;
}
return str.substring( left + 1, right );
}
}
|
[
"[email protected]"
] | |
8e46b4384e32a3ad8640992e92c25e12d6a3f951
|
d8dc31a6e91738bc4a8a02f39c0c4abfbdf49f54
|
/src/uy/com/agm/gaston/modelo/Alerta.java
|
295e59aa1d1c0c7f91e06bb58b69c01789a391c6
|
[] |
no_license
|
agmCorp/GastonWeb
|
652696dea151337bb7c4b36da1b070c05e56f098
|
8dc6510c5ec905d7602e8c18dffc25ca5188c33a
|
refs/heads/master
| 2021-05-14T14:09:11.259447 | 2018-04-11T20:44:39 | 2018-04-11T20:44:39 | 115,965,366 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,828 |
java
|
package uy.com.agm.gaston.modelo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
@Table(name = "ALERTA")
@NamedQueries({
@NamedQuery(name = "Alerta.findByEmail", query = "SELECT a FROM Alerta a WHERE a.usuario.email = :email ORDER BY a.timestamp DESC") })
public class Alerta {
@Id
@Column(name = "ID_ALERTA")
@NotNull
private String id;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "FECHA_HORA_ALERTA")
@NotNull
private Date timestamp;
@Column(name = "DESCRIPCION", length = 100)
@Size(max = 100)
@NotNull
private String descripcion;
@Column(name = "MENSAJE")
@Lob
private String mensaje;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "ID_USUARIO")
private Usuario usuario;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public String getMensaje() {
return mensaje;
}
public void setMensaje(String mensaje) {
this.mensaje = mensaje;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
}
|
[
"[email protected]"
] | |
4cf0bbf90c1ceebd25c51a3b77be28bc76f6aac3
|
79dc26fec90082d8cd76af904da9b863cf21c8a0
|
/src/bean/Actor.java
|
576331d865ed725500735cc4e065a80e56b793cd
|
[] |
no_license
|
zld9804/bad_banana
|
35ef7adf520fc59e3976cd52e24d2ffd787fc08f
|
47b95cf38d634445b36f11e11d1ac18e7e75ded7
|
refs/heads/master
| 2020-07-26T23:03:08.917301 | 2019-09-07T14:47:42 | 2019-09-07T14:47:42 | 208,791,223 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 568 |
java
|
package bean;
public class Actor {
private String name;
private String data;
private String imgPath;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getImgPath() {
return imgPath;
}
public void setImgPath(String imgPath) {
this.imgPath = imgPath;
}
@Override
public String toString() {
return "Actor [name=" + name + ", data=" + data + "]";
}
}
|
[
"[email protected]"
] | |
395ad3f7fc573a8c0577d594316f20243a0d7d68
|
e4b2cd3d743c821c6faab2363d47bf92cbc198c0
|
/chapter_003/src/main/java/ru/job4j/search/Task.java
|
4e50c5625f41b1bd57e0007ed6ab07ecceada4af
|
[
"Apache-2.0"
] |
permissive
|
hedg-r52/job4j
|
d4c332288582b9a8695f92bcb22d4ea2d523db2f
|
11ce7a9c33fe08b78120577587229934c78ce19b
|
refs/heads/master
| 2023-06-01T06:30:56.690851 | 2022-08-08T19:48:34 | 2022-08-08T19:48:34 | 125,415,802 | 0 | 0 |
Apache-2.0
| 2023-05-23T20:10:33 | 2018-03-15T19:21:00 |
Java
|
UTF-8
|
Java
| false | false | 439 |
java
|
package ru.job4j.search;
/**
* Задача
*
* @author Andrei Soloviev ([email protected])
* @version $Id$
* @since 0.1
*/
public class Task {
private String desc;
private int priority;
public Task(String desc, int priority) {
this.desc = desc;
this.priority = priority;
}
public String getDesc() {
return desc;
}
public int getPriority() {
return priority;
}
}
|
[
"[email protected]"
] | |
7c1e1bcfccf3754c0e20961f8379fa62c1fda0a3
|
c64bd2104b79d30ebcf3d73113fe13f97bc2fc6b
|
/main/model/src/main/java/foodz/entity/Recipe/Recipe.java
|
89f35bc56d68403a07355a073492be37f14fc6fc
|
[] |
no_license
|
OliverOBrien-r0606606/IP-August
|
cd66482a619f1a6e98d605a47912bea64944118c
|
2ed08981e09d640b151059facfe387f00ecea69a
|
refs/heads/master
| 2020-03-24T11:54:38.547438 | 2018-08-31T09:06:28 | 2018-08-31T09:06:28 | 142,698,285 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,165 |
java
|
package foodz.entity.Recipe;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.lang.Nullable;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Recipe {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Nullable
@Column(name = "id")
private long id;
@Column(name = "name", columnDefinition = "VARCHAR(256)")
private String name;
@Column(name = "directions", columnDefinition = "VARCHAR(8000)")
private String directions;
@Column(name = "description", columnDefinition = "VARCHAR(512)")
private String description;
public boolean isVegetarian() {
return vegetarian;
}
public void setVegetarian(boolean vegetarian) {
this.vegetarian = vegetarian;
}
public boolean isVegan() {
return vegan;
}
public void setVegan(boolean vegan) {
this.vegan = vegan;
}
public boolean isGluten() {
return gluten;
}
public void setGluten(boolean gluten) {
this.gluten = gluten;
}
public boolean isLactose() {
return lactose;
}
public void setLactose(boolean lactose) {
this.lactose = lactose;
}
public boolean isNuts() {
return nuts;
}
public void setNuts(boolean nuts) {
this.nuts = nuts;
}
public void setIngredients(List<Ingredient> ingredients) {
this.ingredients = ingredients;
}
private boolean vegetarian;
private boolean vegan;
private boolean gluten;
private boolean lactose;
private boolean nuts;
@OneToMany(cascade = CascadeType.ALL)
private List<Ingredient> ingredients;
public List<Ingredient> getIngredients() {
return ingredients;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDirections() {
return directions;
}
public void setDirections(String directions) {
this.directions = directions;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Map<String,Boolean> getAllergyMap(){
Map<String, Boolean> allergyMap = new HashMap<String, Boolean>();
allergyMap.put("vegetarian",isVegetarian());
allergyMap.put("vegan",isVegan());
allergyMap.put("gluten",isGluten());
allergyMap.put("lactose",isLactose());
allergyMap.put("nuts",isNuts());
return allergyMap;
}
public Recipe(String name, String directions, String description, boolean vegetarian, boolean vegan, boolean gluten, boolean lactose, boolean nuts, List<Ingredient> ingredients) {
this.name = name;
this.directions = directions;
this.description = description;
this.vegetarian = vegetarian;
this.vegan = vegan;
this.gluten = gluten;
this.lactose = lactose;
this.nuts = nuts;
this.ingredients = ingredients;
}
public Recipe( String name, String directions, String description, ArrayList<Ingredient> ingredients) {
setDescription(description); setDirections(directions); setName(name); setIngredients(ingredients);
}
public Recipe() {
}
@Override
public String toString() {
return "Recipe{" +
"id=" + id +
", name='" + name + '\'' +
", directions='" + directions + '\'' +
", description='" + description + '\'' +
", vegetarian=" + vegetarian +
", vegan=" + vegan +
", gluten=" + gluten +
", lactose=" + lactose +
", nuts=" + nuts +
", ingredients=" + ingredients +
'}';
}
}
|
[
"[email protected]"
] | |
da8e619acc0383a94a7ba072708b586f16929f52
|
e1b58387f82c8b3bdfed6ca8d8de27d22f388330
|
/src/main/java/com/phone/site/api/TechDetails.java
|
b7c3f49e3de72f725847c0eb2437cbcdf332a8f8
|
[] |
no_license
|
KseniiaNazarova/phones
|
8ead819d78d9e678c386decfef33ed11b0e617ab
|
9f1176970fa4d943158fdfb782cef176cc629767
|
refs/heads/master
| 2021-06-27T12:29:21.073844 | 2019-11-11T10:31:33 | 2019-11-11T10:31:33 | 219,361,022 | 0 | 0 | null | 2021-03-31T21:42:59 | 2019-11-03T20:27:31 |
Java
|
UTF-8
|
Java
| false | false | 2,631 |
java
|
package com.phone.site.api;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Tech details about a phone
* received from fonoapi
*/
public class TechDetails
{
private final String technology;
private final String bands2g;
private final String bands3g;
private final String bands4g;
@Override
public String toString()
{
return "TechDetails{" +
"technology='" + technology + '\'' +
", bands2g='" + bands2g + '\'' +
", bands3g='" + bands3g + '\'' +
", bands4g='" + bands4g + '\'' +
'}';
}
@JsonCreator
private TechDetails(@JsonProperty("technology") final String technology,
@JsonProperty("bands2g") final String bands2g,
@JsonProperty("bands3g") final String bands3g,
@JsonProperty("bands4g") final String bands4g)
{
this.technology = Objects.requireNonNull(technology);
this.bands2g = Objects.requireNonNull(bands2g);
this.bands3g = Objects.requireNonNull(bands3g);
this.bands4g = Objects.requireNonNull(bands4g);
}
public static Builder builder()
{
return new Builder();
}
@JsonProperty("technology")
public String getTechnology()
{
return technology;
}
@JsonProperty("bands2g")
public String getBands2g()
{
return bands2g;
}
@JsonProperty("bands3g")
public String getBands3g()
{
return bands3g;
}
@JsonProperty("bands4g")
public String getBands4g()
{
return bands4g;
}
public static final class Builder
{
private String technology;
private String bands2g;
private String bands3g;
private String bands4g;
public Builder withTechnology(final String technology)
{
this.technology = technology;
return this;
}
public Builder withBands2g(final String bands2g)
{
this.bands2g = bands2g;
return this;
}
public Builder withBands3g(final String bands3g)
{
this.bands3g = bands3g;
return this;
}
public Builder withBands4g(final String bands4g)
{
this.bands4g = bands4g;
return this;
}
public TechDetails build()
{
return new TechDetails(technology, bands2g, bands3g, bands4g);
}
}
}
|
[
"[email protected]"
] | |
a133ed7fd7d9cac24d021a2dab614880e9008ce2
|
e5d729b0668345ff13e8fee9a0024b848e356897
|
/src/test/java/com/fxpt/FxptApplicationTests.java
|
29c40e19952dd6c1510a7685c191b4945ce8a1e1
|
[] |
no_license
|
zhaoyuzhong1/fxpt
|
1d3d56734abca4a8ca7925c716b226ded846cdf3
|
e447d52557d284e4d07e80123a639285b6fe8d5c
|
refs/heads/master
| 2020-04-14T17:16:07.771115 | 2019-03-27T01:49:45 | 2019-03-27T01:49:45 | 163,974,545 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 324 |
java
|
package com.fxpt;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class FxptApplicationTests {
@Test
public void contextLoads() {
}
}
|
[
"d"
] |
d
|
a8531824c2c37f98c7354ce0dbed8f68d70002eb
|
d2cb1f4f186238ed3075c2748552e9325763a1cb
|
/methods_all/nonstatic_methods/javax_swing_text_IconView_getViewCount.java
|
4af9a4b717fce773dd933577ce76f0ed3b8b0be5
|
[] |
no_license
|
Adabot1/data
|
9e5c64021261bf181b51b4141aab2e2877b9054a
|
352b77eaebd8efdb4d343b642c71cdbfec35054e
|
refs/heads/master
| 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 162 |
java
|
class javax_swing_text_IconView_getViewCount{ public static void function() {javax.swing.text.IconView obj = new javax.swing.text.IconView();obj.getViewCount();}}
|
[
"[email protected]"
] | |
4658dd6eaf6be63b4993f2daacf4535d77b1af32
|
84af27ab1cad8d111d00d54f3f7c8fe7e2a17a80
|
/StudentProcessingSytsem/src/org/learning/UpdateStudentRemarks.java
|
26f0d9a2a8a5eabe8e0ac2545eac4f3a64fc5a5c
|
[] |
no_license
|
ravichavali9/Local-Workspace
|
9beb958e0830a57d3464821c21274785c651dac0
|
65eb374e06ea59125cce77f9b40a110539955e10
|
refs/heads/master
| 2021-05-11T02:55:50.627146 | 2018-01-17T21:32:54 | 2018-01-17T21:32:54 | 117,900,023 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,688 |
java
|
package org.learning;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UpdateStudentRemarks extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
String deptname=request.getParameter("deptname");
String loc=request.getParameter("location");
String deptno=request.getParameter("deptno");
Connection con;
PreparedStatement pstmt;
ServletContext sc=getServletContext();
String driver=sc.getInitParameter("driver");
String url=sc.getInitParameter("url");
String dbpassword=sc.getInitParameter("dbpassword");
String user=sc.getInitParameter("user");
response.setContentType("text/html");
try
{
System.out.println(".......1........");
Class.forName(driver);
con=DriverManager.getConnection(url,user,dbpassword);
System.out.println(".......2........");
System.out.println(deptno);
pstmt=con.prepareStatement("update student_remarks set remarks=?,date=? where remark_id=?");
System.out.println(".......3........");
pstmt.setString(1,request.getParameter("remark"));
pstmt.setString(2,request.getParameter("date"));
pstmt.setString(3,request.getParameter("rid"));
pstmt.execute();
System.out.println(".......4........");
response.sendRedirect("UpdateStudentRemarks.jsp");
System.out.println(".......5........");
}
catch(Exception e)
{System.out.println(".......6........");
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
d7dba3b1be3b80d66dd263e2a04aa497e550d783
|
cfeded4d2256e8e1a152a027f672d0ba5c6120af
|
/manna/manna-server/src/com/upiva/manna/server/cmd/jdbc/dao/SessionDao.java
|
ce7f81fd8f432766937206a33e993f0d3a9722c7
|
[] |
no_license
|
Ian-Ferreira/Upiva
|
0e144e076e910a23613aa6e00dbdce176093ded6
|
dcdfcec5aa3edad19816b804239c4df3d0769124
|
refs/heads/master
| 2021-01-19T12:39:39.107798 | 2013-07-19T08:40:51 | 2013-07-19T08:40:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,167 |
java
|
/**
* Authored By: IanF on 04/06/13 15:54
*
* Copyright (c) 2013, Ian Ferreira; [email protected]
*
* This software and codebase is protected by South African and international copyright legislation.
* The intellectual ownership of this source, artifacts and/or any products there-off remain
* the property of the author. All rights reserved globally.
*
* Revisions:-
* 04/06/13 15:54: Created, IanF, ...
*
*/
package com.upiva.manna.server.cmd.jdbc.dao;
public class SessionDao {
///////////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////////////////////////////////////////////////
// Data members
///////////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////////////////////////////////////////////////
// Implements
///////////////////////////////////////////////////////////////////////////
// Overrides
///////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////
// Private helpers
}
|
[
"[email protected]"
] | |
b37a13d1779d2b59f6cdb2ffff086d3a8c52c297
|
cee8bbcb89b73ff0428ea8cfa599396dd8cc3956
|
/app/src/main/java/com/kangjj/aop/proxy/AOPDBProxyActivity.java
|
1defcfc1e6f0e3ab74199a4ed91021129843b8c4
|
[] |
no_license
|
gnmmdk/1.1.3_AOP
|
b2c75de00667eab8f609f757f1bf998667983928
|
6ef3772ac492d4e8d6eae1bcb4a8b8868690413d
|
refs/heads/master
| 2020-08-30T03:40:37.290020 | 2019-10-29T14:32:47 | 2019-10-29T14:32:47 | 218,251,565 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,986 |
java
|
package com.kangjj.aop.proxy;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.kangjj.aop.R;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @Description:
* @Author: jj.kang
* @Email: [email protected]
* @ProjectName: 1.1.3_AOP
* @Package: com.kangjj.aop.proxy
* @CreateDate: 2019/10/29 16:34
*/
public class AOPDBProxyActivity extends AppCompatActivity implements DBOperation{
private final static String TAG = AOPDBProxyActivity.class.getSimpleName();
DBOperation db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_aop_db_proxy);
db = (DBOperation) Proxy.newProxyInstance(
DBOperation.class.getClassLoader(),new Class[]{DBOperation.class},new DBHandler(this));
}
public void jump(View view) {
db.delete();
}
class DBHandler implements InvocationHandler{
private DBOperation db;
public DBHandler(DBOperation db){
this.db = db;
}
@Override
public Object invoke(Object o, Method method, Object[] args) throws Throwable {
if(db!=null){
Log.e(TAG, "操作数据库之前,开始备份……");
save(); // 查询数据库后备份,详细过程省略
Log.e(TAG, "数据备份完成,等待操作");
return method.invoke(db,args);
}
return null;
}
}
@Override
public void insert() {
Log.e(TAG, "新增数据");
}
@Override
public void delete() {
Log.e(TAG, "删除数据");
}
@Override
public void update() {
Log.e(TAG, "修改数据");
}
@Override
public void save() {
Log.e(TAG, "保存数据");
}
}
|
[
"[email protected]"
] | |
5cff495f7803beb59bc1ec133fb73b09e6ca383f
|
f0aed9065cb697d1d371f12d333aaffb33e6c3fc
|
/src/main/java/no/uio/ifi/nios3/util/AttributesUtils.java
|
c8343fc98df1e7183c4eeafa432f4a8b282b6d48
|
[
"MIT"
] |
permissive
|
uio-bmi/nios3
|
bd115da5897a64ab2d85e09eb577a173ce19f7a1
|
ec30c4e44132614b148f6285db372c152c651d93
|
refs/heads/master
| 2020-04-08T23:33:53.629452 | 2018-12-07T13:14:50 | 2018-12-07T13:14:50 | 159,830,138 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,873 |
java
|
package no.uio.ifi.nios3.util;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.PosixFileAttributes;
import java.util.HashMap;
import java.util.Map;
/**
* Utilities to help transforming BasicFileAttributes to Map
*/
public abstract class AttributesUtils {
/**
* Given a BasicFileAttributes not null then return a Map
* with the keys as the fields of the BasicFileAttributes or PosixFileAttributes and the values
* with the content of the fields
*
* @param attr BasicFileAttributes
* @return Map String Object never null
*/
public static Map<String, Object> fileAttributeToMap(BasicFileAttributes attr) {
Map<String, Object> result = new HashMap<>();
result.put("creationTime", attr.creationTime());
result.put("fileKey", attr.fileKey());
result.put("isDirectory", attr.isDirectory());
result.put("isOther", attr.isOther());
result.put("isRegularFile", attr.isRegularFile());
result.put("isSymbolicLink", attr.isSymbolicLink());
result.put("lastAccessTime", attr.lastAccessTime());
result.put("lastModifiedTime", attr.lastModifiedTime());
result.put("size", attr.size());
if (attr instanceof PosixFileAttributes) {
PosixFileAttributes posixAttr = (PosixFileAttributes) attr;
result.put("permissions", posixAttr.permissions());
result.put("owner", posixAttr.owner());
result.put("group", posixAttr.group());
}
return result;
}
/**
* transform the java.nio.file.attribute.BasicFileAttributes to Map filtering by the keys
* given in the filters param
*
* @param attr BasicFileAttributes not null to tranform to map
* @param filters String[] filters
* @return Map String Object with the same keys as the filters
*/
public static Map<String, Object> fileAttributeToMap(BasicFileAttributes attr, String[] filters) {
Map<String, Object> result = new HashMap<>();
for (String filter : filters) {
filter = filter.replace("basic:", "");
filter = filter.replace("posix:", "");
switch (filter) {
case "creationTime":
result.put("creationTime", attr.creationTime());
break;
case "fileKey":
result.put("fileKey", attr.fileKey());
break;
case "isDirectory":
result.put("isDirectory", attr.isDirectory());
break;
case "isOther":
result.put("isOther", attr.isOther());
break;
case "isRegularFile":
result.put("isRegularFile", attr.isRegularFile());
break;
case "isSymbolicLink":
result.put("isSymbolicLink", attr.isSymbolicLink());
break;
case "lastAccessTime":
result.put("lastAccessTime", attr.lastAccessTime());
break;
case "lastModifiedTime":
result.put("lastModifiedTime", attr.lastModifiedTime());
break;
case "size":
result.put("size", attr.size());
break;
case "permissions":
result.put("permissions", ((PosixFileAttributes) attr).permissions());
break;
case "group":
result.put("group", ((PosixFileAttributes) attr).group());
break;
case "owner":
result.put("owner", ((PosixFileAttributes) attr).owner());
break;
}
}
return result;
}
}
|
[
"[email protected]"
] | |
8e24cf0ab71f61fd05c095b32930aa40977a117f
|
242a2e59c4c53b30a1af49da796947e383389d23
|
/WebAppDemo/src/main/java/web/app/demo/model/OrderItemBean.java
|
295b15fde4ff37517ca218ae86e33addd4f3852c
|
[] |
no_license
|
LinYuRu/WebDemo
|
229fd82ae6d8e0c624d1d06ca89340105b23335e
|
a3b10aff94adc34654936a813c345002e82e290f
|
refs/heads/master
| 2023-03-04T10:20:00.394431 | 2019-10-16T02:34:01 | 2019-10-16T02:34:01 | 215,440,830 | 0 | 0 | null | 2023-02-22T02:16:36 | 2019-10-16T02:39:03 |
Java
|
UTF-8
|
Java
| false | false | 2,402 |
java
|
package web.app.demo.model;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "OrderItem")
public class OrderItemBean {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer seqNo;
@Transient
private Integer orderNo;
private Integer productId;
private Integer quantity;
private Integer unitPrice ;
private Double discount;
private String discription;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="FK_OrderBean_orderNo")
private OrderBean orderBean;
private OrderItemBean(Integer seqNo, Integer orderNo, Integer productId, Integer quantity, Integer unitPrice,
Double discount, String discription, OrderBean orderBean) {
this.seqNo = seqNo;
this.orderNo = orderNo;
this.productId = productId;
this.quantity = quantity;
this.unitPrice = unitPrice;
this.discount = discount;
this.discription = discription;
this.orderBean = orderBean;
}
private OrderItemBean (){
}
public OrderBean getOrderBean() {
return orderBean;
}
public void setOrderBean(OrderBean orderBean) {
this.orderBean = orderBean;
}
public Integer getSeqNo() {
return seqNo;
}
public void setSeqNo(Integer seqNo) {
this.seqNo = seqNo;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getOrderNo() {
return orderNo;
}
public void setOrderNo(Integer orderNo) {
this.orderNo = orderNo;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Integer getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Integer unitPrice) {
this.unitPrice = unitPrice;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
public String getDiscription() {
return discription;
}
public void setDiscription(String discription) {
this.discription = discription;
}
}
|
[
"[email protected]"
] | |
ea0c7443dc63c8bb29c460aac690de9792449e15
|
ddbea944d265f844ea8a7c1ed5096ae0b75787a1
|
/topMusicExcepciones/AutorNoValidoException.java
|
b190988856576d3417fdb969d1f7bac3472173a1
|
[] |
no_license
|
Vsevillano/TopMusic
|
4a31104db1f45d0c35972fe24c7d6b15aea7449d
|
1a1877b5b743f8558f18eacf1dbaea6440d0b58b
|
refs/heads/master
| 2021-01-13T11:30:37.906678 | 2017-03-03T13:38:08 | 2017-03-03T13:38:08 | 81,850,951 | 0 | 0 | null | 2017-02-22T09:14:35 | 2017-02-13T17:19:07 |
Java
|
UTF-8
|
Java
| false | false | 165 |
java
|
package topMusicExcepciones;
public class AutorNoValidoException extends Exception {
public AutorNoValidoException(String arg0) {
super(arg0);
}
}
|
[
"[email protected]"
] | |
051eaa9d8d6a259a05969bfb9f4a3b31814d39a9
|
10c83aa1246786e7c96703a996fe93008c05507b
|
/android/app/src/main/module/ImagePreprocessor.java
|
00c609ab798b2f59562f9316375d92473e47712a
|
[] |
no_license
|
pa-rang/cs470-auto-wifi
|
a8379e048aa20a0874e7310099cc5016178c7d68
|
c07e8220b8f1953fa7ad787e08cef10537928aa8
|
refs/heads/master
| 2022-03-13T22:09:49.580863 | 2019-12-01T14:59:01 | 2019-12-01T14:59:01 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 142 |
java
|
import java.awt.Image;
public class ImagePreprocessor {
public static Image preprocessImage(Image image) {
return image;
}
}
|
[
"[email protected]"
] | |
9f7c7a208516e6bcc6a7d03f57f220596175fae2
|
bf1d981e8317a10d735063ae3ae6927a34b8fc37
|
/main/java/integradora/ingenieria/yacalu/yacalu1/GlassesActivity.java
|
8ea264a3ce0df48348fd8f4d3a330b8ec5b1f46d
|
[] |
no_license
|
carlabarcenas/YaCaLuAPP
|
d03fc25974b1b20a45578f67888421a3aade78c2
|
3dd92a21f6c0f3922941c245cd7401918100ba1c
|
refs/heads/master
| 2020-03-26T22:21:51.675663 | 2018-08-20T18:17:59 | 2018-08-20T18:17:59 | 145,452,413 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,251 |
java
|
package integradora.ingenieria.yacalu.yacalu1;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import integradora.ingenieria.yacalu.yacalu1.R;
public class GlassesActivity extends AppCompatActivity implements View.OnClickListener{
private ImageButton btnGlasses;
private Button btnNext;
private Button btnReturn;
private MediaPlayer mediaPlayer;
private SoundPool soundPool;
private int glasses;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_glasses);
btnGlasses = (ImageButton) findViewById(R.id.btn_glasses);
btnNext = (Button) findViewById(R.id.btn_glasses0);
btnReturn = (Button) findViewById(R.id.btn_glasses1);
btnGlasses.setOnClickListener(this);
btnNext.setOnClickListener(this);
btnReturn.setOnClickListener(this);
soundPool = new SoundPool(8, AudioManager.STREAM_MUSIC,0);
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
glasses = soundPool.load(this, R.raw.glasees,1);
mediaPlayer = new MediaPlayer();
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btn_glasses:
soundPool.play(glasses, 1, 1,0,0,1);
break;
case R.id.btn_glasses0:
Intent i = new Intent(this, KeysActivity.class);
startActivity(i);
finish();
break;
case R.id.btn_glasses1:
Intent in = new Intent(this, DiceActivity.class);
startActivity(in);
finish();
break;
default:
break;
}
}
@Override
public void onBackPressed() {
Intent i = new Intent(this, MenuActivity.class);
startActivity(i);
finish();
}
}
|
[
"[email protected]"
] | |
1dbeecee48fa06fea98a1e6174e117441c94553d
|
b5c485493f675bcc19dcadfecf9e775b7bb700ed
|
/jee-utility-__kernel__/src/test/java/org/cyk/utility/__kernel__/instance/InstanceGetterUnitTest.java
|
9ae0d6c41836b32a4644129731d3135e45c981b3
|
[] |
no_license
|
devlopper/org.cyk.utility
|
148a1aafccfc4af23a941585cae61229630b96ec
|
14ec3ba5cfe0fa14f0e2b1439ef0f728c52ec775
|
refs/heads/master
| 2023-03-05T23:45:40.165701 | 2021-04-03T16:34:06 | 2021-04-03T16:34:06 | 16,252,993 | 1 | 0 | null | 2022-10-12T20:09:48 | 2014-01-26T12:52:24 |
Java
|
UTF-8
|
Java
| false | false | 5,013 |
java
|
package org.cyk.utility.__kernel__.instance;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Collection;
import java.util.List;
import org.cyk.utility.__kernel__.configuration.ConfigurationHelper;
import org.cyk.utility.test.weld.AbstractWeldUnitTest;
import org.cyk.utility.__kernel__.variable.VariableHelper;
import org.junit.jupiter.api.Test;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
public class InstanceGetterUnitTest extends AbstractWeldUnitTest {
private static final long serialVersionUID = 1L;
@Override
protected void __listenBefore__() {
super.__listenBefore__();
InstanceGetterImpl.clear();
ConfigurationHelper.clear();
}
@Test
public void getBySystemIdentifier_(){
InstanceGetterImpl.add(new Klass().setIdentifier("123").setCode("abc"));
Klass instance = InstanceGetter.getInstance().getBySystemIdentifier(Klass.class, "123");
assertThat(instance.getIdentifier()).isEqualTo("123");
assertThat(instance.getCode()).isEqualTo("abc");
}
@Test
public void getByBusinessIdentifier_(){
InstanceGetterImpl.add(new Klass().setIdentifier("123").setCode("abc"));
Klass instance = InstanceGetter.getInstance().getByBusinessIdentifier(Klass.class, "abc");
assertThat(instance.getIdentifier()).isEqualTo("123");
assertThat(instance.getCode()).isEqualTo("abc");
}
@Test
public void getFromUniformResourceIdentifier(){
VariableHelper.writeClassUniformResourceIdentifier(Person.class, getClass().getResource("person.json"));
Collection<Person> persons = InstanceGetter.getInstance().getFromUniformResourceIdentifier(Person.class, "identifier","name","identifier");
assertThat(persons).isNotNull();
assertThat(persons.stream().map(Person::getIdentifier)).containsExactly("1","2");
}
@Test
public void getFromUniformResourceIdentifier_1(){
VariableHelper.writeClassUniformResourceIdentifier(Person.class, getClass().getResource("person_1.json"));
Collection<Person> persons = InstanceGetter.getInstance().getFromUniformResourceIdentifier(Person.class, "identifier","name","identifier");
assertThat(persons).isNotNull();
assertThat(persons.stream().map(Person::getIdentifier)).containsExactly("1","2");
}
@Test
public void getFromUniformResourceIdentifier_2(){
VariableHelper.writeClassUniformResourceIdentifier(Person.class, getClass().getResource("person_2.json"));
Collection<Person> persons = InstanceGetter.getInstance().getFromUniformResourceIdentifier(Person.class, "identifier","name","identifier");
assertThat(persons).isNotNull();
assertThat(persons.stream().map(Person::getIdentifier)).containsExactly("A","B");
}
@Test
public void getFromUniformResourceIdentifier_1_2_classifier_1(){
VariableHelper.writeClassUniformResourceIdentifier(Person.class,"1", getClass().getResource("person_1.json"));
VariableHelper.writeClassUniformResourceIdentifier(Person.class,"2", getClass().getResource("person_2.json"));
Collection<Person> persons = InstanceGetter.getInstance().getFromUniformResourceIdentifier(Person.class,"1", List.of("identifier","name","identifier"));
assertThat(persons).isNotNull();
assertThat(persons.stream().map(Person::getIdentifier)).containsExactly("1","2");
}
@Test
public void getFromUniformResourceIdentifier_1_2_classifier_2(){
VariableHelper.writeClassUniformResourceIdentifier(Person.class,"1", getClass().getResource("person_1.json"));
VariableHelper.writeClassUniformResourceIdentifier(Person.class,"2", getClass().getResource("person_2.json"));
Collection<Person> persons = InstanceGetter.getInstance().getFromUniformResourceIdentifier(Person.class,2, "identifier","name","identifier");
assertThat(persons).isNotNull();
assertThat(persons.stream().map(Person::getIdentifier)).containsExactly("A","B");
}
@Test
public void getFromUniformResourceIdentifier_1_2(){
VariableHelper.writeClassUniformResourceIdentifier(Person.class,"1", getClass().getResource("person_1.json"));
VariableHelper.writeClassUniformResourceIdentifier(Person.class,"2", getClass().getResource("person_2.json"));
Collection<Person> persons = InstanceGetter.getInstance().getFromUniformResourceIdentifiers(Person.class, List.of("1","2"), "identifier","name","identifier");
assertThat(persons).isNotNull();
assertThat(persons.stream().map(Person::getIdentifier)).containsExactly("1","2","A","B");
}
/**/
/* Persistence */
@Getter @Setter @Accessors(chain=true)
public static class Klass {
private String identifier,code;
}
@Getter @Setter @Accessors(chain=true)
@EqualsAndHashCode(of = {"identifier"}) @ToString
@NoArgsConstructor @AllArgsConstructor
public static class Person {
private String identifier;
private String name;
private Integer age;
}
}
|
[
"[email protected]"
] | |
cb6186680d0624e522c159da58aff79de5075b71
|
c246ae4adf91fbaf36a02e34d59f806f1adb9dc2
|
/Algoritmi paraleli si distribuiti/Indexare documente tema 2 APD/Main.java
|
08cdd52f219fa46ea25d0deaa9b515dc7133479c
|
[] |
no_license
|
ramonnst/Projects
|
dcb419fec9ef4787c2538b69bb5906adea47c8b5
|
ab6e832c77864b81daab94382ccc1da0d1548604
|
refs/heads/master
| 2021-01-15T11:14:29.181712 | 2013-04-02T21:40:29 | 2013-04-02T21:40:29 | 29,548,818 | 0 | 1 | null | 2015-01-20T19:52:10 | 2015-01-20T19:52:10 | null |
UTF-8
|
Java
| false | false | 1,467 |
java
|
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Integer NT = Integer.valueOf(args[0]);
String fisin = args[1];
String fisout = args[2];
Read read = new Read(fisin);
Map map = new Map(read.documente, NT, read.D);
ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapwordfreq;
mapwordfreq = map.map();
Reduce reduce = new Reduce(read.documente, read.N, read.NC, NT, read.cuvinte, mapwordfreq);
HashMap<String,String> result = reduce.reduce();
try {
FileWriter fstream = new FileWriter(fisout);
BufferedWriter out = new BufferedWriter(fstream);
String s = "Rezultate pentru: (";
String s1 = "";
for(int i = 0; i < read.NC; i++){
s1+= " " + read.cuvinte[i] + ",";
}
s1 = s1.substring(1, s1.length()-1);
s += s1 + ")\n";
int k = 0;
out.write(s);
for(int i = 0; i < read.documente.length; i++){
k++;
if(k <= read.X){
if(!result.get(read.documente[i]).equals("NO")){
out.write("\n" + result.get(read.documente[i]));
}
}
}
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
767d46d4d604d4ff849197fe45a1023a81b004c7
|
d6801077ba7e7f1783feac7b8fa6cb161447de09
|
/30DaysJavaCodingChallenge/src/Day13_abstractClass.java
|
4c9846cafeea2c0945318fe1d0e6461148ce20cf
|
[] |
no_license
|
Jisha-Maniamma/Challenge30daysJava
|
62f67c13f7fbfc5e58b0913b7bccd73dc1f0b9fc
|
d065be68fabef64f6c5cd3e2bfa810f12039555b
|
refs/heads/master
| 2020-06-12T09:22:28.482856 | 2019-07-12T07:53:20 | 2019-07-12T07:53:20 | 194,256,521 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 306 |
java
|
/*
* Example of abstract class
*
*/
abstract class Dog{
abstract void makesound();
}
public class Day13_abstractClass extends Dog{
void makesound() {
System.out.println("Boww");
}
public static void main(String[] args) {
Dog d=new Day13_abstractClass();
d.makesound();
}
}
|
[
"Jisha@admin-PC"
] |
Jisha@admin-PC
|
e5b4f09d10369891903e60d5343bc22f2976a4a9
|
77661f843b0ec18d459080ce60a2f7df41d0e03e
|
/Trabalho_grupo/src/trabalho_grupo/Game.java
|
f0357c3f44d44b7ad1002ee2d6dcd8b42a602a9e
|
[] |
no_license
|
JoaoAntonioAbreu/AD2019
|
7fdd44218955518463d9490ed04f05f8ae681d2f
|
22eb4af85c8795036df5c560f246fbd003134ba9
|
refs/heads/master
| 2022-06-15T03:44:29.301058 | 2020-01-09T18:05:26 | 2020-01-09T18:05:26 | 209,135,600 | 0 | 0 | null | 2022-05-20T21:19:33 | 2019-09-17T19:06:07 |
Java
|
UTF-8
|
Java
| false | false | 9,037 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package trabalho_grupo;
import java.util.Scanner;
/**
*
* @author Turma A
*/
public class Game {
public enum Command {
CREATE, INSPECT, PLAY, QUIT;
}
@SuppressWarnings("empty-statement")
public static void optionSwitch() {
Scanner scanner = new Scanner(System.in);
String options = "";
// Command command = Command.valueOf(options);
Army player = new Army();
Army pc = new Army();
int unimax;
int catapultas;
int x = 0;
int cavalaria;
int infantaria;
int divisao;
int tropas;
boolean verificacao = false;
while (options != "STOP") {
options = scanner.nextLine().toUpperCase();
Command command = Command.valueOf(options);
switch (command) {
case CREATE:
unimax = 100;
player = new Army();
pc = new Army();
while (verificacao == false) {
System.out.println("Crie um exercito com um limite de 100 tropas");
System.out.println("Indique o numero de catapultas");
catapultas = scanner.nextInt();
// player.setnCatapultas(scanner.nextInt());
System.out.println("Indique o numero de cavalaria");
cavalaria = scanner.nextInt();
System.out.println("Indique o numero de infantaria");
infantaria = scanner.nextInt();
tropas = catapultas + cavalaria + infantaria;
if (tropas > 100) {
System.out.println("O teu exercito excede o limite de 100 tropas");
} else {
System.out.println("Indique a percentagem de divisao de tropas para ataque e defesa");
divisao = scanner.nextInt();
Catapult catapult = new Catapult((catapultas * divisao) / 100, catapultas - (catapultas * divisao) / 100);
Cavalry cavalry = new Cavalry((cavalaria * divisao) / 100, cavalaria - (cavalaria * divisao) / 100);
Infantry infantry = new Infantry((infantaria * divisao) / 100, infantaria - (infantaria * divisao) / 100);
player.add(catapult);
player.add(cavalry);
player.add(infantry);
divisao = (int) (Math.random() * ((100 - 1) + 1));
catapultas = (int) (Math.random() * ((unimax - 1) + 1));
unimax = unimax - catapultas;
cavalaria = (int) (Math.random() * ((unimax - 1) + 1));
unimax = unimax - cavalaria;
infantaria = unimax;
Catapult pcCat = new Catapult((catapultas * divisao) / 100, catapultas - (catapultas * divisao) / 100);
Cavalry pcCav = new Cavalry((cavalaria * divisao) / 100, cavalaria - (cavalaria * divisao) / 100);
Infantry pcInf = new Infantry((infantaria * divisao) / 100, infantaria - (infantaria * divisao) / 100);
pc.add(pcCat);
pc.add(pcCav);
pc.add(pcInf);
options = scanner.nextLine().toUpperCase();
System.out.println("Exercito feito com sucesso");
verificacao = true;
}
}
verificacao = false;
break;
case INSPECT:
System.out.println("Player's Army:");
for (FightingForce army : player.getArmy()) {
System.out.println("Player: " + army.getClass().getName().replace("trabalho_grupo.", ""));
System.out.println("Attack: " + army.getAttackPower());
System.out.println("Defense: " + army.getDefensePower());
}
System.out.println("Computer's Army:");
for (FightingForce army : pc.getArmy()) {
System.out.println("Computer: " + army.getClass().getName().replace("trabalho_grupo.", ""));
System.out.println("Attack: " + army.getAttackPower());
System.out.println("Defense: " + army.getDefensePower());
}
break;
case PLAY:
int pcdefenseleft = 0;
int playerAttack = 0;
int playerDefense = 0;
int pcAttack = 0;
int pcDefense = 0;
int playerdefenseleft = 0;
int damage = 0;
for (FightingForce army : player.getArmy()) {
playerAttack += army.getAttackPower();
playerDefense += army.getDefensePower();
}
System.out.println("Player: Total Attack: " + playerAttack + " ,Total Defense: " + playerDefense);
for (FightingForce pcarmy : pc.getArmy()) {
pcAttack += pcarmy.getAttackPower();
pcDefense += pcarmy.getDefensePower();
}
System.out.println("Computers: Total Attack: " + pcAttack + " ,Total Defense: " + pcDefense);
System.out.println("You will attack first");
System.out.println("Since every units on attack has a 50% to do a sucessfull attack: ");
for (FightingForce army : player.getArmy()) {
damage = damage + army.onAttack();
}
System.out.println("You dealt " + damage + " points of damage");
for (FightingForce pcarmy : pc.getArmy()) {
if (damage > 0) {
System.out.print("The Computer ");
x = pcarmy.onDefense(damage);
}
damage = x;
}
for (FightingForce pcarmy : pc.getArmy()) {
pcdefenseleft += pcarmy.getDefensePower();
}
System.out.println("The computer was left with : " + pcdefenseleft + " defense points");
damage = 0;
if (pcdefenseleft == 0) {
System.out.println("The computer died, you WIN!!");
System.out.println("Escreva create para jogar novamente ou quit para sair ");
} else if (pcdefenseleft != 0) {
System.out.println("\n Computers turn! \n");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
for (FightingForce army : pc.getArmy()) {
damage = damage + army.onAttack();
}
System.out.println("The computer dealt " + damage + " points of damage");
for (FightingForce playerarmy : player.getArmy()) {
if (damage > 0) {
System.out.print("The Player ");
x = playerarmy.onDefense(damage);
}
damage = x;
}
for (FightingForce playerarmy : player.getArmy()) {
playerdefenseleft += playerarmy.getDefensePower();
}
System.out.println("You were left with : " + playerdefenseleft + " defense points");
if (playerdefenseleft == 0) {
System.out.println("YOU LOST TRY AGAIN");
System.out.println("Escreva create para jogar novamente ou quit para sair ");
} else {
System.out.println("Escreva play para avancar para a proxima ronda");
}
}
break;
case QUIT:
// message = "Switch-Case: Highest score is 99999";
System.out.println("THANKS FOR PLAYING");
options = "STOP";
break;
}
}
}
}
|
[
"[email protected]"
] | |
35a9678e196aba2f2143c8a96c47d62e40442692
|
51fe8b7ac7c0dfa42f551f2ef886bf5fef32abea
|
/src/main/java/ru/test/issue_tracker/entity/Author.java
|
a144d7e06c61374f1970639b709781af499136a5
|
[] |
no_license
|
Rewiax/IssueTrackerProject
|
ae03bc8d2bea91f03a15590bb6778a563247253b
|
e47d5ffd9c905bc83296895cf716907441f0ed73
|
refs/heads/main
| 2023-08-29T02:40:57.982975 | 2021-10-25T08:00:38 | 2021-10-25T08:00:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 354 |
java
|
package ru.test.issue_tracker.entity;
/**
* @author maxim
* class model for author entity
*/
public final class Author {
private int id;
private String name;
public int getId() {
return id;
}
public String getName() {
return name;
}
@Override
public String toString() {
return "Author [id=" + id + ", name=" + name + "]";
}
}
|
[
"[email protected]"
] | |
ad17e06e02d7e51c541413880422edebc2a1430a
|
7a695c0514d56d365ae46b9127e6854c6abcdd7d
|
/src/main/java/ua/training/view/SQLQuery.java
|
4fd5f11ece9ff0961979ccaf1ce77132fa67e786
|
[] |
no_license
|
leshchukt/Organizer
|
0fa078fe61f37440435c716d51689ddb5a101f33
|
2739d3430abf03dc8fe2c1c5143a2f5c63911bd5
|
refs/heads/master
| 2021-09-02T00:35:49.552322 | 2017-12-17T23:11:39 | 2017-12-17T23:11:39 | 114,548,466 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 403 |
java
|
package ua.training.view;
public interface SQLQuery {
String selectAll =
"SELECT DISTINCT * FROM event " +
"LEFT JOIN category ON event.idcategory = category.idcategory " +
"left join event_has_oponent on event.idevent = event_has_oponent.idevent " +
"left join oponent on event_has_oponent.idoponent = oponent.idoponent";
}
|
[
"[email protected]"
] | |
4701fd43fb137b792d380309104b5d08870e947e
|
6bc018087a74eb38dbf123c19e6f58edf39cf528
|
/app/src/androidTest/java/com/example/android/alphabets/ExampleInstrumentedTest.java
|
05bc414c06eff64e8722aef951ec6ce93ac2cca1
|
[] |
no_license
|
Teresiah6/Alphabets
|
2f49516be568a5062a99e86e3b441b504b0bcade
|
c5bea3d82c66c9c62b1d14df04a2ad1b7d1841ca
|
refs/heads/master
| 2020-04-08T11:36:30.846290 | 2018-12-19T18:18:42 | 2018-12-19T18:18:42 | 159,312,266 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 759 |
java
|
package com.example.android.alphabets;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.android.alphabets", appContext.getPackageName());
}
}
|
[
"[email protected]"
] | |
7c5428e98d70806c6bb64e1fa0307a4abd5b9459
|
a9f8b926c5c36c70cbb01772abfddbce7c4daa8e
|
/kienland-gateway/src/main/java/com/kienland/gateway/security/jwt/TokenProvider.java
|
e9e0735db71a7eda19f4556f6795310d583ef825
|
[] |
no_license
|
kiendo1998/kiendland
|
6e265df77f16c814d0f6fae0ecbe40ce4d9bb38b
|
aeac6e89ce3b5857cade3048bbf0f3a8e82dc0e5
|
refs/heads/main
| 2023-02-23T16:13:30.070471 | 2021-01-05T15:04:27 | 2021-01-05T15:04:27 | 324,564,251 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,221 |
java
|
package com.kienland.gateway.security.jwt;
import java.nio.charset.StandardCharsets;
import java.security.Key;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import io.github.jhipster.config.JHipsterProperties;
import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
@Component
public class TokenProvider {
private final Logger log = LoggerFactory.getLogger(TokenProvider.class);
private static final String AUTHORITIES_KEY = "auth";
private Key key;
private long tokenValidityInMilliseconds;
private long tokenValidityInMillisecondsForRememberMe;
private final JHipsterProperties jHipsterProperties;
public TokenProvider(JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
}
@PostConstruct
public void init() {
byte[] keyBytes;
String secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret();
if (!StringUtils.isEmpty(secret)) {
log.warn("Warning: the JWT key used is not Base64-encoded. " +
"We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security.");
keyBytes = secret.getBytes(StandardCharsets.UTF_8);
} else {
log.debug("Using a Base64-encoded JWT secret key");
keyBytes = Decoders.BASE64.decode(jHipsterProperties.getSecurity().getAuthentication().getJwt().getBase64Secret());
}
this.key = Keys.hmacShaKeyFor(keyBytes);
this.tokenValidityInMilliseconds =
1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds();
this.tokenValidityInMillisecondsForRememberMe =
1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt()
.getTokenValidityInSecondsForRememberMe();
}
public String createToken(Authentication authentication, boolean rememberMe) {
String authorities = authentication.getAuthorities().stream()
.map(GrantedAuthority::getAuthority)
.collect(Collectors.joining(","));
long now = (new Date()).getTime();
Date validity;
if (rememberMe) {
validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe);
} else {
validity = new Date(now + this.tokenValidityInMilliseconds);
}
return Jwts.builder()
.setSubject(authentication.getName())
.claim(AUTHORITIES_KEY, authorities)
.signWith(key, SignatureAlgorithm.HS512)
.setExpiration(validity)
.compact();
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parserBuilder()
.setSigningKey(key)
.build()
.parseClaimsJws(token)
.getBody();
Collection<? extends GrantedAuthority> authorities =
Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(","))
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
User principal = new User(claims.getSubject(), "", authorities);
return new UsernamePasswordAuthenticationToken(principal, token, authorities);
}
public boolean validateToken(String authToken) {
try {
Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(authToken);
return true;
} catch (JwtException | IllegalArgumentException e) {
log.info("Invalid JWT token.");
log.trace("Invalid JWT token trace.", e);
}
return false;
}
}
|
[
"[email protected]"
] | |
3d226bd882e903652df47dbb2849d6ed8291c680
|
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
|
/u-1/u-11/u-11-111/u-11-111-f4068.java
|
e058e89708dea95d69a4df9a396774abf66f2da7
|
[] |
no_license
|
apertureatf/perftest
|
f6c6e69efad59265197f43af5072aa7af8393a34
|
584257a0c1ada22e5486052c11395858a87b20d5
|
refs/heads/master
| 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 106 |
java
|
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
4403169138158
|
[
"[email protected]"
] | |
4b2284e619c9a0f2f3fab5af6bc5ecd3a9b97c82
|
208df6a69f56db58bd1927c732a52879609fba75
|
/sample/src/com/refreshactionprovider/sample/fragment/ActivitiesListFragment.java
|
7b0279c9c5d1249fc072431bab78573286cfc1bc
|
[
"Apache-2.0"
] |
permissive
|
power7714/refresh-action-provider
|
656727679cc34f5dc979df96bc1d5135fd95ee27
|
613498f7228c89a3d7e9abc486388c2de4a939d7
|
refs/heads/master
| 2021-01-18T13:35:46.056114 | 2013-08-20T05:36:10 | 2013-08-20T05:36:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,014 |
java
|
package com.refreshactionprovider.sample.fragment;
import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import com.actionbarsherlock.app.SherlockListFragment;
import com.refreshactionprovider.sample.activity.ActivitiesListActivity;
public class ActivitiesListFragment extends SherlockListFragment {
private ArrayAdapter<String> mArrayAdapter;
private List<ActivityInfo> activities;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mArrayAdapter = new ArrayAdapter<String>(getSherlockActivity(), android.R.layout.simple_list_item_1);
activities = new ArrayList<ActivityInfo>();
PackageManager packageManager = getSherlockActivity().getPackageManager();
try {
PackageInfo info = packageManager.getPackageInfo(getSherlockActivity().getPackageName(), PackageManager.GET_ACTIVITIES);
int count = info.activities.length;
for (int i = 0; i < count; i++) {
if (!info.activities[i].name.equals( ActivitiesListActivity.class.getName())){
mArrayAdapter.add(getString(info.activities[i].labelRes));
activities.add(info.activities[i]);
}
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
setListAdapter(mArrayAdapter);
getListView().setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ActivityInfo info = activities.get(position);
Intent intent = new Intent();
intent.setClassName(info.packageName, info.name);
getSherlockActivity().startActivity(intent);
}
});
}
}
|
[
"[email protected]"
] | |
7b8fcb3dcfab89e79d44895898b02e8183d79ac8
|
9cec9a434b80f8dda818cc71aefb83ce0b325aa3
|
/entropy-2.0/src/test/java/entropy/execution/TestTimedReconfigurationExecuter.java
|
9c4cbf6c36d3da0c3fa80a7a8c3aa4556d2d322f
|
[] |
no_license
|
julien-marchand/BestPlaceBis
|
ef221d02fcec56fe2c2df4d61b00ed0244fc40f5
|
e2276fae0a8d51c712a78770e24d89c04224b31b
|
refs/heads/master
| 2021-01-19T10:31:41.408995 | 2014-01-08T15:55:42 | 2014-01-08T15:55:42 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,331 |
java
|
/*
* Copyright (c) 2010 Ecole des Mines de Nantes.
*
* This file is part of Entropy.
*
* Entropy is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Entropy is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Entropy. If not, see <http://www.gnu.org/licenses/>.
*/
package entropy.execution;
import org.testng.Assert;
import org.testng.annotations.Test;
import entropy.configuration.DefaultConfiguration;
import entropy.configuration.DefaultNode;
import entropy.configuration.DefaultVirtualMachine;
import entropy.execution.driver.MockDriver;
import entropy.execution.driver.MockDriverFactory;
import entropy.plan.DefaultTimedReconfigurationPlan;
import entropy.plan.TimedReconfigurationPlan;
import entropy.plan.action.Action;
import entropy.plan.action.Migration;
import entropy.plan.action.Run;
/**
* Unit tests for BetterExecution.
*
* @author Fabien Hermenier
*/
@Test(groups = {"unit"})
public class TestTimedReconfigurationExecuter {
/**
* A basic test of an execution.
*/
public void testSimpleExecution() {
DefaultConfiguration cfg = new DefaultConfiguration();
DefaultVirtualMachine vm1 = new DefaultVirtualMachine("VM1", 1, 1, 1);
DefaultVirtualMachine vm2 = new DefaultVirtualMachine("VM2", 1, 1, 1);
DefaultVirtualMachine vm3 = new DefaultVirtualMachine("VM3", 1, 1, 1);
DefaultVirtualMachine vm4 = new DefaultVirtualMachine("VM4", 1, 1, 1);
DefaultNode n1 = new DefaultNode("N1", 1, 1, 1);
DefaultNode n2 = new DefaultNode("N2", 1, 1, 1);
DefaultNode n3 = new DefaultNode("N3", 1, 1, 1);
DefaultNode n4 = new DefaultNode("N4", 1, 1, 1);
DefaultNode n5 = new DefaultNode("N5", 1, 1, 1);
cfg.addOnline(n1);
cfg.addOnline(n2);
cfg.addOnline(n3);
cfg.addOnline(n4);
cfg.addOnline(n5);
cfg.setRunOn(vm1, n1);
cfg.setRunOn(vm2, n1);
cfg.setRunOn(vm3, n2);
cfg.setRunOn(vm4, n3);
Action t1 = new Migration(vm1, n1, n2, 5, 8);
Action t2 = new Migration(vm2, n1, n3, 1, 3);
Action t3 = new Migration(vm3, n2, n4, 0, 5);
Action t4 = new Migration(vm4, n3, n5, 0, 1);
TimedReconfigurationPlan plan = new DefaultTimedReconfigurationPlan(cfg);
Assert.assertTrue(plan.add(t1));
Assert.assertTrue(plan.add(t2));
Assert.assertTrue(plan.add(t3));
Assert.assertTrue(plan.add(t4));
MockDriverFactory factory = new MockDriverFactory();
TimedReconfigurationExecuter be = new TimedReconfigurationExecuter(factory);
be.start(plan);
Assert.assertEquals(be.getUncommitedActions().size(), 0);
}
/**
* Another test
*/
public void test2() {
MockDriver.MAX_JITTER = 5000;
DefaultConfiguration cfg = new DefaultConfiguration();
DefaultVirtualMachine[] vms = new DefaultVirtualMachine[6];
for (int i = 0; i < vms.length; i++) {
vms[i] = new DefaultVirtualMachine("VM" + (i + 1), 1, 1, 1);
}
DefaultNode[] ns = new DefaultNode[5];
for (int i = 0; i < ns.length; i++) {
ns[i] = new DefaultNode("N" + (i + 1), 1000, 1000, 1000);
cfg.addOnline(ns[i]);
}
cfg.setRunOn(vms[2], ns[0]);
cfg.setRunOn(vms[0], ns[0]);
cfg.setRunOn(vms[1], ns[1]);
cfg.setRunOn(vms[3], ns[1]);
cfg.setRunOn(vms[4], ns[3]);
cfg.addWaiting(vms[5]);
TimedReconfigurationPlan plan = new DefaultTimedReconfigurationPlan(cfg);
Assert.assertTrue(plan.add(new Migration(vms[2], ns[0], ns[1], 7, 9)));
Assert.assertTrue(plan.add(new Migration(vms[0], ns[0], ns[2], 0, 10)));
Assert.assertTrue(plan.add(new Migration(vms[1], ns[1], ns[2], 0, 5)));
Assert.assertTrue(plan.add(new Migration(vms[3], ns[1], ns[3], 3, 7)));
Assert.assertTrue(plan.add(new Migration(vms[4], ns[3], ns[2], 0, 3)));
Assert.assertTrue(plan.add(new Run(vms[5], ns[3], 0, 5)));
MockDriverFactory factory = new MockDriverFactory();
TimedReconfigurationExecuter be = new TimedReconfigurationExecuter(factory);
be.start(plan);
Assert.assertEquals(be.getUncommitedActions().size(), 0);
}
public void test3() {
MockDriver.MAX_JITTER = 2000;
DefaultConfiguration cfg = new DefaultConfiguration();
DefaultVirtualMachine[] vms = new DefaultVirtualMachine[6];
for (int i = 0; i < vms.length; i++) {
vms[i] = new DefaultVirtualMachine("VM" + (i + 1), 1, 1, 1);
}
DefaultNode[] ns = new DefaultNode[5];
for (int i = 0; i < ns.length; i++) {
ns[i] = new DefaultNode("N" + (i + 1), 1000, 1000, 1000);
cfg.addOnline(ns[i]);
}
cfg.setRunOn(vms[2], ns[0]);
cfg.setRunOn(vms[0], ns[0]);
cfg.setRunOn(vms[1], ns[1]);
cfg.setRunOn(vms[3], ns[1]);
cfg.setRunOn(vms[4], ns[3]);
cfg.addWaiting(vms[5]);
TimedReconfigurationPlan plan = new DefaultTimedReconfigurationPlan(cfg);
Assert.assertTrue(plan.add(new Migration(vms[2], ns[0], ns[1], 5, 9)));
Assert.assertTrue(plan.add(new Migration(vms[0], ns[0], ns[2], 0, 10)));
Assert.assertTrue(plan.add(new Migration(vms[1], ns[1], ns[2], 0, 5)));
Assert.assertTrue(plan.add(new Migration(vms[3], ns[1], ns[3], 3, 5)));
Assert.assertTrue(plan.add(new Migration(vms[4], ns[3], ns[2], 0, 3)));
Assert.assertTrue(plan.add(new Run(vms[5], ns[3], 0, 5)));
MockDriverFactory factory = new MockDriverFactory();
TimedReconfigurationExecuter be = new TimedReconfigurationExecuter(factory);
be.start(plan);
Assert.assertEquals(be.getUncommitedActions().size(), 0);
}
}
|
[
"[email protected]"
] | |
96f7b4fac21cddcf6da158f26944971f35fccf3f
|
281c1a173eb81752c8c76624746539b2c141a14e
|
/src/enservio/framework/globalfunctions/WebDriverFactory.java
|
c10945f08595d69b95aa24154db99ebdc72f6ae2
|
[] |
no_license
|
titusjohn/enservio_automation
|
5bee0f29df4f2adb86bad480322060afbbe55bba
|
6a515b8bcf6aab95a48668a2b901de2845c482ad
|
refs/heads/master
| 2021-01-18T14:18:35.532242 | 2014-06-19T16:46:50 | 2014-06-19T16:46:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,889 |
java
|
package enservio.framework.globalfunctions;
import java.util.Properties;
import enservio.framework.testflowsetup.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.*;
import com.opera.core.systems.OperaDriver;
public class WebDriverFactory {
private static Properties properties;
/**
* Function to return the appropriate {@link RemoteWebDriver} object based
* on the {@link Browser} passed
*
* @param browser
* The {@link Browser} to be used for the test execution
* @return The {@link RemoteWebDriver} object corresponding to the
* {@link Browser} specified
*/
public static RemoteWebDriver getDriver(Browser browser) {
WebDriver driver = null;
switch (browser) {
case Chrome:
properties = settings.getInstance();
System.setProperty("webdriver.chrome.driver",
properties.getProperty("ChromeDriverPath"));
driver = new ChromeDriver();
break;
case Firefox:
driver = new FirefoxDriver();
break;
case HtmlUnit:
driver = new HtmlUnitDriver();
break;
case InternetExplorer:
properties = settings.getInstance();
System.setProperty("webdriver.ie.driver",
properties.getProperty("InternetExplorerDriverPath"));
driver = new InternetExplorerDriver();
break;
case Opera:
driver = new OperaDriver();
break;
case NA:
break;
case Safari:
break;
default:
properties = settings.getInstance();
System.setProperty("webdriver.ie.driver",
properties.getProperty("InternetExplorerDriverPath"));
driver = new InternetExplorerDriver();
}
return (RemoteWebDriver) driver;
}
}
|
[
"[email protected]"
] | |
a7d02842725c8dfd03def27f7a673a167afd4408
|
06af5238ba8cc06fe158ef50b7bcacf519a751b7
|
/pro03/src/sec01/ex02/MemberVO.java
|
50a453f900d2406fe50011b1a24f1b22b9a2a47e
|
[] |
no_license
|
zootopeanut/pro03
|
a0c9b3a4d2e80b089724ef5a054172b6ba8e0dbb
|
92c8f8970cd4646064e3c8ca9f0177cf3137bc17
|
refs/heads/master
| 2020-08-04T19:11:48.112374 | 2019-10-02T05:30:42 | 2019-10-02T05:30:42 | 212,248,722 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 751 |
java
|
package sec01.ex02;
import java.sql.Date;
public class MemberVO {
private String id;
private String pwd;
private String name;
private String email;
private Date joinDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Date getJoinDate() {
return joinDate;
}
public void setJoinDate(Date joinDate) {
this.joinDate = joinDate;
}
}
|
[
"[email protected]"
] | |
128ad2942e0e528b0b1971a3e2237832a1a41774
|
c3fceab49183cc522035e7bf11112d6efa995166
|
/src/test/java/com/ym/netty/executor/FailedFuture.java
|
afa5f15603ea2ece72333d1d8f04587bd8017e21
|
[] |
no_license
|
511659192/trivial
|
3e0fdc4c3b8914426c73f323aec1ddceb35334a7
|
33f19661d0cdb5849fde20ba73e32e221577f01c
|
refs/heads/master
| 2020-12-25T06:45:40.362024 | 2019-01-11T15:29:12 | 2019-01-11T15:29:12 | 62,365,452 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 792 |
java
|
package com.ym.netty.executor;
/**
* @Author yangmeng44
* @Date 2017/7/21
*/
public final class FailedFuture<V> extends CompleteFuture<V> {
private final Throwable cause;
/**
* Creates a new instance.
*
* @param executor the {@link EventExecutor} associated with this future
* @param cause the cause of failure
*/
public FailedFuture(EventExecutor executor, Throwable cause) {
super(executor);
if (cause == null) {
throw new NullPointerException("cause");
}
this.cause = cause;
}
@Override
public Throwable cause() {
return cause;
}
@Override
public boolean isSuccess() {
return false;
}
@Override
public V getNow() {
return null;
}
}
|
[
"[email protected]"
] | |
2a067309c456d3643e4c2b18a862e836c9857357
|
6bdf5c250234428218a9a3e0add7d29f0db45831
|
/VehicleRego-Backend/src/main/java/com/test/assignment/AssignmentApplication.java
|
20d83a3837eac44389a249fd8694ba12d6f5f9b0
|
[] |
no_license
|
suniltiwari778/VehicleRegoApp
|
ecb77fefab6305a9770f967dcf19211049a6fd45
|
0fdc1eb3e2e19e0cdb11899a35ccc2bd68086210
|
refs/heads/master
| 2023-01-11T07:21:57.102231 | 2020-11-16T13:55:15 | 2020-11-16T13:55:15 | 313,311,179 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,514 |
java
|
package com.test.assignment;
import com.test.assignment.model.Insurer;
import com.test.assignment.model.Registration;
import com.test.assignment.model.Registrations;
import com.test.assignment.model.Vehicle;
import com.test.assignment.repository.VehicleRepositoryImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@SpringBootApplication
@Slf4j
public class AssignmentApplication implements ApplicationRunner {
@Autowired
private VehicleRepositoryImpl vehicleRepository;
public static void main(String[] args) {
SpringApplication.run(AssignmentApplication.class, args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
buildRegistrationData();
}
private void buildRegistrationData() {
log.info("build data");
List<Registrations> listRegistrations = new ArrayList<Registrations>();
/* ----- registrations A start ----------*/
Registrations registrationsA = new Registrations();
Registration registrationA = new Registration();
registrationA.setExpired(false);
registrationA.setExpiry_date(new Date());
//Vehicle details
Vehicle vehicleA = new Vehicle();
vehicleA.setType("Wagon");
vehicleA.setMake("BMW");
vehicleA.setModel("X4 M40i");
vehicleA.setColour("Blue");
vehicleA.setVin(Long.valueOf("12389347324"));
vehicleA.setTareWeight(1700);
vehicleA.setGrossMass(null);
//insurer details
Insurer insurerA = new Insurer();
insurerA.setCode("Allianz");
insurerA.setCode("32");
//
registrationsA.setPlateNumber("EBF28E");
registrationsA.setRegistration(registrationA);
registrationsA.setVehicle(vehicleA);
registrationsA.setInsurer(insurerA);
/*------------------- registrations A End ------ */
/* ----- registrations B start ----------*/
Registrations registrationsB = new Registrations();
Registration registrationB = new Registration();
registrationB.setExpired(true);
registrationB.setExpiry_date(new Date());
//Vehicle details
Vehicle vehicleB = new Vehicle();
vehicleB.setType("Hatch");
vehicleB.setMake("Toyota");
vehicleB.setModel("Corolla");
vehicleB.setColour("Silver");
vehicleB.setVin(Long.valueOf("54646546313"));
vehicleB.setTareWeight(1432);
vehicleB.setGrossMass("1500");
//insurer details
Insurer insurerB = new Insurer();
insurerB.setCode("AAMI");
insurerB.setCode("17");
//
registrationsB.setPlateNumber("CXD82F");
registrationsB.setRegistration(registrationB);
registrationsB.setVehicle(vehicleB);
registrationsB.setInsurer(insurerB);
/*------------------- registrations B End ------ */
/* ----- registrations C start ----------*/
Registrations registrationsC = new Registrations();
Registration registrationC = new Registration();
registrationC.setExpired(false);
registrationC.setExpiry_date(new Date());
//Vehicle details
Vehicle vehicleC = new Vehicle();
vehicleC.setType("Sedan");
vehicleC.setMake("Mercedes");
vehicleC.setModel("X4 M40i");
vehicleC.setColour("Blue");
vehicleC.setVin(Long.valueOf("87676676762"));
vehicleC.setTareWeight(1700);
vehicleC.setGrossMass(null);
//insurer details
Insurer insurerC = new Insurer();
insurerC.setCode("GIO");
insurerC.setCode("13");
registrationsC.setPlateNumber("WOP29P");
registrationsC.setRegistration(registrationC);
registrationsC.setVehicle(vehicleC);
registrationsC.setInsurer(insurerC);
/*------------------- registrations C End ------ */
/* ----- registrations D start ----------*/
Registrations registrationsD = new Registrations();
Registration registrationD = new Registration();
registrationD.setExpired(false);
registrationD.setExpiry_date(new Date());
//Vehicle details
Vehicle vehicleD = new Vehicle();
vehicleD.setType("SUV");
vehicleD.setMake("Jaguar");
vehicleD.setModel("F pace");
vehicleD.setColour("Green");
vehicleD.setVin(Long.valueOf("65465466541"));
vehicleD.setTareWeight(1620);
vehicleD.setGrossMass(null);
//insurer details
Insurer insurerD = new Insurer();
insurerD.setCode("NRMA");
insurerD.setCode("27");
registrationsD.setPlateNumber("QWX55Z");
registrationsD.setRegistration(registrationD);
registrationsD.setVehicle(vehicleD);
registrationsD.setInsurer(insurerD);
/*------------------- registrations D End ------ */
listRegistrations.add(registrationsA);
listRegistrations.add(registrationsB);
listRegistrations.add(registrationsC);
listRegistrations.add(registrationsD);
vehicleRepository.saveRegistrations(listRegistrations);
}
}
|
[
"[email protected]"
] | |
45cf570a53aa247fcf559428cee29523c49b5711
|
74db95ac521939b803ce2e8fc201ad44deed2250
|
/RePractice/SwordOffer0316Twice/Code_0324_4Find.java
|
d6d54a223aec60c3184b8cbe1447b89c5a91d7f2
|
[] |
no_license
|
Submergechen/AlgoriPractice
|
220329489f7f962c44d45cd36151b6ca3ba9e3fe
|
769d29e4789c5a2398ec1005c3bd740390e9ac6c
|
refs/heads/master
| 2021-08-09T00:41:53.875972 | 2020-09-24T07:48:23 | 2020-09-24T07:48:23 | 222,943,801 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 547 |
java
|
package RePractice.SwordOffer0316Twice;
public class Code_0324_4Find {
public static boolean solution(int[][]arr, int aim){
if (arr == null || arr.length < 1 || arr[0].length < 1){
return false;
}
int R = 0;
int C = arr[0].length - 1;
while (C >= 0 && R < arr.length){
if (arr[R][C] == aim){
return true;
}else if (aim > arr[R][C]){
C--;
}else {
R++;
}
}
return false;
}
}
|
[
"[email protected]"
] | |
c21e5c2e1da6428689a6835fc9b48c5a58954004
|
e7b61e68a0aac3f8a0654627168d05b7a073c4e4
|
/bos-service/src/main/java/cn/me/service/impl/RoleServiceImpl.java
|
e1a6ad2af0eb4fc1465bbc1c65aca0abcd183815
|
[] |
no_license
|
yqxyz/bos
|
de83c350e10bb5838ffa75a3002f6e2198af73da
|
63531110b57cfb99c19c72036a97deafd0b4015e
|
refs/heads/master
| 2021-09-15T06:58:02.826141 | 2018-05-28T06:42:14 | 2018-05-28T06:42:14 | 109,646,488 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,267 |
java
|
package cn.me.service.impl;
import cn.me.dao.IFunctionDao;
import cn.me.dao.IRoleDao;
import cn.me.domain.Function;
import cn.me.domain.Role;
import cn.me.service.IRoleService;
import cn.me.utils.PageBean;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class RoleServiceImpl implements IRoleService{
@Autowired
private IRoleDao roleDao;
@Autowired
private IFunctionDao functionDao;
@Override
public void save(Role model, String functionIds) {
roleDao.save(model);
System.out.println();
if(StringUtils.isNotBlank(functionIds)){
String[] fIds = functionIds.split(",");
for (String functionId:fIds
) {
Function function = functionDao.findById(functionId);
model.getFunctions().add(function);
}
}
}
@Override
public void queryPage(PageBean pageBean) {
roleDao.pageQuery(pageBean);
}
@Override
public List<Role> findAll() {
return roleDao.findAll();
}
}
|
[
"[email protected]"
] | |
f8d4dc7d7bd64e669477c4ca8d7a978d378d4c98
|
7c7ba9105cc95c2e8bd6840ea99a8a740c55f58e
|
/app/src/main/java/wall/field/investigation/mvp/contract/ChangePasswordContract.java
|
88574b0e45830b569e8fc98e3c9bc767965feb62
|
[
"Apache-2.0"
] |
permissive
|
wall3001/Ance
|
7919253d364fec2f193b5e6edd21be1ebb4848f0
|
44617669b0f31dfcb0e07d6ac29795fe5e6a8c99
|
refs/heads/master
| 2020-03-21T21:48:05.765295 | 2020-01-23T07:41:47 | 2020-01-23T07:41:47 | 139,084,332 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 649 |
java
|
package wall.field.investigation.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import io.reactivex.Observable;
import wall.field.investigation.mvp.model.entity.BaseJson;
public interface ChangePasswordContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<BaseJson<Object>> changePassword(String oldPwd, String newPwd);
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.