blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
192a84923efc16f5f8a28f50de16a2558c162e5c
ef1388fb3db855ca4c5ce0d4bae1a2ef210603fc
/src/main/java/com/example/app/controller/ControllerUtils.java
eac89d40bcadd5c170e4f91370783befa6021579
[]
no_license
trilitra/agregator-shops
2e7e00b0ca1111fbe6314f5d578498e1e9b199b4
375bc71284024be55983227189e61386124a39b8
refs/heads/master
2023-03-05T09:14:26.783920
2021-02-18T08:00:22
2021-02-18T08:00:22
339,976,712
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package com.example.app.controller; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import java.util.Map; import java.util.stream.Collector; import java.util.stream.Collectors; public class ControllerUtils { static Map<String, String> getErrors(BindingResult bindingResult) { Collector<FieldError, ?, Map<String, String>> collector = Collectors.toMap( fieldError -> fieldError.getField() + "Error", FieldError::getDefaultMessage ); return bindingResult.getFieldErrors().stream().collect(collector); } }
[ "efanovalva@gmail.com" ]
efanovalva@gmail.com
96d32dd0163ddfca742ca5e552892d4c68f7d39b
c1116c7ff8314ec43b16d455ee1aea7d8d289943
/enderio-base/src/main/java/crazypants/enderio/base/item/eggs/RenderEntityOwlEgg.java
ea3c62f67076ab299e64b71a403103925208b3d5
[ "Unlicense", "CC-BY-NC-3.0", "CC0-1.0", "CC-BY-3.0", "LicenseRef-scancode-public-domain" ]
permissive
FinalCraftMC/EnderIO
71054da73fe329d5d49c9a2c239b4545a8b7ed7b
a173868d1659d511154d9b195cd0d4759164029b
refs/heads/master
2023-04-23T19:20:36.682724
2021-05-10T18:42:24
2021-05-10T18:42:24
298,419,938
0
0
Unlicense
2020-09-26T23:02:13
2020-09-24T23:40:35
null
UTF-8
Java
false
false
1,533
java
package crazypants.enderio.base.item.eggs; import javax.annotation.Nonnull; import crazypants.enderio.base.init.ModObject; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderEntityOwlEgg extends RenderSnowball<EntityOwlEgg> { public static final Factory FACTORY = new Factory(); public RenderEntityOwlEgg(RenderManager renderManagerIn, RenderItem itemRendererIn) { super(renderManagerIn, ModObject.item_owl_egg.getItemNN(), itemRendererIn); } @Override public void doRender(@Nonnull EntityOwlEgg entity, double x, double y, double z, float entityYaw, float partialTicks) { super.doRender(entity, x, y, z, entityYaw, partialTicks); } @Override public @Nonnull ItemStack getStackToRender(@Nonnull EntityOwlEgg entityIn) { return new ItemStack(ModObject.item_owl_egg.getItemNN()); } public static class Factory implements IRenderFactory<EntityOwlEgg> { @Override public Render<? super EntityOwlEgg> createRenderFor(RenderManager manager) { return new RenderEntityOwlEgg(manager, Minecraft.getMinecraft().getRenderItem()); } } }
[ "henry@loenwind.info" ]
henry@loenwind.info
a2d57588cc329a340aa69c147c08372919653756
d4d1013d3215088f7ec445b393b58fb30249ca1b
/jonix-onix3/src/main/java/com/tectonica/jonix/onix3/TextItemIdentifier.java
ce62265601d253a0ea78266bc0f04f9553399749
[ "Apache-2.0" ]
permissive
miyewd/jonix
70de3ba4b2054e0a66f688185834c9b0c73a101f
2ce4c9d7fddd453c4c76cf2a4bfae17b98e9b91d
refs/heads/master
2022-11-28T18:00:52.049749
2020-08-06T09:21:47
2020-08-06T09:21:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,876
java
/* * Copyright (C) 2012-2020 Zach Melamed * * Latest version available online at https://github.com/zach-m/jonix * Contact me at zach@tectonica.co.il * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tectonica.jonix.onix3; import com.tectonica.jonix.common.JPU; import com.tectonica.jonix.common.OnixComposite.OnixDataCompositeWithKey; import com.tectonica.jonix.common.codelist.RecordSourceTypes; import com.tectonica.jonix.common.codelist.TextItemIdentifierTypes; import com.tectonica.jonix.common.struct.JonixTextItemIdentifier; import java.io.Serializable; /* * NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY */ /** * <h1>Text item identifier composite</h1> * <p> * A repeatable group of data elements which together define an identifier of a text item in accordance with a specified * scheme. The composite is optional. * </p> * <table border='1' cellpadding='3'> * <tr> * <td>Reference name</td> * <td><tt>&lt;TextItemIdentifier&gt;</tt></td> * </tr> * <tr> * <td>Short tag</td> * <td><tt>&lt;textitemidentifier&gt;</tt></td> * </tr> * <tr> * <td>Cardinality</td> * <td>0&#8230;n</td> * </tr> * </table> * <p/> * This tag may be included in the following composites: * <ul> * <li>&lt;{@link TextItem}&gt;</li> * </ul> * <p/> * Possible placements within ONIX message: * <ul> * <li>{@link ONIXMessage} ⯈ {@link Product} ⯈ {@link ContentDetail} ⯈ {@link ContentItem} ⯈ {@link TextItem} ⯈ * {@link TextItemIdentifier}</li> * </ul> */ public class TextItemIdentifier implements OnixDataCompositeWithKey<JonixTextItemIdentifier, TextItemIdentifierTypes>, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "TextItemIdentifier"; public static final String shortname = "textitemidentifier"; ///////////////////////////////////////////////////////////////////////////////// // ATTRIBUTES ///////////////////////////////////////////////////////////////////////////////// /** * (type: dt.DateOrDateTime) */ public String datestamp; public RecordSourceTypes sourcetype; /** * (type: dt.NonEmptyString) */ public String sourcename; ///////////////////////////////////////////////////////////////////////////////// // CONSTRUCTION ///////////////////////////////////////////////////////////////////////////////// private boolean initialized; private final boolean exists; private final org.w3c.dom.Element element; public static final TextItemIdentifier EMPTY = new TextItemIdentifier(); public TextItemIdentifier() { exists = false; element = null; initialized = true; // so that no further processing will be done on this intentionally-empty object } public TextItemIdentifier(org.w3c.dom.Element element) { exists = true; initialized = false; this.element = element; datestamp = JPU.getAttribute(element, "datestamp"); sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype")); sourcename = JPU.getAttribute(element, "sourcename"); } @Override public void _initialize() { if (initialized) { return; } initialized = true; JPU.forElementsOf(element, e -> { final String name = e.getNodeName(); switch (name) { case TextItemIDType.refname: case TextItemIDType.shortname: textItemIDType = new TextItemIDType(e); break; case IDValue.refname: case IDValue.shortname: idValue = new IDValue(e); break; case IDTypeName.refname: case IDTypeName.shortname: idTypeName = new IDTypeName(e); break; default: break; } }); } /** * @return whether this tag (&lt;TextItemIdentifier&gt; or &lt;textitemidentifier&gt;) is explicitly provided in the * ONIX XML */ @Override public boolean exists() { return exists; } @Override public org.w3c.dom.Element getXmlElement() { return element; } ///////////////////////////////////////////////////////////////////////////////// // MEMBERS ///////////////////////////////////////////////////////////////////////////////// private TextItemIDType textItemIDType = TextItemIDType.EMPTY; /** * <p> * An ONIX code identifying the scheme from which the identifier in &lt;IDValue&gt; is taken. Mandatory in each * occurrence of the &lt;TextItemIdentifier&gt; composite, and non-repeating. * </p> * Jonix-Comment: this field is required */ public TextItemIDType textItemIDType() { _initialize(); return textItemIDType; } private IDValue idValue = IDValue.EMPTY; /** * <p> * An identifier of the type specified in &lt;TextItemIDType&gt;. Mandatory in each occurrence of the * &lt;TextItemIdentifier&gt; composite, and non-repeating. * </p> * Jonix-Comment: this field is required */ public IDValue idValue() { _initialize(); return idValue; } private IDTypeName idTypeName = IDTypeName.EMPTY; /** * <p> * A name which identifies a proprietary identifier scheme (<i>ie</i> a scheme which is not a standard and for which * there is no individual ID type code). Must be included when, and only when, the code in &lt;TextItemIDType&gt; * indicates a proprietary scheme, <i>eg</i> a publisher’s own code. Optional and non-repeating * </p> * Jonix-Comment: this field is optional */ public IDTypeName idTypeName() { _initialize(); return idTypeName; } @Override public JonixTextItemIdentifier asStruct() { _initialize(); JonixTextItemIdentifier struct = new JonixTextItemIdentifier(); struct.textItemIDType = textItemIDType.value; struct.idTypeName = idTypeName.value; struct.idValue = idValue.value; return struct; } @Override public TextItemIdentifierTypes structKey() { return textItemIDType().value; } }
[ "zach@tectonica.co.il" ]
zach@tectonica.co.il
e03be5c5626a392c475680d8d7e00b5205d292e3
5efad863e6aae8955b76fe36f47aaffd24f483bb
/app/src/main/java/DAL/Entidades/Mod_and_tipo.java
cc842dbb29ddaae70e572d9d7d633ce1e4efbcf8
[]
no_license
etien-andres/EzbrnFood
e0471c20a4b6b64c4a0dda28d8396543454ebbe0
f1d98923bbeee9264214785d332493155f3cfb75
refs/heads/master
2020-04-14T19:04:15.320697
2019-02-07T01:25:26
2019-02-07T01:25:26
164,043,690
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package DAL.Entidades; public class Mod_and_tipo { Modificadores mod; Integer tipo; public Mod_and_tipo(Modificadores mod, Integer tipo) { this.mod = mod; this.tipo = tipo; } public Modificadores getMod() { return mod; } public void setMod(Modificadores mod) { this.mod = mod; } public Integer getTipo() { return tipo; } public void setTipo(Integer tipo) { this.tipo = tipo; } }
[ "andres.etien@gmail.com" ]
andres.etien@gmail.com
618e716f0606e04990bf74ac3005623d1e7f1843
30d64cf8d9c97a44902ad04e1ce792f953a8beb2
/pz3/app/src/main/java/io/github/gubarsergey/pz3/ReversePolishNotation.java
5c67d13744c10403260058a2ba76a2c44730684c
[]
no_license
SergeyGubar/ppandroid-labs
00489b9a68750b346cc66f591f409c4bbde5bdbb
03eaa87874a84e3ccb4b8a13b5db881ec807c5df
refs/heads/master
2020-08-06T19:13:07.512265
2019-12-27T07:36:16
2019-12-27T07:36:16
213,119,627
3
1
null
null
null
null
UTF-8
Java
false
false
2,933
java
package io.github.gubarsergey.pz3; import java.util.ArrayList; import java.util.List; import java.util.Stack; public class ReversePolishNotation { public List<String> getRPN(String expression) { List<String> rpnExpression = new ArrayList<>(); Stack<Character> operations = new Stack(); String number = ""; for(int i = 0; i < expression.length(); i++){ char character = expression.charAt(i); if(!(this.isNumeric(character) || character == '.') && number != "") { rpnExpression.add(number); number = ""; } if(this.isNumeric(character) || character == '.') number += Character.toString(character); else if(character == '(') operations.push(character); else if(character == ')') { while (!(operations.isEmpty()) && operations.peek() != '(') rpnExpression.add(Character.toString(operations.pop())); if(!(operations.isEmpty())) //delete open bracket operations.pop(); } else if(this.isOperation(character)) { int currentOperationPriority = this.getPriority(character); if(!(operations.empty())) { int previousOperationPriority = this.getPriority(operations.peek()); if(currentOperationPriority > previousOperationPriority) operations.push(character); else { char previousOperation = operations.pop(); rpnExpression.add(Character.toString(previousOperation)); operations.push(character); } } else { operations.push(character); } } } if(number != "") rpnExpression.add(number); while (!(operations.isEmpty())){ if(!this.isOperation(operations.peek())) operations.pop(); else rpnExpression.add(Character.toString(operations.pop())); } return rpnExpression; } private int getPriority(char operation) { switch (operation) { case '+': return 1; case '-': return 1; case '*': return 2; case '/': return 2; default: return 0; } } private Boolean isNumeric(char value) { try { Double.parseDouble(Character.toString(value)); return true; } catch(NumberFormatException e){ return false; } } private Boolean isOperation(char value) { return value == '+' || value == '-' || value == '*' || value == '/'; } }
[ "sergey.gubar187@gmail.com" ]
sergey.gubar187@gmail.com
95e632abdd406943a50ed28350964401f09adf83
b9ab86c9dd3a742aea8f0bace53c11c3027b32a4
/src/main/java/com/alibaba/middleware/race/rpc/model/RpcResponse.java
f95941158ec90b615016450f5886b3ba46364b64
[]
no_license
janck13/my-RPC-Framwork
62b0386500e022ff9b97902655f264e07427fa6e
ca4d5f1adae086151fe424b0fa4a33e10ee111c0
refs/heads/master
2020-05-21T21:24:16.109734
2016-02-09T12:57:04
2016-02-09T12:57:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,716
java
/** * */ package com.alibaba.middleware.race.rpc.model; import java.io.Serializable; /** * @author keehang * */ public class RpcResponse implements Serializable { /** * */ private static final long serialVersionUID = -225640454370459555L; private String errorMsg; //这个用来返回异常信息 private Object appResponse; //这个用来返回结果 //一切响应消息都通过调用下面的工厂方法创建 public synchronized static RpcResponse factory(long requestId,Object appResponse,String errorMsg){ //这个方法需要一定的线程安全性 return new RpcResponse(requestId,appResponse,errorMsg); } private RpcResponse(long requestId,Object appResponse, String errorMsg){ this.requestId = requestId; this.appResponse = appResponse; this.errorMsg = errorMsg; } public Object getAppResponse() { return appResponse; } public String getErrorMsg() { return errorMsg; } public boolean isError(){ return errorMsg == null ? false:true; } private long requestId; //增加一个请求Id,用以区别请求 public long getRequestId(){ return requestId; } /** * @param errorMsg the errorMsg to set */ public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } /** * @param appResponse the appResponse to set */ public void setAppResponse(Object appResponse) { this.appResponse = appResponse; } /** * @param requestId the requestId to set */ public void setRequestId(long requestId) { this.requestId = requestId; } }
[ "18009267974@163.com" ]
18009267974@163.com
4672eef1ec6770d65be0193f6823a2e0659adb23
9a942a741f3ab466be8b2807aba5272f80377498
/app7/part0/src/X.java
21740bc39205b26cdb8dc7f33cea291034e98ff8
[]
no_license
Vijay-Ky/MyJavaPracticeTest
82db8c507be9fde66f68efe3c3b7bb35dc086f67
6d427886b847e9af8a1af7d73ae8e340a4f47dd5
refs/heads/master
2021-09-27T18:45:11.963373
2018-11-17T15:17:07
2018-11-17T15:17:07
154,494,698
0
3
null
2021-09-23T01:16:57
2018-10-24T12:10:37
Java
UTF-8
Java
false
false
186
java
class X { int i; public static void main(String[] args) { X x1 = new X(); X x2 = new X(); x1.i = 10; x2.i = 20; System.out.println(x1.i); System.out.println(x2.i); } }
[ "vijayky007@gmail.com" ]
vijayky007@gmail.com
f1c4b75111bcb1fcd4df4b27f3483dd2036c9eae
785810ba6c708c8841e304ffd36914fa42cce34a
/app/src/main/java/com/example/pratamajambipelayangan/PersyaratanDetail.java
8404dd4ee16ce1db07a233815b0107d2324caed0
[]
no_license
ekastan/PratamaJambiPelayanganV4
497d45f9e211393b6fe57d019f89f2e4ed581551
2c1bdd0d32225ee55c40dd0f81a4f9d4892e5394
refs/heads/master
2022-12-19T14:56:49.044658
2020-10-02T00:41:40
2020-10-02T00:41:40
300,462,758
0
0
null
null
null
null
UTF-8
Java
false
false
5,918
java
package com.example.pratamajambipelayangan; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class PersyaratanDetail extends AppCompatActivity { private String urlData = konfigurasi.URL_GET_LAYANAN_DETAIL; private RecyclerView recyclerViewDokumen; private PersyaratanDetailAdapter mAdapter; private ProgressDialog mProgressDialog; private List<PersyaratanModel> mListData; private String id_layanan; private String hari_kerja; private String nama_layanan; private String url_formulir; private Button btnFormulir; private TextView txtIdLayanan; private TextView txtNamaLayanan; private TextView txtHariKerja; private TextView txtURL; private TextView txtURLFormulir; Dialog myDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_persyaratan_detail); recyclerViewDokumen = findViewById(R.id.recyclerviewDokumen); mProgressDialog = new ProgressDialog(this); mProgressDialog.setMessage("Loading ..."); mProgressDialog.show(); mListData = new ArrayList<>(); myDialog = new Dialog(this); Intent intent = getIntent(); hari_kerja = intent.getStringExtra(konfigurasi.TAG_HARI_KERJA); id_layanan = intent.getStringExtra(konfigurasi.EMP_ID_LAYANAN); nama_layanan = intent.getStringExtra(konfigurasi.TAG_NAMA_LAYANAN); url_formulir = intent.getStringExtra(konfigurasi.TAG_URL_FORMULIR); txtURL = findViewById(R.id.txtURL); txtURL.setText(konfigurasi.URL_GET_LAYANAN_DETAIL+id_layanan); txtNamaLayanan = findViewById(R.id.txtNamaLayanan); txtNamaLayanan.setText(nama_layanan); txtHariKerja = findViewById(R.id.txtharikerja); txtHariKerja.setText(hari_kerja+" hari kerja"); btnFormulir = findViewById(R.id.btnFormulir); getDataVolley(); btnFormulir.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url_formulir)); intent.putExtra(konfigurasi.EMP_ID_LAYANAN,id_layanan); intent.putExtra(konfigurasi.TAG_HARI_KERJA,hari_kerja); intent.putExtra(konfigurasi.TAG_NAMA_LAYANAN,nama_layanan); intent.putExtra(konfigurasi.TAG_URL_FORMULIR,url_formulir); startActivity(intent); } }); } private void getDataVolley(){ urlData = txtURL.getText().toString(); final StringRequest request = new StringRequest(Request.Method.GET, urlData, new Response.Listener<String>() { @Override public void onResponse(String response) { mProgressDialog.dismiss(); iniData(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(request); } private void iniData(String response){ try { JSONObject jsonObject = new JSONObject(response); // ini utk mengambil attribute array yg ada di json (yaitu attribute data) // karna attribute data adalah array makanya kita get menggunakan JSONArray JSONArray jsonArray = jsonObject.getJSONArray("data"); //looping utk array for(int i=0; i<jsonArray.length(); i++){ //get json berdasarkan banyaknya data (index i) JSONObject objectPersyaratan = jsonArray.getJSONObject(i); //get data berdasarkan attribte yang ada dijsonnya (harus sama) String Dokumen = objectPersyaratan.getString("dokumen"); //add data ke modelnya PersyaratanModel persyaratanModel = new PersyaratanModel(); persyaratanModel.setDokumen(Dokumen); //add model ke list mListData.add(persyaratanModel); //passing data list ke adapter mAdapter = new PersyaratanDetailAdapter(mListData, PersyaratanDetail.this); mAdapter.notifyDataSetChanged(); recyclerViewDokumen.setLayoutManager(new LinearLayoutManager(PersyaratanDetail.this)); recyclerViewDokumen.setItemAnimator(new DefaultItemAnimator()); recyclerViewDokumen.setAdapter(mAdapter); } } catch (JSONException e) { e.printStackTrace(); } } }
[ "kawa130484@gmail.com" ]
kawa130484@gmail.com
c6bca7348cb45fb77e7c2fc9c9ab813a221ca2e7
8fc86deabf8a0316df1af39442b79f62e811a8c4
/src/main/java/com/nanda/java8/strings/SplitStrings.java
3fc896077f7bf456684569da7adc4dc10c599893
[]
no_license
nandansn/java8
346fb4b06802091af4a928f493a8080ea001d35b
5d151cc52bcbf2011e58f9d5f85f43de67114354
refs/heads/master
2022-03-07T07:03:14.967008
2019-11-30T15:57:03
2019-11-30T15:57:03
116,780,752
0
0
null
null
null
null
UTF-8
Java
false
false
70
java
package com.nanda.java8.strings; public class SplitStrings { }
[ "nandakumar.rangasamy@oracle.com" ]
nandakumar.rangasamy@oracle.com
fb01c92b81452532cc73224e87e0f4d5779f0b11
30b6b7ebdedb3bb05399d64c5ad1150dbf456925
/ucanaccess/tags/ucanaccess-3.0.6/src/test/java/net/ucanaccess/test/ColumnOrderTest.java
97fffb962050c65683627a681c76c9be6cebf361
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
pchaozhong/ucanaccess-1
229e35d1507d6ad2aa2768953e15c96c19fe993f
e71f19748d5ec815f8bb27456c0aa66bf3492298
refs/heads/master
2020-03-31T11:20:39.568788
2017-04-14T18:26:18
2017-04-14T18:26:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,479
java
/* Copyright (c) 2012 Marco Amadei. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package net.ucanaccess.test; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import com.healthmarketscience.jackcess.Database.FileFormat; public class ColumnOrderTest extends UcanaccessTestBase { public ColumnOrderTest() { super(); } public ColumnOrderTest(FileFormat accVer) { super(accVer); } public String getAccessPath() { return "net/ucanaccess/test/resources/columnOrder.accdb"; } protected void setUp() throws Exception {} public void testColumnOrder1() throws Exception { super.setColumnOrder("display"); Connection uca = getUcanaccessConnection(); PreparedStatement ps=uca.prepareStatement("insert into t1 values (?,?,?)"); ps.setInt(3, 3); ps.setDate(2, new Date(System.currentTimeMillis())); ps.setString(1, "This is the display order"); ps.close(); uca.close(); } }
[ "jamadei@0d68d6fd-73e9-4e6e-8cf7-27d5ccde7a4d" ]
jamadei@0d68d6fd-73e9-4e6e-8cf7-27d5ccde7a4d
319465abf8fac152b8a68a0e839be91cc556b98c
83103555afbbbd7114addda3f66d1ab9dc089955
/src/lambdas/CalculoTeste.java
fce27f31c78e3ced00166cc347906350aaaf3b29
[]
no_license
garciawell/curso-java
c4dd820c9f44567dc99515a719e5bda56e181317
aa7efbf0b607f7e9e64e7c8541925718f6aac3e4
refs/heads/master
2021-01-15T01:19:52.490739
2020-04-23T00:01:34
2020-04-23T00:01:34
242,828,661
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package lambdas; public class CalculoTeste { public static void main(String[] args) { Calculo soma = new Soma(); System.out.println(soma.executar(2,3)); Calculo multiplicacao = new Multiplicar(); System.out.println(multiplicacao.executar(2,3)); } }
[ "garciawell@gmail.com" ]
garciawell@gmail.com
e93ef6810ee5ce8d0b013e2813fdbd905cbce4b8
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/dc181637f24f1ec18c690d3bcc51f3010cf91045/before/IncProjectBuilder.java
4fcdea4f03b3d98b6aa1dcc2d0dccbffd7a1df3f
[]
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
42,999
java
package org.jetbrains.jps.incremental; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.*; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.containers.ConcurrentHashSet; import com.intellij.util.io.MappingFailedException; import com.intellij.util.io.PersistentEnumerator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.ether.dependencyView.Callbacks; import org.jetbrains.jps.*; import org.jetbrains.jps.api.CanceledStatus; import org.jetbrains.jps.api.GlobalOptions; import org.jetbrains.jps.api.RequestFuture; import org.jetbrains.jps.api.SharedBuilderThreadPool; import org.jetbrains.jps.cmdline.ProjectDescriptor; import org.jetbrains.jps.incremental.fs.BuildFSState; import org.jetbrains.jps.incremental.fs.RootDescriptor; import org.jetbrains.jps.incremental.java.ExternalJavacDescriptor; import org.jetbrains.jps.incremental.java.JavaBuilder; import org.jetbrains.jps.incremental.java.JavaBuilderLogger; import org.jetbrains.jps.incremental.messages.*; import org.jetbrains.jps.incremental.storage.*; import org.jetbrains.jps.model.java.JpsJavaClasspathKind; import org.jetbrains.jps.model.java.JpsJavaExtensionService; import org.jetbrains.jps.model.module.JpsModule; import org.jetbrains.jps.service.SharedThreadPool; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; /** * @author Eugene Zhuravlev * Date: 9/17/11 */ public class IncProjectBuilder { private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.IncProjectBuilder"); public static final String BUILD_NAME = "EXTERNAL BUILD"; private static final String CLASSPATH_INDEX_FINE_NAME = "classpath.index"; private static final boolean GENERATE_CLASSPATH_INDEX = Boolean.parseBoolean(System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION, "false")); private static final boolean PARALLEL_BUILD_ENABLED = Boolean.parseBoolean(System.getProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, "false")); private final ProjectDescriptor myProjectDescriptor; private final BuilderRegistry myBuilderRegistry; private final Map<String, String> myBuilderParams; private final CanceledStatus myCancelStatus; @Nullable private final Callbacks.ConstantAffectionResolver myConstantSearch; private ProjectChunks myProductionChunks; private ProjectChunks myTestChunks; private final List<MessageHandler> myMessageHandlers = new ArrayList<MessageHandler>(); private final MessageHandler myMessageDispatcher = new MessageHandler() { public void processMessage(BuildMessage msg) { for (MessageHandler h : myMessageHandlers) { h.processMessage(msg); } } }; private volatile float myModulesProcessed = 0.0f; private final float myTotalModulesWork; private final int myTotalModuleLevelBuilderCount; private final List<Future> myAsyncTasks = new ArrayList<Future>(); public IncProjectBuilder(ProjectDescriptor pd, BuilderRegistry builderRegistry, Map<String, String> builderParams, CanceledStatus cs, @Nullable Callbacks.ConstantAffectionResolver constantSearch) { myProjectDescriptor = pd; myBuilderRegistry = builderRegistry; myBuilderParams = builderParams; myCancelStatus = cs; myConstantSearch = constantSearch; myProductionChunks = new ProjectChunks(pd.jpsProject, JpsJavaClasspathKind.PRODUCTION_COMPILE); myTestChunks = new ProjectChunks(pd.jpsProject, JpsJavaClasspathKind.TEST_COMPILE); myTotalModulesWork = (float)pd.rootsIndex.getTotalModuleCount() * 2; /* multiply by 2 to reflect production and test sources */ myTotalModuleLevelBuilderCount = builderRegistry.getModuleLevelBuilderCount(); } public void addMessageHandler(MessageHandler handler) { myMessageHandlers.add(handler); } public void build(CompileScope scope, final boolean isMake, final boolean isProjectRebuild, boolean forceCleanCaches) throws RebuildRequestedException { final LowMemoryWatcher memWatcher = LowMemoryWatcher.register(new Runnable() { @Override public void run() { myProjectDescriptor.dataManager.flush(false); myProjectDescriptor.timestamps.getStorage().force(); } }); CompileContextImpl context = null; try { context = createContext(scope, isMake, isProjectRebuild); runBuild(context, forceCleanCaches); myProjectDescriptor.dataManager.saveVersion(); } catch (ProjectBuildException e) { final Throwable cause = e.getCause(); if (cause instanceof PersistentEnumerator.CorruptedException || cause instanceof MappingFailedException || cause instanceof IOException) { myMessageDispatcher.processMessage(new CompilerMessage( BUILD_NAME, BuildMessage.Kind.INFO, "Internal caches are corrupted or have outdated format, forcing project rebuild: " + e.getMessage()) ); throw new RebuildRequestedException(cause); } else { if (cause == null) { final String msg = e.getMessage(); if (!StringUtil.isEmpty(msg)) { myMessageDispatcher.processMessage(new ProgressMessage(msg)); } } else { myMessageDispatcher.processMessage(new CompilerMessage(BUILD_NAME, cause)); } } } finally { memWatcher.stop(); flushContext(context); // wait for the async tasks for (Future task : myAsyncTasks) { try { task.get(); } catch (Throwable th) { LOG.info(th); } } } } private static void flushContext(CompileContext context) { if (context != null) { final ProjectDescriptor pd = context.getProjectDescriptor(); pd.timestamps.getStorage().force(); pd.dataManager.flush(false); } final ExternalJavacDescriptor descriptor = ExternalJavacDescriptor.KEY.get(context); if (descriptor != null) { try { final RequestFuture future = descriptor.client.sendShutdownRequest(); future.waitFor(500L, TimeUnit.MILLISECONDS); } finally { // ensure process is not running descriptor.process.destroyProcess(); } ExternalJavacDescriptor.KEY.set(context, null); } //cleanupJavacNameTable(); } private static boolean ourClenupFailed = false; private static void cleanupJavacNameTable() { try { if (JavaBuilder.USE_EMBEDDED_JAVAC && !ourClenupFailed) { final Field freelistField = Class.forName("com.sun.tools.javac.util.Name$Table").getDeclaredField("freelist"); freelistField.setAccessible(true); freelistField.set(null, com.sun.tools.javac.util.List.nil()); } } catch (Throwable e) { ourClenupFailed = true; //LOG.info(e); } } private float updateFractionBuilderFinished(final float delta) { myModulesProcessed += delta; float processed = myModulesProcessed; return processed / myTotalModulesWork; } private void runBuild(CompileContextImpl context, boolean forceCleanCaches) throws ProjectBuildException { context.setDone(0.0f); LOG.info("Building project '" + context.getProjectDescriptor().project.getProjectName() + "'; isRebuild:" + context.isProjectRebuild() + "; isMake:" + context.isMake() + " parallel compilation:" + PARALLEL_BUILD_ENABLED); for (ProjectLevelBuilder builder : myBuilderRegistry.getProjectLevelBuilders()) { builder.buildStarted(context); } for (ModuleLevelBuilder builder : myBuilderRegistry.getModuleLevelBuilders()) { builder.buildStarted(context); } try { if (context.isProjectRebuild() || forceCleanCaches) { cleanOutputRoots(context); } context.processMessage(new ProgressMessage("Running 'before' tasks")); runTasks(context, myBuilderRegistry.getBeforeTasks()); context.setCompilingTests(false); context.processMessage(new ProgressMessage("Checking production sources")); buildChunks(context, myProductionChunks); context.setCompilingTests(true); context.processMessage(new ProgressMessage("Checking test sources")); buildChunks(context, myTestChunks); context.processMessage(new ProgressMessage("Building project")); runProjectLevelBuilders(context); context.processMessage(new ProgressMessage("Running 'after' tasks")); runTasks(context, myBuilderRegistry.getAfterTasks()); // cleanup output roots layout, commented for efficiency //final ModuleOutputRootsLayout outputRootsLayout = context.getDataManager().getOutputRootsLayout(); //try { // final Iterator<String> keysIterator = outputRootsLayout.getKeysIterator(); // final Map<String, JpsModule> modules = myProjectDescriptor.project.getModules(); // while (keysIterator.hasNext()) { // final String moduleName = keysIterator.next(); // if (modules.containsKey(moduleName)) { // outputRootsLayout.remove(moduleName); // } // } //} //catch (IOException e) { // throw new ProjectBuildException(e); //} } finally { for (ProjectLevelBuilder builder : myBuilderRegistry.getProjectLevelBuilders()) { builder.buildFinished(context); } for (ModuleLevelBuilder builder : myBuilderRegistry.getModuleLevelBuilders()) { builder.buildFinished(context); } context.processMessage(new ProgressMessage("Finished, saving caches...")); } } private CompileContextImpl createContext(CompileScope scope, boolean isMake, final boolean isProjectRebuild) throws ProjectBuildException { final CompileContextImpl context = new CompileContextImpl( scope, myProjectDescriptor, isMake, isProjectRebuild, myProductionChunks, myTestChunks, myMessageDispatcher, myBuilderParams, myCancelStatus ); ModuleLevelBuilder.CONSTANT_SEARCH_SERVICE.set(context, myConstantSearch); return context; } private void cleanOutputRoots(CompileContext context) throws ProjectBuildException { // whole project is affected final boolean shouldClear = context.getProjectDescriptor().project.getCompilerConfiguration().isClearOutputDirectoryOnRebuild(); try { if (shouldClear) { clearOutputs(context); } else { for (JpsModule module : context.getProjectDescriptor().jpsProject.getModules()) { final String moduleName = module.getName(); clearOutputFiles(context, moduleName, true); clearOutputFiles(context, moduleName, false); } } } catch (IOException e) { throw new ProjectBuildException("Error cleaning output files", e); } try { context.getProjectDescriptor().timestamps.getStorage().clean(); } catch (IOException e) { throw new ProjectBuildException("Error cleaning timestamps storage", e); } try { context.getProjectDescriptor().dataManager.clean(); } catch (IOException e) { throw new ProjectBuildException("Error cleaning compiler storages", e); } myProjectDescriptor.fsState.clearAll(); } private static void clearOutputFiles(CompileContext context, final String moduleName, boolean forTests) throws IOException { final SourceToOutputMapping map = context.getProjectDescriptor().dataManager.getSourceToOutputMap(moduleName, forTests); for (String srcPath : map.getKeys()) { final Collection<String> outs = map.getState(srcPath); if (outs != null && !outs.isEmpty()) { for (String out : outs) { new File(out).delete(); } context.processMessage(new FileDeletedEvent(outs)); } } } private void clearOutputs(CompileContext context) throws ProjectBuildException, IOException { final Collection<JpsModule> modulesToClean = context.getProjectDescriptor().jpsProject.getModules(); final Map<File, Set<Pair<String, Boolean>>> rootsToDelete = new HashMap<File, Set<Pair<String, Boolean>>>(); // map: outputRoot-> setOfPairs([module, isTest]) final Set<File> annotationOutputs = new HashSet<File>(); // separate collection because no root intersection checks needed for annotation generated sources final Set<File> allSourceRoots = new HashSet<File>(); final ProjectPaths paths = context.getProjectPaths(); for (JpsModule module : modulesToClean) { final File out = paths.getModuleOutputDir(module, false); if (out != null) { appendRootInfo(rootsToDelete, out, module, false); } final File testOut = paths.getModuleOutputDir(module, true); if (testOut != null) { appendRootInfo(rootsToDelete, testOut, module, true); } final AnnotationProcessingProfile profile = context.getAnnotationProcessingProfile(module); if (profile.isEnabled()) { File annotationOut = paths.getAnnotationProcessorGeneratedSourcesOutputDir(module, false, profile.getGeneratedSourcesDirName()); if (annotationOut != null) { annotationOutputs.add(annotationOut); } annotationOut = paths.getAnnotationProcessorGeneratedSourcesOutputDir(module, true, profile.getGeneratedSourcesDirName()); if (annotationOut != null) { annotationOutputs.add(annotationOut); } } final List<RootDescriptor> moduleRoots = context.getProjectDescriptor().rootsIndex.getModuleRoots(context, module); for (RootDescriptor d : moduleRoots) { allSourceRoots.add(d.root); } } // check that output and source roots are not overlapping final List<File> filesToDelete = new ArrayList<File>(); for (Map.Entry<File, Set<Pair<String, Boolean>>> entry : rootsToDelete.entrySet()) { context.checkCanceled(); boolean okToDelete = true; final File outputRoot = entry.getKey(); if (JpsPathUtil.isUnder(allSourceRoots, outputRoot)) { okToDelete = false; } else { final Set<File> _outRoot = Collections.singleton(outputRoot); for (File srcRoot : allSourceRoots) { if (JpsPathUtil.isUnder(_outRoot, srcRoot)) { okToDelete = false; break; } } } if (okToDelete) { // do not delete output root itself to avoid lots of unnecessary "roots_changed" events in IDEA final File[] children = outputRoot.listFiles(); if (children != null) { filesToDelete.addAll(Arrays.asList(children)); } } else { context.processMessage(new CompilerMessage(BUILD_NAME, BuildMessage.Kind.WARNING, "Output path " + outputRoot.getPath() + " intersects with a source root. The output cannot be cleaned.")); // clean only those files we are aware of for (Pair<String, Boolean> info : entry.getValue()) { clearOutputFiles(context, info.first, info.second); } } } for (File annotationOutput : annotationOutputs) { // do not delete output root itself to avoid lots of unnecessary "roots_changed" events in IDEA final File[] children = annotationOutput.listFiles(); if (children != null) { filesToDelete.addAll(Arrays.asList(children)); } } context.processMessage(new ProgressMessage("Cleaning output directories...")); myAsyncTasks.add( FileUtil.asyncDelete(filesToDelete) ); } private static void appendRootInfo(Map<File, Set<Pair<String, Boolean>>> rootsToDelete, File out, JpsModule module, boolean isTest) { Set<Pair<String, Boolean>> infos = rootsToDelete.get(out); if (infos == null) { infos = new HashSet<Pair<String, Boolean>>(); rootsToDelete.put(out, infos); } infos.add(Pair.create(module.getName(), isTest)); } private static void runTasks(CompileContext context, final List<BuildTask> tasks) throws ProjectBuildException { for (BuildTask task : tasks) { task.build(context); } } private void buildChunks(final CompileContextImpl context, ProjectChunks chunks) throws ProjectBuildException { final CompileScope scope = context.getScope(); final ProjectDescriptor pd = context.getProjectDescriptor(); try { if (PARALLEL_BUILD_ENABLED) { final List<ChunkGroup> chunkGroups = buildChunkGroups(context, chunks); for (ChunkGroup group : chunkGroups) { final List<ModuleChunk> groupChunks = group.getChunks(); final int chunkCount = groupChunks.size(); if (chunkCount == 0) { continue; } try { if (chunkCount == 1) { _buildChunk(createContextWrapper(context), scope, groupChunks.iterator().next()); } else { final CountDownLatch latch = new CountDownLatch(chunkCount); final Ref<Throwable> exRef = new Ref<Throwable>(null); if (LOG.isDebugEnabled()) { final StringBuilder logBuilder = new StringBuilder("Building chunks in parallel: "); for (ModuleChunk chunk : groupChunks) { logBuilder.append(chunk.getName()).append("; "); } LOG.debug(logBuilder.toString()); } for (final ModuleChunk chunk : groupChunks) { final CompileContext chunkLocalContext = createContextWrapper(context); SharedBuilderThreadPool.INSTANCE.submitBuildTask(new Runnable() { @Override public void run() { try { _buildChunk(chunkLocalContext, scope, chunk); } catch (Throwable e) { synchronized (exRef) { if (exRef.isNull()) { exRef.set(e); } } LOG.info(e); } finally { latch.countDown(); } } }); } try { latch.await(); } catch (InterruptedException e) { LOG.info(e); } final Throwable exception = exRef.get(); if (exception != null) { if (exception instanceof ProjectBuildException) { throw (ProjectBuildException)exception; } else { throw new ProjectBuildException(exception); } } } } finally { pd.dataManager.closeSourceToOutputStorages(groupChunks, context.isCompilingTests()); pd.dataManager.flush(true); } } } else { // non-parallel build for (ModuleChunk chunk : chunks.getChunkList()) { try { _buildChunk(context, scope, chunk); } finally { pd.dataManager.closeSourceToOutputStorages(Collections.singleton(chunk), context.isCompilingTests()); pd.dataManager.flush(true); } } } } catch (IOException e) { throw new ProjectBuildException(e); } } private void _buildChunk(CompileContext context, CompileScope scope, ModuleChunk chunk) throws ProjectBuildException { if (scope.isAffected(chunk)) { buildChunk(context, chunk); } else { final float fraction = updateFractionBuilderFinished(chunk.getModules().size()); context.setDone(fraction); } } private void buildChunk(CompileContext context, final ModuleChunk chunk) throws ProjectBuildException { boolean doneSomething = false; try { Utils.ERRORS_DETECTED_KEY.set(context, Boolean.FALSE); ensureFSStateInitialized(context, chunk); if (context.isMake()) { processDeletedPaths(context, chunk); doneSomething |= Utils.hasRemovedSources(context); } myProjectDescriptor.fsState.beforeChunkBuildStart(context, chunk); doneSomething = runModuleLevelBuilders(context, chunk); } catch (ProjectBuildException e) { throw e; } catch (Exception e) { throw new ProjectBuildException(e); } finally { try { for (BuilderCategory category : BuilderCategory.values()) { for (ModuleLevelBuilder builder : myBuilderRegistry.getBuilders(category)) { builder.cleanupResources(context, chunk); } } } finally { try { onChunkBuildComplete(context, chunk); } catch (Exception e) { throw new ProjectBuildException(e); } finally { final Collection<RootDescriptor> tempRoots = context.getProjectDescriptor().rootsIndex.clearTempRoots(context); if (!tempRoots.isEmpty()) { final Set<File> rootFiles = new HashSet<File>(); for (RootDescriptor rd : tempRoots) { rootFiles.add(rd.root); context.getProjectDescriptor().fsState.clearRecompile(rd); } myAsyncTasks.add( FileUtil.asyncDelete(rootFiles) ); } try { // restore deleted paths that were not procesesd by 'integrate' final Map<String, Collection<String>> map = Utils.REMOVED_SOURCES_KEY.get(context); if (map != null) { final boolean forTests = context.isCompilingTests(); for (Map.Entry<String, Collection<String>> entry : map.entrySet()) { final String moduleName = entry.getKey(); final Collection<String> paths = entry.getValue(); if (paths != null) { for (String path : paths) { myProjectDescriptor.fsState.registerDeleted(moduleName, new File(path), forTests, null); } } } } } catch (IOException e) { throw new ProjectBuildException(e); } Utils.REMOVED_SOURCES_KEY.set(context, null); if (doneSomething && GENERATE_CLASSPATH_INDEX) { final boolean forTests = context.isCompilingTests(); final Future<?> future = SharedThreadPool.getInstance().executeOnPooledThread(new Runnable() { @Override public void run() { createClasspathIndex(chunk, forTests); } }); myAsyncTasks.add(future); } } } } } private static void createClasspathIndex(final ModuleChunk chunk, boolean forTests) { final Set<File> outputPaths = new LinkedHashSet<File>(); for (JpsModule module : chunk.getModules()) { final String outputUrl = JpsJavaExtensionService.getInstance().getOutputUrl(module, forTests); if (outputUrl != null) { outputPaths.add(JpsPathUtil.urlToFile(outputUrl)); } } for (File outputRoot : outputPaths) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(new File(outputRoot, CLASSPATH_INDEX_FINE_NAME))); try { writeIndex(writer, outputRoot, ""); } finally { writer.close(); } } catch (IOException e) { // Ignore. Failed to create optional classpath index } } } private static void writeIndex(final BufferedWriter writer, final File file, final String path) throws IOException { writer.write(path); writer.write('\n'); final File[] files = file.listFiles(); if (files != null) { for (File child : files) { final String _path = path.isEmpty() ? child.getName() : path + "/" + child.getName(); writeIndex(writer, child, _path); } } } private void processDeletedPaths(CompileContext context, ModuleChunk chunk) throws ProjectBuildException { try { // cleanup outputs final Map<String, Collection<String>> removedSources = new HashMap<String, Collection<String>>(); for (JpsModule module : chunk.getModules()) { final Collection<String> deletedPaths = myProjectDescriptor.fsState.getAndClearDeletedPaths(module.getName(), context.isCompilingTests()); if (deletedPaths.isEmpty()) { continue; } removedSources.put(module.getName(), deletedPaths); final SourceToOutputMapping sourceToOutputStorage = context.getProjectDescriptor().dataManager.getSourceToOutputMap(module.getName(), context.isCompilingTests()); // actually delete outputs associated with removed paths for (String deletedSource : deletedPaths) { // deleting outputs corresponding to non-existing source final Collection<String> outputs = sourceToOutputStorage.getState(deletedSource); if (outputs != null && !outputs.isEmpty()) { final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger(); if (logger.isEnabled()) { final String[] buffer = new String[outputs.size()]; int i = 0; for (final String o : outputs) { buffer[i++] = o; } Arrays.sort(buffer); logger.log("Cleaning output files:"); for (final String o : buffer) { logger.log(o); } logger.log("End of files"); } for (String output : outputs) { new File(output).delete(); } context.processMessage(new FileDeletedEvent(outputs)); } // check if deleted source was associated with a form final SourceToFormMapping sourceToFormMap = context.getProjectDescriptor().dataManager.getSourceToFormMap(); final String formPath = sourceToFormMap.getState(deletedSource); if (formPath != null) { final File formFile = new File(formPath); if (formFile.exists()) { FSOperations.markDirty(context, formFile); } sourceToFormMap.remove(deletedSource); } } } if (!removedSources.isEmpty()) { final Map<String, Collection<String>> existing = Utils.REMOVED_SOURCES_KEY.get(context); if (existing != null) { for (Map.Entry<String, Collection<String>> entry : existing.entrySet()) { final Collection<String> paths = removedSources.get(entry.getKey()); if (paths != null) { paths.addAll(entry.getValue()); } else { removedSources.put(entry.getKey(), entry.getValue()); } } } Utils.REMOVED_SOURCES_KEY.set(context, removedSources); } } catch (IOException e) { throw new ProjectBuildException(e); } } // return true if changed something, false otherwise private boolean runModuleLevelBuilders(final CompileContext context, ModuleChunk chunk) throws ProjectBuildException { boolean doneSomething = false; boolean rebuildFromScratchRequested = false; float stageCount = myTotalModuleLevelBuilderCount; final int modulesInChunk = chunk.getModules().size(); int buildersPassed = 0; boolean nextPassRequired; do { nextPassRequired = false; myProjectDescriptor.fsState.beforeNextRoundStart(context, chunk); if (!context.isProjectRebuild()) { syncOutputFiles(context, chunk); } BUILDER_CATEGORY_LOOP: for (BuilderCategory category : BuilderCategory.values()) { final List<ModuleLevelBuilder> builders = myBuilderRegistry.getBuilders(category); if (builders.isEmpty()) { continue; } for (ModuleLevelBuilder builder : builders) { if (context.isMake()) { processDeletedPaths(context, chunk); } final ModuleLevelBuilder.ExitCode buildResult = builder.build(context, chunk); doneSomething |= (buildResult != ModuleLevelBuilder.ExitCode.NOTHING_DONE); if (buildResult == ModuleLevelBuilder.ExitCode.ABORT) { throw new ProjectBuildException("Builder " + builder.getDescription() + " requested build stop"); } context.checkCanceled(); if (buildResult == ModuleLevelBuilder.ExitCode.ADDITIONAL_PASS_REQUIRED) { if (!nextPassRequired) { // recalculate basis myModulesProcessed -= (buildersPassed * modulesInChunk) / stageCount; stageCount += myTotalModuleLevelBuilderCount; myModulesProcessed += (buildersPassed * modulesInChunk) / stageCount; } nextPassRequired = true; } else if (buildResult == ModuleLevelBuilder.ExitCode.CHUNK_REBUILD_REQUIRED) { if (!rebuildFromScratchRequested && !context.isProjectRebuild()) { LOG.info("Builder " + builder.getDescription() + " requested rebuild of module chunk " + chunk.getName()); // allow rebuild from scratch only once per chunk rebuildFromScratchRequested = true; try { // forcibly mark all files in the chunk dirty FSOperations.markDirty(context, chunk); // reverting to the beginning myModulesProcessed -= (buildersPassed * modulesInChunk) / stageCount; stageCount = myTotalModuleLevelBuilderCount; buildersPassed = 0; nextPassRequired = true; break BUILDER_CATEGORY_LOOP; } catch (Exception e) { throw new ProjectBuildException(e); } } else { context.getLoggingManager().getJavaBuilderLogger().log( "Builder " + builder.getDescription() + " requested second chunk rebuild"); } } buildersPassed++; final float fraction = updateFractionBuilderFinished(modulesInChunk / (stageCount)); context.setDone(fraction); } } } while (nextPassRequired); return doneSomething; } private void runProjectLevelBuilders(CompileContext context) throws ProjectBuildException { for (ProjectLevelBuilder builder : myBuilderRegistry.getProjectLevelBuilders()) { builder.build(context); context.checkCanceled(); } } private static void syncOutputFiles(final CompileContext context, ModuleChunk chunk) throws ProjectBuildException { final BuildDataManager dataManager = context.getProjectDescriptor().dataManager; final boolean compilingTests = context.isCompilingTests(); try { final Collection<String> allOutputs = new LinkedList<String>(); FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() { private final Map<JpsModule, SourceToOutputMapping> storageMap = new HashMap<JpsModule, SourceToOutputMapping>(); @Override public boolean apply(JpsModule module, File file, String sourceRoot) throws IOException { SourceToOutputMapping srcToOut = storageMap.get(module); if (srcToOut == null) { srcToOut = dataManager.getSourceToOutputMap(module.getName(), compilingTests); storageMap.put(module, srcToOut); } final String srcPath = FileUtil.toSystemIndependentName(file.getPath()); final Collection<String> outputs = srcToOut.getState(srcPath); if (outputs != null) { final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger(); for (String output : outputs) { if (logger.isEnabled()) { allOutputs.add(output); } new File(output).delete(); } if (!outputs.isEmpty()) { context.processMessage(new FileDeletedEvent(outputs)); } srcToOut.remove(srcPath); } return true; } }); final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger(); if (logger.isEnabled()) { if (context.isMake() && allOutputs.size() > 0) { logger.log("Cleaning output files:"); final String[] buffer = new String[allOutputs.size()]; int i = 0; for (String output : allOutputs) { buffer[i++] = output; } Arrays.sort(buffer); for (String output : buffer) { logger.log(output); } logger.log("End of files"); } } } catch (Exception e) { throw new ProjectBuildException(e); } } private static List<ChunkGroup> buildChunkGroups(CompileContext context, ProjectChunks chunks) { final List<ModuleChunk> allChunks = chunks.getChunkList(); // building aux dependencies map final Map<JpsModule, Set<JpsModule>> depsMap = new HashMap<JpsModule, Set<JpsModule>>(); final boolean compilingTests = context.isCompilingTests(); for (JpsModule module : context.getProjectDescriptor().jpsProject.getModules()) { Set<JpsModule> dependent = depsMap.get(module); if (dependent == null) { dependent = ProjectPaths.getModulesWithDependentsRecursively(module, compilingTests); dependent.remove(module); depsMap.put(module, dependent); } } final List<ChunkGroup> groups = new ArrayList<ChunkGroup>(); ChunkGroup currentGroup = new ChunkGroup(); groups.add(currentGroup); for (ModuleChunk chunk : allChunks) { if (dependsOnGroup(chunk, currentGroup, depsMap)) { currentGroup = new ChunkGroup(); groups.add(currentGroup); } currentGroup.addChunk(chunk); } return groups; } public static boolean dependsOnGroup(ModuleChunk chunk, ChunkGroup group, Map<JpsModule, Set<JpsModule>> depsMap) { for (ModuleChunk groupChunk : group.getChunks()) { final Set<JpsModule> groupChunkModules = groupChunk.getModules(); for (JpsModule module : chunk.getModules()) { if (Utils.intersects(depsMap.get(module), groupChunkModules)) { return true; } } } return false; } private static void onChunkBuildComplete(CompileContext context, @NotNull ModuleChunk chunk) throws IOException { final ProjectDescriptor pd = context.getProjectDescriptor(); final BuildFSState fsState = pd.fsState; fsState.clearContextRoundData(context); fsState.clearContextChunk(context); if (!Utils.errorsDetected(context) && !context.getCancelStatus().isCanceled()) { boolean marked = false; for (JpsModule module : chunk.getModules()) { if (context.isMake()) { // ensure non-incremental flag cleared context.clearNonIncrementalMark(module); } if (context.isProjectRebuild()) { fsState.markInitialScanPerformed(module.getName(), context.isCompilingTests()); } final Timestamps timestamps = pd.timestamps.getStorage(); final List<RootDescriptor> roots = pd.rootsIndex.getModuleRoots(context, module); for (RootDescriptor rd : roots) { if (context.isCompilingTests() ? rd.isTestRoot : !rd.isTestRoot) { marked |= fsState.markAllUpToDate(context.getScope(), rd, timestamps, context.getCompilationStartStamp()); } } } if (marked) { context.processMessage(UptoDateFilesSavedEvent.INSTANCE); } } } private static void ensureFSStateInitialized(CompileContext context, ModuleChunk chunk) throws IOException { final ProjectDescriptor pd = context.getProjectDescriptor(); final Timestamps timestamps = pd.timestamps.getStorage(); for (JpsModule module : chunk.getModules()) { if (context.isProjectRebuild()) { FSOperations.markDirtyFiles(context, module, timestamps, true, context.isCompilingTests() ? FSOperations.DirtyMarkScope.TESTS : FSOperations.DirtyMarkScope.PRODUCTION, null); updateOutputRootsLayout(context, module); } else { if (context.isMake()) { if (pd.fsState.markInitialScanPerformed(module.getName(), context.isCompilingTests())) { initModuleFSState(context, module); updateOutputRootsLayout(context, module); } } else { // forced compilation mode if (context.getScope().isRecompilationForced(module.getName())) { FSOperations.markDirtyFiles(context, module, timestamps, true, context.isCompilingTests() ? FSOperations.DirtyMarkScope.TESTS : FSOperations.DirtyMarkScope.PRODUCTION, null); updateOutputRootsLayout(context, module); } } } } } private static void initModuleFSState(CompileContext context, JpsModule module) throws IOException { boolean forceMarkDirty = false; final File currentOutput = context.getProjectPaths().getModuleOutputDir(module, context.isCompilingTests()); final ProjectDescriptor pd = context.getProjectDescriptor(); if (currentOutput != null) { Pair<String, String> outputsPair = pd.dataManager.getOutputRootsLayout().getState(module.getName()); if (outputsPair != null) { final String previousPath = context.isCompilingTests() ? outputsPair.second : outputsPair.first; forceMarkDirty = StringUtil.isEmpty(previousPath) || !FileUtil.filesEqual(currentOutput, new File(previousPath)); } else { forceMarkDirty = true; } } final Timestamps timestamps = pd.timestamps.getStorage(); final HashSet<File> currentFiles = new HashSet<File>(); FSOperations.markDirtyFiles(context, module, timestamps, forceMarkDirty, context.isCompilingTests() ? FSOperations.DirtyMarkScope.TESTS : FSOperations.DirtyMarkScope.PRODUCTION, currentFiles); // handle deleted paths final BuildFSState fsState = pd.fsState; fsState.clearDeletedPaths(module.getName(), context.isCompilingTests()); final SourceToOutputMapping sourceToOutputMap = pd.dataManager.getSourceToOutputMap(module.getName(), context.isCompilingTests()); for (final Iterator<String> it = sourceToOutputMap.getKeysIterator(); it.hasNext();) { final String path = it.next(); // can check if the file exists final File file = new File(path); if (!currentFiles.contains(file)) { fsState.registerDeleted(module.getName(), file, context.isCompilingTests(), timestamps); } } } private static void updateOutputRootsLayout(CompileContext context, JpsModule module) throws IOException { final File currentOutput = context.getProjectPaths().getModuleOutputDir(module, context.isCompilingTests()); if (currentOutput == null) { return; } final ModuleOutputRootsLayout outputRootsLayout = context.getProjectDescriptor().dataManager.getOutputRootsLayout(); Pair<String, String> outputsPair = outputRootsLayout.getState(module.getName()); // update data final String productionPath; final String testPath; if (context.isCompilingTests()) { productionPath = outputsPair != null? outputsPair.first : ""; testPath = FileUtil.toSystemIndependentName(currentOutput.getPath()); } else { productionPath = FileUtil.toSystemIndependentName(currentOutput.getPath()); testPath = outputsPair != null? outputsPair.second : ""; } outputRootsLayout.update(module.getName(), Pair.create(productionPath, testPath)); } private static class ChunkGroup { private final List<ModuleChunk> myChunks = new ArrayList<ModuleChunk>(); public void addChunk(ModuleChunk chunk) { myChunks.add(chunk); } public List<ModuleChunk> getChunks() { return myChunks; } } private static final Set<Key> GLOBAL_CONTEXT_KEYS = new HashSet<Key>(); static { // keys for data that must be visible to all threads GLOBAL_CONTEXT_KEYS.add(ExternalJavacDescriptor.KEY); } private static CompileContext createContextWrapper(final CompileContext delegate) { final ClassLoader loader = delegate.getClass().getClassLoader(); final UserDataHolderBase localDataHolder = new UserDataHolderBase(); final Set deletedKeysSet = new ConcurrentHashSet(); final Class<UserDataHolder> dataHolderinterface = UserDataHolder.class; final Class<MessageHandler> messageHandlerinterface = MessageHandler.class; return (CompileContext)Proxy.newProxyInstance(loader, new Class[] {CompileContext.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final Class<?> declaringClass = method.getDeclaringClass(); if (dataHolderinterface.equals(declaringClass)) { final Object firstArgument = args[0]; final boolean isGlobalContextKey = firstArgument instanceof Key && GLOBAL_CONTEXT_KEYS.contains((Key)firstArgument); if (!isGlobalContextKey) { final boolean isWriteOperation = args.length == 2 /*&& void.class.equals(method.getReturnType())*/; if (isWriteOperation) { if (args[1] == null) { deletedKeysSet.add(firstArgument); } else { deletedKeysSet.remove(firstArgument); } } else { if (deletedKeysSet.contains(firstArgument)) { return null; } } final Object result = method.invoke(localDataHolder, args); if (isWriteOperation || result != null) { return result; } } } else if (messageHandlerinterface.equals(declaringClass)) { final BuildMessage msg = (BuildMessage)args[0]; if (msg.getKind() == BuildMessage.Kind.ERROR) { Utils.ERRORS_DETECTED_KEY.set(localDataHolder, Boolean.TRUE); } } return method.invoke(delegate, args); } }); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
a6275acddca4d2196f4ecbeeb888d9f0dfb76d9b
b3571dbbfe3eadbf095b968b6d47a100607c44e9
/src/controlador/PrinciplaController.java
55efcbf262f663aebddb9bfc142443e8ede952e6
[]
no_license
warrenxxx/alim22
d8177251a9ac0f30d2d3e9cc6cafacaffc56eaa5
7cf518ce8805a64937d591c54ca47989705b0732
refs/heads/master
2021-01-18T20:39:10.331570
2017-04-02T12:02:27
2017-04-02T12:02:27
86,981,892
0
0
null
null
null
null
UTF-8
Java
false
false
2,100
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 controlador; import clases.CPersona; import controlador.admi.SideController; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.control.Menu; import javafx.scene.layout.BorderPane; import javafx.scene.layout.VBox; import static modelo.Fx2.USER; /** * FXML Controller class * * @author WARREN */ public class PrinciplaController implements Initializable { /** * Initializes the controller class. */ @FXML Menu file; @FXML BorderPane borderPane; public void init(String warren) throws IOException{ file.setText(warren); if( warren.compareTo("1")==0){ FXMLLoader loader=new FXMLLoader(getClass().getResource("/vista/admi/side.fxml")); VBox root =(VBox)loader.load(); SideController pc=(SideController)loader.getController(); pc.set_border_pane(borderPane); borderPane.setLeft(root); } } public void init(){ System.out.println("ss"); } @Override public void initialize(URL url, ResourceBundle rb) { USER=new CPersona(); FXMLLoader loader=new FXMLLoader(getClass().getResource("/vista/admi/side.fxml")); VBox root = null; try { root = (VBox)loader.load(); } catch (IOException ex) { Logger.getLogger(PrinciplaController.class.getName()).log(Level.SEVERE, null, ex); } SideController pc=(SideController)loader.getController(); pc.set_border_pane(borderPane); borderPane.setLeft(root); } }
[ "ALIM@alim-6b335301f6" ]
ALIM@alim-6b335301f6
fbbb0067d8e8e27cee9911e8b71dbcf37b126b51
162c40ed24b0006a1186da4205a5b86cc2f9746c
/app/src/main/java/com/webfarmatics/exptrack/ActivitySaveLoanDetails.java
27cd1d001d8173205b2f195711d1bb1c75047c6c
[]
no_license
jagtapvivek127/ExpTrack
8d63ad0549122c631a8ee50ddc8d7071cc274407
34b2f3eea4f0f0d56ee4f7ffb6d2e1eeb2744a46
refs/heads/master
2020-11-28T23:56:38.857109
2019-12-23T13:24:55
2019-12-23T13:24:55
229,954,921
0
0
null
null
null
null
UTF-8
Java
false
false
12,767
java
package com.webfarmatics.exptrack; import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.MobileAds; import com.webfarmatics.exptrack.bean.BeanLoan; import com.webfarmatics.exptrack.bean.BeanPurchase; import com.webfarmatics.exptrack.utils.AppDatabase; import com.webfarmatics.exptrack.utils.GlobalData; import java.util.Calendar; public class ActivitySaveLoanDetails extends AppCompatActivity implements View.OnClickListener { private Context context; private AppDatabase database; private RadioButton rbGiven, rbTaken; private EditText edtFromTo, edtLoAmount, edtLoPaymentDesc; private TextView tvLoDate, tvReDate, tvLoError, tvLoanHint; private LinearLayout llWalletIn, llBankIn; private boolean bankSelected = false, walletSelected = false; private int day, month, year, count = 0, day1, month1, year1; private String date = null; private static final int LOAN_DATE_ID = 127; private static final int LOAN_RETURN_DATE_ID = 122; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_save_loan_details); initialize(); initToolbar(); MobileAds.initialize(context, GlobalData.ADD_ID); AdView adView = findViewById(R.id.adView); AdRequest request = new AdRequest.Builder().build(); adView.loadAd(request); } private void initialize() { context = ActivitySaveLoanDetails.this; database = AppDatabase.getInstance(this); rbGiven = findViewById(R.id.rbGiven); rbTaken = findViewById(R.id.rbTaken); edtFromTo = findViewById(R.id.edtFromTo); edtLoAmount = findViewById(R.id.edtLoAmount); edtLoPaymentDesc = findViewById(R.id.edtLoPaymentDesc); tvLoDate = findViewById(R.id.tvLoDate); tvReDate = findViewById(R.id.tvReDate); tvLoError = findViewById(R.id.tvLoError); tvLoanHint = findViewById(R.id.tvLoanHint); Button btnLoSave = findViewById(R.id.btnLoSave); llWalletIn = findViewById(R.id.llWalletIn); llBankIn = findViewById(R.id.llBankIn); Calendar calendar = Calendar.getInstance(); day = calendar.get(Calendar.DAY_OF_MONTH); month = calendar.get(Calendar.MONTH); year = calendar.get(Calendar.YEAR); showDateFirst(day, month, year); day1 = calendar.get(Calendar.DAY_OF_MONTH); month1 = calendar.get(Calendar.MONTH); year1 = calendar.get(Calendar.YEAR); showDateReturn(day1, month1, year1); llWalletIn.setOnClickListener(this); llBankIn.setOnClickListener(this); tvLoDate.setOnClickListener(this); tvReDate.setOnClickListener(this); btnLoSave.setOnClickListener(this); rbTaken.setOnClickListener(this); rbGiven.setOnClickListener(this); AdView adView = findViewById(R.id.adView); AdRequest request = new AdRequest.Builder().build(); adView.loadAd(request); } @SuppressLint("ResourceAsColor") @Override public void onClick(View v) { switch (v.getId()) { case R.id.llBankIn: if (walletSelected) { bankSelected = true; walletSelected = false; llBankIn.setBackgroundResource(R.drawable.select_box); llWalletIn.setBackgroundResource(R.drawable.comment_box); } else { bankSelected = true; llBankIn.setBackgroundResource(R.drawable.select_box); } break; case R.id.llWalletIn: if (bankSelected) { bankSelected = false; walletSelected = true; llBankIn.setBackgroundResource(R.drawable.comment_box); llWalletIn.setBackgroundResource(R.drawable.select_box); } else { walletSelected = true; llWalletIn.setBackgroundResource(R.drawable.select_box); } break; case R.id.tvLoDate: showDialog(LOAN_DATE_ID); break; case R.id.tvReDate: showDialog(LOAN_RETURN_DATE_ID); break; case R.id.btnLoSave: saveLoanDetails(); break; case R.id.rbGiven: tvLoanHint.setText("Debit from"); tvLoanHint.setVisibility(View.VISIBLE); break; case R.id.rbTaken: tvLoanHint.setText("Credit in"); tvLoanHint.setVisibility(View.VISIBLE); break; } } private void showDateFirst(int day, int month, int year) { month = month + 1; Log.e("error", "showDateFirst day " + day + " month " + month + " year " + year); tvLoDate.setText(day + "/" + month + "/" + year); } private void showDateReturn(int day1, int month1, int year1) { month1 = month1 + 1; Log.e("error", "showReturnDate day1 " + day1 + " month1 " + month1 + " year1 " + year1); // tvReDate.setText(day1 + "/" + month1 + "/" + year1); tvReDate.setText("N/A"); } @Override protected Dialog onCreateDialog(int id) { if (id == LOAN_DATE_ID) { return new DatePickerDialog(context, myDateListener, year, month, day); } else { return new DatePickerDialog(context, myDateListener1, year1, month1, day1); } } private DatePickerDialog.OnDateSetListener myDateListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int y, int m, int d) { count++; Log.e("error", "DatePickerDialog initial date count " + count); Log.e("error", "DatePickerDialog initial day " + day + " month " + month + " year " + year); int selectedDate = datePicker.getDayOfMonth(); int selectedMonth = datePicker.getMonth(); int selectedYear = datePicker.getYear(); Log.e("error", "DatePickerDialog new Date day " + selectedDate + " month " + selectedMonth + " year " + selectedYear); setLoanDate(selectedDate, selectedMonth, selectedYear); } }; private DatePickerDialog.OnDateSetListener myDateListener1 = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int y, int m, int d) { count++; Log.e("error", "DatePickerDialog initial date count " + count); Log.e("error", "DatePickerDialog initial day " + day + " month " + month + " year " + year); int selectedDate = datePicker.getDayOfMonth(); int selectedMonth = datePicker.getMonth(); int selectedYear = datePicker.getYear(); Log.e("error", "DatePickerDialog new Date day " + selectedDate + " month " + selectedMonth + " year " + selectedYear); setReturnDate(selectedDate, selectedMonth, selectedYear); } }; private void setLoanDate(int day, int month, int year) { month = month + 1; date = day + "/" + month + "/" + year; tvLoDate.setText(date); } private void setReturnDate(int day, int month, int year) { month = month + 1; date = day + "/" + month + "/" + year; tvReDate.setText(date); } private void saveLoanDetails() { String loanStatus = null; boolean isGiven = rbGiven.isChecked(); boolean isTaekn = rbTaken.isChecked(); if (isGiven) loanStatus = "GIVEN"; else if (isTaekn) loanStatus = "TAKEN"; else { toastMsg("Select Loan Given or Taken"); return; } String fromTo = edtFromTo.getText().toString(); String loanAmt = edtLoAmount.getText().toString(); String loanDesc = edtLoPaymentDesc.getText().toString(); String loanDate = tvLoDate.getText().toString(); String returnDate = tvReDate.getText().toString(); if (fromTo.isEmpty()) { toastMsg("Enter Name..."); edtFromTo.setError("require"); return; } if (loanAmt.isEmpty()) { toastMsg("Enter Amount..."); edtLoAmount.setError("require"); return; } if (loanDesc.isEmpty()) { toastMsg("Enter Comment..."); edtLoPaymentDesc.setError("require"); return; } if (returnDate.equalsIgnoreCase("N/A")) { toastMsg("Select return Date."); return; } int amt = Integer.parseInt(loanAmt); if (loanStatus.equalsIgnoreCase("GIVEN")) { if (walletSelected) { String walletbal = database.getWalletBalance(); int bBal = Integer.parseInt(walletbal); if (bBal < amt) { tvLoError.setText("Wallet balance is low... " + walletbal); tvLoError.setVisibility(View.VISIBLE); return; } else { database.reduceWalletBal(amt); } } else if (bankSelected) { String bankBal = database.getBankBalance(); int bBal = Integer.parseInt(bankBal); if (bBal < amt) { tvLoError.setText("Bank balance is low... " + bankBal); tvLoError.setVisibility(View.VISIBLE); return; } else { database.reduceBankBal(amt); } } } else if (loanStatus.equalsIgnoreCase("TAKEN")) { if (walletSelected) { database.addToWallet(amt); } else if (bankSelected) { database.addToBank(amt); } } else { toastMsg("Select Bank or Wallet"); return; } String amount = "" + amt; BeanLoan loan = new BeanLoan("", fromTo, amount, loanDate, returnDate, loanDesc, loanStatus); boolean saved = database.saveLoanDetails(loan); if (saved) { toastMsg("Loan details saved..."); finish(); Log.e("Loan", " savePurchase " + saved); } else { toastMsg("Loan failed..."); Log.e("Loan", " savePurchase " + saved); } BeanPurchase purchase = null; String paymentBy = null; if (walletSelected) { paymentBy = "Wallet"; Log.e("LoanTr", " paymentBy " + paymentBy); purchase = new BeanPurchase("Loan " + loanStatus, amt, loanDesc, loanDate, "Loan", paymentBy); } else if (bankSelected) { paymentBy = "Card"; Log.e("LoanTr", " paymentBy " + paymentBy); purchase = new BeanPurchase("Loan " + loanStatus, amt, loanDesc, loanDate, "Loan", paymentBy); } if (purchase == null) { return; } boolean saved12 = database.saveTransaction(purchase); if (saved12) { // toastMsg("Loan Transaction saved..."); Log.e("LoanTr", " Loan Transaction saved " + saved12); finish(); } else { toastMsg("Loan Transaction failed..!"); Log.e("LoanTr", " Loan Transaction failed " + saved12); } } public void toastMsg(String msg) { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } public void initToolbar() { //this set back button getSupportActionBar().setDisplayHomeAsUpEnabled(true); //this is set custom image to back button getSupportActionBar().setHomeAsUpIndicator(R.drawable.back_arrow); } //this method call when you press back button @Override public boolean onSupportNavigateUp() { this.finish(); return true; } }
[ "jagtapvivek127@gmail.com" ]
jagtapvivek127@gmail.com
4e6e6eb1c3dfbad085bd2d89f7f77f4b7377caa5
adae8ad2eb8c6836a69dd25b760c3c90e244f078
/app/src/main/java/com/example/sarjhu/parkingtest/Otpgen.java
5b587222ec970a75213de86b7d92fd938fe7e6df
[]
no_license
Sarjhana/ParkSmart
d59888b58c9e5fd7f03c28c7583effde718a1868
7487ac04fc12ae65427e685171140c0a90820c0d
refs/heads/master
2021-05-22T21:16:18.666988
2020-04-04T21:13:22
2020-04-04T21:13:22
253,099,974
1
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.example.sarjhu.parkingtest; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Random; public class Otpgen extends AppCompatActivity { Button generateRandom; TextView randomResult; Random myRandom; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_otpgen); generateRandom = findViewById(R.id.generate); randomResult = findViewById(R.id.randomresult); //popup = findViewById(R.id.popup); generateRandom.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub String result = " "; myRandom = new Random(); int rand = myRandom.nextInt(10000); while(String.valueOf(rand).length()<5) { rand += rand; } result = String.valueOf(rand).substring(0,5); randomResult.setText(String.valueOf(result)); }}); } }
[ "sarjhur@gmail.com" ]
sarjhur@gmail.com
747479dbbc58148a7ced44a3464aed2b5e5a6001
636e5c82bd0d2f56b192cb6289d41ad5ab7ec68c
/andAlarmManager/src/main/java/com/babacit/alarm/ui/activity/ChangePhoneNumActivity.java
081c934b574d02751a73b347295ba1d18a063b98
[]
no_license
jiaxisyy/AndAlarmManager
3cf3aeac732b01a66b73fa3f6a9c0f49aff9a295
b32fe821669e553b99a2e74b96cad4ab152f0382
refs/heads/master
2020-03-09T16:46:41.388001
2018-04-10T08:01:20
2018-04-10T08:01:20
115,099,258
0
0
null
null
null
null
UTF-8
Java
false
false
7,024
java
package com.babacit.alarm.ui.activity; import java.util.Timer; import java.util.TimerTask; import com.babacit.alarm.R; import com.babacit.alarm.config.SharedConfig; import com.babacit.alarm.err.ErrUtils; import com.babacit.alarm.interfaces.RequestCallBack; import com.babacit.alarm.server.GetVerifyTypeServer; import com.babacit.alarm.server.UpdatePhoneNoServer; import com.babacit.alarm.utils.NetworkUtils; import com.babacit.alarm.utils.PhoneNumCheckUtil; import com.babacit.alarm.utils.ToastUtil; import com.umeng.analytics.MobclickAgent; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class ChangePhoneNumActivity extends BaseActivity implements OnClickListener { private EditText mEtOriginNum, mEtNewNum, mEtCode, mEtPwd; private String originNum, newNum, code, pwd; private Button mBtFetchCode; private static final int MSG_FETCH_CODE_SUCCESS = 0; private static final int MSG_FETCH_CODE_FAIL = 1; private static final int MSG_UPDATE_PHONE_SUCCESS = 2; private static final int MSG_UPDATE_PHONE_FAIL = 3; private SharedConfig config; private static final int MSG_ENABLE_FETCH_BTN = 2003; private static final int MSG_REFRESH_BTN_TEXT = 2004; private Timer timer; private static int mCountDown; private RequestCallBack fetchCodeCallBack = new RequestCallBack() { @Override public void onSuccess(Object obj) { mHandler.sendEmptyMessage(MSG_FETCH_CODE_SUCCESS); } @Override public void onFail(Object object, int errCode) { Message msg = mHandler.obtainMessage(MSG_FETCH_CODE_FAIL); msg.arg1 = errCode; msg.sendToTarget(); } }; private RequestCallBack updatePhoneNoCallBack = new RequestCallBack() { @Override public void onSuccess(Object obj) { mHandler.sendEmptyMessage(MSG_UPDATE_PHONE_SUCCESS); } @Override public void onFail(Object object, int errCode) { Message msg = mHandler.obtainMessage(MSG_UPDATE_PHONE_FAIL); msg.arg1 = errCode; msg.sendToTarget(); } }; private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_UPDATE_PHONE_SUCCESS: Intent data = new Intent(); data.putExtra("phone", newNum); setResult(0, data); finish(); break; case MSG_UPDATE_PHONE_FAIL: ToastUtil.showToast(getApplicationContext(), ErrUtils.getErrorReasonStr(msg.arg1)); break; case MSG_FETCH_CODE_SUCCESS: break; case MSG_FETCH_CODE_FAIL: ToastUtil.showToast(getApplicationContext(), ErrUtils.getErrorReasonStr(msg.arg1)); break; case MSG_REFRESH_BTN_TEXT: if (msg.arg2 == 0) { mHandler.sendEmptyMessage(MSG_ENABLE_FETCH_BTN); } mBtFetchCode.setText(String.valueOf(msg.arg2) + getResources().getString( R.string.txt_retry_after_seconds)); break; case MSG_ENABLE_FETCH_BTN: mBtFetchCode.setText(getResources().getString( R.string.txt_fetch_verification_code)); mBtFetchCode.setEnabled(true); stopTimer(); break; default: break; } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_change_phone_num); config = new SharedConfig(this); bindField(); } private void bindField() { mEtOriginNum = (EditText) findViewById(R.id.et_change_phone_number_origin); mEtOriginNum.setText(getIntent().getStringExtra("origin")); mEtNewNum = (EditText) findViewById(R.id.et_change_phone_number_new); mEtCode = (EditText) findViewById(R.id.et_change_phone_num_verification_code); mEtPwd = (EditText) findViewById(R.id.et_change_phone_num_input_password); findViewById(R.id.btn_change_phone_num_back).setOnClickListener(this); findViewById(R.id.btn_confirm).setOnClickListener(this); mBtFetchCode = (Button) findViewById(R.id.btn_change_phone_num_fetch_verification_code); mBtFetchCode.setOnClickListener(this); } @Override public void onClick(View v) { originNum = mEtOriginNum.getText().toString().trim(); newNum = mEtNewNum.getText().toString().trim(); code = mEtCode.getText().toString().trim(); pwd = mEtPwd.getText().toString().trim(); switch (v.getId()) { case R.id.btn_change_phone_num_back: finish(); break; case R.id.btn_confirm: if (!NetworkUtils.isNetWorkOk(getApplicationContext())) { ToastUtil.showToast(getApplicationContext(), "请检查您的网络!"); return; } if (originNum.equals("")) { ToastUtil.showToast(ChangePhoneNumActivity.this, getResources() .getString(R.string.txt_phone_number_cannot_be_empty)); return; } if (!PhoneNumCheckUtil.isMobileNum(originNum)) { ToastUtil.showToast(getApplicationContext(), getResources() .getString(R.string.txt_phone_number_wrong_format)); return; } if (newNum.equals("")) { ToastUtil.showToast(ChangePhoneNumActivity.this, getResources() .getString(R.string.txt_phone_number_cannot_be_empty)); return; } if (!PhoneNumCheckUtil.isMobileNum(newNum)) { ToastUtil.showToast(getApplicationContext(), getResources() .getString(R.string.txt_phone_number_wrong_format)); return; } if (code.equals("")) { ToastUtil .showToast( ChangePhoneNumActivity.this, getResources() .getString( R.string.txt_verification_code_cannot_be_empty)); return; } if (pwd.equals("")) { ToastUtil.showToast(ChangePhoneNumActivity.this, getResources() .getString(R.string.txt_password_cannot_be_empty)); return; } new UpdatePhoneNoServer().start(config.getUserId(), originNum, pwd, newNum, code, updatePhoneNoCallBack); break; case R.id.btn_change_phone_num_fetch_verification_code: if (newNum.equals("")) { ToastUtil.showToast(ChangePhoneNumActivity.this, getResources() .getString(R.string.txt_phone_number_cannot_be_empty)); return; } if (!PhoneNumCheckUtil.isMobileNum(newNum)) { ToastUtil.showToast(getApplicationContext(), getResources() .getString(R.string.txt_phone_number_wrong_format)); return; } mBtFetchCode.setEnabled(false); startTimer(); new GetVerifyTypeServer().start(newNum, 2, fetchCodeCallBack); break; default: break; } } private void startTimer() { mCountDown = 30; if (timer == null) { timer = new Timer(); } timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { Message msg = mHandler.obtainMessage(MSG_REFRESH_BTN_TEXT); msg.arg2 = mCountDown--; msg.sendToTarget(); } }, 0, 1000); } private void stopTimer() { if (timer != null) { timer.cancel(); timer = null; } } @Override protected void onPause() { super.onPause(); MobclickAgent.onPause(this); } @Override protected void onResume() { super.onResume(); MobclickAgent.onResume(this); } }
[ "xyzsyy0102@163.com" ]
xyzsyy0102@163.com
bb2f8be32d88cd85d4d8bd807201e96d351e959e
1ded2d159107f5f9273bbcfeeedbc93e3abd2983
/src/main/java/com/venkat/algos/dp/BracesBalancer.java
78014eb37776714f74640ace35ebacd0be1ea6fd
[]
no_license
venkatbabukr/Algos-And-Programs
6b501dc475199365fa38623a36c8a433133fefc5
3f51fc6dc8b9d490d6ae2e0287e42f407f0a34a7
refs/heads/master
2023-09-01T02:30:21.387583
2023-08-25T13:40:31
2023-08-25T13:40:31
225,018,286
0
0
null
2021-07-30T07:21:53
2019-11-30T13:42:05
Java
UTF-8
Java
false
false
2,702
java
package com.venkat.algos.dp; import java.util.HashSet; import java.util.Set; public class BracesBalancer { private static final char OPEN_BRACE = '('; private static final char CLOSED_BRACE = ')'; private boolean isBalanced(String str) { int openBraceCount = 0; if (str != null && str.length() > 0) { char[] strArray = str.toCharArray(); for (int i = 0 ; i < strArray.length && openBraceCount > -1 ; i++) { char c = strArray[i]; switch (c) { case OPEN_BRACE: openBraceCount++; break; case CLOSED_BRACE: openBraceCount--; break; } } } return(openBraceCount == 0); } public Set<String> balanceWithMinimumRemoval(String inputString) { Set<String> balancedCombos = new HashSet<>(); Set<String> currentLevelCombos = new HashSet<>(); currentLevelCombos.add(inputString); while (!currentLevelCombos.isEmpty()) { Set<String> nextLevelCombos = new HashSet<>(); for (String str : currentLevelCombos) { if (isBalanced(str)) { balancedCombos.add(str); /* * Clear nextLevelCombos, as we have found balanced str at current level... * Just iterate on the remaining strs at this level to see if we can get * any other combination also balanced... */ nextLevelCombos.clear(); } else if (balancedCombos.isEmpty()) { // If balanced string is not yet found... for (int i = 0 ; i < str.length() ; i++) { switch (str.charAt(i)) { case OPEN_BRACE: case CLOSED_BRACE: String nextLevelStr = str.substring(0, i).concat(str.substring(i+1)); nextLevelCombos.add(nextLevelStr); } } } } currentLevelCombos = nextLevelCombos; } return balancedCombos; } public static void main(String[] args) { String[] imbalancedCases = new String[] {"((A())", "())((()", "())(", "())()("}; BracesBalancer balancer = new BracesBalancer(); for (String str : imbalancedCases) { System.out.format("Balanced set for %s: %s\n", str, balancer.balanceWithMinimumRemoval(str)); } } }
[ "venkatbabukr@gmail.com" ]
venkatbabukr@gmail.com
3d416408e21bb71222031f99407403a9f072c506
7d7bc3372c988c2e9af3902be868bcd34a73c3c0
/app/src/main/java/com/example/farzadfarshad/adeiye/BoomMenu/BoomButtons/SimpleCircleButton.java
e2fcaa734d232d711ca6d219141b22ff203b6d67
[]
no_license
farshadkiani/Adeiye
c6686c3f866a574c87f74396274515c6655dec6e
63aa633e76dc3cab89030af3bac5ccc45f39ac3f
refs/heads/master
2020-05-26T21:44:27.033291
2018-06-09T17:18:16
2018-06-09T17:18:16
72,527,119
1
0
null
null
null
null
UTF-8
Java
false
false
4,457
java
package com.example.farzadfarshad.adeiye.BoomMenu.BoomButtons; import android.content.Context; import android.graphics.PointF; import android.view.LayoutInflater; import android.view.View; import com.example.farzadfarshad.adeiye.BoomMenu.ButtonEnum; import com.example.farzadfarshad.adeiye.R; import java.util.ArrayList; /** * Created by Weiping Huang at 01:33 on 16/11/18 * For Personal Open Source * Contact me at 2584541288@qq.com or nightonke@outlook.com * For more projects: https://github.com/Nightonke */ @SuppressWarnings("unused") public class SimpleCircleButton extends BoomButton { private SimpleCircleButton(Builder builder, Context context) { super(context); this.context = context; this.buttonEnum = ButtonEnum.SimpleCircle; init(builder); } private void init(Builder builder) { LayoutInflater.from(context).inflate(R.layout.bmb_simple_circle_button, this, true); initAttrs(builder); if (isRound) initShadow(buttonRadius + shadowRadius); else initShadow(shadowCornerRadius); initCircleButton(); initImage(); centerPoint = new PointF( buttonRadius + shadowRadius + shadowOffsetX, buttonRadius + shadowRadius + shadowOffsetY); } private void initAttrs(Builder builder) { super.initAttrs(builder); } @Override public ButtonEnum type() { return ButtonEnum.SimpleCircle; } @Override public ArrayList<View> goneViews() { ArrayList<View> goneViews = new ArrayList<>(); goneViews.add(image); return goneViews; } @Override public ArrayList<View> rotateViews() { ArrayList<View> rotateViews = new ArrayList<>(); if (rotateImage) rotateViews.add(image); return rotateViews; } @Override public int trueWidth() { return buttonRadius * 2 + shadowRadius * 2 + shadowOffsetX * 2; } @Override public int trueHeight() { return buttonRadius * 2 + shadowRadius * 2 + shadowOffsetY * 2; } @Override public int contentWidth() { return buttonRadius * 2; } @Override public int contentHeight() { return buttonRadius * 2; } @Override public void toHighlighted() { if (lastStateIsNormal && ableToHighlight) { toHighlightedImage(); lastStateIsNormal = false; } } @Override public void toNormal() { if (!lastStateIsNormal) { toNormalImage(); lastStateIsNormal = true; } } @Override public void setRotateAnchorPoints() { image.setPivotX(buttonRadius - imageRect.left); image.setPivotY(buttonRadius - imageRect.top); } @Override public void setSelfScaleAnchorPoints() { } public static class Builder extends BoomButtonBuilder<Builder> { /** * The radius of boom-button, in pixel. * * @param buttonRadius the button radius * @return the builder */ public Builder buttonRadius(int buttonRadius) { this.buttonRadius = buttonRadius; return this; } /** * Set the corner-radius of button. * * @param buttonCornerRadius corner-radius of button * @return the builder */ public Builder buttonCornerRadius(int buttonCornerRadius) { this.buttonCornerRadius = buttonCornerRadius; return this; } /** * Whether the button is a circle shape. * * @param isRound is or not * @return the builder */ public Builder isRound(boolean isRound) { this.isRound = isRound; return this; } /** * Gets button radius, used in BMB package. * * @return the button radius */ public int getButtonRadius() { return buttonRadius; } /** * Build simple circle button, only used in BMB package. * * @param context the context * @return the simple circle button */ @Override public SimpleCircleButton build(Context context) { SimpleCircleButton button = new SimpleCircleButton(this, context); weakReferenceButton(button); return button; } } }
[ "farshadkiani70@gmail.com" ]
farshadkiani70@gmail.com
8451ca74661e5ee58e92b8ea0d366c205e697e95
88e4c2a0f6e9097efe89b47612509f32b79badb8
/src/main/java/com/alipay/api/response/AlipayMobileBeaconDeviceModifyResponse.java
c1227a0bb86ad4c9e976539b4d7102ab0a2f9674
[]
no_license
xushaomin/alipay-sdk-java
15f8e311b6ded9a565f473cd732e2747ed33d8b0
a03324a1ddc6eb3469c18f831512d5248bc98461
refs/heads/master
2020-06-15T13:26:40.913354
2016-12-01T12:23:27
2016-12-01T12:23:27
75,289,929
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.mobile.beacon.device.modify response. * * @author auto create * @since 1.0, 2015-02-03 19:48:29 */ public class AlipayMobileBeaconDeviceModifyResponse extends AlipayResponse { private static final long serialVersionUID = 8691383457445268438L; /** * 返回的操作码 */ @ApiField("code") private String code; /** * 操作结果说明 */ @ApiField("msg") private String msg; public void setCode(String code) { this.code = code; } public String getCode( ) { return this.code; } public void setMsg(String msg) { this.msg = msg; } public String getMsg( ) { return this.msg; } }
[ "xushaomin@foxmail.com" ]
xushaomin@foxmail.com
dbd936ae4d84a493e4e2f3e54765eb6bb7adde39
e1b078a6d5ce30297cac45808e08c577535cca2a
/src/main/java/frc/robot/utils/filters/MovingAverageFilter.java
edd8c0ff9bd61ac44ad8609d3447373650c0a724
[ "MIT" ]
permissive
frc6357/robot_code_2019
035a96a5614509565a95c2b41e64352f15adda8f
7984592c4347ba143f4c9f73f21fdedcee6c4b7d
refs/heads/master
2020-04-16T11:56:48.910115
2020-01-04T15:07:14
2020-01-04T15:07:14
165,558,321
1
1
MIT
2019-10-22T23:24:10
2019-01-13T21:49:45
Java
UTF-8
Java
false
false
2,073
java
package frc.robot.utils.filters; /** * This class creates a filter which has active dampening The function essentially works by creating a moving average and adjusting the * returned value based on this average. */ public class MovingAverageFilter extends Filter { private int MAX_VALUES; private double average, gain; private boolean firstPass; /** * Constructor for an object with the given number of maximum values * * @param max * the maximum number of values to be passed */ public MovingAverageFilter(int max) { gain = 1; MAX_VALUES = max; } /** * Constructor which allows you to pass both mmaximum number of values and gain * * @param max * the max number of values calculated in the average * @param g * the gain to which you set the filter */ public MovingAverageFilter(int max, double g) { MAX_VALUES = max; gain = g; } /** * Filter which uses a moving average to calculate the rate of acceleration Primarily exists for gentler acceleration and reduced * slippage * * @param rawAxis * the data to be passed in, from -1 to 1 * @return the filtered data, which is generated with a moving average */ @Override public double filter(double rawAxis) { if (firstPass) { average = rawAxis; firstPass = false; } else { average -= average / MAX_VALUES; average += rawAxis / MAX_VALUES; } return average * gain; } /** * Sets the number of maximum values * * @param m * the new number of maximum values */ public void setMaxValues(int m) { MAX_VALUES = m; } /** * Sets the gain to a new parameter * * @param g * the new gain with which to adjust output */ public void setGain(double g) { gain = g; } }
[ "dave@davewilsonphotography.com" ]
dave@davewilsonphotography.com
71de3862fa1956b117e264b6bfaaaa66df4c3cb1
d8931d2f25b36993d1c6e4f97f84d054634f74c6
/src/main/java/net/codelizard/hoc/content/Hero.java
913cc1ebf55579e03477d0814d088e68c646041a
[ "MIT" ]
permissive
Codelizard/HeroesOfCordan
9dd213a24d2279be35dd1f5999799bb169c88dd1
6310fd00aa5feccf9080b4c14e3b76444745b6cd
refs/heads/master
2020-11-29T20:56:25.518221
2018-05-07T22:25:44
2018-05-07T22:25:44
96,591,233
0
0
MIT
2018-05-06T14:58:48
2017-07-08T02:40:07
Java
UTF-8
Java
false
false
4,385
java
package net.codelizard.hoc.content; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** * Represents one of the titular Heroes of Cordan. * * @author Codelizard */ @JsonInclude(JsonInclude.Include.NON_DEFAULT) @JsonIgnoreProperties(ignoreUnknown=true) public class Hero { /** An internal-use ID. */ private String id; /** The hero's default name if the player doesn't supply one. */ private String name; /** The hero's RPG class (fighter, rogue, etc). */ @JsonProperty("class") private String rpgClass; /** A short description of the hero, such as "Physical Specialist" or "Arcane/Divine Hybrid". */ private String description; /** A flavor text description about the (default) hero. */ private String flavor; /** A quote from the hero. */ private String quote; /** The discount the hero applies. */ private HeroDiscount discount; /** The resources the character contributes at each level. */ private Map<Integer, Map<ResourceType, Integer>> resources; /** * @return An internal-use ID. */ public String getId() { return id; } /** * @return The hero's name, which can be overridden by the player. */ public String getName() { return name; } /** * @return The hero's RPG class (fighter, rogue, etc). */ public String getRpgClass() { return rpgClass; } /** * @return The hero's one-line description. */ public String getDescription() { return description; } /** * @return A description of the character. */ public String getFlavor() { return flavor; } /** * @return A quote from the default character. */ public String getQuote() { return quote; } /** * @return The discount the hero applies. */ public HeroDiscount getDiscount() { return discount; } /** * @return The resources the hero contributes to the party total each level. */ public Map<Integer, Map<ResourceType, Integer>> getResources() { return resources; } /** * @param id The new ID to use. */ public void setId(final String id) { this.id = id; } /** * @param name The new name to use. */ public void setName(final String name) { this.name = name; } /** * @param rpgClass The new RPG class to use. */ public void setRpgClass(final String rpgClass) { this.rpgClass = rpgClass; } /** * @param description The new description to use. */ public void setDescription(final String description) { this.description = description; } /** * @param flavor The new flavor text description to use. */ public void setFlavor(final String flavor) { this.flavor = flavor; } /** * @param quote The new character quote to use. */ public void setQuote(final String quote) { this.quote = quote; } /** * @param discount The new character discount to use. */ public void setDiscount(final HeroDiscount discount) { this.discount = discount; } /** * @param resources The new resource map to use. */ public void setResources(final Map<Integer, Map<ResourceType, Integer>> resources) { this.resources = resources; } public String getInitialResourcesText() { final StringBuilder output = new StringBuilder(); final Map<ResourceType, Integer> levelOneResources = resources.get(1); for(ResourceType nextResource : levelOneResources.keySet()) { if(output.length() > 0) { output.append(" | "); } output.append(nextResource.name) .append(": ") .append(levelOneResources.get(nextResource)); } return output.toString(); } /** * @return A one-line description of this Hero for debugging purposes. */ @Override public String toString() { return name + " (" + rpgClass + ")"; } }
[ "thecodelizard@hotmail.com" ]
thecodelizard@hotmail.com
3a3fa1988260af219f1eb3fb2023ad3162952d88
a150d03a87a28af74abae0f9b2cbfef164e69a8f
/src/org/dmd/mvw/tools/mvwgenerator/generated/types/adapters/SubMenuREFMVAdapter.java
bbbaa7893cf04275e4578fa6d8ed43e6cab862f3
[]
no_license
dark-matter-org/dark-matter-mvw
4d25454cdf9225c4dffb684b9f2c95be565ac874
88b1aea221571c080292fe7f28c9f8a0b0fc6eb1
refs/heads/master
2021-07-19T20:39:50.448942
2019-12-07T20:04:11
2019-12-07T20:04:11
46,194,408
0
0
null
2021-06-07T18:05:21
2015-11-14T22:21:05
Java
UTF-8
Java
false
false
1,559
java
package org.dmd.mvw.tools.mvwgenerator.generated.types.adapters; import org.dmd.dmc.presentation.DmcAdapterIF; import org.dmd.dmc.DmcAttribute; import org.dmd.dmc.DmcAttributeInfo; import org.dmd.dms.generated.types.DmcTypeModifierMV; import org.dmd.mvw.tools.mvwgenerator.generated.types.DmcTypeSubMenuREFMV; @SuppressWarnings("serial") // org.dmd.dms.util.AdapterFormatter.dumpAdapter(AdapterFormatter.java:59) // Called from: org.dmd.dms.util.AdapterFormatter.dumpAdapterMV(AdapterFormatter.java:16) public class SubMenuREFMVAdapter extends DmcTypeSubMenuREFMV implements DmcAdapterIF { transient DmcTypeSubMenuREFMV existingValue; public SubMenuREFMVAdapter(DmcAttributeInfo ai){ super(ai); } public void setEmpty(){ value = null; } public boolean hasValue(){ if (value == null) return(false); return(true); } public void resetToExisting() { if (existingValue == null) value = null; else value = existingValue.getMVCopy(); } public void setExisting(DmcAttribute<?> attr) { existingValue = (DmcTypeSubMenuREFMV) attr; if (existingValue != null) value = existingValue.getMVCopy(); } public boolean valueChanged(){ return(valueChangedMV(existingValue, this)); } public void addMods(DmcTypeModifierMV mods){ addModsMV(mods, existingValue, this); } public DmcAttribute<?> getExisting() { return(existingValue); } public Object getValue() { return(value); } }
[ "pstrong99@c0aa5241-de7e-54de-0197-666b8cbfb6a2" ]
pstrong99@c0aa5241-de7e-54de-0197-666b8cbfb6a2
e82855dad1d97c171a0146d59b524780fad2e112
3e48cec4fcd759da71f615e69e8f8b08dd6c2e79
/iot-cloud3/iot-cloud-web-admin/src/main/java/net/work100/training/stage2/iot/cloud/web/admin/web/interceptor/LoginInterceptor.java
06b60e0cf40e60c8f2a287c6c87472727cc0f016
[]
no_license
work100-net/training-stage2
615bb464b6d3993a3e0367fc34285f0983e9d62d
f130f9077f83d5a2829202549f7581d64412d8d8
refs/heads/master
2022-12-22T08:59:46.026883
2021-11-29T04:32:55
2021-11-29T04:32:55
238,898,365
3
6
null
2022-12-16T15:25:32
2020-02-07T10:37:15
JavaScript
UTF-8
Java
false
false
1,695
java
package net.work100.training.stage2.iot.cloud.web.admin.web.interceptor; import net.work100.training.stage2.iot.cloud.commons.constant.ConstantUtils; import net.work100.training.stage2.iot.cloud.commons.utils.SessionUtils; import net.work100.training.stage2.iot.cloud.domain.AuthManager; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * <p>Title: LoginInterceptor</p> * <p>Description: </p> * <p>Url: http://www.work100.net/training/monolithic-project-iot-cloud-admin.html</p> * * @author liuxiaojun * @date 2020-02-20 16:22 * ------------------- History ------------------- * <date> <author> <desc> * 2020-02-20 liuxiaojun 初始创建 * ----------------------------------------------- */ public class LoginInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { AuthManager authManager = SessionUtils.get(request, ConstantUtils.SESSION_MANAGER); // 未登录 if (authManager == null) { response.sendRedirect("/login"); } // 为 true 时放行,进入 postHandle return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { } }
[ "xiaojun.liu@work100.net" ]
xiaojun.liu@work100.net
3dbd90545faeff3bb7ddefb5e22fb96eab25ccd0
6b609e3f4f95082342428d2d8921b66429a26308
/src/main/java/org/jpos/iso/channel/ChannelPool.java
0f49bbe548a338fea716c8d0da61ea8fb9406295
[]
no_license
an262110/nettyserver
4b8f7ab9545d70af6c1e28e5e9ec6a4753fd7c92
1226fd4308eecee4c7fdc425029ef7853de8c6e4
refs/heads/master
2020-03-20T19:41:47.470139
2018-06-17T11:59:07
2018-06-17T11:59:07
137,649,336
0
0
null
null
null
null
UTF-8
Java
false
false
5,567
java
/* * jPOS Project [http://jpos.org] * Copyright (C) 2000-2010 Alejandro P. Revilla * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.jpos.iso.channel; import org.jpos.core.Configurable; import org.jpos.core.Configuration; import org.jpos.core.ConfigurationException; import org.jpos.iso.ISOChannel; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.ISOPackager; import org.jpos.util.LogEvent; import org.jpos.util.LogSource; import org.jpos.util.Logger; import org.jpos.util.NameRegistrar; import java.io.IOException; import java.util.List; import java.util.Vector; public class ChannelPool implements ISOChannel, LogSource, Configurable, Cloneable { boolean usable = true; String name = ""; protected Logger logger; protected String realm; Configuration cfg = null; List pool; ISOChannel current; public ChannelPool () { super (); pool = new Vector (); } public void setPackager(ISOPackager p) { // nothing to do } public synchronized void connect () throws IOException { current = null; LogEvent evt = new LogEvent(this, "connect"); evt.addMessage ("pool-size=" + Integer.toString (pool.size())); for (int i=0; i<pool.size(); i++) { try { evt.addMessage ("pool-" + Integer.toString (i)); ISOChannel c = (ISOChannel) pool.get (i); c.connect (); if (c.isConnected()) { current = c; usable = true; break; } } catch (IOException e) { evt.addMessage (e); } } if (current == null) evt.addMessage ("connect failed"); Logger.log (evt); if (current == null) { throw new IOException ("unable to connect"); } } public synchronized void disconnect () throws IOException { current = null; LogEvent evt = new LogEvent(this, "disconnect"); for (int i=0; i<pool.size(); i++) { try { ISOChannel c = (ISOChannel) pool.get (i); c.disconnect (); } catch (IOException e) { evt.addMessage (e); } } Logger.log (evt); } public synchronized void reconnect() throws IOException { disconnect (); connect (); } public synchronized boolean isConnected() { try { return getCurrent().isConnected (); } catch (IOException e) { return false; } } public ISOMsg receive() throws IOException, ISOException { return getCurrent().receive (); } public void send (ISOMsg m) throws IOException, ISOException { getCurrent().send (m); } public void send (byte[] b) throws IOException, ISOException { getCurrent().send (b); } public void setUsable(boolean b) { this.usable = b; } public void setName (String name) { this.name = name; NameRegistrar.register ("channel."+name, this); } public String getName() { return this.name; } public ISOPackager getPackager () { return (ISOPackager) null; } public void setLogger (Logger logger, String realm) { this.logger = logger; this.realm = realm; } public String getRealm () { return realm; } public Logger getLogger() { return logger; } public synchronized void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; String channelName[] = cfg.getAll ("channel"); for (int i=0; i<channelName.length; i++) { try { addChannel (channelName[i]); } catch (NameRegistrar.NotFoundException e) { throw new ConfigurationException(e); } } } public void addChannel (ISOChannel channel) { pool.add (channel); } public void addChannel (String name) throws NameRegistrar.NotFoundException { pool.add ((ISOChannel) NameRegistrar.get ("channel."+name)); } public void removeChannel (ISOChannel channel) { pool.remove (channel); } public void removeChannel (String name) throws NameRegistrar.NotFoundException { pool.remove ((ISOChannel) NameRegistrar.get ("channel."+name)); } public int size() { return pool.size(); } public synchronized ISOChannel getCurrent () throws IOException { if (current == null) connect(); else if (!usable) reconnect(); return current; } public Object clone(){ try { return (ChannelPool)super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } } }
[ "827204212@qq.com" ]
827204212@qq.com
c35191f17e1c61815095da1483ccc2eea2390594
18c96e35d364028a5f32ac28cfa449d0a2658ae4
/src/com/company/design_patterns/composite/MyList.java
97ceb875bb257c441b5a14b6b48425bd2c7783e3
[]
no_license
mmgrigorova/design-patterns-sandbox
bb909d11280b939818edc0e99663e11cb158f227
0803be02f74b666f3e6fc029b283713c9025f826
refs/heads/master
2022-08-01T09:33:06.574431
2020-05-27T07:44:04
2020-05-27T07:44:04
262,832,701
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
package com.company.design_patterns.composite; import java.util.ArrayList; import java.util.Collection; public class MyList extends ArrayList<ValueContainer> { public MyList(Collection<? extends ValueContainer> c) { super(c); } public int sum(){ int result = 0; for(ValueContainer container : this){ for(int value : container){ result += value; } } return result; } }
[ "mmgrigorova@gmail.com" ]
mmgrigorova@gmail.com
8cace0a59c8a6f7f19a935174ef2907808362d10
8cc5301089d99891992ee81a345fb02677a56c72
/android/tools_r22.6/sdklib/src/main/java/com/android/sdklib/repository/SdkSysImgConstants.java
d9983279b9a9ccc29b632bd8ef7b989f964f4ab9
[]
no_license
litengfei/srcnote
3f21dbd7b83ba9a4d003946910c0c7b8dd954b8e
8e1ce1732d48d048c6b2c71c3ada03cdc6b76509
refs/heads/master
2021-01-11T04:24:42.030363
2019-05-20T01:57:57
2019-05-20T02:00:04
71,199,156
0
0
null
null
null
null
UTF-8
Java
false
false
3,256
java
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.sdklib.repository; import com.android.sdklib.internal.repository.sources.SdkSource; import java.io.InputStream; /** * Public constants for the sdk-sys-img XML Schema. */ public class SdkSysImgConstants extends RepoConstants { /** * The default name looked for by {@link SdkSource} when trying to load an * sdk-sys-img XML if the URL doesn't match an existing resource. */ public static final String URL_DEFAULT_FILENAME = "sys-img.xml"; //$NON-NLS-1$ /** The base of our sdk-sys-img XML namespace. */ private static final String NS_BASE = "http://schemas.android.com/sdk/android/sys-img/"; //$NON-NLS-1$ /** * The pattern of our sdk-sys-img XML namespace. * Matcher's group(1) is the schema version (integer). */ public static final String NS_PATTERN = NS_BASE + "([1-9][0-9]*)"; //$NON-NLS-1$ /** * The latest version of the sdk-sys-img XML Schema. * Valid version numbers are between 1 and this number, included. */ public static final int NS_LATEST_VERSION = 2; /** The XML namespace of the latest sdk-sys-img XML. */ public static final String NS_URI = getSchemaUri(NS_LATEST_VERSION); /** The root sdk-sys-img element */ public static final String NODE_SDK_SYS_IMG = "sdk-sys-img"; //$NON-NLS-1$ /** A system-image tag id. */ public static final String ATTR_TAG_ID = "tag-id"; //$NON-NLS-1$ /** The user-visible display part of a system-image tag id. Optional. */ public static final String ATTR_TAG_DISPLAY = "tag-display"; //$NON-NLS-1$ /** * List of possible nodes in a repository XML. Used to populate options automatically * in the no-GUI mode. */ public static final String[] NODES = { NODE_SYSTEM_IMAGE, }; /** * Returns a stream to the requested {@code sdk-sys-img} XML Schema. * * @param version Between 1 and {@link #NS_LATEST_VERSION}, included. * @return An {@link InputStream} object for the local XSD file or * null if there is no schema for the requested version. */ public static InputStream getXsdStream(int version) { return getXsdStream(NODE_SDK_SYS_IMG, version); } /** * Returns the URI of the sdk-sys-img schema for the given version number. * @param version Between 1 and {@link #NS_LATEST_VERSION} included. */ public static String getSchemaUri(int version) { return String.format(NS_BASE + "%d", version); //$NON-NLS-1$ } }
[ "i@tengfei.li" ]
i@tengfei.li
735275195cc923ddf2e5d9029ba1c8c8cee58607
75f4432cff52c29767a2fe10de5462e7eb458598
/sepa-pain-lib/src/main/java/iso/std/iso/_20022/tech/xsd/pain_008_001_02/PersonIdentificationSchemeName1Choice.java
1071314402cb8a178527740ea461f068085dab81
[ "Apache-2.0" ]
permissive
germamix/sepa-pain-lib
893d0a238cf6d2e843f95b80716f72382ed310fe
1c5ea9edc0bbda8b00287611dd3e78e834357852
refs/heads/master
2016-09-06T15:03:25.832970
2015-03-22T09:04:01
2015-03-22T09:04:01
32,666,740
1
1
null
null
null
null
UTF-8
Java
false
false
2,628
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2013.11.14 at 08:41:30 AM CET // package iso.std.iso._20022.tech.xsd.pain_008_001_02; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for PersonIdentificationSchemeName1Choice complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="PersonIdentificationSchemeName1Choice"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;choice> * &lt;element name="Cd" type="{urn:iso:std:iso:20022:tech:xsd:pain.008.001.02}ExternalPersonIdentification1Code"/> * &lt;element name="Prtry" type="{urn:iso:std:iso:20022:tech:xsd:pain.008.001.02}Max35Text"/> * &lt;/choice> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PersonIdentificationSchemeName1Choice", propOrder = { "cd", "prtry" }) public class PersonIdentificationSchemeName1Choice { @XmlElement(name = "Cd") protected String cd; @XmlElement(name = "Prtry") protected String prtry; /** * Gets the value of the cd property. * * @return * possible object is * {@link String } * */ public String getCd() { return cd; } /** * Sets the value of the cd property. * * @param value * allowed object is * {@link String } * */ public void setCd(String value) { this.cd = value; } /** * Gets the value of the prtry property. * * @return * possible object is * {@link String } * */ public String getPrtry() { return prtry; } /** * Sets the value of the prtry property. * * @param value * allowed object is * {@link String } * */ public void setPrtry(String value) { this.prtry = value; } }
[ "mamix.ger@googlemail.com" ]
mamix.ger@googlemail.com
8573fe1cd0c62f562ffaa2821f1463dc6c27e50b
d23e6c9b99a455e9af9b61cdcfa4b4cc37506f35
/KmzProgramm/src/ru/kmz/web/common/client/window/ShowHistoryWindow.java
a05c338ff2362c01506959937ba5c1376e3e1c25
[]
no_license
kmzproject/kmz
2e1d4f7fff6e56fa9bf84aea0418254e382fed4d
de697b1796c8ec2dee070f9245b95d3bda498995
refs/heads/master
2020-05-16T22:14:57.567622
2014-02-12T07:07:59
2014-02-12T07:07:59
14,015,707
0
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
package ru.kmz.web.common.client.window; import ru.kmz.web.common.client.control.HistoryGrid; import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.container.Container; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; public class ShowHistoryWindow extends Window { private long objectId; public ShowHistoryWindow(long objectId) { super(); this.objectId = objectId; add(getInfoContainer()); setPixelSize(500, 300); setModal(true); setBlinkModal(true); createButtons(); } private Container getInfoContainer() { VerticalLayoutContainer p = new VerticalLayoutContainer(); HistoryGrid grid = HistoryGrid.getHistoryGrid(); grid.setObjectId(objectId); p.add(grid); return p; } protected void createButtons() { TextButton cancelButton = new TextButton("Закрыть"); cancelButton.addSelectHandler(new CancelSelectHandler(this)); addButton(cancelButton); } }
[ "lzibarev@yandex.ru" ]
lzibarev@yandex.ru
08007adc9fca1ee597634215e07d63f792868e3f
33ddea28587c8e9ffbd8534535330ad522e11aa4
/src/main/java/com/yuzhihao/myplatform/bot/core/middleware/pre/ContextMiddleware.java
f70f5d848c86278121912d5c1bdb31c6f2dfca83
[]
no_license
yuzhihao/myplatform-bot-dm
0c4f5702d099d42f332af621f79f84dfa63bd53d
0c8ba113cc6f0dcd166877acfdc5ede323d689dc
refs/heads/master
2020-03-20T23:05:48.008727
2018-07-09T01:13:07
2018-07-09T01:13:07
137,829,090
0
0
null
null
null
null
UTF-8
Java
false
false
1,328
java
package com.yuzhihao.myplatform.bot.core.middleware.pre; import com.yuzhihao.myPlatform.common.utils.JacksonUtils; import com.yuzhihao.myplatform.bot.core.DMThreadContext; import com.yuzhihao.myplatform.bot.core.client.redis.RedisServiceImpl; import com.yuzhihao.myplatform.bot.core.middleware.DialogueMiddleware; import com.yuzhihao.myplatform.bot.core.pojo.Bot; import com.yuzhihao.myplatform.bot.core.pojo.DialogContext; import com.yuzhihao.myplatform.bot.core.pojo.Session; import com.yuzhihao.myplatform.bot.core.pojo.enums.DMThreadContextEnum; import org.springframework.beans.factory.annotation.Autowired; import java.util.Optional; /** * 获取对话上下文信息 * 可以使用的数据:BOT,CONTEXT */ public class ContextMiddleware extends DialogueMiddleware { @Autowired RedisServiceImpl redisService; @Override protected boolean isRequired() { return true; } @Override protected boolean checkParam() { return true; } @Override public void preProcessing() { //DMThreadContext threadCtx = DMThreadContext.getInstance(); //DialogContext context = (DialogContext) threadCtx.get(DMThreadContextEnum.CONTEXT); //Bot bot = (Bot)threadCtx.get(DMThreadContextEnum.BOT); } @Override public void afterProcessing() {} }
[ "928435030@qq.com" ]
928435030@qq.com
500000b6e021e693a6a303c9c645e72084bbc895
1cee36069591bd026ad3d5f1f7ebbe3800798f24
/src/main/java/chan/com/usbserialforandroid/datas/util/FLog.java
dcc92f16bcf7b9080d8f9a5c3e4e04cc0d46131f
[]
no_license
fyyy4030/UsbSerialforAndroidDemos
e151cca794d5c1cd9ffb63ed23bbcac43f0f3946
24684c46f3bff4fc53cce9512890f2cb46591fbb
refs/heads/master
2023-03-15T19:00:27.288415
2017-12-29T08:56:50
2017-12-29T08:56:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,567
java
package chan.com.usbserialforandroid.datas.util; import android.util.Log; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import static android.util.Log.getStackTraceString; /** * Created by 28851274 on 7/27/15. */ public final class FLog { private final static String LOG_TAG = "FLog"; /** * Pls set to "true" if you want to save none log in SD card and print none log in ADB. * Otherwise set to "false". * Pls set to false always except in your debug test. */ private final static boolean NO_LOG = false; //The max of log file is 2M bytes. private final static int LOG_FILE_SIZE_MAX = 2 * 1024 * 1024; //The max of log buffer size is 8K bytes. private final static int LOG_BUFFER_SIZE_MAX = 8 * 1024; //Internal log buffer private static byte[] buffer = new byte[LOG_BUFFER_SIZE_MAX]; private static int mPos = 0; private static String mLogPath = "/usb_service/log/"; private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss "); private static SimpleDateFormat fileNameFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SS"); public static int v(String tag, String msg) { if (NO_LOG) return 0; if (tag == null || msg == null) return 0; saveLogs(tag, msg, null); return Log.v(tag, msg); } public static int v(String tag, String msg, Throwable tr) { if (NO_LOG) return 0; if (tag == null || tr == null) return 0; if (msg == null) { saveLogs(tag, "verbose info", tr); return Log.v(tag, "verbose info", tr); } else { saveLogs(tag, msg, tr); return Log.v(tag, msg, tr); } } public static int d(String tag, String msg) { if (NO_LOG) return 0; if (tag == null || msg == null) return 0; saveLogs(tag, msg, null); return Log.d(tag, msg); } public static int d(String tag, String msg, Throwable tr) { if (NO_LOG) return 0; if (tag == null || tr == null) return 0; if (msg == null) { saveLogs(tag, "debug info", tr); return Log.d(tag, "debug info", tr); } else { saveLogs(tag, msg, tr); return Log.d(tag, msg, tr); } } public static int i(String tag, String msg) { if (NO_LOG) return 0; if (tag == null || msg == null) return 0; saveLogs(tag, msg, null); return Log.i(tag, msg); } public static int i(String tag, String msg, Throwable tr) { if (NO_LOG) return 0; if (tag == null || tr == null) return 0; if (msg == null) { saveLogs(tag, "information info", tr); return Log.i(tag, "information info", tr); } else { saveLogs(tag, msg, tr); return Log.i(tag, msg, tr); } } public static int w(String tag, String msg) { if (NO_LOG) return 0; if (tag == null || msg == null) return 0; saveLogs(tag, msg, null); return Log.w(tag, msg); } public static int w(String tag, String msg, Throwable tr) { if (NO_LOG) return 0; if (tag == null || tr == null) return 0; if (msg == null) { saveLogs(tag, "wrong info", tr); return Log.w(tag, "wrong info", tr); } else { saveLogs(tag, msg, tr); return Log.w(tag, msg, tr); } } public static int e(String tag, String msg) { if (NO_LOG) return 0; if (tag == null || msg == null) return 0; saveLogs(tag, msg, null); return Log.e(tag, msg); } public static int e(String tag, String msg, Throwable tr) { if (NO_LOG) return 0; if (tag == null || tr == null) return 0; if (msg == null) { saveLogs(tag, "error info", tr); return Log.e(tag, "error info", tr); } else { saveLogs(tag, msg, tr); return Log.e(tag, msg, tr); } } protected static void saveLogs(String tag, String msg, Throwable tr) { StringBuilder sb = new StringBuilder(tag); sb.append(": "); sb.append(msg); sb.append("\n"); //Also save throwable string if tr is not null. if (tr != null) { String str = getStackTraceString(tr); sb.append(str); } //long t1 = System.currentTimeMillis(); internalLog(sb); //long t2 = System.currentTimeMillis(); //Log.i(LOG_TAG, "saveLogs():Cost of format log and save log is " + (t2 - t1) + " ms!"); } /** * Produce internal log format and save to SD card. * * @param msg */ private synchronized static void internalLog(StringBuilder msg) { //add time header String timeStamp = simpleDateFormat.format(new Date()); msg.insert(0, timeStamp); byte[] contentArray = msg.toString().getBytes(); int length = contentArray.length; int srcPos = 0; if (mPos == LOG_BUFFER_SIZE_MAX) { //Flush internal buffer flushInternalBuffer(); } if (length > buffer.length) { //Strongly flush the current buffer no matter whether it is full flushInternalBuffer(); //Flush all msg string to sd card while (length > buffer.length) { System.arraycopy(contentArray, srcPos, buffer, mPos, buffer.length); flushInternalBuffer(); length -= buffer.length; srcPos += buffer.length; } } else if (length == buffer.length) { flushInternalBuffer(); //Copy contents to buffer System.arraycopy(contentArray, 0, buffer, mPos, length); flushInternalBuffer(); length = 0; } if (length < buffer.length && length > 0) { if ((mPos + length) > buffer.length) { flushInternalBuffer(); //Copy contents to buffer System.arraycopy(contentArray, srcPos, buffer, mPos, length); mPos += length; } else if ((mPos + length) == buffer.length) { //Add content to buffer System.arraycopy(contentArray, srcPos, buffer, mPos, length); mPos += length; flushInternalBuffer(); } else { //Add content to buffer System.arraycopy(contentArray, srcPos, buffer, mPos, length); mPos += length; } } } /** * Flush internal buffer to SD card and then clear buffer to 0. */ private static void flushInternalBuffer() { //Strongly set the last byte to "0A"(new line) if (mPos < LOG_BUFFER_SIZE_MAX) { buffer[LOG_BUFFER_SIZE_MAX - 1] = 10; } long t1, t2; //Save buffer to SD card. t1 = System.currentTimeMillis(); writeToSDCard(); //calculate write file cost t2 = System.currentTimeMillis(); Log.i(LOG_TAG, "internalLog():Cost of write file to SD card is " + (t2 - t1) + " ms!"); //flush buffer. Arrays.fill(buffer, (byte) 0); mPos = 0; } /** * Flush buffer date to SD card. * <p> * This method is used ont only internal, but also used external. * UI developer should invoke this method explicitly to strongly flush buffer to SD card file * when the application is going to die, no matter whether the internal buffer is full {@link FLog#LOG_BUFFER_SIZE_MAX} . * </p> */ public static void writeToSDCard() { File logDir = new File(StorageUtil.getAbsoluteSdcardPath() + mLogPath); if (!logDir.exists()) { logDir.setWritable(true); boolean ret = logDir.mkdirs(); Log.i(LOG_TAG, "writeToSDCard(): create log dir: " + logDir.getAbsolutePath() + " " + ret); } if (!logDir.canWrite()) { logDir.setWritable(true); } //Find the last modified file File lastFile = getLastModifiedFile(logDir); //Write to last modified file writeToLastFile(logDir, lastFile); } /** * Flush logs in {@link FLog#buffer} to last modified file. * <p> * Write to last modified file directly if <code>buffer.length+lastFile.length()</code> * is smaller than {@link FLog#LOG_FILE_SIZE_MAX}. Otherwise it should create another new * file to flush buffer. * </p> * * @param logDir log file folder * @param lastFile last modified file */ private static void writeToLastFile(File logDir, File lastFile) { if (lastFile == null) { Log.e(LOG_TAG, "writeToLastFile(): File is null. lastFile= " + lastFile); } if ((buffer.length + lastFile.length()) > LOG_FILE_SIZE_MAX) { //New another file to flush buffer logs. File file = new File(logDir, fileNameFormat.format(new Date()) + ".txt"); lastFile = file; } String fileName = lastFile.getAbsolutePath(); Log.i(LOG_TAG, "writeToLastFile(): fileName = " + fileName); try { String bufferStr = new String(buffer, "UTF-8"); appendFileSdCardFile(fileName, bufferStr); } catch (UnsupportedEncodingException e) { Log.e(LOG_TAG, "writeToLastFile(): Change from byte[] to String failed!"); e.printStackTrace(); } } /** * Get last modified file in Log folder <code>logDir</code>. * * @param logDir Log folder * @return last modified file if exist. null if <code>logDir</code> is invalid. */ private static File getLastModifiedFile(File logDir) { File[] files = logDir.listFiles(); if (files == null) { Log.e(LOG_TAG, "getLastModifiedFile(): This file dir is invalid. logDir= " + logDir.getAbsolutePath()); return null; } //Create a new file if no file exists in this folder if (files.length == 0) { File file = new File(logDir, fileNameFormat.format(new Date()) + ".txt"); return file; } //Find the last modified file long lastModifiedTime = 0; File lastModifiedFile = null; for (File f : files) { if (lastModifiedTime <= f.lastModified()) { lastModifiedTime = f.lastModified(); lastModifiedFile = f; } } return lastModifiedFile; } /** * Write to a file <code>fileName</code> with content <code>writeStr</code>. * * @param fileName file name must be an absolute path name. * @param writeStr content to be written. */ public static void writeFileSdCardFile(String fileName, String writeStr) { FileOutputStream fout = null; try { fout = new FileOutputStream(fileName); byte[] bytes = writeStr.getBytes(); fout.write(bytes); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (fout != null) { try { fout.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * Append <code>content</code> to a SD card file. * * @param fileName a SD card file would be written. * @param content content want to be written. */ public static void appendFileSdCardFile(String fileName, String content) { FileWriter writer = null; try { //Open a file writer and write a file with appending format with "true". writer = new FileWriter(fileName, true); writer.write(content); } catch (IOException e) { e.printStackTrace(); } finally { try { if (writer != null) { writer.close(); } } catch (IOException e) { e.printStackTrace(); } } } }
[ "1062029783@qq.com" ]
1062029783@qq.com
c3b25ada1834a1c0b891b7ad29f15e49b9963dfe
72c1f6c17f1d9a4cd70e9d2e7979b42d30fc7eb1
/app/src/main/java/com/xzwzz/lady/pay/alipay/SignUtils.java
4f4abce49282df888429c2daeca9d519cc3e2380
[]
no_license
gaoyuan117/Lady
e8845334bd436ce7f9222dfa7d190c0fb68be303
39a8f21eecd4d928262f4f0d55df8a6fce1d0670
refs/heads/master
2020-03-28T12:29:02.158314
2018-09-27T10:44:15
2018-09-27T10:44:15
148,303,083
0
0
null
null
null
null
UTF-8
Java
false
false
957
java
package com.xzwzz.lady.pay.alipay; import java.security.KeyFactory; import java.security.PrivateKey; import java.security.spec.PKCS8EncodedKeySpec; public class SignUtils { private static final String ALGORITHM = "RSA"; private static final String SIGN_ALGORITHMS = "SHA1WithRSA"; private static final String DEFAULT_CHARSET = "UTF-8"; public static String sign(String content, String privateKey) { try { PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( Base64.decode(privateKey)); KeyFactory keyf = KeyFactory.getInstance(ALGORITHM); PrivateKey priKey = keyf.generatePrivate(priPKCS8); java.security.Signature signature = java.security.Signature .getInstance(SIGN_ALGORITHMS); signature.initSign(priKey); signature.update(content.getBytes(DEFAULT_CHARSET)); byte[] signed = signature.sign(); return Base64.encode(signed); } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "1179074755@qq.com" ]
1179074755@qq.com
a9a76fd66f3fb31598291cacb52b0b60aa32edec
a574aa1075ca863168aa5200bb3153baf9767662
/services/bsi-entities/src/main/java/com/bsi/common/beans/Service.java
f4bd59884107f6e44d24739216614f195a6d3621
[]
no_license
nmsgit1234/bsip
55652fd88d2c29fe8ccbb23895a834def37f6576
abbeb6d21f57c40c568900735a19316f4d80be94
refs/heads/master
2020-12-24T08:55:07.358768
2016-08-25T02:37:44
2016-08-25T02:37:44
42,491,522
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.bsi.common.beans; import java.util.HashSet; import java.util.Set; public class Service { private Long nodeId; private Long prntNodeId; private String name; private String description; private Set properties = new HashSet(); private Set persons = new HashSet(); public void setNodeId(Long nodeId) { this.nodeId = nodeId; } public Long getNodeId() { return nodeId; } public void setPrntNodeId(Long prntNodeId) { this.prntNodeId = prntNodeId; } public Long getPrntNodeId() { return prntNodeId; } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setDescription(String description) { this.description = description; } public String getDescription() { return description; } public void setProperties(Set properties) { this.properties = properties; } public Set getProperties() { return properties; } public void setPersons(Set persons) { this.persons = persons; } public Set getPersons() { return persons; } }
[ "anonymus@anonymus" ]
anonymus@anonymus
6a3d58e7dbb8cd811e8f75431a739c7500975436
f3d078fbe6b1009757284dd6496c633073c1aef4
/history/code/solutions/acmp_ru/solutions/_60_precalculated.java
2a37f8150d3b67a549e1655d3b1280860525faeb
[]
no_license
kabulov/code
7b944b394ad2d0289a0f62c4a5647370cdceba84
47021d99fabdc1558a0aee3196be83dad783801b
refs/heads/master
2020-04-05T07:28:31.037806
2015-05-06T16:18:41
2015-05-06T16:18:41
26,828,215
0
0
null
null
null
null
UTF-8
Java
false
false
11,653
java
import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.StreamTokenizer; public class Main { public static void main(String[] args) throws IOException { out = new PrintWriter("output.txt"); in = new StreamTokenizer(new FileReader("input.txt")); init(); out.println(vect[nextInt() - 1]); out.close(); } static int[] vect; static void init() { vect = new int[500]; vect[0] = 3; vect[1] = 5; vect[2] = 11; vect[3] = 17; vect[4] = 31; vect[5] = 41; vect[6] = 59; vect[7] = 67; vect[8] = 83; vect[9] = 109; vect[10] = 127; vect[11] = 157; vect[12] = 179; vect[13] = 191; vect[14] = 211; vect[15] = 241; vect[16] = 277; vect[17] = 283; vect[18] = 331; vect[19] = 353; vect[20] = 367; vect[21] = 401; vect[22] = 431; vect[23] = 461; vect[24] = 509; vect[25] = 547; vect[26] = 563; vect[27] = 587; vect[28] = 599; vect[29] = 617; vect[30] = 709; vect[31] = 739; vect[32] = 773; vect[33] = 797; vect[34] = 859; vect[35] = 877; vect[36] = 919; vect[37] = 967; vect[38] = 991; vect[39] = 1031; vect[40] = 1063; vect[41] = 1087; vect[42] = 1153; vect[43] = 1171; vect[44] = 1201; vect[45] = 1217; vect[46] = 1297; vect[47] = 1409; vect[48] = 1433; vect[49] = 1447; vect[50] = 1471; vect[51] = 1499; vect[52] = 1523; vect[53] = 1597; vect[54] = 1621; vect[55] = 1669; vect[56] = 1723; vect[57] = 1741; vect[58] = 1787; vect[59] = 1823; vect[60] = 1847; vect[61] = 1913; vect[62] = 2027; vect[63] = 2063; vect[64] = 2081; vect[65] = 2099; vect[66] = 2221; vect[67] = 2269; vect[68] = 2341; vect[69] = 2351; vect[70] = 2381; vect[71] = 2417; vect[72] = 2477; vect[73] = 2549; vect[74] = 2609; vect[75] = 2647; vect[76] = 2683; vect[77] = 2719; vect[78] = 2749; vect[79] = 2803; vect[80] = 2897; vect[81] = 2909; vect[82] = 3001; vect[83] = 3019; vect[84] = 3067; vect[85] = 3109; vect[86] = 3169; vect[87] = 3229; vect[88] = 3259; vect[89] = 3299; vect[90] = 3319; vect[91] = 3407; vect[92] = 3469; vect[93] = 3517; vect[94] = 3559; vect[95] = 3593; vect[96] = 3637; vect[97] = 3733; vect[98] = 3761; vect[99] = 3911; vect[100] = 3943; vect[101] = 4027; vect[102] = 4091; vect[103] = 4133; vect[104] = 4153; vect[105] = 4217; vect[106] = 4273; vect[107] = 4339; vect[108] = 4397; vect[109] = 4421; vect[110] = 4463; vect[111] = 4517; vect[112] = 4549; vect[113] = 4567; vect[114] = 4663; vect[115] = 4759; vect[116] = 4787; vect[117] = 4801; vect[118] = 4877; vect[119] = 4933; vect[120] = 4943; vect[121] = 5021; vect[122] = 5059; vect[123] = 5107; vect[124] = 5189; vect[125] = 5281; vect[126] = 5381; vect[127] = 5441; vect[128] = 5503; vect[129] = 5557; vect[130] = 5623; vect[131] = 5651; vect[132] = 5701; vect[133] = 5749; vect[134] = 5801; vect[135] = 5851; vect[136] = 5869; vect[137] = 6037; vect[138] = 6113; vect[139] = 6217; vect[140] = 6229; vect[141] = 6311; vect[142] = 6323; vect[143] = 6353; vect[144] = 6361; vect[145] = 6469; vect[146] = 6599; vect[147] = 6653; vect[148] = 6661; vect[149] = 6691; vect[150] = 6823; vect[151] = 6841; vect[152] = 6863; vect[153] = 6899; vect[154] = 7057; vect[155] = 7109; vect[156] = 7193; vect[157] = 7283; vect[158] = 7351; vect[159] = 7417; vect[160] = 7481; vect[161] = 7523; vect[162] = 7607; vect[163] = 7649; vect[164] = 7699; vect[165] = 7753; vect[166] = 7841; vect[167] = 7883; vect[168] = 8011; vect[169] = 8059; vect[170] = 8101; vect[171] = 8117; vect[172] = 8221; vect[173] = 8233; vect[174] = 8287; vect[175] = 8377; vect[176] = 8389; vect[177] = 8513; vect[178] = 8527; vect[179] = 8581; vect[180] = 8719; vect[181] = 8747; vect[182] = 8761; vect[183] = 8807; vect[184] = 8849; vect[185] = 8923; vect[186] = 8999; vect[187] = 9041; vect[188] = 9103; vect[189] = 9293; vect[190] = 9319; vect[191] = 9403; vect[192] = 9461; vect[193] = 9539; vect[194] = 9619; vect[195] = 9661; vect[196] = 9739; vect[197] = 9833; vect[198] = 9859; vect[199] = 9923; vect[200] = 9973; vect[201] = 10009; vect[202] = 10079; vect[203] = 10169; vect[204] = 10267; vect[205] = 10433; vect[206] = 10457; vect[207] = 10487; vect[208] = 10559; vect[209] = 10589; vect[210] = 10631; vect[211] = 10663; vect[212] = 10687; vect[213] = 10723; vect[214] = 10853; vect[215] = 10861; vect[216] = 10909; vect[217] = 11257; vect[218] = 11311; vect[219] = 11369; vect[220] = 11447; vect[221] = 11633; vect[222] = 11743; vect[223] = 11867; vect[224] = 11909; vect[225] = 11927; vect[226] = 11953; vect[227] = 12007; vect[228] = 12097; vect[229] = 12113; vect[230] = 12143; vect[231] = 12203; vect[232] = 12301; vect[233] = 12409; vect[234] = 12421; vect[235] = 12457; vect[236] = 12479; vect[237] = 12503; vect[238] = 12547; vect[239] = 12647; vect[240] = 12763; vect[241] = 12841; vect[242] = 12959; vect[243] = 13003; vect[244] = 13037; vect[245] = 13103; vect[246] = 13171; vect[247] = 13217; vect[248] = 13297; vect[249] = 13331; vect[250] = 13469; vect[251] = 13513; vect[252] = 13591; vect[253] = 13613; vect[254] = 13649; vect[255] = 13693; vect[256] = 13709; vect[257] = 13757; vect[258] = 13859; vect[259] = 14051; vect[260] = 14107; vect[261] = 14159; vect[262] = 14177; vect[263] = 14437; vect[264] = 14479; vect[265] = 14503; vect[266] = 14591; vect[267] = 14713; vect[268] = 14723; vect[269] = 14783; vect[270] = 14867; vect[271] = 14923; vect[272] = 14969; vect[273] = 15061; vect[274] = 15227; vect[275] = 15271; vect[276] = 15299; vect[277] = 15313; vect[278] = 15413; vect[279] = 15511; vect[280] = 15641; vect[281] = 15683; vect[282] = 15823; vect[283] = 15973; vect[284] = 16061; vect[285] = 16073; vect[286] = 16091; vect[287] = 16127; vect[288] = 16141; vect[289] = 16253; vect[290] = 16411; vect[291] = 16451; vect[292] = 16519; vect[293] = 16693; vect[294] = 16703; vect[295] = 16901; vect[296] = 16921; vect[297] = 17117; vect[298] = 17189; vect[299] = 17291; vect[300] = 17333; vect[301] = 17377; vect[302] = 17387; vect[303] = 17417; vect[304] = 17483; vect[305] = 17539; vect[306] = 17627; vect[307] = 17659; vect[308] = 17761; vect[309] = 17911; vect[310] = 17987; vect[311] = 18049; vect[312] = 18149; vect[313] = 18181; vect[314] = 18217; vect[315] = 18229; vect[316] = 18311; vect[317] = 18433; vect[318] = 18443; vect[319] = 18617; vect[320] = 18661; vect[321] = 18719; vect[322] = 18757; vect[323] = 18787; vect[324] = 18917; vect[325] = 19013; vect[326] = 19213; vect[327] = 19433; vect[328] = 19463; vect[329] = 19501; vect[330] = 19577; vect[331] = 19759; vect[332] = 19777; vect[333] = 19819; vect[334] = 19913; vect[335] = 20047; vect[336] = 20063; vect[337] = 20107; vect[338] = 20161; vect[339] = 20231; vect[340] = 20297; vect[341] = 20341; vect[342] = 20441; vect[343] = 20477; vect[344] = 20719; vect[345] = 20759; vect[346] = 20773; vect[347] = 20873; vect[348] = 20899; vect[349] = 20959; vect[350] = 21089; vect[351] = 21149; vect[352] = 21179; vect[353] = 21191; vect[354] = 21269; vect[355] = 21317; vect[356] = 21379; vect[357] = 21493; vect[358] = 21529; vect[359] = 21587; vect[360] = 21727; vect[361] = 21757; vect[362] = 21817; vect[363] = 21937; vect[364] = 22027; vect[365] = 22067; vect[366] = 22093; vect[367] = 22367; vect[368] = 22549; vect[369] = 22651; vect[370] = 22721; vect[371] = 22751; vect[372] = 22811; vect[373] = 22853; vect[374] = 22907; vect[375] = 23087; vect[376] = 23209; vect[377] = 23251; vect[378] = 23431; vect[379] = 23539; vect[380] = 23563; vect[381] = 23669; vect[382] = 23801; vect[383] = 23887; vect[384] = 23899; vect[385] = 23929; vect[386] = 24019; vect[387] = 24071; vect[388] = 24107; vect[389] = 24133; vect[390] = 24151; vect[391] = 24197; vect[392] = 24251; vect[393] = 24379; vect[394] = 24419; vect[395] = 24439; vect[396] = 24509; vect[397] = 24631; vect[398] = 24671; vect[399] = 24781; vect[400] = 24859; vect[401] = 24917; vect[402] = 25057; vect[403] = 25163; vect[404] = 25301; vect[405] = 25307; vect[406] = 25357; vect[407] = 25409; vect[408] = 25423; vect[409] = 25601; vect[410] = 25733; vect[411] = 25763; vect[412] = 25841; vect[413] = 25919; vect[414] = 25969; vect[415] = 26003; vect[416] = 26189; vect[417] = 26263; vect[418] = 26371; vect[419] = 26423; vect[420] = 26489; vect[421] = 26591; vect[422] = 26693; vect[423] = 26783; vect[424] = 26921; vect[425] = 26953; vect[426] = 27017; vect[427] = 27073; vect[428] = 27091; vect[429] = 27437; vect[430] = 27457; vect[431] = 27581; vect[432] = 27689; vect[433] = 27733; vect[434] = 27809; vect[435] = 27847; vect[436] = 27943; vect[437] = 28057; vect[438] = 28109; vect[439] = 28279; vect[440] = 28307; vect[441] = 28393; vect[442] = 28573; vect[443] = 28643; vect[444] = 28657; vect[445] = 28807; vect[446] = 29101; vect[447] = 29137; vect[448] = 29153; vect[449] = 29269; vect[450] = 29333; vect[451] = 29383; vect[452] = 29483; vect[453] = 29569; vect[454] = 29641; vect[455] = 29683; vect[456] = 29803; vect[457] = 30071; vect[458] = 30091; vect[459] = 30113; vect[460] = 30133; vect[461] = 30253; vect[462] = 30557; vect[463] = 30577; vect[464] = 30661; vect[465] = 30707; vect[466] = 30781; vect[467] = 30829; vect[468] = 30869; vect[469] = 30881; vect[470] = 31033; vect[471] = 31069; vect[472] = 31181; vect[473] = 31189; vect[474] = 31267; vect[475] = 31277; vect[476] = 31489; vect[477] = 31513; vect[478] = 31667; vect[479] = 31729; vect[480] = 32003; vect[481] = 32143; vect[482] = 32233; vect[483] = 32261; vect[484] = 32299; vect[485] = 32323; vect[486] = 32341; vect[487] = 32533; vect[488] = 32603; vect[489] = 32719; vect[490] = 32797; vect[491] = 32911; vect[492] = 32933; vect[493] = 32969; vect[494] = 33013; vect[495] = 33029; vect[496] = 33083; vect[497] = 33191; vect[498] = 33203; vect[499] = 33347; } static PrintWriter out; static StreamTokenizer in; static int nextInt() throws IOException { in.nextToken(); return (int)in.nval; } } /* boolean[] vect = new boolean[100001]; Arrays.fill(vect, true); for (int i = 2; i <= 50000; ++i) { for (int j = i; j + i <= 100000; j += i) { vect[j + i] = false; } } int len = 0; int[] prime = new int[50000]; for (int i = 2; i < 100001; i++) if (vect[i]) prime[len++] = i; for (int i = 0; i < 500; ++i) { out.println("vect[" + i + "] = " + prime[prime[i] - 1] + ";"); } */
[ "kazim.kabulov@gmail.com" ]
kazim.kabulov@gmail.com
9c2d8e9ce1ae4acf50da5b8229d43654b9f7dcdd
de253e9ebe39b43912c879f71206dfd934318c52
/microservices/services/filtering-service/src/main/java/org/xcolab/service/filtering/domain/filteredentry/FilteredEntryDao.java
a8173c3310372bd633d30a7234ddb2bf3ae213dc
[ "MIT" ]
permissive
carlosbpf/XCoLab
9d3a8432bf5a94fc24944d38a5c722823cae708c
eb68c86843eedf29e8e0c109b485e04a508b07f2
refs/heads/master
2021-01-19T10:06:33.281981
2017-02-18T17:18:03
2017-02-18T17:18:03
82,162,079
0
0
null
2017-02-16T09:16:18
2017-02-16T09:16:18
null
UTF-8
Java
false
false
648
java
package org.xcolab.service.filtering.domain.filteredentry; import org.xcolab.model.tables.pojos.FilteredEntry; import org.xcolab.service.filtering.exceptions.NotFoundException; import java.util.List; public interface FilteredEntryDao { FilteredEntry create(FilteredEntry memberContentEntry); boolean update(FilteredEntry filteredEntry); FilteredEntry get(Long memberContentEntryId) throws NotFoundException; List<FilteredEntry> getByStatus(Integer statusId); FilteredEntry getByAuthorAndSourceAndSourceId(Long authorId, Long sourceId, Long source); FilteredEntry getByUuid(String uuid) throws NotFoundException; }
[ "carlosbpf@gmail.com" ]
carlosbpf@gmail.com
d61f8d1aed3ed30d44aeee364b254eed7d13da75
105da5a97e8b6d8184ba17a2dc95cfa0a2176c7f
/app/src/main/java/com/application/kurukshetrauniversitypapers/PlaylistsAvailableActivity.java
df9ed8f12626dc98ffa547cc6569107e133b81aa
[]
no_license
avidraghav/Qsol
3f87f0eb879f94312315bf3ed10232326fb53cc7
0bfd1b7ad39f5f62b0fa6577f334b6231ff64da9
refs/heads/master
2023-06-01T13:25:30.112082
2021-06-20T10:39:06
2021-06-20T10:39:06
258,963,971
3
1
null
null
null
null
UTF-8
Java
false
false
3,464
java
package com.application.kurukshetrauniversitypapers; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import com.google.android.material.snackbar.Snackbar; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; import Adapters.PlaylistsAvailableAdapter; import utils.Videoinfo; public class PlaylistsAvailableActivity extends AppCompatActivity { ListView listView; List<Videoinfo> playlist_info; String directory; DatabaseReference databaseReference; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_playlists_available); listView=findViewById(R.id.playlists_available_listview); playlist_info = new ArrayList<>(); checkConnection(); Intent intent1=getIntent(); directory = intent1.getStringExtra("video_loc"); databaseReference= FirebaseDatabase.getInstance().getReference(directory); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { playlist_info.clear(); for(DataSnapshot playlistsnapshot: dataSnapshot.getChildren()){ Videoinfo playlistinfodata=playlistsnapshot.getValue(Videoinfo.class); playlist_info.add(playlistinfodata); } PlaylistsAvailableAdapter adapter= new PlaylistsAvailableAdapter(PlaylistsAvailableActivity.this,playlist_info); listView.setAdapter(adapter); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("info", databaseError+""); } }); listView.setOnItemClickListener((adapterView, view, position, l) -> { Videoinfo playlistinfodata=playlist_info.get(position); Log.e("info",playlistinfodata.getPlaylistid()); Intent intent=new Intent(PlaylistsAvailableActivity.this, VideosListActivity.class); intent.putExtra("PlaylistId",playlistinfodata.getPlaylistid()); startActivity(intent); }); } private void checkConnection() { ConnectivityManager manager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activenetwork = manager.getActiveNetworkInfo(); if (null != activenetwork) { if (activenetwork.getType() == ConnectivityManager.TYPE_MOBILE) { } } else { View view =findViewById(R.id.playlists_display_layout); Snackbar snackbar = Snackbar.make(view, "Kindly Enable Internet Connection To View Results", Snackbar.LENGTH_LONG); snackbar.setDuration(5000); snackbar.show(); } } }
[ "raghavaggarwal776@gmail.com" ]
raghavaggarwal776@gmail.com
103a7ef5dcf722730462c9fd0c14465b8ef25ca8
72036b45061f9de95c66ebc4e38e676c111eaad5
/analyzer/src/net/reduls/sanmoku/dic/WordDic.java
a6ac0cfbefd01b45cad899cc3ad6f322e26cda3b
[ "MIT", "NAIST-2003" ]
permissive
azuru/sanmoku
6ae6d2f569c03f0f8d922eae52c364fda1a3b3e6
f8f45c2b42264ecac63b2d87699094e34e22f17a
refs/heads/master
2021-01-18T03:32:07.717577
2011-11-06T21:21:53
2011-11-06T21:21:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package net.reduls.sanmoku.dic; import java.util.List; public final class WordDic { public static interface Callback { public void call(ViterbiNode vn); public boolean isEmpty(); } public static void search(String text, int start, Callback fn) { SurfaceId.eachCommonPrefix(text, start, fn); } public static void eachViterbiNode(Callback fn, int surfaceId, int start, int length, boolean isSpace) { final int i_start = Morpheme.morphemesBegin(surfaceId); final int i_end = Morpheme.morphemesEnd(surfaceId); for(int i=i_start; i < i_end; i++) fn.call(new ViterbiNode(start, (short)length, Morpheme.cost(i), Morpheme.posId(i), isSpace)); } }
[ "phjgt308@gmail.com" ]
phjgt308@gmail.com
a69bc003a4cd06da03fd83296c7e78167443b04d
55c6a63c22d4720df1be11838bbc418d35bf1f0e
/src/com/drai/eventosapp2/model/EventoObj.java
5ea8605dbdff659842cf9a3b1ad0a52d0c5c500b
[]
no_license
exteban34/EventosDrai
1e4d304edf59f7255aaa91f8bff3990fc663b4f2
3e89adb70197aa2a0a66b908551a8b249631d525
refs/heads/master
2021-01-02T22:39:04.954414
2015-10-19T14:21:20
2015-10-19T14:21:20
35,692,493
0
0
null
null
null
null
UTF-8
Java
false
false
2,232
java
package com.drai.eventosapp2.model; import java.io.Serializable; /** * Clase para el tranporte de datos de Eventos en el sistema * @author Heinner Esteban Alvarez Rivas <exteban34@gmail.com> * @version 1.0 21/05/2015 */ public class EventoObj implements Serializable { private String id; private String titulo; private String lugar; private String sitioWeb; private String fechaInicio; private String horaInicio; private String descripcion; private String fechaFinalizacion; private String horaFinalizacion; /** * Constructor de la clase EventoObj * @param id del evento * @param titulo del evento * @param fechaInicio del evento * @param horaInicio del evento */ public EventoObj(String id, String titulo, String fechaInicio, String horaInicio) { super(); this.id = id; this.titulo = titulo; this.fechaInicio = fechaInicio; this.horaInicio = horaInicio; } /** * Getters y Setters de los valores de la clase EventoObj * */ public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitulo() { return titulo; } public void setTitulo(String titulo) { this.titulo = titulo; } public String getLugar() { return lugar; } public void setLugar(String lugar) { this.lugar = lugar; } public String getSitioWeb() { return sitioWeb; } public void setSitioWeb(String sitioWeb) { this.sitioWeb = sitioWeb; } public String getFechaInicio() { return fechaInicio; } public void setFechaInicio(String fechaInicio) { this.fechaInicio = fechaInicio; } public String getHoraInicio() { return horaInicio; } public void setHoraInicio(String horaInicio) { this.horaInicio = horaInicio; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getFechaFinalizacion() { return fechaFinalizacion; } public void setFechaFinalizacion(String fechaFinalizacion) { this.fechaFinalizacion = fechaFinalizacion; } public String getHoraFinalizacion() { return horaFinalizacion; } public void setHoraFinalizacion(String horaFinalizacion) { this.horaFinalizacion = horaFinalizacion; } }
[ "exteban34@gmail.com" ]
exteban34@gmail.com
1287912ae52ee407ceb653732f493fa7683a0295
4b3bcd40888671ec6cf602586d639a7a4c6b28d0
/src/ObjectLibrary/Objects/Wall.java
7ad21d8d59a9120f2d2175f8638894568a72b124
[ "MIT" ]
permissive
IgnusG/project-awesome-game
c3b141472d29f4320ae0315535c9ecf7bf611e7c
0ab8669c67d8dd24d2594f72e4439d970bedd86a
refs/heads/master
2022-04-23T16:56:37.106165
2020-04-20T11:41:47
2020-04-20T11:46:59
257,262,252
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
/* * Autor: Jonatan Juhas - Informatik WS15 * Projekt: Objects */ package ObjectLibrary.Objects; import ObjectLibrary.Item; public class Wall extends Item { public Wall(){ super(Objects.WALL); } @Override public String toString(){ return "Wall"; } }
[ "IgnusG@users.noreply.github.com" ]
IgnusG@users.noreply.github.com
7bcf7206eda977567c25352d8d0b14352f5b6fc6
f66debe94a8d66db207c6ac9928f502c8061d5aa
/src/main/java/com/revolut/query/service/QueryService.java
74b0baa8ff276a7ee8762072741c5129f61a6d72
[]
no_license
dhawalschumi/Revolut
4297058b05b7a56015032e63fa30a5a444183018
f70ba918a05c9712d0799327faa6d9a4fa7ff143
refs/heads/master
2022-07-01T14:38:28.769697
2019-07-22T06:35:15
2019-07-22T06:35:15
197,375,095
0
0
null
2022-06-21T01:28:08
2019-07-17T11:20:14
Java
UTF-8
Java
false
false
557
java
/** * */ package com.revolut.query.service; import java.math.BigDecimal; import com.revolut.transfers.account.Account; import com.revolut.transfers.account.Balance; /** * @author Dhawal Patel * */ public interface QueryService { public Balance executeGetBalanceQuery(final long accountId) throws Exception; public void updateAccountBalance(final Account fromAccount, final Account toAccount, final BigDecimal amount) throws Exception; public Account executeGetAccountForCustomer(long customerId) throws Exception; }
[ "schum@LAPTOP-VOF4C0JC" ]
schum@LAPTOP-VOF4C0JC
b79e9f99a00260dd176b7fc3280b5e33a1206e58
c543956c5f0af9213715d295241cd242fffd1668
/src/main/java/route_planner/SingleSourceSolver.java
bb9073157d79a8d40e420e220a33057c50486e3f
[ "MIT" ]
permissive
yu-peng/temporal-spatial-filter
ab181be8a7b8681e629109700509043e5dd02e35
4deb796874d612ff2f063080bc2e52f0a2fa6179
refs/heads/master
2021-01-24T06:12:34.444707
2015-07-22T17:46:29
2015-07-22T17:46:29
39,149,145
0
0
null
null
null
null
UTF-8
Java
false
false
1,649
java
package route_planner; import java.util.concurrent.Callable; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; public class SingleSourceSolver implements Callable<JSONObject> { double originLat; double originLon; double destLat; double destLon; boolean returnPolyline; boolean returnInstruction; String mode; public SingleSourceSolver(double _originLat, double _originLon, double _destLat, double _destLon, boolean _returnPolyline, boolean _returnInstruction, String _mode){ originLat = _originLat; originLon = _originLon; destLat = _destLat; destLon = _destLon; returnPolyline = _returnPolyline; returnInstruction = _returnInstruction; mode = _mode; } public JSONObject call() throws JSONException{ return solve(); } public JSONObject solve() throws JSONException{ JSONObject result = new JSONObject(); // Record the initial parameters try { result.put("OriginLat",originLat); result.put("OriginLon",originLon); result.put("POILat",destLat); result.put("POILon",destLon); result.put("Mode",mode); } catch (JSONException e) { e.printStackTrace(); } Route route = Initialization.path_planner.getRoute(originLat,originLon,destLat,destLon,returnPolyline,returnInstruction,mode); if (route != null){ result.put("Status","Complete"); result.put("Route",Description.getRouteDescription(route)); } else { result.put("Status","Route generator error. No feasible route in any form of transportation can be found between your origin and destination."); } return result; } }
[ "ypbluesky@gmail.com" ]
ypbluesky@gmail.com
c93801054cafaa8377a431bcd9027565156a20f4
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a169/A169269Test.java
0664a693bd4593c8ca3639852050d930a7a20686
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package irvine.oeis.a169; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A169269Test extends AbstractSequenceTest { }
[ "sean.irvine@realtimegenomics.com" ]
sean.irvine@realtimegenomics.com
c096e7875f80b56359ed6102b628c5f3cf6c30f2
5941f48153e82ad5b69ffc9731a7570d439ff3a9
/src/ru/tasha2k7/mail/library/datamodel/Books.java
31bcf9805000601edf38d177852ef83c3392ec39
[]
no_license
TashaB1/Library
9a2291f6667e1e75a7920aa6c9b6c0c706e1628c
1cf7332286b6c90e6357b7eed6eba20b727e7ca6
refs/heads/master
2021-05-04T15:29:57.468750
2018-02-04T22:33:06
2018-02-04T22:33:06
120,230,027
0
1
null
null
null
null
UTF-8
Java
false
false
3,667
java
package ru.tasha2k7.mail.library.datamodel; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by Ната on 01.02.2018. */ public class Books extends AbstractModel { public enum Accessibility { reading_room, // читальный зал storage, // хранилище open_access // открытый доступ (срок) } public enum Branch { //??? Brest, Vitebsk, Gomel, Grodno, Minsk, Mogilev } private String title; private List<Author> author; @SerializedName("publishing_house") private String publishingHouse; private int year; @SerializedName("number_pages") private int numberPages; private List<Genre> genre; private Branch location; private Accessibility accessibility; private boolean available; private List<Journal> journal; public Books() { } public Books(String title, List<Author> author, String publishingHouse, int year, int numberPages, List<Genre> genre, Branch location, Accessibility accessibility, boolean available, List<Journal> journal) { this.title = title; this.author = author; this.publishingHouse = publishingHouse; this.year = year; this.numberPages = numberPages; this.genre = genre; this.location = location; this.accessibility = accessibility; this.available = available; this.journal = journal; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List<Author> getAuthor() { return author; } public void setAuthor(List<Author> author) { this.author = author; } public String getPublishingHouse() { return publishingHouse; } public void setPublishingHouse(String publishingHouse) { this.publishingHouse = publishingHouse; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getNumberPages() { return numberPages; } public void setNumberPages(int numberPages) { this.numberPages = numberPages; } public List<Genre> getGenre() { return genre; } public void setGenre(List<Genre> genre) { this.genre = genre; } public Branch getLocation() { return location; } public void setLocation(Branch location) { this.location = location; } public Accessibility getAccessibility() { return accessibility; } public void setAccessibility(Accessibility accessibility) { this.accessibility = accessibility; } public boolean isAvailable() { return available; } public void setAvailable(boolean available) { this.available = available; } public List<Journal> getJournal() { return journal; } public void setJournal(List<Journal> journal) { this.journal = journal; } @Override public String toString() { return "Books{" + "title='" + title + '\'' + ", author=" + author + ", publishingHouse='" + publishingHouse + '\'' + ", year=" + year + ", numberPages=" + numberPages + ", genre=" + genre + ", location=" + location + ", accessibility=" + accessibility + ", available=" + available + ", journal=" + journal + '}'; } }
[ "Tasha2k7@mail.ru" ]
Tasha2k7@mail.ru
4270e3bd776093917e06db5e34fea835705ffdeb
6ebe19081305cf4201e79f988009ac5f05eb9a68
/src/org/cakelab/oge/utils/ktx/KTX.java
3e4274e22f2c64584628b6f01a4c628ee5f68d1c
[]
no_license
homacs/org.cakelab.soapbox
ab6ee28f48e484b68e7ceb689383d5bddc7426e4
36f3190d949d8821281cac59e995fb27f9608886
refs/heads/master
2022-06-06T11:35:14.222582
2022-05-09T17:29:01
2022-05-09T17:29:01
204,141,155
0
0
null
null
null
null
UTF-8
Java
false
false
10,787
java
package org.cakelab.oge.utils.ktx; import static org.lwjgl.opengl.GL11.GL_NONE; import static org.lwjgl.opengl.GL11.GL_RED; import static org.lwjgl.opengl.GL11.GL_RGB; import static org.lwjgl.opengl.GL11.GL_RGBA; import static org.lwjgl.opengl.GL11.GL_TEXTURE_1D; import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; import static org.lwjgl.opengl.GL11.GL_UNPACK_ALIGNMENT; import static org.lwjgl.opengl.GL11.glBindTexture; import static org.lwjgl.opengl.GL11.glGenTextures; import static org.lwjgl.opengl.GL11.glPixelStorei; import static org.lwjgl.opengl.GL11.glTexSubImage1D; import static org.lwjgl.opengl.GL11.glTexSubImage2D; import static org.lwjgl.opengl.GL12.GL_BGR; import static org.lwjgl.opengl.GL12.GL_BGRA; import static org.lwjgl.opengl.GL12.GL_TEXTURE_3D; import static org.lwjgl.opengl.GL12.glTexSubImage3D; import static org.lwjgl.opengl.GL13.GL_TEXTURE_CUBE_MAP; import static org.lwjgl.opengl.GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X; import static org.lwjgl.opengl.GL30.GL_RG; import static org.lwjgl.opengl.GL30.GL_TEXTURE_1D_ARRAY; import static org.lwjgl.opengl.GL30.GL_TEXTURE_2D_ARRAY; import static org.lwjgl.opengl.GL30.glGenerateMipmap; import static org.lwjgl.opengl.GL40.GL_TEXTURE_CUBE_MAP_ARRAY; import static org.lwjgl.opengl.GL42.glTexStorage1D; import static org.lwjgl.opengl.GL42.glTexStorage2D; import static org.lwjgl.opengl.GL42.glTexStorage3D; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import org.cakelab.oge.texture.GPUTexture; import org.cakelab.oge.utils.BufferUtilsHelper; import org.cakelab.util.types.ArrayListByte; public class KTX { public static class Header { byte[] identifier = new byte[12]; // 12 byte int endianness; int gltype; int gltypesize; int glformat; int glinternalformat; int glbaseinternalformat; int pixelwidth; int pixelheight; int pixeldepth; int arrayelements; int faces; int miplevels; int keypairbytes; public boolean read(InputStream fp) throws IOException { DataInputStream in = new DataInputStream(fp); in.read(identifier); endianness = in.readInt(); gltype = in.readInt(); gltypesize = in.readInt(); glformat = in.readInt(); glinternalformat = in.readInt(); glbaseinternalformat = in.readInt(); pixelwidth = in.readInt(); pixelheight = in.readInt(); pixeldepth = in.readInt(); arrayelements = in.readInt(); faces = in.readInt(); miplevels = in.readInt(); keypairbytes = in.readInt(); return true; } } // union keyvaluepair // { // unsigned int size; // unsigned char rawbytes[4]; // }; static byte[] identifier = new byte[] { (byte) 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, (byte) 0xBB, 0x0D, 0x0A, 0x1A, 0x0A }; public static int swap32(int value) { int b1 = (value >> 0) & 0xff; int b2 = (value >> 8) & 0xff; int b3 = (value >> 16) & 0xff; int b4 = (value >> 24) & 0xff; return b1 << 24 | b2 << 16 | b3 << 8 | b4 << 0; } public static short swap(short value) { int b1 = value & 0xff; int b2 = (value >> 8) & 0xff; return (short) (b1 << 8 | b2 << 0); } public static int calculate_stride(Header h, int width) { int pad = 4; return calculate_stride(h, width, pad); } public static int calculate_stride(Header h, int width, int pad) { int channels = 0; switch (h.glbaseinternalformat) { case GL_RED: channels = 1; break; case GL_RG: channels = 2; break; case GL_BGR: case GL_RGB: channels = 3; break; case GL_BGRA: case GL_RGBA: channels = 4; break; } int stride = h.gltypesize * channels * width; stride = (stride + (pad - 1)) & ~(pad - 1); return stride; } public static int calculate_face_size(Header h) { int stride = calculate_stride(h, h.pixelwidth); return stride * h.pixelheight; } public static GPUTexture load(String filename) throws IOException { return load(filename, 0); } public static GPUTexture load(InputStream in) throws IOException { return load(in, 0); } public static GPUTexture load(String filename, int tex) throws IOException { return load(new FileInputStream(filename), tex); } public static GPUTexture load(InputStream fp, int tex) throws IOException { Header header = new Header(); byte[] data; int target = GL_NONE; if (!header.read(fp)) { fp.close(); throw new IOException("Failed reading header"); } if (!Arrays.equals(header.identifier, identifier)) { fp.close(); throw new IOException("Magic number test failed. File corrupted."); } if (header.endianness == 0x04030201) { // No swap needed } else if (header.endianness == 0x01020304) { // Swap needed header.endianness = swap32(header.endianness); header.gltype = swap32(header.gltype); header.gltypesize = swap32(header.gltypesize); header.glformat = swap32(header.glformat); header.glinternalformat = swap32(header.glinternalformat); header.glbaseinternalformat = swap32(header.glbaseinternalformat); header.pixelwidth = swap32(header.pixelwidth); header.pixelheight = swap32(header.pixelheight); header.pixeldepth = swap32(header.pixeldepth); header.arrayelements = swap32(header.arrayelements); header.faces = swap32(header.faces); header.miplevels = swap32(header.miplevels); header.keypairbytes = swap32(header.keypairbytes); } else { fp.close(); throw new IOException( "Couldn't identify endianess. File corrupted."); } // Guess target (texture type) if (header.pixelheight == 0) { if (header.arrayelements == 0) { target = GL_TEXTURE_1D; } else { target = GL_TEXTURE_1D_ARRAY; } } else if (header.pixeldepth == 0) { if (header.arrayelements == 0) { if (header.faces == 0) { target = GL_TEXTURE_2D; } else { target = GL_TEXTURE_CUBE_MAP; } } else { if (header.faces == 0) { target = GL_TEXTURE_2D_ARRAY; } else { target = GL_TEXTURE_CUBE_MAP_ARRAY; } } } else { target = GL_TEXTURE_3D; } // Check for insanity... if (target == GL_NONE || // Couldn't figure out target (header.pixelwidth == 0) || // Texture has no width??? (header.pixelheight == 0 && header.pixeldepth != 0)) // Texture // has // depth // but // no // height??? { fp.close(); throw new IOException("Failed reading header"); } if (tex == 0) { tex = glGenTextures(); } // // read all data in one buffer // ArrayListByte buffer = new ArrayListByte(1024); buffer.copy(fp); fp.close(); data = buffer.toArray(); if (header.miplevels == 0) { header.miplevels = 1; } glBindTexture(target, tex); switch (target) { case GL_TEXTURE_1D: glTexStorage1D(GL_TEXTURE_1D, header.miplevels, header.glinternalformat, header.pixelwidth); glTexSubImage1D(GL_TEXTURE_1D, 0, 0, header.pixelwidth, header.glformat, header.glinternalformat, BufferUtilsHelper.createByteBuffer(data)); break; case GL_TEXTURE_2D: glTexStorage2D(GL_TEXTURE_2D, header.miplevels, header.glinternalformat, header.pixelwidth, header.pixelheight); { int ptr = 0; int height = header.pixelheight; int width = header.pixelwidth; glPixelStorei(GL_UNPACK_ALIGNMENT, 1); for (int i = 0; i < header.miplevels; i++) { int stride_len = calculate_stride(header, width, 1); glTexSubImage2D(GL_TEXTURE_2D, i, 0, 0, width, height, header.glformat, header.gltype, BufferUtilsHelper.createByteBuffer(data, ptr, height*stride_len)); ptr += height * stride_len; height >>= 1; width >>= 1; if (height == 0) height = 1; if (width == 0) width = 1; } } break; case GL_TEXTURE_3D: glTexStorage3D(GL_TEXTURE_3D, header.miplevels, header.glinternalformat, header.pixelwidth, header.pixelheight, header.pixeldepth); glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, header.pixelwidth, header.pixelheight, header.pixeldepth, header.glformat, header.gltype, BufferUtilsHelper.createByteBuffer(data)); break; case GL_TEXTURE_1D_ARRAY: glTexStorage2D(GL_TEXTURE_1D_ARRAY, header.miplevels, header.glinternalformat, header.pixelwidth, header.arrayelements); glTexSubImage2D(GL_TEXTURE_1D_ARRAY, 0, 0, 0, header.pixelwidth, header.arrayelements, header.glformat, header.gltype, BufferUtilsHelper.createByteBuffer(data)); break; case GL_TEXTURE_2D_ARRAY: glTexStorage3D(GL_TEXTURE_2D_ARRAY, header.miplevels, header.glinternalformat, header.pixelwidth, header.pixelheight, header.arrayelements); glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, header.pixelwidth, header.pixelheight, header.arrayelements, header.glformat, header.gltype, BufferUtilsHelper.createByteBuffer(data)); break; case GL_TEXTURE_CUBE_MAP: glTexStorage2D(GL_TEXTURE_CUBE_MAP, header.miplevels, header.glinternalformat, header.pixelwidth, header.pixelheight); // glTexSubImage3D(GL_TEXTURE_CUBE_MAP, 0, 0, 0, 0, h.pixelwidth, // h.pixelheight, h.faces, h.glformat, h.gltype, data); { int face_size = calculate_face_size(header); for (int i = 0; i < header.faces; i++) { glTexSubImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, header.pixelwidth, header.pixelheight, header.glformat, header.gltype, BufferUtilsHelper.createByteBuffer(data, face_size * i, face_size)); } } break; case GL_TEXTURE_CUBE_MAP_ARRAY: glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, header.miplevels, header.glinternalformat, header.pixelwidth, header.pixelheight, header.arrayelements); glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, 0, header.pixelwidth, header.pixelheight, header.faces * header.arrayelements, header.glformat, header.gltype, BufferUtilsHelper.createByteBuffer(data)); break; default: // Should never happen throw new Error("Unknown texture target type"); } if (header.miplevels == 1) { glGenerateMipmap(target); } return new GPUTexture(target, tex); } // TOTO: remove? // boolean save(String filename, int target, int tex) // { // header h; // // memset(&h, 0, sizeof(h)); // memcpy(h.identifier, identifier, sizeof(identifier)); // h.endianness = 0x04030201; // // glBindTexture(target, tex); // // glGetTexLevelParameteriv(target, 0, GL_TEXTURE_WIDTH, (GLint // *)&h.pixelwidth); // glGetTexLevelParameteriv(target, 0, GL_TEXTURE_HEIGHT, (GLint // *)&h.pixelheight); // glGetTexLevelParameteriv(target, 0, GL_TEXTURE_DEPTH, (GLint // *)&h.pixeldepth); // // return true; // } }
[ "homac@strace.org" ]
homac@strace.org
acc2ddeaa6ef904fdd053afd719fa9a8b054a15e
8e2c9555f6ed0e03e339e805587600a61bc6d2a0
/java/347. Top K Frequent Elements.java
5e7702e09adebe316ffa3795089633e115678a16
[]
no_license
fei051466/leetcode
3d4e430c375d131180b2e99fc4d26a12e1058036
15811a27265a729978349f0a3e803bf5aadb98e8
refs/heads/master
2021-01-16T23:51:22.509775
2017-03-30T06:17:50
2017-03-30T06:17:50
59,805,985
2
0
null
null
null
null
UTF-8
Java
false
false
1,002
java
public class Solution { public List<Integer> topKFrequent(int[] nums, int k) { Map<Integer, Integer> my_map = new HashMap<Integer, Integer>(nums.length); List<Integer> res = new ArrayList<Integer>(); List<Integer>[] bucket = new List[nums.length+1]; for(int i=0; i<nums.length; i++){ if(my_map.containsKey(nums[i])){ my_map.put(nums[i], my_map.get(nums[i])+1); } else{ my_map.put(nums[i], 1); } } for(int key:my_map.keySet()){ int count = my_map.get(key); if(bucket[count] == null){ bucket[count] = new ArrayList<Integer>(); } bucket[count].add(key); } for(int i=bucket.length-1; i>=0; i--){ if(bucket[i] != null){ res.addAll(bucket[i]); } if(res.size() == k){ break; } } return res; } }
[ "295701757@qq.com" ]
295701757@qq.com
b131fd819ee1d21389f351bda2c2c5a3fa729df3
6c11c9f55ff0671ba9b896ec05a02a2ced63eb27
/JPACRUDApp/src/test/java/com/skilldistillery/jpacrud/entities/UserTest.java
baa59733f90f420a84e51e7177d76d79a9ce7152
[]
no_license
Alexwagner1990/JPACRUDProject
3e4486eb254c095600d393c3e996d2ac501e52b8
b26c6e3b383be8881778aa3e5b092b10000141b1
refs/heads/master
2020-03-11T21:58:22.359538
2018-04-25T15:36:53
2018-04-25T15:36:53
130,279,502
0
0
null
null
null
null
UTF-8
Java
false
false
2,186
java
package com.skilldistillery.jpacrud.entities; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; class UserTest { private EntityManagerFactory emf; private EntityManager em; private User user; @BeforeEach void setUp() throws Exception { emf = Persistence.createEntityManagerFactory("RestaurantPickerWebApp"); em = emf.createEntityManager(); user = new User(); user.setPassword("testing"); user.setUsername("tester"); } @AfterEach void tearDown() throws Exception { em.close(); emf.close(); } @Test @DisplayName("User Mapping") void test() { user = em.find(User.class, 2); assertEquals("test", user.getUsername()); assertEquals("tester", user.getPassword()); } @Test @DisplayName("User Adding") void testAdd() { String query = "select u from User u"; em.getTransaction().begin(); List<User> count = em.createQuery(query, User.class).getResultList(); int size = count.size(); em.persist(user); em.flush(); count = em.createQuery(query, User.class).getResultList(); int size2 = count.size(); assertEquals(size, (size2 - 1)); em.getTransaction().rollback(); } @Test @DisplayName("User Updating") void testUpdate() { em.getTransaction().begin(); user = em.find(User.class, 1); user.setUsername("Batman"); em.flush(); user = em.find(User.class, 1); assertEquals("Batman", user.getUsername()); em.getTransaction().rollback(); } @Test @DisplayName("User Deleting") void testDelete() { em.getTransaction().begin(); user = em.find(User.class, 1); em.remove(user); em.flush(); assertEquals(null, em.find(User.class, 1)); em.getTransaction().rollback(); } @Test @DisplayName("User Relationship with Restaurant") void testRestaurantRelationship() { em.getTransaction().begin(); assertEquals("alexwagner", em.find(Restaurant.class, 1).getUser().getUsername()); } }
[ "alexwagner1990@verizon.net" ]
alexwagner1990@verizon.net
7ff82360b158c0557aee74fa1bc9f5c86df3c68f
801c39e8bbeee2e25ed1ba2b74aa039f8b3d62ae
/fizteh-java-2014/src/ru/fizteh/fivt/students/ivan_ivanov/filemap/Get.java
26d512632d7f4c7e6e1b2a5098bd99fc66839b24
[]
no_license
grapefroot/mipt
2f6572b3120e28a0e63e28f2542782520384828f
51d13fa07b37bdbdda943bd47d7e356a3a126177
refs/heads/master
2020-12-24T21:12:03.706690
2016-11-08T07:40:20
2016-11-08T07:40:20
56,529,254
1
0
null
null
null
null
UTF-8
Java
false
false
702
java
package ru.fizteh.fivt.students.ivan_ivanov.filemap; import ru.fizteh.fivt.students.ivan_ivanov.shell.Shell; import ru.fizteh.fivt.students.ivan_ivanov.shell.Command; import java.io.IOException; public class Get implements Command { public final String getName() { return "get"; } public final void executeCmd(final Shell filemap, final String[] args) throws IOException { String key = args[0]; String value = ((FileMap) filemap).getFileMapState().getDataBase().get(key); if (value == null) { System.out.println("not found"); } else { System.out.println("found"); System.out.println(value); } } }
[ "salnikov.dmitri@gmail.com" ]
salnikov.dmitri@gmail.com
9fdd857c9981fd01b23f8e1ca85eb20b521d09df
d89f77bcbcd3474cbb038d79a407c912c6e00cf9
/src/main/java/com/tencentcloudapi/mongodb/v20190725/models/DescribeAsyncRequestInfoResponse.java
57dce0850c6bc014ed52de26d60c3a893b7d0259
[ "Apache-2.0" ]
permissive
victoryckl/tencentcloud-sdk-java
23e5486445d7e4316f85247b35a2e2ba69b92546
73a6e6632e0273cfdebd5487cc7ecff920c5e89c
refs/heads/master
2022-11-20T16:14:11.452984
2020-07-28T01:08:50
2020-07-28T01:08:50
283,146,154
0
1
Apache-2.0
2020-07-28T08:14:10
2020-07-28T08:14:09
null
UTF-8
Java
false
false
2,481
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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. */ package com.tencentcloudapi.mongodb.v20190725.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class DescribeAsyncRequestInfoResponse extends AbstractModel{ /** * 状态 */ @SerializedName("Status") @Expose private String Status; /** * 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ @SerializedName("RequestId") @Expose private String RequestId; /** * Get 状态 * @return Status 状态 */ public String getStatus() { return this.Status; } /** * Set 状态 * @param Status 状态 */ public void setStatus(String Status) { this.Status = Status; } /** * Get 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 * @return RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ public String getRequestId() { return this.RequestId; } /** * Set 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 * @param RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ public void setRequestId(String RequestId) { this.RequestId = RequestId; } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "Status", this.Status); this.setParamSimple(map, prefix + "RequestId", this.RequestId); } }
[ "tencentcloudapi@tenent.com" ]
tencentcloudapi@tenent.com
e7ba37ae28b2f6320ed9129b47feddf76a86f9f0
78a217e39f766b0595f0f339c479a86adcb754e1
/src/com/javarush/test/level04/lesson04/task09/Solution.java
96665446708e5cd61031084c97ec0e56b2a11f10
[]
no_license
Olegusplatypus/JavaRushHomeWork
af9785d88209291ba95bbf9ccc6a1d97f1b7bcb5
5b9b17d94be85d820a4b07b964dad51d293454a0
refs/heads/master
2020-12-25T14:22:55.066156
2016-08-02T11:27:42
2016-08-02T11:27:42
64,745,213
0
0
null
null
null
null
UTF-8
Java
false
false
1,867
java
package com.javarush.test.level04.lesson04.task09; /* Светофор Работа светофора для пешеходов запрограммирована следующим образом: в начале каждого часа в течение трех минут горит зеленый сигнал, затем в течение одной минуты — желтый, а потом в течение одной минуты — красный, затем опять зеленый горит три минуты и т. д. Ввести с клавиатуры вещественное число t, означающее время в минутах, прошедшее с начала очередного часа. Определить, сигнал какого цвета горит для пешеходов в этот момент. Результат вывести на экран в следующем виде: "зеленый" - если горит зеленый цвет, "желтый" - если горит желтый цвет, "красный" - если горит красный цвет. Пример для числа 2.5: зеленый Пример для числа 3: желтый Пример для числа 4: красный Пример для числа 5: зеленый */ import java.io.*; public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); double t = Double.parseDouble(reader.readLine()); //напишите тут ваш код if (t % 5 >= 0 && t % 5 < 3) System.out.println("зеленый"); else if (t % 5 >= 3 && t % 5 < 4) System.out.println("желтый"); else System.out.println("красный"); } }
[ "dovakinn@rambler.ru" ]
dovakinn@rambler.ru
6a9be8552febc3b9c15b46b93b5e8989bc4ac8b8
8cf2bf13e4b6ccc2d8ac78aacfb7a21466ae8244
/huifa-cnki-core/src/main/java/com/huifa/paper/parent/cnki/dao/common/ISystemTopicDao.java
d40e085ae5156bf51b6aca7c004dbfcd63adb95d
[]
no_license
kit-chen/huifa-paper-parent
2ac37b51e67b8a413679abcb422953f8e8a9af33
15dc6d7dcf903a016bc7cd7e76bc6edb691387ee
refs/heads/master
2020-06-10T22:37:41.719235
2016-12-07T16:40:00
2016-12-07T16:40:00
75,855,128
0
0
null
null
null
null
UTF-8
Java
false
false
859
java
package com.huifa.paper.parent.cnki.dao.common; import com.huifa.paper.parent.cnki.entity.common.SystemTopic; import com.huifa.paper.parent.cnki.vo.common.SystemTopicVo; import java.io.IOException; import java.io.Serializable; import java.util.List; import java.util.Map; /** * Created by kchen on 2016-12-03. */ public interface ISystemTopicDao { SystemTopicVo getById(Long id); List<SystemTopicVo> getBeforeOrAfter(Map<Serializable, Serializable> updateMap); SystemTopicVo createTopic(SystemTopic systemTopic) throws IOException; void updateTopic(Map<Serializable, Serializable> updateMap); void logicDelSysTopicById(Long id); void deleteSysTopicById(Long id); List<SystemTopicVo> getSysTopicByMap(Map<Serializable, Serializable> params); Integer getSysTopicCountByMap(Map<Serializable, Serializable> params); }
[ "cm_baije@163.com" ]
cm_baije@163.com
b3acbc45637f963755946e78d53f1f38d9c7ec07
0f43560c526c89ecc0596d4daa0fab45063c135c
/src/main/java/com/zjw/smallioc/aop/PointcutAdvisor.java
b4d56866d76f44e32ae3fe0bdd242e2eccadfcef
[]
no_license
XiaoXia001/small-spring
f6e7b2829f672799ae5ad854232641da433ab4bc
c6e5dda10a7a4cd15a059dc9cfdeb85959f26d6d
refs/heads/master
2021-07-06T15:52:06.105548
2019-08-20T12:21:59
2019-08-20T12:21:59
190,680,260
0
0
null
2020-10-13T13:44:30
2019-06-07T02:55:03
Java
UTF-8
Java
false
false
68
java
package com.zjw.smallioc.aop; public interface PointcutAdvisor { }
[ "391753186@qq.com" ]
391753186@qq.com
f368f80dceb63d2eed92302ec1e9942c39587009
a7f2ddc615fe0e66b06cafa386a2d16d3ea4cc85
/src/main/java/com/example/passwordkeeper/sevice/UserServiceImpl.java
9ff7bbb34aa9c7de891154006b54235343441931
[]
no_license
sonus2884/PasswordKeeper
e7f62320354303425f9d0fffbd2a1bd12cde7792
4b35febdd3937668376fcd5638d14fd9955daf89
refs/heads/master
2022-12-23T22:49:13.415407
2020-10-01T17:54:51
2020-10-01T17:54:51
290,804,451
0
0
null
2020-10-01T17:54:52
2020-08-27T14:55:45
Java
UTF-8
Java
false
false
1,599
java
package com.example.passwordkeeper.sevice; import com.example.passwordkeeper.dto.UserDto; import com.example.passwordkeeper.exception.UserExistsException; import com.example.passwordkeeper.exception.UserNotFoundException; import com.example.passwordkeeper.model.User; import com.example.passwordkeeper.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @Service public class UserServiceImpl implements UserService{ @Autowired private UserRepository userRepository; @Autowired private PasswordEncoder passwordEncoder; @Override public User createUser(UserDto userDto) { if (userRepository.findUserByEmail(userDto.getEmail()) != null){ throw new UserNotFoundException("User with \'" + userDto.getEmail()+ " \' email already exists"); } User user = new User(); user.setEmail(userDto.getEmail()); user.setPassword(passwordEncoder.encode(userDto.getPassword())); User savedUser = userRepository.save(user); return savedUser; } @Override public User findUser(UserDto userDto) { if (userRepository.findUserByEmail(userDto.getEmail()) == null){ throw new UserExistsException("User with \'" + userDto.getEmail()+ " \' email not exists"); } return userRepository.findUserByEmail(userDto.getEmail()); } }
[ "sonus2884@gmail.com" ]
sonus2884@gmail.com
c80e97ab4635813a83db26e51ba4bc6f6878f2fb
0da72d62107115bc7623726b67c10edfaf3921d7
/src/main/java/springfive/cms/domain/models/CMSObject.java
70d56a8308e603ba78d40bf7b9bdde8909c63845
[]
no_license
PrathameshBeri/NewsReviewSite
a0047703a5e792eff6f45f80873a6c1f5ab4a384
aa624eae83e95c6d9157ad40832875e41c68640b
refs/heads/master
2022-12-16T12:29:41.249976
2020-09-23T18:21:47
2020-09-23T18:21:47
289,999,204
0
0
null
2020-09-23T18:21:48
2020-08-24T17:50:42
Java
UTF-8
Java
false
false
283
java
package springfive.cms.domain.models; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import java.time.LocalDateTime; public class CMSObject { @Column LocalDateTime creationDate; @Column LocalDateTime modificationDate; }
[ "prathamesh_beri@protonmail.com" ]
prathamesh_beri@protonmail.com
ab027f8172967eb168aca11116f8883b754d0245
149f6a8e826ba749b1303acadfa9bdae1da871e2
/src/main/java/com/sise/controller/IndexController.java
2da2474cca2ec63851fc6a823bb65698d67d8426
[]
no_license
swyeah/decorationsystem
c596e1daa4b8759f2ca0ce4bbf4abdbe28bb5fa6
2443e3c2481567d963c51d29b954e19d245c015a
refs/heads/master
2020-03-22T01:19:27.289780
2018-07-01T03:36:40
2018-07-01T03:36:40
139,297,894
2
0
null
null
null
null
UTF-8
Java
false
false
25,578
java
package com.sise.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.google.gson.Gson; import com.sise.po.*; import com.sise.service.*; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpSession; import java.sql.Date; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping("/welcome") public class IndexController { @Autowired private ConsumerService consumerService; @Autowired private AreaTypeService areaTypeService; @Autowired private HouseTypeService houseTypeService; @Autowired private DecorationStyleService decorationStyleService; @Autowired private DesignerShowService designerShowService; @Autowired private EmployeeService employeeService; @Autowired private RegistrationTableService registrationTableService; @Autowired private HousepicService housepicService; @Autowired private DesignerpicService designerpicService; @Autowired private ContractService contractService; @Autowired private ProjectTimeService projectTimeService; @Autowired private InspectionReportService inspectionReportService; @RequestMapping("/index") public String goIndex(@RequestParam(value = "sname",defaultValue = "",required = false) String sname,@RequestParam(value = "houseId",defaultValue = "0",required = false) Integer houseId, @RequestParam(value = "styleId",defaultValue = "0",required = false) Integer styleId, @RequestParam(value = "areaId",defaultValue = "0",required = false) Integer areaId,Model model, @RequestParam(defaultValue = "1",required = false) Integer pageNum){ SearchDesignerShow searchContent =new SearchDesignerShow(); if (sname!=null) searchContent.setSname(sname); if (styleId !=null) searchContent.setStyleId(styleId); if (houseId !=null) searchContent.setHouseId(houseId); if(areaId!=null) searchContent.setAreaId(areaId); System.out.println(searchContent.toString()); PageHelper.startPage(pageNum, 8); List<DesignerShow> designerShows = designerShowService.searchDesignerToIndex(searchContent); for (DesignerShow d:designerShows){ Integer collectcount = designerShowService.getCountCollectionByShowId(d.getShowId()); Integer praisecount = designerShowService.getCountPraiseByShowId(d.getShowId()); d.setCollectCount(collectcount); d.setPraiseCount(praisecount); } PageInfo<DesignerShow> pageInfo = new PageInfo<DesignerShow>(designerShows); List<AreaType> areaTypes = areaTypeService.findAllAreaType(); List<HouseType> houseTypes = houseTypeService.findAllHousetype(); List<DecorationStyle> decorationStyles = decorationStyleService.searchAllDecorationStyle(); model.addAttribute("areaTypes",areaTypes); model.addAttribute("houseTypes",houseTypes); model.addAttribute("decorationStyles",decorationStyles); model.addAttribute("designerShows",designerShows); model.addAttribute("pageInfo",pageInfo); model.addAttribute("searchContent",searchContent); return "index"; } /*跳转到客户装修意向提交*/ @RequestMapping("/consumer_intention") public String GoConsumerIntention(Model model){ List<Province> provinces = consumerService.searchAllProvince(); model.addAttribute("provinces",provinces); return "consumer_control/consumer_intention"; } @RequestMapping(value = "/getcity",method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String getCity(@RequestBody String provinceId){ Gson gson = new Gson(); JSONObject jsonObject = JSONObject.fromObject(provinceId); String province = jsonObject.getString("provinceId"); List<City> cities = consumerService.searchCityByProvinceId(Integer.parseInt(province)); String result = gson.toJson(cities); return result; } @RequestMapping(value = "/setgood",method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String setgood(@RequestBody String showId){ JSONObject jsonObject1 = JSONObject.fromObject(showId); String msg = "";; Integer show = jsonObject1.getInt("showId"); Integer praiseMan = jsonObject1.getInt("praiseMan"); Praise praise = new Praise(praiseMan,show); JSONObject jsonObject2 = new JSONObject(); if (designerShowService.findPraiseByShowId(praise)){ jsonObject2.put("msg","已点赞过,不能再点!"); return jsonObject2.toString(); }else { designerShowService.savePraise(praise); msg = "1"; } jsonObject2.put("msg",msg); return jsonObject2.toString(); } @RequestMapping("/designershow") public String designershow(@RequestParam("showId") Integer showId,Model model){ DesignerShow designerShow = designerShowService.searchDesignerShowByShowId(showId); Integer collectcount = designerShowService.getCountCollectionByShowId(showId); Integer praisecount = designerShowService.getCountPraiseByShowId(showId); Employee employee = employeeService.searchEmployeeById(designerShow.getEmployeeId()); designerShow.setCollectCount(collectcount); designerShow.setPraiseCount(praisecount); model.addAttribute("designerShow",designerShow); model.addAttribute("employee",employee); return "consumer_control/index_designershow"; } @RequestMapping(value = "/setcollect",method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String setcollect(@RequestBody String showId){ JSONObject jsonObject1 = JSONObject.fromObject(showId); String msg = "";; Integer show = jsonObject1.getInt("showId"); Integer collectman = jsonObject1.getInt("collectman"); CollectionShow collectionShow = new CollectionShow(collectman,show); JSONObject jsonObject2 = new JSONObject(); if (designerShowService.findCollectByShowId(collectionShow)){ jsonObject2.put("msg","已收藏过,不能再点!"); return jsonObject2.toString(); }else { designerShowService.saveCollectionShow(collectionShow); msg = "1"; } jsonObject2.put("msg",msg); return jsonObject2.toString(); } @RequestMapping("/index_register") public String index_register(Model model){ List<Province> provinces = consumerService.searchAllProvince(); model.addAttribute("provinces",provinces); return "consumer_control/index_register"; } @RequestMapping(value = "/doregistration" ,method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String doregistration(@RequestBody RegistrationTable registrationTable){ registrationTable.setRegistrationTime(new Date(System.currentTimeMillis())); System.out.println(registrationTable); Integer column = registrationTableService.saveRegistration(registrationTable); JSONObject jsonObject = new JSONObject(); jsonObject.put("result","true"); return jsonObject.toString(); } /*返回指定设计师数据*/ @RequestMapping(value = "/getDesigner" ,method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String getDesigner(@RequestBody String requestdata){ JSONObject jsonObject = JSONObject.fromObject(requestdata); Integer pageNum = Integer.parseInt(jsonObject.getString("pageNum")); String search =jsonObject.getString("search"); List list = new ArrayList(); if (search.equals("")){ List<Employee> employees = new ArrayList<Employee>(); PageHelper.startPage(pageNum, 5); employees = employeeService.searchAllDesigner(); PageInfo<Employee> pageInfo = new PageInfo<Employee>(employees); list.add(pageInfo); list.add(employees); }else { List<Employee> employees = new ArrayList<Employee>(); PageHelper.startPage(pageNum, 5); employees= employeeService.searchEmployBySearch(search); PageInfo<Employee> pageInfo = new PageInfo<Employee>(employees); list.add(pageInfo); list.add(employees); } Gson gson = new Gson(); String result = gson.toJson(list); return result; } @RequestMapping("/myproject") public String myproject(HttpSession session,Model model,@RequestParam(defaultValue = "1",required = false) Integer pageNum){ Consumer consumer =(Consumer) session.getAttribute("consumer"); if (consumer!=null){ String userName = consumer.getUserName(); PageHelper.startPage(pageNum, 3); List<RegistrationTable> registrationTables =registrationTableService.searchRegistrationByUserName(userName); PageInfo<RegistrationTable> pageInfo = new PageInfo<RegistrationTable>(registrationTables); model.addAttribute("resultStatus","1"); model.addAttribute("registrationTables",registrationTables); model.addAttribute("pageInfo",pageInfo); }else { model.addAttribute("resultStatus","0"); } return "consumer_control/myproject"; } @RequestMapping("/housepic") public String housepic(@RequestParam("registrationId") Integer registrationId, Model model,HttpSession session){ Consumer consumer =(Consumer) session.getAttribute("consumer"); RegistrationTable registrationTable = registrationTableService.searchRegistrationById(registrationId); if (consumer!=null&registrationTable!=null){ if (consumer.getUserName().equals(registrationTable.getUserName())){ Housepic housepic = housepicService.findHousepicByRegistrationId(registrationId); if (housepic == null) { model.addAttribute("resultStatus", "false"); } else { List<HousepicFile> housepicFiles = housepicService.findHousepicFileByHousepicId(housepic.getHousepicId()); model.addAttribute("housepic", housepic); model.addAttribute("housepicFiles", housepicFiles); model.addAttribute("registrationId", registrationId); model.addAttribute("resultStatus", "true"); } } } model.addAttribute("registrationId", registrationId); return "consumer_control/index_housepic"; } @RequestMapping(value = "/setStatus",method =RequestMethod.POST,produces = "text/html;charset=UTF-8" ) @ResponseBody public String setStatus(@RequestBody String str){ JSONObject jsonObject1 = JSONObject.fromObject(str); Integer housepicId = jsonObject1.getInt("housepicId"); String userName = jsonObject1.getString("userName"); Integer version = jsonObject1.getInt("version"); JSONObject jsonObject2 = new JSONObject(); String msg=""; Integer column = 0; if (version>=housepicService.searchVersionById(housepicId)){ if (registrationTableService.compareHousepicAndConusmer(userName,housepicId)){ column = housepicService.changeStatusById(housepicId,3); }else { msg="无法访问别的客户信息!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } }else { msg="数据已被刷新,请重新访问!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } if (column==1){ jsonObject2.put("msg","确认成功!"); }else{ jsonObject2.put("msg","确认失败!"); } return jsonObject2.toString(); } @RequestMapping(value = "/setStatusFalse" ,method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String setStatusFalse(@RequestBody String str){ JSONObject jsonObject1 = JSONObject.fromObject(str); Integer housepicId = jsonObject1.getInt("housepicId"); String userName = jsonObject1.getString("userName"); Integer version = jsonObject1.getInt("version"); JSONObject jsonObject2 = new JSONObject(); String msg=""; Integer column = 0; if (version>=housepicService.searchVersionById(housepicId)){ if (registrationTableService.compareHousepicAndConusmer(userName,housepicId)){ column = housepicService.changeStatusById(housepicId,2); }else { msg="无法访问别的客户信息!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } }else { msg="数据已被刷新,请重新访问!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } if (column==1){ msg = "确认户型图错误待修改!"; }else{ msg = "请刷新界面,重新确认!"; } jsonObject2.put("msg",msg); return jsonObject2.toString(); } @RequestMapping("/designerpic") public String designer(@RequestParam("registrationId") Integer registrationId, Model model,HttpSession session){ Consumer consumer =(Consumer) session.getAttribute("consumer"); RegistrationTable registrationTable = registrationTableService.searchRegistrationById(registrationId); if (consumer!=null&registrationTable!=null){ if (consumer.getUserName().equals(registrationTable.getUserName())){ Designerpic designerpic = designerpicService.searchDesignerpicByRegistrationId(registrationId); if (designerpic == null) { model.addAttribute("resultStatus", "false"); } else { List<DesignerpicFile> designerpicFiles = designerpicService.searchAllDesignerpicFileByDesignerId(designerpic.getDesignerpicId()); model.addAttribute("designerpic", designerpic); model.addAttribute("designerpicFiles", designerpicFiles); model.addAttribute("resultStatus", "true"); } } } model.addAttribute("registrationId", registrationId); return "consumer_control/index_designerpic"; } @RequestMapping(value = "/setdesignerpicStatus",method =RequestMethod.POST,produces = "text/html;charset=UTF-8" ) @ResponseBody public String setdesignerpicStatus(@RequestBody String str,HttpSession session){ JSONObject jsonObject1 = JSONObject.fromObject(str); Integer designerpicId = jsonObject1.getInt("designerpicId"); Consumer consumer =(Consumer) session.getAttribute("consumer"); Integer version = jsonObject1.getInt("version"); JSONObject jsonObject2 = new JSONObject(); String msg=""; Integer column = 0; if (version>=designerpicService.searchVersionByDesignerpicId(designerpicId)){ if (consumer!=null && registrationTableService.compareDesignerpicAndConusmer(consumer.getUserName(),designerpicId)){ column = designerpicService.changeStatusByDesignerpicId(designerpicId,3); }else { msg="无法访问别的客户信息!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } }else { msg="数据已被刷新,请重新访问!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } if (column==1){ jsonObject2.put("msg","同意成功!"); }else{ jsonObject2.put("msg","同意失败!"); } return jsonObject2.toString(); } @RequestMapping(value = "/setdesignerpicStatusFalse" ,method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String setdesignerpicStatusFalse(@RequestBody String str,HttpSession session){ JSONObject jsonObject1 = JSONObject.fromObject(str); Integer designerpicId = jsonObject1.getInt("designerpicId"); Consumer consumer =(Consumer) session.getAttribute("consumer"); Integer version = jsonObject1.getInt("version"); JSONObject jsonObject2 = new JSONObject(); String msg=""; Integer column = 0; if (version>=designerpicService.searchVersionByDesignerpicId(designerpicId)){ if (consumer!=null && registrationTableService.compareDesignerpicAndConusmer(consumer.getUserName(),designerpicId)){ column = designerpicService.changeStatusByDesignerpicId(designerpicId,2); }else { msg="无法访问别的客户信息!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } }else { msg="数据已被刷新,请重新访问!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } if (column==1){ msg = "操作成功!"; }else{ msg = "请刷新界面,重新确认!"; } jsonObject2.put("msg",msg); return jsonObject2.toString(); } @RequestMapping("/contract") public String contract(@RequestParam("registrationId") Integer registrationId, Model model,HttpSession session){ Consumer consumer =(Consumer) session.getAttribute("consumer"); RegistrationTable registrationTable = registrationTableService.searchRegistrationById(registrationId); if (consumer!=null&registrationTable!=null){ if (consumer.getUserName().equals(registrationTable.getUserName())){ Contract contract = contractService.findContractByRegistrationId(registrationId); if (contract == null) { model.addAttribute("resultStatus", "false"); } else { List<ContractFile> contractFiles = contractService.findContractFileByContractId(contract.getContractId()); model.addAttribute("contract", contract); model.addAttribute("contractFiles", contractFiles); model.addAttribute("resultStatus", "true"); } } } model.addAttribute("registrationId", registrationId); return "consumer_control/index_contract"; } @RequestMapping(value = "/setcontractStatus",method =RequestMethod.POST,produces = "text/html;charset=UTF-8" ) @ResponseBody public String setcontractStatus(@RequestBody String str,HttpSession session){ JSONObject jsonObject1 = JSONObject.fromObject(str); Integer contractId = jsonObject1.getInt("contractId"); Consumer consumer =(Consumer) session.getAttribute("consumer"); Integer version = jsonObject1.getInt("version"); JSONObject jsonObject2 = new JSONObject(); String msg=""; Integer column = 0; if (version>=contractService.searchVersionById(contractId)){ if (consumer!=null && registrationTableService.compareContractAndConusmer(consumer.getUserName(),contractId)){ column = contractService.changeStatusById(contractId,5); }else { msg="无法访问别的客户信息!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } }else { msg="数据已被刷新,请重新访问!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } if (column==1){ jsonObject2.put("msg","同意成功!"); }else{ jsonObject2.put("msg","同意失败!"); } return jsonObject2.toString(); } @RequestMapping(value = "/setcontractStatusFalse" ,method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String setcontractStatusFalse(@RequestBody String str,HttpSession session){ JSONObject jsonObject1 = JSONObject.fromObject(str); Integer contractId = jsonObject1.getInt("contractId"); Consumer consumer =(Consumer) session.getAttribute("consumer"); Integer version = jsonObject1.getInt("version"); JSONObject jsonObject2 = new JSONObject(); String msg=""; Integer column = 0; if (version>=contractService.searchVersionById(contractId)){ if (consumer!=null && registrationTableService.compareContractAndConusmer(consumer.getUserName(),contractId)){ column = contractService.changeStatusById(contractId,4); }else { msg="无法访问别的客户信息!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } }else { msg="数据已被刷新,请重新访问!"; jsonObject2.put("msg",msg); return jsonObject2.toString(); } if (column==1){ msg = "操作成功!"; }else{ msg = "请刷新界面,重新确认!"; } jsonObject2.put("msg",msg); return jsonObject2.toString(); } @RequestMapping("/project_time") public String project_time(@RequestParam("registrationId") Integer registrationId,@RequestParam(value = "startTime",defaultValue = "",required = false) String startTime,@RequestParam(value = "endTime",defaultValue = "",required = false) String endTime, Model model,@RequestParam(defaultValue = "1",required = false) Integer pageNum){ Map<String ,Object> map = new HashMap<String ,Object>(); if (startTime!="") map.put("startTime",startTime); if (endTime!="") map.put("endTime",endTime); map.put("registrationId",registrationId); PageHelper.startPage(pageNum, 30); List<ProjectTime> projectTimes =projectTimeService.searchProjectTimeBySearch(map); PageInfo<ProjectTime> pageInfo = new PageInfo<ProjectTime>(projectTimes); model.addAttribute("projectTimes",projectTimes); model.addAttribute("pageInfo",pageInfo); model.addAttribute("map",map); return "consumer_control/index_project_time"; } @RequestMapping("/progressContent") public String progressContent(@RequestParam(value = "progressId",required = false) Integer progressId,@RequestParam(value = "projectId" ) Integer projectId,Model model){ List<ProgressContent> progressContents = new ArrayList<ProgressContent>(); if (projectId!=null){ progressContents = projectTimeService.searchAllProgressContentTitleByProjectId(projectId); } ProgressContent progressContent = null; ProjectTime projectTime=null; if (progressContents.size()>0){ if (progressId==null){ progressId = progressContents.get(0).getProgressId(); } projectTime = projectTimeService.searchProjectTimeByProjectId(projectId); progressContent = projectTimeService.searchProgressContentByProgressId(progressId); } model.addAttribute("projectId",projectId); model.addAttribute("projectTime",projectTime); model.addAttribute("progressContents",progressContents); model.addAttribute("progressContent",progressContent); return "consumer_control/index_progress_content"; } @RequestMapping("/inspection_report") public String inspection_report(@RequestParam("registrationId")Integer registrationId, Model model){ if (registrationId!=null){ InspectionReport inspectionReport = inspectionReportService.searchInspectionReportByRegistrationId(registrationId); if (inspectionReport!=null){ List<InspectionReportPic> inspectionReportPics = inspectionReportService.searchInspectionReportpicByReportId(inspectionReport.getReportId()); model.addAttribute("resultStatus","1"); model.addAttribute("inspectionReport",inspectionReport); model.addAttribute("inspectionReportPics",inspectionReportPics); }else { model.addAttribute("resultStatus",0); } } model.addAttribute("registrationId",registrationId); return "consumer_control/index_inspection_report"; } @RequestMapping(value = "/logout" ,method = RequestMethod.POST,produces = "text/html;charset=UTF-8") @ResponseBody public String logout(HttpSession session){ session.removeAttribute("consumer"); session.removeAttribute("name"); JSONObject jsonObject = new JSONObject(); jsonObject.put("msg","退出成功!"); return jsonObject.toString(); } }
[ "603112577@qq.com" ]
603112577@qq.com
5542fd8f6d8b01800d87c8c6e44dc9962f5f7845
14c69415beaaad2f75a92aae2929da27cbf60887
/e-SToPP/app/src/androidTest/java/com/shamsed/e_stopp/ExampleInstrumentedTest.java
64fd7ab0fd8033e9f39de9c0f1de2e42681deae9
[]
no_license
FIU-SCIS-Senior-Projects/Social-APP-Ver-1.0
860fd13aa6c1811a351f3cbf0e43d8fe09c40b9f
c81459e6a5fdda80e53ad9eb7e566322421af578
refs/heads/master
2020-12-06T19:00:50.831734
2016-12-05T21:40:49
2016-12-05T21:40:49
67,468,216
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.shamsed.e_stopp; 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.*; /** * Instrumentation 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.shamsed.e_stopp", appContext.getPackageName()); } }
[ "ssing091@fiu.edu" ]
ssing091@fiu.edu
07b234886056a04e39f12d67ee9f5d080dec4912
20c1a4ac8405886fd26e6778f37c02df88ae268d
/src/main/java/asia/redact/bracket/properties/RandomAccessFileOutputAdapter.java
e75e9c89c89283fc4c65babe45a3458e7b146ea1
[ "Apache-2.0" ]
permissive
buttermilk-crypto/bracket
413cd3121ff216df5b58569da587ac4881d43d9b
8fb4e734af8c152afed5745a12e645548f799b99
refs/heads/master
2021-01-17T14:30:42.058871
2018-05-21T06:09:38
2018-05-21T06:09:38
55,750,302
1
0
null
null
null
null
UTF-8
Java
false
false
1,381
java
/* * This file is part of Buttermilk(TM) * Copyright 2013-2014 David R. Smith for cryptoregistry.com * */ package asia.redact.bracket.properties; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Set; import java.util.Map.Entry; import asia.redact.bracket.properties.OutputFormat; import asia.redact.bracket.properties.Properties; import asia.redact.bracket.properties.ValueModel; /** * Joins an OutputFormatter with a file to output. RandomAccessFiles can handle * file locking semantics for example if the data is being written to a file share * (shared file system) * * @author Dave * */ public class RandomAccessFileOutputAdapter { Properties props; public RandomAccessFileOutputAdapter(Properties props) { super(); this.props = props; } /** * Write it out. The file must be closed externally * */ public void writeTo(RandomAccessFile file, OutputFormat format) throws IOException { Set<Entry<String,ValueModel>> set = props.getPropertyMap().entrySet(); file.writeChars(format.formatHeader()); for(Entry<String,ValueModel> e: set) { String key = e.getKey(); ValueModel model = e.getValue(); file.writeBytes(format.format(key, model.getSeparator(),model.getValues(),model.getComments())); } file.writeBytes(format.formatFooter()); } }
[ "Dave@a12e1f22-4431-4adc-8947-0a92dc9a4dba" ]
Dave@a12e1f22-4431-4adc-8947-0a92dc9a4dba
5a03a59d9fa988068a2401be8ba1b30e464b1bbb
82b341cb79ab5413492dba167b0004f3e0826651
/src/main/java/com/company/service/CitiesService.java
b1a9062a3b868c437d6454acb1875c3ade917fb3
[]
no_license
musanabiyev/bankAPI
6faceeccd33954cbe705215b653cd33091b32d5d
cc61dc6c7904dfcf28547f3142d6bf9a4fe11ec8
refs/heads/main
2023-08-01T22:41:52.544642
2021-09-16T14:46:36
2021-09-16T14:46:36
405,349,739
1
0
null
null
null
null
UTF-8
Java
false
false
1,246
java
package com.company.service; import com.company.model.Cities; import com.company.repository.CitiesRepository; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collection; import java.util.List; @Service public class CitiesService { private final CitiesRepository citiesRepository; public CitiesService(CitiesRepository citiesRepository) { this.citiesRepository = citiesRepository; } public List<Cities> getAllCities() { return new ArrayList<Cities>((Collection<? extends Cities>) citiesRepository.findAll()); } public Cities getCitiesById(Long id) { return citiesRepository.findById(id).orElseThrow(() -> new RuntimeException("Couldnt find city by id: " + id)); } public Cities createCities(Cities cities){ return citiesRepository.save(cities); } public Cities updateCities(Long id, Cities cities){ Cities oldCity = getCitiesById(id); oldCity.setName(cities.getName()); oldCity.setPlateCode(cities.getPlateCode()); return citiesRepository.save(oldCity); } public void deleteCities(Long id){ Cities city = getCitiesById(id); citiesRepository.delete(city); } }
[ "musa416n@gmail.com" ]
musa416n@gmail.com
9f400ca575d14ed9f106a0bfcac446163bf6f98f
fff8f77f810bbd5fb6b4e5f7a654568fd9d3098d
/src/main/java/com/google/android/gms/internal/fitness/zzev.java
dbf8e21beb82671e8dc4d0e9fdff814b37f6ed64
[]
no_license
TL148/gorkiy
b6ac8772587e9e643d939ea399bf5e7a42e89f46
da8fbd017277cf72020c8c800326954bb1a0cee3
refs/heads/master
2021-05-21T08:24:39.286900
2020-04-03T02:57:49
2020-04-03T02:57:49
252,618,229
0
0
null
2020-04-03T02:54:39
2020-04-03T02:54:39
null
UTF-8
Java
false
false
1,201
java
package com.google.android.gms.internal.fitness; import android.os.Parcel; import android.os.Parcelable; import com.google.android.gms.common.internal.safeparcel.SafeParcelReader; import com.google.android.gms.fitness.data.DataSource; /* compiled from: com.google.android.gms:play-services-fitness@@18.0.0 */ public final class zzev implements Parcelable.Creator<zzes> { public final /* synthetic */ Object[] newArray(int i) { return new zzes[i]; } public final /* synthetic */ Object createFromParcel(Parcel parcel) { int validateObjectHeader = SafeParcelReader.validateObjectHeader(parcel); DataSource dataSource = null; while (parcel.dataPosition() < validateObjectHeader) { int readHeader = SafeParcelReader.readHeader(parcel); if (SafeParcelReader.getFieldId(readHeader) != 1) { SafeParcelReader.skipUnknownField(parcel, readHeader); } else { dataSource = (DataSource) SafeParcelReader.createParcelable(parcel, readHeader, DataSource.CREATOR); } } SafeParcelReader.ensureAtEnd(parcel, validateObjectHeader); return new zzes(dataSource); } }
[ "itaysontesterlab@gmail.com" ]
itaysontesterlab@gmail.com
4ea2168c8778ac138d5ac3eed288466a12922ef1
f26dbcfeb28f04722cefe17480d97ff52945f716
/app/src/main/java/com/sp/parcial_1/AgregarAlimento.java
c12f9234b0fbd26886b0bf555f96f0d48b8ceaeb
[]
no_license
santipineda26/Parcial_1
78d785d130ad04e4b1e655c337faec0804834fbf
38b726e7854beb6ad53eb5faadeef6f6acfc1c87
refs/heads/master
2023-03-29T18:43:28.525737
2021-04-09T04:00:04
2021-04-09T04:00:04
356,128,384
0
0
null
null
null
null
UTF-8
Java
false
false
3,792
java
package com.sp.parcial_1; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.ib.custom.toast.CustomToastView; import java.util.ArrayList; import Clases.Producto; import static java.lang.Integer.parseInt; public class AgregarAlimento extends AppCompatActivity implements View.OnClickListener { Producto producto = new Producto(); public static ArrayList<Producto> productos = new ArrayList(); private Button btnAgregar; private Button btnInicio; private EditText txtNombre; private EditText txtCodigo; private EditText txtValor; private EditText txtIva; private EditText txtDescripcion; private EditText txtCategoria; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_agregar_alimento); btnAgregar = findViewById(R.id.btnAgregar); btnInicio = findViewById(R.id.btnInicio); txtNombre = findViewById(R.id.txtNombre); txtCodigo = findViewById(R.id.txtCodigo); txtValor = findViewById(R.id.txtValor); txtIva = findViewById(R.id.txtIva); txtDescripcion = findViewById(R.id.txtDescripcion); txtCategoria = findViewById(R.id.txtCategoria); btnInicio.setOnClickListener(this); btnAgregar.setOnClickListener(this); } @Override public void onClick(View v) { if (v.getId() == R.id.btnAgregar) { String nombre = txtNombre.getText().toString(); String codigo = txtCodigo.getText().toString(); String valor = txtValor.getText().toString(); String iva = txtIva.getText().toString(); String descripcion = txtDescripcion.getText().toString(); String categoria = txtCategoria.getText().toString(); if (nombre.isEmpty()) { CustomToastView.makeErrorToast(this, "Error al validar el Nombre", R.layout.custom_toast).show(); return; } if (codigo.isEmpty()) { CustomToastView.makeErrorToast(this, "Error al validar el Código", R.layout.custom_toast).show(); return; } if (valor.isEmpty()) { CustomToastView.makeErrorToast(this, "Error al validar el Valor", R.layout.custom_toast).show(); return; } if (iva.isEmpty()) { CustomToastView.makeErrorToast(this, "Error al validar el IVA", R.layout.custom_toast).show(); return; } if (descripcion.isEmpty()) { CustomToastView.makeErrorToast(this, "Error al validar la Descripción", R.layout.custom_toast).show(); return; } if (categoria.isEmpty()) { CustomToastView.makeErrorToast(this, "Error al validar la Categoría", R.layout.custom_toast).show(); return; } Producto nuevoProducto; nuevoProducto = new Producto(); nuevoProducto.setNombre(nombre); nuevoProducto.setCodigo(codigo); nuevoProducto.setValor(parseInt(valor)); nuevoProducto.setIva(iva); nuevoProducto.setDescripcion(descripcion); nuevoProducto.setCategoria(categoria); productos.add(nuevoProducto); Intent intent = new Intent(this, ListarAlimentos.class); startActivity(intent); } if (v.getId() == R.id.btnInicio) { Intent intent = new Intent(this, MainActivity.class); startActivity(intent); } } }
[ "santipineda26@gmail.com" ]
santipineda26@gmail.com
469661aaeee66b3a7fcdd228b388c69aacb7d46b
314d16b521af200617173842905525ce1404b2da
/src/main/java/com/mycompany/myapp/service/StoreService.java
6ba7473c8638f0d362d207cb96141f6d98c8d316
[]
no_license
pdeoliveira/equipmentManagement-start
39c94dfea5ba3a1976e56ef90c0dcb4a0ef8f139
a3fa04fcaed69f5090dd879cb4720bef3174c390
refs/heads/main
2023-01-24T13:33:07.164090
2020-12-05T16:05:06
2020-12-05T16:05:06
318,887,775
0
5
null
null
null
null
UTF-8
Java
false
false
1,915
java
package com.mycompany.myapp.service; import com.mycompany.myapp.domain.Store; import com.mycompany.myapp.repository.StoreRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Optional; /** * Service Implementation for managing {@link Store}. */ @Service @Transactional public class StoreService { private final Logger log = LoggerFactory.getLogger(StoreService.class); private final StoreRepository storeRepository; public StoreService(StoreRepository storeRepository) { this.storeRepository = storeRepository; } /** * Save a store. * * @param store the entity to save. * @return the persisted entity. */ public Store save(Store store) { log.debug("Request to save Store : {}", store); return storeRepository.save(store); } /** * Get all the stores. * * @param pageable the pagination information. * @return the list of entities. */ @Transactional(readOnly = true) public Page<Store> findAll(Pageable pageable) { log.debug("Request to get all Stores"); return storeRepository.findAll(pageable); } /** * Get one store by id. * * @param id the id of the entity. * @return the entity. */ @Transactional(readOnly = true) public Optional<Store> findOne(Long id) { log.debug("Request to get Store : {}", id); return storeRepository.findById(id); } /** * Delete the store by id. * * @param id the id of the entity. */ public void delete(Long id) { log.debug("Request to delete Store : {}", id); storeRepository.deleteById(id); } }
[ "pdeoliveira@gmail.com" ]
pdeoliveira@gmail.com
9f133b1f72c3e74998c755bfcc1b27717030fbe0
15683d5aea4b4ecf6dd476813614aaa09db3ea80
/src/com/jemmic/addressbook/exception/PersonNotFoundException.java
fb643956fce43bee8efdf1ba2d83827dcd97ce00
[]
no_license
reza-javaEE/Addressbook-command-line
5d972bf1ccae413bed2a09cc3b0b0a2a6761317e
5eb88144cd38001ff105f4f047623173c09137c9
refs/heads/master
2023-04-16T14:02:57.339700
2021-04-22T09:26:20
2021-04-22T09:26:20
353,364,728
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package com.jemmic.addressbook.exception; /** * Alert that the person was not found. */ public class PersonNotFoundException extends Exception { public PersonNotFoundException(String message) { super(message); } }
[ "rezaei.reza@ymail.com" ]
rezaei.reza@ymail.com
848a70299223019d56ebd363d0ab20970ff4714b
8614f770d651a9a4402e9e34e3918f15e9bc5486
/src/view/Main.java
0634fadab8d230cae468d229931497c811f1be00
[]
no_license
NguyenViet07/Kiem_tra_module2_jav_01
68bae33b40c54c7dfd33f5c2b1b4abcd8ebed5d8
779e0f4e56aa8c82816187384a88be77a6456e0d
refs/heads/master
2020-07-03T04:08:48.906176
2019-08-11T15:01:23
2019-08-11T15:01:23
201,779,040
0
0
null
null
null
null
UTF-8
Java
false
false
4,135
java
package view; import controller.Controller; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Controller controller = new Controller(); int keyword = 0; int id,price,stt; String name,status,description; do{ System.out.println("============================"); System.out.println("Enter selection:"); System.out.println("1. Show all products"); System.out.println("2. Add new products"); System.out.println("3. Edit products"); System.out.println("4. Delete products"); System.out.println("5. Search products by name"); System.out.println("6. Sort products"); System.out.println("0. Exit"); System.out.println("============================"); keyword = sc.nextInt(); switch (keyword){ case 1: System.out.println("==> Show products: "); controller.showProducts(); break; case 2: System.out.println("==> Add product: "); System.out.print("Input ID: "); id = sc.nextInt(); while(controller.checkID(id)){ System.out.print("ID products is exist. Please input ID again: "); id = sc.nextInt(); } System.out.print("Input Name: "); name = sc.next(); System.out.print("Input Price: "); price= sc.nextInt(); System.out.print("Input Status: "); status = sc.next(); System.out.print("Input Description: "); description = sc.next(); controller.addProduct(id,name,price,status,description); System.out.println("Add product success"); break; case 3: System.out.println("==> Edit product: "); System.out.print("Input ID: "); id = sc.nextInt(); if(controller.checkID(id)){ System.out.print("Input Name: "); name = sc.next(); System.out.print("Input Price: "); price= sc.nextInt(); System.out.print("Input Status: "); status = sc.next(); System.out.print("Input Description: "); description = sc.next(); controller.editProduct(id,name,price,status,description); System.out.println("Edit product success"); } else { System.out.println("ID Product is not exist."); } break; case 4: System.out.println("==> Delete product: "); System.out.print("Input ID: "); id = sc.nextInt(); if(controller.deleteProducts(id)){ System.out.println("Delete Product success"); } else { System.out.println("ID Product is not exist."); } break; case 5: System.out.println("==> Search product by Name: "); System.out.print("Input Name: "); name = sc.next(); if(!controller.searchByName(name)){ System.out.println("no Products"); } break; case 6: System.out.println("==> Sort by: "); System.out.println("Increase: 1 | Descrease : 2"); stt = sc.nextInt(); controller.showSortProduct(stt); break; } }while(keyword != 0); } }
[ "nguyenviet.vn.07@gmail.com" ]
nguyenviet.vn.07@gmail.com
ab14633e6760fbf3a1b1b68c76086686ca3972e3
f886812ecab339023ecf23ff5aa28b7051cc951e
/src/main/java/com/twineworks/tweakflow/lang/interpreter/ops/ClosureReferenceOp.java
f82f288db299d24d9234ce60787e6c72290d3cac
[ "MIT" ]
permissive
twineworks/tweakflow
995608af17f309bacb0064769499077aca7e1f8d
b6aa5241b9347c14d58bb0ef8f6b75a955ea92b6
refs/heads/master
2023-02-21T12:51:35.647910
2023-02-17T10:52:09
2023-02-17T10:52:09
97,735,381
31
6
MIT
2022-01-07T18:52:04
2017-07-19T15:55:15
Java
UTF-8
Java
false
false
2,108
java
/* * The MIT License (MIT) * * Copyright (c) 2019 Twineworks GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.twineworks.tweakflow.lang.interpreter.ops; import com.twineworks.tweakflow.lang.ast.expressions.ReferenceNode; import com.twineworks.tweakflow.lang.values.Value; import com.twineworks.tweakflow.lang.values.ValueProvider; import com.twineworks.tweakflow.lang.interpreter.EvaluationContext; import com.twineworks.tweakflow.lang.interpreter.Stack; final public class ClosureReferenceOp implements ExpressionOp { private final ReferenceNode node; public ClosureReferenceOp(ReferenceNode node) { this.node = node; } @Override public Value eval(Stack stack, EvaluationContext context) { ValueProvider vp = stack.peek().getClosures().get(node); return vp.getValue(); } @Override public boolean isConstant() { return false; } @Override public ExpressionOp specialize() { return new ClosureReferenceOp(node); } @Override public ExpressionOp refresh() { return new ClosureReferenceOp(node); } }
[ "slawomir.chodnicki@gmail.com" ]
slawomir.chodnicki@gmail.com
de2f09bdb1361117d508b15aa6e73c7d5c36b60f
45e172fbf60c13b2c7e20ce0d0cc674421ab53a5
/packages/apps/PIM/src/com/lewa/PIM/mms/transaction/AbstractRetryScheme.java
107b1ec40fcb2f6bc98f77d6d2a4b6f63b4f2d03
[ "Apache-2.0" ]
permissive
manfeel/android_vendor_lewa
17d9de4963f8a9b00088b15cea9fb8cec035bc08
567f54d25d0477a7e872153e66c0fe42789896b7
refs/heads/master
2020-07-14T10:53:49.421254
2013-05-27T07:22:54
2013-05-27T07:22:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
/* * Copyright (C) 2008 Esmertec AG. * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.lewa.PIM.mms.transaction; public abstract class AbstractRetryScheme { public static final int OUTGOING = 1; public static final int INCOMING = 2; protected int mRetriedTimes; public AbstractRetryScheme(int retriedTimes) { mRetriedTimes = retriedTimes; } abstract public int getRetryLimit(); abstract public long getWaitingInterval(); }
[ "jwjiang@lewatek.com" ]
jwjiang@lewatek.com
bc2588e27e447482ceb9a2435cf5b8837e3da43b
0484c4c753db5c8ba9f5ac58afb3a3dcf691ecfb
/src/main/java/com/he/study/java8/common/NewMan.java
5eb844a427e19b441b47dedad19002028fbbd1c2
[]
no_license
he1217/study
590468f49ad6fb75ff09302f890e1638a07e192e
b3c5de951b4a2d1c633ebde97882de3bd41224db
refs/heads/master
2023-08-17T12:39:31.860594
2021-10-14T03:21:02
2021-10-14T03:21:02
261,707,186
0
0
null
null
null
null
UTF-8
Java
false
false
605
java
package com.he.study.java8.common; import java.util.Optional; //注意:Optional 不能被序列化 public class NewMan { private Optional<Godness> godness = Optional.empty(); private Godness god; public Optional<Godness> getGod(){ return Optional.of(god); } public NewMan() { } public NewMan(Optional<Godness> godness) { this.godness = godness; } public Optional<Godness> getGodness() { return godness; } public void setGodness(Optional<Godness> godness) { this.godness = godness; } @Override public String toString() { return "NewMan [godness=" + godness + "]"; } }
[ "455450091@qq.com" ]
455450091@qq.com
d4b4fe75aa3123af129d9aa9667e3fbae4d997e9
81e8d7189799312a1694e103e52cd31eb25d3ab8
/src/main/java/manmaed/petslow/libs/SoundFiles.java
e2a503d491cbb71f63c4f0e5d09fad0fe5ce648c
[]
no_license
Naxanria/PetSlow
a7f5a1da5cc7e0ad9f131e3cd50fc6adf48f4a4f
d51948f779d63018344dc8a350381c0e509722ce
refs/heads/master
2020-05-02T15:50:38.204786
2019-03-17T17:28:02
2019-03-17T17:28:02
178,053,621
0
0
null
2019-03-27T18:34:54
2019-03-27T18:34:54
null
UTF-8
Java
false
false
716
java
package manmaed.petslow.libs; import net.minecraft.util.ResourceLocation; /** * Created by manmaed on 13/01/2019. */ public class SoundFiles { public static final String SOUNDFILES = "textures/entity/"; public static final ResourceLocation SLOWPOKE = ResourceLocationHelper.getResourceLocation(SOUNDFILES + "slowpoke64.ogg"); private static class ResourceLocationHelper { public static ResourceLocation getResourceLocation(String modId, String path) { return new ResourceLocation(modId, path); } public static ResourceLocation getResourceLocation(String path) { return getResourceLocation(Reference.MOD_ID.toLowerCase(), path); } } }
[ "manmaed18@gmail.com" ]
manmaed18@gmail.com
1a84866da8ae2e313ba6dd4e6050926feae694b9
af4290ed57180aae81fb128780f4d99e27d99adf
/boot-home/src/test/java/com/shenofusc/module/manager/service/ManagerServiceTest.java
f6a0cf9f62f056a0ae3c5149d71ea9321436f020
[]
no_license
smacheng/saas-base-platform
9e4273f76e0778e40151c172675427c4effd2163
2dedac1006553443b8f262c82da4261a9d22acf4
refs/heads/master
2021-04-26T22:43:41.287782
2017-08-16T07:12:05
2017-08-16T07:12:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package com.shenofusc.module.manager.service; import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.shenofusc.core.entity.Manager; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:conf/applicationContext.xml") public class ManagerServiceTest { @Resource private ManagerService managerService; /*@Resource private ManagerMapper managerMapper;*/ @Test public void testFindByUserName() { String userName = "admin"; Manager manager = managerService.findByUserName(userName); // assertNotNull(manager); } }
[ "shenofusc@gmail.com" ]
shenofusc@gmail.com
906b2157f8c288fa0ab313d7a77104f61656878b
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/21/1932.java
7eefa5321fcf2e054eac002bfd1ee946041d975e
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
840
java
package <missing>; public class GlobalMembers { public static int Main() { int n; int i; int middle; double[] a = new double[301]; double[] d = new double[301]; double dmax = 0; double sum = 0.0; double x; n = Integer.parseInt(ConsoleInput.readToWhiteSpace(true)); for (i = 0;i < n;i++) { a[i] = Double.parseDouble(ConsoleInput.readToWhiteSpace(true)); } for (i = 0;i < n;i++) { sum = sum + a[i]; } x = sum / n; sort(a,a + n); for (i = 0;i < n;i++) { d[i] = Math.abs(a[i] - x); if (d[i] > dmax) { dmax = d[i]; } } for (i = 0;i < n;i++) { if (d[i] == dmax) { System.out.print(a[i]); middle = i; break; } } for (i = middle+1;i < n;i++) { if (d[i] == dmax) { System.out.print(","); System.out.print(a[i]); } } return 0; } }
[ "y.yu@open.ac.uk" ]
y.yu@open.ac.uk
7e3a5f811e997049e273786f1c38649ab2514171
7938f326cd023007ffeab60bb977a99edd30e86c
/src/test/java/fr/paris/lutece/util/beanvalidation/Bean.java
9ef2e8296f01cbdda94a30df143db4449ace7d5f
[ "LicenseRef-scancode-other-permissive", "BSD-3-Clause" ]
permissive
eahuma/lutece-core
0a83cbd24a0dcf37e80c4e8f1d6ad32acf2d060b
469c86d0263e9f68d94397b79adcd3c2c2092267
refs/heads/master
2022-12-22T04:52:32.298071
2020-07-01T16:38:01
2020-07-01T16:38:01
278,385,330
0
0
BSD-3-Clause
2020-07-09T14:21:13
2020-07-09T14:21:12
null
UTF-8
Java
false
false
4,095
java
/* * Copyright (c) 2002-2020, City of Paris * 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 * and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice * and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' 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 HOLDERS 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. * * License 1.0 */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package fr.paris.lutece.util.beanvalidation; import java.math.BigDecimal; import java.sql.Date; /** * * @author pierre */ public interface Bean { /** * Returns the Age * * @return The Age */ int getAge( ); /** * @return the _strCurrency */ String getCurrency( ); /** * @return the _dateBirth */ Date getDateBirth( ); /** * @return the _dateEndOfWorld */ Date getDateEndOfWorld( ); /** * Returns the Description * * @return The Description */ String getDescription( ); /** * Returns the Email * * @return The Email */ String getEmail( ); /** * Returns the IdObject * * @return The IdObject */ int getIdObject( ); /** * Returns the Name * * @return The Name */ String getName( ); /** * @return the _percent */ BigDecimal getPercent( ); /** * @return the _salary */ BigDecimal getSalary( ); /** * Sets the Age * * @param nAge * The Age */ void setAge( int nAge ); /** * @param strCurrency * the _strCurrency to set */ void setCurrency( String strCurrency ); /** * @param dateBirth * the _dateBirth to set */ void setDateBirth( Date dateBirth ); /** * @param dateEndOfWorld * the _dateEndOfWorld to set */ void setDateEndOfWorld( Date dateEndOfWorld ); /** * Sets the Description * * @param strDescription * The Description */ void setDescription( String strDescription ); /** * Sets the Email * * @param strEmail * The Email */ void setEmail( String strEmail ); /** * Sets the IdObject * * @param nIdObject * The IdObject */ void setIdObject( int nIdObject ); /** * Sets the Name * * @param strName * The Name */ void setName( String strName ); /** * @param percent * the _percent to set */ void setPercent( BigDecimal percent ); /** * @param salary * the _salary to set */ void setSalary( BigDecimal salary ); void setUrl( String strUrl ); String getUrl( ); }
[ "pierrelevy@users.noreply.github.com" ]
pierrelevy@users.noreply.github.com
bbcccc723418bf4d7edb2c8ff7ce8b5ba19c6142
6e6db7db5aa823c77d9858d2182d901684faaa24
/sample/webservice/HelloeBayTrading/src/com/ebay/trading/api/LocalListingDistancesNonSubscriptionDefinitionType.java
7e386b75a0bea63b8e7ce4b5be153752843522a8
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
4everalone/nano
68a480d07d80f0f50d73ec593443bfb362d646aa
71779b1ad546663ee90a29f1c2d4236a6948a621
refs/heads/master
2020-12-25T14:08:08.303942
2013-07-25T13:28:41
2013-07-25T13:28:41
10,792,684
0
1
Apache-2.0
2019-04-24T20:12:27
2013-06-19T13:14:26
Java
UTF-8
Java
false
false
673
java
// Generated by xsd compiler for android/java // DO NOT CHANGE! package com.ebay.trading.api; import java.io.Serializable; import com.leansoft.nano.annotation.*; import java.util.List; /** * * Defines the LocalListingDistancesNonSubscription feature. This feature displays all the supported local * listing distances for items listed by sellers who have not subscribed to either Local Market for Vehicles * or Local Market for Specialty Vehicles. * */ public class LocalListingDistancesNonSubscriptionDefinitionType implements Serializable { private static final long serialVersionUID = -1L; @AnyElement @Order(value=0) public List<Object> any; }
[ "51startup@sina.com" ]
51startup@sina.com
4e06d743d2215c786cf4785b84c0c33bb5e3f19c
de5f344e514e447a32c3b71d6356144b84aa17c9
/app/src/main/java/com/hfad/beeradviser/BeerExpert.java
e4ec97acc02eeb91e9a8ae9a6bc70e0394062f09
[]
no_license
SER210-SP21/headfirst-ch2-ijcrawford
f210238faceee229b252d668e078724038579460
600a4bc0b96352268fcebe2cc4d824949d50bb6e
refs/heads/master
2023-03-02T17:35:32.419604
2021-02-09T20:11:53
2021-02-09T20:11:53
335,474,670
0
0
null
null
null
null
UTF-8
Java
false
false
456
java
package com.hfad.beeradviser; import java.util.ArrayList; import java.util.List; public class BeerExpert { public List<String> getBrands(String color) { List<String> brands = new ArrayList<>(); if(color.equals("amber")) { brands.add("Jack Amber"); brands.add("Red Moose"); } else { brands.add("Jail Pale Ale"); brands.add("Gout Stout"); } return brands; } }
[ "57536818+icra13@users.noreply.github.com" ]
57536818+icra13@users.noreply.github.com
26a67560891a93e2d4301f78d61c88c1b04e8fd9
c7fa44c7281a7d86d752fcb02a96578d1bb71b16
/Month/src/month/Month.java
ae36004bb6ae0c242a3f10a0390d9d12c3205fc9
[]
no_license
asu-cse-source-code/csc-205
2476a6421a88da08264c332880f57435da138f02
9120580b95cad358e62d241e690b51254b043475
refs/heads/master
2023-02-02T00:25:57.597001
2020-12-21T03:54:59
2020-12-21T03:54:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,005
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 month; /** * * @author austinspencer */ public class Month { private int monthNumber; String monthName; public Month() { monthNumber = 1; //initializing monthNumber to 1 } public Month(int m) { this.monthNumber = m; //initializing monthNumber to m } /** * * @param monthName initializing monthNumber according to monthName */ public Month(String monthName) //if for each month to its corresponding number { this.monthName = monthName; if (this.monthName.equals("January")) { this.monthNumber = 1; } else if (this.monthName.equals("February")) { this.monthNumber = 2; } else if (this.monthName.equals("March")) { this.monthNumber = 3; } else if (this.monthName.equals("April")) { this.monthNumber = 4; } else if (this.monthName.equals("May")) { this.monthNumber = 5; } else if (this.monthName.equals("June")) { this.monthNumber = 6; } else if (this.monthName.equals("July")) { this.monthNumber = 7; } else if (this.monthName.equals("August")) { this.monthNumber = 8; } else if (this.monthName.equals("September")) { this.monthNumber = 9; } else if (this.monthName.equals("October")) { this.monthNumber = 10; } else if (this.monthName.equals("November")) { this.monthNumber = 11; } else if (this.monthName.equals("December")) { this.monthNumber = 12; } else { this.monthNumber = 1; } } public String getMonthName() //gets the monthName from the monthNumber { if (this.monthNumber == 1) { this.monthName = "January"; } else if (this.monthNumber == 2) { this.monthName = "February"; } else if (this.monthNumber == 3) { this.monthName = "March"; } else if (this.monthNumber == 4) { this.monthName = "April"; } else if (this.monthNumber == 5) { this.monthName = "May"; } else if (this.monthNumber == 6) { this.monthName = "June"; } else if (this.monthNumber == 7) { this.monthName = "July"; } else if (this.monthNumber == 8) { this.monthName = "August"; } else if (this.monthNumber == 9) { this.monthName = "September"; } else if (this.monthNumber == 10) { this.monthName = "October"; } else if (this.monthNumber == 11) { this.monthName = "November"; } else if (this.monthNumber == 12) { this.monthName = "December"; } else { this.monthName = "January"; // Allows for bad month to be January } return monthName; } public int getMonthNumber() { return monthNumber; } /** * * @param m sets the month numbers from 0 to 12 */ public void setMonthNumber(int m) { if (monthNumber >= 0 && monthNumber <= 12) { this.monthNumber = m; } else { m = 1; } } /** * * @param month2 // sees if the calling object month is greater than month2 * @return */ public boolean greaterThan(Month month2) { if (this.getMonthNumber() > month2.getMonthNumber()) { return true; } else { return false; } } /** * * @param month2 sees if the calling object month is less than month2 * @return */ public boolean lessThan(Month month2) { if (this.getMonthNumber() < month2.getMonthNumber()) { return true; } else { return false; } } /** * * @param month2 sees is the calling object month is equal to month2 * @return */ public boolean equals(Month month2) { if (this.getMonthNumber() == month2.getMonthNumber()) { return true; } else { return false; } } public String toString() { return getMonthName(); } }
[ "abspencer2097@gmail.com" ]
abspencer2097@gmail.com
e76bffd20b407dd8696d3725b7dc5dc883069249
a63d907ad63ba6705420a6fb2788196d1bd3763c
/src/dataflow/codecheck/src/test/java/com/tencent/bk/base/dataflow/codecheck/util/db/DBConnectionUtilTest.java
f9530df69c4b2fdbefc61d583802d0ef7aa2a034
[ "MIT" ]
permissive
Tencent/bk-base
a38461072811667dc2880a13a5232004fe771a4b
6d483b4df67739b26cc8ecaa56c1d76ab46bd7a2
refs/heads/master
2022-07-30T04:24:53.370661
2022-04-02T10:30:55
2022-04-02T10:30:55
381,257,882
101
51
NOASSERTION
2022-04-02T10:30:56
2021-06-29T06:10:01
Python
UTF-8
Java
false
false
6,106
java
/* * Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. * * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. * * BK-BASE 蓝鲸基础平台 is licensed under the MIT License. * * License for BK-BASE 蓝鲸基础平台: * -------------------------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.tencent.bk.base.dataflow.codecheck.util.db; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import com.tencent.bk.base.dataflow.codecheck.util.Configuration; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import java.sql.Connection; import java.util.Properties; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; @RunWith(PowerMockRunner.class) @PrepareForTest({DBConnectionUtil.class, Configuration.class, HikariConfig.class, HikariDataSource.class}) public class DBConnectionUtilTest { private AutoCloseable closeable; @Before public void openMocks() { closeable = MockitoAnnotations.openMocks(this); } @After public void releaseMocks() throws Exception { closeable.close(); } @Test public void testGetSingleton() throws Exception { DBConnectionUtil singleton = PowerMockito.mock(DBConnectionUtil.class); Configuration configuration = PowerMockito.mock(Configuration.class); PowerMockito.mockStatic(Configuration.class); PowerMockito.when(Configuration.getSingleton()).thenReturn(configuration); Properties properties = new Properties(); PowerMockito.when(configuration.getDBConfig()).thenReturn(properties); HikariConfig hikariConfig = PowerMockito.mock(HikariConfig.class); HikariDataSource hikariDataSource = PowerMockito.mock(HikariDataSource.class); PowerMockito.whenNew(HikariConfig.class).withAnyArguments().thenReturn(hikariConfig); PowerMockito.whenNew(HikariDataSource.class).withArguments(hikariConfig).thenReturn(hikariDataSource); Whitebox.setInternalState(DBConnectionUtil.class, "dbConfig", hikariConfig); Whitebox.setInternalState(DBConnectionUtil.class, "ds", hikariDataSource); PowerMockito.whenNew(DBConnectionUtil.class).withAnyArguments().thenReturn(singleton); PowerMockito.mockStatic(DBConnectionUtil.class); PowerMockito.doCallRealMethod().when(DBConnectionUtil.class, "getSingleton"); Assert.assertEquals(DBConnectionUtil.getSingleton(), singleton); } @Test public void testGetConnection() throws Exception { DBConnectionUtil dbConnectionUtil = PowerMockito.mock(DBConnectionUtil.class); PowerMockito.mockStatic(DBConnectionUtil.class); PowerMockito.when(DBConnectionUtil.getSingleton()).thenReturn(dbConnectionUtil); Connection conn = PowerMockito.mock(Connection.class); HikariDataSource ds = PowerMockito.mock(HikariDataSource.class); PowerMockito.when(ds, "getConnection").thenReturn(conn); Whitebox.setInternalState(DBConnectionUtil.class, "ds", ds); PowerMockito.doCallRealMethod().when(dbConnectionUtil).getConnection(); Connection result = DBConnectionUtil.getSingleton().getConnection(); Assert.assertEquals(conn, result); } @Test public void testGetConnection2() throws Exception { DBConnectionUtil dbConnectionUtil = PowerMockito.mock(DBConnectionUtil.class); PowerMockito.mockStatic(DBConnectionUtil.class); PowerMockito.when(DBConnectionUtil.getSingleton()).thenReturn(dbConnectionUtil); HikariDataSource ds = PowerMockito.mock(HikariDataSource.class); PowerMockito.when(ds, "getConnection").thenThrow( new RuntimeException(), new RuntimeException(), new RuntimeException(), new RuntimeException()); Whitebox.setInternalState(DBConnectionUtil.class, "ds", ds); PowerMockito.doCallRealMethod().when(dbConnectionUtil).getConnection(); Connection result2 = DBConnectionUtil.getSingleton().getConnection(); Assert.assertNull(result2); } @Test public void testShutdown() throws Exception { DBConnectionUtil dBConnectionUtil = PowerMockito.mock(DBConnectionUtil.class); PowerMockito.mockStatic(DBConnectionUtil.class); HikariDataSource ds = PowerMockito.mock(HikariDataSource.class); PowerMockito.doNothing().when(ds, "close"); Whitebox.setInternalState(DBConnectionUtil.class, "ds", ds); PowerMockito.doCallRealMethod().when(dBConnectionUtil, "shutdown"); dBConnectionUtil.shutdown(); verify(dBConnectionUtil, times(3)).shutdown(); } }
[ "terrencehan@tencent.com" ]
terrencehan@tencent.com
3d7ac45e16755421a34ef3da535e1c444443d331
eca99e2af37ede85f4c291ea886d05357305d011
/app/src/main/java/com/cadyd/app/utils/GPUImageFilterTools.java
754c8ee732c5694a2ddc84f62723db116c64f7b2
[]
no_license
Brave-wan/cadyd
302fc5f47cdb246ab1ad88f585adcaa87518e080
7fb26a29a8609520c7be8b72016c1ecccf5872ca
refs/heads/master
2020-07-29T14:15:44.080887
2016-11-14T03:40:31
2016-11-14T03:40:31
73,664,047
0
0
null
null
null
null
UTF-8
Java
false
false
36,810
java
/* * Copyright (C) 2012 CyberAgent * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cadyd.app.utils; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.BitmapFactory; import android.graphics.PointF; import android.opengl.Matrix; import com.cadyd.app.R; import java.util.LinkedList; import java.util.List; import jp.co.cyberagent.android.gpuimage.GPUImage3x3ConvolutionFilter; import jp.co.cyberagent.android.gpuimage.GPUImage3x3TextureSamplingFilter; import jp.co.cyberagent.android.gpuimage.GPUImageAddBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageAlphaBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageBilateralFilter; import jp.co.cyberagent.android.gpuimage.GPUImageBoxBlurFilter; import jp.co.cyberagent.android.gpuimage.GPUImageBrightnessFilter; import jp.co.cyberagent.android.gpuimage.GPUImageBulgeDistortionFilter; import jp.co.cyberagent.android.gpuimage.GPUImageCGAColorspaceFilter; import jp.co.cyberagent.android.gpuimage.GPUImageChromaKeyBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageColorBalanceFilter; import jp.co.cyberagent.android.gpuimage.GPUImageColorBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageColorBurnBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageColorDodgeBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageColorInvertFilter; import jp.co.cyberagent.android.gpuimage.GPUImageContrastFilter; import jp.co.cyberagent.android.gpuimage.GPUImageCrosshatchFilter; import jp.co.cyberagent.android.gpuimage.GPUImageDarkenBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageDifferenceBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageDilationFilter; import jp.co.cyberagent.android.gpuimage.GPUImageDirectionalSobelEdgeDetectionFilter; import jp.co.cyberagent.android.gpuimage.GPUImageDissolveBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageDivideBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageEmbossFilter; import jp.co.cyberagent.android.gpuimage.GPUImageExclusionBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageExposureFilter; import jp.co.cyberagent.android.gpuimage.GPUImageFalseColorFilter; import jp.co.cyberagent.android.gpuimage.GPUImageFilter; import jp.co.cyberagent.android.gpuimage.GPUImageFilterGroup; import jp.co.cyberagent.android.gpuimage.GPUImageGammaFilter; import jp.co.cyberagent.android.gpuimage.GPUImageGaussianBlurFilter; import jp.co.cyberagent.android.gpuimage.GPUImageGlassSphereFilter; import jp.co.cyberagent.android.gpuimage.GPUImageGrayscaleFilter; import jp.co.cyberagent.android.gpuimage.GPUImageHalftoneFilter; import jp.co.cyberagent.android.gpuimage.GPUImageHardLightBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageHazeFilter; import jp.co.cyberagent.android.gpuimage.GPUImageHighlightShadowFilter; import jp.co.cyberagent.android.gpuimage.GPUImageHueBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageHueFilter; import jp.co.cyberagent.android.gpuimage.GPUImageKuwaharaFilter; import jp.co.cyberagent.android.gpuimage.GPUImageLaplacianFilter; import jp.co.cyberagent.android.gpuimage.GPUImageLevelsFilter; import jp.co.cyberagent.android.gpuimage.GPUImageLightenBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageLinearBurnBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageLookupFilter; import jp.co.cyberagent.android.gpuimage.GPUImageLuminosityBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageMonochromeFilter; import jp.co.cyberagent.android.gpuimage.GPUImageMultiplyBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageNonMaximumSuppressionFilter; import jp.co.cyberagent.android.gpuimage.GPUImageNormalBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageOpacityFilter; import jp.co.cyberagent.android.gpuimage.GPUImageOverlayBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImagePixelationFilter; import jp.co.cyberagent.android.gpuimage.GPUImagePosterizeFilter; import jp.co.cyberagent.android.gpuimage.GPUImageRGBDilationFilter; import jp.co.cyberagent.android.gpuimage.GPUImageRGBFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSaturationBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSaturationFilter; import jp.co.cyberagent.android.gpuimage.GPUImageScreenBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSepiaFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSharpenFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSketchFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSmoothToonFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSobelEdgeDetection; import jp.co.cyberagent.android.gpuimage.GPUImageSoftLightBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSourceOverBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSphereRefractionFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSubtractBlendFilter; import jp.co.cyberagent.android.gpuimage.GPUImageSwirlFilter; import jp.co.cyberagent.android.gpuimage.GPUImageToneCurveFilter; import jp.co.cyberagent.android.gpuimage.GPUImageToonFilter; import jp.co.cyberagent.android.gpuimage.GPUImageTransformFilter; import jp.co.cyberagent.android.gpuimage.GPUImageTwoInputFilter; import jp.co.cyberagent.android.gpuimage.GPUImageVignetteFilter; import jp.co.cyberagent.android.gpuimage.GPUImageWeakPixelInclusionFilter; import jp.co.cyberagent.android.gpuimage.GPUImageWhiteBalanceFilter; public class GPUImageFilterTools { public static void showDialog(final Context context, final OnGpuImageFilterChosenListener listener) { final FilterList filters = new FilterList(); filters.addFilter("Contrast", FilterType.CONTRAST); filters.addFilter("Invert", FilterType.INVERT); filters.addFilter("Pixelation", FilterType.PIXELATION); filters.addFilter("Hue", FilterType.HUE); filters.addFilter("Gamma", FilterType.GAMMA); filters.addFilter("Brightness", FilterType.BRIGHTNESS); filters.addFilter("Sepia", FilterType.SEPIA); filters.addFilter("Grayscale", FilterType.GRAYSCALE); filters.addFilter("Sharpness", FilterType.SHARPEN); filters.addFilter("Sobel Edge Detection", FilterType.SOBEL_EDGE_DETECTION); filters.addFilter("3x3 Convolution", FilterType.THREE_X_THREE_CONVOLUTION); filters.addFilter("Emboss", FilterType.EMBOSS); filters.addFilter("Posterize", FilterType.POSTERIZE); filters.addFilter("Grouped filters", FilterType.FILTER_GROUP); filters.addFilter("Saturation", FilterType.SATURATION); filters.addFilter("Exposure", FilterType.EXPOSURE); filters.addFilter("Highlight Shadow", FilterType.HIGHLIGHT_SHADOW); filters.addFilter("Monochrome", FilterType.MONOCHROME); filters.addFilter("Opacity", FilterType.OPACITY); filters.addFilter("RGB", FilterType.RGB); filters.addFilter("White Balance", FilterType.WHITE_BALANCE); filters.addFilter("Vignette", FilterType.VIGNETTE); filters.addFilter("ToneCurve", FilterType.TONE_CURVE); filters.addFilter("Blend (Difference)", FilterType.BLEND_DIFFERENCE); filters.addFilter("Blend (Source Over)", FilterType.BLEND_SOURCE_OVER); filters.addFilter("Blend (Color Burn)", FilterType.BLEND_COLOR_BURN); filters.addFilter("Blend (Color Dodge)", FilterType.BLEND_COLOR_DODGE); filters.addFilter("Blend (Darken)", FilterType.BLEND_DARKEN); filters.addFilter("Blend (Dissolve)", FilterType.BLEND_DISSOLVE); filters.addFilter("Blend (Exclusion)", FilterType.BLEND_EXCLUSION); filters.addFilter("Blend (Hard Light)", FilterType.BLEND_HARD_LIGHT); filters.addFilter("Blend (Lighten)", FilterType.BLEND_LIGHTEN); filters.addFilter("Blend (Add)", FilterType.BLEND_ADD); filters.addFilter("Blend (Divide)", FilterType.BLEND_DIVIDE); filters.addFilter("Blend (Multiply)", FilterType.BLEND_MULTIPLY); filters.addFilter("Blend (Overlay)", FilterType.BLEND_OVERLAY); filters.addFilter("Blend (Screen)", FilterType.BLEND_SCREEN); filters.addFilter("Blend (Alpha)", FilterType.BLEND_ALPHA); filters.addFilter("Blend (Color)", FilterType.BLEND_COLOR); filters.addFilter("Blend (Hue)", FilterType.BLEND_HUE); filters.addFilter("Blend (Saturation)", FilterType.BLEND_SATURATION); filters.addFilter("Blend (Luminosity)", FilterType.BLEND_LUMINOSITY); filters.addFilter("Blend (Linear Burn)", FilterType.BLEND_LINEAR_BURN); filters.addFilter("Blend (Soft Light)", FilterType.BLEND_SOFT_LIGHT); filters.addFilter("Blend (Subtract)", FilterType.BLEND_SUBTRACT); filters.addFilter("Blend (Chroma Key)", FilterType.BLEND_CHROMA_KEY); filters.addFilter("Blend (Normal)", FilterType.BLEND_NORMAL); filters.addFilter("Lookup (Amatorka)", FilterType.LOOKUP_AMATORKA); filters.addFilter("Gaussian Blur", FilterType.GAUSSIAN_BLUR); filters.addFilter("Crosshatch", FilterType.CROSSHATCH); filters.addFilter("Box Blur", FilterType.BOX_BLUR); filters.addFilter("CGA Color Space", FilterType.CGA_COLORSPACE); filters.addFilter("Dilation", FilterType.DILATION); filters.addFilter("Kuwahara", FilterType.KUWAHARA); filters.addFilter("RGB Dilation", FilterType.RGB_DILATION); filters.addFilter("Sketch", FilterType.SKETCH); filters.addFilter("Toon", FilterType.TOON); filters.addFilter("Smooth Toon", FilterType.SMOOTH_TOON); filters.addFilter("Halftone", FilterType.HALFTONE); filters.addFilter("Bulge Distortion", FilterType.BULGE_DISTORTION); filters.addFilter("Glass Sphere", FilterType.GLASS_SPHERE); filters.addFilter("Haze", FilterType.HAZE); filters.addFilter("Laplacian", FilterType.LAPLACIAN); filters.addFilter("Non Maximum Suppression", FilterType.NON_MAXIMUM_SUPPRESSION); filters.addFilter("Sphere Refraction", FilterType.SPHERE_REFRACTION); filters.addFilter("Swirl", FilterType.SWIRL); filters.addFilter("Weak Pixel Inclusion", FilterType.WEAK_PIXEL_INCLUSION); filters.addFilter("False Color", FilterType.FALSE_COLOR); filters.addFilter("Color Balance", FilterType.COLOR_BALANCE); filters.addFilter("Levels Min (Mid Adjust)", FilterType.LEVELS_FILTER_MIN); filters. addFilter("Bilateral Blur", FilterType.BILATERAL_BLUR); filters.addFilter("Transform (2-D)", FilterType.TRANSFORM2D); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Choose a filter"); builder.setItems(filters.names.toArray(new String[filters.names.size()]), new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int item) { listener.onGpuImageFilterChosenListener( createFilterForType(context, filters.filters.get(item))); } }); builder.create().show(); } private static GPUImageFilter createFilterForType(final Context context, final FilterType type) { switch (type) { case CONTRAST: return new GPUImageContrastFilter(2.0f); case GAMMA: return new GPUImageGammaFilter(2.0f); case INVERT: return new GPUImageColorInvertFilter(); case PIXELATION: return new GPUImagePixelationFilter(); case HUE: return new GPUImageHueFilter(90.0f); case BRIGHTNESS: return new GPUImageBrightnessFilter(1.5f); case GRAYSCALE: return new GPUImageGrayscaleFilter(); case SEPIA: return new GPUImageSepiaFilter(); case SHARPEN: GPUImageSharpenFilter sharpness = new GPUImageSharpenFilter(); sharpness.setSharpness(2.0f); return sharpness; case SOBEL_EDGE_DETECTION: return new GPUImageSobelEdgeDetection(); case THREE_X_THREE_CONVOLUTION: GPUImage3x3ConvolutionFilter convolution = new GPUImage3x3ConvolutionFilter(); convolution.setConvolutionKernel(new float[] { -1.0f, 0.0f, 1.0f, -2.0f, 0.0f, 2.0f, -1.0f, 0.0f, 1.0f }); return convolution; case EMBOSS: return new GPUImageEmbossFilter(); case POSTERIZE: return new GPUImagePosterizeFilter(); case FILTER_GROUP: List<GPUImageFilter> filters = new LinkedList<GPUImageFilter>(); filters.add(new GPUImageContrastFilter()); filters.add(new GPUImageDirectionalSobelEdgeDetectionFilter()); filters.add(new GPUImageGrayscaleFilter()); return new GPUImageFilterGroup(filters); case SATURATION: return new GPUImageSaturationFilter(1.0f); case EXPOSURE: return new GPUImageExposureFilter(0.0f); case HIGHLIGHT_SHADOW: return new GPUImageHighlightShadowFilter(0.0f, 1.0f); case MONOCHROME: return new GPUImageMonochromeFilter(1.0f, new float[]{0.6f, 0.45f, 0.3f, 1.0f}); case OPACITY: return new GPUImageOpacityFilter(1.0f); case RGB: return new GPUImageRGBFilter(1.0f, 1.0f, 1.0f); case WHITE_BALANCE: return new GPUImageWhiteBalanceFilter(5000.0f, 0.0f); case VIGNETTE: PointF centerPoint = new PointF(); centerPoint.x = 0.5f; centerPoint.y = 0.5f; return new GPUImageVignetteFilter(centerPoint, new float[] {0.0f, 0.0f, 0.0f}, 0.3f, 0.75f); case TONE_CURVE: GPUImageToneCurveFilter toneCurveFilter = new GPUImageToneCurveFilter(); toneCurveFilter.setFromCurveFileInputStream( context.getResources().openRawResource(R.raw.tone_cuver_sample)); return toneCurveFilter; case BLEND_DIFFERENCE: return createBlendFilter(context, GPUImageDifferenceBlendFilter.class); case BLEND_SOURCE_OVER: return createBlendFilter(context, GPUImageSourceOverBlendFilter.class); case BLEND_COLOR_BURN: return createBlendFilter(context, GPUImageColorBurnBlendFilter.class); case BLEND_COLOR_DODGE: return createBlendFilter(context, GPUImageColorDodgeBlendFilter.class); case BLEND_DARKEN: return createBlendFilter(context, GPUImageDarkenBlendFilter.class); case BLEND_DISSOLVE: return createBlendFilter(context, GPUImageDissolveBlendFilter.class); case BLEND_EXCLUSION: return createBlendFilter(context, GPUImageExclusionBlendFilter.class); case BLEND_HARD_LIGHT: return createBlendFilter(context, GPUImageHardLightBlendFilter.class); case BLEND_LIGHTEN: return createBlendFilter(context, GPUImageLightenBlendFilter.class); case BLEND_ADD: return createBlendFilter(context, GPUImageAddBlendFilter.class); case BLEND_DIVIDE: return createBlendFilter(context, GPUImageDivideBlendFilter.class); case BLEND_MULTIPLY: return createBlendFilter(context, GPUImageMultiplyBlendFilter.class); case BLEND_OVERLAY: return createBlendFilter(context, GPUImageOverlayBlendFilter.class); case BLEND_SCREEN: return createBlendFilter(context, GPUImageScreenBlendFilter.class); case BLEND_ALPHA: return createBlendFilter(context, GPUImageAlphaBlendFilter.class); case BLEND_COLOR: return createBlendFilter(context, GPUImageColorBlendFilter.class); case BLEND_HUE: return createBlendFilter(context, GPUImageHueBlendFilter.class); case BLEND_SATURATION: return createBlendFilter(context, GPUImageSaturationBlendFilter.class); case BLEND_LUMINOSITY: return createBlendFilter(context, GPUImageLuminosityBlendFilter.class); case BLEND_LINEAR_BURN: return createBlendFilter(context, GPUImageLinearBurnBlendFilter.class); case BLEND_SOFT_LIGHT: return createBlendFilter(context, GPUImageSoftLightBlendFilter.class); case BLEND_SUBTRACT: return createBlendFilter(context, GPUImageSubtractBlendFilter.class); case BLEND_CHROMA_KEY: return createBlendFilter(context, GPUImageChromaKeyBlendFilter.class); case BLEND_NORMAL: return createBlendFilter(context, GPUImageNormalBlendFilter.class); case LOOKUP_AMATORKA: GPUImageLookupFilter amatorka = new GPUImageLookupFilter(); amatorka.setBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.lookup_amatorka)); return amatorka; case GAUSSIAN_BLUR: return new GPUImageGaussianBlurFilter(); case CROSSHATCH: return new GPUImageCrosshatchFilter(); case BOX_BLUR: return new GPUImageBoxBlurFilter(); case CGA_COLORSPACE: return new GPUImageCGAColorspaceFilter(); case DILATION: return new GPUImageDilationFilter(); case KUWAHARA: return new GPUImageKuwaharaFilter(); case RGB_DILATION: return new GPUImageRGBDilationFilter(); case SKETCH: return new GPUImageSketchFilter(); case TOON: return new GPUImageToonFilter(); case SMOOTH_TOON: return new GPUImageSmoothToonFilter(); case BULGE_DISTORTION: return new GPUImageBulgeDistortionFilter(); case GLASS_SPHERE: return new GPUImageGlassSphereFilter(); case HAZE: return new GPUImageHazeFilter(); case LAPLACIAN: return new GPUImageLaplacianFilter(); case NON_MAXIMUM_SUPPRESSION: return new GPUImageNonMaximumSuppressionFilter(); case SPHERE_REFRACTION: return new GPUImageSphereRefractionFilter(); case SWIRL: return new GPUImageSwirlFilter(); case WEAK_PIXEL_INCLUSION: return new GPUImageWeakPixelInclusionFilter(); case FALSE_COLOR: return new GPUImageFalseColorFilter(); case COLOR_BALANCE: return new GPUImageColorBalanceFilter(); case LEVELS_FILTER_MIN: GPUImageLevelsFilter levelsFilter = new GPUImageLevelsFilter(); levelsFilter.setMin(0.0f, 3.0f, 1.0f); return levelsFilter; case HALFTONE: return new GPUImageHalftoneFilter(); case BILATERAL_BLUR: return new GPUImageBilateralFilter(); case TRANSFORM2D: return new GPUImageTransformFilter(); default: throw new IllegalStateException("No filter of that type!"); } } private static GPUImageFilter createBlendFilter(Context context, Class<? extends GPUImageTwoInputFilter> filterClass) { try { GPUImageTwoInputFilter filter = filterClass.newInstance(); filter.setBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher)); return filter; } catch (Exception e) { e.printStackTrace(); return null; } } public interface OnGpuImageFilterChosenListener { void onGpuImageFilterChosenListener(GPUImageFilter filter); } private enum FilterType { CONTRAST, GRAYSCALE, SHARPEN, SEPIA, SOBEL_EDGE_DETECTION, THREE_X_THREE_CONVOLUTION, FILTER_GROUP, EMBOSS, POSTERIZE, GAMMA, BRIGHTNESS, INVERT, HUE, PIXELATION, SATURATION, EXPOSURE, HIGHLIGHT_SHADOW, MONOCHROME, OPACITY, RGB, WHITE_BALANCE, VIGNETTE, TONE_CURVE, BLEND_COLOR_BURN, BLEND_COLOR_DODGE, BLEND_DARKEN, BLEND_DIFFERENCE, BLEND_DISSOLVE, BLEND_EXCLUSION, BLEND_SOURCE_OVER, BLEND_HARD_LIGHT, BLEND_LIGHTEN, BLEND_ADD, BLEND_DIVIDE, BLEND_MULTIPLY, BLEND_OVERLAY, BLEND_SCREEN, BLEND_ALPHA, BLEND_COLOR, BLEND_HUE, BLEND_SATURATION, BLEND_LUMINOSITY, BLEND_LINEAR_BURN, BLEND_SOFT_LIGHT, BLEND_SUBTRACT, BLEND_CHROMA_KEY, BLEND_NORMAL, LOOKUP_AMATORKA, GAUSSIAN_BLUR, CROSSHATCH, BOX_BLUR, CGA_COLORSPACE, DILATION, KUWAHARA, RGB_DILATION, SKETCH, TOON, SMOOTH_TOON, BULGE_DISTORTION, GLASS_SPHERE, HAZE, LAPLACIAN, NON_MAXIMUM_SUPPRESSION, SPHERE_REFRACTION, SWIRL, WEAK_PIXEL_INCLUSION, FALSE_COLOR, COLOR_BALANCE, LEVELS_FILTER_MIN, BILATERAL_BLUR, HALFTONE, TRANSFORM2D } private static class FilterList { public List<String> names = new LinkedList<String>(); public List<FilterType> filters = new LinkedList<FilterType>(); public void addFilter(final String name, final FilterType filter) { names.add(name); filters.add(filter); } } public static class FilterAdjuster { private final Adjuster<? extends GPUImageFilter> adjuster; public FilterAdjuster(final GPUImageFilter filter) { if (filter instanceof GPUImageSharpenFilter) { adjuster = new SharpnessAdjuster().filter(filter); } else if (filter instanceof GPUImageSepiaFilter) { adjuster = new SepiaAdjuster().filter(filter); } else if (filter instanceof GPUImageContrastFilter) { adjuster = new ContrastAdjuster().filter(filter); } else if (filter instanceof GPUImageGammaFilter) { adjuster = new GammaAdjuster().filter(filter); } else if (filter instanceof GPUImageBrightnessFilter) { adjuster = new BrightnessAdjuster().filter(filter); } else if (filter instanceof GPUImageSobelEdgeDetection) { adjuster = new SobelAdjuster().filter(filter); } else if (filter instanceof GPUImageEmbossFilter) { adjuster = new EmbossAdjuster().filter(filter); } else if (filter instanceof GPUImage3x3TextureSamplingFilter) { adjuster = new GPU3x3TextureAdjuster().filter(filter); } else if (filter instanceof GPUImageHueFilter) { adjuster = new HueAdjuster().filter(filter); } else if (filter instanceof GPUImagePosterizeFilter) { adjuster = new PosterizeAdjuster().filter(filter); } else if (filter instanceof GPUImagePixelationFilter) { adjuster = new PixelationAdjuster().filter(filter); } else if (filter instanceof GPUImageSaturationFilter) { adjuster = new SaturationAdjuster().filter(filter); } else if (filter instanceof GPUImageExposureFilter) { adjuster = new ExposureAdjuster().filter(filter); } else if (filter instanceof GPUImageHighlightShadowFilter) { adjuster = new HighlightShadowAdjuster().filter(filter); } else if (filter instanceof GPUImageMonochromeFilter) { adjuster = new MonochromeAdjuster().filter(filter); } else if (filter instanceof GPUImageOpacityFilter) { adjuster = new OpacityAdjuster().filter(filter); } else if (filter instanceof GPUImageRGBFilter) { adjuster = new RGBAdjuster().filter(filter); } else if (filter instanceof GPUImageWhiteBalanceFilter) { adjuster = new WhiteBalanceAdjuster().filter(filter); } else if (filter instanceof GPUImageVignetteFilter) { adjuster = new VignetteAdjuster().filter(filter); } else if (filter instanceof GPUImageDissolveBlendFilter) { adjuster = new DissolveBlendAdjuster().filter(filter); } else if (filter instanceof GPUImageGaussianBlurFilter) { adjuster = new GaussianBlurAdjuster().filter(filter); } else if (filter instanceof GPUImageCrosshatchFilter) { adjuster = new CrosshatchBlurAdjuster().filter(filter); } else if (filter instanceof GPUImageBulgeDistortionFilter) { adjuster = new BulgeDistortionAdjuster().filter(filter); } else if (filter instanceof GPUImageGlassSphereFilter) { adjuster = new GlassSphereAdjuster().filter(filter); } else if (filter instanceof GPUImageHazeFilter) { adjuster = new HazeAdjuster().filter(filter); } else if (filter instanceof GPUImageSphereRefractionFilter) { adjuster = new SphereRefractionAdjuster().filter(filter); } else if (filter instanceof GPUImageSwirlFilter) { adjuster = new SwirlAdjuster().filter(filter); } else if (filter instanceof GPUImageColorBalanceFilter) { adjuster = new ColorBalanceAdjuster().filter(filter); } else if (filter instanceof GPUImageLevelsFilter) { adjuster = new LevelsMinMidAdjuster().filter(filter); } else if (filter instanceof GPUImageBilateralFilter) { adjuster = new BilateralAdjuster().filter(filter); } else if (filter instanceof GPUImageTransformFilter) { adjuster = new RotateAdjuster().filter(filter); } else { adjuster = null; } } public boolean canAdjust() { return adjuster != null; } public void adjust(final int percentage) { if (adjuster != null) { adjuster.adjust(percentage); } } private abstract class Adjuster<T extends GPUImageFilter> { private T filter; @SuppressWarnings("unchecked") public Adjuster<T> filter(final GPUImageFilter filter) { this.filter = (T) filter; return this; } public T getFilter() { return filter; } public abstract void adjust(int percentage); protected float range(final int percentage, final float start, final float end) { return (end - start) * percentage / 100.0f + start; } protected int range(final int percentage, final int start, final int end) { return (end - start) * percentage / 100 + start; } } private class SharpnessAdjuster extends Adjuster<GPUImageSharpenFilter> { @Override public void adjust(final int percentage) { getFilter().setSharpness(range(percentage, -4.0f, 4.0f)); } } private class PixelationAdjuster extends Adjuster<GPUImagePixelationFilter> { @Override public void adjust(final int percentage) { getFilter().setPixel(range(percentage, 1.0f, 100.0f)); } } private class HueAdjuster extends Adjuster<GPUImageHueFilter> { @Override public void adjust(final int percentage) { getFilter().setHue(range(percentage, 0.0f, 360.0f)); } } private class ContrastAdjuster extends Adjuster<GPUImageContrastFilter> { @Override public void adjust(final int percentage) { getFilter().setContrast(range(percentage, 0.0f, 2.0f)); } } private class GammaAdjuster extends Adjuster<GPUImageGammaFilter> { @Override public void adjust(final int percentage) { getFilter().setGamma(range(percentage, 0.0f, 3.0f)); } } private class BrightnessAdjuster extends Adjuster<GPUImageBrightnessFilter> { @Override public void adjust(final int percentage) { getFilter().setBrightness(range(percentage, -1.0f, 1.0f)); } } private class SepiaAdjuster extends Adjuster<GPUImageSepiaFilter> { @Override public void adjust(final int percentage) { getFilter().setIntensity(range(percentage, 0.0f, 2.0f)); } } private class SobelAdjuster extends Adjuster<GPUImageSobelEdgeDetection> { @Override public void adjust(final int percentage) { getFilter().setLineSize(range(percentage, 0.0f, 5.0f)); } } private class EmbossAdjuster extends Adjuster<GPUImageEmbossFilter> { @Override public void adjust(final int percentage) { getFilter().setIntensity(range(percentage, 0.0f, 4.0f)); } } private class PosterizeAdjuster extends Adjuster<GPUImagePosterizeFilter> { @Override public void adjust(final int percentage) { // In theorie to 256, but only first 50 are interesting getFilter().setColorLevels(range(percentage, 1, 50)); } } private class GPU3x3TextureAdjuster extends Adjuster<GPUImage3x3TextureSamplingFilter> { @Override public void adjust(final int percentage) { getFilter().setLineSize(range(percentage, 0.0f, 5.0f)); } } private class SaturationAdjuster extends Adjuster<GPUImageSaturationFilter> { @Override public void adjust(final int percentage) { getFilter().setSaturation(range(percentage, 0.0f, 2.0f)); } } private class ExposureAdjuster extends Adjuster<GPUImageExposureFilter> { @Override public void adjust(final int percentage) { getFilter().setExposure(range(percentage, -10.0f, 10.0f)); } } private class HighlightShadowAdjuster extends Adjuster<GPUImageHighlightShadowFilter> { @Override public void adjust(final int percentage) { getFilter().setShadows(range(percentage, 0.0f, 1.0f)); getFilter().setHighlights(range(percentage, 0.0f, 1.0f)); } } private class MonochromeAdjuster extends Adjuster<GPUImageMonochromeFilter> { @Override public void adjust(final int percentage) { getFilter().setIntensity(range(percentage, 0.0f, 1.0f)); //getFilter().setColor(new float[]{0.6f, 0.45f, 0.3f, 1.0f}); } } private class OpacityAdjuster extends Adjuster<GPUImageOpacityFilter> { @Override public void adjust(final int percentage) { getFilter().setOpacity(range(percentage, 0.0f, 1.0f)); } } private class RGBAdjuster extends Adjuster<GPUImageRGBFilter> { @Override public void adjust(final int percentage) { getFilter().setRed(range(percentage, 0.0f, 1.0f)); //getFilter().setGreen(range(percentage, 0.0f, 1.0f)); //getFilter().setBlue(range(percentage, 0.0f, 1.0f)); } } private class WhiteBalanceAdjuster extends Adjuster<GPUImageWhiteBalanceFilter> { @Override public void adjust(final int percentage) { getFilter().setTemperature(range(percentage, 2000.0f, 8000.0f)); //getFilter().setTint(range(percentage, -100.0f, 100.0f)); } } private class VignetteAdjuster extends Adjuster<GPUImageVignetteFilter> { @Override public void adjust(final int percentage) { getFilter().setVignetteStart(range(percentage, 0.0f, 1.0f)); } } private class DissolveBlendAdjuster extends Adjuster<GPUImageDissolveBlendFilter> { @Override public void adjust(final int percentage) { getFilter().setMix(range(percentage, 0.0f, 1.0f)); } } private class GaussianBlurAdjuster extends Adjuster<GPUImageGaussianBlurFilter> { @Override public void adjust(final int percentage) { getFilter().setBlurSize(range(percentage, 0.0f, 1.0f)); } } private class CrosshatchBlurAdjuster extends Adjuster<GPUImageCrosshatchFilter> { @Override public void adjust(final int percentage) { getFilter().setCrossHatchSpacing(range(percentage, 0.0f, 0.06f)); getFilter().setLineWidth(range(percentage, 0.0f, 0.006f)); } } private class BulgeDistortionAdjuster extends Adjuster<GPUImageBulgeDistortionFilter> { @Override public void adjust(final int percentage) { getFilter().setRadius(range(percentage, 0.0f, 1.0f)); getFilter().setScale(range(percentage, -1.0f, 1.0f)); } } private class GlassSphereAdjuster extends Adjuster<GPUImageGlassSphereFilter> { @Override public void adjust(final int percentage) { getFilter().setRadius(range(percentage, 0.0f, 1.0f)); } } private class HazeAdjuster extends Adjuster<GPUImageHazeFilter> { @Override public void adjust(final int percentage) { getFilter().setDistance(range(percentage, -0.3f, 0.3f)); getFilter().setSlope(range(percentage, -0.3f, 0.3f)); } } private class SphereRefractionAdjuster extends Adjuster<GPUImageSphereRefractionFilter> { @Override public void adjust(final int percentage) { getFilter().setRadius(range(percentage, 0.0f, 1.0f)); } } private class SwirlAdjuster extends Adjuster<GPUImageSwirlFilter> { @Override public void adjust(final int percentage) { getFilter().setAngle(range(percentage, 0.0f, 2.0f)); } } private class ColorBalanceAdjuster extends Adjuster<GPUImageColorBalanceFilter> { @Override public void adjust(int percentage) { getFilter().setMidtones(new float[]{ range(percentage, 0.0f, 1.0f), range(percentage / 2, 0.0f, 1.0f), range(percentage / 3, 0.0f, 1.0f)}); } } private class LevelsMinMidAdjuster extends Adjuster<GPUImageLevelsFilter> { @Override public void adjust(int percentage) { getFilter().setMin(0.0f, range(percentage, 0.0f, 1.0f), 1.0f); } } private class BilateralAdjuster extends Adjuster<GPUImageBilateralFilter> { @Override public void adjust(final int percentage) { getFilter().setDistanceNormalizationFactor(range(percentage, 0.0f, 15.0f)); } } private class RotateAdjuster extends Adjuster<GPUImageTransformFilter> { @Override public void adjust(final int percentage) { float[] transform = new float[16]; Matrix.setRotateM(transform, 0, 360 * percentage / 100, 0, 0, 1.0f); getFilter().setTransform3D(transform); } } } }
[ "185214487@qq.com" ]
185214487@qq.com
1939236d340860833f0ec8f80fa33c6e742cb52d
dcca538a05b5084d3491cc9e7b477a7b32aecde1
/app/src/main/java/com/beamotivator/beam/SavedPost.java
238e96e39f1892eff72c737e0a0a3164e4cfd130
[]
no_license
rakulav/My-Android-App
3b0cb042cba802701f1de796cf035d9c71945398
60f5dc1d135624a9436d4b76ffa39fb3dcade56a
refs/heads/master
2022-12-13T07:40:15.068440
2020-09-06T06:41:17
2020-09-06T06:41:17
292,741,912
0
0
null
null
null
null
UTF-8
Java
false
false
4,921
java
package com.beamotivator.beam; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.widget.Toast; import androidx.appcompat.widget.Toolbar; import com.beamotivator.beam.adapters.AdapterPosts; import com.beamotivator.beam.models.ModelPost; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; public class SavedPost extends AppCompatActivity { RecyclerView savedPostsRv; List<ModelPost> postList; AdapterPosts adapterPosts; FirebaseAuth firebaseAuth; String myId ; String ig = ""; int count = 0; //Toolbar savedPosts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = this.getWindow(); Drawable background = this.getResources().getDrawable(R.drawable.main_gradient); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(this.getResources().getColor(android.R.color.transparent)); // window.setNavigationBarColor(this.getResources().getColor(android.R.color.transparent)); window.setBackgroundDrawable(background); } setContentView(R.layout.activity_saved_post); //set firebase firebaseAuth = FirebaseAuth.getInstance(); myId = firebaseAuth.getCurrentUser().getUid(); Toolbar savedTlbr = (Toolbar) findViewById(R.id.savedPostTlbr); setSupportActionBar(savedTlbr); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); savedPostsRv = findViewById(R.id.savedRecyclerView); postList = new ArrayList<>(); loadSavedPosts(); } private void loadSavedPosts() { //linear layout for recyclerview LinearLayoutManager layoutManager = new LinearLayoutManager(SavedPost.this); //show newest posts, load from last layoutManager.setStackFromEnd(true); layoutManager.setReverseLayout(true); //set this layout to recycler view savedPostsRv.setLayoutManager(layoutManager); myId = firebaseAuth.getCurrentUser().getUid(); DatabaseReference ref = FirebaseDatabase.getInstance().getReference("Extras").child(myId).child("Saved"); ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { postList.clear(); for(DataSnapshot ds:snapshot.getChildren()){ String postId = ""+ds.getKey(); //now check for the post details DatabaseReference ref1 = FirebaseDatabase.getInstance().getReference("Posts"); ref1.orderByChild("pId") .equalTo(postId) .addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot datasnapshot) { for(DataSnapshot ds1:datasnapshot.getChildren()){ ModelPost modelPost = ds1.getValue(ModelPost.class); //add post postList.add(modelPost); //adapter adapterPosts = new AdapterPosts(SavedPost.this,postList); //set adapter to recycler view savedPostsRv.setAdapter(adapterPosts); } } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } @Override public boolean onSupportNavigateUp() { onBackPressed(); return super.onSupportNavigateUp(); } }
[ "rahulvenkat126@gmail.com" ]
rahulvenkat126@gmail.com
dc9c24d3ea59c3cd9a2e0b43df725e1c91d260e5
d1587ff23f80b268719195cf094e69cf16707ad4
/hr-payroll/src/main/java/com/brazil/hrpayroll/mappers/PaymentMapper.java
1ff42427e59ae103fd4aafe1d817f646851d1611
[]
no_license
eduardomingoranca/ms-human-resources-spring
6e09a26fba8e3ebb7bd846badfd62b1c3dee4dc4
b13dd2bf444584cce9ba1e9141032037b1b51f5d
refs/heads/main
2023-08-28T00:01:01.513303
2021-09-18T13:05:09
2021-09-18T13:05:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package com.brazil.hrpayroll.mappers; import com.brazil.hrpayroll.entities.Payment; import com.brazil.hrpayroll.responses.PaymentResponse; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @Mapper(componentModel = "spring") public abstract class PaymentMapper { /** criando uma instancia */ public static final PaymentMapper INSTANCE = Mappers.getMapper(PaymentMapper.class); /** * convertendo automaticamente todos os * atributos dentro das DTO's * * @param payment */ public abstract PaymentResponse toPaymentResponse(Payment payment); }
[ "eduardomingoranca@gmail.com" ]
eduardomingoranca@gmail.com
dcabc7714870a092765f65a8453581d49a28e364
e52d9e1f01e93d1a00a653ea21e94095d1c37a8e
/app/src/main/java/com/augmentis/ayp/dnd/DragAndDrawActivity.java
33854214834352af034fed57bc0223cbf3c55bec
[]
no_license
rawinng/Drag-and-draw
12a82b3441982e6e3af0601e46cf26813c0fd19f
ba5ac15caac6d1b44e9a926dca21847d90cf72d1
refs/heads/master
2021-06-05T01:08:26.476660
2016-08-30T08:41:52
2016-08-30T08:41:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package com.augmentis.ayp.dnd; import android.support.v4.app.Fragment; /** * Created by Rawin on 30-Aug-16. */ public class DragAndDrawActivity extends SingleFragmentActivity { @Override Fragment onCreateFragment() { return DragAndDrawFragment.newInstance(); } }
[ "rawin.n@augmentis.biz" ]
rawin.n@augmentis.biz
cebab17a25cfd6cca680b58c259d7d546456e5b5
1aaeae6ca0cceabeb8f2aa71fc5fb409f838e227
/xjcloud-common/xjcloud-common-core/src/main/java/gov/pbc/xjcloud/common/core/config/MessageSourceConfig.java
70b84dcc3ba42a73bd01d73d8538f0f2ad718307
[]
no_license
lizxGitHub/xjcloud-master
e03d7079bd0d262ba8b6f964b2f560589421e1a8
d73c5553c94e6ac133bd1e0b80277ffa34f80dc3
refs/heads/master
2023-06-21T20:40:54.854381
2021-05-31T14:18:40
2021-05-31T14:18:40
231,402,466
0
1
null
2023-06-20T18:32:04
2020-01-02T14:52:34
Java
UTF-8
Java
false
false
575
java
package gov.pbc.xjcloud.common.core.config; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ReloadableResourceBundleMessageSource; @Configuration public class MessageSourceConfig { @Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename("classpath:i18n/messages"); return messageSource; } }
[ "lizhuxiong123@163.com" ]
lizhuxiong123@163.com
bd451bc96e7de2c8cd520fc6b5878bbcff9dfdd4
6d3d22ff3af218191c2463a5f953d301839d088f
/Quizzer.java
cdd76e66d7a99dbb0a8173d5bf9c334460b9a67a
[]
no_license
iblacksand/Quizzer
1b3565aa7e64c9ea2c187da8e81d7b4b1f4ab9e0
1fa478d83efd620852b2594ce98fcea58114631f
refs/heads/master
2021-01-10T10:15:40.321760
2015-10-01T21:37:54
2015-10-01T21:37:54
43,519,537
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
import java.util.*; /** *Class to start the quiz clas *@author John Elizarraras *@version 0.1.0 */ public class Quizzer { /** *Main method for the quizzer *@param args arguments for starting program */ public static void main(String[] args) { Quiz q = new Quiz(); Scanner in = new Scanner (System.in); String statement = in.nextLine(); while (!statement.equalsIgnoreCase("Exit")) { System.out.println(q.quiz()); } } }
[ "chess4j@gmail.com" ]
chess4j@gmail.com
8c50d119cbd5bc61315f69a63572ec790a9294f7
28c26a46a8c24b0dcc2b76b776d37af218dab3b5
/acmicpc/java/_2845/Main.java
d603493ad100ab73322b6669610c2f8c8008d6ed
[]
no_license
kingesay/algorithm_hub
062898fc61a27f5f28ebe45716b1eb4489eb9061
09ec614e96d9b2c4deab1c8ca18e406536c4e5ea
refs/heads/master
2022-11-23T20:14:13.179329
2020-07-26T23:37:37
2020-07-26T23:37:37
265,223,532
1
0
null
2020-05-19T11:04:40
2020-05-19T11:04:39
null
UTF-8
Java
false
false
886
java
package _2845; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s1 = br.readLine(); String[] strings1 = s1.split(" "); int l = Integer.parseInt(strings1[0]); int p = Integer.parseInt(strings1[1]); int sol = l*p; String s2 = br.readLine(); String[] strings2 = s2.split(" "); int size = 5; int[] target = new int[5]; for (int i = 0; i < size; i++) { target[i] = Integer.parseInt(strings2[i]); int gap = 0; gap = target[i] - sol; bw.write(gap+" "); } bw.write("\n"); bw.flush(); bw.close(); } }
[ "dkssudvn2@gmail.com" ]
dkssudvn2@gmail.com
70bc721898e1bf0a3d866f7112e8723a791e03c4
536ad227b030891a250271945133d5deb36bad0c
/dubbo-demo-parent/dubbo-demo-consumer/src/main/java/com/wjq/ConsumerStart.java
6282001cce8ab2ae09e794dd4ff90522a82bc217
[]
no_license
wenjiaquan/dubbo-zuoye-arithmetic
ed61eaefc0efb5f9e62773207b5ac24fb9653ca1
575edbf386c2cfdf8fbd833b2e0b648f7c4704fc
refs/heads/master
2022-01-15T04:03:44.153888
2020-02-23T09:07:04
2020-02-23T09:07:04
242,486,324
0
0
null
2022-01-12T23:05:02
2020-02-23T09:03:51
Java
UTF-8
Java
false
false
838
java
package com.wjq; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.wjq.entity.Student; import com.wjq.service.StudentService; public class ConsumerStart { private static StudentService studentService; private static ClassPathXmlApplicationContext context; public static void main(String[] args) { context = new ClassPathXmlApplicationContext("classpath:ApplicantionContext.xml"); studentService=context.getBean(StudentService.class); Student stu = studentService.getByid(20); System.out.println("student is" + stu); Student setAge = studentService.setAge(stu, 5); System.out.println("加岁数以后的数据 " + setAge); System.out.println("两数相加的结果:"+studentService.jia(2,3)); System.out.println("两数相减的结果:"+studentService.jian(6,3)); } }
[ "dell@192.168.124.1" ]
dell@192.168.124.1
b345d678ceac0c10fa08c14134262d266c8cdd60
75cd764739a399af6ea3bda47c9305a962fe8a57
/jar-project/OceanusLiveTvMiddleware/tvmiddlewareinterface/src/main/java/Oceanus/Tv/Service/PictureManager/PictureManagerDefinitions/EN_PICTURE_MODE.java
4976fe27b5ddc7d1dcf1b1756c3c7cd717c03ed3
[]
no_license
changxiangzhong/oceanus
a6a2a8d7a84c1070cc2f00e6eb277aadf7511dbd
92ec2d6e5a94159dae1ce7f1183dcc93dd85c7df
refs/heads/master
2023-08-31T12:27:22.813420
2017-08-04T06:57:17
2017-08-04T06:57:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
671
java
package Oceanus.Tv.Service.PictureManager.PictureManagerDefinitions; /** * Created by sky057509 on 2016/8/19. */ public enum EN_PICTURE_MODE { // ** Standrad mode E_PICTURE_MODE_STANDARD, // ** Vivid mode E_PICTURE_MODE_VIVID, // ** Soft mode E_PICTURE_MODE_SOFT, // ** User mode E_PICTURE_MODE_USER, // ** Game mode E_PICTURE_MODE_GAME, // ** Auto mode E_PICTURE_MODE_AUTO, // ** Natural mode E_PICTURE_MODE_NATURAL, // ** Sports mode E_PICTURE_MODE_SPORTS, // ** PC mode E_PICTURE_MODE_PC, // ** Dymanic mode E_PICTURE_MODE_DYMANIC, // ** Invalid mode E_PICTURE_MODE_INVALID; }
[ "chencong1254@163.com" ]
chencong1254@163.com
1461dacc6ed9550861cf95b78a868f6680c32718
8deb480242bccf0615056122293ea7d6b02f62a9
/src/main/java/com/qianfeng/pojo/Person.java
2d6602123d2fd80bd6765bdb08ea15a04dd845ec
[]
no_license
hzbace/clothsys
a26e25c183f49c201eb67d3a6c34316c4c75e4d5
da09acb52e38872e76f38d8e63e73f5259bc9fb4
refs/heads/master
2020-04-23T13:40:17.583942
2019-02-18T02:59:39
2019-02-18T02:59:39
171,204,795
0
0
null
null
null
null
UTF-8
Java
false
false
1,495
java
package com.qianfeng.pojo; public class Person { private Integer perId; private String perName; private String perCompany; private String perEmail; private String perPhone; private String perAddr; private Integer perUserId; public Integer getPerId() { return perId; } public void setPerId(Integer perId) { this.perId = perId; } public String getPerName() { return perName; } public void setPerName(String perName) { this.perName = perName == null ? null : perName.trim(); } public String getPerCompany() { return perCompany; } public void setPerCompany(String perCompany) { this.perCompany = perCompany == null ? null : perCompany.trim(); } public String getPerEmail() { return perEmail; } public void setPerEmail(String perEmail) { this.perEmail = perEmail == null ? null : perEmail.trim(); } public String getPerPhone() { return perPhone; } public void setPerPhone(String perPhone) { this.perPhone = perPhone == null ? null : perPhone.trim(); } public String getPerAddr() { return perAddr; } public void setPerAddr(String perAddr) { this.perAddr = perAddr == null ? null : perAddr.trim(); } public Integer getPerUserId() { return perUserId; } public void setPerUserId(Integer perUserId) { this.perUserId = perUserId; } }
[ "hzbace@sohu.com" ]
hzbace@sohu.com
d5c29e174c64c22484130059ba9d21974f666b6d
befd1d2879f7924f6d5898302e3512cd4ae02c88
/MergeChunk.java
1a3f495b1388f40ae0f4c8d7c543421e5ec5ae84
[]
no_license
weirenw/Peer2Peer-Network
a10a6722d8daefda98b09e40d622f2f7449687de
23604906c1ca43fef5e7b848f649eca3fcc3ef92
refs/heads/master
2020-05-18T17:07:59.255676
2014-11-13T04:39:35
2014-11-13T04:39:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,367
java
import java.io.*; import java.util.*; public class MergeChunk{ public void mergeParts ( int PEER_NUM, int CHUNK_NUM ) { String DESTINATION_PATH = "/home/administrator/CNT5106/project/client" + Integer.toString(PEER_NUM) + "/file/"; ArrayList<String> nameList = new ArrayList<String>(); for(int i=1;i<=CHUNK_NUM;i++) nameList.add(DESTINATION_PATH+"data"+Integer.toString(i)+".bin"); File[] file = new File[nameList.size()]; byte AllFilesContent[] = null; int TOTAL_SIZE = 0; int FILE_NUMBER = nameList.size(); int FILE_LENGTH = 0; int CURRENT_LENGTH=0; for ( int i=0; i<FILE_NUMBER; i++) { file[i] = new File (nameList.get(i)); TOTAL_SIZE+=file[i].length(); } try { AllFilesContent= new byte[TOTAL_SIZE]; // Length of All Files, Total Size InputStream inStream = null; for ( int j=0; j<FILE_NUMBER; j++) { inStream = new BufferedInputStream ( new FileInputStream( file[j] )); FILE_LENGTH = (int) file[j].length(); inStream.read(AllFilesContent, CURRENT_LENGTH, FILE_LENGTH); CURRENT_LENGTH+=FILE_LENGTH; inStream.close(); } } catch (FileNotFoundException e) { System.out.println("File not found " + e); } catch (IOException ioe) { System.out.println("Exception while reading the file " + ioe); } finally { write (AllFilesContent,DESTINATION_PATH+"finalfile"); } System.out.println("Merge was executed successfully.!"); } void write(byte[] DataByteArray, String DestinationFileName){ try { OutputStream output = null; try { output = new BufferedOutputStream(new FileOutputStream(DestinationFileName)); output.write( DataByteArray ); System.out.println("Writing Process Was Performed"); } finally { output.close(); } } catch(FileNotFoundException ex){ ex.printStackTrace(); } catch(IOException ex){ ex.printStackTrace(); } } }
[ "weirenwang@gatech.edu" ]
weirenwang@gatech.edu
90f32513c9a7c31423e1216e74492a9982925c8a
edadfd41bba5414ecb3130782565fb83563c21fa
/src/com/timmy/jsonEntity/IdentifyUserResult.java
6c47c5248a9d31c7e17ca497103d9717618182e6
[]
no_license
Raphealkxy/AMSFull
c477efda20966ca42358aac8cc8463c9edbef59c
7e4a9a1b8ac372840639458a5dd15e977ffcb4f3
refs/heads/master
2021-07-11T02:38:27.675019
2017-10-07T13:01:43
2017-10-07T13:01:43
103,399,166
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package com.timmy.jsonEntity; import java.util.List; /** * Auto-generated: 2017-10-07 15:29:31 * * @author www.jsons.cn * @website http://www.jsons.cn/json2java/ */ public class IdentifyUserResult { private List<Result> result; private int resultNum; private int logId; public void setResult(List<Result> result) { this.result = result; } public List<Result> getResult() { return result; } public void setResultNum(int resultNum) { this.resultNum = resultNum; } public int getResultNum() { return resultNum; } public void setLogId(int logId) { this.logId = logId; } public int getLogId() { return logId; } }
[ "1277609958@qq.com" ]
1277609958@qq.com
05f62afdae32c8aa528c114f2cd836dd40ea7a57
86e4307b042fc735aa0c67f5963a78d154d276c8
/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/google/android/gms/base/R.java
fc3addbf5f53fba91a893f2023b51fd1bed83e48
[]
no_license
lukas0512/Vic
6b01f44f8b4774f450c5f318e95ce7dc1643ba5e
13c817032f6995351b614b363b540abcb6adf829
refs/heads/master
2023-01-06T18:43:08.717859
2019-09-04T04:40:41
2019-09-04T04:40:41
206,222,630
0
0
null
2023-01-04T08:54:58
2019-09-04T03:25:07
Java
UTF-8
Java
false
false
6,376
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.google.android.gms.base; public final class R { private R() {} public static final class attr { private attr() {} public static final int buttonSize = 0x7f020044; public static final int circleCrop = 0x7f02004b; public static final int colorScheme = 0x7f02005a; public static final int imageAspectRatio = 0x7f020092; public static final int imageAspectRatioAdjust = 0x7f020093; public static final int scopeUris = 0x7f0200e2; } public static final class color { private color() {} public static final int common_google_signin_btn_text_dark = 0x7f040027; public static final int common_google_signin_btn_text_dark_default = 0x7f040028; public static final int common_google_signin_btn_text_dark_disabled = 0x7f040029; public static final int common_google_signin_btn_text_dark_focused = 0x7f04002a; public static final int common_google_signin_btn_text_dark_pressed = 0x7f04002b; public static final int common_google_signin_btn_text_light = 0x7f04002c; public static final int common_google_signin_btn_text_light_default = 0x7f04002d; public static final int common_google_signin_btn_text_light_disabled = 0x7f04002e; public static final int common_google_signin_btn_text_light_focused = 0x7f04002f; public static final int common_google_signin_btn_text_light_pressed = 0x7f040030; public static final int common_google_signin_btn_tint = 0x7f040031; } public static final class drawable { private drawable() {} public static final int common_full_open_on_phone = 0x7f060054; public static final int common_google_signin_btn_icon_dark = 0x7f060055; public static final int common_google_signin_btn_icon_dark_focused = 0x7f060056; public static final int common_google_signin_btn_icon_dark_normal = 0x7f060057; public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f060058; public static final int common_google_signin_btn_icon_disabled = 0x7f060059; public static final int common_google_signin_btn_icon_light = 0x7f06005a; public static final int common_google_signin_btn_icon_light_focused = 0x7f06005b; public static final int common_google_signin_btn_icon_light_normal = 0x7f06005c; public static final int common_google_signin_btn_icon_light_normal_background = 0x7f06005d; public static final int common_google_signin_btn_text_dark = 0x7f06005e; public static final int common_google_signin_btn_text_dark_focused = 0x7f06005f; public static final int common_google_signin_btn_text_dark_normal = 0x7f060060; public static final int common_google_signin_btn_text_dark_normal_background = 0x7f060061; public static final int common_google_signin_btn_text_disabled = 0x7f060062; public static final int common_google_signin_btn_text_light = 0x7f060063; public static final int common_google_signin_btn_text_light_focused = 0x7f060064; public static final int common_google_signin_btn_text_light_normal = 0x7f060065; public static final int common_google_signin_btn_text_light_normal_background = 0x7f060066; public static final int googleg_disabled_color_18 = 0x7f060067; public static final int googleg_standard_color_18 = 0x7f060068; } public static final class id { private id() {} public static final int adjust_height = 0x7f070020; public static final int adjust_width = 0x7f070021; public static final int auto = 0x7f070026; public static final int dark = 0x7f07003b; public static final int icon_only = 0x7f070054; public static final int light = 0x7f07005a; public static final int none = 0x7f070064; public static final int standard = 0x7f070092; public static final int wide = 0x7f0700aa; } public static final class string { private string() {} public static final int common_google_play_services_enable_button = 0x7f0b0043; public static final int common_google_play_services_enable_text = 0x7f0b0044; public static final int common_google_play_services_enable_title = 0x7f0b0045; public static final int common_google_play_services_install_button = 0x7f0b0046; public static final int common_google_play_services_install_text = 0x7f0b0047; public static final int common_google_play_services_install_title = 0x7f0b0048; public static final int common_google_play_services_notification_channel_name = 0x7f0b0049; public static final int common_google_play_services_notification_ticker = 0x7f0b004a; public static final int common_google_play_services_unsupported_text = 0x7f0b004c; public static final int common_google_play_services_update_button = 0x7f0b004d; public static final int common_google_play_services_update_text = 0x7f0b004e; public static final int common_google_play_services_update_title = 0x7f0b004f; public static final int common_google_play_services_updating_text = 0x7f0b0050; public static final int common_google_play_services_wear_update_text = 0x7f0b0051; public static final int common_open_on_phone = 0x7f0b0052; public static final int common_signin_button_text = 0x7f0b0053; public static final int common_signin_button_text_long = 0x7f0b0054; } public static final class styleable { private styleable() {} public static final int[] LoadingImageView = { 0x7f02004b, 0x7f020092, 0x7f020093 }; public static final int LoadingImageView_circleCrop = 0; public static final int LoadingImageView_imageAspectRatio = 1; public static final int LoadingImageView_imageAspectRatioAdjust = 2; public static final int[] SignInButton = { 0x7f020044, 0x7f02005a, 0x7f0200e2 }; public static final int SignInButton_buttonSize = 0; public static final int SignInButton_colorScheme = 1; public static final int SignInButton_scopeUris = 2; } }
[ "lukasgalhardosilva@gmail.com" ]
lukasgalhardosilva@gmail.com
4f404389e360bb068099bc8607c7281babe7c0a1
bc4d2a4dfe587d3dd8045544cc6dc562ed0661b4
/src/test/java/stepDefinition/stepDefinition.java
3f872caf414fb089d4097c6291d1448a159b4308
[]
no_license
SudhakarElumalai/GitDemo
89d5415ecbae905c41dbb5e17938b4426832cfea
94f0b0a6150a46891886cff0dade46d86f851268
refs/heads/master
2022-12-30T16:27:08.093393
2020-07-26T18:15:19
2020-07-26T18:15:19
282,641,947
0
0
null
2020-10-13T23:56:45
2020-07-26T12:08:51
Java
UTF-8
Java
false
false
1,009
java
package stepDefinition; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; public class stepDefinition { @Given("^User is on landing Page$") public void user_is_on_landing_page() throws Throwable { System.out.println("User is on Landing Page"); System.out.println("Navgated To Login page"); System.out.println("Passed"); } @When("^User Login into application with username and password$") public void user_login_into_application_with_username_and_password() throws Throwable { System.out.println("User successfully logined into the application"); } @Then("^Home page is populated$") public void home_page_is_populated() throws Throwable { System.out.println("User is on Home Page"); } @And("^Cards are displayed$") public void cards_are_displayed() throws Throwable { System.out.println("Cards details is populated"); } }
[ "sudha.sporty@gmail.com" ]
sudha.sporty@gmail.com
2ae2133550d5f7be3ce8fb87e55d75f4d87ace1d
670470a84ff2f9647286b012c2372d9473162cb9
/src/test/java/application/GreetingResourceTest.java
e83d51537360f4db4a4048c65157d5ec0bfaeef1
[]
no_license
DanielFidalgo/quarkus-kubernetes
f86963ab4e9d9db8e105380ef04960461c628568
b82dc907977afc9986aef3be0ee5e90e8df82afd
refs/heads/main
2023-07-01T16:59:11.520228
2021-08-06T02:13:21
2021-08-06T02:13:21
386,439,558
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package application; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.is; @QuarkusTest public class GreetingResourceTest { @Test public void testHelloEndpoint() { given() .when().get("/hello") .then() .statusCode(200) .body(is("Hello RESTEasy")); } }
[ "daniel.fidalgo@gmail.com" ]
daniel.fidalgo@gmail.com
e7718e5ed421165c6e184615e4455c08efef5b2b
cba0fed5248fbfda184e483891cdd34e5f7f4984
/impl/src/main/java/org/opendaylight/jsonrpc/binding/MultiModelProxy.java
0ccf8e81a1481f721228672a9feb5f17396cd4b4
[]
no_license
mltdinesh/jsonrpc
0f2c7b9cb57ea5559e0c9a1b2202e37505490769
092ca5443cb145864bd80b622256ae51cbe5852d
refs/heads/master
2020-12-20T01:29:53.820123
2020-01-16T21:13:59
2020-01-17T12:45:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,790
java
/* * Copyright (c) 2018 Lumina Networks, Inc. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.jsonrpc.binding; import com.google.common.collect.ClassToInstanceMap; import com.google.common.collect.ImmutableClassToInstanceMap; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import org.opendaylight.yangtools.yang.binding.RpcService; /** * Proxy context for remote RPC service which implements multiple yang models. * * @author <a href="mailto:richard.kosegi@gmail.com">Richard Kosegi</a> * @since Oct 16, 2018 */ public class MultiModelProxy implements AutoCloseable { private final ClassToInstanceMap<? extends RpcService> proxyMap; private final Set<ProxyContext<RpcService>> proxies; public MultiModelProxy(Set<ProxyContext<RpcService>> proxies) { this.proxies = proxies; proxyMap = ImmutableClassToInstanceMap .copyOf(proxies.stream().collect(Collectors.toMap(ProxyContext::getType, ProxyContext::getProxy))); } @Override public void close() { proxies.stream().forEach(ProxyContext::close); } /** * Get RPC proxy for particular {@link RpcService}. * * @param type subtype of {@link RpcService} to get proxy for * @return proxy for given RpcService subtype */ @SuppressWarnings("unchecked") public <T extends RpcService> T getRpcService(Class<T> type) { return (T) Objects.requireNonNull(proxyMap.get(type), "Service is not supported by this requester instance : " + type); } }
[ "richard.kosegi@gmail.com" ]
richard.kosegi@gmail.com
8ce0fe3d176dc11a5b0105ab737dd488688a8ca5
ce475cdc11907eddfe7d419048fa9883474631d2
/WORKSPACE/array/src/com/testyantra/collection/set/Person.java
e598c6aef84d73a222502ab009eedc22addf2e72
[]
no_license
avinashporwal2607/Manthan-ELF-16th-October-Avinash-Porwal
0c44d8924da2f0e02da803e6521792b8c943c1ed
28dc9a3664826e6690f81696aa51c6726860387f
refs/heads/master
2020-09-16T22:30:10.336409
2019-12-27T07:05:13
2019-12-27T07:05:13
223,904,867
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
package com.testyantra.collection.set; public class Person implements Comparable<Person> //here we have to implement comparable interface user dedine class { int id; String name; double hegiht; public Person(int id, String name, double hegiht) { this.id = id; this.name = name; this.hegiht = hegiht; } /* * public int compareTo(Person x)// { if(this.id>x.id) { return 1; } else if * (this.id<x.id) { return -1; } else { return 0; } */ // public int compareTo(Person x) // { if(this.hegiht>x.hegiht) // { // return 1; // } // else if // (this.hegiht<x.hegiht) // { return -1; } // else // { return 0; // } public int compareTo(Person x) { return this.name.compareTo(x.name); } }
[ "aviporwal2607@gmail.com" ]
aviporwal2607@gmail.com
28b608242afd72d9a4bd5b63c6fbdc85f15d99f2
5f63a60fd029b8a74d2b1b4bf6992f5e4c7b429b
/com/planet_ink/coffee_mud/core/database/GRaceLoader.java
a4ae1d625f5c16a227a5b45943a14efcb86d17d4
[ "Apache-2.0" ]
permissive
bozimmerman/CoffeeMud
5da8b5b98c25b70554ec9a2a8c0ef97f177dc041
647864922e07572b1f6c863de8f936982f553288
refs/heads/master
2023-09-04T09:17:12.656291
2023-09-02T00:30:19
2023-09-02T00:30:19
5,267,832
179
122
Apache-2.0
2023-04-30T11:09:14
2012-08-02T03:22:12
Java
UTF-8
Java
false
false
7,242
java
package com.planet_ink.coffee_mud.core.database; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.CMProps.Int; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.DatabaseEngine; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.sql.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /* Copyright 2008-2023 Bo Zimmerman 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. */ public class GRaceLoader { protected DBConnector DB=null; protected Set<String> updateQue = Collections.synchronizedSet(new TreeSet<String>()); public GRaceLoader(final DBConnector newDB) { DB=newDB; } public void DBDeleteRace(final String raceID) { DB.update("DELETE FROM CMGRAC WHERE CMRCID='"+raceID+"'"); } public void DBCreateRace(final String raceID, final String data) { DB.updateWithClobs( "INSERT INTO CMGRAC (" +"CMRCID, " +"CMRDAT," +"CMRCDT " +") values (" +"'"+raceID+"'," +"?," +System.currentTimeMillis() +")", data+" "); } public void DBUpdateRaceCreationDate(final String raceID) { DBConnection D=null; try { D=DB.DBFetch(); D.update("UPDATE CMGRAC SET CMRCDT="+System.currentTimeMillis()+" WHERE CMRCID='"+raceID+"';", 0); } catch(final Exception sqle) { Log.errOut("GRaceLoader",sqle); } finally { DB.DBDone(D); } } public boolean isRaceExpired(String raceID) { raceID = DB.injectionClean(raceID); DBConnection D=null; try { D=DB.DBFetch(); final ResultSet R=D.query("SELECT * FROM CMGRAC WHERE CMRCID='"+raceID+"';"); if(R.next()) { final long oneHour = (60L * 60L * 1000L); final long expireDays = CMProps.getIntVar(Int.RACEEXPIRATIONDAYS); final long expireMs = (oneHour * expireDays * 24L); final long oldestDate = System.currentTimeMillis()- expireMs; final long creationDate = DBConnections.getLongRes(R, "CMRCDT"); R.close(); return (creationDate < oldestDate); } R.close(); } catch(final Exception sqle) { Log.errOut("GRaceLoader",sqle); } finally { DB.DBDone(D); } return false; } public void registerRaceUsed(final Race R) { if((R!=null)&&(R.isGeneric())) updateQue.add(R.ID()); } public int updateAllRaceDates() { final List<String> que = new LinkedList<String>(updateQue); final List<String> updates = new ArrayList<String>(que.size()); updateQue.clear(); final long cDate = System.currentTimeMillis(); for(final String id : que) { if(!id.equalsIgnoreCase("GenRace")) updates.add("UPDATE CMGRAC SET CMRCDT="+cDate+" WHERE CMRCID='"+id+"';"); } if(updates.size()>0) { try { DB.update(updates.toArray(new String[0])); } catch(final Exception sqle) { Log.errOut("GRaceLoader",sqle); } return updates.size(); } return 0; } public int DBPruneOldRaces() { final List<String> updates = new ArrayList<String>(1); final long oneHour = (60L * 60L * 1000L); final long expireDays = CMProps.getIntVar(Int.RACEEXPIRATIONDAYS); final long expireMs = (oneHour * expireDays * 24L); final long oldestDate = System.currentTimeMillis()- expireMs; final long oldestHour = System.currentTimeMillis()- oneHour; final List<DatabaseEngine.AckStats> ackStats = DBReadRaceStats(); for(final DatabaseEngine.AckStats stat : ackStats) { if(stat.creationDate() != 0) { final Race R=CMClass.getRace(stat.ID()); if(R.usageCount(0) == 0) { if(stat.creationDate() < oldestDate) { updates.add("DELETE FROM CMGRAC WHERE CMRCID='"+stat.ID()+"';"); CMClass.delRace(R); Log.sysOut("Expiring race '"+R.ID()+": "+R.name()+": "+CMLib.time().date2String(stat.creationDate())); } } } else { final long cDate = CMLib.dice().rollInRange(oldestDate, oldestHour); updates.add("UPDATE CMGRAC SET CMRCDT="+cDate+" WHERE CMRCID='"+stat.ID()+"';"); } } if(updates.size()>0) { try { DB.update(updates.toArray(new String[0])); } catch(final Exception sqle) { Log.errOut("GRaceLoader",sqle); } } return updates.size(); } protected List<DatabaseEngine.AckStats> DBReadRaceStats() { DBConnection D=null; final List<DatabaseEngine.AckStats> rows=new Vector<DatabaseEngine.AckStats>(); try { D=DB.DBFetch(); final ResultSet R=D.query("SELECT * FROM CMGRAC"); while(R.next()) { final String rcid = DBConnections.getRes(R,"CMRCID"); final long rfirst = DBConnections.getLongRes(R, "CMRCDT"); final DatabaseEngine.AckStats ack=new DatabaseEngine.AckStats() { @Override public String ID() { return rcid; } @Override public long creationDate() { return rfirst; } }; rows.add(ack); } } catch(final Exception sqle) { Log.errOut("GRaceLoader",sqle); } finally { DB.DBDone(D); } // log comment return rows; } public List<DatabaseEngine.AckRecord> DBReadRaces() { DBConnection D=null; final List<DatabaseEngine.AckRecord> rows=new Vector<DatabaseEngine.AckRecord>(); try { D=DB.DBFetch(); final ResultSet R=D.query("SELECT * FROM CMGRAC"); while(R.next()) { final String rcid = DBConnections.getRes(R,"CMRCID"); final String rdat = DBConnections.getRes(R,"CMRDAT"); final DatabaseEngine.AckRecord ack=new DatabaseEngine.AckRecord() { @Override public String ID() { return rcid; } @Override public String data() { return rdat; } @Override public String typeClass() { return "GenRace"; } }; rows.add(ack); } } catch(final Exception sqle) { Log.errOut("GRaceLoader",sqle); } finally { DB.DBDone(D); } // log comment return rows; } }
[ "bo@zimmers.net" ]
bo@zimmers.net
dd97c51cb607ad208e8723d5fc8a7a591f5f77dc
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/9/org/jfree/data/xy/DefaultIntervalXYDataset_getY_386.java
3d5dbd7f28e158a74dc44195d8203bc158009363
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,202
java
org jfree data dataset defin rang interv valu valu implement arrai store start end start end valu altern implement link interv dataset intervalxydataset provid link interv seri collect xyintervalseriescollect default interv dataset defaultintervalxydataset abstract interv dataset abstractintervalxydataset return item seri param seri seri index rang code code code seri count getseriescount code param item item index rang code code code item count getitemcount seri code arrai index bound except arrayindexoutofboundsexcept code seri code rang arrai index bound except arrayindexoutofboundsexcept code item code rang getyvalu number geti seri item doubl getyvalu seri item
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
65f9e3b0f974ca2e559b3b027401669adce35a5c
12d0f7d3294352856ab89be1b66c446e585ed809
/app/src/main/java/il/ac/tau/cloudweb17a/hasorkim/AppCompatPreferenceActivity.java
e17681fde1bb7e0624bd7223c3b39ea7b224dda9
[]
no_license
ShaharLer/Hasorkim-reports
d41f4f1f3e4a39925785f216187b13745bdceade
f123927e3f654a6fb383bd2171c6c445128c48c0
refs/heads/master
2021-03-30T15:43:57.452224
2018-04-30T12:59:04
2018-04-30T12:59:04
110,526,393
0
0
null
null
null
null
UTF-8
Java
false
false
3,004
java
package il.ac.tau.cloudweb17a.hasorkim; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceActivity; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatDelegate; import android.support.v7.widget.Toolbar; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; /** * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls * to be used with AppCompat. */ public abstract class AppCompatPreferenceActivity extends PreferenceActivity { private AppCompatDelegate mDelegate; @Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getDelegate().onPostCreate(savedInstanceState); } public ActionBar getSupportActionBar() { return getDelegate().getSupportActionBar(); } public void setSupportActionBar(@Nullable Toolbar toolbar) { getDelegate().setSupportActionBar(toolbar); } @Override public MenuInflater getMenuInflater() { return getDelegate().getMenuInflater(); } @Override public void setContentView(@LayoutRes int layoutResID) { getDelegate().setContentView(layoutResID); } @Override public void setContentView(View view) { getDelegate().setContentView(view); } @Override public void setContentView(View view, ViewGroup.LayoutParams params) { getDelegate().setContentView(view, params); } @Override public void addContentView(View view, ViewGroup.LayoutParams params) { getDelegate().addContentView(view, params); } @Override protected void onPostResume() { super.onPostResume(); getDelegate().onPostResume(); } @Override protected void onTitleChanged(CharSequence title, int color) { super.onTitleChanged(title, color); getDelegate().setTitle(title); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); getDelegate().onConfigurationChanged(newConfig); } @Override protected void onStop() { super.onStop(); getDelegate().onStop(); } @Override protected void onDestroy() { super.onDestroy(); getDelegate().onDestroy(); } public void invalidateOptionsMenu() { getDelegate().invalidateOptionsMenu(); } private AppCompatDelegate getDelegate() { if (mDelegate == null) { mDelegate = AppCompatDelegate.create(this, null); } return mDelegate; } }
[ "sch.bar@gmail.com" ]
sch.bar@gmail.com
ff7682fef48ff851ec74e17da5a39da25ce9d702
e5c5b9f97ad7a5985018456f0184a77017ffcff6
/src/test/java/com/okidokiteam/exxam/regression/paxrunner/porcelain/MutliFrameworkTest.java
942df2bf4aed3168d0530628a86054ae82c6c07a
[]
no_license
tonit/ExamOnGradle
21bf9804f6b9fb66468c417ceb407616eb1ed460
9cf0d671256d3ce216dbe5e2ce065bc6d0fc378d
refs/heads/master
2016-09-05T19:59:43.642944
2011-04-15T12:39:02
2011-04-15T12:39:02
1,515,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,086
java
package com.okidokiteam.exxam.regression.paxrunner.porcelain; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.Configuration; import org.ops4j.pax.exam.junit.ExamReactorStrategy; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory; import static org.ops4j.pax.exam.CoreOptions.*; import static org.ops4j.pax.exam.LibraryOptions.*; import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.*; /** * */ @RunWith( JUnit4TestRunner.class ) @ExamReactorStrategy( AllConfinedStagedReactorFactory.class ) public class MutliFrameworkTest { private static Logger LOG = LoggerFactory.getLogger( MutliFrameworkTest.class ); @Configuration() public Option[] config() { return options( junitBundles(), equinox(), felix(), logProfile() ); } @Test public void fwTest( ) { } }
[ "toni@okidokiteam.com" ]
toni@okidokiteam.com
7c36d46c013102739251b39f348349d03abacf99
cee88a3b33d342aec3f4b1183252c3c6d780517d
/src/main/java/com/simon/gateway/service/mapper/UserMapper.java
b12cd92e655dccf33923fc145b9b34ced652e15e
[]
no_license
simoncurran/jhipster-ui-gateway
b9a1e2c6229208dc1e249f33f3ebeaa282fbb739
702af22a8e0d772f64ae542b945b63e87dfdbec1
refs/heads/master
2020-07-26T01:36:10.272735
2016-11-13T20:27:07
2016-11-13T20:27:07
73,640,664
0
0
null
null
null
null
UTF-8
Java
false
false
1,709
java
package com.simon.gateway.service.mapper; import com.simon.gateway.domain.Authority; import com.simon.gateway.domain.User; import com.simon.gateway.service.dto.UserDTO; import org.mapstruct.*; import java.util.List; import java.util.Set; import java.util.stream.Collectors; /** * Mapper for the entity User and its DTO UserDTO. */ @Mapper(componentModel = "spring", uses = {}) public interface UserMapper { UserDTO userToUserDTO(User user); List<UserDTO> usersToUserDTOs(List<User> users); @Mapping(target = "createdBy", ignore = true) @Mapping(target = "createdDate", ignore = true) @Mapping(target = "lastModifiedBy", ignore = true) @Mapping(target = "lastModifiedDate", ignore = true) @Mapping(target = "id", ignore = true) @Mapping(target = "activationKey", ignore = true) @Mapping(target = "resetKey", ignore = true) @Mapping(target = "resetDate", ignore = true) @Mapping(target = "password", ignore = true) User userDTOToUser(UserDTO userDTO); List<User> userDTOsToUsers(List<UserDTO> userDTOs); default User userFromId(Long id) { if (id == null) { return null; } User user = new User(); user.setId(id); return user; } default Set<String> stringsFromAuthorities (Set<Authority> authorities) { return authorities.stream().map(Authority::getName) .collect(Collectors.toSet()); } default Set<Authority> authoritiesFromStrings(Set<String> strings) { return strings.stream().map(string -> { Authority auth = new Authority(); auth.setName(string); return auth; }).collect(Collectors.toSet()); } }
[ "curran.simon@googlemail.com" ]
curran.simon@googlemail.com
b15589e6eb4a3204b8b965546aff597e77f4950c
f801fb4120a08ee43419befeaae953a986e91143
/projects/EmployeeManager/src/employeemanager/models/implementations/Manager.java
1285b6594ca5be84b8a06f377c0ae2910db04546
[]
no_license
VictorMilitan/homework1
96770b4952f1e784838a0db1ce3c4ba9827249f1
cdbc96ae5b59512a3850a6fc7cfe039e97453441
refs/heads/master
2020-04-17T23:44:13.243588
2019-04-10T17:57:45
2019-04-10T17:57:45
167,048,326
0
0
null
null
null
null
UTF-8
Java
false
false
462
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 employeemanager.models.implementations; import employeemanager.models.Employee1; /** * * @author User */ public class Manager extends Employee1{ public void rules() { } public void screams() { } }
[ "victor.militan@gmail.com" ]
victor.militan@gmail.com
ae24edb0ecefe67fa0c750fdce4af3840b05f719
0bcefd61a8378ec888803b286edc9152cfea98cc
/src/concurrent/singleton/Singleton1.java
856e8a9265af904a2623cf09b57db57727b06dd5
[]
no_license
LEEZONGYIN/AlgorithmPractice
ea3fb418ab6e5b6f418ca713e96a3b69c339438b
3496da1f527fa96c9ce030b1d6c6a7e8c0d0c91b
refs/heads/master
2021-07-18T15:51:34.666912
2020-09-04T10:17:50
2020-09-04T10:17:50
209,320,427
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package concurrent.singleton; /** * 双重校验锁 */ public class Singleton1 { private static Singleton1 INSTANCE = null; private Singleton1(){ } public Singleton1 getSingleton(){ if(INSTANCE==null){ synchronized(Singleton1.class){ if(INSTANCE==null){ INSTANCE = new Singleton1(); } } } return INSTANCE; } }
[ "673368374@qq.com" ]
673368374@qq.com
859ad66508a4b7fa1c0fdd67064c28367e3d550b
8ec9c8921ec3d6d3d313df8f500a97a5faf5b8a6
/factoryproject1706/guigu_service/src/main/java/com/guigu/service/impl/marketing/MarketServiceImpl.java
4af7b049a2a7ff344975a2b448dddd4beda1da8a
[]
no_license
johny751/StuMgr-Java
e4b28db6977efb6e8bca771d9aab6d9a0466672c
8d52c5d7a4351c0aeade72e0b9169c69c00b4bc6
refs/heads/master
2023-03-30T12:29:43.230846
2019-03-05T09:01:56
2019-03-05T09:01:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,601
java
package com.guigu.service.impl.marketing; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.guigu.dao.marketing.MarketMapper; import com.guigu.domain.marketing.Employee; import com.guigu.domain.marketing.PageInfo; import com.guigu.domain.marketing.Statistics; import com.guigu.domain.marketing.StatisticsSale; import com.guigu.domain.marketing.StatisticsSchool; import com.guigu.service.marketing.IMarketService; import com.guigu.util.PageHelpVO; @Service public class MarketServiceImpl implements IMarketService { @Autowired private MarketMapper marketMapper; /** * 查询所有市场人员统计招生情况 */ @Override public PageHelpVO querySale(int page, int rows) throws Exception { // TODO Auto-generated method stub PageHelpVO pageinfo = new PageHelpVO(); Page page2 = PageHelper.startPage(page, rows); List<Statistics> list = this.marketMapper.querySale(); System.out.println(list); pageinfo.setRows(list); pageinfo.setTotal(page2.getTotal()); return pageinfo; } /** * 查询生源地区/院校统计招生情况 */ @Override public PageHelpVO querySchool(int page, int rows) throws Exception { // TODO Auto-generated method stub PageHelpVO pageinfo = new PageHelpVO(); Page page3 = PageHelper.startPage(page, rows); List<StatisticsSchool> list = this.marketMapper.querySchool(); pageinfo.setRows(list); pageinfo.setTotal(page3.getTotal()); return pageinfo; } }
[ "103305656@example.com" ]
103305656@example.com
68d2244ec5dbee70b46432a97cf7106b232f1f06
4683677f52e69d47732260a758636cdf5c4457d7
/ch05/src/Ex10/Cylinder.java
555f27330ca032009a7df5c1d80ebd3a92c0401e
[]
no_license
potshow/work_java
e810243dba783cde7673a4fdb9eb091709ddb001
6b938eafee08811f115e90d9259ef0e0ae04e0c7
refs/heads/master
2021-09-05T17:41:15.318241
2018-01-30T00:49:00
2018-01-30T00:49:00
115,475,115
0
0
null
null
null
null
UTF-8
Java
false
false
1,285
java
package Ex10; public class Cylinder { Circle circle; double height; // 4번문제. public Cylinder(Circle circle, double height) { this.circle = circle; this.height = height; } public double getVolume() { double area = circle.getArea(); // 원 넓이를 구하고 double volume = area*this.height; return volume; } // 방법1 circle필드를 setter를 이용하여 초기화 public void setCircle(Circle circle) { this.circle = circle; } public void setHeight(double height) { this.height = height; } public static void main(String[] args) { // 1. 원을 만든다. Circle 클래스를 이용하여 객체 생성하기 Circle c1 = new Circle(2.8); // 2. 실린더를 만든다 //생성자를 통해서 바로 초기화를 했다 // c1 = circle(2.8) Cylinder cylinder = new Cylinder(new Circle(2.8), 5.6); /* cylinder.setCircle(c1); //cylinder객체의 circle필드를 초기화 cylinder.setHeight(5.6); //cylinder객체의 height필드를 초기화 */ System.out.println(cylinder.circle + " / " + cylinder.height); // 3. 실린더의 부피를 구하는 메소드를 호출 System.out.println("원통의 부피는 " + cylinder.getVolume() + "이다."); } }
[ "KOITT@KOITT-PC14" ]
KOITT@KOITT-PC14
2e8672629c259ec99941405ea0382af90c3e3147
e25162d2811aa6a59bb70390506ed487627ffa52
/app/src/main/java/com/example/dslab/personal_bio/TabFragment3.java
cb158a096c02aa95732740693c4b6e46259d3940
[]
no_license
ParvatiBinjawadgi/Personal_Bio
e00e4a80002a20caf7acba656d3c6533a971b8e1
7b9d2060641603a78478f8d7064319aeb2b94351
refs/heads/master
2020-03-24T03:00:00.505363
2018-07-26T06:42:37
2018-07-26T06:42:37
142,399,890
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
package com.example.dslab.personal_bio; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class TabFragment3 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.tab_fragment3, container, false); } }
[ "parwathibinjawadgi@gmail.com" ]
parwathibinjawadgi@gmail.com
9c5f93cd8415141f19233b07b192927cb913485c
b02be2a132fc40594f104d81333c49222175885d
/src/feture/offer/Offer05.java
39ad45e128d43bbe4091d61c604e3693ecd4db09
[]
no_license
xmzyjr/leetcode
2732a4627f555cc7129fa55842d836f5053b824f
4425439aa2f6ba3d561bfea1608cb5c999733abd
refs/heads/master
2021-06-10T21:15:07.451902
2021-05-30T05:12:57
2021-05-30T05:12:57
188,504,762
1
0
null
null
null
null
UTF-8
Java
false
false
486
java
package feture.offer; /** * @author lanshan */ public class Offer05 { public String replaceSpace(String s) { if (s == null || s.length() == 0) return s; char[] chars = s.toCharArray(); StringBuilder sb = new StringBuilder(); for (char aChar : chars) { if (aChar == ' ') { sb.append("%20"); } else { sb.append(aChar); } } return sb.toString(); } }
[ "yangjr@tuya.com" ]
yangjr@tuya.com