blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
0ac8e6bb972b1b98cc9e410a8d26678c2d45b65d
d24fc6913cbcd81bf37453ffcd13eb2b420d9e39
/src/projects/SDWSN/service/TypeSense.java
3a6e368cb858c716ac07b8345de16be001230350
[]
no_license
matheus013/jsensor-sdwsn
9abf017a7cb93c2971ec252a7aaa37364b9313e1
4fb13474f85c1caede56daa21f5210b5933aec8e
refs/heads/master
2020-05-18T01:19:53.479107
2019-07-23T19:54:49
2019-07-23T19:54:49
184,087,106
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package projects.SDWSN.service; public enum TypeSense { TEMPERATURE(1), LUMINOSITY(2), PRESSURE(3), HUMIDITY(4), INVALID(0); private int value; TypeSense(int value) { this.value = value; } }
[ "matheusinacio@Matheuss-MacBook-Pro-2.local" ]
matheusinacio@Matheuss-MacBook-Pro-2.local
3dd9a4022e8a58aed9d966d87bdea7f65012ed77
244f856fdabf2c294ced71489ea82aacbefaffcc
/Gamificator/Teaching-HEIGVD-AMT-2016-Gamification/ExecutableSpecification/src/test/java/ch/heigvd/amt/gamification/spec/SpecificationTest.java
84b3e74ddd72eeba0bac8d600e6790a3bfed0c60
[ "MIT" ]
permissive
sarrab/GamifyApp
5de5be5ce60e95ca0b783b2e658bceb4ea1c46a9
bb66bcaf7889d231e58d959f13fff793fb8e70ad
refs/heads/master
2020-07-23T09:13:51.214162
2017-01-27T14:49:28
2017-01-27T14:49:28
73,811,914
0
1
null
2017-01-25T23:07:10
2016-11-15T12:33:54
Java
UTF-8
Java
false
false
545
java
package ch.heigvd.amt.gamification.spec; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Olivier Liechti (olivier.liechti@heig-vd.ch) */ @RunWith(Cucumber.class) @CucumberOptions(features="src/test/resources/scenarios/", plugin = {"pretty", "html:target/cucumber"}) public class SpecificationTest { public SpecificationTest() { } /** * Test of main method, of class Specification. */ @Test public void testMain() { } }
[ "sarra.berrich@gmail.com" ]
sarra.berrich@gmail.com
2fe24a88acacde96103664c5e64557c70a4ffb25
d22d9d6bf1afc01731aeb782bbc5d4af7b1dc8f7
/app/src/main/java/com/gjzg/adapter/TInfoTaskInnerAdapter.java
6cb4984bb24a100ab34cd1df0ecf847cbc61c898
[]
no_license
yh392261226/o2o_android
11b4fb76ab4948f4f2e513ed78536363bcab526a
4fdb7a0616c15cece36b44641a23a973da5b4980
refs/heads/master
2020-04-23T21:32:53.499158
2017-12-01T09:02:08
2017-12-01T09:02:08
98,505,472
0
2
null
2017-12-01T09:02:09
2017-07-27T07:13:28
Java
UTF-8
Java
false
false
5,740
java
package com.gjzg.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.gjzg.R; import com.squareup.picasso.Picasso; import java.util.List; import com.gjzg.bean.TInfoOrderBean; import com.gjzg.config.ColorConfig; import com.gjzg.listener.TInfoClickHelp; import com.gjzg.view.CImageView; /** * Created by Administrator on 2017/11/5. */ //任务详情内部适配器 public class TInfoTaskInnerAdapter extends BaseAdapter { private Context context; private List<TInfoOrderBean> list; private TInfoClickHelp tInfoClickHelp; public TInfoTaskInnerAdapter(Context context, List<TInfoOrderBean> list, TInfoClickHelp tInfoClickHelp) { this.context = context; this.list = list; this.tInfoClickHelp = tInfoClickHelp; } @Override public int getCount() { return list == null ? 0 : list.size(); } @Override public Object getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.item_tinfotask_inner, null); holder = new ViewHolder(convertView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final TInfoOrderBean tInfoOrderBean = list.get(position); if (tInfoOrderBean != null) { Picasso.with(context).load(tInfoOrderBean.getU_img()).placeholder(R.mipmap.person_face_default).error(R.mipmap.person_face_default).into(holder.iconIv); String sex = tInfoOrderBean.getU_sex(); if (sex.equals("0")) { holder.sexIv.setImageResource(R.mipmap.female); } else if (sex.equals("1")) { holder.sexIv.setImageResource(R.mipmap.male); } String o_pay = tInfoOrderBean.getO_pay(); String o_status = tInfoOrderBean.getO_status(); String t_status = tInfoOrderBean.getU_task_status(); if (o_pay.equals("0")) { holder.mobileIv.setVisibility(View.VISIBLE); holder.mobileIv.setEnabled(true); holder.evaluateTv.setVisibility(View.GONE); if (t_status.equals("0")) { holder.statusTv.setText("洽谈中"); holder.statusTv.setBackgroundColor(ColorConfig.yellow_ffc822); } else { holder.statusTv.setText("工作中"); holder.statusTv.setBackgroundColor(ColorConfig.red_ff3e50); } } else { holder.mobileIv.setVisibility(View.GONE); holder.evaluateTv.setVisibility(View.VISIBLE); } if (o_status.equals("-1")) { holder.statusTv.setText("已辞职"); holder.statusTv.setBackgroundColor(ColorConfig.gray_c4ced3); holder.mobileIv.setEnabled(false); } else if (o_status.equals("-2")) { holder.statusTv.setText("已解雇"); holder.statusTv.setBackgroundColor(ColorConfig.gray_c4ced3); holder.mobileIv.setEnabled(false); } holder.nameTv.setText(tInfoOrderBean.getU_true_name()); holder.skillTv.setText(tInfoOrderBean.getSkill()); } final int innerPos = position; final int llId = holder.ll.getId(); final int mobileId = holder.mobileIv.getId(); final int evaluateId = holder.evaluateTv.getId(); final String orderId = tInfoOrderBean.getO_id(); holder.ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tInfoClickHelp.onClick(llId, 0, innerPos, orderId); } }); holder.mobileIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tInfoClickHelp.onClick(mobileId, 0, innerPos, orderId); } }); holder.evaluateTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tInfoClickHelp.onClick(evaluateId, 0, innerPos, orderId); } }); return convertView; } private class ViewHolder { private LinearLayout ll; private CImageView iconIv, mobileIv; private ImageView sexIv; private TextView nameTv, skillTv, statusTv, evaluateTv; public ViewHolder(View itemView) { ll = (LinearLayout) itemView.findViewById(R.id.ll_item_tinfotask_inner); iconIv = (CImageView) itemView.findViewById(R.id.iv_item_tinfotask_inner_icon); mobileIv = (CImageView) itemView.findViewById(R.id.iv_item_tinfotask_inner_mobile); sexIv = (ImageView) itemView.findViewById(R.id.iv_item_tinfotask_inner_sex); nameTv = (TextView) itemView.findViewById(R.id.tv_item_tinfotask_inner_name); skillTv = (TextView) itemView.findViewById(R.id.tv_item_tinfotask_inner_skill); statusTv = (TextView) itemView.findViewById(R.id.tv_item_tinfotask_inner_status); evaluateTv = (TextView) itemView.findViewById(R.id.tv_item_tinfotask_inner_evaluate); } } }
[ "smm15045281940@163.com" ]
smm15045281940@163.com
f845ddf78595aa9cd7be4e2ebb08719c2e5f6b15
6ee92ecc85ba29f13769329bc5a90acea6ef594f
/bizcore/WEB-INF/retailscm_core_src/com/doublechaintech/retailscm/accountingperiod/AccountingPeriodSerializer.java
8f5dd1d3cf5419addc93fedef7b6252b03e65cb2
[]
no_license
doublechaintech/scm-biz-suite
b82628bdf182630bca20ce50277c41f4a60e7a08
52db94d58b9bd52230a948e4692525ac78b047c7
refs/heads/master
2023-08-16T12:16:26.133012
2023-05-26T03:20:08
2023-05-26T03:20:08
162,171,043
1,387
500
null
2023-07-08T00:08:42
2018-12-17T18:07:12
Java
UTF-8
Java
false
false
793
java
package com.doublechaintech.retailscm.accountingperiod; import java.io.IOException; import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.SerializerProvider; import com.doublechaintech.retailscm.RetailscmObjectPlainCustomSerializer; public class AccountingPeriodSerializer extends RetailscmObjectPlainCustomSerializer<AccountingPeriod> { @Override public void serialize( AccountingPeriod accountingPeriod, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { Map<String, Object> ctx = new HashMap<>(); this.writeBaseEntityField(jgen, null, accountingPeriod, provider, ctx); } }
[ "zhangxilai@doublechaintech.com" ]
zhangxilai@doublechaintech.com
6e9fd5ade0422e4a0ceaaf116afb8237b2707e39
2a448b2ca4dba7beea5f9f69f3777819fc1562b4
/src/exercicio_08/Principal.java
c2dca8544767199dd0d4f9cacc13d4aacabaa7d0
[]
no_license
VitorEduard/interfaceGrafica
0ed8dde7848cd2974012406439a2457a38767860
e5f1e2d1b8f9ceeff22c2bcd0b40c5f6d0a08fbd
refs/heads/master
2020-03-17T22:20:08.906427
2018-05-18T20:27:39
2018-05-18T20:27:39
133,999,520
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package exercicio_08; public class Principal { public static void main(String[] args) { } }
[ "104906@SALA107.proway.treina" ]
104906@SALA107.proway.treina
ef98b122af040b6400057fcbc223f6e30f6c7d41
1740a89a84acbba02436d4af1874c248e02d79f7
/src/main/java/br/com/next/repositories/IRepositorySenha.java
61109049c55027eaa670c14afae36ea00ed4da85
[ "Apache-2.0" ]
permissive
felansu/Next-Sistema-de-fila-para-atendimento-em-caixas
f4ab902bf4c4126f91182bba788b900c6d52cab2
c5b223915d7bb9d9098cf24e8c7092d7cff1c454
refs/heads/master
2021-05-29T22:32:01.680384
2015-07-19T19:58:48
2015-07-19T19:58:48
36,097,418
2
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
package br.com.next.repositories; import java.util.List; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import br.com.next.model.Senha; import br.com.next.repositories.custom.IRepositorySenhaCustom; @RepositoryRestResource(collectionResourceRel = "senha", path = "senha") public interface IRepositorySenha extends CrudRepository<Senha, Long>, IRepositorySenhaCustom { @Query("SELECT T1 FROM Senha T1 WHERE foiAtendido = false ORDER BY T1.dataEmissao ASC") List<Senha> senhasAguardando(); /** * Tipo 0 == Senha comum || Tipo 1 == Senha preferencial */ @Query("SELECT T1.senha FROM Senha T1 WHERE T1.tipo = '0' AND foiAtendido = false ORDER BY T1.dataEmissao ASC") List<Senha> senhasComunsAguardando(); @Query("SELECT T1.senha FROM Senha T1 WHERE T1.tipo = '1' AND foiAtendido = false ORDER BY T1.dataEmissao ASC") List<Senha> senhasPreferenciaisAguardando(); @Query("SELECT T1 FROM Senha T1 WHERE T1.id = (SELECT MAX(id) FROM Senha)") Senha trazerUltimaSenha(); @Query("SELECT T1 FROM Senha T1 WHERE T1.id = (SELECT MIN(id) FROM Senha WHERE foiAtendido = false)") Senha trazerPrimeiraSenha(); @Query("SELECT T1 FROM Senha T1 WHERE T1.id = (SELECT MIN(id) FROM Senha WHERE foiAtendido = false AND tipo = '1')") Senha trazerPrimeiraSenhaPreferencial(); }
[ "gaferran@gmail.com" ]
gaferran@gmail.com
1cfb7fc84cd6df241f21a8da875cac6936bf1099
332769f8f73eaafab9f134ac03f5d8dfd7c2eb3d
/src/zen/codegen/jvm/JavaImportNode.java
88cfce68a9d7efca41a137fafec3175856ae80ff
[ "BSD-3-Clause" ]
permissive
konoha-project/libzen
45f1986f6fa35eb45d43cd05aa54ae027b179696
f386b31b14d8e3ecfbc35a190be0453023350d81
refs/heads/master
2020-05-23T15:35:36.733950
2014-03-30T20:38:42
2014-03-30T20:38:42
15,700,981
0
0
NOASSERTION
2022-11-24T10:00:27
2014-01-07T10:01:42
JavaScript
UTF-8
Java
false
false
1,187
java
package zen.codegen.jvm; import zen.ast.ZNode; import zen.ast.ZTopLevelNode; import zen.parser.ZLogger; import zen.parser.ZNameSpace; import zen.type.ZType; import zen.util.Var; public class JavaImportNode extends ZTopLevelNode { public final static int _Path = 0; public JavaImportNode(ZNode ParentNode) { super(ParentNode, null, 1); } // private String ParsePath(String Path) { // @Var int loc = Path.lastIndexOf('.'); // if(loc != -1) { // return Path.substring(0, loc); // } // return Path; // } private String ParseSymbol(String Path) { @Var int loc = Path.lastIndexOf('.'); if(loc != -1) { return Path.substring(loc+1); } return Path; } @Override public void Perform(ZNameSpace NameSpace) { @Var String ResourcePath = this.AST[JavaImportNode._Path].SourceToken.GetTextAsName(); try { Class<?> jClass = Class.forName(ResourcePath); ZType Type = JavaTypeTable.GetZenType(jClass); String Alias = this.ParseSymbol(ResourcePath); NameSpace.SetTypeName(Alias, Type, this.SourceToken); } catch (ClassNotFoundException e) { ZLogger._LogError(this.GetAstToken(JavaImportNode._Path), "unfound resource: "+ ResourcePath); } } }
[ "kimio@konohascript.org" ]
kimio@konohascript.org
099d909c64ee0e9e426d174acd5164ef7ef16c53
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Lang-4/org.apache.commons.lang3.text.translate.LookupTranslator/BBC-F0-opt-20/tests/4/org/apache/commons/lang3/text/translate/LookupTranslator_ESTest.java
62293fcd2b7d784c99361533fdaff5ab7cf4663d
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
8,889
java
/* * This file was automatically generated by EvoSuite * Tue Oct 19 00:17:08 GMT 2021 */ package org.apache.commons.lang3.text.translate; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.io.StringWriter; import java.io.Writer; import java.nio.CharBuffer; import org.apache.commons.lang3.text.translate.LookupTranslator; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class LookupTranslator_ESTest extends LookupTranslator_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[3][1]; CharSequence[] charSequenceArray1 = new CharSequence[3]; CharBuffer charBuffer0 = CharBuffer.allocate(0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray1[1] = (CharSequence) "594"; charSequenceArray0[0] = charSequenceArray1; charSequenceArray0[1] = charSequenceArray1; CharSequence[] charSequenceArray2 = new CharSequence[8]; charSequenceArray2[0] = (CharSequence) "FFFFEDF3"; charSequenceArray0[2] = charSequenceArray2; LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0); StringWriter stringWriter0 = new StringWriter(); CharBuffer charBuffer1 = CharBuffer.allocate(2712); int int0 = lookupTranslator0.translate((CharSequence) charBuffer1, 0, (Writer) stringWriter0); assertEquals("594", stringWriter0.toString()); assertEquals(0, int0); } @Test(timeout = 4000) public void test1() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[3][1]; CharSequence[] charSequenceArray1 = new CharSequence[3]; CharBuffer charBuffer0 = CharBuffer.allocate(0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray0[0] = charSequenceArray1; CharSequence[] charSequenceArray2 = new CharSequence[8]; charSequenceArray2[0] = (CharSequence) "FFFFEDF3"; CharSequence[][] charSequenceArray3 = new CharSequence[5][3]; charSequenceArray3[0] = charSequenceArray0[0]; charSequenceArray3[1] = charSequenceArray2; charSequenceArray3[2] = charSequenceArray1; LookupTranslator lookupTranslator0 = null; try { lookupTranslator0 = new LookupTranslator(charSequenceArray3); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.lang3.text.translate.LookupTranslator", e); } } @Test(timeout = 4000) public void test2() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[3][1]; CharSequence[] charSequenceArray1 = new CharSequence[3]; CharBuffer charBuffer0 = CharBuffer.allocate(0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray0[0] = charSequenceArray1; charSequenceArray0[1] = charSequenceArray1; charSequenceArray0[2] = charSequenceArray0[1]; LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0); StringWriter stringWriter0 = new StringWriter(); // Undeclared exception! try { lookupTranslator0.translate((CharSequence) "179", (-1786), (Writer) stringWriter0); fail("Expecting exception: StringIndexOutOfBoundsException"); } catch(StringIndexOutOfBoundsException e) { } } @Test(timeout = 4000) public void test3() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[1][3]; CharSequence[] charSequenceArray1 = new CharSequence[2]; char[] charArray0 = new char[1]; CharBuffer charBuffer0 = CharBuffer.wrap(charArray0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray1[1] = (CharSequence) charBuffer0; charSequenceArray0[0] = charSequenceArray1; LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0); StringWriter stringWriter0 = new StringWriter(); // Undeclared exception! try { lookupTranslator0.translate(charSequenceArray1[1], Integer.MAX_VALUE, (Writer) stringWriter0); fail("Expecting exception: IndexOutOfBoundsException"); } catch(IndexOutOfBoundsException e) { // // no message in exception (getMessage() returned null) // verifyException("java.nio.HeapCharBuffer", e); } } @Test(timeout = 4000) public void test4() throws Throwable { CharBuffer charBuffer0 = CharBuffer.allocate(4095); CharBuffer charBuffer1 = CharBuffer.wrap((CharSequence) charBuffer0); CharSequence[][] charSequenceArray0 = new CharSequence[2][4]; CharSequence[] charSequenceArray1 = new CharSequence[7]; charSequenceArray1[0] = (CharSequence) charBuffer1; charBuffer0.put('#'); charSequenceArray0[0] = charSequenceArray1; LookupTranslator lookupTranslator0 = null; try { lookupTranslator0 = new LookupTranslator(charSequenceArray0); fail("Expecting exception: IndexOutOfBoundsException"); } catch(IndexOutOfBoundsException e) { // // no message in exception (getMessage() returned null) // verifyException("java.nio.Buffer", e); } } @Test(timeout = 4000) public void test5() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[3][1]; CharSequence[] charSequenceArray1 = new CharSequence[3]; CharBuffer charBuffer0 = CharBuffer.allocate(0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray0[0] = charSequenceArray1; charSequenceArray0[1] = charSequenceArray1; CharSequence[] charSequenceArray2 = new CharSequence[8]; charSequenceArray2[0] = (CharSequence) "FFFFEDF3"; charSequenceArray2[1] = (CharSequence) "594"; charSequenceArray2[3] = (CharSequence) "FFFFEDF3"; charSequenceArray0[2] = charSequenceArray2; LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0); StringWriter stringWriter0 = new StringWriter(); int int0 = lookupTranslator0.translate(charSequenceArray2[3], 0, (Writer) stringWriter0); assertEquals("594", stringWriter0.toString()); assertEquals(8, int0); } @Test(timeout = 4000) public void test6() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[3][1]; CharSequence[] charSequenceArray1 = new CharSequence[3]; CharBuffer charBuffer0 = CharBuffer.allocate(0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray0[0] = charSequenceArray1; charSequenceArray0[1] = charSequenceArray0[0]; charSequenceArray0[2] = charSequenceArray0[0]; LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0); StringWriter stringWriter0 = new StringWriter(); int int0 = lookupTranslator0.translate(charSequenceArray1[0], 168, (Writer) stringWriter0); assertEquals(0, int0); } @Test(timeout = 4000) public void test7() throws Throwable { CharSequence[][] charSequenceArray0 = new CharSequence[3][1]; CharSequence[] charSequenceArray1 = new CharSequence[3]; CharBuffer charBuffer0 = CharBuffer.allocate(0); charSequenceArray1[0] = (CharSequence) charBuffer0; charSequenceArray0[0] = charSequenceArray1; charSequenceArray0[1] = charSequenceArray1; LookupTranslator lookupTranslator0 = null; try { lookupTranslator0 = new LookupTranslator(charSequenceArray0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 1 // verifyException("org.apache.commons.lang3.text.translate.LookupTranslator", e); } } @Test(timeout = 4000) public void test8() throws Throwable { LookupTranslator lookupTranslator0 = new LookupTranslator((CharSequence[][]) null); StringWriter stringWriter0 = new StringWriter(); // Undeclared exception! try { lookupTranslator0.translate((CharSequence) null, (-1885), (Writer) stringWriter0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.lang3.text.translate.LookupTranslator", e); } } }
[ "pderakhshanfar@serg2.ewi.tudelft.nl" ]
pderakhshanfar@serg2.ewi.tudelft.nl
1d58d58741706fb8ab0db5a6edf51c1487556654
eee474dd5c97109436231958fdfe0a80331b6931
/elevate/src/main/java/com/ilyabuglakov/elevate/model/authentication/Permission.java
96ea60425467a6890f5ff7d9ebf386fc09916131
[]
no_license
Sintexer/elevate
9fa9e337baff5a03bfe6e540bc1f6ef214509389
91c662f6412196282d14e0d286fc0a3210efe861
refs/heads/master
2023-02-02T01:57:30.543028
2020-12-15T19:15:05
2020-12-15T19:15:05
317,035,850
1
1
null
2020-12-14T21:14:48
2020-11-29T20:20:42
Java
UTF-8
Java
false
false
343
java
package com.ilyabuglakov.elevate.model.authentication; public enum Permission { DEV_READ("dev:read"), DEV_EDIT("dev:edit"), AUTH("auth"); private final String permission; Permission(String permission) { this.permission = permission; } public String getPermission() { return permission; } }
[ "Neonlightnight@gmail.com" ]
Neonlightnight@gmail.com
c197761f352bca83a4242a61a7b6ad6a28769a4c
e9e7e213c86d25e0d513fc1a9b4c5c316466c30d
/src/main/java/DataAccess/SQLMapping.java
ce0a8fbc1d3063f73bd177695efd705acfb8fed0
[]
no_license
KevinMertTuran/GutenbergApplicationGF-1
44f84db9cc0f1dd5317d32418bbad94d6cb04eac
fb5f109babc0de377011f20a6a753dc89105b510
refs/heads/master
2020-01-19T21:40:02.457342
2017-05-26T15:42:42
2017-05-26T15:42:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,844
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 DataAccess; import DTO.DTOAuthorBook; import DTO.DTOBookLocation; import DTO.DTOLocation; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; public class SQLMapping { // 1. Given a city name your application returns all book titles with // corresponding authors that mention this city. public Collection<DTOAuthorBook> getAllBookTitleWithAuthorByCityName(Connection con, String tempLocation) { Collection<DTOAuthorBook> books = new ArrayList<>(); String SQLString1 = "SELECT DISTINCT b.title, a.name FROM author a, book b, location l, book_location bl, author_book ab" + " WHERE l.name = ? AND l.UID = bl.UIDlocations AND bl.UIDbooks = b.UID AND" + " b.UID = ab.UIDbook AND ab.UIDauthor = a.UID"; PreparedStatement statement = null; try { statement = con.prepareStatement(SQLString1); statement.setString(1, tempLocation); ResultSet rs = statement.executeQuery(); while (rs.next()) { books.add(new DTOAuthorBook(rs.getString("title"), rs.getString("name"))); } for (DTOAuthorBook x : books) { System.out.println("Book title " + x.getTitle() + " - Author: " + x.getAuthor()); } } catch (Exception e) { System.out.println("Fail in Mapping"); System.out.println(e.getMessage()); } finally { try { statement.close(); } catch (SQLException e) { System.out.println("Fail in closing connection"); System.out.println(e.getMessage()); } } return books; } // Given a book title, your application plots all cities mentioned in this book onto a map. public Collection<DTOBookLocation> getAllLocationByBookTitle(Connection con, String title) { Collection<DTOBookLocation> locations = new ArrayList<>(); String SQLString1 = "SELECT DISTINCT book.title, l.name FROM location l" + " INNER JOIN book_location ON book_location.UIDlocations = l.UID" + " INNER JOIN author_book ON author_book.UIDbook = book_location.UIDbooks" + " INNER JOIN author ON author.UID = author_book.UIDauthor" + " INNER JOIN book ON book.UID = author_book.UIDbook" + " WHERE book.title = ?"; PreparedStatement statement = null; try { statement = con.prepareStatement(SQLString1); statement.setString(1, title); ResultSet rs = statement.executeQuery(); while (rs.next()) { locations.add(new DTOBookLocation(rs.getString("title"), rs.getString("name"))); } for (DTOBookLocation x : locations) { System.out.println("Book title: " + x.getTitle() + " Location name: " + x.getName()); } } catch (Exception e) { System.out.println("Fail in Mapping"); System.out.println(e.getMessage()); } finally { try { statement.close(); } catch (SQLException e) { System.out.println("Fail in closing connection"); System.out.println(e.getMessage()); } } return locations; } //Given an author name your application lists all books written by that author and plots all cities mentioned in any of the books onto a map. public Collection<DTOAuthorBook> getAllBooksAndCitiesByAuthorName(Connection con, String author) { Collection<DTOAuthorBook> books = new ArrayList<>(); Collection<DTOLocation> locations = new ArrayList<>(); String SQLString1 = "SELECT book.title, author.name FROM book " + "INNER JOIN author_book ON author_book.UIDbook = book.UID " + "INNER JOIN author ON author.UID = author_book.UIDauthor " + "where author.name = ?"; PreparedStatement statement = null; try { statement = con.prepareStatement(SQLString1); statement.setString(1, author); ResultSet rs = statement.executeQuery(); while (rs.next()) { String title = rs.getString("title"); String authorInBook = rs.getString("name"); String SQLString2 = "SELECT location.name FROM book " + "INNER JOIN book_location ON book_location.UIDbooks = book.UID " + "INNER JOIN location ON location.UID = book_location.UIDlocations " + "WHERE book.title = ?"; PreparedStatement statement2 = null; statement2 = con.prepareStatement(SQLString2); statement2.setString(1, rs.getString("title")); ResultSet rs2 = statement2.executeQuery(); DTOAuthorBook dtoAuthorBook = new DTOAuthorBook(title, authorInBook); while (rs2.next()) { locations.add(new DTOLocation(rs2.getString("name"))); } dtoAuthorBook.setLocations(locations); books.add(dtoAuthorBook); } for (DTOAuthorBook x : books) { System.out.println("Book title: " + x.getTitle()); } for (DTOLocation z : locations) { System.out.println("Locations: " + z.getName()); } } catch (Exception e) { System.out.println("Fail in Mapping"); System.out.println(e.getMessage()); } finally { try { statement.close(); } catch (SQLException e) { System.out.println("Fail in closing connection"); System.out.println(e.getMessage()); } } return books; } // Given a geolocation, your application lists all books mentioning a city in vicinity of the given geolocation. public Collection<DTOAuthorBook> getAllBooksByGeolocation(Connection con, String latitude, String longitude) { Collection<DTOAuthorBook> books = new ArrayList<>(); int radius = 10000; String SQLString1 = "SELECT book.title FROM book " + "INNER JOIN book_location ON book_location.UIDbooks = book.UID " + "INNER JOIN location ON book_location.UIDlocations = location.UID " + "WHERE location.latitude = ? && location.longitude=?"; PreparedStatement statement = null; try { statement = con.prepareStatement(SQLString1); statement.setString(1, latitude); statement.setString(2, longitude); ResultSet rs = statement.executeQuery(); while (rs.next()) { books.add(new DTOAuthorBook(rs.getString("title"))); } for (DTOAuthorBook z : books) { System.out.println("Book titles: " + z.getTitle()); } } catch (Exception e) { System.out.println("Fail in Mapping"); System.out.println(e.getMessage()); } finally { try { statement.close(); } catch (SQLException e) { System.out.println("Fail in closing connection"); System.out.println(e.getMessage()); } } return books; } }
[ "star1994@hotmail.dk" ]
star1994@hotmail.dk
ffe00fa0bc5e63666edc9df92198c11282dc2b08
5e11e0cb2646dccdd1b44e59a5e4ae048d7d13ed
/android/app/src/main/java/com/trakus/MainActivity.java
b3e105640d50ae37986cd2a6e210da8a2711e58b
[]
no_license
Teepheh-Git/Trakus
47df679ed621775f275e9076ee0e798d279a6aed
dc6fe3894ed9685037215d6a44aa0d99355bb4b6
refs/heads/master
2023-08-22T15:18:51.185979
2021-10-07T18:49:55
2021-10-07T18:49:55
414,387,762
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.trakus; import android.os.Bundle; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "Trakus"; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(null); } }
[ "81614588+Teepheh-Git@users.noreply.github.com" ]
81614588+Teepheh-Git@users.noreply.github.com
012169c2d5e6edaa135fed9d04f98240a2471aff
dd3241e7aa488ab8eb680f1a80547e3a429656c9
/Factory/example/SimplePizzaFactory.java
20cfd3f0a14135dcf79f1dc2f0f2ef22bf980788
[]
no_license
mrmabo/DesignPatternsForJava
4c34e3f83a9b50e9deaa83fea081128e85886318
432b4984c44bb65d4d75fa309f68cfb0813964cc
refs/heads/master
2021-07-12T19:49:31.538127
2017-10-13T19:47:37
2017-10-13T19:47:37
106,362,232
3
0
null
null
null
null
UTF-8
Java
false
false
717
java
package Factory.example; public class SimplePizzaFactory implements PizzaFactory { //This factory should often times by singleton private static PizzaFactory factory = new SimplePizzaFactory(); private SimplePizzaFactory() {} public static PizzaFactory getFactory(){ return factory; } @Override public Pizza createPizza(String type) { Pizza pizza = null; if(type.equalsIgnoreCase("cheese")){ pizza = new CheesePizza(); } else if(type.equalsIgnoreCase("clam")){ pizza = new PepperoniPizza(); } else if(type.equalsIgnoreCase("pepperoni")){ pizza = new PepperoniPizza(); } return pizza; } }
[ "dtmbo@hotmail.com" ]
dtmbo@hotmail.com
59b22c03e9d04bfd7908932f2dc929ed04cf9ab6
4d6f449339b36b8d4c25d8772212bf6cd339f087
/netreflected/src/Core/System.Data.Common,Version=4.2.2.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a/system/data/common/DbDataReader.java
ed5e3bd6d252d0f7532caf522e4011ecf1ef367d
[ "MIT" ]
permissive
lvyitian/JCOReflector
299a64550394db3e663567efc6e1996754f6946e
7e420dca504090b817c2fe208e4649804df1c3e1
refs/heads/master
2022-12-07T21:13:06.208025
2020-08-28T09:49:29
2020-08-28T09:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,510
java
/* * MIT License * * Copyright (c) 2020 MASES s.r.l. * * 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. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.data.common; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section import system.MarshalByRefObject; import system.Single; import system.data.common.DbDataReader; import system.data.DataTable; import system.DateTime; import system.Decimal; import system.Guid; import system.io.Stream; import system.io.TextReader; import system.threading.tasks.Task; import system.threading.tasks.ValueTask; /** * The base .NET class managing System.Data.Common.DbDataReader, System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Extends {@link NetObject}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Data.Common.DbDataReader" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Data.Common.DbDataReader</a> */ public class DbDataReader extends MarshalByRefObject { /** * Fully assembly qualified name: System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a */ public static final String assemblyFullName = "System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; /** * Assembly name: System.Data.Common */ public static final String assemblyShortName = "System.Data.Common"; /** * Qualified class name: System.Data.Common.DbDataReader */ public static final String className = "System.Data.Common.DbDataReader"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); } catch (JCException e) { return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } public DbDataReader(Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link DbDataReader}, a cast assert is made to check if types are compatible. */ public static DbDataReader cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new DbDataReader(from.getJCOInstance()); } // Constructors section public DbDataReader() throws Throwable { } // Methods section public boolean GetBoolean(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("GetBoolean", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean IsDBNull(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("IsDBNull", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean NextResult() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("NextResult"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean Read() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("Read"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte GetByte(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (byte)classInstance.Invoke("GetByte", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public char GetChar(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (char)classInstance.Invoke("GetChar", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public double GetDouble(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (double)classInstance.Invoke("GetDouble", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public short GetInt16(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (short)classInstance.Invoke("GetInt16", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int GetInt32(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Invoke("GetInt32", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int GetOrdinal(java.lang.String name) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Invoke("GetOrdinal", name); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int GetProviderSpecificValues(NetObject[] values) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Invoke("GetProviderSpecificValues", (Object)toObjectFromArray(values)); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int GetValues(NetObject[] values) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Invoke("GetValues", (Object)toObjectFromArray(values)); } catch (JCNativeException jcne) { throw translateException(jcne); } } public long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (long)classInstance.Invoke("GetBytes", ordinal, dataOffset, buffer, bufferOffset, length); } catch (JCNativeException jcne) { throw translateException(jcne); } } public long GetBytes(int dupParam0, long dupParam1, JCRefOut dupParam2, int dupParam3, int dupParam4) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (long)classInstance.Invoke("GetBytes", dupParam0, dupParam1, dupParam2, dupParam3, dupParam4); } catch (JCNativeException jcne) { throw translateException(jcne); } } public long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (long)classInstance.Invoke("GetChars", ordinal, dataOffset, buffer, bufferOffset, length); } catch (JCNativeException jcne) { throw translateException(jcne); } } public long GetChars(int dupParam0, long dupParam1, JCRefOut dupParam2, int dupParam3, int dupParam4) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (long)classInstance.Invoke("GetChars", dupParam0, dupParam1, dupParam2, dupParam3, dupParam4); } catch (JCNativeException jcne) { throw translateException(jcne); } } public long GetInt64(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (long)classInstance.Invoke("GetInt64", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Single GetFloat(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetFloat = (JCObject)classInstance.Invoke("GetFloat", ordinal); return new Single(objGetFloat); } catch (JCNativeException jcne) { throw translateException(jcne); } } public DbDataReader GetData(int ordinal) throws Throwable, system.ArgumentException, system.IndexOutOfRangeException, system.NotSupportedException, system.ArgumentNullException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.PlatformNotSupportedException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetData = (JCObject)classInstance.Invoke("GetData", ordinal); return new DbDataReader(objGetData); } catch (JCNativeException jcne) { throw translateException(jcne); } } public DataTable GetSchemaTable() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.NotSupportedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetSchemaTable = (JCObject)classInstance.Invoke("GetSchemaTable"); return new DataTable(objGetSchemaTable); } catch (JCNativeException jcne) { throw translateException(jcne); } } public DateTime GetDateTime(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetDateTime = (JCObject)classInstance.Invoke("GetDateTime", ordinal); return new DateTime(objGetDateTime); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Decimal GetDecimal(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetDecimal = (JCObject)classInstance.Invoke("GetDecimal", ordinal); return new Decimal(objGetDecimal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Guid GetGuid(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetGuid = (JCObject)classInstance.Invoke("GetGuid", ordinal); return new Guid(objGetGuid); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Stream GetStream(int ordinal) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.IndexOutOfRangeException, system.NotSupportedException, system.ArgumentNullException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.globalization.CultureNotFoundException, system.PlatformNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetStream = (JCObject)classInstance.Invoke("GetStream", ordinal); return new Stream(objGetStream); } catch (JCNativeException jcne) { throw translateException(jcne); } } public TextReader GetTextReader(int ordinal) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.IndexOutOfRangeException, system.NotSupportedException, system.ArgumentNullException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.globalization.CultureNotFoundException, system.PlatformNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetTextReader = (JCObject)classInstance.Invoke("GetTextReader", ordinal); return new TextReader(objGetTextReader); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NetObject GetProviderSpecificValue(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetProviderSpecificValue = (JCObject)classInstance.Invoke("GetProviderSpecificValue", ordinal); return new NetObject(objGetProviderSpecificValue); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NetObject GetValue(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetValue = (JCObject)classInstance.Invoke("GetValue", ordinal); return new NetObject(objGetValue); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String GetDataTypeName(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Invoke("GetDataTypeName", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String GetName(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Invoke("GetName", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String GetString(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Invoke("GetString", ordinal); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task CloseAsync() throws Throwable, system.NotSupportedException, system.ArgumentNullException, system.ArgumentException, system.PlatformNotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.threading.SynchronizationLockException, system.IndexOutOfRangeException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objCloseAsync = (JCObject)classInstance.Invoke("CloseAsync"); return new Task(objCloseAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ValueTask DisposeAsync() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objDisposeAsync = (JCObject)classInstance.Invoke("DisposeAsync"); return new ValueTask(objDisposeAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NetType GetFieldType(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetFieldType = (JCObject)classInstance.Invoke("GetFieldType", ordinal); return new NetType(objGetFieldType); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NetType GetProviderSpecificFieldType(int ordinal) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetProviderSpecificFieldType = (JCObject)classInstance.Invoke("GetProviderSpecificFieldType", ordinal); return new NetType(objGetProviderSpecificFieldType); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Close() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Close"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Dispose() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Dispose"); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Properties section public boolean getHasRows() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("HasRows"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean getIsClosed() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("IsClosed"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int getDepth() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Get("Depth"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int getFieldCount() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Get("FieldCount"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int getRecordsAffected() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Get("RecordsAffected"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int getVisibleFieldCount() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Get("VisibleFieldCount"); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }
[ "mario.mastrodicasa@masesgroup.com" ]
mario.mastrodicasa@masesgroup.com
5ac196a35817209bdcb12dd5470a24184ed735a9
5dd2ec8717248d25c502a7e73182be11dd249fb3
/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncErrorPromptUtils.java
bb296b62c31d92229b314e5d100d957cebe77d5f
[ "BSD-3-Clause" ]
permissive
sunnyps/chromium
32491c4799a2802fe6ece0c05fb23e00d88020e6
9550e527d46350377a6e84cd6e09e1b32bf2d936
refs/heads/main
2023-08-30T10:34:39.941312
2021-10-09T20:13:18
2021-10-09T20:13:18
217,597,965
0
0
BSD-3-Clause
2021-09-28T18:16:02
2019-10-25T19:01:58
null
UTF-8
Java
false
false
11,809
java
// Copyright 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.sync.ui; import static org.chromium.base.ContextUtils.getApplicationContext; import static org.chromium.chrome.browser.preferences.ChromePreferenceKeys.SYNC_ERROR_PROMPT_SHOWN_AT_TIME; import android.content.Context; import androidx.annotation.IntDef; import androidx.annotation.VisibleForTesting; import org.chromium.base.IntentUtils; import org.chromium.base.Log; import org.chromium.chrome.R; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.sync.SyncService; import org.chromium.chrome.browser.sync.TrustedVaultClient; import org.chromium.chrome.browser.sync.settings.ManageSyncSettings; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils.SyncError; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.signin.base.CoreAccountInfo; import org.chromium.components.sync.TrustedVaultUserActionTriggerForUMA; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.concurrent.TimeUnit; /** * Shared code between the old {@link org.chromium.chrome.browser.infobar.SyncErrorInfobar} * and the new UI based on {@link SyncErrorMessage}. * * TODO(crbug.com/1246073): make private as methods of message ui controller once the migration to * the new UI is completed. */ public class SyncErrorPromptUtils { @VisibleForTesting public static final long MINIMAL_DURATION_BETWEEN_UI_MS = TimeUnit.MILLISECONDS.convert(24, TimeUnit.HOURS); @IntDef({SyncErrorPromptType.NOT_SHOWN, SyncErrorPromptType.AUTH_ERROR, SyncErrorPromptType.PASSPHRASE_REQUIRED, SyncErrorPromptType.SYNC_SETUP_INCOMPLETE, SyncErrorPromptType.CLIENT_OUT_OF_DATE, SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING, SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS, SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING, SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS}) @Retention(RetentionPolicy.SOURCE) public @interface SyncErrorPromptType { int NOT_SHOWN = -1; int AUTH_ERROR = 0; int PASSPHRASE_REQUIRED = 1; int SYNC_SETUP_INCOMPLETE = 2; int CLIENT_OUT_OF_DATE = 3; int TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING = 4; int TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS = 5; int TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING = 6; int TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS = 7; } // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. @IntDef({SyncErrorPromptAction.SHOWN, SyncErrorPromptAction.DISMISSED, SyncErrorPromptAction.BUTTON_CLICKED, SyncErrorPromptAction.NUM_ENTRIES}) @Retention(RetentionPolicy.SOURCE) public @interface SyncErrorPromptAction { int SHOWN = 0; int DISMISSED = 1; int BUTTON_CLICKED = 2; int NUM_ENTRIES = 3; } private static final String TAG = "SyncErrorPromptUtils"; public static String getTitle(Context context, @SyncError int error) { // Use the same title with sync error card of sync settings. return SyncSettingsUtils.getSyncErrorCardTitle(context, error); } public static String getPrimaryButtonText(Context context, @SyncError int error) { switch (error) { case SyncError.TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING: case SyncError.TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS: case SyncError.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING: case SyncError.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS: return context.getString(R.string.trusted_vault_error_card_button); default: return context.getString(R.string.open_settings_button); } } public static String getErrorMessage(Context context, @SyncError int error) { return (error == SyncError.SYNC_SETUP_INCOMPLETE) ? context.getString(R.string.sync_settings_not_confirmed_title) : SyncSettingsUtils.getSyncErrorHint(context, error); } @SyncErrorPromptType public static int getSyncErrorUiType(@SyncError int error) { switch (error) { case SyncError.AUTH_ERROR: return SyncErrorPromptType.AUTH_ERROR; case SyncError.PASSPHRASE_REQUIRED: return SyncErrorPromptType.PASSPHRASE_REQUIRED; case SyncError.SYNC_SETUP_INCOMPLETE: return SyncErrorPromptType.SYNC_SETUP_INCOMPLETE; case SyncError.CLIENT_OUT_OF_DATE: return SyncErrorPromptType.CLIENT_OUT_OF_DATE; case SyncError.TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING: return SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING; case SyncError.TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS: return SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS; case SyncError.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING: return SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING; case SyncError.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS: return SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS; default: return SyncErrorPromptType.NOT_SHOWN; } } public static void onUserAccepted(@SyncErrorPromptType int type) { switch (type) { case SyncErrorPromptType.NOT_SHOWN: assert false; return; case SyncErrorPromptType.AUTH_ERROR: case SyncErrorPromptType.PASSPHRASE_REQUIRED: case SyncErrorPromptType.SYNC_SETUP_INCOMPLETE: case SyncErrorPromptType.CLIENT_OUT_OF_DATE: SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); settingsLauncher.launchSettingsActivity(getApplicationContext(), ManageSyncSettings.class, ManageSyncSettings.createArguments(false)); return; case SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING: case SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS: openTrustedVaultKeyRetrievalActivity(); return; case SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING: case SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS: openTrustedVaultRecoverabilityDegradedActivity(); return; } } public static boolean shouldShowPrompt(@SyncErrorPromptType int type) { if (type == SyncErrorPromptType.NOT_SHOWN) { return false; } long lastShownTime = SharedPreferencesManager.getInstance().readLong(SYNC_ERROR_PROMPT_SHOWN_AT_TIME, 0); return System.currentTimeMillis() - lastShownTime > MINIMAL_DURATION_BETWEEN_UI_MS; } public static void updateLastShownTime() { SharedPreferencesManager.getInstance().writeLong( SYNC_ERROR_PROMPT_SHOWN_AT_TIME, System.currentTimeMillis()); } public static void resetLastShownTime() { SharedPreferencesManager.getInstance().removeKey(SYNC_ERROR_PROMPT_SHOWN_AT_TIME); } public static boolean isMessageUiEnabled() { return ChromeFeatureList.isEnabled(ChromeFeatureList.MESSAGES_FOR_ANDROID_INFRASTRUCTURE) && ChromeFeatureList.isEnabled(ChromeFeatureList.MESSAGES_FOR_ANDROID_SYNC_ERROR); } public static String getSyncErrorPromptUiHistogramSuffix(@SyncErrorPromptType int type) { assert type != SyncErrorPromptType.NOT_SHOWN; switch (type) { case SyncErrorPromptType.AUTH_ERROR: return "AuthError"; case SyncErrorPromptType.PASSPHRASE_REQUIRED: return "PassphraseRequired"; case SyncErrorPromptType.SYNC_SETUP_INCOMPLETE: return "SyncSetupIncomplete"; case SyncErrorPromptType.CLIENT_OUT_OF_DATE: return "ClientOutOfDate"; case SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING: return "TrustedVaultKeyRequiredForEverything"; case SyncErrorPromptType.TRUSTED_VAULT_KEY_REQUIRED_FOR_PASSWORDS: return "TrustedVaultKeyRequiredForPasswords"; case SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING: return "TrustedVaultRecoverabilityDegradedForEverything"; case SyncErrorPromptType.TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS: return "TrustedVaultRecoverabilityDegradedForPasswords"; default: assert false; return ""; } } private static void openTrustedVaultKeyRetrievalActivity() { CoreAccountInfo primaryAccountInfo = getPrimaryAccountInfo(); if (primaryAccountInfo == null) { return; } TrustedVaultClient.get() .createKeyRetrievalIntent(primaryAccountInfo) .then( (intent) -> { IntentUtils.safeStartActivity(getApplicationContext(), SyncTrustedVaultProxyActivity.createKeyRetrievalProxyIntent( intent, TrustedVaultUserActionTriggerForUMA .NEW_TAB_PAGE_INFOBAR)); }, (exception) -> Log.w(TAG, "Error creating trusted vault key retrieval intent: ", exception)); } private static void openTrustedVaultRecoverabilityDegradedActivity() { CoreAccountInfo primaryAccountInfo = getPrimaryAccountInfo(); if (primaryAccountInfo == null) { return; } TrustedVaultClient.get() .createRecoverabilityDegradedIntent(primaryAccountInfo) .then( (intent) -> { IntentUtils.safeStartActivity(getApplicationContext(), SyncTrustedVaultProxyActivity .createRecoverabilityDegradedProxyIntent(intent, TrustedVaultUserActionTriggerForUMA .NEW_TAB_PAGE_INFOBAR)); }, (exception) -> Log.w(TAG, "Error creating trusted vault recoverability intent: ", exception)); } private static CoreAccountInfo getPrimaryAccountInfo() { if (!SyncService.get().isAuthenticatedAccountPrimary()) { return null; } return SyncService.get().getAuthenticatedAccountInfo(); } }
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
a6dacb6264dd269f1651a2ba3722e4803f98e26e
55777c059ea9073d230c9be84348dc3b01f31902
/eclipse-plugin/bpmn2/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/CategoryValueTest.java
b74d6feb7afc164ef6606e1c49091ebbd9c592c1
[]
no_license
pabloguerrero/ukuFlow
2625bef389637aa188385eb95f1dce77f15e6f64
1a527f11769ed59175edcaa85c1f4840d54fb664
refs/heads/master
2020-12-24T14:18:54.550305
2015-03-16T21:48:51
2015-03-16T21:48:51
32,354,275
1
0
null
null
null
null
UTF-8
Java
false
false
2,712
java
/** * <copyright> * * Copyright (c) 2010 SAP AG. * 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 * * Contributors: * Reiner Hille-Doering (SAP AG) - initial API and implementation and/or initial documentation * * </copyright> */ package org.eclipse.bpmn2.tests; import junit.textui.TestRunner; import org.eclipse.bpmn2.Bpmn2Factory; import org.eclipse.bpmn2.CategoryValue; /** * <!-- begin-user-doc --> * A test case for the model object '<em><b>Category Value</b></em>'. * <!-- end-user-doc --> * <p> * The following features are tested: * <ul> * <li>{@link org.eclipse.bpmn2.CategoryValue#getCategorizedFlowElements() <em>Categorized Flow Elements</em>}</li> * </ul> * </p> * @generated */ public class CategoryValueTest extends BaseElementTest { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static void main(String[] args) { TestRunner.run(CategoryValueTest.class); } /** * Constructs a new Category Value test case with the given name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CategoryValueTest(String name) { super(name); } /** * Returns the fixture for this Category Value test case. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected CategoryValue getFixture() { return (CategoryValue) fixture; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see junit.framework.TestCase#setUp() * @generated */ @Override protected void setUp() throws Exception { setFixture(Bpmn2Factory.eINSTANCE.createCategoryValue()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see junit.framework.TestCase#tearDown() * @generated */ @Override protected void tearDown() throws Exception { setFixture(null); } /** * Tests the '{@link org.eclipse.bpmn2.CategoryValue#getCategorizedFlowElements() <em>Categorized Flow Elements</em>}' feature getter. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.eclipse.bpmn2.CategoryValue#getCategorizedFlowElements() * @generated */ public void testGetCategorizedFlowElements() { // TODO: implement this feature getter test method // Ensure that you remove @generated or mark it @generated NOT fail(); } } //CategoryValueTest
[ "dangquochien@gmail.com" ]
dangquochien@gmail.com
db56bff2cde8c7312cb4fa0eee29f486ec783a9c
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.minihd.qq/assets/exlibs.1.jar/classes.jar/tencent/im/oidb/cmd0x8a7/cmd0x8a7.java
41ef4eed8960db8f2b6da7b4c2664af46bd6217c
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
278
java
package tencent.im.oidb.cmd0x8a7; public final class cmd0x8a7 {} /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.1.jar\classes.jar * Qualified Name: tencent.im.oidb.cmd0x8a7.cmd0x8a7 * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
67811a236d0aa9cf92c8bd6366a5ff7b5af1396c
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/12627/tar_1.java
1fe2dcef03b93d806cc2a5ce61944ed1f05a1eb5
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,767
java
/*BEGIN_COPYRIGHT_BLOCK* PLT Utilities BSD License Copyright (c) 2007-2008 JavaPLT group at Rice University All rights reserved. Developed by: Java Programming Languages Team Rice University http://www.cs.rice.edu/~javaplt/ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the JavaPLT group, Rice University, nor the names of the library's 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 AND 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. *END_COPYRIGHT_BLOCK*/ package edu.rice.cs.plt.collect; import java.util.Set; import java.util.Map; import edu.rice.cs.plt.tuple.Pair; /** * A set of pairs representing a binary relation. Relations can be viewed as generalizations * of maps in which keys map to sets of values, and the mapping occurs in both directions. */ public interface Relation<T1, T2> extends PredicateSet<Pair<T1, T2>> { /** Whether the given object appears in the set. */ public boolean contains(Object o); /** Whether {@code Pair.make(first, second)} appears in the set. */ public boolean contains(T1 first, T2 second); /** * Add {@code Pair.make(p.first(), p.second())} to the set. (That is, the pair that is * added is not an instance of some subclass of Pair.) */ public boolean add(Pair<T1, T2> pair); /** Add {@code Pair.make(first, second)} to the set. */ public boolean add(T1 first, T2 second); /** * If {@code o} is a pair, remove {@code Pair.make(o.first(), o.second())} from the set. * (That is, equality is always defined according to the Pair class's equals method, not * that of some subclass.) */ public boolean remove(Object o); /** Remove {@code Pair.make(first, second)} from the set. */ public boolean remove(T1 first, T2 second); /** * Produce the inverse of the relation, derived by swapping the elements of each pair. Need not * allow mutation, but must reflect subsequent changes. */ public Relation<T2, T1> inverse(); /** The set of firsts. Need not allow mutation, but must reflect subsequent changes. */ public PredicateSet<T1> firstSet(); /** Whether a pair with the given first value appears in the set. */ public boolean containsFirst(T1 first); /** * The set of seconds corresponding to a specific first. Need not allow mutation, but must * reflect subsequent changes. */ public PredicateSet<T2> matchFirst(T1 first); /** * The set of seconds for which there exists a (first, second) pair in the * relation. Equivalent to {@link #secondSet}, but defined redundantly for consistency * with higher-arity relations. Need not allow mutation, but must reflect subsequent changes. */ public PredicateSet<T2> excludeFirsts(); /** The set of seconds. Need not allow mutation, but must reflect subsequent changes. */ public PredicateSet<T2> secondSet(); /** Whether a pair with the given second value appears in the set. */ public boolean containsSecond(T2 second); /** * The set of firsts corresponding to a specific second. Need not allow mutation, but must * reflect subsequent changes. */ public PredicateSet<T1> matchSecond(T2 second); /** * The set of firsts for which there exists a (first, second) pair in the * relation. Equivalent to {@link #firstSet}, but defined redundantly for consistency * with higher-arity relations. Need not allow mutation, but must reflect subsequent changes. */ public PredicateSet<T1> excludeSeconds(); }
[ "375833274@qq.com" ]
375833274@qq.com
8de529544cdeb72a4712dac773c168f60194af6c
e63363389e72c0822a171e450a41c094c0c1a49c
/Mate20_9_0_0/src/main/java/android/icu/impl/Trie2_32.java
a64c9d5aaedf5d6761846eec20a354542d83e894
[]
no_license
solartcc/HwFrameWorkSource
fc23ca63bcf17865e99b607cc85d89e16ec1b177
5b92ed0f1ccb4bafc0fdb08b6fc4d98447b754ad
refs/heads/master
2022-12-04T21:14:37.581438
2020-08-25T04:30:43
2020-08-25T04:30:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,618
java
package android.icu.impl; import android.icu.text.DateTimePatternGenerator; import android.icu.text.UTF16; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; public class Trie2_32 extends Trie2 { Trie2_32() { } public static Trie2_32 createFromSerialized(ByteBuffer bytes) throws IOException { return (Trie2_32) Trie2.createFromSerialized(bytes); } public final int get(int codePoint) { if (codePoint >= 0) { if (codePoint < 55296 || (codePoint > UTF16.LEAD_SURROGATE_MAX_VALUE && codePoint <= DateTimePatternGenerator.MATCH_ALL_FIELDS_LENGTH)) { return this.data32[(this.index[codePoint >> 5] << 2) + (codePoint & 31)]; } else if (codePoint <= DateTimePatternGenerator.MATCH_ALL_FIELDS_LENGTH) { return this.data32[(this.index[2048 + ((codePoint - 55296) >> 5)] << 2) + (codePoint & 31)]; } else if (codePoint < this.highStart) { return this.data32[(this.index[this.index[2080 + (codePoint >> 11)] + ((codePoint >> 5) & 63)] << 2) + (codePoint & 31)]; } else if (codePoint <= 1114111) { return this.data32[this.highValueIndex]; } } return this.errorValue; } public int getFromU16SingleLead(char codeUnit) { return this.data32[(this.index[codeUnit >> 5] << 2) + (codeUnit & 31)]; } public int serialize(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); int bytesWritten = 0 + serializeHeader(dos); for (int i = 0; i < this.dataLength; i++) { dos.writeInt(this.data32[i]); } return bytesWritten + (this.dataLength * 4); } public int getSerializedLength() { return (16 + (this.header.indexLength * 2)) + (this.dataLength * 4); } int rangeEnd(int startingCP, int limit, int value) { int cp = startingCP; loop0: while (cp < limit) { int index2Block; int block; if (cp < 55296 || (cp > UTF16.LEAD_SURROGATE_MAX_VALUE && cp <= DateTimePatternGenerator.MATCH_ALL_FIELDS_LENGTH)) { index2Block = 0; block = this.index[cp >> 5] << 2; } else if (cp < DateTimePatternGenerator.MATCH_ALL_FIELDS_LENGTH) { index2Block = 2048; block = this.index[((cp - 55296) >> 5) + 2048] << 2; } else if (cp < this.highStart) { index2Block = this.index[2080 + (cp >> 11)]; block = this.index[((cp >> 5) & 63) + index2Block] << 2; } else if (value == this.data32[this.highValueIndex]) { cp = limit; } if (index2Block == this.index2NullOffset) { if (value != this.initialValue) { break; } cp += 2048; } else if (block != this.dataNullOffset) { int startIx = (cp & 31) + block; int limitIx = block + 32; for (int ix = startIx; ix < limitIx; ix++) { if (this.data32[ix] != value) { cp += ix - startIx; break loop0; } } cp += limitIx - startIx; } else if (value != this.initialValue) { break; } else { cp += 32; } } if (cp > limit) { cp = limit; } return cp - 1; } }
[ "lygforbs0@gmail.com" ]
lygforbs0@gmail.com
bdc13be08fbca010e9bcba2612c04e62413409e3
f76bdd8c72fc90ea95b4bd6d0a331029ed07f98a
/gmall-api/src/main/java/com/atguigu/gmall0228/bean/Crumb.java
27e1690eed664a88b7eddc26fa387eaadbac0f70
[]
no_license
signngis/gmall
6842e7fb5d6b084c28647a29cc0aee76a74a7da2
6765c56f3820ff2b8591b08ff04f60b07d20032a
refs/heads/master
2020-04-27T04:15:11.826989
2019-04-11T03:46:57
2019-04-11T03:46:57
174,048,823
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.atguigu.gmall0228.bean; public class Crumb { private String valueName; private String urlParam; public String getValueName() { return valueName; } public void setValueName(String valueName) { this.valueName = valueName; } public String getUrlParam() { return urlParam; } public void setUrlParam(String urlParam) { this.urlParam = urlParam; } }
[ "wangliang@skybility.com" ]
wangliang@skybility.com
0e0b88c103a39fcced2198f5dd1c8e30fdd1ab05
7f6363bea1c59007102ba90be28af1635d763966
/th/src/util/JsonTrans.java
8765644ee37da72da6e4bb2313285637ef7df0fa
[]
no_license
qiaofei/CodePractises
b0487a3de2b7400168fce9ac15197dde069514d0
3b123e37f2b3070e4a783cd54a90bb237867e91c
refs/heads/master
2021-01-10T04:45:03.070836
2016-04-01T07:32:38
2016-04-01T07:32:56
47,304,191
0
0
null
null
null
null
UTF-8
Java
false
false
920
java
package util; import java.util.List; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import net.sf.json.util.CycleDetectionStrategy; public class JsonTrans { // list转为json对象 public static String transListToJson(List list) { JSONArray jsonArray = null; try { JsonConfig jsonConfig = new JsonConfig(); jsonConfig .setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT); jsonArray = JSONArray.fromObject(list, jsonConfig); } catch (Exception e) { } return jsonArray.toString(); } // 对象转为json对象 public static String transObjectToJson(Object object) { JSONObject json = null; try { JsonConfig jsonConfig = new JsonConfig(); jsonConfig .setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT); json = JSONObject.fromObject(object, jsonConfig); } catch (Exception e) { } return json.toString(); } }
[ "qiaofei9@foxmail.com" ]
qiaofei9@foxmail.com
87a595f4221448b9c0b360123e756e20d1ef25a9
1866c245cbe8493a933cf0532cdfcfcb5549cb72
/src/main/java/com/bolsadeideas/springboot/diapp/controller/ISpringTicTacToeService.java
8ed06785ffbe4a5ece6d0d5fdc84871bfbbef66a
[]
no_license
andresescobarcotan/SpringTicTacToe
0f179e25042e00a72dd603004459932d8afb7337
d9438c1b9163b57809bc7c237a4a1b254e695c5a
refs/heads/master
2020-07-28T08:09:50.584894
2019-09-18T16:54:47
2019-09-18T16:54:47
209,360,163
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.bolsadeideas.springboot.diapp.controller; import com.bolsadeideas.springboot.diapp.model.Movement; public interface ISpringTicTacToeService { public String createGame(); public String getGame(String idGame); public String nextMovement(String idGame, Movement nm); }
[ "aescobac@everis.com" ]
aescobac@everis.com
f935f671e46fcfca209be8f649d12d739833c7a3
2d7d40d0f0d85f27801c165fcdcecb7d031db654
/src/test/java/com/allstate/services/DriverServiceTest.java
25395f993d8448033a1b601ef9186627734124a4
[]
no_license
rkrohit94/Cab_Api
b3840034dc5b35d74ba5e4d8bf95a82204b4e3a2
f8bfe3eebc196e2ed256145e457148c0a050be56
refs/heads/master
2021-01-23T07:10:01.185239
2017-02-01T09:21:52
2017-02-01T09:21:52
80,491,883
1
0
null
null
null
null
UTF-8
Java
false
false
3,656
java
package com.allstate.services; import com.allstate.entities.Car; import com.allstate.entities.City; import com.allstate.entities.Driver; import com.allstate.entities.Trip; import com.allstate.enums.Gender; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit4.SpringRunner; import javax.transaction.Transactional; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.*; @RunWith(SpringRunner.class) @SpringBootTest @Sql("/sql/seed.sql") public class DriverServiceTest { @Autowired private DriverService driverService; private Driver driver; @Before public void setUp() throws Exception { driver =new Driver(); driver.setName("bob"); driver.setGender(Gender.MALE); driver.setAge(30); } @After public void tearDown() throws Exception { } @Test public void shouldCreateDriver() throws Exception { Driver result=this.driverService.createDriver(driver); assertNotNull(result); assertEquals(4,result.getId()); } @Test(expected = javax.validation.ConstraintViolationException.class) public void shouldNotCreateDriverWithBadName() throws Exception { Driver driver1=new Driver(); Driver result=this.driverService.createDriver(driver1); assertNull(result); } @Test public void shouldFindDriverById() throws Exception { Driver result=this.driverService.findById(1); assertEquals(1,result.getId()); assertEquals("abc",result.getName()); } @Test public void shouldNotFindDriverByBadId() throws Exception { Driver result=this.driverService.findById(5); assertNull(result); } @Test public void shouldFindDriverByName() throws Exception { Driver result=this.driverService.findByName("abc"); assertEquals(1,result.getId()); } @Test public void shouldNotFindDriverByBadName() throws Exception { Driver result=this.driverService.findByName("aaa"); assertNull(result); } @Test(expected = org.springframework.dao.DataIntegrityViolationException.class) public void shouldDeleteDriverById() throws Exception { this.driverService.deleteById(1); Driver result= this.driverService.findById(1); assertNull(result); } @Test public void shouldAddDriverViolation() throws Exception { Driver driver1 = this.driverService.findById(1); Driver result = this.driverService.addViolation(driver1); assertEquals(1,result.getViolations()); assertEquals(1,result.getVersion()); } @Test @Transactional public void shouldFindListOfCitiesDrivenByDriver() throws Exception { Driver driver1 =this.driverService.findById(1); List<City> cityList = driver1.getCity(); assertEquals(1,cityList.size()); } @Test @Transactional public void shouldFindListOfCarsOfDriver() throws Exception{ Driver driver1 =this.driverService.findById(1); List<Car> carsList = driver1.getCarsList(); assertEquals(2,carsList.size()); } @Test @Transactional public void shouldFindListOfTripsByDriver() throws Exception { Driver driver1 =this.driverService.findById(1); List<Trip> tripList = driver1.getTripList(); assertEquals(2,tripList.size()); } }
[ "lredg@allstate.com" ]
lredg@allstate.com
5376c82f0aef37c53a55b9dcba56d76d2fa40e8a
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-appmesh/src/main/java/com/amazonaws/services/appmesh/model/transform/GatewayRouteSpecJsonUnmarshaller.java
d111be6d0f25f568f7b5f30bc688eea18321323b
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
3,261
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.appmesh.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.appmesh.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * GatewayRouteSpec JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GatewayRouteSpecJsonUnmarshaller implements Unmarshaller<GatewayRouteSpec, JsonUnmarshallerContext> { public GatewayRouteSpec unmarshall(JsonUnmarshallerContext context) throws Exception { GatewayRouteSpec gatewayRouteSpec = new GatewayRouteSpec(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("grpcRoute", targetDepth)) { context.nextToken(); gatewayRouteSpec.setGrpcRoute(GrpcGatewayRouteJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("http2Route", targetDepth)) { context.nextToken(); gatewayRouteSpec.setHttp2Route(HttpGatewayRouteJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("httpRoute", targetDepth)) { context.nextToken(); gatewayRouteSpec.setHttpRoute(HttpGatewayRouteJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return gatewayRouteSpec; } private static GatewayRouteSpecJsonUnmarshaller instance; public static GatewayRouteSpecJsonUnmarshaller getInstance() { if (instance == null) instance = new GatewayRouteSpecJsonUnmarshaller(); return instance; } }
[ "" ]
47b3de12ab25d94617bd85bdc591981b01c43276
c0e307c751a3f3b99f93801036680b952794183b
/src/HomeTelephone/PhoneUtils.java
eba6a89caa4374c3d47beaea3e079115a8d4fafe
[]
no_license
AndrewKhan1983/Studing
165139c42859d8592e77646b71b187b75b683066
e72d31ec03f4a124ee23703d29dbbc58aa44cab9
refs/heads/master
2023-07-17T13:00:45.618288
2021-08-19T18:38:14
2021-08-19T18:38:14
377,246,820
0
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package HomeTelephone; import java.util.ArrayList; import java.util.Arrays; public class PhoneUtils { public static void printAllPhonesByProduction(ArrayList<Telephone> phones, String production) { for (Telephone telephone : phones) { if (telephone.getProduction().equals(production)) { System.out.println(telephone.toString()); } } } public static void printTheBigestResolution(ArrayList<Telephone> phones){ Telephone biggestPhone = phones.get(0); for (Telephone telephone:phones) { if(telephone.getDiag()> biggestPhone.getDiag()){ biggestPhone = telephone; System.out.println(biggestPhone); } } } public static void printTheSmallerResolution(ArrayList<Telephone> phones){ Telephone smallerPhone = phones.get(0); for (Telephone telephone:phones) { if (telephone.getDiag()< smallerPhone.getDiag()){ smallerPhone = telephone; System.out.println(smallerPhone); } } } }
[ "andre-khan@yandex.ru" ]
andre-khan@yandex.ru
8f17dc154c2f73c189d3253dc7fd81e252002963
aeb83ad5f0808e2df9a0d48ba88e196e90beebfd
/app/src/main/java/com/codepath/simpletodo/MainActivity.java
479a6c0d2f73451d5791973d50923cf9bbf0261d
[ "Apache-2.0" ]
permissive
antonialiu/SimpleToDo
824fb19c86972cddbc09d9fd9151e5de2e497cde
cd0167e2f07c7f7d38be85035735cb351b8597db
refs/heads/master
2020-06-10T23:54:40.639778
2019-06-25T23:44:09
2019-06-25T23:44:09
193,796,325
0
0
null
null
null
null
UTF-8
Java
false
false
3,688
java
package com.codepath.simpletodo; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ArrayList<String> items; ArrayAdapter<String> itemsAdapter; ListView lvItems; public static final int EDIT_REQUEST_CODE = 20; public static final String ITEM_TEXT = "itemText"; public static final String ITEM_POSITION = "itemPosition"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lvItems = (ListView) findViewById(R.id.lvItems); readItems(); itemsAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items); lvItems.setAdapter(itemsAdapter); setupListViewListener(); } public void onAddItem(View v) { EditText etNewItem = (EditText) findViewById(R.id.etNewItem); String itemText = etNewItem.getText().toString(); itemsAdapter.add(itemText); writeItems(); Toast.makeText(getApplicationContext(), "Item added to list", Toast.LENGTH_SHORT).show(); } private void setupListViewListener() { lvItems.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { items.remove(i); itemsAdapter.notifyDataSetChanged(); Log.i("MainActivity", "Removed item" + i); writeItems(); return true; } }); lvItems.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Intent i = new Intent(MainActivity.this, EditItemActivity.class); i.putExtra(ITEM_TEXT, items.get(position)); i.putExtra(ITEM_POSITION, position); startActivityForResult(i, EDIT_REQUEST_CODE); } }); } private File getDataFile() { return new File(getFilesDir(), "todo.txt"); } private void readItems() { try { items = new ArrayList<String>(FileUtils.readLines(getDataFile(), Charset.defaultCharset())); } catch (IOException e) { e.printStackTrace(); items = new ArrayList<>(); } } private void writeItems() { try { FileUtils.writeLines(getDataFile(), items); } catch (IOException e) { e.printStackTrace(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK && requestCode == EDIT_REQUEST_CODE) { String updatedItem = data.getExtras().getString(ITEM_TEXT); int position = data.getExtras().getInt(ITEM_POSITION, 0); items.set(position, updatedItem); itemsAdapter.notifyDataSetChanged(); writeItems(); Toast.makeText(this, "Item updated", Toast.LENGTH_SHORT).show(); } } }
[ "antonialiu@fb.com" ]
antonialiu@fb.com
005d38f830d9a21ddd3c26ce0e163e9fcfaf1176
7f861741956bdb22956e537d0f721accc3c48870
/Resposta_n3.java
d82491c8f6bcec5933b44a61fb80a11e3a795edb
[]
no_license
MatheusFRocha/Procedimento-metodo-e-fun-o
a0991dda04c130a2dd6f06ccb5d2460e2f7c4942
95bbf82f85e40e1ec95ae9446cc79a6f927173bc
refs/heads/master
2022-10-13T09:36:18.993825
2020-06-08T21:40:58
2020-06-08T21:40:58
270,836,135
1
0
null
null
null
null
ISO-8859-2
Java
false
false
902
java
package exercicios_método; import java.util.Scanner; public class Resposta_n3 { public static void main(String[] args) { Scanner leitor = new Scanner(System.in); int media; int m1,m2,m3,m4; int x=1; { do { System.out.println("Digite sua "+x+"° nota"); m1= leitor.nextInt(); x++; System.out.println("Digite sua "+x+"° nota"); m2= leitor.nextInt(); x++; System.out.println("Digite sua "+x+"° nota"); m3= leitor.nextInt(); x++; System.out.println("Digite sua "+x+"° nota"); m4= leitor.nextInt(); x++; } while(x<5); media = m1+m2+m3+m4/4; System.out.println("Sua média foi de: "+media); if(media <7){ System.out.println("Reprovado"); } else { System.out.println("Aprovado"); return; } } } }
[ "noreply@github.com" ]
noreply@github.com
31d06261b710833f6f025ef157ad28fb255b15c2
263bb8a306b4af1d937fec61e119367cfd89877e
/src/main/java/br/edu/ifpb/ads/padroes/comparable/FrutasComparatorReversed.java
4fffb2d122a696299298ccb8c82bb9ced0068375
[]
no_license
Padroes-de-Projeto-IFPB/exemplo-strategy
8e360bcb59279813cfdb56e94b0629821b54c62c
d5afa88e9e3a0ab7977d05e42249fa38e51d8cf4
refs/heads/master
2023-03-13T02:14:24.301582
2021-03-05T18:27:25
2021-03-05T18:27:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
247
java
package br.edu.ifpb.ads.padroes.comparable; import java.util.Comparator; public class FrutasComparatorReversed implements Comparator { public int compare(Object o1, Object o2) { return o2.toString().compareTo(o1.toString()); } }
[ "diego.pessoa@ifpb.edu.br" ]
diego.pessoa@ifpb.edu.br
03f09703e2e96bdd7ce5ee4342677084183fa23f
f3697cf76aa8c5d39a4043fb5fe1e009d98c685e
/src/com/adamwhiles/easyphotoupload/Album.java
a32813a98876d662ff1fe56964f613e2fde2332d
[]
no_license
adamwhiles/EasyPhotoUpload
0b27f268d4deedf619843a8e10ac3685e111354c
392170e61547d9f1348b8239415863707f5548c5
refs/heads/master
2020-05-29T22:23:37.525206
2012-08-09T04:09:56
2012-08-09T04:09:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,510
java
package com.adamwhiles.easyphotoupload; import android.os.Parcel; import android.os.Parcelable; public class Album implements Parcelable { private String id; private String name; private String description; public Album(String name, String id, String description) { this.id = id; this.name = name; this.description = description; } public Album(Parcel in) { name = in.readString(); id = in.readString(); description = in.readString(); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public static final Parcelable.Creator<Album> CREATOR = new Parcelable.Creator<Album>() { @Override public Album createFromParcel(Parcel in) { return new Album(in); } @Override public Album[] newArray(int size) { return new Album[size]; } }; @Override public String toString() { // returning name because that is what will be displayed in the Spinner // control return (this.name); } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel arg0, int arg1) { // TODO Auto-generated method stub arg0.writeString(name); arg0.writeString(id); arg0.writeString(description); } }
[ "awhiles2011@gmail.com" ]
awhiles2011@gmail.com
27e10131920962e396b9a3f0afa6c0953bd8b422
ff0c2c1548c83b82eeca658e3d79234c2fc13c06
/TestngPractise2/src/test/java/mavenProfiling/TestngPractise2/WebT.java
1fdb5cac182f9aa19c1a05e5f6d3769b025458e0
[]
no_license
priyanka3644/GitPractise
ca8cbbc4a57744fa1412f8fba6a5f74b0e6f2f75
b23db37e5db134c2fc777512d9a61720bb891b3b
refs/heads/master
2023-08-25T18:36:19.923545
2021-10-13T12:25:25
2021-10-13T12:25:25
416,421,683
0
0
null
null
null
null
UTF-8
Java
false
false
291
java
package mavenProfiling.TestngPractise2; import org.testng.annotations.Test; public class WebT { @Test public void webTestScenario1() { System.out.println("In Web Test Scenario 1"); } @Test public void webTestScenario2() { System.out.println("In Web Test Scenario 2"); } }
[ "priyankasanka@gmail.com" ]
priyankasanka@gmail.com
c39105ba8bf3766ced1012b3bc42adc145bcb7ab
539bdd6e660ce616027315f945cc989499566996
/trackanalyzer/src/at/ofai/music/beatroot/EventProcessor.java
e2a3cd62cd2f03240748810a2e6fc4e765bea85d
[]
no_license
PhilHannant/Project
f764be122477a0268f01bd639068469757923574
0c9edd7ee60431d069148a3e01e1f8ee4fe21d79
refs/heads/master
2020-05-29T18:09:42.487750
2016-06-26T22:33:47
2016-06-26T22:33:47
50,346,752
0
0
null
null
null
null
UTF-8
Java
false
false
7,476
java
/* BeatRoot: An interactive beat tracking system Copyright (C) 2001, 2006 by Simon Dixon This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program (the file gpl.txt); if not, download it from http://www.gnu.org/licenses/gpl.txt or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package at.ofai.music.beatroot; import javax.swing.JCheckBoxMenuItem; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** Key, menu, and button event processing. All user interaction with the * system is processed by the single EventProcessor object, which has * handles to the other main objects for performing the requested actions. */ class EventProcessor implements ActionListener, KeyListener { /** Handle to BeatRoot's GUI */ protected GUI gui; /** Handle to BeatRoot's audio player */ protected AudioPlayer audioPlayer; /** Handle to BeatRoot's audio processor */ protected AudioProcessor audioProcessor; /** Handle to BeatRoot's file chooser */ protected Chooser chooser; /** Flag for enabling debugging output */ public static boolean debug = false; /** Constructor: * @param g Handle to BeatRoot's GUI * @param ap Handle to BeatRoot's audio player * @param proc Handle to BeatRoot's audio processor * @param ch Handle to BeatRoot's file chooser */ public EventProcessor(GUI g, AudioPlayer ap, AudioProcessor proc, Chooser ch) { gui = g; audioPlayer = ap; audioProcessor = proc; chooser = ch; } // constructor /** Processes all user menu and button actions. * @param e The Java event handling system's representation of the user action */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); boolean flag = false; Object o = e.getSource(); if (o instanceof JCheckBoxMenuItem) flag = ((JCheckBoxMenuItem)o).isSelected(); if (command.equals(GUI.EXIT)) BeatRoot.quit(); else if (command.equals(GUI.PLAY)) audioPlayer.play(); else if (command.equals(GUI.PLAY_BEATS)) audioPlayer.play(false); else if (command.equals(GUI.PLAY_AUDIO)) audioPlayer.play(true); else if (command.equals(GUI.STOP)) audioPlayer.stop(); else if (command.equals(GUI.LOAD_AUDIO)) gui.loadAudioData(); else if (command.equals(GUI.SAVE_AUDIO)) audioPlayer.save(); else if (command.equals(GUI.LOAD_BEATS)) gui.loadBeatData(); else if (command.equals(GUI.SAVE_BEATS)) gui.saveBeatData(); else if (command.equals(GUI.UNDO)) EditAction.undo(); else if (command.equals(GUI.REDO)) EditAction.redo(); else if (command.equals(GUI.EDIT_PREFERENCES)) gui.editPreferences(); else if (command.equals(GUI.EDIT_PERCUSSION)) gui.editPercussionSounds(); else if (command.equals(GUI.SHOW_BEATS)) gui.setMode(BeatTrackDisplay.SHOW_BEATS, flag); else if (command.equals(GUI.SHOW_IBIS)) gui.setMode(BeatTrackDisplay.SHOW_IBI, flag); else if (command.equals(GUI.SHOW_WAVE)) gui.setMode(BeatTrackDisplay.SHOW_AUDIO, flag); else if (command.equals(GUI.SHOW_SPECTRO)) gui.setMode(BeatTrackDisplay.SHOW_SPECTRO, flag); else if (command.equals(GUI.BEAT_TRACK)){ System.out.println("beattracking"); gui.displayPanel.beatTrack();} else if (command.equals(GUI.CLEAR_BEATS)) gui.clearBeatData(); else if (command.equals(GUI.MARK_METRICAL_LEVEL)) gui.markMetricalLevel(); else if (command.equals(GUI.CLEAR_METRICAL_LEVELS)) gui.clearMetricalLevels(); else BeatRoot.warning("Operation not implemented"); } // actionPerformed() /** Processes user key events which are not associated with menu items. * Keystrokes are only processed if no modifiers are present (e.g. shift, alt, mouse buttons). * Since key releases are considered irrelevant, all processing is done here. */ public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); int modifiers = e.getModifiers(); if (modifiers == 0) { switch (keyCode) { case KeyEvent.VK_A: audioPlayer.stop(false); gui.displayPanel.toggleAnnotateMode(); break; /*case KeyEvent.VK_LEFT: gui.displayPanel.selectPreviousBeat(); break; case KeyEvent.VK_RIGHT: gui.displayPanel.selectNextBeat(); break;*/ case KeyEvent.VK_HOME: gui.displayPanel.selectFirstBeat(); break; case KeyEvent.VK_END: gui.displayPanel.selectLastBeat(); break; case KeyEvent.VK_0: gui.displayPanel.setMetricalLevel(0); break; case KeyEvent.VK_1: gui.displayPanel.setMetricalLevel(1); break; case KeyEvent.VK_2: gui.displayPanel.setMetricalLevel(2); break; case KeyEvent.VK_3: gui.displayPanel.setMetricalLevel(3); break; case KeyEvent.VK_4: gui.displayPanel.setMetricalLevel(4); break; case KeyEvent.VK_5: gui.displayPanel.setMetricalLevel(5); break; case KeyEvent.VK_6: gui.displayPanel.setMetricalLevel(6); break; case KeyEvent.VK_7: gui.displayPanel.setMetricalLevel(7); break; case KeyEvent.VK_X: gui.displayPanel.removeSelectedBeat(); break; case KeyEvent.VK_C: gui.displayPanel.addAfterSelectedBeat(); break; case KeyEvent.VK_SLASH: if (debug) System.err.print(System.nanoTime() / 1000000 % 100000); gui.displayPanel.addBeatNow(); break; case KeyEvent.VK_V: gui.displayPanel.addBeat(gui.displayPanel.getCurrentTime()); break; case KeyEvent.VK_P: audioPlayer.play(); break; case KeyEvent.VK_S: audioPlayer.stop(); break; case KeyEvent.VK_SPACE: // WG. inserted (4 Aug 2009) if (audioPlayer.playing) audioPlayer.stop(); else audioPlayer.play(); break; case KeyEvent.VK_B: // WG. inserted (4 Aug 2009) gui.displayPanel.beatTrack(); break; case KeyEvent.VK_Z: // WG. inserted (5 Aug 2009) gui.displayPanel.clearBeats(); break; case KeyEvent.VK_RIGHT: gui.scroll(.025); break; case KeyEvent.VK_LEFT: gui.scroll(-.025); break; } // switch } else if (modifiers == KeyEvent.CTRL_MASK) { switch (keyCode) { case KeyEvent.VK_RIGHT: gui.scroll(.1); break; case KeyEvent.VK_LEFT: gui.scroll(-.1); break; } // switch } else if (modifiers == KeyEvent.ALT_MASK) { switch (keyCode) { case KeyEvent.VK_RIGHT: gui.scroll(.005); break; case KeyEvent.VK_LEFT: gui.scroll(-.005); break; } // switch } } // keyPressed() /** Ignore key releases, since processing is performed as soon as the key is pressed. * Implements part of interface KeyListener */ public void keyReleased(KeyEvent e) {} /** Ignore KeyEvents indicating that a key was typed, since keyPressed() has * already dealt with this keystroke. * Implements part of interface KeyListener */ public void keyTyped(KeyEvent e) {} } // class EventProcessor
[ "philip.a.hannant@gmail.com" ]
philip.a.hannant@gmail.com
72f5f9eebd186616edf91095354955afa00d8441
fedf791c7c36339ea8a93e9c0ffe44e80a8606c6
/app/src/main/java/com/zxycloud/zszw/model/ResultAlertBean.java
1221161b4fc72c264fff3949c18dcaf4d6d5c4b7
[]
no_license
Ring1205/hzy
44b135a748e0d248f7a164a4e91e4b30965a2c2f
a8ef58d566f53af512a4376664109aa01fd1b3b2
refs/heads/master
2020-08-26T11:54:45.902465
2019-10-23T08:29:03
2019-10-23T08:29:03
217,005,924
1
0
null
null
null
null
UTF-8
Java
false
false
310
java
package com.zxycloud.zszw.model; import com.zxycloud.zszw.model.bean.AlarmBean; import com.zxycloud.common.base.BaseBean; /** * @author leiming * @date 2019/3/28. */ public class ResultAlertBean extends BaseBean { private AlarmBean data; public AlarmBean getData() { return data; } }
[ "dengzhihong@zxycloud.com" ]
dengzhihong@zxycloud.com
a60e2add8bd7909c8423b7c20009e96a2c49358a
2f1c420066058568fcc4d233ab55366e38aae1f4
/app/src/main/java/com/xgx/syzj/bean/StoreInfo.java
ee47072c1789f90c07a4d0291edf278917376d0c
[]
no_license
zhengjunjie9204/hmk
8c500644f0e06590562237ae8b66b6f6f1c4a708
3c6cb822854ab2ec6c9844b5e58c5cd4f8067a03
refs/heads/master
2020-04-06T07:08:22.978061
2016-09-07T07:45:42
2016-09-07T07:45:42
64,652,433
1
0
null
null
null
null
UTF-8
Java
false
false
965
java
package com.xgx.syzj.bean; /** * Created by Administrator on 2016/8/9 0009. */ public class StoreInfo { private String managerPhone; private String storeName; private String managerName; private String storePosition; public StoreInfo() { } public String getManagerPhone() { return managerPhone; } public void setManagerPhone(String managerPhone) { this.managerPhone = managerPhone; } public String getStoreName() { return storeName; } public void setStoreName(String storeName) { this.storeName = storeName; } public String getManagerName() { return managerName; } public void setManagerName(String managerName) { this.managerName = managerName; } public String getStorePosition() { return storePosition; } public void setStorePosition(String storePosition) { this.storePosition = storePosition; } }
[ "383145661@qq.com" ]
383145661@qq.com
8f7784f4bb60445fc09433cb2d92bfb9870ef81f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/34/34_63d298a6260f67bddbb434c1997c6c545f735c74/JNDIConnectionWrapper/34_63d298a6260f67bddbb434c1997c6c545f735c74_JNDIConnectionWrapper_t.java
72c32b7e96ee80e392e67043f14066ca51d6b7aa
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
59,575
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.directory.studio.connection.core.io.jndi; import java.io.File; import java.io.IOException; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Hashtable; import java.util.List; import javax.naming.CommunicationException; import javax.naming.CompositeName; import javax.naming.Context; import javax.naming.InsufficientResourcesException; import javax.naming.InvalidNameException; import javax.naming.Name; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.PartialResultException; import javax.naming.ReferralException; import javax.naming.ServiceUnavailableException; import javax.naming.directory.Attributes; import javax.naming.directory.ModificationItem; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.naming.ldap.Control; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; import javax.naming.ldap.LdapName; import javax.naming.ldap.StartTlsRequest; import javax.naming.ldap.StartTlsResponse; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag; import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException; import org.apache.directory.shared.ldap.message.Referral; import org.apache.directory.shared.ldap.message.ReferralImpl; import org.apache.directory.shared.ldap.util.LdapURL; import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor; import org.apache.directory.studio.connection.core.Connection; import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod; import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod; import org.apache.directory.studio.connection.core.ConnectionCoreConstants; import org.apache.directory.studio.connection.core.ConnectionCorePlugin; import org.apache.directory.studio.connection.core.ConnectionParameter; import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod; import org.apache.directory.studio.connection.core.IAuthHandler; import org.apache.directory.studio.connection.core.ICredentials; import org.apache.directory.studio.connection.core.IJndiLogger; import org.apache.directory.studio.connection.core.Messages; import org.apache.directory.studio.connection.core.Utils; import org.apache.directory.studio.connection.core.io.ConnectionWrapper; import org.apache.directory.studio.connection.core.io.ConnectionWrapperUtils; import org.eclipse.core.runtime.Preferences; import org.eclipse.osgi.util.NLS; /** * A connection wrapper that uses JNDI. * * - asychron + cancelable * - SSL certificate * - manages broken/closed connections * - delete old RDN * - exception handling * - referral handling * * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> */ public class JNDIConnectionWrapper implements ConnectionWrapper { private static final String JAVA_NAMING_LDAP_DELETE_RDN = "java.naming.ldap.deleteRDN"; //$NON-NLS-1$ private static final String AUTHMETHOD_NONE = "none"; //$NON-NLS-1$ private static final String AUTHMETHOD_SIMPLE = "simple"; //$NON-NLS-1$ private static final String AUTHMETHOD_DIGEST_MD5 = "DIGEST-MD5"; //$NON-NLS-1$ private static final String AUTHMETHOD_CRAM_MD5 = "CRAM-MD5"; //$NON-NLS-1$ private static final String AUTHMETHOD_GSSAPI = "GSSAPI"; //$NON-NLS-1$ private static final String NO_CONNECTION = "No connection"; //$NON-NLS-1$ private static final String JAVA_NAMING_SECURITY_SASL_REALM = "java.naming.security.sasl.realm"; //$NON-NLS-1$ private static final String JAVA_NAMING_LDAP_FACTORY_SOCKET = "java.naming.ldap.factory.socket"; //$NON-NLS-1$ private static final String COM_SUN_JNDI_DNS_TIMEOUT_RETRIES = "com.sun.jndi.dns.timeout.retries"; //$NON-NLS-1$ private static final String COM_SUN_JNDI_DNS_TIMEOUT_INITIAL = "com.sun.jndi.dns.timeout.initial"; //$NON-NLS-1$ private static final String COM_SUN_JNDI_LDAP_CONNECT_TIMEOUT = "com.sun.jndi.ldap.connect.timeout"; //$NON-NLS-1$ private static final String JAVA_NAMING_LDAP_VERSION = "java.naming.ldap.version"; //$NON-NLS-1$ private static final String JAVA_NAMING_LDAP_DEREF_ALIASES = "java.naming.ldap.derefAliases"; //$NON-NLS-1$ private static final String JAVA_NAMING_LDAP_ATTRIBUTES_BINARY = "java.naming.ldap.attributes.binary"; //$NON-NLS-1$ private static int SEARCH_RESQUEST_NUM = 0; private Connection connection; private boolean useLdaps; private boolean useStartTLS; private String authMethod; private String bindPrincipal; private String bindCredentials; private String saslRealm; private Hashtable<String, String> environment; private InitialLdapContext context; private boolean isConnected; private Thread jobThread; private Collection<String> binaryAttributes; /** JNDI constant for "throw" referrals handling */ public static final String REFERRAL_THROW = "throw"; //$NON-NLS-1$ /** JNDI constant for "follow" referrals handling */ public static final String REFERRAL_FOLLOW = "follow"; //$NON-NLS-1$ /** JNDI constant for "ignore" referrals handling */ public static final String REFERRAL_IGNORE = "ignore"; //$NON-NLS-1$ /** JNDI constant for "searching" alias dereferencing */ public static final String ALIAS_SEARCHING = "searching"; //$NON-NLS-1$ /** JNDI constant for "finding" alias dereferencing */ public static final String ALIAS_FINDING = "finding"; //$NON-NLS-1$ /** JNDI constant for "always" alias dereferencing */ public static final String ALIAS_ALWAYS = "always"; //$NON-NLS-1$ /** JNDI constant for "never" alias dereferencing */ public static final String ALIAS_NEVER = "never"; //$NON-NLS-1$ /** * Creates a new instance of JNDIConnectionContext. * * @param connection the connection */ public JNDIConnectionWrapper( Connection connection ) { this.connection = connection; } /** * {@inheritDoc} */ public void connect( StudioProgressMonitor monitor ) { context = null; isConnected = false; jobThread = null; try { doConnect( monitor ); } catch ( NamingException ne ) { disconnect(); monitor.reportError( ne ); } } /** * {@inheritDoc} */ public void disconnect() { if ( jobThread != null ) { Thread t = jobThread; jobThread = null; t.interrupt(); } if ( context != null ) { try { context.close(); } catch ( NamingException e ) { // ignore } context = null; } isConnected = false; System.gc(); } /** * {@inheritDoc} */ public void bind( StudioProgressMonitor monitor ) { try { doBind( monitor ); } catch ( NamingException ne ) { disconnect(); monitor.reportError( ne ); } } /** * {@inheritDoc} */ public void unbind() { disconnect(); } /** * {@inheritDoc} */ public boolean isConnected() { return context != null; } /** * Sets the binary attributes. * * @param binaryAttributes the binary attributes */ public void setBinaryAttributes( Collection<String> binaryAttributes ) { this.binaryAttributes = binaryAttributes; String binaryAttributesString = StringUtils.EMPTY; for ( String string : binaryAttributes ) { binaryAttributesString += string + ' '; } if ( environment != null ) { environment.put( JAVA_NAMING_LDAP_ATTRIBUTES_BINARY, binaryAttributesString ); } if ( context != null ) { try { context.addToEnvironment( JAVA_NAMING_LDAP_ATTRIBUTES_BINARY, binaryAttributesString ); } catch ( NamingException e ) { // TODO: logging e.printStackTrace(); } } } /** * Search. * * @param searchBase the search base * @param filter the filter * @param searchControls the controls * @param aliasesDereferencingMethod the aliases dereferencing method * @param referralsHandlingMethod the referrals handling method * @param controls the LDAP controls * @param monitor the progress monitor * @param referralsInfo the referrals info * * @return the naming enumeration or null if an exception occurs. */ public JndiStudioNamingEnumeration search( final String searchBase, final String filter, final SearchControls searchControls, final AliasDereferencingMethod aliasesDereferencingMethod, final ReferralHandlingMethod referralsHandlingMethod, final Control[] controls, final StudioProgressMonitor monitor, final ReferralsInfo referralsInfo ) { final long requestNum = SEARCH_RESQUEST_NUM++; // start InnerRunnable runnable = new InnerRunnable() { public void run() { LdapContext searchCtx = context; try { // create the search context searchCtx = context.newInstance( controls ); // translate alias dereferencing method searchCtx.addToEnvironment( JAVA_NAMING_LDAP_DEREF_ALIASES, translateDerefAliasMethod( aliasesDereferencingMethod ) ); // use "throw" as we handle referrals manually searchCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW ); // perform the search NamingEnumeration<SearchResult> result = searchCtx.search( JNDIConnectionWrapper .getSaveJndiName( searchBase ), filter, searchControls ); namingEnumeration = new JndiStudioNamingEnumeration( connection, searchCtx, result, null, searchBase, filter, searchControls, aliasesDereferencingMethod, referralsHandlingMethod, controls, requestNum, monitor, referralsInfo ); } catch ( PartialResultException e ) { namingEnumeration = new JndiStudioNamingEnumeration( connection, searchCtx, null, e, searchBase, filter, searchControls, aliasesDereferencingMethod, referralsHandlingMethod, controls, requestNum, monitor, referralsInfo ); } catch ( ReferralException e ) { namingEnumeration = new JndiStudioNamingEnumeration( connection, searchCtx, null, e, searchBase, filter, searchControls, aliasesDereferencingMethod, referralsHandlingMethod, controls, requestNum, monitor, referralsInfo ); } catch ( NamingException e ) { namingException = e; } for ( IJndiLogger logger : getJndiLoggers() ) { if ( namingEnumeration != null ) { logger.logSearchRequest( connection, searchBase, filter, searchControls, aliasesDereferencingMethod, controls, requestNum, namingException ); } else { logger.logSearchRequest( connection, searchBase, filter, searchControls, aliasesDereferencingMethod, controls, requestNum, namingException ); logger.logSearchResultDone( connection, 0, requestNum, namingException ); } } } }; try { checkConnectionAndRunAndMonitor( runnable, monitor ); } catch ( NamingException ne ) { monitor.reportError( ne ); return null; } if ( runnable.isCanceled() ) { monitor.setCanceled( true ); } if ( runnable.getException() != null ) { monitor.reportError( runnable.getException() ); return null; } else { return runnable.getResult(); } } /** * Modifies attributes of an entry. * * @param dn the DN * @param modificationItems the modification items * @param controls the controls * @param monitor the progress monitor * @param referralsInfo the referrals info */ public void modifyEntry( final String dn, final ModificationItem[] modificationItems, final Control[] controls, final StudioProgressMonitor monitor, final ReferralsInfo referralsInfo ) { if ( connection.isReadOnly() ) { monitor.reportError( NLS.bind( Messages.error__connection_is_readonly, connection.getName() ) ); return; } InnerRunnable runnable = new InnerRunnable() { public void run() { boolean logModification = true; try { // create modify context LdapContext modCtx = context.newInstance( controls ); // use "throw" as we handle referrals manually modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW ); // perform modification modCtx.modifyAttributes( getSaveJndiName( dn ), modificationItems ); } catch ( ReferralException re ) { logModification = false; try { ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo ); Referral referral = newReferralsInfo.getNextReferral(); if ( referral != null ) { Connection referralConnection = ConnectionWrapperUtils.getReferralConnection( referral, monitor, this ); if ( referralConnection != null ) { List<String> urls = new ArrayList<String>( referral.getLdapUrls() ); String referralDn = new LdapURL( urls.get( 0 ) ).getDn().getName(); referralConnection.getConnectionWrapper().modifyEntry( referralDn, modificationItems, controls, monitor, newReferralsInfo ); } else { canceled = true; } } return; } catch ( NamingException ne ) { namingException = ne; } catch ( LdapURLEncodingException e ) { namingException = new NamingException( e.getMessage() ); } } catch ( NamingException ne ) { namingException = ne; } if ( logModification ) { for ( IJndiLogger logger : getJndiLoggers() ) { logger.logChangetypeModify( connection, dn, modificationItems, controls, namingException ); } } } }; try { checkConnectionAndRunAndMonitor( runnable, monitor ); } catch ( NamingException ne ) { monitor.reportError( ne ); } if ( runnable.isCanceled() ) { monitor.setCanceled( true ); } if ( runnable.getException() != null ) { monitor.reportError( runnable.getException() ); } } /** * Renames an entry. * * @param oldDn the old DN * @param newDn the new DN * @param deleteOldRdn true to delete the old RDN * @param controls the controls * @param monitor the progress monitor * @param referralsInfo the referrals info */ public void renameEntry( final String oldDn, final String newDn, final boolean deleteOldRdn, final Control[] controls, final StudioProgressMonitor monitor, final ReferralsInfo referralsInfo ) { if ( connection.isReadOnly() ) { monitor.reportError( NLS.bind( Messages.error__connection_is_readonly, connection.getName() ) ); return; } InnerRunnable runnable = new InnerRunnable() { public void run() { boolean logModification = true; try { // create modify context LdapContext modCtx = context.newInstance( controls ); // use "throw" as we handle referrals manually modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW ); // delete old RDN if ( deleteOldRdn ) { modCtx.addToEnvironment( JAVA_NAMING_LDAP_DELETE_RDN, "true" ); //$NON-NLS-1$ } else { modCtx.addToEnvironment( JAVA_NAMING_LDAP_DELETE_RDN, "false" ); //$NON-NLS-1$ } // rename entry modCtx.rename( getSaveJndiName( oldDn ), getSaveJndiName( newDn ) ); } catch ( ReferralException re ) { logModification = false; try { ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo ); Referral referral = newReferralsInfo.getNextReferral(); if ( referral != null ) { Connection referralConnection = ConnectionWrapperUtils.getReferralConnection( referral, monitor, this ); if ( referralConnection != null ) { referralConnection.getConnectionWrapper().renameEntry( oldDn, newDn, deleteOldRdn, controls, monitor, newReferralsInfo ); } else { canceled = true; } } } catch ( NamingException ne ) { namingException = ne; } } catch ( NamingException ne ) { namingException = ne; } if ( logModification ) { for ( IJndiLogger logger : getJndiLoggers() ) { logger.logChangetypeModDn( connection, oldDn, newDn, deleteOldRdn, controls, namingException ); } } } }; try { checkConnectionAndRunAndMonitor( runnable, monitor ); } catch ( NamingException ne ) { monitor.reportError( ne ); } if ( runnable.isCanceled() ) { monitor.setCanceled( true ); } if ( runnable.getException() != null ) { monitor.reportError( runnable.getException() ); } } /** * Creates an entry. * * @param dn the entry's DN * @param attributes the entry's attributes * @param controls the controls * @param monitor the progress monitor * @param referralsInfo the referrals info */ public void createEntry( final String dn, final Attributes attributes, final Control[] controls, final StudioProgressMonitor monitor, final ReferralsInfo referralsInfo ) { if ( connection.isReadOnly() ) { monitor.reportError( NLS.bind( Messages.error__connection_is_readonly, connection.getName() ) ); return; } InnerRunnable runnable = new InnerRunnable() { public void run() { boolean logModification = true; try { // create modify context LdapContext modCtx = context.newInstance( controls ); // use "throw" as we handle referrals manually modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW ); // create entry modCtx.createSubcontext( getSaveJndiName( dn ), attributes ); } catch ( ReferralException re ) { logModification = false; try { ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo ); Referral referral = newReferralsInfo.getNextReferral(); if ( referral != null ) { Connection referralConnection = ConnectionWrapperUtils.getReferralConnection( referral, monitor, this ); if ( referralConnection != null ) { List<String> urls = new ArrayList<String>( referral.getLdapUrls() ); String referralDn = new LdapURL( urls.get( 0 ) ).getDn().getName(); referralConnection.getConnectionWrapper().createEntry( referralDn, attributes, controls, monitor, newReferralsInfo ); } else { canceled = true; } } } catch ( NamingException ne ) { namingException = ne; } catch ( LdapURLEncodingException e ) { namingException = new NamingException( e.getMessage() ); } } catch ( NamingException ne ) { namingException = ne; } if ( logModification ) { for ( IJndiLogger logger : getJndiLoggers() ) { logger.logChangetypeAdd( connection, dn, attributes, controls, namingException ); } } } }; try { checkConnectionAndRunAndMonitor( runnable, monitor ); } catch ( NamingException ne ) { monitor.reportError( ne ); } if ( runnable.isCanceled() ) { monitor.setCanceled( true ); } if ( runnable.getException() != null ) { monitor.reportError( runnable.getException() ); } } /** * Deletes an entry. * * @param dn the DN of the entry to delete * @param controls the controls * @param monitor the progress monitor * @param referralsInfo the referrals info */ public void deleteEntry( final String dn, final Control[] controls, final StudioProgressMonitor monitor, final ReferralsInfo referralsInfo ) { if ( connection.isReadOnly() ) { monitor.reportError( NLS.bind( Messages.error__connection_is_readonly, connection.getName() ) ); return; } InnerRunnable runnable = new InnerRunnable() { public void run() { boolean logModification = true; try { // create modify context LdapContext modCtx = context.newInstance( controls ); // use "throw" as we handle referrals manually modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW ); // delete entry modCtx.destroySubcontext( getSaveJndiName( dn ) ); } catch ( ReferralException re ) { logModification = false; try { ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo ); Referral referral = newReferralsInfo.getNextReferral(); if ( referral != null ) { Connection referralConnection = ConnectionWrapperUtils.getReferralConnection( referral, monitor, this ); if ( referralConnection != null ) { List<String> urls = new ArrayList<String>( referral.getLdapUrls() ); String referralDn = new LdapURL( urls.get( 0 ) ).getDn().getName(); referralConnection.getConnectionWrapper().deleteEntry( referralDn, controls, monitor, newReferralsInfo ); } else { canceled = true; } } } catch ( NamingException ne ) { namingException = ne; } catch ( LdapURLEncodingException e ) { namingException = new NamingException( e.getMessage() ); } } catch ( NamingException ne ) { namingException = ne; } if ( logModification ) { for ( IJndiLogger logger : getJndiLoggers() ) { logger.logChangetypeDelete( connection, dn, controls, namingException ); } } } }; try { checkConnectionAndRunAndMonitor( runnable, monitor ); } catch ( NamingException ne ) { monitor.reportError( ne ); } if ( runnable.isCanceled() ) { monitor.setCanceled( true ); } if ( runnable.getException() != null ) { monitor.reportError( runnable.getException() ); } } private void doConnect( final StudioProgressMonitor monitor ) throws NamingException { context = null; isConnected = true; // setup connection parameters String host = connection.getConnectionParameter().getHost(); int port = connection.getConnectionParameter().getPort(); useLdaps = connection.getConnectionParameter().getEncryptionMethod() == ConnectionParameter.EncryptionMethod.LDAPS; useStartTLS = connection.getConnectionParameter().getEncryptionMethod() == ConnectionParameter.EncryptionMethod.START_TLS; environment = new Hashtable<String, String>(); Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences(); final boolean validateCertificates = preferences .getBoolean( ConnectionCoreConstants.PREFERENCE_VALIDATE_CERTIFICATES ); String ldapCtxFactory = preferences.getString( ConnectionCoreConstants.PREFERENCE_LDAP_CONTEXT_FACTORY ); environment.put( Context.INITIAL_CONTEXT_FACTORY, ldapCtxFactory ); environment.put( JAVA_NAMING_LDAP_VERSION, "3" ); //$NON-NLS-1$ // timeouts // Don't use a timeout when using ldaps: JNDI throws a SocketException // when setting a timeout on SSL connections. if ( !useLdaps ) { environment.put( COM_SUN_JNDI_LDAP_CONNECT_TIMEOUT, "10000" ); //$NON-NLS-1$ } environment.put( COM_SUN_JNDI_DNS_TIMEOUT_INITIAL, "2000" ); //$NON-NLS-1$ environment.put( COM_SUN_JNDI_DNS_TIMEOUT_RETRIES, "3" ); //$NON-NLS-1$ // ldaps:// if ( useLdaps ) { environment.put( Context.PROVIDER_URL, LdapURL.LDAPS_SCHEME + host + ':' + port ); environment.put( Context.SECURITY_PROTOCOL, "ssl" ); //$NON-NLS-1$ // host name verification is done in StudioTrustManager environment.put( JAVA_NAMING_LDAP_FACTORY_SOCKET, validateCertificates ? StudioSSLSocketFactory.class .getName() : DummySSLSocketFactory.class.getName() ); } else { environment.put( Context.PROVIDER_URL, LdapURL.LDAP_SCHEME + host + ':' + port ); } if ( binaryAttributes != null ) { setBinaryAttributes( binaryAttributes ); } InnerRunnable runnable = new InnerRunnable() { public void run() { try { context = new InitialLdapContext( environment, null ); if ( useStartTLS ) { try { StartTlsResponse tls = ( StartTlsResponse ) context .extendedOperation( new StartTlsRequest() ); // deactivate host name verification at this level, // host name verification is done in StudioTrustManager tls.setHostnameVerifier( new HostnameVerifier() { public boolean verify( String hostname, SSLSession session ) { return true; } } ); if ( validateCertificates ) { tls.negotiate( StudioSSLSocketFactory.getDefault() ); } else { tls.negotiate( DummySSLSocketFactory.getDefault() ); } } catch ( Exception e ) { namingException = new NamingException( e.getMessage() != null ? e.getMessage() : "Error while establishing TLS session" ); //$NON-NLS-1$ namingException.setRootCause( e ); context.close(); } } } catch ( NamingException ne ) { namingException = ne; } } }; runAndMonitor( runnable, monitor ); if ( runnable.getException() != null ) { throw runnable.getException(); } else if ( context != null ) { // all OK } else { throw new NamingException( "???" ); //$NON-NLS-1$ } } private void doBind( final StudioProgressMonitor monitor ) throws NamingException { if ( context != null && isConnected ) { // setup authentication methdod authMethod = AUTHMETHOD_NONE; if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SIMPLE ) { authMethod = AUTHMETHOD_SIMPLE; } else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5 ) { authMethod = AUTHMETHOD_DIGEST_MD5; saslRealm = connection.getConnectionParameter().getSaslRealm(); } else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_CRAM_MD5 ) { authMethod = AUTHMETHOD_CRAM_MD5; } else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_GSSAPI ) { authMethod = AUTHMETHOD_GSSAPI; } // setup credentials IAuthHandler authHandler = ConnectionCorePlugin.getDefault().getAuthHandler(); if ( authHandler == null ) { NamingException namingException = new NamingException( Messages.model__no_auth_handler ); monitor.reportError( Messages.model__no_auth_handler, namingException ); throw namingException; } ICredentials credentials = authHandler.getCredentials( connection.getConnectionParameter() ); if ( credentials == null ) { CancelException cancelException = new CancelException(); monitor.setCanceled( true ); monitor.reportError( Messages.model__no_credentials, cancelException ); throw cancelException; } if ( credentials.getBindPrincipal() == null || credentials.getBindPassword() == null ) { NamingException namingException = new NamingException( Messages.model__no_credentials ); monitor.reportError( Messages.model__no_credentials, namingException ); throw namingException; } bindPrincipal = credentials.getBindPrincipal(); bindCredentials = credentials.getBindPassword(); InnerRunnable runnable = new InnerRunnable() { public void run() { try { context.removeFromEnvironment( Context.SECURITY_AUTHENTICATION ); context.removeFromEnvironment( Context.SECURITY_PRINCIPAL ); context.removeFromEnvironment( Context.SECURITY_CREDENTIALS ); context.removeFromEnvironment( JAVA_NAMING_SECURITY_SASL_REALM ); context.addToEnvironment( Context.SECURITY_AUTHENTICATION, authMethod ); // SASL options if ( connection.getConnectionParameter().getAuthMethod() == AuthenticationMethod.SASL_CRAM_MD5 || connection.getConnectionParameter().getAuthMethod() == AuthenticationMethod.SASL_DIGEST_MD5 || connection.getConnectionParameter().getAuthMethod() == AuthenticationMethod.SASL_GSSAPI ) { // Request quality of protection switch ( connection.getConnectionParameter().getSaslQop() ) { case AUTH: context.addToEnvironment( "javax.security.sasl.qop", "auth" ); break; case AUTH_INT: context.addToEnvironment( "javax.security.sasl.qop", "auth-int" ); break; case AUTH_INT_PRIV: context.addToEnvironment( "javax.security.sasl.qop", "auth-conf" ); break; } // Request mutual authentication if ( connection.getConnectionParameter().isSaslMutualAuthentication() ) { context.addToEnvironment( "javax.security.sasl.server.authentication", "true" ); } else { context.removeFromEnvironment( "javax.security.sasl.server.authentication" ); } // Request cryptographic protection strength switch ( connection.getConnectionParameter().getSaslSecurityStrength() ) { case HIGH: context.addToEnvironment( "javax.security.sasl.strength", "high" ); break; case MEDIUM: context.addToEnvironment( "javax.security.sasl.strength", "medium" ); break; case LOW: context.addToEnvironment( "javax.security.sasl.strength", "low" ); break; } } // Bind if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_GSSAPI ) { // GSSAPI doGssapiBind( this ); } else { // no GSSAPI context.addToEnvironment( Context.SECURITY_PRINCIPAL, bindPrincipal ); context.addToEnvironment( Context.SECURITY_CREDENTIALS, bindCredentials ); if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5 && StringUtils.isNotEmpty( saslRealm ) ) { context.addToEnvironment( JAVA_NAMING_SECURITY_SASL_REALM, saslRealm ); } context.reconnect( context.getConnectControls() ); } } catch ( NamingException ne ) { namingException = ne; } } }; runAndMonitor( runnable, monitor ); if ( runnable.getException() != null ) { throw runnable.getException(); } else if ( context != null ) { // all OK } else { throw new NamingException( "???" ); //$NON-NLS-1$ } } else { throw new NamingException( NO_CONNECTION ); } } private void doGssapiBind( final InnerRunnable innerRunnable ) throws NamingException { File configFile = null; try { Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences(); boolean useKrb5SystemProperties = preferences .getBoolean( ConnectionCoreConstants.PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES ); String krb5LoginModule = preferences.getString( ConnectionCoreConstants.PREFERENCE_KRB5_LOGIN_MODULE ); if ( !useKrb5SystemProperties ) { // Kerberos Configuration switch ( connection.getConnectionParameter().getKrb5Configuration() ) { case DEFAULT: // nothing System.clearProperty( "java.security.krb5.conf" ); break; case FILE: // use specified krb5.conf System.setProperty( "java.security.krb5.conf", connection.getConnectionParameter() .getKrb5ConfigurationFile() ); break; case MANUAL: // write manual config parameters to connection specific krb5.conf file String fileName = Utils.getFilenameString( connection.getId() ) + ".krb5.conf"; configFile = ConnectionCorePlugin.getDefault().getStateLocation().append( fileName ).toFile(); String realm = connection.getConnectionParameter().getKrb5Realm(); String host = connection.getConnectionParameter().getKrb5KdcHost(); int port = connection.getConnectionParameter().getKrb5KdcPort(); StringBuilder sb = new StringBuilder(); sb.append( "[libdefaults]" ).append( ConnectionCoreConstants.LINE_SEPARATOR ); sb.append( "default_realm = " ).append( realm ).append( ConnectionCoreConstants.LINE_SEPARATOR ); sb.append( "[realms]" ).append( ConnectionCoreConstants.LINE_SEPARATOR ); sb.append( realm ).append( " = {" ).append( ConnectionCoreConstants.LINE_SEPARATOR ); sb.append( "kdc = " ).append( host ).append( ":" ).append( port ).append( ConnectionCoreConstants.LINE_SEPARATOR ); sb.append( "}" ).append( ConnectionCoreConstants.LINE_SEPARATOR ); try { FileUtils.writeStringToFile( configFile, sb.toString() ); } catch ( IOException ioe ) { NamingException ne = new NamingException(); ne.setRootCause( ioe ); throw ne; } System.setProperty( "java.security.krb5.conf", configFile.getAbsolutePath() ); } // Use our custom configuration so we don't need to mess with external configuration Configuration.setConfiguration( new InnerConfiguration( krb5LoginModule ) ); } // Gets the TGT, either from native ticket cache or obtain new from KDC LoginContext lc = null; try { lc = new LoginContext( this.getClass().getName(), new InnerCallbackHandler() ); lc.login(); } catch ( LoginException le ) { NamingException ne = new NamingException(); ne.setRootCause( le ); throw ne; } // Login to LDAP server, obtains a service ticket from KDC Subject.doAs( lc.getSubject(), new PrivilegedAction<Object>() { public Object run() { try { context.reconnect( context.getConnectControls() ); } catch ( NamingException ne ) { innerRunnable.namingException = ne; } return null; } } ); } finally { // delete temporary config file if ( configFile != null && configFile.exists() ) { configFile.delete(); } } } private void checkConnectionAndRunAndMonitor( final InnerRunnable runnable, final StudioProgressMonitor monitor ) throws NamingException { // check connection if ( !isConnected || context == null ) { doConnect( monitor ); doBind( monitor ); } if ( context == null ) { throw new NamingException( NO_CONNECTION ); } // loop for reconnection for ( int i = 0; i <= 1; i++ ) { runAndMonitor( runnable, monitor ); // check reconnection if ( i == 0 && runnable.getException() != null && ( ( runnable.getException() instanceof CommunicationException ) || ( runnable.getException() instanceof ServiceUnavailableException ) || ( runnable.getException() instanceof InsufficientResourcesException ) ) ) { doConnect( monitor ); doBind( monitor ); runnable.reset(); } else { break; } } } private void runAndMonitor( final InnerRunnable runnable, final StudioProgressMonitor monitor ) throws CancelException { if ( !monitor.isCanceled() ) { // monitor StudioProgressMonitor.CancelListener listener = new StudioProgressMonitor.CancelListener() { public void cancelRequested( StudioProgressMonitor.CancelEvent event ) { if ( monitor.isCanceled() ) { if ( jobThread != null && jobThread.isAlive() ) { jobThread.interrupt(); } if ( context != null ) { try { context.close(); } catch ( NamingException ne ) { } isConnected = false; context = null; System.gc(); } isConnected = false; } } }; monitor.addCancelListener( listener ); jobThread = Thread.currentThread(); // run try { // try { // Thread.sleep(5000); // } catch (InterruptedException e) { // System.out.println(System.currentTimeMillis() + ": sleep // interrupted!"); // } // System.out.println(System.currentTimeMillis() + ": " + // runnable); runnable.run(); } finally { monitor.removeCancelListener( listener ); jobThread = null; } if ( monitor.isCanceled() ) { throw new CancelException(); } } } private final class InnerConfiguration extends Configuration { private String krb5LoginModule; private AppConfigurationEntry[] configList = null; public InnerConfiguration( String krb5LoginModule ) { this.krb5LoginModule = krb5LoginModule; } public AppConfigurationEntry[] getAppConfigurationEntry( String applicationName ) { if ( configList == null ) { HashMap<String, Object> options = new HashMap<String, Object>(); // TODO: this only works for Sun JVM options.put( "refreshKrb5Config", "true" ); switch ( connection.getConnectionParameter().getKrb5CredentialConfiguration() ) { case USE_NATIVE: options.put( "useTicketCache", "true" ); options.put( "doNotPrompt", "true" ); break; case OBTAIN_TGT: options.put( "doNotPrompt", "false" ); break; } configList = new AppConfigurationEntry[1]; configList[0] = new AppConfigurationEntry( krb5LoginModule, LoginModuleControlFlag.REQUIRED, options ); } return configList; } public void refresh() { } } private final class InnerCallbackHandler implements CallbackHandler { public void handle( Callback[] callbacks ) throws UnsupportedCallbackException, IOException { for ( int ii = 0; ii < callbacks.length; ii++ ) { Callback callBack = callbacks[ii]; if ( callBack instanceof NameCallback ) { // Handles username callback. NameCallback nameCallback = ( NameCallback ) callBack; nameCallback.setName( bindPrincipal ); } else if ( callBack instanceof PasswordCallback ) { // Handles password callback. PasswordCallback passwordCallback = ( PasswordCallback ) callBack; passwordCallback.setPassword( bindCredentials.toCharArray() ); } else { throw new UnsupportedCallbackException( callBack, "Callback not supported" ); } } } } abstract class InnerRunnable implements Runnable { protected JndiStudioNamingEnumeration namingEnumeration = null; protected NamingException namingException = null; protected boolean canceled = false; /** * Gets the exception. * * @return the exception */ public NamingException getException() { return namingException; } /** * Gets the result. * * @return the result */ public JndiStudioNamingEnumeration getResult() { return namingEnumeration; } /** * Checks if is canceled. * * @return true, if is canceled */ public boolean isCanceled() { return canceled; } /** * Reset. */ public void reset() { namingEnumeration = null; namingException = null; canceled = false; } } private List<IJndiLogger> getJndiLoggers() { return ConnectionCorePlugin.getDefault().getJndiLoggers(); } /** * Translates the alias dereferencing method to its JNDI specific string. * * @param aliasDereferencingMethod the alias dereferencing method * * @return the JNDI specific alias dereferencing method string */ private String translateDerefAliasMethod( AliasDereferencingMethod aliasDereferencingMethod ) { String m = ALIAS_ALWAYS; switch ( aliasDereferencingMethod ) { case NEVER: m = ALIAS_NEVER; break; case ALWAYS: m = ALIAS_ALWAYS; break; case FINDING: m = ALIAS_FINDING; break; case SEARCH: m = ALIAS_SEARCHING; break; } return m; } /** * Gets a Name object that is save for JNDI operations. * <p> * In JNDI we have could use the following classes for names: * <ul> * <li>DN as String</li> * <li>javax.naming.CompositeName</li> * <li>javax.naming.ldap.LdapName (since Java5)</li> * <li>org.apache.directory.shared.ldap.name.LdapDN</li> * </ul> * <p> * There are some drawbacks when using this classes: * <ul> * <li>When passing DN as String, JNDI doesn't handle slashes '/' correctly. * So we must use a Name object here.</li> * <li>With CompositeName we have the same problem with slashes '/'.</li> * <li>When using LdapDN from shared-ldap, JNDI uses the toString() method * and LdapDN.toString() returns the normalized ATAV, but we need the * user provided ATAV.</li> * <li>When using LdapName for the empty DN (Root DSE) JNDI _sometimes_ throws * an Exception (java.lang.IndexOutOfBoundsException: Posn: -1, Size: 0 * at javax.naming.ldap.LdapName.getPrefix(LdapName.java:240)).</li> * <li>Using LdapDN for the RootDSE doesn't work with Apache Harmony because * its JNDI provider only accepts intstances of CompositeName or LdapName.</li> * </ul> * <p> * So we use LdapName as default and the CompositeName for the empty DN. * * @param name the DN * * @return the save JNDI name * * @throws InvalidNameException the invalid name exception */ static Name getSaveJndiName( String name ) throws InvalidNameException { if ( name == null || StringUtils.isEmpty( name ) ) //$NON-NLS-1$ { return new CompositeName(); } else { return new LdapName( name ); } } /** * Retrieves all referrals from the ReferralException and * creates or updates the ReferralsInfo. * * @param referralException the referral exception * @param initialReferralsInfo the initial referrals info, may be null * * @return the created or updated referrals info * * @throws NamingException if a loop was encountered. */ static ReferralsInfo handleReferralException( ReferralException referralException, ReferralsInfo initialReferralsInfo ) throws NamingException { if ( initialReferralsInfo == null ) { initialReferralsInfo = new ReferralsInfo(); } Referral referral = handleReferralException( referralException, initialReferralsInfo, null ); while ( referralException.skipReferral() ) { try { Context ctx = referralException.getReferralContext(); ctx.list( StringUtils.EMPTY ); //$NON-NLS-1$ } catch ( NamingException ne ) { if ( ne instanceof ReferralException ) { if ( ne != referralException ) { // what a hack: // if the same exception is throw, we have another URL for the same Referral/SearchResultReference // if another exception is throws, we have a new Referral/SearchResultReference // in the latter case we null out the reference, a new one will be created by handleReferral() referral = null; } referralException = ( ReferralException ) ne; referral = handleReferralException( referralException, initialReferralsInfo, referral ); } else { break; } } } return initialReferralsInfo; } private static Referral handleReferralException( ReferralException referralException, ReferralsInfo initialReferralsInfo, Referral referral ) throws NamingException { String info = ( String ) referralException.getReferralInfo(); if ( referral == null ) { referral = new ReferralImpl(); initialReferralsInfo.addReferral( referral ); } referral.addLdapUrl( info ); return referral; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
59c3225db3ee3b1741817c62cff355bdba1d305e
b7b1a996c56a960c7715b594ceecfc4b514ee705
/src/main/java/org/bian/dto/BQTechnicalSpecificationRetrieveInputModelTechnicalSpecificationInstanceAnalysis.java
3e59ce94f9f5317b1bfa15bb6fbc3159a80d0df5
[ "Apache-2.0" ]
permissive
bianapis/sd-system-development-v2
afc02dcffccb89feecbf40463bfaa4e5ad1bd504
f84358dfc10f6bf01f18bfe2d8e59da7de6e4268
refs/heads/master
2020-07-22T21:04:43.626329
2019-09-10T06:15:39
2019-09-10T06:15:39
207,327,078
0
0
null
null
null
null
UTF-8
Java
false
false
1,163
java
package org.bian.dto; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; /** * BQTechnicalSpecificationRetrieveInputModelTechnicalSpecificationInstanceAnalysis */ public class BQTechnicalSpecificationRetrieveInputModelTechnicalSpecificationInstanceAnalysis { private String technicalSpecificationInstanceAnalysisReference = null; /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the control record instance analysis view * @return technicalSpecificationInstanceAnalysisReference **/ public String getTechnicalSpecificationInstanceAnalysisReference() { return technicalSpecificationInstanceAnalysisReference; } public void setTechnicalSpecificationInstanceAnalysisReference(String technicalSpecificationInstanceAnalysisReference) { this.technicalSpecificationInstanceAnalysisReference = technicalSpecificationInstanceAnalysisReference; } }
[ "team1@bian.org" ]
team1@bian.org
da6fc984aced8cfa71dabeef42b3f6ad55f317f6
92400ffd9cfa03c701f9ef901b7802c4ae130950
/src/com/thoughtworks/xstream/XStream.java
db2c1040fd624158aeb11eebd1da003e81f8bc4d
[]
no_license
zhengyouxiang/yihaodian_android
2e56177ea12e78dfcfd93fc563d036ca105d0469
79af41a99a824f8eed130ecb559fc9fbc1aa0db8
refs/heads/master
2020-12-29T02:54:17.718722
2012-03-07T06:25:40
2012-03-07T06:25:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
79,220
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) package com.thoughtworks.xstream; import com.thoughtworks.xstream.alias.ClassMapper; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.ConverterLookup; import com.thoughtworks.xstream.converters.ConverterRegistry; import com.thoughtworks.xstream.converters.DataHolder; import com.thoughtworks.xstream.converters.SingleValueConverter; import com.thoughtworks.xstream.converters.SingleValueConverterWrapper; import com.thoughtworks.xstream.converters.basic.BigDecimalConverter; import com.thoughtworks.xstream.converters.basic.BigIntegerConverter; import com.thoughtworks.xstream.converters.basic.BooleanConverter; import com.thoughtworks.xstream.converters.basic.ByteConverter; import com.thoughtworks.xstream.converters.basic.CharConverter; import com.thoughtworks.xstream.converters.basic.DateConverter; import com.thoughtworks.xstream.converters.basic.DoubleConverter; import com.thoughtworks.xstream.converters.basic.FloatConverter; import com.thoughtworks.xstream.converters.basic.IntConverter; import com.thoughtworks.xstream.converters.basic.LongConverter; import com.thoughtworks.xstream.converters.basic.NullConverter; import com.thoughtworks.xstream.converters.basic.ShortConverter; import com.thoughtworks.xstream.converters.basic.StringBufferConverter; import com.thoughtworks.xstream.converters.basic.StringConverter; import com.thoughtworks.xstream.converters.basic.URLConverter; import com.thoughtworks.xstream.converters.collections.ArrayConverter; import com.thoughtworks.xstream.converters.collections.BitSetConverter; import com.thoughtworks.xstream.converters.collections.CharArrayConverter; import com.thoughtworks.xstream.converters.collections.CollectionConverter; import com.thoughtworks.xstream.converters.collections.MapConverter; import com.thoughtworks.xstream.converters.collections.PropertiesConverter; import com.thoughtworks.xstream.converters.collections.TreeMapConverter; import com.thoughtworks.xstream.converters.collections.TreeSetConverter; import com.thoughtworks.xstream.converters.extended.ColorConverter; import com.thoughtworks.xstream.converters.extended.DynamicProxyConverter; import com.thoughtworks.xstream.converters.extended.EncodedByteArrayConverter; import com.thoughtworks.xstream.converters.extended.FileConverter; import com.thoughtworks.xstream.converters.extended.FontConverter; import com.thoughtworks.xstream.converters.extended.GregorianCalendarConverter; import com.thoughtworks.xstream.converters.extended.JavaClassConverter; import com.thoughtworks.xstream.converters.extended.JavaMethodConverter; import com.thoughtworks.xstream.converters.extended.LocaleConverter; import com.thoughtworks.xstream.converters.extended.LookAndFeelConverter; import com.thoughtworks.xstream.converters.extended.SqlDateConverter; import com.thoughtworks.xstream.converters.extended.SqlTimeConverter; import com.thoughtworks.xstream.converters.extended.SqlTimestampConverter; import com.thoughtworks.xstream.converters.extended.TextAttributeConverter; import com.thoughtworks.xstream.converters.reflection.ExternalizableConverter; import com.thoughtworks.xstream.converters.reflection.ReflectionConverter; import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; import com.thoughtworks.xstream.converters.reflection.SelfStreamingInstanceChecker; import com.thoughtworks.xstream.converters.reflection.SerializableConverter; import com.thoughtworks.xstream.core.DefaultConverterLookup; import com.thoughtworks.xstream.core.JVM; import com.thoughtworks.xstream.core.MapBackedDataHolder; import com.thoughtworks.xstream.core.ReferenceByIdMarshallingStrategy; import com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy; import com.thoughtworks.xstream.core.TreeMarshallingStrategy; import com.thoughtworks.xstream.core.util.ClassLoaderReference; import com.thoughtworks.xstream.core.util.CompositeClassLoader; import com.thoughtworks.xstream.core.util.CustomObjectInputStream; import com.thoughtworks.xstream.core.util.CustomObjectOutputStream; import com.thoughtworks.xstream.io.HierarchicalStreamDriver; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.io.StatefulWriter; import com.thoughtworks.xstream.io.xml.XppDriver; import com.thoughtworks.xstream.mapper.AnnotationConfiguration; import com.thoughtworks.xstream.mapper.ArrayMapper; import com.thoughtworks.xstream.mapper.AttributeAliasingMapper; import com.thoughtworks.xstream.mapper.AttributeMapper; import com.thoughtworks.xstream.mapper.CachingMapper; import com.thoughtworks.xstream.mapper.ClassAliasingMapper; import com.thoughtworks.xstream.mapper.DefaultImplementationsMapper; import com.thoughtworks.xstream.mapper.DefaultMapper; import com.thoughtworks.xstream.mapper.DynamicProxyMapper; import com.thoughtworks.xstream.mapper.FieldAliasingMapper; import com.thoughtworks.xstream.mapper.ImmutableTypesMapper; import com.thoughtworks.xstream.mapper.ImplicitCollectionMapper; import com.thoughtworks.xstream.mapper.LocalConversionMapper; import com.thoughtworks.xstream.mapper.Mapper; import com.thoughtworks.xstream.mapper.MapperWrapper; import com.thoughtworks.xstream.mapper.OuterClassMapper; import com.thoughtworks.xstream.mapper.PackageAliasingMapper; import com.thoughtworks.xstream.mapper.SystemAttributeAliasingMapper; import com.thoughtworks.xstream.mapper.XStream11XmlFriendlyMapper; import java.io.*; import java.lang.reflect.Constructor; import java.lang.reflect.Proxy; // Referenced classes of package com.thoughtworks.xstream: // MarshallingStrategy, XStreamException public class XStream { public static class InitializationException extends XStreamException { public InitializationException(String s) { super(s); } public InitializationException(String s, Throwable throwable) { super(s, throwable); } } public XStream() { this(null, (Mapper)null, ((HierarchicalStreamDriver) (new XppDriver()))); } public XStream(ReflectionProvider reflectionprovider) { this(reflectionprovider, (Mapper)null, ((HierarchicalStreamDriver) (new XppDriver()))); } public XStream(ReflectionProvider reflectionprovider, ClassMapper classmapper, HierarchicalStreamDriver hierarchicalstreamdriver) { this(reflectionprovider, ((Mapper) (classmapper)), hierarchicalstreamdriver); } public XStream(ReflectionProvider reflectionprovider, ClassMapper classmapper, HierarchicalStreamDriver hierarchicalstreamdriver, String s) { this(reflectionprovider, ((Mapper) (classmapper)), hierarchicalstreamdriver); aliasAttribute(s, "class"); } public XStream(ReflectionProvider reflectionprovider, HierarchicalStreamDriver hierarchicalstreamdriver) { this(reflectionprovider, (Mapper)null, hierarchicalstreamdriver); } public XStream(ReflectionProvider reflectionprovider, HierarchicalStreamDriver hierarchicalstreamdriver, ClassLoader classloader) { this(reflectionprovider, hierarchicalstreamdriver, classloader, ((Mapper) (null))); } public XStream(ReflectionProvider reflectionprovider, HierarchicalStreamDriver hierarchicalstreamdriver, ClassLoader classloader, Mapper mapper1) { this(reflectionprovider, hierarchicalstreamdriver, classloader, mapper1, ((ConverterLookup) (new DefaultConverterLookup())), null); } public XStream(ReflectionProvider reflectionprovider, HierarchicalStreamDriver hierarchicalstreamdriver, ClassLoader classloader, Mapper mapper1, ConverterLookup converterlookup, ConverterRegistry converterregistry) { jvm = new JVM(); jvm = new JVM(); if(reflectionprovider == null) reflectionprovider = jvm.bestReflectionProvider(); reflectionProvider = reflectionprovider; hierarchicalStreamDriver = hierarchicalstreamdriver; ClassLoaderReference classloaderreference; ConverterRegistry converterregistry1; Mapper mapper2; if(classloader instanceof ClassLoaderReference) classloaderreference = (ClassLoaderReference)classloader; else classloaderreference = new ClassLoaderReference(classloader); classLoaderReference = classloaderreference; converterLookup = converterlookup; if(converterregistry != null) converterregistry1 = converterregistry; else if(converterlookup instanceof ConverterRegistry) converterregistry1 = (ConverterRegistry)converterlookup; else converterregistry1 = null; converterRegistry = converterregistry1; if(mapper1 == null) mapper2 = buildMapper(); else mapper2 = mapper1; mapper = mapper2; setupMappers(); setupAliases(); setupDefaultImplementations(); setupConverters(); setupImmutableTypes(); setMode(1003); } public XStream(ReflectionProvider reflectionprovider, Mapper mapper1, HierarchicalStreamDriver hierarchicalstreamdriver) { this(reflectionprovider, hierarchicalstreamdriver, ((ClassLoader) (new ClassLoaderReference(new CompositeClassLoader()))), mapper1, ((ConverterLookup) (new DefaultConverterLookup())), null); } public XStream(HierarchicalStreamDriver hierarchicalstreamdriver) { this(null, (Mapper)null, hierarchicalstreamdriver); } private Mapper buildMapper() { Object obj = new DefaultMapper(classLoaderReference); if(useXStream11XmlFriendlyMapper()) obj = new XStream11XmlFriendlyMapper(((Mapper) (obj))); AttributeMapper attributemapper = new AttributeMapper(new DefaultImplementationsMapper(new ArrayMapper(new OuterClassMapper(new ImplicitCollectionMapper(new SystemAttributeAliasingMapper(new AttributeAliasingMapper(new FieldAliasingMapper(new ClassAliasingMapper(new PackageAliasingMapper(new DynamicProxyMapper(((Mapper) (obj)))))))))))), converterLookup); Object obj1; if(JVM.is15()) { Class aclass1[] = new Class[1]; Object obj2; Class aclass[]; Object aobj[]; Class class6; Object aobj1[]; if(class$com$thoughtworks$xstream$mapper$Mapper == null) { class6 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper"); class$com$thoughtworks$xstream$mapper$Mapper = class6; } else { class6 = class$com$thoughtworks$xstream$mapper$Mapper; } aclass1[0] = class6; aobj1 = new Object[1]; aobj1[0] = attributemapper; obj1 = buildMapperDynamically("com.thoughtworks.xstream.mapper.EnumMapper", aclass1, aobj1); } else { obj1 = attributemapper; } obj2 = new ImmutableTypesMapper(new LocalConversionMapper(((Mapper) (obj1)))); if(JVM.is15()) { aclass = new Class[5]; Class class1; Class class2; Class class3; Class class4; Class class5; if(class$com$thoughtworks$xstream$mapper$Mapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper"); class$com$thoughtworks$xstream$mapper$Mapper = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$Mapper; } aclass[0] = class1; if(class$com$thoughtworks$xstream$converters$ConverterRegistry == null) { class2 = _mthclass$("com.thoughtworks.xstream.converters.ConverterRegistry"); class$com$thoughtworks$xstream$converters$ConverterRegistry = class2; } else { class2 = class$com$thoughtworks$xstream$converters$ConverterRegistry; } aclass[1] = class2; if(class$java$lang$ClassLoader == null) { class3 = _mthclass$("java.lang.ClassLoader"); class$java$lang$ClassLoader = class3; } else { class3 = class$java$lang$ClassLoader; } aclass[2] = class3; if(class$com$thoughtworks$xstream$converters$reflection$ReflectionProvider == null) { class4 = _mthclass$("com.thoughtworks.xstream.converters.reflection.ReflectionProvider"); class$com$thoughtworks$xstream$converters$reflection$ReflectionProvider = class4; } else { class4 = class$com$thoughtworks$xstream$converters$reflection$ReflectionProvider; } aclass[3] = class4; if(class$com$thoughtworks$xstream$core$JVM == null) { class5 = _mthclass$("com.thoughtworks.xstream.core.JVM"); class$com$thoughtworks$xstream$core$JVM = class5; } else { class5 = class$com$thoughtworks$xstream$core$JVM; } aclass[4] = class5; aobj = new Object[5]; aobj[0] = obj2; aobj[1] = converterLookup; aobj[2] = classLoaderReference; aobj[3] = reflectionProvider; aobj[4] = jvm; obj2 = buildMapperDynamically("com.thoughtworks.xstream.mapper.AnnotationMapper", aclass, aobj); } return new CachingMapper(wrapMapper((MapperWrapper)obj2)); } private Mapper buildMapperDynamically(String s, Class aclass[], Object aobj[]) { Mapper mapper1; try { mapper1 = (Mapper)Class.forName(s, false, classLoaderReference.getReference()).getConstructor(aclass).newInstance(aobj); } catch(Exception exception) { throw new InitializationException("Could not instantiate mapper : " + s, exception); } return mapper1; } static Class _mthclass$(String s) { Class class1; try { class1 = Class.forName(s); } catch(ClassNotFoundException classnotfoundexception) { throw new NoClassDefFoundError(classnotfoundexception.getMessage()); } return class1; } private void dynamicallyRegisterConverter(String s, int i, Class aclass[], Object aobj[]) { try { Object obj = Class.forName(s, false, classLoaderReference.getReference()).getConstructor(aclass).newInstance(aobj); if(obj instanceof Converter) registerConverter((Converter)obj, i); else if(obj instanceof SingleValueConverter) registerConverter((SingleValueConverter)obj, i); } catch(Exception exception) { throw new InitializationException("Could not instantiate converter : " + s, exception); } } private Object readResolve() { jvm = new JVM(); return this; } private void setupMappers() { Mapper mapper1 = mapper; Class class1; Mapper mapper2; Class class2; Mapper mapper3; Class class3; Mapper mapper4; Class class4; Mapper mapper5; Class class5; Mapper mapper6; Class class6; Mapper mapper7; Class class7; Mapper mapper8; Class class8; Mapper mapper9; Class class9; Mapper mapper10; Class class10; Mapper mapper11; Class class11; if(class$com$thoughtworks$xstream$mapper$PackageAliasingMapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.PackageAliasingMapper"); class$com$thoughtworks$xstream$mapper$PackageAliasingMapper = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$PackageAliasingMapper; } packageAliasingMapper = (PackageAliasingMapper)mapper1.lookupMapperOfType(class1); mapper2 = mapper; if(class$com$thoughtworks$xstream$mapper$ClassAliasingMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.ClassAliasingMapper"); class$com$thoughtworks$xstream$mapper$ClassAliasingMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$ClassAliasingMapper; } classAliasingMapper = (ClassAliasingMapper)mapper2.lookupMapperOfType(class2); mapper3 = mapper; if(class$com$thoughtworks$xstream$mapper$FieldAliasingMapper == null) { class3 = _mthclass$("com.thoughtworks.xstream.mapper.FieldAliasingMapper"); class$com$thoughtworks$xstream$mapper$FieldAliasingMapper = class3; } else { class3 = class$com$thoughtworks$xstream$mapper$FieldAliasingMapper; } fieldAliasingMapper = (FieldAliasingMapper)mapper3.lookupMapperOfType(class3); mapper4 = mapper; if(class$com$thoughtworks$xstream$mapper$AttributeMapper == null) { class4 = _mthclass$("com.thoughtworks.xstream.mapper.AttributeMapper"); class$com$thoughtworks$xstream$mapper$AttributeMapper = class4; } else { class4 = class$com$thoughtworks$xstream$mapper$AttributeMapper; } attributeMapper = (AttributeMapper)mapper4.lookupMapperOfType(class4); mapper5 = mapper; if(class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper == null) { class5 = _mthclass$("com.thoughtworks.xstream.mapper.AttributeAliasingMapper"); class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper = class5; } else { class5 = class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper; } attributeAliasingMapper = (AttributeAliasingMapper)mapper5.lookupMapperOfType(class5); mapper6 = mapper; if(class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper == null) { class6 = _mthclass$("com.thoughtworks.xstream.mapper.SystemAttributeAliasingMapper"); class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper = class6; } else { class6 = class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper; } systemAttributeAliasingMapper = (SystemAttributeAliasingMapper)mapper6.lookupMapperOfType(class6); mapper7 = mapper; if(class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper == null) { class7 = _mthclass$("com.thoughtworks.xstream.mapper.ImplicitCollectionMapper"); class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper = class7; } else { class7 = class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper; } implicitCollectionMapper = (ImplicitCollectionMapper)mapper7.lookupMapperOfType(class7); mapper8 = mapper; if(class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper == null) { class8 = _mthclass$("com.thoughtworks.xstream.mapper.DefaultImplementationsMapper"); class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper = class8; } else { class8 = class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper; } defaultImplementationsMapper = (DefaultImplementationsMapper)mapper8.lookupMapperOfType(class8); mapper9 = mapper; if(class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper == null) { class9 = _mthclass$("com.thoughtworks.xstream.mapper.ImmutableTypesMapper"); class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper = class9; } else { class9 = class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper; } immutableTypesMapper = (ImmutableTypesMapper)mapper9.lookupMapperOfType(class9); mapper10 = mapper; if(class$com$thoughtworks$xstream$mapper$LocalConversionMapper == null) { class10 = _mthclass$("com.thoughtworks.xstream.mapper.LocalConversionMapper"); class$com$thoughtworks$xstream$mapper$LocalConversionMapper = class10; } else { class10 = class$com$thoughtworks$xstream$mapper$LocalConversionMapper; } localConversionMapper = (LocalConversionMapper)mapper10.lookupMapperOfType(class10); mapper11 = mapper; if(class$com$thoughtworks$xstream$mapper$AnnotationConfiguration == null) { class11 = _mthclass$("com.thoughtworks.xstream.mapper.AnnotationConfiguration"); class$com$thoughtworks$xstream$mapper$AnnotationConfiguration = class11; } else { class11 = class$com$thoughtworks$xstream$mapper$AnnotationConfiguration; } annotationConfiguration = (AnnotationConfiguration)mapper11.lookupMapperOfType(class11); } public void addDefaultImplementation(Class class1, Class class2) { if(defaultImplementationsMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class3; if(class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper == null) { class3 = _mthclass$("com.thoughtworks.xstream.mapper.DefaultImplementationsMapper"); class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper = class3; } else { class3 = class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper; } throw new InitializationException(stringbuffer.append(class3.getName()).append(" available").toString()); } else { defaultImplementationsMapper.addDefaultImplementation(class1, class2); return; } } public void addImmutableType(Class class1) { if(immutableTypesMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.ImmutableTypesMapper"); class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { immutableTypesMapper.addImmutableType(class1); return; } } public void addImplicitCollection(Class class1, String s) { if(implicitCollectionMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.ImplicitCollectionMapper"); class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { implicitCollectionMapper.add(class1, s, null, null); return; } } public void addImplicitCollection(Class class1, String s, Class class2) { if(implicitCollectionMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class3; if(class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper == null) { class3 = _mthclass$("com.thoughtworks.xstream.mapper.ImplicitCollectionMapper"); class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper = class3; } else { class3 = class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper; } throw new InitializationException(stringbuffer.append(class3.getName()).append(" available").toString()); } else { implicitCollectionMapper.add(class1, s, null, class2); return; } } public void addImplicitCollection(Class class1, String s, String s1, Class class2) { if(implicitCollectionMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class3; if(class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper == null) { class3 = _mthclass$("com.thoughtworks.xstream.mapper.ImplicitCollectionMapper"); class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper = class3; } else { class3 = class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper; } throw new InitializationException(stringbuffer.append(class3.getName()).append(" available").toString()); } else { implicitCollectionMapper.add(class1, s, s1, class2); return; } } public void alias(String s, Class class1) { if(classAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$ClassAliasingMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.ClassAliasingMapper"); class$com$thoughtworks$xstream$mapper$ClassAliasingMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$ClassAliasingMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { classAliasingMapper.addClassAlias(s, class1); return; } } public void alias(String s, Class class1, Class class2) { alias(s, class1); addDefaultImplementation(class2, class1); } public void aliasAttribute(Class class1, String s, String s1) { aliasField(s1, class1, s); useAttributeFor(class1, s); } public void aliasAttribute(String s, String s1) { if(attributeAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class1; if(class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.AttributeAliasingMapper"); class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper; } throw new InitializationException(stringbuffer.append(class1.getName()).append(" available").toString()); } else { attributeAliasingMapper.addAliasFor(s1, s); return; } } public void aliasField(String s, Class class1, String s1) { if(fieldAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$FieldAliasingMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.FieldAliasingMapper"); class$com$thoughtworks$xstream$mapper$FieldAliasingMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$FieldAliasingMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { fieldAliasingMapper.addFieldAlias(s, class1, s1); return; } } public void aliasPackage(String s, String s1) { if(packageAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class1; if(class$com$thoughtworks$xstream$mapper$PackageAliasingMapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.PackageAliasingMapper"); class$com$thoughtworks$xstream$mapper$PackageAliasingMapper = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$PackageAliasingMapper; } throw new InitializationException(stringbuffer.append(class1.getName()).append(" available").toString()); } else { packageAliasingMapper.addPackageAlias(s, s1); return; } } public void aliasSystemAttribute(String s, String s1) { if(systemAttributeAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class1; if(class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.SystemAttributeAliasingMapper"); class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper; } throw new InitializationException(stringbuffer.append(class1.getName()).append(" available").toString()); } else { systemAttributeAliasingMapper.addAliasFor(s1, s); return; } } public void aliasType(String s, Class class1) { if(classAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$ClassAliasingMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.ClassAliasingMapper"); class$com$thoughtworks$xstream$mapper$ClassAliasingMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$ClassAliasingMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { classAliasingMapper.addTypeAlias(s, class1); return; } } public void autodetectAnnotations(boolean flag) { if(annotationConfiguration != null) annotationConfiguration.autodetectAnnotations(flag); } public ObjectInputStream createObjectInputStream(final HierarchicalStreamReader reader) throws IOException { return new CustomObjectInputStream(new _cls3()); } public ObjectInputStream createObjectInputStream(InputStream inputstream) throws IOException { return createObjectInputStream(hierarchicalStreamDriver.createReader(inputstream)); } public ObjectInputStream createObjectInputStream(Reader reader) throws IOException { return createObjectInputStream(hierarchicalStreamDriver.createReader(reader)); } public ObjectOutputStream createObjectOutputStream(HierarchicalStreamWriter hierarchicalstreamwriter) throws IOException { return createObjectOutputStream(hierarchicalstreamwriter, "object-stream"); } public ObjectOutputStream createObjectOutputStream(HierarchicalStreamWriter hierarchicalstreamwriter, String s) throws IOException { final StatefulWriter statefulWriter = new StatefulWriter(hierarchicalstreamwriter); statefulWriter.startNode(s, null); return new CustomObjectOutputStream(new _cls2()); } public ObjectOutputStream createObjectOutputStream(OutputStream outputstream) throws IOException { return createObjectOutputStream(hierarchicalStreamDriver.createWriter(outputstream), "object-stream"); } public ObjectOutputStream createObjectOutputStream(OutputStream outputstream, String s) throws IOException { return createObjectOutputStream(hierarchicalStreamDriver.createWriter(outputstream), s); } public ObjectOutputStream createObjectOutputStream(Writer writer) throws IOException { return createObjectOutputStream(hierarchicalStreamDriver.createWriter(writer), "object-stream"); } public ObjectOutputStream createObjectOutputStream(Writer writer, String s) throws IOException { return createObjectOutputStream(hierarchicalStreamDriver.createWriter(writer), s); } public Object fromXML(InputStream inputstream) { return unmarshal(hierarchicalStreamDriver.createReader(inputstream), null); } public Object fromXML(InputStream inputstream, Object obj) { return unmarshal(hierarchicalStreamDriver.createReader(inputstream), obj); } public Object fromXML(Reader reader) { return unmarshal(hierarchicalStreamDriver.createReader(reader), null); } public Object fromXML(Reader reader, Object obj) { return unmarshal(hierarchicalStreamDriver.createReader(reader), obj); } public Object fromXML(String s) { return fromXML(((Reader) (new StringReader(s)))); } public Object fromXML(String s, Object obj) { return fromXML(((Reader) (new StringReader(s))), obj); } public ClassLoader getClassLoader() { return classLoaderReference.getReference(); } public ClassMapper getClassMapper() { ClassMapper classmapper; if(mapper instanceof ClassMapper) { classmapper = (ClassMapper)mapper; } else { ClassLoader classloader = getClassLoader(); Class aclass[] = new Class[1]; Class class1; if(class$com$thoughtworks$xstream$alias$ClassMapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.alias.ClassMapper"); class$com$thoughtworks$xstream$alias$ClassMapper = class1; } else { class1 = class$com$thoughtworks$xstream$alias$ClassMapper; } aclass[0] = class1; classmapper = (ClassMapper)Proxy.newProxyInstance(classloader, aclass, new _cls1()); } return classmapper; } public ConverterLookup getConverterLookup() { return converterLookup; } public Mapper getMapper() { return mapper; } public ReflectionProvider getReflectionProvider() { return reflectionProvider; } public void marshal(Object obj, HierarchicalStreamWriter hierarchicalstreamwriter) { marshal(obj, hierarchicalstreamwriter, null); } public void marshal(Object obj, HierarchicalStreamWriter hierarchicalstreamwriter, DataHolder dataholder) { marshallingStrategy.marshal(hierarchicalstreamwriter, obj, converterLookup, mapper, dataholder); } public DataHolder newDataHolder() { return new MapBackedDataHolder(); } public void omitField(Class class1, String s) { if(fieldAliasingMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$FieldAliasingMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.FieldAliasingMapper"); class$com$thoughtworks$xstream$mapper$FieldAliasingMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$FieldAliasingMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { fieldAliasingMapper.omitField(class1, s); return; } } public void processAnnotations(Class class1) { Class aclass[] = new Class[1]; aclass[0] = class1; processAnnotations(aclass); } public void processAnnotations(Class aclass[]) { if(annotationConfiguration == null) { throw new InitializationException("No com.thoughtworks.xstream.mapper.AnnotationMapper available"); } else { annotationConfiguration.processAnnotations(aclass); return; } } public void registerConverter(Converter converter) { registerConverter(converter, 0); } public void registerConverter(Converter converter, int i) { if(converterRegistry != null) converterRegistry.registerConverter(converter, i); } public void registerConverter(SingleValueConverter singlevalueconverter) { registerConverter(singlevalueconverter, 0); } public void registerConverter(SingleValueConverter singlevalueconverter, int i) { if(converterRegistry != null) converterRegistry.registerConverter(new SingleValueConverterWrapper(singlevalueconverter), i); } public void registerLocalConverter(Class class1, String s, Converter converter) { if(localConversionMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$LocalConversionMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.LocalConversionMapper"); class$com$thoughtworks$xstream$mapper$LocalConversionMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$LocalConversionMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { localConversionMapper.registerLocalConverter(class1, s, converter); return; } } public void registerLocalConverter(Class class1, String s, SingleValueConverter singlevalueconverter) { registerLocalConverter(class1, s, ((Converter) (new SingleValueConverterWrapper(singlevalueconverter)))); } public void setClassLoader(ClassLoader classloader) { classLoaderReference.setReference(classloader); } public void setMarshallingStrategy(MarshallingStrategy marshallingstrategy) { marshallingStrategy = marshallingstrategy; } public void setMode(int i) { i; JVM INSTR tableswitch 1001 1004: default 32 // 1001 60 // 1002 72 // 1003 86 // 1004 103; goto _L1 _L2 _L3 _L4 _L5 _L1: throw new IllegalArgumentException("Unknown mode : " + i); _L2: setMarshallingStrategy(new TreeMarshallingStrategy()); _L7: return; _L3: setMarshallingStrategy(new ReferenceByIdMarshallingStrategy()); continue; /* Loop/switch isn't completed */ _L4: setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(ReferenceByXPathMarshallingStrategy.RELATIVE)); continue; /* Loop/switch isn't completed */ _L5: setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(ReferenceByXPathMarshallingStrategy.ABSOLUTE)); if(true) goto _L7; else goto _L6 _L6: } protected void setupAliases() { if(classAliasingMapper != null) goto _L2; else goto _L1 _L1: return; _L2: Class class1; Class class2; Class class3; Class class4; Class class5; Class class6; Class class7; Class class8; Class class9; Class class10; Class class11; Class class12; Class class13; Class class14; Class class15; Class class16; Class class17; Class class18; Class class19; Class class20; Class class21; Class class22; Class class23; Class class24; Class class25; Class class26; Class class27; Class class28; Class class29; Class class30; Class class31; Class class32; Class class33; Class class34; if(class$com$thoughtworks$xstream$mapper$Mapper$Null == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper$Null"); class$com$thoughtworks$xstream$mapper$Mapper$Null = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$Mapper$Null; } alias("null", class1); if(class$java$lang$Integer == null) { class2 = _mthclass$("java.lang.Integer"); class$java$lang$Integer = class2; } else { class2 = class$java$lang$Integer; } alias("int", class2); if(class$java$lang$Float == null) { class3 = _mthclass$("java.lang.Float"); class$java$lang$Float = class3; } else { class3 = class$java$lang$Float; } alias("float", class3); if(class$java$lang$Double == null) { class4 = _mthclass$("java.lang.Double"); class$java$lang$Double = class4; } else { class4 = class$java$lang$Double; } alias("double", class4); if(class$java$lang$Long == null) { class5 = _mthclass$("java.lang.Long"); class$java$lang$Long = class5; } else { class5 = class$java$lang$Long; } alias("long", class5); if(class$java$lang$Short == null) { class6 = _mthclass$("java.lang.Short"); class$java$lang$Short = class6; } else { class6 = class$java$lang$Short; } alias("short", class6); if(class$java$lang$Character == null) { class7 = _mthclass$("java.lang.Character"); class$java$lang$Character = class7; } else { class7 = class$java$lang$Character; } alias("char", class7); if(class$java$lang$Byte == null) { class8 = _mthclass$("java.lang.Byte"); class$java$lang$Byte = class8; } else { class8 = class$java$lang$Byte; } alias("byte", class8); if(class$java$lang$Boolean == null) { class9 = _mthclass$("java.lang.Boolean"); class$java$lang$Boolean = class9; } else { class9 = class$java$lang$Boolean; } alias("boolean", class9); if(class$java$lang$Number == null) { class10 = _mthclass$("java.lang.Number"); class$java$lang$Number = class10; } else { class10 = class$java$lang$Number; } alias("number", class10); if(class$java$lang$Object == null) { class11 = _mthclass$("java.lang.Object"); class$java$lang$Object = class11; } else { class11 = class$java$lang$Object; } alias("object", class11); if(class$java$math$BigInteger == null) { class12 = _mthclass$("java.math.BigInteger"); class$java$math$BigInteger = class12; } else { class12 = class$java$math$BigInteger; } alias("big-int", class12); if(class$java$math$BigDecimal == null) { class13 = _mthclass$("java.math.BigDecimal"); class$java$math$BigDecimal = class13; } else { class13 = class$java$math$BigDecimal; } alias("big-decimal", class13); if(class$java$lang$StringBuffer == null) { class14 = _mthclass$("java.lang.StringBuffer"); class$java$lang$StringBuffer = class14; } else { class14 = class$java$lang$StringBuffer; } alias("string-buffer", class14); if(class$java$lang$String == null) { class15 = _mthclass$("java.lang.String"); class$java$lang$String = class15; } else { class15 = class$java$lang$String; } alias("string", class15); if(class$java$lang$Class == null) { class16 = _mthclass$("java.lang.Class"); class$java$lang$Class = class16; } else { class16 = class$java$lang$Class; } alias("java-class", class16); if(class$java$lang$reflect$Method == null) { class17 = _mthclass$("java.lang.reflect.Method"); class$java$lang$reflect$Method = class17; } else { class17 = class$java$lang$reflect$Method; } alias("method", class17); if(class$java$lang$reflect$Constructor == null) { class18 = _mthclass$("java.lang.reflect.Constructor"); class$java$lang$reflect$Constructor = class18; } else { class18 = class$java$lang$reflect$Constructor; } alias("constructor", class18); if(class$java$util$Date == null) { class19 = _mthclass$("java.util.Date"); class$java$util$Date = class19; } else { class19 = class$java$util$Date; } alias("date", class19); if(class$java$net$URL == null) { class20 = _mthclass$("java.net.URL"); class$java$net$URL = class20; } else { class20 = class$java$net$URL; } alias("url", class20); if(class$java$util$BitSet == null) { class21 = _mthclass$("java.util.BitSet"); class$java$util$BitSet = class21; } else { class21 = class$java$util$BitSet; } alias("bit-set", class21); if(class$java$util$Map == null) { class22 = _mthclass$("java.util.Map"); class$java$util$Map = class22; } else { class22 = class$java$util$Map; } alias("map", class22); if(class$java$util$Map$Entry == null) { class23 = _mthclass$("java.util.Map$Entry"); class$java$util$Map$Entry = class23; } else { class23 = class$java$util$Map$Entry; } alias("entry", class23); if(class$java$util$Properties == null) { class24 = _mthclass$("java.util.Properties"); class$java$util$Properties = class24; } else { class24 = class$java$util$Properties; } alias("properties", class24); if(class$java$util$List == null) { class25 = _mthclass$("java.util.List"); class$java$util$List = class25; } else { class25 = class$java$util$List; } alias("list", class25); if(class$java$util$Set == null) { class26 = _mthclass$("java.util.Set"); class$java$util$Set = class26; } else { class26 = class$java$util$Set; } alias("set", class26); if(class$java$util$LinkedList == null) { class27 = _mthclass$("java.util.LinkedList"); class$java$util$LinkedList = class27; } else { class27 = class$java$util$LinkedList; } alias("linked-list", class27); if(class$java$util$Vector == null) { class28 = _mthclass$("java.util.Vector"); class$java$util$Vector = class28; } else { class28 = class$java$util$Vector; } alias("vector", class28); if(class$java$util$TreeMap == null) { class29 = _mthclass$("java.util.TreeMap"); class$java$util$TreeMap = class29; } else { class29 = class$java$util$TreeMap; } alias("tree-map", class29); if(class$java$util$TreeSet == null) { class30 = _mthclass$("java.util.TreeSet"); class$java$util$TreeSet = class30; } else { class30 = class$java$util$TreeSet; } alias("tree-set", class30); if(class$java$util$Hashtable == null) { class31 = _mthclass$("java.util.Hashtable"); class$java$util$Hashtable = class31; } else { class31 = class$java$util$Hashtable; } alias("hashtable", class31); if(jvm.supportsAWT()) { alias("awt-color", jvm.loadClass("java.awt.Color")); alias("awt-font", jvm.loadClass("java.awt.Font")); alias("awt-text-attribute", jvm.loadClass("java.awt.font.TextAttribute")); } if(jvm.supportsSQL()) { alias("sql-timestamp", jvm.loadClass("java.sql.Timestamp")); alias("sql-time", jvm.loadClass("java.sql.Time")); alias("sql-date", jvm.loadClass("java.sql.Date")); } if(class$java$io$File == null) { class32 = _mthclass$("java.io.File"); class$java$io$File = class32; } else { class32 = class$java$io$File; } alias("file", class32); if(class$java$util$Locale == null) { class33 = _mthclass$("java.util.Locale"); class$java$util$Locale = class33; } else { class33 = class$java$util$Locale; } alias("locale", class33); if(class$java$util$Calendar == null) { class34 = _mthclass$("java.util.Calendar"); class$java$util$Calendar = class34; } else { class34 = class$java$util$Calendar; } alias("gregorian-calendar", class34); if(JVM.is14()) { alias("auth-subject", jvm.loadClass("javax.security.auth.Subject")); alias("linked-hash-map", jvm.loadClass("java.util.LinkedHashMap")); alias("linked-hash-set", jvm.loadClass("java.util.LinkedHashSet")); alias("trace", jvm.loadClass("java.lang.StackTraceElement")); alias("currency", jvm.loadClass("java.util.Currency")); aliasType("charset", jvm.loadClass("java.nio.charset.Charset")); } if(JVM.is15()) { alias("duration", jvm.loadClass("javax.xml.datatype.Duration")); alias("enum-set", jvm.loadClass("java.util.EnumSet")); alias("enum-map", jvm.loadClass("java.util.EnumMap")); alias("string-builder", jvm.loadClass("java.lang.StringBuilder")); alias("uuid", jvm.loadClass("java.util.UUID")); } if(true) goto _L1; else goto _L3 _L3: } protected void setupConverters() { ReflectionConverter reflectionconverter = new ReflectionConverter(mapper, reflectionProvider); registerConverter(reflectionconverter, -20); registerConverter(new SerializableConverter(mapper, reflectionProvider), -10); registerConverter(new ExternalizableConverter(mapper), -10); registerConverter(new NullConverter(), 10000); registerConverter(new IntConverter(), 0); registerConverter(new FloatConverter(), 0); registerConverter(new DoubleConverter(), 0); registerConverter(new LongConverter(), 0); registerConverter(new ShortConverter(), 0); registerConverter(new CharConverter(), 0); registerConverter(new BooleanConverter(), 0); registerConverter(new ByteConverter(), 0); registerConverter(new StringConverter(), 0); registerConverter(new StringBufferConverter(), 0); registerConverter(new DateConverter(), 0); registerConverter(new BitSetConverter(), 0); registerConverter(new URLConverter(), 0); registerConverter(new BigIntegerConverter(), 0); registerConverter(new BigDecimalConverter(), 0); registerConverter(new ArrayConverter(mapper), 0); registerConverter(new CharArrayConverter(), 0); registerConverter(new CollectionConverter(mapper), 0); registerConverter(new MapConverter(mapper), 0); registerConverter(new TreeMapConverter(mapper), 0); registerConverter(new TreeSetConverter(mapper), 0); registerConverter(new PropertiesConverter(), 0); registerConverter(new EncodedByteArrayConverter(), 0); registerConverter(new FileConverter(), 0); if(jvm.supportsSQL()) { registerConverter(new SqlTimestampConverter(), 0); registerConverter(new SqlTimeConverter(), 0); registerConverter(new SqlDateConverter(), 0); } registerConverter(new DynamicProxyConverter(mapper, classLoaderReference), 0); registerConverter(new JavaClassConverter(classLoaderReference), 0); registerConverter(new JavaMethodConverter(classLoaderReference), 0); if(jvm.supportsAWT()) { registerConverter(new FontConverter(), 0); registerConverter(new ColorConverter(), 0); registerConverter(new TextAttributeConverter(), 0); } if(jvm.supportsSwing()) registerConverter(new LookAndFeelConverter(mapper, reflectionProvider), 0); registerConverter(new LocaleConverter(), 0); registerConverter(new GregorianCalendarConverter(), 0); if(JVM.is14()) { Class aclass2[] = new Class[1]; Class aclass[]; Object aobj[]; Class aclass1[]; Object aobj1[]; Class class3; Object aobj2[]; Class aclass3[]; Class class4; Object aobj3[]; Class aclass4[]; Class class5; Object aobj4[]; if(class$com$thoughtworks$xstream$mapper$Mapper == null) { class3 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper"); class$com$thoughtworks$xstream$mapper$Mapper = class3; } else { class3 = class$com$thoughtworks$xstream$mapper$Mapper; } aclass2[0] = class3; aobj2 = new Object[1]; aobj2[0] = mapper; dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.SubjectConverter", 0, aclass2, aobj2); aclass3 = new Class[1]; if(class$com$thoughtworks$xstream$converters$Converter == null) { class4 = _mthclass$("com.thoughtworks.xstream.converters.Converter"); class$com$thoughtworks$xstream$converters$Converter = class4; } else { class4 = class$com$thoughtworks$xstream$converters$Converter; } aclass3[0] = class4; aobj3 = new Object[1]; aobj3[0] = reflectionconverter; dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.ThrowableConverter", 0, aclass3, aobj3); dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.StackTraceElementConverter", 0, null, null); dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.CurrencyConverter", 0, null, null); aclass4 = new Class[1]; if(class$com$thoughtworks$xstream$converters$Converter == null) { class5 = _mthclass$("com.thoughtworks.xstream.converters.Converter"); class$com$thoughtworks$xstream$converters$Converter = class5; } else { class5 = class$com$thoughtworks$xstream$converters$Converter; } aclass4[0] = class5; aobj4 = new Object[1]; aobj4[0] = reflectionconverter; dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.RegexPatternConverter", 0, aclass4, aobj4); dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.CharsetConverter", 0, null, null); } if(JVM.is15()) { dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.extended.DurationConverter", 0, null, null); dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.enums.EnumConverter", 0, null, null); aclass = new Class[1]; Class class1; Class class2; if(class$com$thoughtworks$xstream$mapper$Mapper == null) { class1 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper"); class$com$thoughtworks$xstream$mapper$Mapper = class1; } else { class1 = class$com$thoughtworks$xstream$mapper$Mapper; } aclass[0] = class1; aobj = new Object[1]; aobj[0] = mapper; dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.enums.EnumSetConverter", 0, aclass, aobj); aclass1 = new Class[1]; if(class$com$thoughtworks$xstream$mapper$Mapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper"); class$com$thoughtworks$xstream$mapper$Mapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$Mapper; } aclass1[0] = class2; aobj1 = new Object[1]; aobj1[0] = mapper; dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.enums.EnumMapConverter", 0, aclass1, aobj1); dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.basic.StringBuilderConverter", 0, null, null); dynamicallyRegisterConverter("com.thoughtworks.xstream.converters.basic.UUIDConverter", 0, null, null); } registerConverter(new SelfStreamingInstanceChecker(reflectionconverter, this), 0); } protected void setupDefaultImplementations() { if(defaultImplementationsMapper != null) { Class class1; Class class2; Class class3; Class class4; Class class5; Class class6; Class class7; Class class8; if(class$java$util$HashMap == null) { class1 = _mthclass$("java.util.HashMap"); class$java$util$HashMap = class1; } else { class1 = class$java$util$HashMap; } if(class$java$util$Map == null) { class2 = _mthclass$("java.util.Map"); class$java$util$Map = class2; } else { class2 = class$java$util$Map; } addDefaultImplementation(class1, class2); if(class$java$util$ArrayList == null) { class3 = _mthclass$("java.util.ArrayList"); class$java$util$ArrayList = class3; } else { class3 = class$java$util$ArrayList; } if(class$java$util$List == null) { class4 = _mthclass$("java.util.List"); class$java$util$List = class4; } else { class4 = class$java$util$List; } addDefaultImplementation(class3, class4); if(class$java$util$HashSet == null) { class5 = _mthclass$("java.util.HashSet"); class$java$util$HashSet = class5; } else { class5 = class$java$util$HashSet; } if(class$java$util$Set == null) { class6 = _mthclass$("java.util.Set"); class$java$util$Set = class6; } else { class6 = class$java$util$Set; } addDefaultImplementation(class5, class6); if(class$java$util$GregorianCalendar == null) { class7 = _mthclass$("java.util.GregorianCalendar"); class$java$util$GregorianCalendar = class7; } else { class7 = class$java$util$GregorianCalendar; } if(class$java$util$Calendar == null) { class8 = _mthclass$("java.util.Calendar"); class$java$util$Calendar = class8; } else { class8 = class$java$util$Calendar; } addDefaultImplementation(class7, class8); } } protected void setupImmutableTypes() { if(immutableTypesMapper != null) goto _L2; else goto _L1 _L1: return; _L2: addImmutableType(Boolean.TYPE); Class class1; Class class2; Class class3; Class class4; Class class5; Class class6; Class class7; Class class8; Class class9; Class class10; Class class11; Class class12; Class class13; Class class14; Class class15; if(class$java$lang$Boolean == null) { class1 = _mthclass$("java.lang.Boolean"); class$java$lang$Boolean = class1; } else { class1 = class$java$lang$Boolean; } addImmutableType(class1); addImmutableType(Byte.TYPE); if(class$java$lang$Byte == null) { class2 = _mthclass$("java.lang.Byte"); class$java$lang$Byte = class2; } else { class2 = class$java$lang$Byte; } addImmutableType(class2); addImmutableType(Character.TYPE); if(class$java$lang$Character == null) { class3 = _mthclass$("java.lang.Character"); class$java$lang$Character = class3; } else { class3 = class$java$lang$Character; } addImmutableType(class3); addImmutableType(Double.TYPE); if(class$java$lang$Double == null) { class4 = _mthclass$("java.lang.Double"); class$java$lang$Double = class4; } else { class4 = class$java$lang$Double; } addImmutableType(class4); addImmutableType(Float.TYPE); if(class$java$lang$Float == null) { class5 = _mthclass$("java.lang.Float"); class$java$lang$Float = class5; } else { class5 = class$java$lang$Float; } addImmutableType(class5); addImmutableType(Integer.TYPE); if(class$java$lang$Integer == null) { class6 = _mthclass$("java.lang.Integer"); class$java$lang$Integer = class6; } else { class6 = class$java$lang$Integer; } addImmutableType(class6); addImmutableType(Long.TYPE); if(class$java$lang$Long == null) { class7 = _mthclass$("java.lang.Long"); class$java$lang$Long = class7; } else { class7 = class$java$lang$Long; } addImmutableType(class7); addImmutableType(Short.TYPE); if(class$java$lang$Short == null) { class8 = _mthclass$("java.lang.Short"); class$java$lang$Short = class8; } else { class8 = class$java$lang$Short; } addImmutableType(class8); if(class$com$thoughtworks$xstream$mapper$Mapper$Null == null) { class9 = _mthclass$("com.thoughtworks.xstream.mapper.Mapper$Null"); class$com$thoughtworks$xstream$mapper$Mapper$Null = class9; } else { class9 = class$com$thoughtworks$xstream$mapper$Mapper$Null; } addImmutableType(class9); if(class$java$math$BigDecimal == null) { class10 = _mthclass$("java.math.BigDecimal"); class$java$math$BigDecimal = class10; } else { class10 = class$java$math$BigDecimal; } addImmutableType(class10); if(class$java$math$BigInteger == null) { class11 = _mthclass$("java.math.BigInteger"); class$java$math$BigInteger = class11; } else { class11 = class$java$math$BigInteger; } addImmutableType(class11); if(class$java$lang$String == null) { class12 = _mthclass$("java.lang.String"); class$java$lang$String = class12; } else { class12 = class$java$lang$String; } addImmutableType(class12); if(class$java$net$URL == null) { class13 = _mthclass$("java.net.URL"); class$java$net$URL = class13; } else { class13 = class$java$net$URL; } addImmutableType(class13); if(class$java$io$File == null) { class14 = _mthclass$("java.io.File"); class$java$io$File = class14; } else { class14 = class$java$io$File; } addImmutableType(class14); if(class$java$lang$Class == null) { class15 = _mthclass$("java.lang.Class"); class$java$lang$Class = class15; } else { class15 = class$java$lang$Class; } addImmutableType(class15); if(jvm.supportsAWT()) addImmutableType(jvm.loadClass("java.awt.font.TextAttribute")); if(JVM.is14()) addImmutableType(jvm.loadClass("com.thoughtworks.xstream.converters.extended.CharsetConverter")); if(true) goto _L1; else goto _L3 _L3: } public String toXML(Object obj) { StringWriter stringwriter = new StringWriter(); toXML(obj, ((Writer) (stringwriter))); return stringwriter.toString(); } public void toXML(Object obj, OutputStream outputstream) { HierarchicalStreamWriter hierarchicalstreamwriter = hierarchicalStreamDriver.createWriter(outputstream); marshal(obj, hierarchicalstreamwriter); hierarchicalstreamwriter.flush(); return; Exception exception; exception; hierarchicalstreamwriter.flush(); throw exception; } public void toXML(Object obj, Writer writer) { HierarchicalStreamWriter hierarchicalstreamwriter = hierarchicalStreamDriver.createWriter(writer); marshal(obj, hierarchicalstreamwriter); hierarchicalstreamwriter.flush(); return; Exception exception; exception; hierarchicalstreamwriter.flush(); throw exception; } public Object unmarshal(HierarchicalStreamReader hierarchicalstreamreader) { return unmarshal(hierarchicalstreamreader, null, null); } public Object unmarshal(HierarchicalStreamReader hierarchicalstreamreader, Object obj) { return unmarshal(hierarchicalstreamreader, obj, null); } public Object unmarshal(HierarchicalStreamReader hierarchicalstreamreader, Object obj, DataHolder dataholder) { return marshallingStrategy.unmarshal(obj, hierarchicalstreamreader, dataholder, converterLookup, mapper); } public void useAttributeFor(Class class1) { if(attributeMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$AttributeMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.AttributeMapper"); class$com$thoughtworks$xstream$mapper$AttributeMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$AttributeMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { attributeMapper.addAttributeFor(class1); return; } } public void useAttributeFor(Class class1, String s) { if(attributeMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$AttributeMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.AttributeMapper"); class$com$thoughtworks$xstream$mapper$AttributeMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$AttributeMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { attributeMapper.addAttributeFor(class1, s); return; } } public void useAttributeFor(String s, Class class1) { if(attributeMapper == null) { StringBuffer stringbuffer = (new StringBuffer()).append("No "); Class class2; if(class$com$thoughtworks$xstream$mapper$AttributeMapper == null) { class2 = _mthclass$("com.thoughtworks.xstream.mapper.AttributeMapper"); class$com$thoughtworks$xstream$mapper$AttributeMapper = class2; } else { class2 = class$com$thoughtworks$xstream$mapper$AttributeMapper; } throw new InitializationException(stringbuffer.append(class2.getName()).append(" available").toString()); } else { attributeMapper.addAttributeFor(s, class1); return; } } protected boolean useXStream11XmlFriendlyMapper() { return false; } protected MapperWrapper wrapMapper(MapperWrapper mapperwrapper) { return mapperwrapper; } private static final String ANNOTATION_MAPPER_TYPE = "com.thoughtworks.xstream.mapper.AnnotationMapper"; public static final int ID_REFERENCES = 1002; public static final int NO_REFERENCES = 1001; public static final int PRIORITY_LOW = -10; public static final int PRIORITY_NORMAL = 0; public static final int PRIORITY_VERY_HIGH = 10000; public static final int PRIORITY_VERY_LOW = -20; public static final int XPATH_ABSOLUTE_REFERENCES = 1004; public static final int XPATH_REFERENCES = 1003; public static final int XPATH_RELATIVE_REFERENCES = 1003; static Class class$com$thoughtworks$xstream$alias$ClassMapper; static Class class$com$thoughtworks$xstream$converters$Converter; static Class class$com$thoughtworks$xstream$converters$ConverterRegistry; static Class class$com$thoughtworks$xstream$converters$reflection$ReflectionProvider; static Class class$com$thoughtworks$xstream$core$JVM; static Class class$com$thoughtworks$xstream$mapper$AnnotationConfiguration; static Class class$com$thoughtworks$xstream$mapper$AttributeAliasingMapper; static Class class$com$thoughtworks$xstream$mapper$AttributeMapper; static Class class$com$thoughtworks$xstream$mapper$ClassAliasingMapper; static Class class$com$thoughtworks$xstream$mapper$DefaultImplementationsMapper; static Class class$com$thoughtworks$xstream$mapper$FieldAliasingMapper; static Class class$com$thoughtworks$xstream$mapper$ImmutableTypesMapper; static Class class$com$thoughtworks$xstream$mapper$ImplicitCollectionMapper; static Class class$com$thoughtworks$xstream$mapper$LocalConversionMapper; static Class class$com$thoughtworks$xstream$mapper$Mapper; static Class class$com$thoughtworks$xstream$mapper$Mapper$Null; static Class class$com$thoughtworks$xstream$mapper$PackageAliasingMapper; static Class class$com$thoughtworks$xstream$mapper$SystemAttributeAliasingMapper; static Class class$java$io$File; static Class class$java$lang$Boolean; static Class class$java$lang$Byte; static Class class$java$lang$Character; static Class class$java$lang$Class; static Class class$java$lang$ClassLoader; static Class class$java$lang$Double; static Class class$java$lang$Float; static Class class$java$lang$Integer; static Class class$java$lang$Long; static Class class$java$lang$Number; static Class class$java$lang$Object; static Class class$java$lang$Short; static Class class$java$lang$String; static Class class$java$lang$StringBuffer; static Class class$java$lang$reflect$Constructor; static Class class$java$lang$reflect$Method; static Class class$java$math$BigDecimal; static Class class$java$math$BigInteger; static Class class$java$net$URL; static Class class$java$util$ArrayList; static Class class$java$util$BitSet; static Class class$java$util$Calendar; static Class class$java$util$Date; static Class class$java$util$GregorianCalendar; static Class class$java$util$HashMap; static Class class$java$util$HashSet; static Class class$java$util$Hashtable; static Class class$java$util$LinkedList; static Class class$java$util$List; static Class class$java$util$Locale; static Class class$java$util$Map; static Class class$java$util$Map$Entry; static Class class$java$util$Properties; static Class class$java$util$Set; static Class class$java$util$TreeMap; static Class class$java$util$TreeSet; static Class class$java$util$Vector; private AnnotationConfiguration annotationConfiguration; private AttributeAliasingMapper attributeAliasingMapper; private AttributeMapper attributeMapper; private ClassAliasingMapper classAliasingMapper; private ClassLoaderReference classLoaderReference; private ConverterLookup converterLookup; private ConverterRegistry converterRegistry; private DefaultImplementationsMapper defaultImplementationsMapper; private FieldAliasingMapper fieldAliasingMapper; private HierarchicalStreamDriver hierarchicalStreamDriver; private ImmutableTypesMapper immutableTypesMapper; private ImplicitCollectionMapper implicitCollectionMapper; private transient JVM jvm; private LocalConversionMapper localConversionMapper; private Mapper mapper; private MarshallingStrategy marshallingStrategy; private PackageAliasingMapper packageAliasingMapper; private ReflectionProvider reflectionProvider; private SystemAttributeAliasingMapper systemAttributeAliasingMapper; private class _cls3 implements com.thoughtworks.xstream.core.util.CustomObjectInputStream.StreamCallback { public void close() { reader.close(); } public void defaultReadObject() throws NotActiveException { throw new NotActiveException("not in call to readObject"); } public Map readFieldsFromStream() throws IOException { throw new NotActiveException("not in call to readObject"); } public Object readFromStream() throws EOFException { if(!reader.hasMoreChildren()) { throw new EOFException(); } else { reader.moveDown(); Object obj = unmarshal(reader); reader.moveUp(); return obj; } } public void registerValidation(ObjectInputValidation objectinputvalidation, int i) throws NotActiveException { throw new NotActiveException("stream inactive"); } private final XStream this$0; private final HierarchicalStreamReader val$reader; _cls3() throws NotActiveException, EOFException { this$0 = XStream.this; reader = hierarchicalstreamreader; } } private class _cls2 implements com.thoughtworks.xstream.core.util.CustomObjectOutputStream.StreamCallback { public void close() { if(statefulWriter.state() != StatefulWriter.STATE_CLOSED) { statefulWriter.endNode(); statefulWriter.close(); } } public void defaultWriteObject() throws NotActiveException { throw new NotActiveException("not in call to writeObject"); } public void flush() { statefulWriter.flush(); } public void writeFieldsToStream(Map map) throws NotActiveException { throw new NotActiveException("not in call to writeObject"); } public void writeToStream(Object obj) { marshal(obj, statefulWriter); } private final XStream this$0; private final StatefulWriter val$statefulWriter; _cls2() throws NotActiveException { this$0 = XStream.this; statefulWriter = statefulwriter; } } private class _cls1 implements InvocationHandler { public Object invoke(Object obj, Method method, Object aobj[]) throws Throwable { return method.invoke(mapper, aobj); } private final XStream this$0; _cls1() throws InvocationTargetException, IllegalAccessException { this$0 = XStream.this; } } }
[ "flychen50@gmail.com" ]
flychen50@gmail.com
5f496c2401ebba927428b07a3c73f6e6cb0ddc79
7005205525b6494d2c4bc0ac32b796c90d84f805
/net/minecraft/server/ConsoleCommandHandler.java
33d3318933e9763bbe12dfc5e4a5ea85a5883bbc
[]
no_license
ymsquall/mc-dev
a238b8717a8e2ca8d842d841b34bba3ec3fe4c81
32e82087390bf2cd3ce47123bdc29037dd82054a
refs/heads/master
2021-01-18T19:48:39.879630
2011-03-31T18:28:36
2011-03-31T18:28:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,159
java
package net.minecraft.server; import java.util.Iterator; import java.util.Set; import java.util.logging.Logger; public class ConsoleCommandHandler { private static Logger a = Logger.getLogger("Minecraft"); private MinecraftServer b; public ConsoleCommandHandler(MinecraftServer minecraftserver) { this.b = minecraftserver; } public void a(ServerCommand servercommand) { String s = servercommand.a; ICommandListener icommandlistener = servercommand.b; String s1 = icommandlistener.c(); WorldServer worldserver = this.b.e; ServerConfigurationManager serverconfigurationmanager = this.b.f; if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) { if (s.toLowerCase().startsWith("list")) { icommandlistener.b("Connected players: " + serverconfigurationmanager.c()); } else if (s.toLowerCase().startsWith("stop")) { this.a(s1, "Stopping the server.."); this.b.a(); } else if (s.toLowerCase().startsWith("save-all")) { this.a(s1, "Forcing save.."); worldserver.a(true, (IProgressUpdate) null); this.a(s1, "Save complete."); } else if (s.toLowerCase().startsWith("save-off")) { this.a(s1, "Disabling level saving.."); worldserver.w = true; } else if (s.toLowerCase().startsWith("save-on")) { this.a(s1, "Enabling level saving.."); worldserver.w = false; } else { String s2; if (s.toLowerCase().startsWith("op ")) { s2 = s.substring(s.indexOf(" ")).trim(); serverconfigurationmanager.e(s2); this.a(s1, "Opping " + s2); serverconfigurationmanager.a(s2, "\u00A7eYou are now op!"); } else if (s.toLowerCase().startsWith("deop ")) { s2 = s.substring(s.indexOf(" ")).trim(); serverconfigurationmanager.f(s2); serverconfigurationmanager.a(s2, "\u00A7eYou are no longer op!"); this.a(s1, "De-opping " + s2); } else if (s.toLowerCase().startsWith("ban-ip ")) { s2 = s.substring(s.indexOf(" ")).trim(); serverconfigurationmanager.c(s2); this.a(s1, "Banning ip " + s2); } else if (s.toLowerCase().startsWith("pardon-ip ")) { s2 = s.substring(s.indexOf(" ")).trim(); serverconfigurationmanager.d(s2); this.a(s1, "Pardoning ip " + s2); } else { EntityPlayer entityplayer; if (s.toLowerCase().startsWith("ban ")) { s2 = s.substring(s.indexOf(" ")).trim(); serverconfigurationmanager.a(s2); this.a(s1, "Banning " + s2); entityplayer = serverconfigurationmanager.i(s2); if (entityplayer != null) { entityplayer.a.a("Banned by admin"); } } else if (s.toLowerCase().startsWith("pardon ")) { s2 = s.substring(s.indexOf(" ")).trim(); serverconfigurationmanager.b(s2); this.a(s1, "Pardoning " + s2); } else { int i; if (s.toLowerCase().startsWith("kick ")) { s2 = s.substring(s.indexOf(" ")).trim(); entityplayer = null; for (i = 0; i < serverconfigurationmanager.b.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.b.get(i); if (entityplayer1.name.equalsIgnoreCase(s2)) { entityplayer = entityplayer1; } } if (entityplayer != null) { entityplayer.a.a("Kicked by admin"); this.a(s1, "Kicking " + entityplayer.name); } else { icommandlistener.b("Can\'t find user " + s2 + ". No kick."); } } else { String[] astring; EntityPlayer entityplayer2; if (s.toLowerCase().startsWith("tp ")) { astring = s.split(" "); if (astring.length == 3) { entityplayer = serverconfigurationmanager.i(astring[1]); entityplayer2 = serverconfigurationmanager.i(astring[2]); if (entityplayer == null) { icommandlistener.b("Can\'t find user " + astring[1] + ". No tp."); } else if (entityplayer2 == null) { icommandlistener.b("Can\'t find user " + astring[2] + ". No tp."); } else { entityplayer.a.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch); this.a(s1, "Teleporting " + astring[1] + " to " + astring[2] + "."); } } else { icommandlistener.b("Syntax error, please provice a source and a target."); } } else { String s3; if (s.toLowerCase().startsWith("give ")) { astring = s.split(" "); if (astring.length != 3 && astring.length != 4) { return; } s3 = astring[1]; entityplayer2 = serverconfigurationmanager.i(s3); if (entityplayer2 != null) { try { int j = Integer.parseInt(astring[2]); if (Item.byId[j] != null) { this.a(s1, "Giving " + entityplayer2.name + " some " + j); int k = 1; if (astring.length > 3) { k = this.a(astring[3], 1); } if (k < 1) { k = 1; } if (k > 64) { k = 64; } entityplayer2.b(new ItemStack(j, k, 0)); } else { icommandlistener.b("There\'s no item with id " + j); } } catch (NumberFormatException numberformatexception) { icommandlistener.b("There\'s no item with id " + astring[2]); } } else { icommandlistener.b("Can\'t find user " + s3); } } else if (s.toLowerCase().startsWith("time ")) { astring = s.split(" "); if (astring.length != 3) { return; } s3 = astring[1]; try { i = Integer.parseInt(astring[2]); if ("add".equalsIgnoreCase(s3)) { worldserver.a(worldserver.l() + (long) i); this.a(s1, "Added " + i + " to time"); } else if ("set".equalsIgnoreCase(s3)) { worldserver.a((long) i); this.a(s1, "Set time to " + i); } else { icommandlistener.b("Unknown method, use either \"add\" or \"set\""); } } catch (NumberFormatException numberformatexception1) { icommandlistener.b("Unable to convert time value, " + astring[2]); } } else if (s.toLowerCase().startsWith("say ")) { s = s.substring(s.indexOf(" ")).trim(); a.info("[" + s1 + "] " + s); serverconfigurationmanager.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s))); } else if (s.toLowerCase().startsWith("tell ")) { astring = s.split(" "); if (astring.length >= 3) { s = s.substring(s.indexOf(" ")).trim(); s = s.substring(s.indexOf(" ")).trim(); a.info("[" + s1 + "->" + astring[1] + "] " + s); s = "\u00A77" + s1 + " whispers " + s; a.info(s); if (!serverconfigurationmanager.a(astring[1], (Packet) (new Packet3Chat(s)))) { icommandlistener.b("There\'s no player by that name online."); } } } else if (s.toLowerCase().startsWith("whitelist ")) { this.a(s1, s, icommandlistener); } else { a.info("Unknown console command. Type \"help\" for help."); } } } } } } } else { this.a(icommandlistener); } } private void a(String s, String s1, ICommandListener icommandlistener) { String[] astring = s1.split(" "); if (astring.length >= 2) { String s2 = astring[1].toLowerCase(); if ("on".equals(s2)) { this.a(s, "Turned on white-listing"); this.b.d.b("white-list", true); } else if ("off".equals(s2)) { this.a(s, "Turned off white-listing"); this.b.d.b("white-list", false); } else if ("list".equals(s2)) { Set set = this.b.f.e(); String s3 = ""; String s4; for (Iterator iterator = set.iterator(); iterator.hasNext(); s3 = s3 + s4 + " ") { s4 = (String) iterator.next(); } icommandlistener.b("White-listed players: " + s3); } else { String s5; if ("add".equals(s2) && astring.length == 3) { s5 = astring[2].toLowerCase(); this.b.f.k(s5); this.a(s, "Added " + s5 + " to white-list"); } else if ("remove".equals(s2) && astring.length == 3) { s5 = astring[2].toLowerCase(); this.b.f.l(s5); this.a(s, "Removed " + s5 + " from white-list"); } else if ("reload".equals(s2)) { this.b.f.f(); this.a(s, "Reloaded white-list from file"); } } } } private void a(ICommandListener icommandlistener) { icommandlistener.b("To run the server without a gui, start it like this:"); icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui"); icommandlistener.b("Console commands:"); icommandlistener.b(" help or ? shows this message"); icommandlistener.b(" kick <player> removes a player from the server"); icommandlistener.b(" ban <player> bans a player from the server"); icommandlistener.b(" pardon <player> pardons a banned player so that they can connect again"); icommandlistener.b(" ban-ip <ip> bans an IP address from the server"); icommandlistener.b(" pardon-ip <ip> pardons a banned IP address so that they can connect again"); icommandlistener.b(" op <player> turns a player into an op"); icommandlistener.b(" deop <player> removes op status from a player"); icommandlistener.b(" tp <player1> <player2> moves one player to the same location as another player"); icommandlistener.b(" give <player> <id> [num] gives a player a resource"); icommandlistener.b(" tell <player> <message> sends a private message to a player"); icommandlistener.b(" stop gracefully stops the server"); icommandlistener.b(" save-all forces a server-wide level save"); icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)"); icommandlistener.b(" save-on re-enables terrain saving"); icommandlistener.b(" list lists all currently connected players"); icommandlistener.b(" say <message> broadcasts a message to all players"); icommandlistener.b(" time <add|set> <amount> adds to or sets the world time (0-24000)"); } private void a(String s, String s1) { String s2 = s + ": " + s1; this.b.f.j("\u00A77(" + s2 + ")"); a.info(s2); } private int a(String s, int i) { try { return Integer.parseInt(s); } catch (NumberFormatException numberformatexception) { return i; } } }
[ "erikbroes@grum.nl" ]
erikbroes@grum.nl
37e33f569449a1f8fa32dfc657caff686c2a805a
06ce63b1ebbfeaa4ff8760d7773203a1525d0fac
/code/android_app/ColorPenPrediction2/app/src/main/java/com/example/sylvestre/colorpenprediction2/DetectionActivity.java
aefef309f9f007d21c6a19b8238c9e4f2098b490
[]
no_license
maximenz/Color-Pen-Prediction
46b37e49b6b477bf899e99adc59f37155aec19f8
039000c93f6537100ebee5eb237a2e0480c90223
refs/heads/master
2021-09-13T23:41:51.340775
2018-05-06T01:40:09
2018-05-06T01:40:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,470
java
package com.example.sylvestre.colorpenprediction2; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.SeekBar; import android.widget.TextView; import java.math.BigDecimal; public class DetectionActivity extends AppCompatActivity { public static final String EXTRA_MEQUAL = "com.example.sylvestre.colorpenprediction2.mEqual" ; public static final String EXTRA_MMIN = "com.example.sylvestre.colorpenprediction2.mMin" ; public static final String EXTRA_DELTA = "com.example.sylvestre.colorpenprediction2.delta" ; public static final String EXTRA_TMES = "com.example.sylvestre.colorpenprediction2.tMes" ; public static final String EXTRA_NMES = "com.example.sylvestre.colorpenprediction2.nMes" ; public static final String EXTRA_NFEUTRES = "com.example.sylvestre.colorpenprediction2.nFeutres" ; private TextView textMEqual ; private TextView textMMin ; private TextView textDelta ; private TextView textTMes ; private TextView textNMes ; private TextView textNFeutres ; private SeekBar seekMEqual ; private SeekBar seekMMin ; private SeekBar seekDelta ; private SeekBar seekTMes ; private SeekBar seekNMes ; private SeekBar seekNFeutres ; private BigDecimal bd ; private int mEqual = 5 ; private int mMin = 5 ; private int delta = 5 ; private int tMes = 5 ; private int nMes = 10 ; private int nFeutres = 5 ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detection); Bundle intentExtra = getIntent().getExtras() ; mEqual = intentExtra.getInt(DetectionActivity.EXTRA_MEQUAL); mMin = intentExtra.getInt(DetectionActivity.EXTRA_MMIN); delta = intentExtra.getInt(DetectionActivity.EXTRA_DELTA); tMes = intentExtra.getInt(DetectionActivity.EXTRA_TMES); nMes = intentExtra.getInt(DetectionActivity.EXTRA_NMES); nFeutres = intentExtra.getInt(DetectionActivity.EXTRA_NFEUTRES); textMEqual = (TextView)findViewById(R.id.textViewMEqual) ; textMMin = (TextView)findViewById(R.id.textViewMMin) ; textDelta = (TextView)findViewById(R.id.textViewDelta) ; textTMes = (TextView)findViewById(R.id.textViewTMes) ; textNMes = (TextView)findViewById(R.id.textViewNMes) ; textNFeutres = (TextView)findViewById(R.id.textViewNFeutres) ; seekMEqual = (SeekBar)findViewById(R.id.seekBarMEqual); seekMMin = (SeekBar)findViewById(R.id.seekBarMMin); seekDelta = (SeekBar)findViewById(R.id.seekBarDelta); seekTMes = (SeekBar)findViewById(R.id.seekBarTMes); seekNMes = (SeekBar)findViewById(R.id.seekBarNMes); seekNFeutres = (SeekBar)findViewById(R.id.seekBarNFeutres); bd = BigDecimal.valueOf(((double) mEqual) / 50) ; bd.setScale(1,BigDecimal.ROUND_DOWN); textMEqual.setText(bd.toString()); seekMEqual.setProgress(mEqual-1); textMMin.setText(Integer.toString(mMin)); seekMMin.setProgress(mMin-1) ; bd = BigDecimal.valueOf(((double) delta) / 10) ; bd.setScale(1, BigDecimal.ROUND_DOWN); textDelta.setText(bd.toString()); seekDelta.setProgress(delta-1); textTMes.setText(Integer.toString(tMes * 10)); seekTMes.setProgress(tMes-1); textNMes.setText(Integer.toString(nMes)); seekNMes.setProgress(nMes-1); textNFeutres.setText(Integer.toString(nFeutres)); seekNFeutres.setProgress(nFeutres-2) ; seekMEqual.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { bd = BigDecimal.valueOf(((double) (progress+1)) / 50) ; bd.setScale(1,BigDecimal.ROUND_DOWN); textMEqual.setText(bd.toString()); mEqual = progress ; } } ); seekMMin.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { textMMin.setText(Integer.toString(progress+1)); mMin = progress+1 ; } } ); seekDelta.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { bd = BigDecimal.valueOf(((double) (progress+1)) / 10) ; bd.setScale(1, BigDecimal.ROUND_DOWN); textDelta.setText(bd.toString()); delta = progress+1 ; } } ); seekTMes.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { textTMes.setText(Integer.toString((progress+1)*10)); tMes = progress+1 ; } } ); seekNMes.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { textNMes.setText(Integer.toString(progress+1)); nMes = progress+1 ; } } ); seekNFeutres.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { textNFeutres.setText(Integer.toString(progress+2)); nFeutres = progress+2 ; } } ); } public void validerDetection(View view){ Intent intent = new Intent(); intent.putExtra(EXTRA_MEQUAL, mEqual); intent.putExtra(EXTRA_MMIN, mMin); intent.putExtra(EXTRA_DELTA, delta); intent.putExtra(EXTRA_TMES, tMes); intent.putExtra(EXTRA_NMES, nMes); intent.putExtra(EXTRA_NFEUTRES, nFeutres); setResult(RESULT_OK, intent); finish(); } public void parametresParDefaut(View view){ mEqual = 5 ; mMin = 5 ; delta = 5 ; tMes = 5 ; nMes = 10 ; nFeutres = 3 ; bd = BigDecimal.valueOf(((double) mEqual) / 50) ; bd.setScale(1,BigDecimal.ROUND_DOWN); textMEqual.setText(bd.toString()); seekMEqual.setProgress(mEqual-1); textMMin.setText(Integer.toString(mMin)); seekMMin.setProgress(mMin-1) ; bd = BigDecimal.valueOf(((double) delta) / 10) ; bd.setScale(1, BigDecimal.ROUND_DOWN); textDelta.setText(bd.toString()); seekDelta.setProgress(delta-1); textTMes.setText(Integer.toString(tMes * 10)); seekTMes.setProgress(tMes-1); textNMes.setText(Integer.toString(nMes)); seekNMes.setProgress(nMes-1); textNFeutres.setText(Integer.toString(nFeutres)); seekNFeutres.setProgress(nFeutres-2) ; } }
[ "gael.colas@student.ecp.fr" ]
gael.colas@student.ecp.fr
7ceb728f753f33b9e76811692d6a8b8db6bbcf55
17d9058cfcc06802c671681fcd2e561b4990ff20
/app/src/main/java/com/example/radioimagechanger/RadioImageChanger.java
609e22472d6a270ed436fadf13e7517260d8aee2
[]
no_license
Shyamul-Shakya/RadioImageChanger
444093ae51e4d1ad8985d4f8a10f6f3788e38cf9
177cc286719ed3a72ee7d508bc2b05a08cd6dfc6
refs/heads/master
2020-08-22T21:01:13.065408
2019-10-21T04:20:36
2019-10-21T04:20:36
216,476,649
0
0
null
null
null
null
UTF-8
Java
false
false
1,346
java
package com.example.radioimagechanger; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.RadioButton; public class RadioImageChanger extends AppCompatActivity implements View.OnClickListener { RadioButton radioButton1, radioButton2, radioButton3; ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_radio_image_changer); radioButton1 = findViewById(R.id.rbImg1); radioButton2 = findViewById(R.id.rbImg2); radioButton3 = findViewById(R.id.rbImg3); imageView = findViewById(R.id.ivShowimg); radioButton1.setOnClickListener(this); radioButton2.setOnClickListener(this); radioButton3.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.rbImg1 : imageView.setImageResource(R.drawable.a); break; case R.id.rbImg2 : imageView.setImageResource(R.drawable.d); break; case R.id.rbImg3 : imageView.setImageResource(R.drawable.h); break; } } }
[ "samuelshakya29@gmail.com" ]
samuelshakya29@gmail.com
49ddf4ffd1d3f8852b18d6b9aa574ce5e675a694
96c53dbf583a68a69434a00cd219951c5f386356
/src/test/java/com/redbeard/offsets/KafkaTopicOffsetsApplicationTests.java
b33ee557d8922583d3baa66dc25681aa7e4f5303
[]
no_license
lfrei/kafka-topic-offsets
0ff49c2878e87ad8334dbe6bf1cd4b4166da1fc5
e5e4ff4e969feac0ff57da60be2c6c13568b66d5
refs/heads/main
2023-07-11T05:27:17.999460
2021-08-15T16:35:18
2021-08-15T16:35:18
396,339,316
0
0
null
2021-08-15T13:12:09
2021-08-15T12:11:07
Java
UTF-8
Java
false
false
232
java
package com.redbeard.offsets; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class KafkaTopicOffsetsApplicationTests { @Test void contextLoads() { } }
[ "lukas.frei@zuehlke.com" ]
lukas.frei@zuehlke.com
973843de6752fb58da9e017d5f6b9b1d74d2ac53
fd02b314c1b5923c626368f772a5249a694245e9
/src/main/java/school/校内赛试题/水仙花数.java
5964fa6dc9c01167ab17b078d74dbfe062b3b672
[]
no_license
Janche/Algorithm
8e4d5c6155e0b0c4266ac22d007cd163cbc2f7af
4955bb49332f3973d7048b1d5ce1287e3a590655
refs/heads/master
2021-11-30T09:24:37.137155
2021-10-07T14:54:39
2021-10-07T14:54:39
192,445,020
0
0
null
2021-05-22T15:48:50
2019-06-18T01:44:17
Java
GB18030
Java
false
false
311
java
package school.校内赛试题; public class 水仙花数 { public static void main(String[] args) { int count = 0; for (int i = 100; i < 1000; i++) { int a = i/100; int b = i/10%10; int c = i%10; if(i == a*a*a + b*b*b + c*c*c){ count++; } } System.out.println(count); } }
[ "957671816@qq.com" ]
957671816@qq.com
38684650a88fd6686512e61f39d58c8cae167d76
6744c11ce0cbbcb40079c5aec7689f6939e2f3d1
/app/src/main/java/com/earthgee/simplechat/ui/AddNewChatActivity.java
f2d4d11fa9b16330a53852073dfa583e89ff2422
[]
no_license
earthgee/SimpleChat
94e37ffbef0d0fc53b76746a571eed2cabf238a1
0eec5b8186e86f6af3b3d5b5c3d95aa877cb1508
refs/heads/master
2021-01-09T06:25:49.608661
2017-04-05T12:01:08
2017-04-05T12:01:08
80,985,915
0
0
null
null
null
null
UTF-8
Java
false
false
1,444
java
package com.earthgee.simplechat.ui; import android.content.Intent; import android.os.Bundle; import android.os.PersistableBundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.earthgee.simplechat.R; /** * Created by earthgee on 17/2/21. */ public class AddNewChatActivity extends AppCompatActivity{ private EditText addUserId; private Button addChat; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_chat); addUserId= (EditText) findViewById(R.id.et_add_user_id); addChat= (Button) findViewById(R.id.btn_chat); addChat.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String userId=addUserId.getText().toString(); Intent intent=new Intent(AddNewChatActivity.this,ChatActivity.class); intent.putExtra("userId",userId); startActivity(intent); finish(); } }); ActionBar actionBar=getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } @Override public void onBackPressed() { finish(); } }
[ "865603556@qq.com" ]
865603556@qq.com
b3fe081f13ac8e42c3128aaf945e98a18ffbfc6c
71294c9b42dfc502609f2c5ab58adb86f0ec588f
/Exercicio8/src/main/java/br/edu/ifes/poo2/cln/cdp/ComandoHandler.java
51639f33d5f19d760e3cef59516e99e0a8c435ba
[]
no_license
thanner/PadroesComportamentais
41d84673d46889ee479363225a5f2e6f88cb16c7
1671c10bafa08d858fc2cdcd6306fd3e47dd6645
refs/heads/master
2020-05-31T23:46:08.289736
2014-07-25T21:35:24
2014-07-25T21:35:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,687
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.edu.ifes.poo2.cln.cdp; import java.util.List; /** * * @author 20121BSI0325 */ public abstract class ComandoHandler implements ComandoHandlerInterface { private ComandoHandlerInterface comando; @Override public void setProximo(ComandoHandlerInterface comando) { this.comando = comando; } public static Expressao handle(String token, List<Expressao> listaExpressao) { SomaExpressao somaExpressao = new SomaExpressao(); SubtracaoExpressao subtracaoExpressao = new SubtracaoExpressao(); MultiplicacaoExpressao multiplicacaoExpressao = new MultiplicacaoExpressao(); DivisaoExpressao divisaoExpressao = new DivisaoExpressao(); somaExpressao.setProximo(subtracaoExpressao); subtracaoExpressao.setProximo(divisaoExpressao); divisaoExpressao.setProximo(multiplicacaoExpressao); return somaExpressao.processarExpressao(token, listaExpressao); } @Override public Expressao processarExpressao(String token, List<Expressao> listaExpressao) { Expressao expressao = null; if (tipoExpressao().equals(token)) { expressao = processarAqui(listaExpressao); } else { expressao = comando.processarExpressao(token, listaExpressao); } return expressao; } public abstract Expressao processarAqui(List<Expressao> listaExpressao); public abstract String tipoExpressao(); }
[ "iac-isabella@live.com" ]
iac-isabella@live.com
b0e8e850e186b0573c076258fa92ba34053dde02
fdbf81dbfd0bd28ecb33ccfed2b0cf0feb947626
/hydroponics/app/src/main/java/com/codingblocks/hydroponics/growcostcalci.java
1d8c55fe2b018103475e27dbe88a700094076b5e
[]
no_license
neeraj0403/connectivity
e7756e71105576f199e55b6117b1b53f40f974b4
e608e545335d2b3a61142273dfb878c28ed3786b
refs/heads/master
2022-06-06T11:13:34.300885
2020-05-03T09:54:51
2020-05-03T09:54:51
260,874,466
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.codingblocks.hydroponics; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class growcostcalci extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_growcostcalci); } }
[ "neerajkumarp40@gmail.com" ]
neerajkumarp40@gmail.com
4a92a9b2cf9794182bf3d0d2e995e015611abe1f
b11bcb900885ae52e80d89c7b090590bacbb9f08
/server/src/test/java/com/example/TestGreeter.java
88abc4b91881e538aea83370a4a603cc2df3bb58
[]
no_license
devopsaspirants/hello-world
5e7c8c19a3cece6dba1e242ad5695b9779e183bc
9ede5bcc6cc2af91f0020a83811350353fb1ca92
refs/heads/master
2020-05-04T06:34:26.143094
2019-04-21T07:49:17
2019-04-21T07:49:17
179,008,871
0
3
null
2019-07-21T11:17:14
2019-04-02T05:58:05
Java
UTF-8
Java
false
false
754
java
package com.example; import org.junit.Before; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertThat; import static org.junit.matchers.JUnitMatchers.containsString; public class TestGreeter { private Greeter greeter; @Before public void setup() { greeter = new Greeter(); } @Test public void greetShouldIncludeTheOneBeingGreeted() { String someone = "World"; assertThat(greeter.greet(someone), containsString(someone)); } @Test public void greetShouldIncludeGreetingPhrase() { String someone = "World"; assertThat(greeter.greet(someone).length(), is(greaterThan(someone.length()))); } } //hello noor//
[ "noreply@github.com" ]
noreply@github.com
936fd6e26f82c7af4031ed19b57eb221d4b9d127
c413527a56052642e65c49aec68434f6882c0344
/app/src/main/java/com/example/rodrix/mi_app3/MainActivity.java
e37033d2882f57b233cac0c89a88e5de04f59a62
[]
no_license
elrodrix/Mi_app3
252a42bfeb37cdd67bb27fb351bbcdd2462fa39f
a82e2bac956d1ae17fffc50deea52e4135bd3300
refs/heads/master
2020-06-03T00:14:33.834783
2015-04-07T21:23:52
2015-04-07T21:23:52
33,569,058
0
0
null
null
null
null
UTF-8
Java
false
false
4,968
java
package com.example.rodrix.mi_app3; import android.app.Activity; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.support.v4.widget.DrawerLayout; import android.widget.ArrayAdapter; import android.widget.TextView; public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in {@link #restoreActionBar()}. */ private CharSequence mTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); } @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) .commit(); } public void onSectionAttached(int number) { switch (number) { case 1: mTitle = getString(R.string.title_section1); break; case 2: mTitle = getString(R.string.title_section2); break; case 3: mTitle = getString(R.string.title_section3); break; } } public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); } @Override public boolean onCreateOptionsMenu(Menu menu) { if (!mNavigationDrawerFragment.isDrawerOpen()) { // Only show items in the action bar relevant to this screen // if the drawer is not showing. Otherwise, let the drawer // decide what to show in the action bar. getMenuInflater().inflate(R.menu.main, menu); restoreActionBar(); return true; } return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { /** * The fragment argument representing the section number for this * fragment. */ private static final String ARG_SECTION_NUMBER = "section_number"; /** * Returns a new instance of this fragment for the given section * number. */ public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } @Override public void onAttach(Activity activity) { super.onAttach(activity); ((MainActivity) activity).onSectionAttached( getArguments().getInt(ARG_SECTION_NUMBER)); } } }
[ "rodrigo398@hotmail.com" ]
rodrigo398@hotmail.com
1d8537ec46498d6f2569e349997555fcdab7f7a1
eb7beaf680e273d1245ce1794da1024a1a2f26d2
/src/main/java/com/fabianbg/domain/service/IDeveloperService.java
c5a23926e8fe80bdd1baf6e29da9f2c06a30d36f
[ "MIT" ]
permissive
FabianBG/spring-boot-postgresql-rest
7459daad393234da991da85baddcdd1828ad4274
09d517ef1235b92840d0d213250786b816625cd8
refs/heads/master
2022-07-29T03:26:46.210356
2020-05-26T20:27:33
2020-05-26T20:27:33
267,140,090
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.fabianbg.domain.service; import java.util.List; import com.fabianbg.domain.dto.DeveloperUpdateDTO; import com.fabianbg.domain.model.Developer; public interface IDeveloperService { public Developer create(Developer data); public List<Developer> getAll(); public Developer update(String id, DeveloperUpdateDTO updateData); public String delete(String id); }
[ "f4b4g3@gmail.com" ]
f4b4g3@gmail.com
d0bc87c6b49de5b84f113a4799c4a26a6413d2b8
624042d9c60129afd0f939e5931a6a6ee07f5534
/prjWebStocks/src/com/sanguine/webpms/service/clsPMSPaymentService.java
b50bc095877b0e8a7c4c75751350e06902f51b3d
[]
no_license
SanguineSoftwareSolutions/prjWebStocks
2c5890b73240e68c76b0c9a3cd166603e1ee5acc
52cac0350aa5ec66add108892bd35586e884ebae
refs/heads/master
2021-05-14T15:08:47.605536
2018-01-02T07:30:31
2018-01-02T07:43:44
115,986,934
0
1
null
null
null
null
UTF-8
Java
false
false
620
java
package com.sanguine.webpms.service; import javax.servlet.http.HttpServletRequest; import com.sanguine.webbooks.model.clsPaymentHdModel; import com.sanguine.webpms.bean.clsPMSPaymentBean; import com.sanguine.webpms.bean.clsWalkinBean; import com.sanguine.webpms.model.clsPMSPaymentHdModel; import com.sanguine.webpms.model.clsWalkinHdModel; public interface clsPMSPaymentService{ public void funAddUpdatePaymentHd(clsPMSPaymentHdModel objHdModel); public clsPMSPaymentHdModel funPreparePaymentModel(clsPMSPaymentBean objPaymentBean,String clientCode,HttpServletRequest request,String userCode); }
[ "jai chandra@jaichandra-PC" ]
jai chandra@jaichandra-PC
e1593c3bd2eace316506b7d6fb2baa5b8e584332
d9f44bf1fcaa0c6d7fc4da8e7200beade186d9dd
/src/main/generated-sources/xtend/clases/subeWindow.java
b08c5f550af3b293c2d4751f278a8608cf10cfcd
[]
no_license
Fedes23/gastosArena
53e9239f99f373c44390ca2519c9fd6ec245c4c9
0102d54fb31792e5562a9cdbbb4e4484f5d68432
refs/heads/master
2020-03-28T12:59:06.967058
2018-09-11T17:35:10
2018-09-11T17:35:10
148,354,600
0
0
null
null
null
null
UTF-8
Java
false
false
7,873
java
package clases; import clases.monto; import clases.subeDomain; import org.eclipse.xtext.xbase.lib.ObjectExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; import org.uqbar.arena.bindings.NotNullObservable; import org.uqbar.arena.bindings.ObservableValue; import org.uqbar.arena.layout.ColumnLayout; import org.uqbar.arena.layout.HorizontalLayout; import org.uqbar.arena.layout.VerticalLayout; import org.uqbar.arena.widgets.Button; import org.uqbar.arena.widgets.Control; import org.uqbar.arena.widgets.Label; import org.uqbar.arena.widgets.NumericField; import org.uqbar.arena.widgets.Panel; import org.uqbar.arena.widgets.TextBox; import org.uqbar.arena.widgets.tables.Column; import org.uqbar.arena.widgets.tables.Table; import org.uqbar.arena.windows.MainWindow; import org.uqbar.arena.xtend.ArenaXtendExtensions; import org.uqbar.lacar.ui.model.Action; import org.uqbar.lacar.ui.model.ControlBuilder; import org.uqbar.lacar.ui.model.TableBuilder; import org.uqbar.lacar.ui.model.bindings.ViewObservable; @SuppressWarnings("all") public class subeWindow extends MainWindow<subeDomain> { public subeWindow() { super(new subeDomain()); } public void createContents(final Panel MainPanel) { Panel _panel = new Panel(MainPanel); final Procedure1<Panel> _function = new Procedure1<Panel>() { public void apply(final Panel it) { VerticalLayout _verticalLayout = new VerticalLayout(); it.setLayout(_verticalLayout); } }; final Panel principal = ObjectExtensions.<Panel>operator_doubleArrow(_panel, _function); Panel _panel_1 = new Panel(principal); final Procedure1<Panel> _function_1 = new Procedure1<Panel>() { public void apply(final Panel it) { ColumnLayout _columnLayout = new ColumnLayout(3); it.setLayout(_columnLayout); } }; final Panel superior = ObjectExtensions.<Panel>operator_doubleArrow(_panel_1, _function_1); Panel _panel_2 = new Panel(principal); final Procedure1<Panel> _function_2 = new Procedure1<Panel>() { public void apply(final Panel it) { VerticalLayout _verticalLayout = new VerticalLayout(); it.setLayout(_verticalLayout); } }; final Panel inferior = ObjectExtensions.<Panel>operator_doubleArrow(_panel_2, _function_2); Label _label = new Label(superior); _label.setText("descripcion:"); TextBox _textBox = new TextBox(superior); final Procedure1<TextBox> _function_3 = new Procedure1<TextBox>() { public void apply(final TextBox it) { ObservableValue<Control, ControlBuilder> _value = it.<ControlBuilder>value(); ArenaXtendExtensions.operator_spaceship(_value, "descripcionMonto"); it.setWidth(150); } }; ObjectExtensions.<TextBox>operator_doubleArrow(_textBox, _function_3); Button _button = new Button(superior); final Procedure1<Button> _function_4 = new Procedure1<Button>() { public void apply(final Button it) { final NotNullObservable campoDescripcion = new NotNullObservable("descripcionMonto"); final NotNullObservable campoMonto = new NotNullObservable("monto"); it.setCaption("Agregar Gasto"); final Action _function = new Action() { public void execute() { subeWindow.this.agregarMontoAlRepositorio(); } }; it.onClick(_function); it.<Object, ControlBuilder>bindEnabled(campoDescripcion); it.<Object, ControlBuilder>bindEnabled(campoMonto); } }; ObjectExtensions.<Button>operator_doubleArrow(_button, _function_4); Label _label_1 = new Label(superior); _label_1.setText("Monto:"); NumericField _numericField = new NumericField(superior); final Procedure1<NumericField> _function_5 = new Procedure1<NumericField>() { public void apply(final NumericField it) { ObservableValue<Control, ControlBuilder> _value = it.<ControlBuilder>value(); ArenaXtendExtensions.operator_spaceship(_value, "monto"); it.setWidth(150); } }; ObjectExtensions.<NumericField>operator_doubleArrow(_numericField, _function_5); Button _button_1 = new Button(superior); final Procedure1<Button> _function_6 = new Procedure1<Button>() { public void apply(final Button it) { final NotNullObservable campoDescripcion = new NotNullObservable("descripcionMonto"); final NotNullObservable campoMonto = new NotNullObservable("monto"); it.setCaption("Agregar ingreso"); final Action _function = new Action() { public void execute() { subeWindow.this.agregarMontoAlRepositorio(); } }; it.onClick(_function); it.<Object, ControlBuilder>bindEnabled(campoDescripcion); it.<Object, ControlBuilder>bindEnabled(campoMonto); } }; ObjectExtensions.<Button>operator_doubleArrow(_button_1, _function_6); Table<monto> _table = new Table<monto>(inferior, monto.class); final Procedure1<Table<monto>> _function_7 = new Procedure1<Table<monto>>() { public void apply(final Table<monto> it) { ViewObservable<Table<monto>, TableBuilder<monto>> _items = it.items(); ArenaXtendExtensions.operator_spaceship(_items, "listaMontos"); ObservableValue<Control, ControlBuilder> _value = it.<ControlBuilder>value(); ArenaXtendExtensions.operator_spaceship(_value, "montoSeleccionado"); it.setNumberVisibleRows(4); Column<monto> _column = new Column<monto>(it); final Procedure1<Column<monto>> _function = new Procedure1<Column<monto>>() { public void apply(final Column<monto> it) { it.setTitle("Fecha"); it.setFixedSize(200); it.bindContentsToProperty("fecha"); } }; ObjectExtensions.<Column<monto>>operator_doubleArrow(_column, _function); Column<monto> _column_1 = new Column<monto>(it); final Procedure1<Column<monto>> _function_1 = new Procedure1<Column<monto>>() { public void apply(final Column<monto> it) { it.setTitle("Descripción"); it.setFixedSize(200); it.bindContentsToProperty("descripcion"); } }; ObjectExtensions.<Column<monto>>operator_doubleArrow(_column_1, _function_1); Column<monto> _column_2 = new Column<monto>(it); final Procedure1<Column<monto>> _function_2 = new Procedure1<Column<monto>>() { public void apply(final Column<monto> it) { it.setTitle("Monto"); it.setFixedSize(200); it.bindContentsToProperty("monto"); } }; ObjectExtensions.<Column<monto>>operator_doubleArrow(_column_2, _function_2); } }; ObjectExtensions.<Table<monto>>operator_doubleArrow(_table, _function_7); Panel _panel_3 = new Panel(inferior); final Procedure1<Panel> _function_8 = new Procedure1<Panel>() { public void apply(final Panel it) { HorizontalLayout _horizontalLayout = new HorizontalLayout(); it.setLayout(_horizontalLayout); } }; final Panel renglonSaldo = ObjectExtensions.<Panel>operator_doubleArrow(_panel_3, _function_8); Label _label_2 = new Label(renglonSaldo); _label_2.setText("Saldo:"); Label _label_3 = new Label(renglonSaldo); final Procedure1<Label> _function_9 = new Procedure1<Label>() { public void apply(final Label it) { ObservableValue<Control, ControlBuilder> _value = it.<ControlBuilder>value(); ArenaXtendExtensions.operator_spaceship(_value, "totalMonto"); } }; ObjectExtensions.<Label>operator_doubleArrow(_label_3, _function_9); } public Object agregarMontoAlRepositorio() { return null; } public static void main(final String[] args) { new subeWindow().startApplication(); } }
[ "fede.serafini.23@gmail.com" ]
fede.serafini.23@gmail.com
c1a3625003fbeda666d23678a20f12156ff0ada1
58ad4ae44a50d93be80d1ea60dd911f089c3ba82
/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalysisBuilders.java
ea2a956a66e12c4845b0a1eebdf9341e3998abab
[ "Apache-2.0" ]
permissive
elastic/elasticsearch-java
ef6aa0c91f8cd45225ecb7e2ba20eb59180b5293
b2b0e4708df2979d38c58abbb85e98edb2bb6c77
refs/heads/main
2023-08-16T11:01:11.676949
2023-08-11T17:03:54
2023-08-11T17:03:54
365,244,061
318
165
Apache-2.0
2023-09-13T20:19:15
2021-05-07T13:34:18
Java
UTF-8
Java
false
false
3,496
java
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ //---------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- package co.elastic.clients.elasticsearch.ml; import co.elastic.clients.util.ObjectBuilder; import java.util.function.Function; /** * Builders for {@link DataframeAnalysis} variants. */ public class DataframeAnalysisBuilders { private DataframeAnalysisBuilders() { } /** * Creates a builder for the {@link DataframeAnalysisClassification * classification} {@code DataframeAnalysis} variant. */ public static DataframeAnalysisClassification.Builder classification() { return new DataframeAnalysisClassification.Builder(); } /** * Creates a DataframeAnalysis of the {@link DataframeAnalysisClassification * classification} {@code DataframeAnalysis} variant. */ public static DataframeAnalysis classification( Function<DataframeAnalysisClassification.Builder, ObjectBuilder<DataframeAnalysisClassification>> fn) { DataframeAnalysis.Builder builder = new DataframeAnalysis.Builder(); builder.classification(fn.apply(new DataframeAnalysisClassification.Builder()).build()); return builder.build(); } /** * Creates a builder for the {@link DataframeAnalysisOutlierDetection * outlier_detection} {@code DataframeAnalysis} variant. */ public static DataframeAnalysisOutlierDetection.Builder outlierDetection() { return new DataframeAnalysisOutlierDetection.Builder(); } /** * Creates a DataframeAnalysis of the {@link DataframeAnalysisOutlierDetection * outlier_detection} {@code DataframeAnalysis} variant. */ public static DataframeAnalysis outlierDetection( Function<DataframeAnalysisOutlierDetection.Builder, ObjectBuilder<DataframeAnalysisOutlierDetection>> fn) { DataframeAnalysis.Builder builder = new DataframeAnalysis.Builder(); builder.outlierDetection(fn.apply(new DataframeAnalysisOutlierDetection.Builder()).build()); return builder.build(); } /** * Creates a builder for the {@link DataframeAnalysisRegression regression} * {@code DataframeAnalysis} variant. */ public static DataframeAnalysisRegression.Builder regression() { return new DataframeAnalysisRegression.Builder(); } /** * Creates a DataframeAnalysis of the {@link DataframeAnalysisRegression * regression} {@code DataframeAnalysis} variant. */ public static DataframeAnalysis regression( Function<DataframeAnalysisRegression.Builder, ObjectBuilder<DataframeAnalysisRegression>> fn) { DataframeAnalysis.Builder builder = new DataframeAnalysis.Builder(); builder.regression(fn.apply(new DataframeAnalysisRegression.Builder()).build()); return builder.build(); } }
[ "sylvain@elastic.co" ]
sylvain@elastic.co
3815244b0c196360347065876e71082283408af5
61135b8f12c974ee6dc56b105a20e1661309c328
/app/src/test/java/dima/liza/mobile/shenkar/com/sqlproject/ExampleUnitTest.java
884d0be02d724f4b57eb4efdc102dcfd064aaf5f
[]
no_license
DimaGirya/SQLProject
ff4286b8f2296e814ce4ab8d04814395e1ff0f2a
1050369d90095db90cf98e7f73993a272969a52f
refs/heads/master
2021-01-10T18:04:01.439297
2016-01-21T13:12:11
2016-01-21T13:12:11
48,714,285
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package dima.liza.mobile.shenkar.com.sqlproject; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "DimaGirya1990@gmail.com" ]
DimaGirya1990@gmail.com
6e541bf376593272ab48a8872e89f46990272e74
6ee8db44ad78c7819e1c6005c0b40a1c64462f41
/src/testcal/TestCal.java
01cbb16f892eb7dcd25a5b3063d6b140d1772b02
[]
no_license
djshujja/java-gpa-calculator
c5010be419fe18708ca1bbec3f0d1c817925e36a
78ac2385d4322ca569e7e3d2aad3a0b6487aa3b1
refs/heads/main
2023-01-09T14:25:49.496834
2020-11-04T07:27:29
2020-11-04T07:27:29
309,924,196
0
0
null
null
null
null
UTF-8
Java
false
false
486
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 testcal; /** * * @author DjShujja */ public class TestCal { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here dao dao = new dao(); dao.connection(); } }
[ "djshujja@gmail.com" ]
djshujja@gmail.com
698674bab8c051b8895de9f20991a677d17af954
0b994e8de4d63857535c19c95851017ad4561fcb
/hystrix-demo/src/main/java/com/chen/rxjava/demo/RxJavaSchedulers.java
d01d8120e45b28a8dc03cfe93cead9e7a56100d8
[]
no_license
chen458/open-source-demo
e3dd5e778ef58653c001e246d348586275413b61
e998a3ef949447a6d381ab33f3ca3d43360707ba
refs/heads/master
2021-01-20T05:25:10.066544
2017-06-18T16:13:42
2017-06-18T16:13:42
89,774,893
0
0
null
null
null
null
UTF-8
Java
false
false
3,140
java
package com.chen.rxjava.demo; import rx.Observable; import rx.Subscriber; import rx.functions.Action1; import rx.schedulers.Schedulers; import rx.subscriptions.CompositeSubscription; import java.util.Random; import java.util.concurrent.TimeUnit; /** * 调度器,解决Android主线程问题 * * @author chenshenghong * @version 1.0 * @created 2017/5/30 * @time 下午2:59 * * Schedulers 类型: * 1、Schedulers.immediate() * 允许你立即在当前线程执行你指定的工作。它是timeout(),timeInterval(),以及timestamp()方法默认的调度器。 * 2、Schedulers.newThread() * 总是启用新线程,并在新线程执行操作 * 3、Schedulers.io() * 用于I/O操作(读写文件、读写数据库、网络信息交互等); * io() 的内部实现是是用一个无数量上限的线程池,可以重用空闲的线程,因此多数情况下 io() 比 newThread() 更有效率。; * 4、Schedulers.computation() * 计算工作使用调度器。指 CPU 密集型计算,不涉及 I/O 等限制性能的操作; * 使用的固定的线程池,大小为 CPU 核数。 * 5、Schedulers.trampoline() * 会处理它的队列并且按序运行队列中每一个任务。它是repeat()和retry()方法默认的调度器。 * * Schedulers 方法: * 1、subscribeOn() * 指定 subscribe() 所发生的线程,即 Observable.OnSubscribe 被激活时所处的线程。或者叫做事件产生的线程。 * 2、observeOn() * 指定 Subscriber 所运行在的线程。或者叫做事件消费的线程。 */ public class RxJavaSchedulers { private CompositeSubscription compositeSubscription; public static void main(String[] args) { ioSchedulers(); } private static void ioSchedulers(){ Observable .create(new Observable.OnSubscribe<Integer>() { @Override public void call(Subscriber<? super Integer> subscriber) { subscriber.onNext(getNumber()); subscriber.onNext(getNumber()); subscriber.onNext(getNumber()); subscriber.onCompleted(); } }) .subscribeOn(Schedulers.io())//指定 subscribe() 发生在 IO 线程 .observeOn(Schedulers.immediate())//指定 Subscriber 的回调发生在主线程 .subscribe(new Action1<Integer>() { @Override public void call(Integer number) { System.out.println("Schedulers.io() runing! number = " + number); } }); System.out.println("mainThread done"); } /** * 模拟取数据 * @return */ private static int getNumber(){ int num = new Random().nextInt(1000); try { TimeUnit.MILLISECONDS.sleep(num * 1L); } catch (Exception e) { e.printStackTrace(); } System.out.println("getNumber done。 number = " + num); return num; } }
[ "chenshenghong@meituan.com" ]
chenshenghong@meituan.com
416d39cff087f3a6ca7b544dd2258397f74b4c67
c9ff93802550000e172008c52eaad51b020c9bac
/de.jwic.samples/src/de/jwic/samples/filebrowser/DirectoryModel.java
a323a598611dead33390ed2d2bd488df67d07c87
[]
no_license
xwic/jWic
0846232415b5c11b47e5ccb9c16c0a67cb658a0d
aceeb9961dff0a9ac9989048208b101dafcc0603
refs/heads/master
2023-08-17T01:24:15.585697
2021-07-28T18:01:08
2021-07-28T18:01:08
6,672,931
4
2
null
2022-05-20T20:45:28
2012-11-13T15:36:21
JavaScript
UTF-8
Java
false
false
2,084
java
/******************************************************************************* * Copyright 2015 xWic group (http://www.xwic.de) * * Licensed under the Apache License, Version 2.0 (the "License"). * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *******************************************************************************/ package de.jwic.samples.filebrowser; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.File; import java.io.Serializable; /** * Acts as a model for the FileBrowser. Holds the current directory selected * by the user. * * @author Florian Lippisch * @version $Revision: 1.2 $ */ public class DirectoryModel implements Serializable { private File directory = null; private PropertyChangeSupport propSupport = new PropertyChangeSupport(this); /** * Add a listener to this model. * @param listener */ public void addPropertyChangeListener(PropertyChangeListener listener) { propSupport.addPropertyChangeListener(listener); } /** * Removes the specified listener. * @param listener */ public void removePropertyChangeListener(PropertyChangeListener listener) { propSupport.removePropertyChangeListener(listener); } /** * @param rootFile */ public DirectoryModel(File file) { directory = file; } /** * @return Returns the directory. */ public File getDirectory() { return directory; } /** * @param directory The directory to set. */ public void setDirectory(File directory) { File old = this.directory; this.directory = directory; propSupport.firePropertyChange("directory", old, directory); } }
[ "daniel@beamgau.com" ]
daniel@beamgau.com
3adab4d511fe1952ac31ea5170e6e38bd2e0efdb
a99501469adbec29cebc3b332ff9419d1136e4d8
/seguranca/src/main/java/br/com/basis/madre/seguranca/domain/Municipio.java
9f67fc76425e6196298190167276dcab549e3dbb
[]
no_license
Rodolfo-campina/madre
0d73fc6541d4eb0b18ed8c3e6c82b15acaf114d3
de5f919a4c29bafaf41a69c0120d5af3a0fcbdad
refs/heads/master
2023-07-06T21:59:48.503379
2021-08-13T15:03:27
2021-08-13T15:03:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,058
java
package br.com.basis.madre.seguranca.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import javax.validation.constraints.*; import org.springframework.data.elasticsearch.annotations.FieldType; import java.io.Serializable; /** * A Municipio. */ @Entity @Table(name = "municipio") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @org.springframework.data.elasticsearch.annotations.Document(indexName = "municipio") public class Municipio implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqMunicipio") @SequenceGenerator(name = "seqMunicipio") private Long id; @NotNull @Column(name = "nome", nullable = false) private String nome; @Column(name = "nome_do_distrito") private String nomeDoDistrito; @NotNull @Column(name = "ibge", nullable = false) private String ibge; @ManyToOne @JsonIgnoreProperties(value = "municipios", allowSetters = true) private UF uf; // jhipster-needle-entity-add-field - JHipster will add fields here public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNome() { return nome; } public Municipio nome(String nome) { this.nome = nome; return this; } public void setNome(String nome) { this.nome = nome; } public String getNomeDoDistrito() { return nomeDoDistrito; } public Municipio nomeDoDistrito(String nomeDoDistrito) { this.nomeDoDistrito = nomeDoDistrito; return this; } public void setNomeDoDistrito(String nomeDoDistrito) { this.nomeDoDistrito = nomeDoDistrito; } public String getIbge() { return ibge; } public Municipio ibge(String ibge) { this.ibge = ibge; return this; } public void setIbge(String ibge) { this.ibge = ibge; } public UF getUf() { return uf; } public Municipio uf(UF uF) { this.uf = uF; return this; } public void setUf(UF uF) { this.uf = uF; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Municipio)) { return false; } return id != null && id.equals(((Municipio) o).id); } @Override public int hashCode() { return 31; } // prettier-ignore @Override public String toString() { return "Municipio{" + "id=" + getId() + ", nome='" + getNome() + "'" + ", nomeDoDistrito='" + getNomeDoDistrito() + "'" + ", ibge='" + getIbge() + "'" + "}"; } }
[ "mariabrenda177@gmail.com" ]
mariabrenda177@gmail.com
44aa1e3d4b58cdcec82df96df085ab1a882a56e0
2cc89a69f643c440214daca54349f5dab75fb726
/backend/src/main/java/com/scc/app/service/SupplyService.java
a657aa1a1d34a85348e2ea28cc885cc437b21cbd
[]
no_license
Ryuushinzou/SmartCarCleaner
83d99697c5f377f57d6d02bb4c1972ed0573a025
bd45c12fc017626112ff99a708cd1d6a5de03fdb
refs/heads/master
2022-12-26T18:13:59.018223
2020-05-21T21:14:22
2020-05-21T21:14:22
254,615,573
0
0
null
2022-12-10T06:00:52
2020-04-10T11:14:44
Java
UTF-8
Java
false
false
2,517
java
package com.scc.app.service; import com.scc.app.model.Resource; import com.scc.app.model.Supply; import com.scc.app.model.SupplyStatus; import com.scc.app.mysql.repository.SupplyRepository; import com.scc.app.utils.Utils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @Service public class SupplyService { //TODO add firebase @Autowired private SupplyRepository supplyRepository; private ConcurrentMap<Long, Supply> idToSupply = new ConcurrentHashMap<>(); @Scheduled(fixedDelay = 10_000) private void syncWithDb() { ConcurrentMap<Long, Supply> idToSupplyTemporary = new ConcurrentHashMap<>(); if (Utils.isFirebaseDatabase()) { //TODO get all firebase } else { supplyRepository.findAll().forEach(supply -> idToSupplyTemporary.put(supply.getId(), supply.clone())); } idToSupply = idToSupplyTemporary; } public Supply saveSupply(Supply supply) { if (Utils.isFirebaseDatabase()) { // TODO add to firebase db } else { return supplyRepository.save(supply); } return null; } public Supply getResourceById(Long id) { return idToSupply.get(id); } public Collection<Supply> getAllSupplies() { return idToSupply.values(); } public Supply update(Supply supplyUpdated) { Supply supply = idToSupply.get(supplyUpdated.getId()); if (supply != null) { if (supplyUpdated.getResourceIdToQuantity() != null) { supply.setResourceIdToQuantity(supplyUpdated.getResourceIdToQuantity()); } if (supplyUpdated.getDate() != null) { supply.setDate(supplyUpdated.getDate()); } if (supplyUpdated.getSupplyStatus() != null) { supply.setSupplyStatus(supplyUpdated.getSupplyStatus()); } if (supplyUpdated.getWashingStationId() != null) { supply.setWashingStationId(supplyUpdated.getWashingStationId()); } if (supplyUpdated.getPrice() != null) { supply.setPrice(supplyUpdated.getPrice()); } return supplyRepository.save(supply); } return null; } }
[ "mihai.godza@everymatrix.com" ]
mihai.godza@everymatrix.com
012730d5fb0bb0345f2b9b621be7e7b3650d2673
613415527714d681ad38e19ed612e5f182cb85f2
/app/src/main/java/com/example/machenike/myapplication/c1Frg.java
68fc3d3d688345ae8f0187017213bf301220b381
[]
no_license
sunliangzhen/lottery-nick-4
985f90c82c2cc2b77a2797ab71219d67bae2ca04
b5d96e2ec59382a9b777af95d104dd974c884989
refs/heads/master
2020-04-13T08:33:31.025817
2018-12-25T13:45:55
2018-12-25T13:45:55
162,987,152
0
0
null
null
null
null
UTF-8
Java
false
false
10,523
java
package com.example.machenike.myapplication; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; import android.text.TextUtils; import android.util.TypedValue; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.example.machenike.myapplication.a.BaseFragment; import com.example.machenike.myapplication.a.Constant; import com.example.machenike.myapplication.a.JSONUtils; import com.example.machenike.myapplication.a.NetWorkUtils; import com.example.machenike.myapplication.a.StringUtils; import com.example.machenike.myapplication.commonwidget.LoadingDataTip; import com.zhy.autolayout.utils.AutoUtils; import org.xutils.common.util.LogUtil; import org.xutils.view.annotation.Event; import org.xutils.view.annotation.ViewInject; import java.util.Map; public class c1Frg extends BaseFragment implements LoadingDataTip.onReloadListener { @ViewInject(R.id.webView) WebView webView; @ViewInject(R.id.loadedTip) LoadingDataTip loadedTip; @ViewInject(R.id.relay_01) RelativeLayout relay_01; @ViewInject(R.id.relay_cehua) RelativeLayout relay_cehua; @ViewInject(R.id.linlay_bottom) LinearLayout linlay_bottom; @ViewInject(R.id.in_tv_title) TextView in_tv_title; private String mFailingUrl = ""; private boolean isLoadOK = true; private String app_type; private String url; private Map<String, String> map; private Map<String, String> map_app; private Map<String, String> map_main; @Override protected int getLayoutResource() { return R.layout.cfrg_1; } @Override public void initPresenter() { } @Event(value = {R.id.relay_01}) private void Click(View view) { switch (view.getId()) { case R.id.relay_01: break; default: break; } } @Override protected void initView() { String json = StringUtils.getJson("app.json", getActivity()); map = JSONUtils.parseKeyAndValueToMap(json); map_app = JSONUtils.parseKeyAndValueToMap(map.get("app")); map_main = JSONUtils.parseKeyAndValueToMapList(map.get("main")).get(0); app_type = map_app.get("app_type"); url = map_main.get("web_url"); } @Override public void requestDatas() { super.requestDatas(); } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) private void webViewSet() { WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口 webSettings.setSupportZoom(false);//无限缩放 webSettings.setBuiltInZoomControls(false); webSettings.setAppCacheEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_DEFAULT); webSettings.setLoadWithOverviewMode(true);//这方法可以让你的页面适应手机屏幕的分辨率,完整的显示在屏幕上,可以放大缩小 webSettings.setPluginState(WebSettings.PluginState.ON); webSettings.setAllowFileAccess(true);// 设置允许访问文件数据 webSettings.setAllowFileAccessFromFileURLs(true); webSettings.setAllowUniversalAccessFromFileURLs(true); webSettings.setUseWideViewPort(true); //图片加载处理 if (Build.VERSION.SDK_INT >= 19) { webView.getSettings().setLoadsImagesAutomatically(true); } else { webView.getSettings().setLoadsImagesAutomatically(false); } final String cachePath = getActivity().getApplicationContext().getDir("cache", Context.MODE_PRIVATE).getPath(); webSettings.setAppCachePath(cachePath); webSettings.setAppCacheMaxSize(5 * 1024 * 1024); webSettings.setDomStorageEnabled(true);//可以使用Android4.4手机和Chrome Inspcet Device联调 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);//5.0以上 } } public void titleBarIsCover() { relay_cehua.setVisibility(View.GONE); int dimension2 = Integer.parseInt(map_main.get("webcover_b_h")); int dimension = Integer.parseInt(map.get("bottom_h")); if (dimension - dimension2 < 0) { linlay_bottom.setPadding(0, 0, 0, (int) AutoUtils.getPercentHeightSize(dimension)); } else { linlay_bottom.setPadding(0, 0, 0, (int) AutoUtils.getPercentHeightSize(dimension - dimension2)); } int dimensionTop = Integer.parseInt(map_main.get("web_t_h")); int dimension2Top = Integer.parseInt(map_main.get("webcover_t_h")); RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) webView.getLayoutParams(); if (dimensionTop - dimension2Top < 0) { lp.topMargin = (int) AutoUtils.getPercentHeightSize(0); } else { lp.topMargin = (int) AutoUtils.getPercentHeightSize(dimensionTop - dimension2Top); } in_tv_title.setText(map_main.get("web_title")); in_tv_title.setTextColor(Color.parseColor(map_main.get("web_text_color"))); in_tv_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, AutoUtils.getPercentWidthSize(Integer.parseInt(map_main.get("web_text_size")))); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) relay_01.getLayoutParams(); params.height = AutoUtils.getPercentHeightSize(dimensionTop); relay_01.setLayoutParams(params); if(map_main.get("web_text_bg").startsWith("#")){ relay_01.setBackgroundColor(Color.parseColor(map_main.get("web_text_bg"))); }else{ String img_url = map_main.get("web_text_bg"); if (!img_url.startsWith("http")) { relay_01.setBackgroundResource(StringUtils.getImageResourceId(img_url)); } else { } } } @Override public void onResume() { super.onResume(); } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); titleBarIsCover(); webViewSet(); loadedTip.setOnReloadListener(this); if (NetWorkUtils.isNetConnected(getContext())) { loadedTip.setLoadingTip(LoadingDataTip.LoadStatus.loading); webView.loadUrl(url); } else { mFailingUrl = url; loadedTip.setLoadingTip(LoadingDataTip.LoadStatus.error); } Constant.webView1 = webView; relay_cehua.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MainAty mainAty = (MainAty) getActivity(); mainAty.a(); } }); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); isLoadOK = false; mFailingUrl = failingUrl; webView.setVisibility(View.GONE); loadedTip.setLoadingTip(LoadingDataTip.LoadStatus.error); } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (isLoadOK) { webView.setVisibility(View.VISIBLE); loadedTip.setLoadingTip(LoadingDataTip.LoadStatus.finish); } } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO 自动生成的方法存根 if (url.startsWith("tel:")) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } if (url.startsWith("alipays://")) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent); return true; } webView.loadUrl(url); return true; } }); webView.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { view.loadUrl("javascript:function setTop(){document.querySelector('body > div.topcontainer').style.display=\"none\";}setTop();"); // view.loadUrl("javascript:function setTop(){document.querySelector('body > div.topcontainer > div.floatrow.art-topbanner').style.display=\"none\";}setTop();"); // // view.loadUrl("javascript:function setTop(){document.getElementById('body > div.topcontainer > div.topbanne').style.padding = 0}setTop();"); // view.loadUrl("javascript:function setTop(){document.getElementById('bbody > div.topcontainer > div.floatrow.art-topbanner').style.padding = 0}setTop();"); super.onProgressChanged(view, newProgress); } }); } @Override public void reload() { if (!NetWorkUtils.isNetConnected(getContext())) { showShortToast("网络异常"); return; } if (TextUtils.isEmpty(url)) { return; } isLoadOK = true; webView.loadUrl(mFailingUrl); webView.setVisibility(View.VISIBLE); loadedTip.setLoadingTip(LoadingDataTip.LoadStatus.loading); } }
[ "2542983545@qq.com" ]
2542983545@qq.com
c2e3868d67d53cdff395a04333746a65768b0a73
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21_ReducedClassCount/applicationModule/src/main/java/applicationModulepackageJava4/Foo756.java
674aaffad8db01febba243836e2a146e1089dc49
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package applicationModulepackageJava4; public class Foo756 { public void foo0() { new applicationModulepackageJava4.Foo755().foo9(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } public void foo7() { foo6(); } public void foo8() { foo7(); } public void foo9() { foo8(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
4fd5cbc7485642f1b4a41baa2b293daff326203d
1ec6ed32c4bf4d0f342daf5b563eb5a5c20e613e
/src/OLD/DynamicProgramming/LargestPalindrome.java
a68e8162287aedb0024e93d6c2e8f1821222f7f0
[]
no_license
PoojaRudrawar/myWork
aa456c08db2ccf6f1ad39100bbc526ed8adaf1d9
b6243007925f84ef126c8eada1c1bba4feb1efc7
refs/heads/master
2020-03-21T12:43:30.843249
2018-10-05T12:43:44
2018-10-05T12:43:44
138,568,592
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package OLD.DynamicProgramming; public class LargestPalindrome { public static void main(String[] args) { int[] input={1,3,4,5,6,4,1}; int length=input.length; int[][] developMatrix=new int[length][length]; for(int i=0;i<length;i++) { developMatrix[i][i]=1; } for(int i=2;i<=length;i++){//i=1 means length=i+1 and ... for(int j=0;j<length-i+1;j++){ int k=j+i-1; if(input[j]==input[k]){ developMatrix[j][k]=2+developMatrix[j+1][k-1]; } else{ developMatrix[j][k]=Integer.max(developMatrix[j][k-1],developMatrix[j+1][k]); } } } printMatrix(length, developMatrix); } private static void printMatrix(int length, int[][] developMatrix) { for(int i=0;i<length;i++) { for (int j=0;j<length;j++){ System.out.print(developMatrix[i][j]+" "); } System.out.println(); } } }
[ "prudrawar@saba.com" ]
prudrawar@saba.com
5e6d9917be2931a25a7732f5a291c7132e347dcc
4c7141b05b0146e0f2b6acae275e01045f57a497
/Builder Design Pattern/src/com/sd/dp/builder/Address.java
e7e00e55a0ab92317e4f0dfc5eee66794d9260b4
[]
no_license
sahil-diwan/Design-Patterns
ae3b399eaf968b113105f5d8047ed9c46e2f1942
c5fc7a83e5afe4bbd832b7fa63e5e591db8fa462
refs/heads/master
2022-06-07T23:02:12.080253
2020-05-07T21:39:15
2020-05-07T21:39:15
262,137,615
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
package com.sd.dp.builder; public class Address { private String houseNumber; private String street; private String city; private String zipcode; private String state; public String getHouseNumber() { return houseNumber; } public void setHouseNumber(String houseNumber) { this.houseNumber = houseNumber; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getZipcode() { return zipcode; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } public String getState() { return state; } public void setState(String state) { this.state = state; } }
[ "isahildiwan101@gmail.com" ]
isahildiwan101@gmail.com
415d1cbce5b07ca6041b6d0432c581c8072feb01
250af241e34bab434540bbd873a4e50e22b701e8
/src/main/java/com/muammerdiri/rentACar/core/utilities/result/SuccessDataResult.java
4368a0bbf57db3b9ceaee02e4fe289f86d168f2f
[]
no_license
muammerdiri/ReCapProject
913b3bd2b9bb6965c250220f9e1e4a1b78d28a00
5e749c9fa38795e7d3c3c27d3d8fd9e6df973911
refs/heads/master
2023-02-27T09:04:44.679285
2022-12-14T10:34:41
2022-12-14T10:34:41
334,995,359
1
0
null
null
null
null
UTF-8
Java
false
false
445
java
package com.muammerdiri.rentACar.core.utilities.result; public class SuccessDataResult<T> extends DataResult<T> { public SuccessDataResult(T data, String message) { super(data, true ,message); } public SuccessDataResult(T data) { super(data,true); } public SuccessDataResult(String message) { super(null, true ,message); } public SuccessDataResult() { super(null, true); } }
[ "muammerdiri2@gmail.com" ]
muammerdiri2@gmail.com
3063c75488f1edcf8d6d0fb37ffc2e8774c2ce6d
505e6186bc30b9bb8ef92cfde24ea57319847ba8
/DPS Genetic Algorithm/src/Phenotype.java
a529d37793367da5706c76ccdc7fe9a0f5087eed
[]
no_license
Flamestriken911/Genetic-Algorithm
06ed348bfa8f4511edc7e461d28588d9259056f3
f0ebd6f4d151a4aea3d065c90b57c8735d223c42
refs/heads/master
2020-04-26T15:55:02.314178
2015-04-12T19:55:08
2015-04-12T19:55:08
32,197,902
0
0
null
null
null
null
UTF-8
Java
false
false
5,331
java
//Code for the 'phenotypes' of the evolutionary algorithm import java.util.Arrays; import org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression; class Phenotype { private boolean[] varSelection; private String id; //mutationRate is frequency of mutations and mutationDepth is max number of possible changes per mutation private double mutationRate; private int mutationDepth; private boolean isMutant = false; private int numVars; private double[] varCoeffs; public OLSMultipleLinearRegression reg = new OLSMultipleLinearRegression(); //Class constructor //Init vars and mutate public Phenotype(boolean[] varBools, double mutRate, int mutDepth, boolean enableMutate) { this.varSelection = varBools; this.mutationRate = mutRate; this.mutationDepth = mutDepth; //Mutate if enabled & triggered, and track whether it is a mutant if (enableMutate && Math.random() < mutationRate) { this.mutate(); this.isMutant = true; } //Keep track of how many columns we have this.numVars=0; int varTracker = 0; for (int i=0; i<varSelection.length; i++){ if(varSelection[i]==true) { varTracker++; } } this.numVars = varTracker; //update ID this.id = ""; for(int i=0; i<this.varSelection.length; i++){ if(this.varSelection[i]){ this.id +="1"; } else{ this.id +="0"; } } } //Code for reproduce method //Returns a new copy of itself, with possibility of mutation public Phenotype reproduce() { boolean[] childVarSelection = Arrays.copyOf(this.varSelection, this.varSelection.length); Phenotype child = new Phenotype(childVarSelection, mutationRate, mutationDepth, true); return child; } //Code for mutate method private void mutate() { //Randomly select number of mutations to make int numMutations = (int) ( Math.random() * mutationDepth + 1 ); //Make selected number of changes //Note that currently a change can be made and then be un-made by the subsequent change within a single 'round' of mutation for (int i=0; i<numMutations; i++) { //Randomly select an index to change, then switch its value int mutateIndex = (int) ( Math.random() * varSelection.length ); //We use xor to cleanly switch the boolean varSelection[mutateIndex] ^= true; } } //Getter methods //ID public String getId() { return this.id; } //Mutation rate public double getMutationRate() { return mutationRate; } //Mutation depth public int getMutationDepth() { return mutationDepth; } //Number of selected independent variables public int getNumVars() { return numVars; } //Variable selection public boolean[] getVarSelection() { return varSelection; } //Mutant indicator public boolean getIsMutant() { return isMutant; } //Setter methods //ID public void setId(String newID) { id = newID; } //Mutation rate public void setMutationRate(double newMutationRate) { mutationRate = newMutationRate; } //Mutation depth public void setMutationDepth(int newMutationDepth) { mutationDepth = newMutationDepth; } //Variable selection public void setVarSelection(boolean[] newVarSelection) { varSelection = newVarSelection; } //Mutant indicator public void setIsMutant(boolean newIsMutant) { isMutant = newIsMutant; } //Train the phenotype on the provided environment public void train(Environment env){ //Get the y[] and x[][] data from the environment double[] Y = env.getObjData(); //Keep only the necessary columns for X double[][] X = new double[Y.length][this.numVars]; int i=0; for(int currentCol=0; currentCol<this.varSelection.length; currentCol++){ if(varSelection[currentCol]){ double[] dataCol = env.getColumn(currentCol); for (int j=0; j<Y.length; j++){ X[j][i] = dataCol[j]; } i++; if(i>this.numVars) break; } } this.reg.newSampleData(Y, X); this.varCoeffs = this.reg.estimateRegressionParameters(); } public double score(Environment env){ //Get the y[] and x[][] data from the environment double[] Y = env.getObjData(); //Keep only the necessary columns for X double[][] X = new double[Y.length][this.numVars]; int i=0; for(int currentCol=0; currentCol<this.varSelection.length; currentCol++){ if(varSelection[currentCol]){ double[] dataCol = env.getColumn(currentCol); for (int j=0; j<Y.length; j++){ X[j][i] = dataCol[j]; } i++; if(i>this.numVars) break; } } this.reg.newSampleData(Y, X); return reg.calculateAdjustedRSquared(); } }
[ "emersonct911@gmail.com" ]
emersonct911@gmail.com
f80ad8c2442e0f913805e75d1b1fe3b8de69de77
9dc84ce0e25ea1b12468e00425d72f115972a921
/Materials/Java Code/CH18/src/wci/backend/compiler/Instruction.java
208ae5d5586f8f70f0a8b6a27807e190d8bba937
[]
no_license
jeffreypersons/CS153-Compilers
43d47cc0e5ec5c44e08c25485470d29eab260c25
f8e1aa35fc79e9055dcdacaed54131a7ad455457
refs/heads/master
2021-09-15T00:20:21.000895
2017-12-18T22:13:37
2017-12-18T22:13:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,706
java
package wci.backend.compiler; /** * <h1>Instruction</h1> * * <p>Jasmin instructions.</p> * * <p>Copyright (c) 2009 by Ronald Mak</p> * <p>For instructional purposes only. No warranties.</p> */ public enum Instruction { // Load constant ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, FCONST_0, FCONST_1, FCONST_2, ACONST_NULL, BIPUSH, SIPUSH, LDC, // Load value or address ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ILOAD, FLOAD, ALOAD, GETSTATIC, GETFIELD, // Store value or address ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ISTORE, FSTORE, ASTORE, PUTSTATIC, PUTFIELD, // Operand stack POP, SWAP, DUP, // Arithmetic and logical IADD, FADD, ISUB, FSUB, IMUL, FMUL, IDIV, FDIV, IREM, FREM, INEG, FNEG, IINC, IAND, IOR, IXOR, // Type conversion and checking I2F, I2C, I2D, F2I, F2D, D2F, CHECKCAST, // Objects and arrays NEW, NEWARRAY, ANEWARRAY, MULTIANEWARRAY, IALOAD, FALOAD, BALOAD, CALOAD, AALOAD, IASTORE, FASTORE, BASTORE, CASTORE, AASTORE, // Compare and branch IFEQ, IFNE, IFLT, IFLE, IFGT, IFGE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPLE, IF_ICMPGT, IF_ICMPGE, FCMPG, GOTO, LOOKUPSWITCH, // Call and return INVOKESTATIC, INVOKEVIRTUAL, INVOKENONVIRTUAL, RETURN, IRETURN, FRETURN, ARETURN, // No operation NOP; /** * @return the string that is emitted. */ public String toString() { return super.toString().toLowerCase(); } }
[ "jperman8@gmail.com" ]
jperman8@gmail.com
4d194a6d20c31620e4fad8af3fa3115ecad086f8
bc30bdc2a174b47e9e8ccd2ad94585854d262a5f
/modules/learning/src/test/java/deepboof/backward/ChecksForward_DSpatialBatchNorm.java
d5bb781095f8d55a86d198dadc34967b417974c3
[ "Apache-2.0" ]
permissive
lessthanoptimal/DeepBoof
2a3a8307c1cbab2b4076e38776dd828c956105df
2cc5daffa8bcc9fa26286c25438fb97acd4dc2d7
refs/heads/master
2023-09-04T06:36:57.829912
2023-06-01T01:29:31
2023-06-01T01:48:31
58,591,901
21
5
Apache-2.0
2022-03-01T13:20:21
2016-05-12T00:09:54
Java
UTF-8
Java
false
false
5,721
java
/* * Copyright (c) 2016, Peter Abeles. All Rights Reserved. * * This file is part of DeepBoof * * 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 deepboof.backward; import deepboof.DeepBoofConstants; import deepboof.DeepUnitTest; import deepboof.Tensor; import deepboof.misc.TensorOps; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; /** * Special checks for learning implementations of spatial batch norm. The behavior is very different from forwards * only since the statics are computed in the forwards pass * * @author Peter Abeles */ public abstract class ChecksForward_DSpatialBatchNorm<T extends Tensor<T>> extends ChecksForward_DBatchNorm<T> { public ChecksForward_DSpatialBatchNorm(double tolerance) { super(tolerance); } public abstract DSpatialBatchNorm<T> createForwards(boolean gammaBeta ); @Override public DSpatialBatchNorm<T> createForwards(int which) { gammaBeta = which == 0; return createForwards(gammaBeta); } @Override protected void checkParameterShapes(int[] input, List<int[]> parameters) { if( gammaBeta ) { assertEquals(1, parameters.size()); int[] paramShape = parameters.get(0); assertEquals(2, paramShape.length); assertEquals(input[0], paramShape[0]); assertEquals(2, paramShape[1]); } else { assertEquals(0,parameters.size()); } } @Override protected void checkOutputShapes(int[] input, int[] output) { DeepUnitTest.assertEquals(input, output); } @Override public List<Case> createTestInputs() { List<Case> cases = new ArrayList<Case>(); cases.add( new Case(1,1,1)); cases.add( new Case(3,4,5)); // do a bunch of mini-batches so that the statistics are meaningful for( Case c : cases ) c.minibatch = 200; return cases; } /** * Ensures that the mean and variance of the output is approximately one and also checks the statistics of * the internal */ @Test public void checkOutputStatistics() { for( int config = 0; config < numberOfConfigurations; config++ ) { DSpatialBatchNorm<T> alg = createForwards(config); alg.learning(); for (Case test : createTestInputs()) { T input = tensorFactory.randomM(random,false,test.minibatch,test.inputShape); T output = tensorFactory.randomM(random,false,test.minibatch,test.inputShape); alg.initialize(test.inputShape); if( alg.hasGammaBeta() ) { // declare the parameters such that they will not shift the output T params = createParameter(1,0,test.inputShape[0]); alg.setParameters(Arrays.asList(params)); } alg.forward(input,output); verifyMean(output, 0, DeepBoofConstants.TEST_TOL_B_F64); verifyStd(output, 0, 1.0, DeepBoofConstants.TEST_TOL_B_F64); // the data is generated from a uniform distribution from -1 to 1 // mean should be 0 and variance 4/12 = 0.333 T foundMean = alg.getMean(null); T foundVariance = alg.getVariance(null); double foundMeanAve = TensorOps.elementSum(foundMean)/foundMean.length(); double foundVarAve = TensorOps.elementSum(foundVariance)/foundVariance.length(); // standard deviation of the mean int N = test.minibatch*test.inputShape[1]*test.inputShape[2]; double sampleMeanStd = 0.333/Math.sqrt(N); // the mean should be within this tolerance almost all of the time assertEquals(0, foundMeanAve, sampleMeanStd*3); assertEquals(0.333, foundVarAve , sampleMeanStd*10); // not mathematically sound tolerance } } } /** * Tests to see if gamma and beta are applied to the output correctly */ @Test public void checkGammaBeta() { DSpatialBatchNorm<T> alg = createForwards(true); alg.learning(); assertTrue( alg.hasGammaBeta() ); int numBands = 3; int shape[] = new int[]{numBands,4,5}; T input = tensorFactory.randomM(random,false,30,shape); T output = tensorFactory.randomM(random,false,30,shape); T params = createParameter(1.5,20,numBands); alg.initialize(shape); alg.setParameters(Arrays.asList(params)); alg.forward(input,output); verifyMean(output, 20 , DeepBoofConstants.TEST_TOL_B_F64); verifyStd(output, 20, 1.5, DeepBoofConstants.TEST_TOL_B_F64); } protected abstract T createParameter( double gamma , double beta , int numBands ); protected abstract void verifyMean( T tensor , double expected , double tol ); protected abstract void verifyStd( T tensor , double mean, double expected , double tol ); }
[ "peter.abeles@gmail.com" ]
peter.abeles@gmail.com
fffb1d119a2bfb93a0134a89a3150524331fc710
f98123690c1f832da66fc9699052e0a934e74736
/src/main/java/com/networknt/oas/jsonoverlay/StringOverlay.java
5f03f5ca0dab8cd457fd9da4da885ecf34943dbb
[ "Apache-2.0" ]
permissive
jenkins-poc/openapi-parser
38b105ee73dbde969a9263954db8199b151b7f3c
27fe7c3c5aa9a7d927f032a3a74cfd2f09be469c
refs/heads/master
2020-03-10T06:57:08.905420
2018-04-08T17:11:38
2018-04-08T17:11:38
129,250,918
0
0
Apache-2.0
2018-04-12T12:52:45
2018-04-12T12:52:45
null
UTF-8
Java
false
false
1,755
java
/******************************************************************************* * Copyright (c) 2017 ModelSolv, Inc. and others. * 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 * * Contributors: * ModelSolv, Inc. - initial API and implementation and/or initial documentation *******************************************************************************/ package com.networknt.oas.jsonoverlay; import com.fasterxml.jackson.databind.JsonNode; public class StringOverlay extends ScalarOverlay<String> { private StringOverlay(JsonNode json, JsonOverlay<?> parent, ReferenceRegistry refReg) { super(json, parent, refReg); } private StringOverlay(String value, JsonOverlay<?> parent, ReferenceRegistry refReg) { super(value, parent, refReg); } @Override public String fromJson(JsonNode json) { return json.isTextual() ? json.textValue() : null; } @Override public JsonNode toJson(SerializationOptions options) { return value != null ? jsonScalar(value) : jsonMissing(); } public static OverlayFactory<String, StringOverlay> factory = new OverlayFactory<String, StringOverlay>() { @Override protected Class<StringOverlay> getOverlayClass() { return StringOverlay.class; } @Override public StringOverlay _create(String value, JsonOverlay<?> parent, ReferenceRegistry refReg) { return new StringOverlay(value, parent, refReg); } @Override public StringOverlay _create(JsonNode json, JsonOverlay<?> parent, ReferenceRegistry refReg) { return new StringOverlay(json, parent, refReg); } }; }
[ "stevehu@gmail.com" ]
stevehu@gmail.com
f1888fe6181d67bcaf42848f9414f797ae2ff16f
4f1d524cb3c52502b4b2d1db98ed568ef1b0823a
/src/aula03exm02/Janela.java
185ed4173bedb9a694657803b388d64f97d73f07
[]
no_license
ufjf-dcc171/ufjf-dcc171-exr02b-lucasDinizCosta
8a8d88e78fb5be1b48025670e65930e549bf5164
a61232233fb5c5e72ce2ebf726dfcdadc0f8eb78
refs/heads/master
2021-06-21T08:46:42.238928
2017-08-16T01:46:02
2017-08-16T01:46:02
100,435,646
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package aula03exm02; import java.awt.FlowLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class Janela extends JFrame{ private final JLabel escrito_1; private final JTextField caixa_1; private JLabel textoInvertido; public Janela() throws HeadlessException{ super("Exercicio 1 - B"); setLayout(new FlowLayout()); escrito_1 = new JLabel("Digite um texto para ser invertido: "); caixa_1 = new JTextField(20); textoInvertido = new JLabel(); add(escrito_1); add(caixa_1); add(textoInvertido); caixa_1.addActionListener(new funcao()); } public class funcao implements ActionListener{ public String inverterTexto(){ String texto = caixa_1.getText(); String aux = ""; for(int i = texto.length()-1; i >= 0 ;i--){ System.out.println(texto.charAt(i)); aux = aux+texto.charAt(i); } System.out.println(aux); return aux; } public void actionPerformed(ActionEvent e) { textoInvertido.setText("O texto invertido eh: \'"+inverterTexto()+"\'"); } } }
[ "lucas_diniz_costa@hotmail.com" ]
lucas_diniz_costa@hotmail.com
fabde8aebbb534f90b96427f48751d024285e0c8
aaab2bf041403c1e4086b47e902d4cb26eacf4c9
/app/src/main/java/com/example/hopjs/filmcinema/UI/Fragment/SidebarFragment.java
ff93a8f8518cad015bf8407a4c0b19f12efdf611
[]
no_license
coomia/FilmCinema
b79c1e2373de8848de0b4b71888d98e9a28f3586
399e12c1e225e66403e43a41b9d92a515bc84646
refs/heads/master
2021-01-21T08:54:30.126892
2017-01-18T05:59:53
2017-01-18T05:59:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,561
java
package com.example.hopjs.filmcinema.UI.Fragment; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.DrawerLayout; import android.support.v7.widget.CardView; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.hopjs.filmcinema.Common.Transform; import com.example.hopjs.filmcinema.Data.UserAccount; import com.example.hopjs.filmcinema.MyApplication; import com.example.hopjs.filmcinema.Network.Connect; import com.example.hopjs.filmcinema.R; import com.example.hopjs.filmcinema.Test.Test; import com.example.hopjs.filmcinema.UI.Login; /** * Created by Hopjs on 2016/10/14. */ public class SidebarFragment extends Fragment { private LinearLayout llHpager,llFilm,llCinema,llQuestion,llHelp,llAbout,llExit; private CardView cvPortrait; private ImageView ivPortrait; private TextView tvNorT; private UserAccount userAccount; private Handler handler=new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); loadUserInfor(); } }; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.sidebar,container,true); tvNorT = (TextView)view.findViewById(R.id.tv_sidebar_nameortips); ivPortrait = (ImageView)view.findViewById(R.id.iv_sidebar_portrait); cvPortrait = (CardView)view.findViewById(R.id.cv_sidebar_card); llAbout = (LinearLayout)view.findViewById(R.id.ll_sidebar_about); llCinema = (LinearLayout)view.findViewById(R.id.ll_sidebar_cinema); llFilm = (LinearLayout)view.findViewById(R.id.ll_sidebar_film); llHelp = (LinearLayout)view.findViewById(R.id.ll_sidebar_help); llHpager = (LinearLayout)view.findViewById(R.id.ll_sidebar_hpager); llQuestion = (LinearLayout)view.findViewById(R.id.ll_sidebar_question); llExit = (LinearLayout)view.findViewById(R.id.ll_sidebar_exit); cvPortrait.setOnClickListener(listener); llQuestion.setOnClickListener(listener); llHpager.setOnClickListener(listener); llHelp.setOnClickListener(listener); llFilm.setOnClickListener(listener); llAbout.setOnClickListener(listener); llCinema.setOnClickListener(listener); llExit.setOnClickListener(listener); view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); loadUserInfor(); return view; } public void loadUserInfor(){ userAccount = ((MyApplication)getActivity().getApplicationContext()).userAccount; if(userAccount.isLogin()){ Connect.TemUrl temUrl = new Connect.TemUrl(); temUrl.setConnectionType(Connect.NETWORK_PORTRAIT); temUrl.addHeader("portraitName","Portraits/"+userAccount.getPortraitName()); Glide.with(getContext()) .load(temUrl.getSurl()) .error(R.drawable.userportrait) .into(ivPortrait); tvNorT.setText(userAccount.getName()); llExit.setVisibility(View.VISIBLE); }else { Glide.with(getContext()) .load(R.drawable.userportrait) .into(ivPortrait); tvNorT.setText("登 录"); llExit.setVisibility(View.INVISIBLE); } } View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()){ case R.id.ll_sidebar_cinema: Transform.toCinema(getActivity()); break; case R.id.ll_sidebar_about: Transform.toAbout(getActivity()); break; case R.id.ll_sidebar_film: Transform.toFilm(getActivity()); break; case R.id.ll_sidebar_help: Transform.toHelp(getActivity()); break; case R.id.ll_sidebar_hpager: Transform.toHomePage(getActivity()); break; case R.id.ll_sidebar_question: Transform.toQuestion(getActivity()); break; case R.id.cv_sidebar_card: if(userAccount.isLogin()){ Transform.toPcenter(getActivity()); }else { Login login = new Login(getActivity(),handler,0);//getContext(), login.show(); } break; case R.id.ll_sidebar_exit: ((MyApplication)getActivity().getApplicationContext()). userAccount.setLogin(false); loadUserInfor(); llExit.setVisibility(View.INVISIBLE); break; } } }; }
[ "pingdengjia0liu@163.com" ]
pingdengjia0liu@163.com
f1540c1c9a121cefa690865f132d2cff211cac70
3a35094b72f439fbc8a62b087a2a88c3b406c37c
/src/main/java/org/docx4j/model/styles/StyleUtil.java
71128193e6790786aca9eb06c181fdce91f33619
[ "Apache-2.0" ]
permissive
gatesy/docx4j
9b71a8992e688a1e97a40f494d20d6ebc3dc2f7e
6793b395f2d0b9ae4562946c087edf2eb3fb4a20
refs/heads/master
2021-01-17T10:44:53.870340
2014-07-23T16:49:50
2014-07-23T16:49:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
102,960
java
/* Licensed to Plutext Pty Ltd under one or more contributor license agreements. * This file is part of docx4j. docx4j is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.docx4j.model.styles; import java.math.BigInteger; import java.util.List; import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; import org.docx4j.XmlUtils; import org.docx4j.jaxb.Context; import org.docx4j.sharedtypes.STOnOff; import org.docx4j.wml.BooleanDefaultTrue; import org.docx4j.wml.CTBorder; import org.docx4j.wml.CTCnf; import org.docx4j.wml.CTEm; import org.docx4j.wml.CTFramePr; import org.docx4j.wml.CTHeight; import org.docx4j.wml.CTLanguage; import org.docx4j.wml.CTShd; import org.docx4j.wml.CTShortHexNumber; import org.docx4j.wml.CTSignedHpsMeasure; import org.docx4j.wml.CTSignedTwipsMeasure; import org.docx4j.wml.CTTabStop; import org.docx4j.wml.CTTblCellMar; import org.docx4j.wml.CTTblLayoutType; import org.docx4j.wml.CTTblLook; import org.docx4j.wml.CTTblOverlap; import org.docx4j.wml.CTTblPPr; import org.docx4j.wml.CTTblPrBase; import org.docx4j.wml.CTTblPrBase.TblStyle; import org.docx4j.wml.CTTblPrBase.TblStyleColBandSize; import org.docx4j.wml.CTTblPrBase.TblStyleRowBandSize; import org.docx4j.wml.CTTblStylePr; import org.docx4j.wml.CTTextEffect; import org.docx4j.wml.CTTextScale; import org.docx4j.wml.CTTextboxTightWrap; import org.docx4j.wml.CTTrPrBase.GridAfter; import org.docx4j.wml.CTTrPrBase.GridBefore; import org.docx4j.wml.CTVerticalAlignRun; import org.docx4j.wml.CTVerticalJc; import org.docx4j.wml.Color; import org.docx4j.wml.Highlight; import org.docx4j.wml.HpsMeasure; import org.docx4j.wml.Jc; import org.docx4j.wml.PPr; import org.docx4j.wml.PPrBase; import org.docx4j.wml.PPrBase.Ind; import org.docx4j.wml.PPrBase.NumPr; import org.docx4j.wml.PPrBase.OutlineLvl; import org.docx4j.wml.PPrBase.PBdr; import org.docx4j.wml.PPrBase.PStyle; import org.docx4j.wml.PPrBase.Spacing; import org.docx4j.wml.PPrBase.TextAlignment; import org.docx4j.wml.ParaRPr; import org.docx4j.wml.RFonts; import org.docx4j.wml.RPr; import org.docx4j.wml.RStyle; import org.docx4j.wml.STBorder; import org.docx4j.wml.STDropCap; import org.docx4j.wml.STEm; import org.docx4j.wml.STHAnchor; import org.docx4j.wml.STHeightRule; import org.docx4j.wml.STHint; import org.docx4j.wml.STShd; import org.docx4j.wml.STTblLayoutType; import org.docx4j.wml.STTblOverlap; import org.docx4j.wml.STTblStyleOverrideType; import org.docx4j.wml.STTextEffect; import org.docx4j.wml.STTheme; import org.docx4j.wml.STThemeColor; import org.docx4j.wml.STVAnchor; import org.docx4j.wml.STVerticalAlignRun; import org.docx4j.wml.STVerticalJc; import org.docx4j.wml.STWrap; import org.docx4j.wml.STXAlign; import org.docx4j.wml.STYAlign; import org.docx4j.wml.Style; import org.docx4j.wml.Style.BasedOn; import org.docx4j.wml.Tabs; import org.docx4j.wml.TblBorders; import org.docx4j.wml.TblWidth; import org.docx4j.wml.TcMar; import org.docx4j.wml.TcPr; import org.docx4j.wml.TcPrInner.GridSpan; import org.docx4j.wml.TcPrInner.HMerge; import org.docx4j.wml.TcPrInner.TcBorders; import org.docx4j.wml.TcPrInner.VMerge; import org.docx4j.wml.TextDirection; import org.docx4j.wml.TrPr; import org.docx4j.wml.U; import org.docx4j.wml.UnderlineEnumeration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /* * @author Alberto Zerolo * @since 3.0.0 * */ public class StyleUtil { protected static Logger log = LoggerFactory.getLogger(StyleUtil.class); public static final String CHARACTER_STYLE = "character"; public static final String PARAGRAPH_STYLE = "paragraph"; public static final String TABLE_STYLE = "table"; public static final String NUMBERING_STYLE = "numbering"; ///////////////////////////////////////////// // areEqual-Methods ///////////////////////////////////////////// public static boolean areEqual(Style style1, Style style2, boolean compareIDs) { if (style1 == style2) return true; if (((style1 != null) && (style2 == null)) || ((style1 == null) && (style2 != null))) return false; if ((compareIDs && (!areEqual(style1.getStyleId(), style2.getStyleId()))) || (!areEqual(style1.getType(), style2.getType()))) { return false; } if (CHARACTER_STYLE.equals(style1.getType())) { return areEqual(style1.getBasedOn(), style2.getBasedOn()) && areEqual(style1.getRPr(), style2.getRPr()); } else if (PARAGRAPH_STYLE.equals(style1.getType()) || NUMBERING_STYLE.equals(style1.getType())) { return areEqual(style1.getBasedOn(), style2.getBasedOn()) && areEqual(style1.getRPr(), style2.getRPr()) && areEqual(style1.getPPr(), style2.getPPr()); } else if (TABLE_STYLE.equals(style1.getType())) { return areEqual(style1.getBasedOn(), style2.getBasedOn()) && areEqual(style1.getTblPr(), style2.getTblPr()) && areEqual(style1.getTcPr(), style2.getTcPr()) && areEqual(style1.getTblStylePr(), style2.getTblStylePr()); } throw new IllegalArgumentException("Invalid style type: " + style1.getType()); } public static boolean areEqual(PPr pPr1, PPr pPr2) { return (pPr1 == pPr2) || ((pPr1 != null) && (pPr2 != null) && areEqual((PPrBase)pPr1, (PPrBase)pPr2) && areEqual(pPr1.getRPr(), pPr2.getRPr()) ); } public static boolean areEqual(PPrBase pPrBase1, PPrBase pPrBase2) { return (pPrBase1 == pPrBase2) || ( (pPrBase1 != null) && (pPrBase2 != null) && areEqual(pPrBase1.getPStyle(), pPrBase2.getPStyle()) && areEqual(pPrBase1.getKeepNext(), pPrBase2.getKeepNext()) && areEqual(pPrBase1.getKeepLines(), pPrBase2.getKeepLines()) && areEqual(pPrBase1.getPageBreakBefore(), pPrBase2.getPageBreakBefore()) && areEqual(pPrBase1.getFramePr(), pPrBase2.getFramePr()) && areEqual(pPrBase1.getWidowControl(), pPrBase2.getWidowControl()) && areEqual(pPrBase1.getNumPr(), pPrBase2.getNumPr()) && areEqual(pPrBase1.getSuppressLineNumbers(), pPrBase2.getSuppressLineNumbers()) && areEqual(pPrBase1.getPBdr(), pPrBase2.getPBdr()) && areEqual(pPrBase1.getShd(), pPrBase2.getShd()) && areEqual(pPrBase1.getTabs(), pPrBase2.getTabs()) && areEqual(pPrBase1.getSuppressAutoHyphens(), pPrBase2.getSuppressAutoHyphens()) && areEqual(pPrBase1.getKinsoku(), pPrBase2.getKinsoku()) && areEqual(pPrBase1.getWordWrap(), pPrBase2.getWordWrap()) && areEqual(pPrBase1.getOverflowPunct(), pPrBase2.getOverflowPunct()) && areEqual(pPrBase1.getTopLinePunct(), pPrBase2.getTopLinePunct()) && areEqual(pPrBase1.getAutoSpaceDE(), pPrBase2.getAutoSpaceDE()) && areEqual(pPrBase1.getAutoSpaceDN(), pPrBase2.getAutoSpaceDN()) && areEqual(pPrBase1.getBidi(), pPrBase2.getBidi()) && areEqual(pPrBase1.getAdjustRightInd(), pPrBase2.getAdjustRightInd()) && areEqual(pPrBase1.getSnapToGrid(), pPrBase2.getSnapToGrid()) && areEqual(pPrBase1.getSpacing(), pPrBase2.getSpacing()) && areEqual(pPrBase1.getInd(), pPrBase2.getInd()) && areEqual(pPrBase1.getContextualSpacing(), pPrBase2.getContextualSpacing()) && areEqual(pPrBase1.getMirrorIndents(), pPrBase2.getMirrorIndents()) && areEqual(pPrBase1.getSuppressOverlap(), pPrBase2.getSuppressOverlap()) && areEqual(pPrBase1.getJc(), pPrBase2.getJc()) && areEqual(pPrBase1.getTextDirection(), pPrBase2.getTextDirection()) && areEqual(pPrBase1.getTextAlignment(), pPrBase2.getTextAlignment()) && areEqual(pPrBase1.getTextboxTightWrap(), pPrBase2.getTextboxTightWrap()) && areEqual(pPrBase1.getOutlineLvl(), pPrBase2.getOutlineLvl()) && areEqual(pPrBase1.getCnfStyle(), pPrBase2.getCnfStyle()) ); } public static boolean areEqual(RPr rPr1, RPr rPr2) { return ((rPr1 == rPr2) || ((rPr1 != null) && (rPr2 != null) && areEqual(rPr1.getRStyle(), rPr2.getRStyle()) && areEqual(rPr1.getRFonts(), rPr2.getRFonts()) && areEqual(rPr1.getB(), rPr2.getB()) && areEqual(rPr1.getBCs(), rPr2.getBCs()) && areEqual(rPr1.getI(), rPr2.getI()) && areEqual(rPr1.getICs(), rPr2.getICs()) && areEqual(rPr1.getCaps(), rPr2.getCaps()) && areEqual(rPr1.getSmallCaps(), rPr2.getSmallCaps()) && areEqual(rPr1.getStrike(), rPr2.getStrike()) && areEqual(rPr1.getDstrike(), rPr2.getDstrike()) && areEqual(rPr1.getOutline(), rPr2.getOutline()) && areEqual(rPr1.getShadow(), rPr2.getShadow()) && areEqual(rPr1.getEmboss(), rPr2.getEmboss()) && areEqual(rPr1.getImprint(), rPr2.getImprint()) && areEqual(rPr1.getSnapToGrid(), rPr2.getSnapToGrid()) && areEqual(rPr1.getVanish(), rPr2.getVanish()) && areEqual(rPr1.getColor(), rPr2.getColor()) && areEqual(rPr1.getSpacing(), rPr2.getSpacing()) && areEqual(rPr1.getW(), rPr2.getW()) && areEqual(rPr1.getKern(), rPr2.getKern()) && areEqual(rPr1.getPosition(), rPr2.getPosition()) && areEqual(rPr1.getSz(), rPr2.getSz()) && areEqual(rPr1.getSzCs(), rPr2.getSzCs()) && areEqual(rPr1.getHighlight(), rPr2.getHighlight()) && areEqual(rPr1.getU(), rPr2.getU()) && areEqual(rPr1.getEffect(), rPr2.getEffect()) && areEqual(rPr1.getBdr(), rPr2.getBdr()) && areEqual(rPr1.getShd(), rPr2.getShd()) && areEqual(rPr1.getVertAlign(), rPr2.getVertAlign()) && areEqual(rPr1.getRtl(), rPr2.getRtl()) && areEqual(rPr1.getCs(), rPr2.getCs()) && areEqual(rPr1.getEm(), rPr2.getEm()) && areEqual(rPr1.getSpecVanish(), rPr2.getSpecVanish()) && areEqual(rPr1.getOMath(), rPr2.getOMath()) // rPr1.getLang() ?? ) ); } public static boolean areEqual(ParaRPr rPr1, ParaRPr rPr2) { return ((rPr1 == rPr2) || ((rPr1 != null) && (rPr2 != null) && areEqual(rPr1.getRStyle(), rPr2.getRStyle()) && areEqual(rPr1.getRFonts(), rPr2.getRFonts()) && areEqual(rPr1.getB(), rPr2.getB()) && areEqual(rPr1.getBCs(), rPr2.getBCs()) && areEqual(rPr1.getI(), rPr2.getI()) && areEqual(rPr1.getICs(), rPr2.getICs()) && areEqual(rPr1.getCaps(), rPr2.getCaps()) && areEqual(rPr1.getSmallCaps(), rPr2.getSmallCaps()) && areEqual(rPr1.getStrike(), rPr2.getStrike()) && areEqual(rPr1.getDstrike(), rPr2.getDstrike()) && areEqual(rPr1.getOutline(), rPr2.getOutline()) && areEqual(rPr1.getShadow(), rPr2.getShadow()) && areEqual(rPr1.getEmboss(), rPr2.getEmboss()) && areEqual(rPr1.getImprint(), rPr2.getImprint()) && areEqual(rPr1.getSnapToGrid(), rPr2.getSnapToGrid()) && areEqual(rPr1.getVanish(), rPr2.getVanish()) && areEqual(rPr1.getColor(), rPr2.getColor()) && areEqual(rPr1.getSpacing(), rPr2.getSpacing()) && areEqual(rPr1.getW(), rPr2.getW()) && areEqual(rPr1.getKern(), rPr2.getKern()) && areEqual(rPr1.getPosition(), rPr2.getPosition()) && areEqual(rPr1.getSz(), rPr2.getSz()) && areEqual(rPr1.getSzCs(), rPr2.getSzCs()) && areEqual(rPr1.getHighlight(), rPr2.getHighlight()) && areEqual(rPr1.getU(), rPr2.getU()) && areEqual(rPr1.getEffect(), rPr2.getEffect()) && areEqual(rPr1.getBdr(), rPr2.getBdr()) && areEqual(rPr1.getShd(), rPr2.getShd()) && areEqual(rPr1.getVertAlign(), rPr2.getVertAlign()) && areEqual(rPr1.getRtl(), rPr2.getRtl()) && areEqual(rPr1.getCs(), rPr2.getCs()) && areEqual(rPr1.getEm(), rPr2.getEm()) && areEqual(rPr1.getSpecVanish(), rPr2.getSpecVanish()) && areEqual(rPr1.getOMath(), rPr2.getOMath()) ) ); } public static boolean areEqual(CTTblPrBase tblPr1, CTTblPrBase tblPr2) { return ((tblPr1 == tblPr2) || ((tblPr1 != null) && (tblPr2 != null) && areEqual(tblPr1.getTblStyle(), tblPr2.getTblStyle()) && areEqual(tblPr1.getTblpPr(), tblPr2.getTblpPr()) && areEqual(tblPr1.getTblOverlap(), tblPr2.getTblOverlap()) && areEqual(tblPr1.getTblStyleRowBandSize(), tblPr2.getTblStyleRowBandSize()) && areEqual(tblPr1.getTblStyleColBandSize(), tblPr2.getTblStyleColBandSize()) && areEqual(tblPr1.getTblW(), tblPr2.getTblW()) && areEqual(tblPr1.getJc(), tblPr2.getJc()) && areEqual(tblPr1.getTblCellSpacing(), tblPr2.getTblCellSpacing()) && areEqual(tblPr1.getTblInd(), tblPr2.getTblInd()) && areEqual(tblPr1.getTblBorders(), tblPr2.getTblBorders()) && areEqual(tblPr1.getShd(), tblPr2.getShd()) && areEqual(tblPr1.getTblLayout(), tblPr2.getTblLayout()) && areEqual(tblPr1.getTblCellMar(), tblPr2.getTblCellMar()) && areEqual(tblPr1.getTblLook(), tblPr2.getTblLook()) ) ); } public static boolean areEqual(CTTblLook tblLook1, CTTblLook tblLook2) { return ((tblLook1 == tblLook2) || ((tblLook1 !=null) && (tblLook2 !=null) && areEqual(tblLook1.getVal(), tblLook2.getVal()) && areEqual(tblLook1.getFirstColumn(), tblLook2.getFirstColumn()) && areEqual(tblLook1.getFirstRow(), tblLook2.getFirstRow()) && areEqual(tblLook1.getLastColumn(), tblLook2.getLastColumn()) && areEqual(tblLook1.getLastRow(), tblLook2.getLastRow()) && areEqual(tblLook1.getNoHBand(), tblLook2.getNoHBand()) && areEqual(tblLook1.getNoVBand(), tblLook2.getNoVBand()) ) ); } private static boolean areEqual(STOnOff oo1, STOnOff oo2) { return (oo1 == oo2); } public static boolean areEqual(TcPr tcPr1, TcPr tcPr2) { return ((tcPr1 == tcPr2) || ((tcPr1 != null) && (tcPr2 != null) && areEqual(tcPr1.getCnfStyle(), tcPr2.getCnfStyle()) && areEqual(tcPr1.getTcW(), tcPr2.getTcW()) && areEqual(tcPr1.getGridSpan(), tcPr2.getGridSpan()) && areEqual(tcPr1.getHMerge(), tcPr2.getHMerge()) && areEqual(tcPr1.getVMerge(), tcPr2.getVMerge()) && areEqual(tcPr1.getTcBorders(), tcPr2.getTcBorders()) && areEqual(tcPr1.getShd(), tcPr2.getShd()) && areEqual(tcPr1.getNoWrap(), tcPr2.getNoWrap()) && areEqual(tcPr1.getTcMar(), tcPr2.getTcMar()) && areEqual(tcPr1.getTextDirection(), tcPr2.getTextDirection()) && areEqual(tcPr1.getTcFitText(), tcPr2.getTcFitText()) && areEqual(tcPr1.getVAlign(), tcPr2.getVAlign()) && areEqual(tcPr1.getHideMark(), tcPr2.getHideMark()) ) ); } public static boolean areEqual(List<CTTblStylePr> tblStylePrList1, List<CTTblStylePr> tblStylePrList2) { if (tblStylePrList1 == tblStylePrList2) return true; if (((tblStylePrList1 == null) && (tblStylePrList2 != null)) || ((tblStylePrList1 != null) && (tblStylePrList2 == null))) return false; if (tblStylePrList1.size() != tblStylePrList2.size()) return false; for (int i=0; i<tblStylePrList1.size(); i++) if (!areEqual(tblStylePrList1.get(i), tblStylePrList2.get(i))) return false; return true; } public static boolean areEqual(CTTblStylePr ctTblStylePr1, CTTblStylePr ctTblStylePr2) { return ((ctTblStylePr1 == ctTblStylePr2) || ((ctTblStylePr1 != null) && (ctTblStylePr2 != null) && areEqual(ctTblStylePr1.getPPr(), ctTblStylePr2.getPPr()) && areEqual(ctTblStylePr1.getRPr(), ctTblStylePr2.getRPr()) && areEqual(ctTblStylePr1.getTblPr(), ctTblStylePr2.getTblPr()) && areEqual(ctTblStylePr1.getTrPr(), ctTblStylePr2.getTrPr()) && areEqual(ctTblStylePr1.getType(), ctTblStylePr2.getType()) ) ); } public static boolean areEqual(OutlineLvl outlineLvl1, OutlineLvl outlineLvl2) { return (outlineLvl1 == outlineLvl2) || ((outlineLvl1 != null) && (outlineLvl2 != null) && areEqual(outlineLvl1.getVal(), outlineLvl2.getVal())); } public static boolean areEqual(CTTextboxTightWrap textboxTightWrap1, CTTextboxTightWrap textboxTightWrap2) { return (textboxTightWrap1 == textboxTightWrap2) || ((textboxTightWrap1 != null) && (textboxTightWrap2 != null) && ((textboxTightWrap1.getVal() == textboxTightWrap2.getVal()) || ((textboxTightWrap1.getVal() != null) && (textboxTightWrap1.getVal().equals(textboxTightWrap2.getVal())) ) ) ); } public static boolean areEqual(TextAlignment textAlignment1, TextAlignment textAlignment2) { return (textAlignment1 == textAlignment2) || ((textAlignment1 != null) && (textAlignment2 != null) && ((textAlignment1.getVal() == textAlignment2.getVal()) || ((textAlignment1.getVal() != null) && (textAlignment1.getVal().equals(textAlignment2.getVal())) ) ) ); } public static boolean areEqual(TextDirection textDirection1, TextDirection textDirection2) { return (textDirection1 == textDirection2) || ((textDirection1 != null) && (textDirection2 != null) && areEqual(textDirection1.getVal(), textDirection2.getVal())); } public static boolean areEqual(Jc jc1, Jc jc2) { return (jc1 == jc2) || ((jc1 != null) && (jc2 != null) && ((jc1.getVal() == jc2.getVal()) || ((jc1.getVal() != null) && (jc1.getVal().equals(jc2.getVal())) ) ) ); } public static boolean areEqual(Ind ind1, Ind ind2) { return ((ind1 == ind2) || ((ind1 != null) && (ind2 != null) && areEqual(ind1.getFirstLine(), ind2.getFirstLine()) && areEqual(ind1.getFirstLineChars(), ind2.getFirstLineChars()) && areEqual(ind1.getHanging(), ind2.getHanging()) && areEqual(ind1.getHangingChars(), ind2.getHangingChars()) && areEqual(ind1.getLeft(), ind2.getLeft()) && areEqual(ind1.getLeftChars(), ind2.getLeftChars()) && areEqual(ind1.getRight(), ind2.getRight()) && areEqual(ind1.getRightChars(), ind2.getRightChars()) ) ); } public static boolean areEqual(Spacing spacing1, Spacing spacing2) { return ((spacing1 == spacing2) || ((spacing1 != null) && (spacing2 != null) && areEqual(spacing1.getAfter(), spacing2.getAfter()) && areEqual(spacing1.getAfterLines(), spacing2.getAfterLines()) && areEqual(spacing1.getBefore(), spacing2.getBefore()) && areEqual(spacing1.getBeforeLines(), spacing2.getBeforeLines()) && areEqual(spacing1.getLine(), spacing2.getLine()) && ((spacing1.getLineRule() == spacing2.getLineRule()) || ((spacing1.getLineRule() != null) && (spacing1.getLineRule().equals(spacing2.getLineRule())))) ) ); } public static boolean areEqual(Tabs tabs1, Tabs tabs2) { if (tabs1 == tabs2) return true; if (((tabs1 != null) && (tabs2 == null)) || ((tabs1 == null) && (tabs2 != null))) return false; if (tabs1.getTab() == tabs2.getTab()) return true; if (tabs1.getTab().size() != tabs2.getTab().size()) return false; for (int i=0; i<tabs1.getTab().size(); i++) if (!areEqual(tabs1.getTab().get(i), tabs2.getTab().get(i))) return false; return true; } public static boolean areEqual(CTTabStop ctTabStop1, CTTabStop ctTabStop2) { return ((ctTabStop1 == ctTabStop2) || ((ctTabStop1 != null) && (ctTabStop2 != null) && areEqual(ctTabStop1.getPos(), ctTabStop2.getPos()) && ((ctTabStop1.getVal() == ctTabStop2.getVal()) || ((ctTabStop1.getVal() != null) && (ctTabStop1.getVal().equals(ctTabStop2.getVal())))) && ((ctTabStop1.getLeader() == ctTabStop2.getLeader()) || ((ctTabStop1.getLeader() != null) && (ctTabStop1.getLeader().equals(ctTabStop2.getLeader())))) ) ); } public static boolean areEqual(CTShd shd1, CTShd shd2) { return ((shd1 == shd2) || ((shd1 != null) && (shd2 != null) && areEqual(shd1.getColor(), shd2.getColor()) && areEqual(shd1.getThemeTint(), shd2.getThemeTint()) && areEqual(shd1.getThemeShade(), shd2.getThemeShade()) && areEqual(shd1.getFill(), shd2.getFill()) && areEqual(shd1.getThemeFillTint(), shd2.getThemeFillTint()) && areEqual(shd1.getThemeFillShade(), shd2.getThemeFillShade()) && areEqual(shd1.getThemeColor(), shd2.getThemeColor()) && areEqual(shd1.getThemeFill(), shd2.getThemeFill()) && ((shd1.getVal() == shd2.getVal()) || ((shd1.getVal() != null) && (shd1.getVal().equals(shd2.getVal())))) ) ); } public static boolean areEqual(PBdr pBdr1, PBdr pBdr2) { return ((pBdr1 == pBdr2) || ((pBdr1 != null) && (pBdr2 != null) && areEqual(pBdr1.getTop(), pBdr2.getTop()) && areEqual(pBdr1.getLeft(), pBdr2.getLeft()) && areEqual(pBdr1.getBottom(), pBdr2.getBottom()) && areEqual(pBdr1.getRight(), pBdr2.getRight()) && areEqual(pBdr1.getBetween(), pBdr2.getBetween()) && areEqual(pBdr1.getBar(), pBdr2.getBar()) ) ); } public static boolean areEqual(CTBorder border1, CTBorder border2) { return ((border1 == border2) || ((border1 != null) && (border2 != null) && areEqual(border1.getColor(), border2.getColor()) && areEqual(border1.getSpace(), border2.getSpace()) && areEqual(border1.getSz(), border2.getSz()) && areEqual(border1.getThemeColor(), border2.getThemeColor()) && areEqual(border1.getThemeShade(), border2.getThemeShade()) && areEqual(border1.getThemeTint(), border2.getThemeTint()) && ((border1.getVal() == border2.getVal()) || ((border1.getVal() != null) && (border1.getVal().equals(border2.getVal())))) ) ); } public static boolean areEqual(NumPr numPr1, NumPr numPr2) { // Comparing the numbering format would require looking into the // numbering definitions part, for this reason only the id is // checked return ((numPr1 == numPr2) || ((numPr1 != null) && (numPr2 != null) && ((numPr1.getNumId() == numPr2.getNumId()) || ((numPr1.getNumId() != null) && (numPr2.getNumId() != null) && areEqual(numPr1.getNumId().getVal(), numPr2.getNumId().getVal())) ) ) ); } public static boolean areEqual(CTFramePr framePr1, CTFramePr framePr2) { return ((framePr1 == framePr2) || ((framePr1 != null) && (framePr2 != null) && areEqual(framePr1.getDropCap(), framePr2.getDropCap()) && areEqual(framePr1.getLines(), framePr2.getLines()) && areEqual(framePr1.getW(), framePr2.getW()) && areEqual(framePr1.getH(), framePr2.getH()) && areEqual(framePr1.getVSpace(), framePr2.getVSpace()) && areEqual(framePr1.getHSpace(), framePr2.getHSpace()) && areEqual(framePr1.getWrap(), framePr2.getWrap()) && areEqual(framePr1.getHAnchor(), framePr2.getHAnchor()) && areEqual(framePr1.getVAnchor(), framePr2.getVAnchor()) && areEqual(framePr1.getX(), framePr2.getX()) && areEqual(framePr1.getXAlign(), framePr2.getXAlign()) && areEqual(framePr1.getY(), framePr2.getY()) && areEqual(framePr1.getYAlign(), framePr2.getYAlign()) && areEqual(framePr1.getHRule(), framePr2.getHRule()) && (framePr1.isAnchorLock() == framePr2.isAnchorLock()) ) ); } public static boolean areEqual(CTCnf cnfStyle1, CTCnf cnfStyle2) { return (cnfStyle1 == cnfStyle2) || ((cnfStyle1 != null) && (cnfStyle2 != null) && areEqual(cnfStyle1.getVal(), cnfStyle2.getVal()) ); } public static boolean areEqual(STHeightRule hRule1, STHeightRule hRule2) { return (hRule1 == hRule2) || ((hRule1 != null) && (hRule1.equals(hRule2))); } public static boolean areEqual(STYAlign yAlign1, STYAlign yAlign2) { return (yAlign1 == yAlign2) || ((yAlign1 != null) && (yAlign1.equals(yAlign2))); } public static boolean areEqual(STXAlign xAlign1, STXAlign xAlign2) { return (xAlign1 == xAlign2) || ((xAlign1 != null) && (xAlign1.equals(xAlign2))); } public static boolean areEqual(STVAnchor vAnchor1, STVAnchor vAnchor2) { return (vAnchor1 == vAnchor2) || ((vAnchor1 != null) && (vAnchor1.equals(vAnchor2))); } public static boolean areEqual(STHAnchor hAnchor1, STHAnchor hAnchor2) { return (hAnchor1 == hAnchor2) || ((hAnchor1 != null) && (hAnchor1.equals(hAnchor2))); } public static boolean areEqual(STWrap wrap1, STWrap wrap2) { return (wrap1 == wrap2) || ((wrap1 != null) && (wrap1.equals(wrap2))); } public static boolean areEqual(STDropCap dropCap1, STDropCap dropCap2) { return (dropCap1 == dropCap2) || ((dropCap1 != null) && (dropCap1.equals(dropCap2))); } public static boolean areEqual(PStyle pStyle1, PStyle pStyle2) { return (pStyle1 == pStyle2) || ((pStyle1 != null) && (pStyle2 != null) && areEqual(pStyle1.getVal(), pStyle2.getVal())); } public static boolean areEqual(BasedOn basedOn1, BasedOn basedOn2) { return (basedOn1 == basedOn2) || ((basedOn1 != null) && (basedOn2 != null) && areEqual(basedOn1.getVal(), basedOn2.getVal())); } public static boolean areEqual(RFonts rFonts1, RFonts rFonts2) { //Comparing the ascii version should be enough in most cases return (rFonts1 == rFonts2) || ((rFonts1 != null) && (rFonts2 != null) && (areEqual(rFonts1.getAscii(), rFonts2.getAscii())) ); } public static boolean areEqual(RStyle rStyle1, RStyle rStyle2) { return (rStyle1 == rStyle2) || ((rStyle1 != null) && (rStyle2 != null) && (areEqual(rStyle1.getVal(), rStyle2.getVal())) ); } public static boolean areEqual(CTEm em1, CTEm em2) { return (em1 == em2) || ((em1 != null) && (em2 != null) && (areEqual(em1.getVal(), em2.getVal())) ); } public static boolean areEqual(CTVerticalAlignRun vertAlign1, CTVerticalAlignRun vertAlign2) { return (vertAlign1 == vertAlign2) || ((vertAlign1 != null) && (vertAlign2 != null) && (areEqual(vertAlign1.getVal(), vertAlign2.getVal())) ); } public static boolean areEqual(CTTextEffect effect1, CTTextEffect effect2) { return (effect1 == effect2) || ((effect1 != null) && (effect2 != null) && (areEqual(effect1.getVal(), effect2.getVal())) ); } public static boolean areEqual(U u1, U u2) { return (u1 == u2) || ((u1 != null) && (u2 != null) && areEqual(u1.getVal(), u2.getVal()) && areEqual(u1.getColor(), u2.getColor()) ); } public static boolean areEqual(Highlight highlight1, Highlight highlight2) { return (highlight1 == highlight2) || ((highlight1 != null) && (highlight2 != null) && (areEqual(highlight1.getVal(), highlight2.getVal())) ); } public static boolean areEqual(CTSignedHpsMeasure measure1, CTSignedHpsMeasure measure2) { return (measure1 == measure2) || ((measure1 != null) && (measure2 != null) && (areEqual(measure1.getVal(), measure2.getVal())) ); } public static boolean areEqual(HpsMeasure measure1, HpsMeasure measure2) { return (measure1 == measure2) || ((measure1 != null) && (measure2 != null) && (areEqual(measure1.getVal(), measure2.getVal())) ); } public static boolean areEqual(CTTextScale scale1, CTTextScale scale2) { return (scale1 == scale2) || ((scale1 != null) && (scale2 != null) && (areEqual(scale1.getVal(), scale2.getVal())) ); } public static boolean areEqual(CTSignedTwipsMeasure measure1, CTSignedTwipsMeasure measure2) { return (measure1 == measure2) || ((measure1 != null) && (measure2 != null) && (areEqual(measure1.getVal(), measure2.getVal())) ); } public static boolean areEqual(Color color1, Color color2) { return (color1 == color2) || ((color1 != null) && (color2 != null) && (areEqual(color1.getVal(), color2.getVal())) ); } public static boolean areEqual(CTTblLayoutType tblLayout1, CTTblLayoutType tblLayout2) { return (tblLayout1 == tblLayout2) || ((tblLayout1 != null) && (tblLayout2 != null) && (areEqual(tblLayout1.getType(), tblLayout2.getType())) ); } public static boolean areEqual(CTTblCellMar margin1, CTTblCellMar margin2) { return (margin1 == margin2) || ((margin1 != null) && (margin2 != null) && areEqual(margin1.getBottom(), margin2.getBottom()) && areEqual(margin1.getLeft(), margin2.getLeft()) && areEqual(margin1.getRight(), margin2.getRight()) && areEqual(margin1.getTop(), margin2.getTop()) ); } public static boolean areEqual(TblBorders borders1, TblBorders borders2) { return (borders1 == borders2) || ((borders1 != null) && (borders2 != null) && areEqual(borders1.getBottom(), borders2.getBottom()) && areEqual(borders1.getLeft(), borders2.getLeft()) && areEqual(borders1.getRight(), borders2.getRight()) && areEqual(borders1.getTop(), borders2.getTop()) && areEqual(borders1.getInsideH(), borders2.getInsideH()) && areEqual(borders1.getInsideV(), borders2.getInsideV()) ); } public static boolean areEqual(TblStyleColBandSize bandSize1, TblStyleColBandSize bandSize2) { return (bandSize1 == bandSize2) || ((bandSize1 != null) && (bandSize2 != null) && areEqual(bandSize1.getVal(), bandSize2.getVal()) ); } public static boolean areEqual(TblStyleRowBandSize bandSize1, TblStyleRowBandSize bandSize2) { return (bandSize1 == bandSize2) || ((bandSize1 != null) && (bandSize2 != null) && areEqual(bandSize1.getVal(), bandSize2.getVal()) ); } public static boolean areEqual(CTTblOverlap overlap1, CTTblOverlap overlap2) { return (overlap1 == overlap2) || ((overlap1 != null) && (overlap2 != null) && areEqual(overlap1.getVal(), overlap2.getVal()) ); } public static boolean areEqual(CTTblPPr tblpPr1, CTTblPPr tblpPr2) { return (tblpPr1 == tblpPr2) || ((tblpPr1 != null) && (tblpPr2 != null) && areEqual(tblpPr1.getLeftFromText(), tblpPr2.getLeftFromText()) && areEqual(tblpPr1.getRightFromText(), tblpPr2.getRightFromText()) && areEqual(tblpPr1.getTopFromText(), tblpPr2.getTopFromText()) && areEqual(tblpPr1.getBottomFromText(), tblpPr2.getBottomFromText()) && areEqual(tblpPr1.getVertAnchor(), tblpPr2.getVertAnchor()) && areEqual(tblpPr1.getHorzAnchor(), tblpPr2.getHorzAnchor()) && areEqual(tblpPr1.getTblpXSpec(), tblpPr2.getTblpXSpec()) && areEqual(tblpPr1.getTblpX(), tblpPr2.getTblpX()) && areEqual(tblpPr1.getTblpYSpec(), tblpPr2.getTblpYSpec()) && areEqual(tblpPr1.getTblpY(), tblpPr2.getTblpY()) ); } public static boolean areEqual(TblStyle style1, TblStyle style2) { return (style1 == style2) || ((style1 != null) && (style2 != null) && areEqual(style1.getVal(), style2.getVal()) ); } public static boolean areEqual(CTVerticalJc vAlign1, CTVerticalJc vAlign2) { return (vAlign1 == vAlign2) || ((vAlign1 != null) && (vAlign2 != null) && areEqual(vAlign1.getVal(), vAlign2.getVal()) ); } public static boolean areEqual(TcMar margin1, TcMar margin2) { return (margin1 == margin2) || ((margin1 != null) && (margin2 != null) && areEqual(margin1.getBottom(), margin2.getBottom()) && areEqual(margin1.getLeft(), margin2.getLeft()) && areEqual(margin1.getRight(), margin2.getRight()) && areEqual(margin1.getTop(), margin2.getTop()) ); } public static boolean areEqual(TcBorders borders1, TcBorders borders2) { return (borders1 == borders2) || ((borders1 != null) && (borders2 != null) && areEqual(borders1.getBottom(), borders2.getBottom()) && areEqual(borders1.getLeft(), borders2.getLeft()) && areEqual(borders1.getRight(), borders2.getRight()) && areEqual(borders1.getTop(), borders2.getTop()) && areEqual(borders1.getInsideH(), borders2.getInsideH()) && areEqual(borders1.getInsideV(), borders2.getInsideV()) && areEqual(borders1.getTl2Br(), borders2.getTl2Br()) && areEqual(borders1.getTr2Bl(), borders2.getTr2Bl()) ); } public static boolean areEqual(VMerge merge1, VMerge merge2) { return (merge1 == merge2) || ((merge1 != null) && (merge2 != null) && areEqual(merge1.getVal(), merge2.getVal()) ); } public static boolean areEqual(HMerge merge1, HMerge merge2) { return (merge1 == merge2) || ((merge1 != null) && (merge2 != null) && areEqual(merge1.getVal(), merge2.getVal()) ); } public static boolean areEqual(GridSpan gridSpan1, GridSpan gridSpan2) { return (gridSpan1 == gridSpan2) || ((gridSpan1 != null) && (gridSpan2 != null) && areEqual(gridSpan1.getVal(), gridSpan2.getVal()) ); } public static boolean areEqual(TrPr trPr1, TrPr trPr2) { List<JAXBElement<?>> defs1 = null; List<JAXBElement<?>> defs2 = null; JAXBElement<?> defs1element = null; Object defs2value = null; QName qName = null; String qNameLocal = null; if (trPr1 == trPr2) return true; if (((trPr1 != null) && (trPr2 == null)) || ((trPr1 == null) && (trPr2 != null))) return false; defs1 = trPr1.getCnfStyleOrDivIdOrGridBefore(); defs2 = trPr2.getCnfStyleOrDivIdOrGridBefore(); if (defs1 == defs2) return true; //getCnfStyleOrDivIdOrGridBefore() is allways != null if (defs1.size() != defs2.size()) return false; if (defs1.isEmpty()) return true; for (int i=0; i<defs1.size(); i++) { defs1element = defs1.get(i); qName = defs1element.getName(); defs2value = findTrValue(defs2, qName); if (defs2value == null) return false; qNameLocal = qName.getLocalPart(); if ("gridAfter".equals(qNameLocal)) { if (!areEqual((GridAfter)defs1element.getValue(), (GridAfter)defs2value)) return false; } else if ("cantSplit".equals(qNameLocal)) { if (!areEqual((BooleanDefaultTrue)defs1element.getValue(), (BooleanDefaultTrue)defs2value)) return false; } else if ("wBefore".equals(qNameLocal)) { if (!areEqual((TblWidth)defs1element.getValue(), (TblWidth)defs2value)) return false; } else if ("jc".equals(qNameLocal)) { if (!areEqual((Jc)defs1element.getValue(), (Jc)defs2value)) return false; } else if ("cnfStyle".equals(qNameLocal)) { if (!areEqual((CTCnf)defs1element.getValue(), (CTCnf)defs2value)) return false; } else if ("gridBefore".equals(qNameLocal)) { if (!areEqual((GridBefore)defs1element.getValue(), (GridBefore)defs2value)) return false; } else if ("hidden".equals(qNameLocal)) { if (!areEqual((BooleanDefaultTrue)defs1element.getValue(), (BooleanDefaultTrue)defs2value)) return false; } else if ("trHeight".equals(qNameLocal)) { if (!areEqual((CTHeight)defs1element.getValue(), (CTHeight)defs2value)) return false; } else if ("wAfter".equals(qNameLocal)) { if (!areEqual((TblWidth)defs1element.getValue(), (TblWidth)defs2value)) return false; } else if ("tblHeader".equals(qNameLocal)) { if (!areEqual((BooleanDefaultTrue)defs1element.getValue(), (BooleanDefaultTrue)defs2value)) return false; } else if ("tblCellSpacing".equals(qNameLocal)) { if (!areEqual((TblWidth)defs1element.getValue(), (TblWidth)defs2value)) return false; } } return true; } private static Object findTrValue(List<JAXBElement<?>> defs, QName qName) { for (int i=0; i<defs.size(); i++) if (qName.equals(defs.get(i).getName())) return defs.get(i).getValue(); return null; } public static boolean areEqual(GridBefore value1, GridBefore value2) { return (value1 == value2) || ((value1 != null) && (value2 != null) && (areEqual(value1.getVal(), value2.getVal())) ); } public static boolean areEqual(GridAfter value1, GridAfter value2) { return (value1 == value2) || ((value1 != null) && (value2 != null) && (areEqual(value1.getVal(), value2.getVal())) ); } public static boolean areEqual(CTHeight height1, CTHeight height2) { return (height1 == height2) || ((height1 != null) && (height2 != null) && areEqual(height1.getVal(), height2.getVal()) && areEqual(height1.getHRule(), height2.getHRule()) ); } public static boolean areEqual(TblWidth width1, TblWidth width2) { return (width1 == width2) || ((width1 != null) && (width2 != null) && areEqual(width1.getW(), width2.getW()) && areEqual(width1.getType(), width2.getType()) ); } public static boolean areEqual(CTShortHexNumber number1, CTShortHexNumber number2) { return (number1 == number2) || ((number1 != null) && (number2 != null) && (areEqual(number1.getVal(), number2.getVal())) ); } public static boolean areEqual(STTblOverlap val1, STTblOverlap val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STTblStyleOverrideType val1, STTblStyleOverrideType val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STTblLayoutType val1, STTblLayoutType val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(UnderlineEnumeration val1, UnderlineEnumeration val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STTextEffect val1, STTextEffect val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STEm val1, STEm val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STVerticalAlignRun val1, STVerticalAlignRun val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STVerticalJc val1, STVerticalJc val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } public static boolean areEqual(STThemeColor themeColor1, STThemeColor themeColor2) { return (themeColor1 == themeColor2) || ((themeColor1 != null) && (themeColor1.equals(themeColor2))); } public static boolean areEqual(BooleanDefaultTrue booleanDefaultTrue1, BooleanDefaultTrue booleanDefaultTrue2) { return (booleanDefaultTrue1 != null ? booleanDefaultTrue1.isVal() : false) == (booleanDefaultTrue2 != null ? booleanDefaultTrue2.isVal() : false); } public static boolean areEqual(Boolean bool1, Boolean bool2) { return (bool1 != null ? bool1.booleanValue() : false) == (bool2 != null ? bool2.booleanValue() : false); } public static boolean areEqual(BigInteger val1, BigInteger val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } protected static boolean areEqual(Integer val1, Integer val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } protected static boolean areEqual(String val1, String val2) { return (val1 == val2) || ((val1 != null) && (val1.equals(val2))); } ///////////////////////////////////////////// //isEmpty-Methods ///////////////////////////////////////////// public static boolean isEmpty(Style style) { if (style == null) return true; if (isEmpty(style.getStyleId())) return true; if (CHARACTER_STYLE.equals(style.getType())) { return isEmpty(style.getRPr()); } else if (PARAGRAPH_STYLE.equals(style.getType()) || NUMBERING_STYLE.equals(style.getType())) { return isEmpty(style.getPPr()) && isEmpty(style.getRPr()); } else if (TABLE_STYLE.equals(style.getType())) { return isEmpty(style.getTblPr()) && isEmpty(style.getTcPr()) && isEmpty(style.getTblStylePr()); } throw new IllegalArgumentException("Invalid style type: " + style.getType()); } public static boolean isEmpty(PPr pPr) { return (pPr == null) || (isEmpty((PPrBase)pPr) && isEmpty(pPr.getRPr()) ); } public static boolean isEmpty(PPrBase pPrBase) { return (pPrBase == null) || ( isEmpty(pPrBase.getPStyle()) && isEmpty(pPrBase.getKeepNext()) && isEmpty(pPrBase.getKeepLines()) && isEmpty(pPrBase.getPageBreakBefore()) && isEmpty(pPrBase.getFramePr()) && isEmpty(pPrBase.getWidowControl()) && isEmpty(pPrBase.getNumPr()) && isEmpty(pPrBase.getSuppressLineNumbers()) && isEmpty(pPrBase.getPBdr()) && isEmpty(pPrBase.getShd()) && isEmpty(pPrBase.getTabs()) && isEmpty(pPrBase.getSuppressAutoHyphens()) && isEmpty(pPrBase.getKinsoku()) && isEmpty(pPrBase.getWordWrap()) && isEmpty(pPrBase.getOverflowPunct()) && isEmpty(pPrBase.getTopLinePunct()) && isEmpty(pPrBase.getAutoSpaceDE()) && isEmpty(pPrBase.getAutoSpaceDN()) && isEmpty(pPrBase.getBidi()) && isEmpty(pPrBase.getAdjustRightInd()) && isEmpty(pPrBase.getSnapToGrid()) && isEmpty(pPrBase.getSpacing()) && isEmpty(pPrBase.getInd()) && isEmpty(pPrBase.getContextualSpacing()) && isEmpty(pPrBase.getMirrorIndents()) && isEmpty(pPrBase.getSuppressOverlap()) && isEmpty(pPrBase.getJc()) && isEmpty(pPrBase.getTextDirection()) && isEmpty(pPrBase.getTextAlignment()) && isEmpty(pPrBase.getTextboxTightWrap()) && isEmpty(pPrBase.getOutlineLvl()) && isEmpty(pPrBase.getCnfStyle()) ); } /** * isEmpty returns true if rPr is null, or each of its * properties is in turn, empty * * @param rPr * @return */ public static boolean isEmpty(RPr rPr) { return ((rPr == null) || (isEmpty(rPr.getRStyle()) && isEmpty(rPr.getRFonts()) && isEmpty(rPr.getB()) && isEmpty(rPr.getBCs()) && isEmpty(rPr.getI()) && isEmpty(rPr.getICs()) && isEmpty(rPr.getCaps()) && isEmpty(rPr.getSmallCaps()) && isEmpty(rPr.getStrike()) && isEmpty(rPr.getDstrike()) && isEmpty(rPr.getOutline()) && isEmpty(rPr.getShadow()) && isEmpty(rPr.getEmboss()) && isEmpty(rPr.getImprint()) && isEmpty(rPr.getSnapToGrid()) && isEmpty(rPr.getVanish()) && isEmpty(rPr.getColor()) && isEmpty(rPr.getSpacing()) && isEmpty(rPr.getW()) && isEmpty(rPr.getKern()) && isEmpty(rPr.getPosition()) && isEmpty(rPr.getSz()) && isEmpty(rPr.getSzCs()) && isEmpty(rPr.getHighlight()) && isEmpty(rPr.getU()) && isEmpty(rPr.getEffect()) && isEmpty(rPr.getBdr()) && isEmpty(rPr.getShd()) && isEmpty(rPr.getVertAlign()) && isEmpty(rPr.getRtl()) && isEmpty(rPr.getCs()) && isEmpty(rPr.getEm()) && isEmpty(rPr.getSpecVanish()) && isEmpty(rPr.getOMath()) ) ); } public static boolean isEmpty(ParaRPr rPr) { return ((rPr == null) || (isEmpty(rPr.getRStyle()) && isEmpty(rPr.getRFonts()) && isEmpty(rPr.getB()) && isEmpty(rPr.getBCs()) && isEmpty(rPr.getI()) && isEmpty(rPr.getICs()) && isEmpty(rPr.getCaps()) && isEmpty(rPr.getSmallCaps()) && isEmpty(rPr.getStrike()) && isEmpty(rPr.getDstrike()) && isEmpty(rPr.getOutline()) && isEmpty(rPr.getShadow()) && isEmpty(rPr.getEmboss()) && isEmpty(rPr.getImprint()) && isEmpty(rPr.getSnapToGrid()) && isEmpty(rPr.getVanish()) && isEmpty(rPr.getColor()) && isEmpty(rPr.getSpacing()) && isEmpty(rPr.getW()) && isEmpty(rPr.getKern()) && isEmpty(rPr.getPosition()) && isEmpty(rPr.getSz()) && isEmpty(rPr.getSzCs()) && isEmpty(rPr.getHighlight()) && isEmpty(rPr.getU()) && isEmpty(rPr.getEffect()) && isEmpty(rPr.getBdr()) && isEmpty(rPr.getShd()) && isEmpty(rPr.getVertAlign()) && isEmpty(rPr.getRtl()) && isEmpty(rPr.getCs()) && isEmpty(rPr.getEm()) && isEmpty(rPr.getSpecVanish()) && isEmpty(rPr.getOMath()) ) ); } public static boolean isEmpty(CTTblPrBase tblPr) { return ((tblPr == null) || (isEmpty(tblPr.getTblStyle()) && isEmpty(tblPr.getTblpPr()) && isEmpty(tblPr.getTblOverlap()) && isEmpty(tblPr.getTblStyleRowBandSize()) && isEmpty(tblPr.getTblStyleColBandSize()) && isEmpty(tblPr.getTblW()) && isEmpty(tblPr.getJc()) && isEmpty(tblPr.getTblCellSpacing()) && isEmpty(tblPr.getTblInd()) && isEmpty(tblPr.getTblBorders()) && isEmpty(tblPr.getShd()) && isEmpty(tblPr.getTblLayout()) && isEmpty(tblPr.getTblCellMar()) && isEmpty(tblPr.getTblLook()) ) ); } public static boolean isEmpty(TcPr tcPr) { return ((tcPr == null) || (isEmpty(tcPr.getCnfStyle()) && isEmpty(tcPr.getTcW()) && isEmpty(tcPr.getGridSpan()) && isEmpty(tcPr.getHMerge()) && isEmpty(tcPr.getVMerge()) && isEmpty(tcPr.getTcBorders()) && isEmpty(tcPr.getShd()) && isEmpty(tcPr.getNoWrap()) && isEmpty(tcPr.getTcMar()) && isEmpty(tcPr.getTextDirection()) && isEmpty(tcPr.getTcFitText()) && isEmpty(tcPr.getVAlign()) && isEmpty(tcPr.getHideMark()) ) ); } public static boolean isEmpty(List<CTTblStylePr> tblStylePrList) { if ((tblStylePrList == null) || (tblStylePrList.isEmpty())) return true; for (int i=0; i<tblStylePrList.size(); i++) if (!isEmpty(tblStylePrList.get(i))) return false; return true; } public static boolean isEmpty(CTTblStylePr ctTblStylePr) { return ((ctTblStylePr == null) || (isEmpty(ctTblStylePr.getPPr()) && isEmpty(ctTblStylePr.getRPr()) && isEmpty(ctTblStylePr.getTblPr()) && isEmpty(ctTblStylePr.getTrPr()) && (ctTblStylePr.getType() == null) ) ); } public static boolean isEmpty(OutlineLvl outlineLvl) { return (outlineLvl == null) || (outlineLvl.getVal() == null); } public static boolean isEmpty(CTTextboxTightWrap textboxTightWrap) { return (textboxTightWrap == null) || (textboxTightWrap.getVal() == null); } public static boolean isEmpty(TextAlignment textAlignment) { return (textAlignment == null) || (textAlignment.getVal() == null); } public static boolean isEmpty(TextDirection textDirection) { return (textDirection == null) || (textDirection.getVal() == null); } public static boolean isEmpty(Jc jc) { return (jc == null) || (jc.getVal() == null); } public static boolean isEmpty(Ind ind) { return ((ind == null) || (isEmpty(ind.getFirstLine()) && isEmpty(ind.getFirstLineChars()) && isEmpty(ind.getHanging()) && isEmpty(ind.getHangingChars()) && isEmpty(ind.getLeft()) && isEmpty(ind.getLeftChars()) && isEmpty(ind.getRight()) && isEmpty(ind.getRightChars()) ) ); } public static boolean isEmpty(Spacing spacing) { return ((spacing == null) || (isEmpty(spacing.getAfter()) && isEmpty(spacing.getAfterLines()) && isEmpty(spacing.getBefore()) && isEmpty(spacing.getBeforeLines()) && isEmpty(spacing.getLine()) && (spacing.getLineRule() == null) ) ); } public static boolean isEmpty(Tabs tabs) { if ((tabs == null) || (tabs.getTab() == null) || (tabs.getTab().isEmpty())) return true; for (int i=0; i<tabs.getTab().size(); i++) if (!isEmpty(tabs.getTab().get(i))) return false; return true; } public static boolean isEmpty(CTTabStop ctTabStop) { return ((ctTabStop == null) || (isEmpty(ctTabStop.getPos()) && (ctTabStop.getVal() == null) && (ctTabStop.getLeader() == null) ) ); } public static boolean isEmpty(CTShd shd) { return ((shd == null) || (isEmpty(shd.getColor()) && isEmpty(shd.getThemeTint()) && isEmpty(shd.getThemeShade()) && isEmpty(shd.getFill()) && isEmpty(shd.getThemeFillTint()) && isEmpty(shd.getThemeFillShade()) && (shd.getThemeColor() == null) && (shd.getThemeFill() == null) && (shd.getVal() == null) ) ); } public static boolean isEmpty(PBdr pBdr) { return ((pBdr == null) || (isEmpty(pBdr.getTop()) && isEmpty(pBdr.getLeft()) && isEmpty(pBdr.getBottom()) && isEmpty(pBdr.getRight()) && isEmpty(pBdr.getBetween()) && isEmpty(pBdr.getBar()) ) ); } public static boolean isEmpty(CTBorder border) { return ((border == null) || (isEmpty(border.getColor()) && isEmpty(border.getSpace()) && isEmpty(border.getSz()) && (border.getThemeColor() == null) && isEmpty(border.getThemeShade()) && isEmpty(border.getThemeTint()) && (border.getVal() == null) ) ); } public static boolean isEmpty(NumPr numPr) { // Comparing the numbering format would require looking into the // numbering definitions part, for this reason only the id is // checked return (numPr == null) || (numPr.getNumId() == null) || (isEmpty(numPr.getNumId().getVal())); } public static boolean isEmpty(CTFramePr framePr) { return ((framePr == null) || ((framePr.getDropCap() == null) && isEmpty(framePr.getLines()) && isEmpty(framePr.getW()) && isEmpty(framePr.getH()) && isEmpty(framePr.getVSpace()) && isEmpty(framePr.getHSpace()) && (framePr.getWrap() == null) && (framePr.getHAnchor() == null) && (framePr.getVAnchor() == null) && isEmpty(framePr.getX()) && (framePr.getXAlign() == null) && isEmpty(framePr.getY()) && (framePr.getYAlign() == null) && (framePr.getHRule() == null) && (framePr.isAnchorLock()) ) ); } public static boolean isEmpty(CTCnf cnfStyle) { return (cnfStyle == null) || isEmpty(cnfStyle.getVal() ); } public static boolean isEmpty(PStyle pStyle) { return (pStyle == null) || isEmpty(pStyle.getVal()); } /** * isEmpty (non sensitive to presence of possible hint ie * would still return true) * * @param rFonts * @return */ public static boolean isEmpty(RFonts rFonts) { return (rFonts == null) || (isEmpty(rFonts.getAscii()) && isEmpty(rFonts.getAsciiTheme()) && isEmpty(rFonts.getCs()) && isEmpty(rFonts.getCstheme()) && isEmpty(rFonts.getEastAsia()) && isEmpty(rFonts.getEastAsiaTheme()) && isEmpty(rFonts.getHAnsi()) && isEmpty(rFonts.getHAnsiTheme()) ); } public static boolean isEmpty(STHint stHint) { return (stHint == null) ; } public static boolean isEmpty(STTheme stTheme) { return (stTheme == null) ; } public static boolean isEmpty(RStyle rStyle) { return (rStyle == null) || isEmpty(rStyle.getVal()); } public static boolean isEmpty(CTEm em) { return (em == null) || (em.getVal() == null); } public static boolean isEmpty(CTVerticalAlignRun vertAlign) { return (vertAlign == null) || (vertAlign.getVal() == null); } public static boolean isEmpty(CTTextEffect effect) { return (effect == null) || (effect.getVal() == null); } public static boolean isEmpty(U u) { return (u == null) || ((u.getVal() == null) && isEmpty(u.getColor()) ); } public static boolean isEmpty(Highlight highlight) { return (highlight == null) || isEmpty(highlight.getVal()); } public static boolean isEmpty(CTSignedHpsMeasure measure) { return (measure == null) || isEmpty(measure.getVal()); } public static boolean isEmpty(HpsMeasure measure) { return (measure == null) || isEmpty(measure.getVal()); } public static boolean isEmpty(CTTextScale scale) { return (scale == null) || isEmpty(scale.getVal()); } public static boolean isEmpty(CTSignedTwipsMeasure measure) { return (measure == null) || isEmpty(measure.getVal()); } public static boolean isEmpty(Color color) { return (color == null) || isEmpty(color.getVal()); } public static boolean isEmpty(CTTblLook tblLook) { return (tblLook == null) || (tblLook.getFirstColumn()==null && tblLook.getFirstRow()==null && tblLook.getLastColumn()==null && tblLook.getLastRow()==null && tblLook.getNoHBand()==null && tblLook.getNoVBand()==null && tblLook.getVal()==null ); } public static boolean isEmpty(CTTblLayoutType tblLayout) { return (tblLayout == null) || (tblLayout.getType() == null); } public static boolean isEmpty(CTTblCellMar margin) { return (margin == null) || (isEmpty(margin.getBottom()) && isEmpty(margin.getLeft()) && isEmpty(margin.getRight()) && isEmpty(margin.getTop()) ); } public static boolean isEmpty(TblBorders borders) { return (borders == null) || (isEmpty(borders.getBottom()) && isEmpty(borders.getLeft()) && isEmpty(borders.getRight()) && isEmpty(borders.getTop()) && isEmpty(borders.getInsideH()) && isEmpty(borders.getInsideV()) ); } public static boolean isEmpty(TblStyleColBandSize bandSize) { return (bandSize == null) || isEmpty(bandSize.getVal()); } public static boolean isEmpty(TblStyleRowBandSize bandSize) { return (bandSize == null) || isEmpty(bandSize.getVal()); } public static boolean isEmpty(CTTblOverlap overlap) { return (overlap == null) || (overlap.getVal() == null); } public static boolean isEmpty(CTTblPPr tblpPr) { return (tblpPr == null) || (isEmpty(tblpPr.getLeftFromText()) && isEmpty(tblpPr.getRightFromText()) && isEmpty(tblpPr.getTopFromText()) && isEmpty(tblpPr.getBottomFromText()) && isEmpty(tblpPr.getVertAnchor() == null) && isEmpty(tblpPr.getHorzAnchor() == null) && isEmpty(tblpPr.getTblpXSpec() == null) && isEmpty(tblpPr.getTblpX()) && isEmpty(tblpPr.getTblpYSpec() == null) && isEmpty(tblpPr.getTblpY()) ); } public static boolean isEmpty(TblStyle style) { return (style == null) || isEmpty(style.getVal()); } public static boolean isEmpty(CTVerticalJc vAlign) { return (vAlign == null) || (vAlign.getVal() == null); } public static boolean isEmpty(TcMar margin) { return (margin == null) || (isEmpty(margin.getBottom()) && isEmpty(margin.getLeft()) && isEmpty(margin.getRight()) && isEmpty(margin.getTop()) ); } public static boolean isEmpty(TcBorders borders) { return (borders == null) || (isEmpty(borders.getBottom()) && isEmpty(borders.getLeft()) && isEmpty(borders.getRight()) && isEmpty(borders.getTop()) && isEmpty(borders.getInsideH()) && isEmpty(borders.getInsideV()) && isEmpty(borders.getTl2Br()) && isEmpty(borders.getTr2Bl()) ); } public static boolean isEmpty(VMerge merge) { return (merge == null) || isEmpty(merge.getVal()); } public static boolean isEmpty(HMerge merge) { return (merge == null) || isEmpty(merge.getVal()); } public static boolean isEmpty(GridSpan gridSpan) { return (gridSpan == null) || isEmpty(gridSpan.getVal()); } public static boolean isEmpty(TrPr trPr) { return (trPr == null) || (trPr.getCnfStyleOrDivIdOrGridBefore() == null) || (trPr.getCnfStyleOrDivIdOrGridBefore().isEmpty()); } public static boolean isEmpty(CTHeight height) { //HRule is ignored return (height == null) || isEmpty(height.getVal()); } public static boolean isEmpty(TblWidth width) { //type is ignored return (width == null) || isEmpty(width.getW()); } public static boolean isEmpty(CTShortHexNumber number) { return (number == null) || isEmpty(number.getVal()); } public static boolean isEmpty(BooleanDefaultTrue booleanDefaultTrue) { return (booleanDefaultTrue == null); // we want to apply eg <w:i w:val="0"/> //|| (!booleanDefaultTrue.isVal()); } public static boolean isEmpty(Boolean bool) { return (bool == null) || (!bool.booleanValue()); } protected static boolean isEmpty(BigInteger val) { return (val == null) || (val.equals(BigInteger.ZERO)); } protected static boolean isEmpty(Integer val) { return (val == null) || (val.intValue() == 0); } protected static boolean isEmpty(String val) { return (val == null) || (val.length() == 0); } protected static boolean isEmpty(STThemeColor val) { return (val == null) || (val.equals(STThemeColor.NONE)); } ///////////////////////////////////////////// //apply-Methods // // see similar ImmutablePropertyResolver // ///////////////////////////////////////////// public static void apply(Style source, Style destination) { if (CHARACTER_STYLE.equals(source.getType())) { destination.setRPr(apply(source.getRPr(), destination.getRPr())); } else if (PARAGRAPH_STYLE.equals(source.getType()) || NUMBERING_STYLE.equals(source.getType())) { destination.setPPr(apply(source.getPPr(), destination.getPPr())); destination.setRPr(apply(source.getRPr(), destination.getRPr())); } else if (TABLE_STYLE.equals(source.getType())) { destination.setTblPr(apply(source.getTblPr(), destination.getTblPr())); destination.setTcPr(apply(source.getTcPr(), destination.getTcPr())); apply(source.getTblStylePr(), destination.getTblStylePr()); destination.setPPr(apply(source.getPPr(), destination.getPPr())); destination.setRPr(apply(source.getRPr(), destination.getRPr())); } } public static PPr apply(PPr source, PPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPr(); apply((PPrBase)source, (PPrBase)destination); destination.setRPr(apply(source.getRPr(), destination.getRPr())); } return destination; } public static void apply(PPrBase source, PPrBase destination) { //PPrBase as a Base class isn't instantiated if (!isEmpty((PPrBase)source)) { destination.setPStyle(apply(source.getPStyle(), destination.getPStyle())); destination.setKeepNext(apply(source.getKeepNext(), destination.getKeepNext())); destination.setKeepLines(apply(source.getKeepLines(), destination.getKeepLines())); destination.setPageBreakBefore(apply(source.getPageBreakBefore(), destination.getPageBreakBefore())); destination.setFramePr(apply(source.getFramePr(), destination.getFramePr())); destination.setWidowControl(apply(source.getWidowControl(), destination.getWidowControl())); destination.setNumPr(apply(source.getNumPr(), destination.getNumPr())); destination.setSuppressLineNumbers(apply(source.getSuppressLineNumbers(), destination.getSuppressLineNumbers())); destination.setPBdr(apply(source.getPBdr(), destination.getPBdr())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setTabs(apply(source.getTabs(), destination.getTabs())); destination.setSuppressAutoHyphens(apply(source.getSuppressAutoHyphens(), destination.getSuppressAutoHyphens())); destination.setKinsoku(apply(source.getKinsoku(), destination.getKinsoku())); destination.setWordWrap(apply(source.getWordWrap(), destination.getWordWrap())); destination.setOverflowPunct(apply(source.getOverflowPunct(), destination.getOverflowPunct())); destination.setTopLinePunct(apply(source.getTopLinePunct(), destination.getTopLinePunct())); destination.setAutoSpaceDE(apply(source.getAutoSpaceDE(), destination.getAutoSpaceDE())); destination.setAutoSpaceDN(apply(source.getAutoSpaceDN(), destination.getAutoSpaceDN())); destination.setBidi(apply(source.getBidi(), destination.getBidi())); destination.setAdjustRightInd(apply(source.getAdjustRightInd(), destination.getAdjustRightInd())); destination.setSnapToGrid(apply(source.getSnapToGrid(), destination.getSnapToGrid())); destination.setSpacing(apply(source.getSpacing(), destination.getSpacing())); destination.setInd(apply(source.getInd(), destination.getInd())); destination.setContextualSpacing(apply(source.getContextualSpacing(), destination.getContextualSpacing())); destination.setMirrorIndents(apply(source.getMirrorIndents(), destination.getMirrorIndents())); destination.setSuppressOverlap(apply(source.getSuppressOverlap(), destination.getSuppressOverlap())); destination.setJc(apply(source.getJc(), destination.getJc())); destination.setTextDirection(apply(source.getTextDirection(), destination.getTextDirection())); destination.setTextAlignment(apply(source.getTextAlignment(), destination.getTextAlignment())); destination.setTextboxTightWrap(apply(source.getTextboxTightWrap(), destination.getTextboxTightWrap())); destination.setOutlineLvl(apply(source.getOutlineLvl(), destination.getOutlineLvl())); destination.setCnfStyle(apply(source.getCnfStyle(), destination.getCnfStyle())); } } public static RPr apply(RPr source, RPr destination) { boolean hint = false; if (source!=null && source.getRFonts()!=null && !isEmpty(source.getRFonts().getHint())) { hint = true; log.debug("source rPr contains rFonts with hint"); } if (isEmpty(source) && !hint ) { log.debug("no source rPr to apply"); } else { if (destination == null) destination = Context.getWmlObjectFactory().createRPr(); destination.setLang(apply(source.getLang(), destination.getLang())); destination.setRStyle(apply(source.getRStyle(), destination.getRStyle())); destination.setRFonts(apply(source.getRFonts(), destination.getRFonts())); destination.setB(apply(source.getB(), destination.getB())); destination.setBCs(apply(source.getBCs(), destination.getBCs())); destination.setI(apply(source.getI(), destination.getI())); destination.setICs(apply(source.getICs(), destination.getICs())); destination.setCaps(apply(source.getCaps(), destination.getCaps())); destination.setSmallCaps(apply(source.getSmallCaps(), destination.getSmallCaps())); destination.setStrike(apply(source.getStrike(), destination.getStrike())); destination.setDstrike(apply(source.getDstrike(), destination.getDstrike())); destination.setOutline(apply(source.getOutline(), destination.getOutline())); destination.setShadow(apply(source.getShadow(), destination.getShadow())); destination.setEmboss(apply(source.getEmboss(), destination.getEmboss())); destination.setImprint(apply(source.getImprint(), destination.getImprint())); destination.setSnapToGrid(apply(source.getSnapToGrid(), destination.getSnapToGrid())); destination.setVanish(apply(source.getVanish(), destination.getVanish())); destination.setColor(apply(source.getColor(), destination.getColor())); destination.setSpacing(apply(source.getSpacing(), destination.getSpacing())); destination.setW(apply(source.getW(), destination.getW())); destination.setKern(apply(source.getKern(), destination.getKern())); destination.setPosition(apply(source.getPosition(), destination.getPosition())); destination.setSz(apply(source.getSz(), destination.getSz())); destination.setSzCs(apply(source.getSzCs(), destination.getSzCs())); destination.setHighlight(apply(source.getHighlight(), destination.getHighlight())); destination.setU(apply(source.getU(), destination.getU())); destination.setEffect(apply(source.getEffect(), destination.getEffect())); destination.setBdr(apply(source.getBdr(), destination.getBdr())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setVertAlign(apply(source.getVertAlign(), destination.getVertAlign())); destination.setRtl(apply(source.getRtl(), destination.getRtl())); destination.setCs(apply(source.getCs(), destination.getCs())); destination.setEm(apply(source.getEm(), destination.getEm())); destination.setSpecVanish(apply(source.getSpecVanish(), destination.getSpecVanish())); destination.setOMath(apply(source.getOMath(), destination.getOMath())); } return destination; } public static CTLanguage apply(CTLanguage source, CTLanguage destination) { // TODO refine this? return ((source == null) ? destination : source); } public static RPr apply(ParaRPr source, RPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createRPr(); destination.setRStyle(apply(source.getRStyle(), destination.getRStyle())); destination.setRFonts(apply(source.getRFonts(), destination.getRFonts())); destination.setB(apply(source.getB(), destination.getB())); destination.setBCs(apply(source.getBCs(), destination.getBCs())); destination.setI(apply(source.getI(), destination.getI())); destination.setICs(apply(source.getICs(), destination.getICs())); destination.setCaps(apply(source.getCaps(), destination.getCaps())); destination.setSmallCaps(apply(source.getSmallCaps(), destination.getSmallCaps())); destination.setStrike(apply(source.getStrike(), destination.getStrike())); destination.setDstrike(apply(source.getDstrike(), destination.getDstrike())); destination.setOutline(apply(source.getOutline(), destination.getOutline())); destination.setShadow(apply(source.getShadow(), destination.getShadow())); destination.setEmboss(apply(source.getEmboss(), destination.getEmboss())); destination.setImprint(apply(source.getImprint(), destination.getImprint())); destination.setSnapToGrid(apply(source.getSnapToGrid(), destination.getSnapToGrid())); destination.setVanish(apply(source.getVanish(), destination.getVanish())); destination.setColor(apply(source.getColor(), destination.getColor())); destination.setSpacing(apply(source.getSpacing(), destination.getSpacing())); destination.setW(apply(source.getW(), destination.getW())); destination.setKern(apply(source.getKern(), destination.getKern())); destination.setPosition(apply(source.getPosition(), destination.getPosition())); destination.setSz(apply(source.getSz(), destination.getSz())); destination.setSzCs(apply(source.getSzCs(), destination.getSzCs())); destination.setHighlight(apply(source.getHighlight(), destination.getHighlight())); destination.setU(apply(source.getU(), destination.getU())); destination.setEffect(apply(source.getEffect(), destination.getEffect())); destination.setBdr(apply(source.getBdr(), destination.getBdr())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setVertAlign(apply(source.getVertAlign(), destination.getVertAlign())); destination.setRtl(apply(source.getRtl(), destination.getRtl())); destination.setCs(apply(source.getCs(), destination.getCs())); destination.setEm(apply(source.getEm(), destination.getEm())); destination.setSpecVanish(apply(source.getSpecVanish(), destination.getSpecVanish())); destination.setOMath(apply(source.getOMath(), destination.getOMath())); } return destination; } public static ParaRPr apply(RPr source, ParaRPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createParaRPr(); destination.setRStyle(apply(source.getRStyle(), destination.getRStyle())); destination.setRFonts(apply(source.getRFonts(), destination.getRFonts())); destination.setB(apply(source.getB(), destination.getB())); destination.setBCs(apply(source.getBCs(), destination.getBCs())); destination.setI(apply(source.getI(), destination.getI())); destination.setICs(apply(source.getICs(), destination.getICs())); destination.setCaps(apply(source.getCaps(), destination.getCaps())); destination.setSmallCaps(apply(source.getSmallCaps(), destination.getSmallCaps())); destination.setStrike(apply(source.getStrike(), destination.getStrike())); destination.setDstrike(apply(source.getDstrike(), destination.getDstrike())); destination.setOutline(apply(source.getOutline(), destination.getOutline())); destination.setShadow(apply(source.getShadow(), destination.getShadow())); destination.setEmboss(apply(source.getEmboss(), destination.getEmboss())); destination.setImprint(apply(source.getImprint(), destination.getImprint())); destination.setSnapToGrid(apply(source.getSnapToGrid(), destination.getSnapToGrid())); destination.setVanish(apply(source.getVanish(), destination.getVanish())); destination.setColor(apply(source.getColor(), destination.getColor())); destination.setSpacing(apply(source.getSpacing(), destination.getSpacing())); destination.setW(apply(source.getW(), destination.getW())); destination.setKern(apply(source.getKern(), destination.getKern())); destination.setPosition(apply(source.getPosition(), destination.getPosition())); destination.setSz(apply(source.getSz(), destination.getSz())); destination.setSzCs(apply(source.getSzCs(), destination.getSzCs())); destination.setHighlight(apply(source.getHighlight(), destination.getHighlight())); destination.setU(apply(source.getU(), destination.getU())); destination.setEffect(apply(source.getEffect(), destination.getEffect())); destination.setBdr(apply(source.getBdr(), destination.getBdr())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setVertAlign(apply(source.getVertAlign(), destination.getVertAlign())); destination.setRtl(apply(source.getRtl(), destination.getRtl())); destination.setCs(apply(source.getCs(), destination.getCs())); destination.setEm(apply(source.getEm(), destination.getEm())); destination.setSpecVanish(apply(source.getSpecVanish(), destination.getSpecVanish())); destination.setOMath(apply(source.getOMath(), destination.getOMath())); } return destination; } public static ParaRPr apply(ParaRPr source, ParaRPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createParaRPr(); destination.setRStyle(apply(source.getRStyle(), destination.getRStyle())); destination.setRFonts(apply(source.getRFonts(), destination.getRFonts())); destination.setB(apply(source.getB(), destination.getB())); destination.setBCs(apply(source.getBCs(), destination.getBCs())); destination.setI(apply(source.getI(), destination.getI())); destination.setICs(apply(source.getICs(), destination.getICs())); destination.setCaps(apply(source.getCaps(), destination.getCaps())); destination.setSmallCaps(apply(source.getSmallCaps(), destination.getSmallCaps())); destination.setStrike(apply(source.getStrike(), destination.getStrike())); destination.setDstrike(apply(source.getDstrike(), destination.getDstrike())); destination.setOutline(apply(source.getOutline(), destination.getOutline())); destination.setShadow(apply(source.getShadow(), destination.getShadow())); destination.setEmboss(apply(source.getEmboss(), destination.getEmboss())); destination.setImprint(apply(source.getImprint(), destination.getImprint())); destination.setSnapToGrid(apply(source.getSnapToGrid(), destination.getSnapToGrid())); destination.setVanish(apply(source.getVanish(), destination.getVanish())); destination.setColor(apply(source.getColor(), destination.getColor())); destination.setSpacing(apply(source.getSpacing(), destination.getSpacing())); destination.setW(apply(source.getW(), destination.getW())); destination.setKern(apply(source.getKern(), destination.getKern())); destination.setPosition(apply(source.getPosition(), destination.getPosition())); destination.setSz(apply(source.getSz(), destination.getSz())); destination.setSzCs(apply(source.getSzCs(), destination.getSzCs())); destination.setHighlight(apply(source.getHighlight(), destination.getHighlight())); destination.setU(apply(source.getU(), destination.getU())); destination.setEffect(apply(source.getEffect(), destination.getEffect())); destination.setBdr(apply(source.getBdr(), destination.getBdr())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setVertAlign(apply(source.getVertAlign(), destination.getVertAlign())); destination.setRtl(apply(source.getRtl(), destination.getRtl())); destination.setCs(apply(source.getCs(), destination.getCs())); destination.setEm(apply(source.getEm(), destination.getEm())); destination.setSpecVanish(apply(source.getSpecVanish(), destination.getSpecVanish())); destination.setOMath(apply(source.getOMath(), destination.getOMath())); } return destination; } public static CTTblPrBase apply(CTTblPrBase source, CTTblPrBase destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTblPr(); destination.setBidiVisual(apply(source.getBidiVisual(), destination.getBidiVisual())); destination.setTblStyle(apply(source.getTblStyle(), destination.getTblStyle())); destination.setTblpPr(apply(source.getTblpPr(), destination.getTblpPr())); destination.setTblOverlap(apply(source.getTblOverlap(), destination.getTblOverlap())); destination.setTblStyleRowBandSize(apply(source.getTblStyleRowBandSize(), destination.getTblStyleRowBandSize())); destination.setTblStyleColBandSize(apply(source.getTblStyleColBandSize(), destination.getTblStyleColBandSize())); destination.setTblW(apply(source.getTblW(), destination.getTblW())); destination.setJc(apply(source.getJc(), destination.getJc())); destination.setTblCellSpacing(apply(source.getTblCellSpacing(), destination.getTblCellSpacing())); destination.setTblInd(apply(source.getTblInd(), destination.getTblInd())); destination.setTblBorders(apply(source.getTblBorders(), destination.getTblBorders())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setTblLayout(apply(source.getTblLayout(), destination.getTblLayout())); destination.setTblCellMar(apply(source.getTblCellMar(), destination.getTblCellMar())); destination.setTblLook(apply(source.getTblLook(), destination.getTblLook())); } return destination; } public static TcPr apply(TcPr source, TcPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTcPr(); destination.setCnfStyle(apply(source.getCnfStyle(), destination.getCnfStyle())); destination.setTcW(apply(source.getTcW(), destination.getTcW())); destination.setGridSpan(apply(source.getGridSpan(), destination.getGridSpan())); destination.setHMerge(apply(source.getHMerge(), destination.getHMerge())); destination.setVMerge(apply(source.getVMerge(), destination.getVMerge())); destination.setTcBorders(apply(source.getTcBorders(), destination.getTcBorders())); destination.setShd(apply(source.getShd(), destination.getShd())); destination.setNoWrap(apply(source.getNoWrap(), destination.getNoWrap())); destination.setTcMar(apply(source.getTcMar(), destination.getTcMar())); destination.setTextDirection(apply(source.getTextDirection(), destination.getTextDirection())); destination.setTcFitText(apply(source.getTcFitText(), destination.getTcFitText())); destination.setVAlign(apply(source.getVAlign(), destination.getVAlign())); destination.setHideMark(apply(source.getHideMark(), destination.getHideMark())); } return destination; } public static void apply(List<CTTblStylePr> source, List<CTTblStylePr> destination) { CTTblStylePr destinationTblStylePr = null; if (!isEmpty(source)) { //not sure about this, but if the source defines a content model it should //replace the one of the source as a whole, and not parts of it. destination.clear(); for (int i=0; i<source.size(); i++) { destinationTblStylePr = apply(source.get(i), null); if (destinationTblStylePr != null) { destination.add(destinationTblStylePr); } } } } public static CTTblLook apply(CTTblLook source, CTTblLook destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblLook(); destination.setFirstColumn(apply(source.getFirstColumn(), destination.getFirstColumn())); destination.setFirstRow(apply(source.getFirstRow(), destination.getFirstRow())); destination.setLastColumn(apply(source.getLastColumn(), destination.getLastColumn())); destination.setLastRow(apply(source.getLastRow(), destination.getLastRow())); destination.setNoHBand(apply(source.getNoHBand(), destination.getNoHBand())); destination.setNoVBand(apply(source.getNoVBand(), destination.getNoVBand())); destination.setVal(apply(source.getVal(), destination.getVal())); } return destination; } private static STOnOff apply(STOnOff source, STOnOff destination) { return (source == null ? destination : source); } public static CTTblStylePr apply(CTTblStylePr source, CTTblStylePr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblStylePr(); destination.setPPr(apply(source.getPPr(), destination.getPPr())); destination.setRPr(apply(source.getRPr(), destination.getRPr())); destination.setTblPr(apply(source.getTblPr(), destination.getTblPr())); destination.setTcPr(apply(source.getTcPr(), destination.getTcPr())); destination.setTrPr(apply(source.getTrPr(), destination.getTrPr())); destination.setType(source.getType()); //enum } return destination; } public static OutlineLvl apply(OutlineLvl source, OutlineLvl destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBaseOutlineLvl(); destination.setVal(source.getVal()); //atomic } return destination; } public static CTTextboxTightWrap apply(CTTextboxTightWrap source, CTTextboxTightWrap destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTextboxTightWrap(); destination.setVal(source.getVal()); //enum } return destination; } public static TextAlignment apply(TextAlignment source, TextAlignment destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBaseTextAlignment(); destination.setVal(source.getVal()); //atomic } return destination; } public static TextDirection apply(TextDirection source, TextDirection destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTextDirection(); destination.setVal(source.getVal()); //atomic } return destination; } public static Jc apply(Jc source, Jc destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createJc(); destination.setVal(source.getVal()); //enum } return destination; } public static Ind apply(Ind source, Ind destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBaseInd(); destination.setFirstLine(apply(source.getFirstLine(), destination.getFirstLine())); destination.setFirstLineChars(apply(source.getFirstLineChars(), destination.getFirstLineChars())); destination.setHanging(apply(source.getHanging(), destination.getHanging())); destination.setHangingChars(apply(source.getHangingChars(), destination.getHangingChars())); destination.setLeft(apply(source.getLeft(), destination.getLeft())); destination.setLeftChars(apply(source.getLeftChars(), destination.getLeftChars())); destination.setRight(apply(source.getRight(), destination.getRight())); destination.setRightChars(apply(source.getRightChars(), destination.getRightChars())); } return destination; } public static Spacing apply(Spacing source, Spacing destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBaseSpacing(); destination.setAfter(apply(source.getAfter(), destination.getAfter())); destination.setAfterLines(apply(source.getAfterLines(), destination.getAfterLines())); destination.setBefore(apply(source.getBefore(), destination.getBefore())); destination.setBeforeLines(apply(source.getBeforeLines(), destination.getBeforeLines())); destination.setLine(apply(source.getLine(), destination.getLine())); destination.setLineRule(destination.getLineRule()); } return destination; } public static Tabs apply(Tabs source, Tabs destination) { CTTabStop sourceTabStop = null; CTTabStop destinationTabStop = null; //Tabs are relative to each other, therefore if there are any tabs in the source //they should replace those in the destination and not be added to the destination. if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTabs(); destination.getTab().clear(); for (int i=0; i<source.getTab().size(); i++) { sourceTabStop = source.getTab().get(i); destinationTabStop = Context.getWmlObjectFactory().createCTTabStop(); destinationTabStop.setLeader(sourceTabStop.getLeader()); //enum destinationTabStop.setPos(sourceTabStop.getPos()); //atomic destinationTabStop.setVal(sourceTabStop.getVal()); //enum if (destinationTabStop != null) { destination.getTab().add(destinationTabStop); } } } return destination; } public static CTShd apply(CTShd source, CTShd destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTShd(); destination.setColor(apply(source.getColor(), destination.getColor())); destination.setFill(apply(source.getFill(), destination.getFill())); destination.setVal(apply(source.getVal(), destination.getVal())); destination.setThemeTint(apply(source.getThemeTint(), destination.getThemeTint())); destination.setThemeShade(apply(source.getThemeShade(), destination.getThemeShade())); destination.setThemeFillTint(apply(source.getThemeFillTint(), destination.getThemeFillTint())); destination.setThemeFillShade(apply(source.getThemeFillShade(), destination.getThemeFillShade())); destination.setThemeColor(source.getThemeColor()); //enum destination.setThemeFill(source.getThemeFill()); //enum } return destination; } public static PBdr apply(PBdr source, PBdr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBasePBdr(); destination.setTop(apply(source.getTop(), destination.getTop())); destination.setLeft(apply(source.getLeft(), destination.getLeft())); destination.setBottom(apply(source.getBottom(), destination.getBottom())); destination.setRight(apply(source.getRight(), destination.getRight())); destination.setBetween(apply(source.getBetween(), destination.getBetween())); destination.setBar(apply(source.getBar(), destination.getBar())); } return destination; } public static CTBorder apply(CTBorder source, CTBorder destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTBorder(); destination.setColor(apply(source.getColor(), destination.getColor())); destination.setSpace(apply(source.getSpace(), destination.getSpace())); destination.setSz(apply(source.getSz(), destination.getSz())); destination.setThemeColor(source.getThemeColor()); destination.setThemeShade(apply(source.getThemeShade(), destination.getThemeShade())); destination.setThemeTint(apply(source.getThemeTint(), destination.getThemeTint())); destination.setVal(apply(source.getVal(), destination.getVal())); } return destination; } public static NumPr apply(NumPr source, NumPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBaseNumPr(); if ((source.getNumId() != null) || (source.getIlvl() != null)) { destination.setNumId(source.getNumId()); destination.setIlvl(source.getIlvl()); } } return destination; } public static CTFramePr apply(CTFramePr source, CTFramePr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTFramePr(); destination.setDropCap(source.getDropCap()); destination.setLines(apply(source.getLines(), destination.getLines())); destination.setW(apply(source.getW(), destination.getW())); destination.setH(apply(source.getH(), destination.getH())); destination.setVSpace(apply(source.getVSpace(), destination.getVSpace())); destination.setHSpace(apply(source.getHSpace(), destination.getHSpace())); destination.setWrap(source.getWrap()); destination.setHAnchor(source.getHAnchor()); destination.setVAnchor(source.getVAnchor()); destination.setX(apply(source.getX(), destination.getX())); destination.setXAlign(source.getXAlign()); destination.setY(apply(source.getY(), destination.getY())); destination.setYAlign(source.getYAlign()); destination.setHRule(source.getHRule()); destination.setAnchorLock(source.isAnchorLock()); } return destination; } public static CTCnf apply(CTCnf source, CTCnf destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTCnf(); destination.setVal(apply(source.getVal(), destination.getVal())); } return destination; } public static PStyle apply(PStyle source, PStyle destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createPPrBasePStyle(); destination.setVal(apply(source.getVal(), destination.getVal())); } return destination; } public static RFonts apply(RFonts source, RFonts destination) { if (destination == null) destination = Context.getWmlObjectFactory().createRFonts(); if (isEmpty(source) ) { if (source!=null && source.getHint()!=null) { destination.setHint(source.getHint()); } } else { if (source.getAscii() != null) { destination.setAscii(source.getAscii()); destination.setAsciiTheme(null); // theme trumps non theme, but here destination is "lower" than source // see http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/rFonts.html } if (source.getCs() != null) { destination.setCs(source.getCs()); destination.setCstheme(null); } if (source.getEastAsia() != null) { destination.setEastAsia(source.getEastAsia()); destination.setEastAsiaTheme(null); } if (source.getHAnsi() != null) { destination.setHAnsi(source.getHAnsi()); destination.setHAnsiTheme(null); } if (source.getAsciiTheme() != null) { destination.setAsciiTheme(source.getAsciiTheme()); destination.setAscii(null); // do this, since theme trumps non theme } if (source.getCstheme() != null) { destination.setCstheme(source.getCstheme()); destination.setCs(null); } if (source.getEastAsiaTheme() != null) { destination.setEastAsiaTheme(source.getEastAsiaTheme()); destination.setEastAsia(null); } if (source.getHAnsiTheme() != null) { destination.setHAnsiTheme(source.getHAnsiTheme()); destination.setHAnsi(null); } if (source.getHint() != null) { destination.setHint(source.getHint()); } } return destination; } public static RStyle apply(RStyle source, RStyle destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createRStyle(); destination.setVal(source.getVal()); } return destination; } public static CTEm apply(CTEm source, CTEm destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTEm(); destination.setVal(source.getVal()); } return destination; } public static CTVerticalAlignRun apply(CTVerticalAlignRun source, CTVerticalAlignRun destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTVerticalAlignRun(); destination.setVal(source.getVal()); } return destination; } public static CTTextEffect apply(CTTextEffect source, CTTextEffect destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTextEffect(); destination.setVal(source.getVal()); } return destination; } public static U apply(U source, U destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createU(); destination.setVal(source.getVal()); } return destination; } public static Highlight apply(Highlight source, Highlight destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createHighlight(); destination.setVal(source.getVal()); } return destination; } public static CTSignedHpsMeasure apply(CTSignedHpsMeasure source, CTSignedHpsMeasure destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTSignedHpsMeasure(); destination.setVal(source.getVal()); } return destination; } public static HpsMeasure apply(HpsMeasure source, HpsMeasure destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createHpsMeasure(); destination.setVal(source.getVal()); } return destination; } public static CTTextScale apply(CTTextScale source, CTTextScale destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTextScale(); destination.setVal(source.getVal()); } return destination; } public static CTSignedTwipsMeasure apply(CTSignedTwipsMeasure source, CTSignedTwipsMeasure destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTSignedTwipsMeasure(); destination.setVal(source.getVal()); } return destination; } public static Color apply(Color source, Color destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createColor(); destination.setThemeColor(apply(source.getThemeColor(), destination.getThemeColor())); destination.setThemeShade(apply(source.getThemeShade(), destination.getThemeShade())); destination.setThemeTint(apply(source.getThemeTint(), destination.getThemeTint())); destination.setVal(apply(source.getVal(), destination.getVal())); } return destination; } private static STThemeColor apply(STThemeColor source, STThemeColor destination) { return (isEmpty(source) ? destination : source); } public static CTTblLayoutType apply(CTTblLayoutType source, CTTblLayoutType destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblLayoutType(); destination.setType(source.getType()); } return destination; } public static CTTblCellMar apply(CTTblCellMar source, CTTblCellMar destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblCellMar(); destination.setBottom(apply(source.getBottom(), destination.getBottom())); destination.setLeft(apply(source.getLeft(), destination.getLeft())); destination.setRight(apply(source.getRight(), destination.getRight())); destination.setTop(apply(source.getTop(), destination.getTop())); } return destination; } public static TblBorders apply(TblBorders source, TblBorders destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTblBorders(); destination.setBottom(apply(source.getBottom(), destination.getBottom())); destination.setLeft(apply(source.getLeft(), destination.getLeft())); destination.setRight(apply(source.getRight(), destination.getRight())); destination.setTop(apply(source.getTop(), destination.getTop())); destination.setInsideH(apply(source.getInsideH(), destination.getInsideH())); destination.setInsideV(apply(source.getInsideV(), destination.getInsideV())); } return destination; } public static TblStyleColBandSize apply(TblStyleColBandSize source, TblStyleColBandSize destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblPrBaseTblStyleColBandSize(); destination.setVal(source.getVal()); } return destination; } public static TblStyleRowBandSize apply(TblStyleRowBandSize source, TblStyleRowBandSize destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblPrBaseTblStyleRowBandSize(); destination.setVal(source.getVal()); } return destination; } public static CTTblOverlap apply(CTTblOverlap source, CTTblOverlap destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblOverlap(); destination.setVal(source.getVal()); } return destination; } public static CTTblPPr apply(CTTblPPr source, CTTblPPr destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblPPr(); destination.setLeftFromText(apply(source.getLeftFromText(), destination.getLeftFromText())); destination.setRightFromText(apply(source.getRightFromText(), destination.getRightFromText())); destination.setTopFromText(apply(source.getTopFromText(), destination.getTopFromText())); destination.setBottomFromText(apply(source.getBottomFromText(), destination.getBottomFromText())); destination.setVertAnchor(source.getVertAnchor()); destination.setHorzAnchor(source.getHorzAnchor()); destination.setTblpXSpec(source.getTblpXSpec()); destination.setTblpX(apply(source.getTblpX(), destination.getTblpX())); destination.setTblpYSpec(source.getTblpYSpec()); destination.setTblpY(apply(source.getTblpY(), destination.getTblpY())); } return destination; } public static TblStyle apply(TblStyle source, TblStyle destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTTblPrBaseTblStyle(); destination.setVal(source.getVal()); } return destination; } public static CTVerticalJc apply(CTVerticalJc source, CTVerticalJc destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createCTVerticalJc(); destination.setVal(source.getVal()); } return destination; } public static TcMar apply(TcMar source, TcMar destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTcMar(); destination.setBottom(apply(source.getBottom(), destination.getBottom())); destination.setLeft(apply(source.getLeft(), destination.getLeft())); destination.setRight(apply(source.getRight(), destination.getRight())); destination.setTop(apply(source.getTop(), destination.getTop())); } return destination; } public static TcBorders apply(TcBorders source, TcBorders destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTcPrInnerTcBorders(); destination.setBottom(apply(source.getBottom(), destination.getBottom())); destination.setLeft(apply(source.getLeft(), destination.getLeft())); destination.setRight(apply(source.getRight(), destination.getRight())); destination.setTop(apply(source.getTop(), destination.getTop())); destination.setInsideH(apply(source.getInsideH(), destination.getInsideH())); destination.setInsideV(apply(source.getInsideV(), destination.getInsideV())); destination.setTl2Br(apply(source.getTl2Br(), destination.getTl2Br())); destination.setTr2Bl(apply(source.getTr2Bl(), destination.getTr2Bl())); } return destination; } public static VMerge apply(VMerge source, VMerge destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTcPrInnerVMerge(); destination.setVal(source.getVal()); } return destination; } public static HMerge apply(HMerge source, HMerge destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTcPrInnerHMerge(); destination.setVal(source.getVal()); } return destination; } public static GridSpan apply(GridSpan source, GridSpan destination) { if (!isEmpty(source)) { if (destination == null) destination = Context.getWmlObjectFactory().createTcPrInnerGridSpan(); destination.setVal(source.getVal()); } return destination; } public static TrPr apply(TrPr source, TrPr destination) { List<JAXBElement<?>> defsSource = null; List<JAXBElement<?>> defsDestination = null; JAXBElement<?> defsSourceElement = null; if (isEmpty(source)) return destination; if (!isEmpty(destination)) { defsSource = source.getCnfStyleOrDivIdOrGridBefore(); defsDestination = destination.getCnfStyleOrDivIdOrGridBefore(); for (int i=0; i<defsSource.size(); i++) { defsSourceElement = defsSource.get(i); for (int j=0; j<defsDestination.size(); j++) { if (defsSourceElement.getName().equals(defsDestination.get(i).getName())) { defsDestination.remove(i); break; } } defsDestination.add(XmlUtils.deepCopy(defsSourceElement)); } } return destination; } public static TblWidth apply(TblWidth source, TblWidth destination) { //Type gets ignored if ((source != null) && (!isEmpty(source.getW()))) { if (destination == null) destination = Context.getWmlObjectFactory().createTblWidth(); destination.setW(source.getW()); } return destination; } public static CTShortHexNumber apply(CTShortHexNumber source, CTShortHexNumber destination) { if ((source != null) && (!isEmpty(source.getVal()))) { if (destination == null) destination = Context.getWmlObjectFactory().createCTShortHexNumber(); destination.setVal(source.getVal()); } return destination; } private static STBorder apply(STBorder source, STBorder destination) { return ((source == null) || STBorder.NIL.equals(source) ? destination : source); } public static STShd apply(STShd source, STShd destination) { return ((source == null) || STShd.NIL.equals(source) ? destination : source); } public static STTblOverlap apply(STTblOverlap source, STTblOverlap destination) { return ((source == null) || STTblOverlap.NEVER.equals(source) ? destination : source); } public static STTblLayoutType apply(STTblLayoutType source, STTblLayoutType destination) { return ((source == null) || STTblLayoutType.AUTOFIT.equals(source) ? destination : source); } public static UnderlineEnumeration apply(UnderlineEnumeration source, UnderlineEnumeration destination) { return ((source == null) || UnderlineEnumeration.NONE.equals(source) ? destination : source); } public static STTextEffect apply(STTextEffect source, STTextEffect destination) { return ((source == null) || STTextEffect.NONE.equals(source) ? destination : source); } public static STEm apply(STEm source, STEm destination) { return ((source == null) || STEm.NONE.equals(source) ? destination : source); } public static STVerticalAlignRun apply(STVerticalAlignRun source, STVerticalAlignRun destination) { return ((source == null) || STVerticalAlignRun.BASELINE.equals(source) ? destination : source); } public static STVerticalJc apply(STVerticalJc source, STVerticalJc destination) { return ((source == null) || STVerticalJc.CENTER.equals(source) ? destination : source); } public static BooleanDefaultTrue apply(BooleanDefaultTrue source, BooleanDefaultTrue destination) { return (source == null ? destination : source); } public static Boolean apply(Boolean source, Boolean destination) { return (source == null ? destination : source); } // protected static BigInteger apply(BigInteger source, BigInteger destination) { // return (source == null || BigInteger.ZERO.equals(source) ? destination : source); // } // Need to honour eg <w:ind w:firstLine="0"/> protected static BigInteger apply(BigInteger source, BigInteger destination) { return (source == null ? destination : source); } protected static Integer apply(Integer source, Integer destination) { return (source == null || source.intValue() == 0 ? destination : source); } protected static String apply(String source, String destination) { return (source == null || source.length() == 0 ? destination : source); } }
[ "jason@plutext.org" ]
jason@plutext.org
bbf7d0f6ee8ab619bf4f8b6a7e1ff933bf844e3c
083f35664d6775b85fc99fac5b0212c4b5bfd412
/spring-node-2/src/main/java/com/spring/mybatis/realm/UserRealm.java
337cc8b7f7b32fbcb33ce25bfe816a6c7aa55416
[ "Apache-2.0" ]
permissive
tinybyhuang/sso-shiro-cas
a3f88a3f9ba8fd7e0469f9c6d786681630bfcf24
79950e926226abfe3be77d504f2a2979b08595f1
refs/heads/master
2023-04-18T11:03:28.186049
2023-04-10T06:35:32
2023-04-10T06:35:32
66,066,456
88
53
Apache-2.0
2023-04-10T06:35:33
2016-08-19T08:29:34
CSS
UTF-8
Java
false
false
1,967
java
package com.spring.mybatis.realm; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Resource; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.cas.CasRealm; import org.apache.shiro.subject.PrincipalCollection; import com.spring.mybatis.model.User; import com.spring.mybatis.service.RoleService; import com.spring.mybatis.service.UserService; /** * 用户授权信息域 * * @author coderhuang * */ public class UserRealm extends CasRealm { @Resource private RoleService roleService; @Resource private UserService userService; protected final Map<String, SimpleAuthorizationInfo> roles = new ConcurrentHashMap<String, SimpleAuthorizationInfo>(); /** * 设置角色和权限信息 */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { String account = (String) principals.getPrimaryPrincipal(); SimpleAuthorizationInfo authorizationInfo = null; if (authorizationInfo == null) { authorizationInfo = new SimpleAuthorizationInfo(); authorizationInfo.addStringPermissions(roleService.getPermissions(account)); authorizationInfo.addRoles(roleService.getRoles(account)); roles.put(account, authorizationInfo); } return authorizationInfo; } /** * 1、CAS认证 ,验证用户身份 * 2、将用户基本信息设置到会话中 */ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) { AuthenticationInfo authc = super.doGetAuthenticationInfo(token); String account = (String) authc.getPrincipals().getPrimaryPrincipal(); User user = userService.getUserByAccount(account); SecurityUtils.getSubject().getSession().setAttribute("user", user); return authc; } }
[ "wyu11080716@gmail.com" ]
wyu11080716@gmail.com
5ffbc8215fe0d72f5027a446c19d1b4c8e6a3a27
14d2ff6e1f74f7ceffe720f1630f92c8809206c8
/src/main/java/ex03/pymont/connector/http/HttpHeader.java
e4a28e9d7a9811f6d6b3a81f8ba5ca8e297222dd
[]
no_license
shiyanfei5/LearnTomcat
096c4d3055c3ae35497851dfdfb8e22b179380de
e30fcfd0c252badc34f4b577fa3bd5b7037764ad
refs/heads/master
2020-09-23T23:08:05.716525
2019-12-19T07:43:56
2019-12-19T07:43:56
225,610,766
0
0
null
null
null
null
UTF-8
Java
false
false
7,103
java
package ex03.pymont.connector.http; import util.StringManager; import java.io.IOException; /** * HTTP header enum type. * * @author Remy Maucherat * @version $Revision: 1.4 $ $Date: 2002/03/18 07:15:40 $ */ public final class HttpHeader { // -------------------------------------------------------------- Constants public static final int INITIAL_NAME_SIZE = 32; public static final int INITIAL_VALUE_SIZE = 64; public static final int MAX_NAME_SIZE = 128; public static final int MAX_VALUE_SIZE = 4096; //注册一个错误信息映射器 private static StringManager sm = new StringManager(Constants.Package); // ----------------------------------------------------------- Constructors public HttpHeader() { this(new char[INITIAL_NAME_SIZE], 0, new char[INITIAL_VALUE_SIZE], 0); } public HttpHeader(char[] name, int nameEnd, char[] value, int valueEnd) { this.name = name; this.nameEnd = nameEnd; this.value = value; this.valueEnd = valueEnd; } public HttpHeader(String name, String value) { this.name = name.toLowerCase().toCharArray(); this.nameEnd = name.length(); this.value = value.toCharArray(); this.valueEnd = value.length(); } // ----------------------------------------------------- Instance Variables /** * end标识 -1为空 */ public char[] name; public int nameEnd ; public char[] value; public int valueEnd; protected int hashCode = 0; // ------------------------------------------------------------- Properties // --------------------------------------------------------- Public Methods public void extendName(int rate) throws IOException{ if ((rate * name.length) <= HttpHeader.MAX_NAME_SIZE) { char[] newBuffer = new char[rate * name.length]; System.arraycopy(name, 0, newBuffer, 0, name.length); name = newBuffer; } else { throw new IOException (sm.getString("requestStream.readline.toolong")); } } public void extendValue(int rate) throws IOException{ if ((rate * value.length) <= HttpHeader.MAX_VALUE_SIZE) { char[] newBuffer = new char[rate * value.length]; System.arraycopy(value, 0, newBuffer, 0, value.length); value = newBuffer; } else { throw new IOException (sm.getString("requestStream.readline.toolong")); } } /** * Release all object references, and initialize instance variables, in * preparation for reuse of this object. */ public void recycle() { nameEnd = -1; valueEnd = -1; hashCode = 0; } /** * Test if the name of the header is equal to the given char array. * All the characters must already be lower case. */ public boolean equals(char[] buf) { return equals(buf, buf.length); } /** * Test if the name of the header is equal to the given char array. * All the characters must already be lower case. */ public boolean equals(char[] buf, int end) { if (end != nameEnd) return false; for (int i=0; i<end; i++) { if (buf[i] != name[i]) return false; } return true; } /** * Test if the name of the header is equal to the given string. * The String given must be made of lower case characters. */ public boolean equals(String str) { return equals(str.toCharArray(), str.length()); } /** * Test if the value of the header is equal to the given char array. */ public boolean valueEquals(char[] buf) { return valueEquals(buf, buf.length); } /** * Test if the value of the header is equal to the given char array. */ public boolean valueEquals(char[] buf, int end) { if (end != valueEnd) return false; for (int i=0; i<end; i++) { if (buf[i] != value[i]) return false; } return true; } /** * Test if the value of the header is equal to the given string. */ public boolean valueEquals(String str) { return valueEquals(str.toCharArray(), str.length()); } /** * Test if the value of the header includes the given char array. */ public boolean valueIncludes(char[] buf) { return valueIncludes(buf, buf.length); } /** * Test if the value of the header includes the given char array. */ public boolean valueIncludes(char[] buf, int end) { char firstChar = buf[0]; int pos = 0; while (pos < valueEnd) { pos = valueIndexOf(firstChar, pos); if (pos == -1) return false; if ((valueEnd - pos) < end) return false; for (int i = 0; i < end; i++) { if (value[i + pos] != buf[i]) break; if (i == (end-1)) return true; } pos++; } return false; } /** * Test if the value of the header includes the given string. */ public boolean valueIncludes(String str) { return valueIncludes(str.toCharArray(), str.length()); } /** * Returns the index of a character in the value. */ public int valueIndexOf(char c, int start) { for (int i=start; i<valueEnd; i++) { if (value[i] == c) return i; } return -1; } /** * Test if the name of the header is equal to the given header. * All the characters in the name must already be lower case. */ public boolean equals(HttpHeader header) { return (equals(header.name, header.nameEnd)); } /** * Test if the name and value of the header is equal to the given header. * All the characters in the name must already be lower case. */ public boolean headerEquals(HttpHeader header) { return (equals(header.name, header.nameEnd)) && (valueEquals(header.value, header.valueEnd)); } // --------------------------------------------------------- Object Methods /** * Return hash code. The hash code of the HttpHeader object is the same * as returned by new String(name, 0, nameEnd).hashCode(). */ public int hashCode() { int h = hashCode; if (h == 0) { int off = 0; char val[] = name; int len = nameEnd; for (int i = 0; i < len; i++) h = 31*h + val[off++]; hashCode = h; } return h; } public boolean equals(Object obj) { if (obj instanceof String) { return equals(((String) obj).toLowerCase()); } else if (obj instanceof HttpHeader) { return equals((HttpHeader) obj); } return false; } }
[ "13218016202@163.com" ]
13218016202@163.com
82600f764190e5979ea99797d9858811e44a8f98
ad6bea791ca9b0ff639f41a44a0856e64a0882dc
/relay-api/src/main/java/org/landcycle/json/AsiaMapper.java
34270c5d272a962fb4d620dfea6414dd16be8a21
[]
no_license
mv-relay/relay-service
6bb13dd1dacc3c18530f85b7b2c6008cb4475365
31d9cfb951f2c4014b3adfdac309131ef4ee8663
refs/heads/master
2016-09-09T20:14:09.500273
2014-10-28T21:10:20
2014-10-28T21:10:20
21,915,202
0
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
package org.landcycle.json; import org.codehaus.jackson.Version; import org.codehaus.jackson.map.Module; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig; import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; import org.codehaus.jackson.map.module.SimpleModule; /** * Estensione del mapper Jackson che permette di overridare il formato di I/O per le varie classi, oltre ad impedire la stampa di proprieta' a null. * * le istanze di questa classe si devono passare alla configurazione di spring-web (ed utilizzata direttamente da CommonUtils) * * @author gmicali * */ public class AsiaMapper extends ObjectMapper { public AsiaMapper() { super(); m_configure_defaults(); Module mod = m_configure_modules(); this.registerModule(mod); } /** * imposta i defaults in modo tale che non vengano stampate le properties a null; */ private void m_configure_defaults() { setSerializationInclusion(Inclusion.NON_NULL); configure(SerializationConfig.Feature.WRITE_NULL_MAP_VALUES, false); configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false); configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false); SerializationConfig serConfig = getSerializationConfig(); //serConfig.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); } /** * configura serializzatori/deserializzatori custom * * @return un modulo configurato; */ private SimpleModule m_configure_modules() { SimpleModule mod = new SimpleModule("AsiaMappers", Version.unknownVersion()); mod.addSerializer(new JsonBigDecimalSerializer()); return mod; } }
[ "valerio.artusi@livenxs.com" ]
valerio.artusi@livenxs.com
64e08213e896401281e44b305245b31d450db0aa
859150fe97394f812794617088021daf96df6e30
/src/test/java/examples/Growl.java
4ed30daa48c6466d012b9299c632da8555739cd6
[ "MIT" ]
permissive
sachinas/selenium_solution-
0450d40dd352692df87492567250c4795c4eaf16
f366c0b52887dcce23831632793cde95fe03e5dc
refs/heads/master
2021-04-17T06:11:26.372517
2018-03-23T03:22:08
2018-03-23T03:22:08
126,309,916
2
0
null
null
null
null
UTF-8
Java
false
false
2,024
java
package examples; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.firefox.FirefoxDriver; public class Growl { WebDriver driver; JavascriptExecutor js; @Before public void setUp() throws Exception { driver = new FirefoxDriver(); js = (JavascriptExecutor) driver; } @After public void tearDown() throws Exception { driver.quit(); } @Test public void growlTest() throws InterruptedException { driver.get("http://the-internet.herokuapp.com/"); // Check for jQuery on the page, add it if need be js.executeScript("if (!window.jQuery) {" + "var jquery = document.createElement('script'); jquery.type = 'text/javascript';" + "jquery.src = 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js';" + "document.getElementsByTagName('head')[0].appendChild(jquery);" + "}"); // Use jQuery to add jquery-growl to the page js.executeScript("$.getScript('http://the-internet.herokuapp.com/js/vendor/jquery.growl.js')"); // Use jQuery to add jquery-growl styles to the page js.executeScript("$('head').append('<link rel=\"stylesheet\" " + "href=\"http://the-internet.herokuapp.com/css/jquery.growl.css\" " + "type=\"text/css\" />');"); // jquery-growl w/ no frills js.executeScript("$.growl({ title: 'GET', message: '/' });"); // jquery-growl w/ colorized output js.executeScript("$.growl.error({ title: 'ERROR', message: 'your error message goes here' });"); js.executeScript("$.growl.notice({ title: 'Notice', message: 'your notice message goes here' });"); js.executeScript("$.growl.warning({ title: 'Warning!', message: 'your warning message goes here' });"); Thread.sleep(5000); } }
[ "sachin.sankangoudar@gmail.com" ]
sachin.sankangoudar@gmail.com
4a2634e84765738b76b93319b7950c865ce1e61f
812d8b9541e7621fe1de776912a5914eb190f9ab
/app/src/main/java/com/aurghyadip/librarymanagementlibrarian/ScanFragment.java
e5c11279833f6fd50adaf10bb2d4b37c15cd49df
[ "Apache-2.0" ]
permissive
shrestha23/library_management_librarian
b73232924a1a9a66f6d451e2320d9d94c1d5f6f2
8ee1a344baef9da4b82ef4edae4a1f5cb8c1bfab
refs/heads/master
2021-01-24T04:28:17.380944
2018-02-25T20:17:29
2018-02-25T20:17:29
122,938,545
0
0
null
2018-02-26T08:33:45
2018-02-26T08:33:44
null
UTF-8
Java
false
false
3,215
java
package com.aurghyadip.librarymanagementlibrarian; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.TextInputEditText; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; import com.basgeekball.awesomevalidation.AwesomeValidation; import com.basgeekball.awesomevalidation.ValidationStyle; import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; //TODO: Add data handling and Barcode Scanner public class ScanFragment extends Fragment { Button scanBooks; Button scanIsbn; TextInputEditText isbn; AwesomeValidation awesomeValidation; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_scan, container, false); scanBooks = rootView.findViewById(R.id.search_books); scanIsbn = rootView.findViewById(R.id.barcode_scan); isbn = rootView.findViewById(R.id.book_search_field); //Awesome validation block awesomeValidation = new AwesomeValidation(ValidationStyle.COLORATION); awesomeValidation.addValidation(isbn, "^(97(8|9))?\\d{9}(\\d|X)$", getString(R.string.isbn_error)); scanIsbn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { scanFromFragment(); } }); return rootView; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); scanBooks.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (awesomeValidation.validate()) { startBookDetailsActivity(isbn.getText().toString()); } } }); } private void scanFromFragment() { IntentIntegrator integrator = IntentIntegrator.forSupportFragment(this); integrator.setDesiredBarcodeFormats(IntentIntegrator.PRODUCT_CODE_TYPES); integrator.setBeepEnabled(true); integrator.setOrientationLocked(false); integrator.initiateScan(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if(result != null) { if(result.getContents() == null) { Toast.makeText(getActivity(), "No ISBN Found", Toast.LENGTH_SHORT).show(); } else { startBookDetailsActivity(result.getContents()); } } } private void startBookDetailsActivity(String isbnNumber) { Intent intent = new Intent(getActivity(), BookDetailsActivity.class); intent.putExtra("isbn", isbnNumber); startActivity(intent); } }
[ "adkundu@gmail.com" ]
adkundu@gmail.com
05564a8b6b30755f66ae5bc079a162b1eeb8f805
a526fb571c9003216e92e8ab3bb8617fdea8d29c
/hw6 copy/hw-voting-districts-master/src/main/java/CompositeDistrict.java
ba16a6be639fd7372c89369ce3a6562849fa00e9
[]
no_license
rgolding/cs1331HW
51dd1abf5bd2816fa6af0ed102c71d67dcb608dc
1acd0fd611dac34545dc6d0278022c6193fc33b7
refs/heads/master
2021-01-10T05:11:03.885129
2016-01-12T22:32:39
2016-01-12T22:32:39
49,533,141
0
1
null
null
null
null
UTF-8
Java
false
false
2,878
java
import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * Represents a Composite District * @author Rachel Golding * @version 1.0 Dec 4 2015 */ public class CompositeDistrict extends District { private District locals; // private String name; private ArrayList<District> dis; private Map<String, Integer> cans = new HashMap<>(); /** * Contructor for Local District * @param name String of name * @param dis ArrayList of districts */ public CompositeDistrict(String name, ArrayList<District> dis) { super(name); this.dis = dis; tallyVotes(); } /** * Gets Number of Districts * @return Size of dis arraylist */ public int getNumDis() { return dis.size(); } /** * Gets Number of Voters of District * @return voters Size of voters arraylist */ public int getNumVoters() { int voters = 0; for (District d : dis) { voters = d.getNumVoters(); } return voters; } /* public String getWinner() { HashMap<String, Integer> map = new HashMap<>(); for (District d : dis) { String[] districts = d.getVotes(); for (int i = 0; i < 3; i++) { if (map.containsKey(votes[i])) { int oldVotes = map.get(votes[i]); int newVotes = oldVotes + (3 - i); map.put(votes[i], newVotes); } else { map.put(votes[i], (3-i)); } } } String winner = null; for (String c : map.keySet()) { if (winner == null) { winner = c; } else if (map.get(c) > map.get(winner)) { winner = c; } } return winner; } */ /** * Gets number of votes from each district */ public void tallyVotes() { for (District d : dis) { int voters = d.getNumVoters(); String c = d.getWinner(); if (!cans.containsKey(c)) { cans.put(c, voters); } else { cans.put(c, voters + cans.get(c)); } } } /** * Gets Winner of District * @return winner String of winner */ public String getWinner() { String winner = null; //System.out.println(winner); //System.out.println(cans.keySet()) for (String can : cans.keySet()) { //System.out.println(can); if (winner == null) { winner = can; //System.out.println(can); } else { int value = cans.get(can); if (value > cans.get(winner)) { winner = can; //System.out.println(can); } } } return winner; } }
[ "golding.rh@gmail.com" ]
golding.rh@gmail.com
abda9bd647ed3011b36019662f4b24ab982e8d9f
968414b517bac6f20b37528df839e057f4a130e0
/6-spring/workspace/myworkspace/src/main/java/com/git/myworkspace/contact/Contact.java
368ffdbdc9700e2789baf5ff8de4357e550c189f
[]
no_license
noeahrin/git2021-working
7af0609a5eb1f86c40cfcfd007dccfb847e10eb5
4527907c7992d734b5bb5514bec84dd598189bfe
refs/heads/master
2023-08-28T10:23:02.348994
2021-11-07T07:09:36
2021-11-07T07:09:36
390,923,723
0
0
null
null
null
null
UHC
Java
false
false
1,218
java
package com.git.myworkspace.contact; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @NoArgsConstructor @AllArgsConstructor //Spring Data JPA(Java Persistence API, 자바 영속화 API) //영속화: 휘발성 데이터 -> 비휘발성 장치 // 자바 객체(RAM) -> 테이블 레코드(파일내부의 특정값) //ORM(Object Relational Mapping) //: 객체를 테이블과 맵핑한 것 말함 //1. 객체 지향으로 개발할 수 있게함(소프트웨어공학) //2. 특정 DB에 종속되지 않게함 //@Entity: 테이블과 클래스를 맵핑함 //기본방법은 Photo(pascal-case) -> photo(snake-case) @Entity public class Contact { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(columnDefinition = "VARCHAR(1000)") private String memo; // BLOB: binary large object @Column(columnDefinition = "TEXT") private String name; private String phone; private String email; private long createdTime; }
[ "noeahrin@gmail.com" ]
noeahrin@gmail.com
374c7be1c1f2fac2264f71b39b3782026c6ad8e9
0f717b6ed8954da1367bfbf210a7c5095fc01430
/Exercises/src/ru/schepin/otherExercises/StaticBlock.java
aa75ebd739b7293dc205377cb9c61ef0c0a01e4f
[]
no_license
dmitry1308/JavaRush
4f623a371088d65e2304f6076be3e4fe55421c62
95db841b75a91cbbb5cddb89bf9532863fb537a4
refs/heads/master
2021-09-02T23:55:13.443132
2018-01-04T05:28:09
2018-01-04T05:28:09
110,952,221
0
0
null
null
null
null
UTF-8
Java
false
false
297
java
package ru.schepin.otherExercises; public class StaticBlock { static int a = 5; static int b = 6; static int c = 6; static { c = a + b; System.out.println(c); } public static void main(String[] args) { System.out.println("Hello world!"); } }
[ "bright1308@gmail.com" ]
bright1308@gmail.com
5f7555ffb3259872fdcc9e3df025cb702d6a3f04
d095684d1e59a0816b1495d80e1d4c8360c2e1a5
/build/generated/src/org/apache/jsp/heartattack4_jsp.java
0e85eec20c05723080c71c99c3e8a0befdbdc947
[]
no_license
rish8795/Cardiac-Countermeasure
911f872e285c0dc2f1b34930a471d89e456cb2f8
5efd51fe85267d98b411ff81249eeb8836623765
refs/heads/master
2021-01-11T14:55:37.306447
2019-03-02T21:33:04
2019-03-02T21:33:04
80,250,213
0
0
null
null
null
null
UTF-8
Java
false
false
23,636
java
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class heartattack4_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List<String> _jspx_dependants; private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector; public java.util.List<String> getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write('\n'); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!DOCTYPE html>\n"); out.write("<html lang=\"en\">\n"); out.write(" <head>\n"); out.write(" \n"); out.write(" <!-- Basic Page Needs\n"); out.write(" ================================================== -->\n"); out.write(" <meta charset=\"utf-8\">\n"); out.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"); out.write(" <title>CARDIAC COUNTERMEASURE :Heart-attack Detection</title>\n"); out.write("\n"); out.write(" <!-- Mobile Specific Metas\n"); out.write(" ================================================== -->\n"); out.write(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"); out.write("\n"); out.write(" <!-- Favicon -->\n"); out.write(" <link rel=\"shortcut icon\" type=\"image/icon\" href=\"images/favicon.ico\"/>\n"); out.write("\n"); out.write(" <!-- CSS\n"); out.write(" ================================================== --> \n"); out.write(" <!-- Bootstrap css file-->\n"); out.write(" <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n"); out.write(" <!-- Font awesome css file-->\n"); out.write(" <link href=\"css/font-awesome.min.css\" rel=\"stylesheet\"> \n"); out.write(" <!-- Default Theme css file -->\n"); out.write(" <link id=\"switcher\" href=\"css/themes/default-theme.css\" rel=\"stylesheet\"> \n"); out.write(" <!-- Slick slider css file -->\n"); out.write(" <link href=\"css/slick.css\" rel=\"stylesheet\"> \n"); out.write(" <!-- Photo Swipe Image Gallery --> \n"); out.write(" <link rel='stylesheet prefetch' href='css/photoswipe.css'>\n"); out.write(" <link rel='stylesheet prefetch' href='css/default-skin.css'> \n"); out.write("\n"); out.write(" <!-- Main structure css file -->\n"); out.write(" <link href=\"style.css\" rel=\"stylesheet\">\n"); out.write(" \n"); out.write(" <!-- Google fonts -->\n"); out.write(" <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> \n"); out.write(" <link href='http://fonts.googleapis.com/css?family=Habibi' rel='stylesheet' type='text/css'> \n"); out.write(" <link href='http://fonts.googleapis.com/css?family=Cinzel+Decorative:900' rel='stylesheet' type='text/css'>\n"); out.write("\n"); out.write(" <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->\n"); out.write(" <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n"); out.write(" <!--[if lt IE 9]>\n"); out.write(" <script src=\"https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js\"></script>\n"); out.write(" <script src=\"https://oss.maxcdn.com/respond/1.4.2/respond.min.js\"></script>\n"); out.write(" <![endif]--> \n"); out.write(" <meta name=\"description\" content=\"chart created using amCharts live editor\" />\n"); out.write("\n"); out.write("\t\t<!-- amCharts custom font -->\n"); out.write("\t\t<link href='http://fonts.googleapis.com/css?family=Covered+By+Your+Grace' rel='stylesheet' type='text/css'>\n"); out.write("\n"); out.write("\t\t<!-- amCharts javascript sources -->\n"); out.write("\t\t<script type=\"text/javascript\" src=\"http://www.amcharts.com/lib/3/amcharts.js\"></script>\n"); out.write("\t\t<script type=\"text/javascript\" src=\"http://cdn.amcharts.com/lib/3/gauge.js\"></script>\n"); out.write("\t\t<script type=\"text/javascript\" src=\"http://www.amcharts.com/lib/3/themes/chalk.js\"></script>\n"); out.write("\n"); out.write("\t\t<!-- amCharts javascript code -->\n"); out.write("\t\t<script type=\"text/javascript\">\n"); out.write("\t\t\tAmCharts.makeChart(\"chartdiv\",\n"); out.write("\t\t\t\t{\n"); out.write("\t\t\t\t\t\"type\": \"gauge\",\n"); out.write("\t\t\t\t\t\"clockWiseOnly\": true,\n"); out.write("\t\t\t\t\t\"faceBorderColor\": \"#FF8000\",\n"); out.write("\t\t\t\t\t\"faceBorderWidth\": 0,\n"); out.write("\t\t\t\t\t\"gaugeX\": 421,\n"); out.write("\t\t\t\t\t\"gaugeY\": 206,\n"); out.write("\t\t\t\t\t\"marginTop\": 90,\n"); out.write("\t\t\t\t\t\"minRadius\": 29,\n"); out.write("\t\t\t\t\t\"startDuration\": 6,\n"); out.write("\t\t\t\t\t\"startEffect\": \"bounce\",\n"); out.write("\t\t\t\t\t\"autoDisplay\": true,\n"); out.write("\t\t\t\t\t\"backgroundColor\": \"#f7f7f7\",\n"); out.write("\t\t\t\t\t\"classNamePrefix\": \"CC\",\n"); out.write("\t\t\t\t\t\"color\": \"#ff0000\",\n"); out.write("\t\t\t\t\t\"fontSize\": 20,\n"); out.write("\t\t\t\t\t\"handDrawScatter\": 1,\n"); out.write("\t\t\t\t\t\"handDrawThickness\": 3,\n"); out.write("\t\t\t\t\t\"path\": \"CC/\",\n"); out.write("\t\t\t\t\t\"theme\": \"chalk\",\n"); out.write("\t\t\t\t\t\"arrows\": [\n"); out.write("\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\"alpha\": 0,\n"); out.write("\t\t\t\t\t\t\t\"axis\": \"GaugeAxis-1\",\n"); out.write("\t\t\t\t\t\t\t\"color\": \"#333\",\n"); out.write("\t\t\t\t\t\t\t\"id\": \"GaugeArrow-1\",\n"); out.write("\t\t\t\t\t\t\t\"innerRadius\": 21,\n"); out.write("\t\t\t\t\t\t\t\"radius\": \"88%\",\n"); out.write("\t\t\t\t\t\t\t\"startWidth\": 30,\n"); out.write("\t\t\t\t\t\t\t\"value\": 15\n"); out.write("\t\t\t\t\t\t}\n"); out.write("\t\t\t\t\t],\n"); out.write("\t\t\t\t\t\"axes\": [\n"); out.write("\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\"bottomText\": \"15.00 %\",\n"); out.write("\t\t\t\t\t\t\t\"bottomTextYOffset\": -20,\n"); out.write("\t\t\t\t\t\t\t\"endValue\": 100,\n"); out.write("\t\t\t\t\t\t\t\"id\": \"GaugeAxis-1\",\n"); out.write("\t\t\t\t\t\t\t\"valueInterval\": 10,\n"); out.write("\t\t\t\t\t\t\t\"bands\": [\n"); out.write("\t\t\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\t\t\"alpha\": 0.7,\n"); out.write("\t\t\t\t\t\t\t\t\t\"color\": \"#00CC00\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"endValue\": 30,\n"); out.write("\t\t\t\t\t\t\t\t\t\"id\": \"GaugeBand-1\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"startValue\": 0\n"); out.write("\t\t\t\t\t\t\t\t},\n"); out.write("\t\t\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\t\t\"alpha\": 0.7,\n"); out.write("\t\t\t\t\t\t\t\t\t\"color\": \"#F9F900\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"endValue\": 70,\n"); out.write("\t\t\t\t\t\t\t\t\t\"id\": \"GaugeBand-2\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"startValue\": 31\n"); out.write("\t\t\t\t\t\t\t\t},\n"); out.write("\t\t\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\t\t\"alpha\": 0.7,\n"); out.write("\t\t\t\t\t\t\t\t\t\"color\": \"#ea3838\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"endValue\": 100,\n"); out.write("\t\t\t\t\t\t\t\t\t\"id\": \"GaugeBand-3\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"innerRadius\": \"95%\",\n"); out.write("\t\t\t\t\t\t\t\t\t\"startValue\": 71\n"); out.write("\t\t\t\t\t\t\t\t},\n"); out.write("\t\t\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\t\t\"id\": \"GaugeBand-4\"\n"); out.write("\t\t\t\t\t\t\t\t}\n"); out.write("\t\t\t\t\t\t\t]\n"); out.write("\t\t\t\t\t\t}\n"); out.write("\t\t\t\t\t],\n"); out.write("\t\t\t\t\t\"allLabels\": [\n"); out.write("\t\t\t\t\t\t{\n"); out.write("\t\t\t\t\t\t\t\"align\": \"center\",\n"); out.write("\t\t\t\t\t\t\t\"alpha\": 0.9,\n"); out.write("\t\t\t\t\t\t\t\"color\": \"#FF8000\",\n"); out.write("\t\t\t\t\t\t\t\"id\": \"Label-1\",\n"); out.write("\t\t\t\t\t\t\t\"size\": 25,\n"); out.write("\t\t\t\t\t\t\t\"text\": \"Heart-Attack Meter\",\n"); out.write("\t\t\t\t\t\t\t\"x\": -90,\n"); out.write("\t\t\t\t\t\t\t\"y\": 21\n"); out.write("\t\t\t\t\t\t}\n"); out.write("\t\t\t\t\t],\n"); out.write("\t\t\t\t\t\"balloon\": {\n"); out.write("\t\t\t\t\t\t\"animationDuration\": 0.66,\n"); out.write("\t\t\t\t\t\t\"color\": \"#FF8000\",\n"); out.write("\t\t\t\t\t\t\"fadeOutDuration\": 0.76\n"); out.write("\t\t\t\t\t},\n"); out.write("\t\t\t\t\t\"titles\": []\n"); out.write("\t\t\t\t}\n"); out.write("\t\t\t);\n"); out.write("\t\t</script>\n"); out.write(" </head>\n"); out.write(" <body> \n"); out.write(" <!-- BEGAIN PRELOADER -->\n"); out.write(" <div id=\"preloader\">\n"); out.write(" <div id=\"status\">&nbsp;</div>\n"); out.write(" </div>\n"); out.write(" <!-- END PRELOADER -->\n"); out.write("\n"); out.write(" <!-- SCROLL TOP BUTTON -->\n"); out.write(" <a class=\"scrollToTop\" href=\"#\"><i class=\"fa fa-heartbeat\"></i></a>\n"); out.write(" <!-- END SCROLL TOP BUTTON -->\n"); out.write("\n"); out.write(" <!--=========== BEGIN HEADER SECTION ================-->\n"); out.write(" <header id=\"header\">\n"); out.write(" <!-- BEGIN MENU -->\n"); out.write(" <div class=\"menu_area\">\n"); out.write(" <nav class=\"navbar navbar-default navbar-fixed-top\" role=\"navigation\"> \n"); out.write(" <div class=\"container\">\n"); out.write(" <div class=\"navbar-header\">\n"); out.write(" <!-- FOR MOBILE VIEW COLLAPSED BUTTON -->\n"); out.write(" <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n"); out.write(" <span class=\"sr-only\">Toggle navigation</span>\n"); out.write(" <span class=\"icon-bar\"></span>\n"); out.write(" <span class=\"icon-bar\"></span>\n"); out.write(" <span class=\"icon-bar\"></span>\n"); out.write(" </button>\n"); out.write(" <!-- LOGO --> \n"); out.write(" <!-- TEXT BASED LOGO -->\n"); out.write(" <a class=\"navbar-brand\" href=\"home.jsp\"><i class=\"fa fa-heartbeat\"></i><span style=\"font-family: cursive\">CARDIAC COUNTERMEASURE</span></a> \n"); out.write(" <!-- IMG BASED LOGO -->\n"); out.write(" <!-- <a class=\"navbar-brand\" href=\"index.html\"><img src=\"images/logo.png\" alt=\"logo\"></a> --> \n"); out.write(" </div>\n"); out.write(" <div id=\"navbar\" class=\"navbar-collapse collapse\">\n"); out.write(" <ul id=\"top-menu\" class=\"nav navbar-nav navbar-right main-nav\">\n"); out.write(" <li class=\"active\"><a href=\"index.html\">Home</a></li>\n"); out.write(" \n"); out.write(" <li class=\"dropdown\">\n"); out.write(" <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\">Services <span class=\"fa fa-angle-down\"></span></a>\n"); out.write(" <ul class=\"dropdown-menu\" role=\"menu\">\n"); out.write(" <li><a href=\"medical-counseling.html\">Heart-attack detection</a></li>\n"); out.write(" <li><a href=\"medical-research.html\">Consult Cariac</a></li>\n"); out.write(" <li><a href=\"blood-bank.html\">Laboratory test</a></li>\n"); out.write(" </ul>\n"); out.write(" </li>\n"); out.write(" \n"); out.write(" \n"); out.write(" <li><a href=\"blog-archive-with-left-sidebar.html\">Blogs</a></li>\n"); out.write(" <li><a href=\"features.html\">FAQs</a></li>\n"); out.write(" <li><a href=\"contact.html\">Contact Us</a></li>\n"); out.write(" <li><a href=\"features.html\">My Profile</a></li>\n"); out.write(" </ul> \n"); out.write(" </div><!--/.nav-collapse -->\n"); out.write(" </div> \n"); out.write(" </nav> \n"); out.write(" </div>\n"); out.write(" <!-- END MENU --> \n"); out.write(" </header>\n"); out.write(" \n"); out.write(" <section id=\"blogArchive\"> \n"); out.write(" <div class=\"row\">\n"); out.write(" <div class=\"col-lg-12 col-md-12\">\n"); out.write(" <div class=\"blog-breadcrumbs-area\">\n"); out.write(" <div class=\"container\">\n"); out.write(" <div class=\"blog-breadcrumbs-left\">\n"); out.write(" <h2>Heart-attack Detection</h2>\n"); out.write(" </div>\n"); out.write(" <div class=\"blog-breadcrumbs-right\">\n"); out.write(" <ol class=\"breadcrumb\">\n"); out.write(" <li>You are here</li>\n"); out.write(" <li><a href=\"#\">Home</a></li> \n"); out.write(" <li class=\"active\">Heart-attack Detection</li>\n"); out.write(" </ol>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div> \n"); out.write(" </div> \n"); out.write(" </section>\n"); out.write(" \n"); out.write("\n"); out.write(" \n"); out.write(" <!--=========== BEGIN Heart-attack detection SECTION ================-->\n"); out.write(" <section id=\"whychooseSection\">\n"); out.write(" <div style=\"width: 37%;\n"); out.write(" float: right;\n"); out.write(" padding: 100px;\n"); out.write(" margin-left: 80px;\n"); out.write(" font-size: 33px;\n"); out.write(" color: initial;\">\n"); out.write(" <h1 style=\"color:#31708F;\"> <u>Factors</u></h1></br>\n"); out.write(" <p style=\"color: darkorange;\">Do your father ever have an heart-attack after passing age of 60?</p>\n"); out.write(" <input type=\"radio\" name=\"radio\" value=\"\" checked=\"checked\" style=\"color: red\" /> Yes<br>\n"); out.write(" <input type=\"radio\" name=\"radio\" value=\"\" style=\"color: green\" /> No\n"); out.write(" </div>\n"); out.write(" <div class=\"container\">\n"); out.write(" \n"); out.write(" \t<div id=\"chartdiv\" style=\"width: 57%; height: 367px; background-color: rgb(247, 247, 247);\" >\n"); out.write(" \n"); out.write(" </div>\n"); out.write(" \n"); out.write(" </div>\n"); out.write(" </section>\n"); out.write(" <!--=========== END Heart-attack detection SECTION ================-->\n"); out.write(" \n"); out.write(" <!--=========== Start Footer SECTION ================-->\n"); out.write(" <footer id=\"footer\">\n"); out.write(" <!-- Start Footer Top -->\n"); out.write(" <div class=\"footer-top\">\n"); out.write(" <div class=\"container\">\n"); out.write(" <div class=\"row\">\n"); out.write(" <div class=\"col-lg-3 col-md-3 col-sm-3\">\n"); out.write(" <div class=\"single-footer-widget\">\n"); out.write(" <div class=\"section-heading\">\n"); out.write(" <h2>About Us</h2>\n"); out.write(" <div class=\"line\"></div>\n"); out.write(" </div> \n"); out.write(" <p> 'Cardiac Countermeasure' is a link between the Artificial Intelligence Cardiac System and the needy patient. It provides the person with a detailed list of Factors and functions related to heart-attack and after the user provides the correct information then System will generate the chances of the person of having heart-attack. Not only that after the system based report is generated it also provides the further asylum to the user for consulting laboratory as well as cardiologist.</p>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" <div class=\"col-lg-5 col-md-5 col-sm-5\">\n"); out.write(" \n"); out.write(" </div>\n"); out.write(" <div class=\"col-lg-3 col-md-3 col-sm-3\">\n"); out.write(" <div class=\"single-footer-widget\">\n"); out.write(" <div class=\"col-lg-3 col-md-3 col-sm-3\">\n"); out.write(" <div class=\"single-footer-widget\">\n"); out.write(" <div class=\"section-heading\">\n"); out.write(" <h2>Contact Info</h2>\n"); out.write(" <div class=\"line\"></div>\n"); out.write(" </div>\n"); out.write(" <p>Feel free to contact us at any time for suggestions or complaints</p>\n"); out.write(" <address class=\"contact-info\">\n"); out.write(" <p><span class=\"fa fa-home\"></span>305 Satyam mall,\n"); out.write(" jodhpur,Ahmedabad</p>\n"); out.write(" <p><span class=\"fa fa-phone\"></span>+919974911232</p>\n"); out.write(" <p><span class=\"fa fa-envelope\"></span>info@Cardiaccountermeasure.com</p>\n"); out.write(" </address>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" <!-- Start Footer Middle -->\n"); out.write(" <div class=\"footer-middle\">\n"); out.write(" <div class=\"container\">\n"); out.write(" <div class=\"row\">\n"); out.write(" <div class=\"col-lg-6 col-md-6 col-sm-6 col-xs-12\">\n"); out.write(" <div class=\"footer-copyright\">\n"); out.write(" <p>&copy; Copyright 2015 <a href=\"index.html\">R&J</a></p>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" <div class=\"col-lg-6 col-md-6 col-sm-6 col-xs-12\">\n"); out.write(" <div class=\"footer-social\"> \n"); out.write(" <a href=\"#\"><span class=\"fa fa-facebook\"></span></a>\n"); out.write(" <a href=\"#\"><span class=\"fa fa-twitter\"></span></a>\n"); out.write(" <a href=\"#\"><span class=\"fa fa-google-plus\"></span></a>\n"); out.write(" <a href=\"#\"><span class=\"fa fa-linkedin\"></span></a> \n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" <!-- Start Footer Bottom -->\n"); out.write(" <div class=\"footer-bottom\">\n"); out.write(" <div class=\"container\">\n"); out.write(" <div class=\"row\">\n"); out.write(" <div class=\"col-md-12\">\n"); out.write(" <p>Design & Developed By <a rel=\"nofollow\" href=\"https://www.facebook.com/rishabh.shah.18\"> R&J</a></p>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </div>\n"); out.write(" </footer>\n"); out.write(" <!--=========== End Footer SECTION ================-->\n"); out.write("\n"); out.write(" <!-- jQuery Library -->\n"); out.write(" <script src=\"js/jquery.js\"></script> \n"); out.write(" <!-- Bootstrap default js -->\n"); out.write(" <script src=\"js/bootstrap.min.js\"></script>\n"); out.write(" <!-- slick slider -->\n"); out.write(" <script src=\"js/slick.min.js\"></script> \n"); out.write(" <script type=\"text/javascript\" src=\"js/modernizr.custom.79639.js\"></script> \n"); out.write(" <!-- counter -->\n"); out.write(" <script src=\"js/waypoints.min.js\"></script>\n"); out.write(" <script src=\"js/jquery.counterup.min.js\"></script>\n"); out.write(" <!-- Doctors hover effect -->\n"); out.write(" <script src=\"js/snap.svg-min.js\"></script>\n"); out.write(" <script src=\"js/hovers.js\"></script>\n"); out.write(" <!-- Photo Swipe Gallery Slider -->\n"); out.write(" <script src='js/photoswipe.min.js'></script>\n"); out.write(" <script src='js/photoswipe-ui-default.min.js'></script> \n"); out.write(" <script src=\"js/photoswipe-gallery.js\"></script>\n"); out.write("\n"); out.write(" <!-- Custom JS -->\n"); out.write(" <script src=\"js/custom.js\"></script>\n"); out.write(" \n"); out.write(" </body>\n"); out.write("</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "rish8795@gmail.com" ]
rish8795@gmail.com
3210c4a6dbceec481b8232f340e80f08dbcc5b0a
a786b01bff0f4c99fd712795ad7ca738114fc122
/app/src/main/java/com/piper/hackernews/ServiceCallback.java
82a5c9460b106b28ff97b189f716aa9d3b621812
[]
no_license
partha4u21/HackerNews_Omnify
24739d8ae6bf5ac1aa0c6933276328fe9c596239
0343da86772df360760c46cce4090b9d94006e1e
refs/heads/master
2020-03-31T08:25:54.009300
2018-10-08T09:42:08
2018-10-08T09:42:08
152,056,816
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
package com.piper.hackernews; /** * Created by parthamurmu on 09/09/17. */ public interface ServiceCallback { void updateAdapter(); }
[ "partha4u21@gmail.com" ]
partha4u21@gmail.com
23db73f3f096059beaa10b969c0c9162e5d89ac6
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/lucene-solr/2015/8/FieldQueryTest.java
fba2858cb203abc04bc3bbf5ab567ffda4df3b2f
[ "Apache-2.0" ]
permissive
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
35,202
java
package org.apache.lucene.search.vectorhighlight; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.Filter; import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.RegexpQuery; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TermRangeQuery; import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.search.vectorhighlight.FieldQuery.QueryPhraseMap; import org.apache.lucene.search.vectorhighlight.FieldTermStack.TermInfo; import org.apache.lucene.util.Bits; import org.apache.lucene.util.BytesRef; public class FieldQueryTest extends AbstractTestCase { private float boost; /** * Set boost to a random value each time it is called. */ private void initBoost() { boost = usually() ? 1F : random().nextFloat() * 10000; } public void testFlattenBoolean() throws Exception { initBoost(); BooleanQuery.Builder booleanQueryB = new BooleanQuery.Builder(); booleanQueryB.add(tq("A"), Occur.MUST); booleanQueryB.add(tq("B"), Occur.MUST); booleanQueryB.add(tq("C"), Occur.SHOULD); BooleanQuery.Builder innerQuery = new BooleanQuery.Builder(); innerQuery.add(tq("D"), Occur.MUST); innerQuery.add(tq("E"), Occur.MUST); booleanQueryB.add(innerQuery.build(), Occur.MUST_NOT); BooleanQuery booleanQuery = booleanQueryB.build(); booleanQuery.setBoost(boost); FieldQuery fq = new FieldQuery(booleanQuery, true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten(booleanQuery, reader, flatQueries); assertCollectionQueries( flatQueries, tq( boost, "A" ), tq( boost, "B" ), tq( boost, "C" ) ); } public void testFlattenDisjunctionMaxQuery() throws Exception { initBoost(); Query query = dmq( tq( "A" ), tq( "B" ), pqF( "C", "D" ) ); query.setBoost( boost ); FieldQuery fq = new FieldQuery( query, true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten( query, reader, flatQueries ); assertCollectionQueries( flatQueries, tq( boost, "A" ), tq( boost, "B" ), pqF( boost, "C", "D" ) ); } public void testFlattenTermAndPhrase() throws Exception { initBoost(); BooleanQuery.Builder booleanQueryB = new BooleanQuery.Builder(); booleanQueryB.add(tq("A"), Occur.MUST); booleanQueryB.add(pqF("B", "C"), Occur.MUST); BooleanQuery booleanQuery = booleanQueryB.build(); booleanQuery.setBoost(boost); FieldQuery fq = new FieldQuery(booleanQuery, true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten(booleanQuery, reader, flatQueries); assertCollectionQueries( flatQueries, tq( boost, "A" ), pqF( boost, "B", "C" ) ); } public void testFlattenTermAndPhrase2gram() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add(new TermQuery(new Term(F, "AA")), Occur.MUST); query.add(toPhraseQuery(analyze("BCD", F, analyzerB), F), Occur.MUST); query.add(toPhraseQuery(analyze("EFGH", F, analyzerB), F), Occur.SHOULD); FieldQuery fq = new FieldQuery( query.build(), true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten( query.build(), reader, flatQueries ); assertCollectionQueries( flatQueries, tq( "AA" ), pqF( "BC", "CD" ), pqF( "EF", "FG", "GH" ) ); } public void testFlatten1TermPhrase() throws Exception { Query query = pqF( "A" ); FieldQuery fq = new FieldQuery( query, true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten( query, reader, flatQueries ); assertCollectionQueries( flatQueries, tq( "A" ) ); } public void testExpand() throws Exception { Query dummy = pqF( "DUMMY" ); FieldQuery fq = new FieldQuery( dummy, true, true ); // "a b","b c" => "a b","b c","a b c" Set<Query> flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( pqF( "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), pqF( "b", "c" ), pqF( "a", "b", "c" ) ); // "a b","b c d" => "a b","b c d","a b c d" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( pqF( "b", "c", "d" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), pqF( "b", "c", "d" ), pqF( "a", "b", "c", "d" ) ); // "a b c","b c d" => "a b c","b c d","a b c d" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b", "c" ) ); flatQueries.add( pqF( "b", "c", "d" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b", "c" ), pqF( "b", "c", "d" ), pqF( "a", "b", "c", "d" ) ); // "a b c","c d e" => "a b c","c d e","a b c d e" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b", "c" ) ); flatQueries.add( pqF( "c", "d", "e" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b", "c" ), pqF( "c", "d", "e" ), pqF( "a", "b", "c", "d", "e" ) ); // "a b c d","b c" => "a b c d","b c" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b", "c", "d" ) ); flatQueries.add( pqF( "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b", "c", "d" ), pqF( "b", "c" ) ); // "a b b","b c" => "a b b","b c","a b b c" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b", "b" ) ); flatQueries.add( pqF( "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b", "b" ), pqF( "b", "c" ), pqF( "a", "b", "b", "c" ) ); // "a b","b a" => "a b","b a","a b a", "b a b" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( pqF( "b", "a" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), pqF( "b", "a" ), pqF( "a", "b", "a" ), pqF( "b", "a", "b" ) ); // "a b","a b c" => "a b","a b c" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( pqF( "a", "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), pqF( "a", "b", "c" ) ); } public void testNoExpand() throws Exception { Query dummy = pqF( "DUMMY" ); FieldQuery fq = new FieldQuery( dummy, true, true ); // "a b","c d" => "a b","c d" Set<Query> flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( pqF( "c", "d" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), pqF( "c", "d" ) ); // "a","a b" => "a", "a b" flatQueries = new HashSet<>(); flatQueries.add( tq( "a" ) ); flatQueries.add( pqF( "a", "b" ) ); assertCollectionQueries( fq.expand( flatQueries ), tq( "a" ), pqF( "a", "b" ) ); // "a b","b" => "a b", "b" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( tq( "b" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), tq( "b" ) ); // "a b c","b c" => "a b c","b c" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b", "c" ) ); flatQueries.add( pqF( "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b", "c" ), pqF( "b", "c" ) ); // "a b","a b c" => "a b","a b c" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b" ) ); flatQueries.add( pqF( "a", "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b" ), pqF( "a", "b", "c" ) ); // "a b c","b d e" => "a b c","b d e" flatQueries = new HashSet<>(); flatQueries.add( pqF( "a", "b", "c" ) ); flatQueries.add( pqF( "b", "d", "e" ) ); assertCollectionQueries( fq.expand( flatQueries ), pqF( "a", "b", "c" ), pqF( "b", "d", "e" ) ); } public void testExpandNotFieldMatch() throws Exception { Query dummy = pqF( "DUMMY" ); FieldQuery fq = new FieldQuery( dummy, true, false ); // f1:"a b",f2:"b c" => f1:"a b",f2:"b c",f1:"a b c" Set<Query> flatQueries = new HashSet<>(); flatQueries.add( pq( F1, "a", "b" ) ); flatQueries.add( pq( F2, "b", "c" ) ); assertCollectionQueries( fq.expand( flatQueries ), pq( F1, "a", "b" ), pq( F2, "b", "c" ), pq( F1, "a", "b", "c" ) ); } public void testGetFieldTermMap() throws Exception { Query query = tq( "a" ); FieldQuery fq = new FieldQuery( query, true, true ); QueryPhraseMap pqm = fq.getFieldTermMap( F, "a" ); assertNotNull( pqm ); assertTrue( pqm.isTerminal() ); pqm = fq.getFieldTermMap( F, "b" ); assertNull( pqm ); pqm = fq.getFieldTermMap( F1, "a" ); assertNull( pqm ); } public void testGetRootMap() throws Exception { Query dummy = pqF( "DUMMY" ); FieldQuery fq = new FieldQuery( dummy, true, true ); QueryPhraseMap rootMap1 = fq.getRootMap( tq( "a" ) ); QueryPhraseMap rootMap2 = fq.getRootMap( tq( "a" ) ); assertTrue( rootMap1 == rootMap2 ); QueryPhraseMap rootMap3 = fq.getRootMap( tq( "b" ) ); assertTrue( rootMap1 == rootMap3 ); QueryPhraseMap rootMap4 = fq.getRootMap( tq( F1, "b" ) ); assertFalse( rootMap4 == rootMap3 ); } public void testGetRootMapNotFieldMatch() throws Exception { Query dummy = pqF( "DUMMY" ); FieldQuery fq = new FieldQuery( dummy, true, false ); QueryPhraseMap rootMap1 = fq.getRootMap( tq( "a" ) ); QueryPhraseMap rootMap2 = fq.getRootMap( tq( "a" ) ); assertTrue( rootMap1 == rootMap2 ); QueryPhraseMap rootMap3 = fq.getRootMap( tq( "b" ) ); assertTrue( rootMap1 == rootMap3 ); QueryPhraseMap rootMap4 = fq.getRootMap( tq( F1, "b" ) ); assertTrue( rootMap4 == rootMap3 ); } public void testGetTermSet() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add(new TermQuery(new Term(F, "A")), Occur.MUST); query.add(new TermQuery(new Term(F, "B")), Occur.MUST); query.add(new TermQuery(new Term("x", "C")), Occur.SHOULD); BooleanQuery.Builder innerQuery = new BooleanQuery.Builder(); innerQuery.add(new TermQuery(new Term(F, "D")), Occur.MUST); innerQuery.add(new TermQuery(new Term(F, "E")), Occur.MUST); query.add(innerQuery.build(), Occur.MUST_NOT); FieldQuery fq = new FieldQuery( query.build(), true, true ); assertEquals( 2, fq.termSetMap.size() ); Set<String> termSet = fq.getTermSet( F ); assertEquals( 2, termSet.size() ); assertTrue( termSet.contains( "A" ) ); assertTrue( termSet.contains( "B" ) ); termSet = fq.getTermSet( "x" ); assertEquals( 1, termSet.size() ); assertTrue( termSet.contains( "C" ) ); termSet = fq.getTermSet( "y" ); assertNull( termSet ); } public void testQueryPhraseMap1Term() throws Exception { Query query = tq( "a" ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query, true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 1, qpm.subMap.size() ); assertTrue( qpm.subMap.get( "a" ) != null ); assertTrue( qpm.subMap.get( "a" ).terminal ); assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0); // phraseHighlight = true, fieldMatch = false fq = new FieldQuery( query, true, false ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( F ) ); assertNotNull( map.get( null ) ); qpm = map.get( null ); assertEquals( 1, qpm.subMap.size() ); assertTrue( qpm.subMap.get( "a" ) != null ); assertTrue( qpm.subMap.get( "a" ).terminal ); assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0); // phraseHighlight = false, fieldMatch = true fq = new FieldQuery( query, false, true ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); qpm = map.get( F ); assertEquals( 1, qpm.subMap.size() ); assertTrue( qpm.subMap.get( "a" ) != null ); assertTrue( qpm.subMap.get( "a" ).terminal ); assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0); // phraseHighlight = false, fieldMatch = false fq = new FieldQuery( query, false, false ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( F ) ); assertNotNull( map.get( null ) ); qpm = map.get( null ); assertEquals( 1, qpm.subMap.size() ); assertTrue( qpm.subMap.get( "a" ) != null ); assertTrue( qpm.subMap.get( "a" ).terminal ); assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0); // boost != 1 query = tq( 2, "a" ); fq = new FieldQuery( query, true, true ); map = fq.rootMaps; qpm = map.get( F ); assertEquals( 2F, qpm.subMap.get( "a" ).boost, 0); } public void testQueryPhraseMap1Phrase() throws Exception { Query query = pqF( "a", "b" ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query, true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 1, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "a" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // phraseHighlight = true, fieldMatch = false fq = new FieldQuery( query, true, false ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( F ) ); assertNotNull( map.get( null ) ); qpm = map.get( null ); assertEquals( 1, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "a" ) ); qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // phraseHighlight = false, fieldMatch = true fq = new FieldQuery( query, false, true ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); qpm = map.get( F ); assertEquals( 2, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "a" ) ); qpm2 = qpm.subMap.get( "a" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); assertNotNull( qpm.subMap.get( "b" ) ); qpm2 = qpm.subMap.get( "b" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); // phraseHighlight = false, fieldMatch = false fq = new FieldQuery( query, false, false ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( F ) ); assertNotNull( map.get( null ) ); qpm = map.get( null ); assertEquals( 2, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "a" ) ); qpm2 = qpm.subMap.get( "a" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); assertNotNull( qpm.subMap.get( "b" ) ); qpm2 = qpm.subMap.get( "b" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); // boost != 1 query = pqF( 2, "a", "b" ); // phraseHighlight = false, fieldMatch = false fq = new FieldQuery( query, false, false ); map = fq.rootMaps; qpm = map.get( null ); qpm2 = qpm.subMap.get( "a" ); assertEquals( 2F, qpm2.boost, 0); qpm3 = qpm2.subMap.get( "b" ); assertEquals( 2F, qpm3.boost, 0); qpm2 = qpm.subMap.get( "b" ); assertEquals( 2F, qpm2.boost, 0); } public void testQueryPhraseMap1PhraseAnother() throws Exception { Query query = pqF( "search", "engines" ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query, true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 1, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "search" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "search" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "engines" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "engines" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); } public void testQueryPhraseMap2Phrases() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add( pqF( "a", "b" ), Occur.SHOULD ); query.add( pqF( 2, "c", "d" ), Occur.SHOULD ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query.build(), true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 2, qpm.subMap.size() ); // "a b" assertNotNull( qpm.subMap.get( "a" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "c d"^2 assertNotNull( qpm.subMap.get( "c" ) ); qpm2 = qpm.subMap.get( "c" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "d" ) ); qpm3 = qpm2.subMap.get( "d" ); assertTrue( qpm3.terminal ); assertEquals( 2F, qpm3.boost, 0); } public void testQueryPhraseMap2PhrasesFields() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add( pq( F1, "a", "b" ), Occur.SHOULD ); query.add( pq( 2F, F2, "c", "d" ), Occur.SHOULD ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query.build(), true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 2, map.size() ); assertNull( map.get( null ) ); // "a b" assertNotNull( map.get( F1 ) ); QueryPhraseMap qpm = map.get( F1 ); assertEquals( 1, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "a" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "c d"^2 assertNotNull( map.get( F2 ) ); qpm = map.get( F2 ); assertEquals( 1, qpm.subMap.size() ); assertNotNull( qpm.subMap.get( "c" ) ); qpm2 = qpm.subMap.get( "c" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "d" ) ); qpm3 = qpm2.subMap.get( "d" ); assertTrue( qpm3.terminal ); assertEquals( 2F, qpm3.boost, 0); // phraseHighlight = true, fieldMatch = false fq = new FieldQuery( query.build(), true, false ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( F1 ) ); assertNull( map.get( F2 ) ); assertNotNull( map.get( null ) ); qpm = map.get( null ); assertEquals( 2, qpm.subMap.size() ); // "a b" assertNotNull( qpm.subMap.get( "a" ) ); qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "c d"^2 assertNotNull( qpm.subMap.get( "c" ) ); qpm2 = qpm.subMap.get( "c" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "d" ) ); qpm3 = qpm2.subMap.get( "d" ); assertTrue( qpm3.terminal ); assertEquals( 2F, qpm3.boost, 0); } /* * <t>...terminal * * a-b-c-<t> * +-d-<t> * b-c-d-<t> * +-d-<t> */ public void testQueryPhraseMapOverlapPhrases() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add( pqF( "a", "b", "c" ), Occur.SHOULD ); query.add( pqF( 2, "b", "c", "d" ), Occur.SHOULD ); query.add( pqF( 3, "b", "d" ), Occur.SHOULD ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query.build(), true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 2, qpm.subMap.size() ); // "a b c" assertNotNull( qpm.subMap.get( "a" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "b" ); assertFalse( qpm3.terminal ); assertEquals( 1, qpm3.subMap.size() ); assertNotNull( qpm3.subMap.get( "c" ) ); QueryPhraseMap qpm4 = qpm3.subMap.get( "c" ); assertTrue( qpm4.terminal ); assertEquals( 1F, qpm4.boost, 0); assertNotNull( qpm4.subMap.get( "d" ) ); QueryPhraseMap qpm5 = qpm4.subMap.get( "d" ); assertTrue( qpm5.terminal ); assertEquals( 1F, qpm5.boost, 0); // "b c d"^2, "b d"^3 assertNotNull( qpm.subMap.get( "b" ) ); qpm2 = qpm.subMap.get( "b" ); assertFalse( qpm2.terminal ); assertEquals( 2, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "c" ) ); qpm3 = qpm2.subMap.get( "c" ); assertFalse( qpm3.terminal ); assertEquals( 1, qpm3.subMap.size() ); assertNotNull( qpm3.subMap.get( "d" ) ); qpm4 = qpm3.subMap.get( "d" ); assertTrue( qpm4.terminal ); assertEquals( 2F, qpm4.boost, 0); assertNotNull( qpm2.subMap.get( "d" ) ); qpm3 = qpm2.subMap.get( "d" ); assertTrue( qpm3.terminal ); assertEquals( 3F, qpm3.boost, 0); } /* * <t>...terminal * * a-b-<t> * +-c-<t> */ public void testQueryPhraseMapOverlapPhrases2() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add( pqF( "a", "b" ), Occur.SHOULD ); query.add( pqF( 2, "a", "b", "c" ), Occur.SHOULD ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query.build(), true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 1, qpm.subMap.size() ); // "a b" assertNotNull( qpm.subMap.get( "a" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "b" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "b" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "a b c"^2 assertEquals( 1, qpm3.subMap.size() ); assertNotNull( qpm3.subMap.get( "c" ) ); QueryPhraseMap qpm4 = qpm3.subMap.get( "c" ); assertTrue( qpm4.terminal ); assertEquals( 2F, qpm4.boost, 0); } /* * <t>...terminal * * a-a-a-<t> * +-a-<t> * +-a-<t> * +-a-<t> */ public void testQueryPhraseMapOverlapPhrases3() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add( pqF( "a", "a", "a", "a" ), Occur.SHOULD ); query.add( pqF( 2, "a", "a", "a" ), Occur.SHOULD ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query.build(), true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 1, qpm.subMap.size() ); // "a a a" assertNotNull( qpm.subMap.get( "a" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "a" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "a" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "a" ); assertFalse( qpm3.terminal ); assertEquals( 1, qpm3.subMap.size() ); assertNotNull( qpm3.subMap.get( "a" ) ); QueryPhraseMap qpm4 = qpm3.subMap.get( "a" ); assertTrue( qpm4.terminal ); // "a a a a" assertEquals( 1, qpm4.subMap.size() ); assertNotNull( qpm4.subMap.get( "a" ) ); QueryPhraseMap qpm5 = qpm4.subMap.get( "a" ); assertTrue( qpm5.terminal ); // "a a a a a" assertEquals( 1, qpm5.subMap.size() ); assertNotNull( qpm5.subMap.get( "a" ) ); QueryPhraseMap qpm6 = qpm5.subMap.get( "a" ); assertTrue( qpm6.terminal ); // "a a a a a a" assertEquals( 1, qpm6.subMap.size() ); assertNotNull( qpm6.subMap.get( "a" ) ); QueryPhraseMap qpm7 = qpm6.subMap.get( "a" ); assertTrue( qpm7.terminal ); } public void testQueryPhraseMapOverlap2gram() throws Exception { BooleanQuery.Builder query = new BooleanQuery.Builder(); query.add(toPhraseQuery(analyze("abc", F, analyzerB), F), Occur.MUST); query.add(toPhraseQuery(analyze("bcd", F, analyzerB), F), Occur.MUST); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query.build(), true, true ); Map<String, QueryPhraseMap> map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); QueryPhraseMap qpm = map.get( F ); assertEquals( 2, qpm.subMap.size() ); // "ab bc" assertNotNull( qpm.subMap.get( "ab" ) ); QueryPhraseMap qpm2 = qpm.subMap.get( "ab" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "bc" ) ); QueryPhraseMap qpm3 = qpm2.subMap.get( "bc" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "ab bc cd" assertEquals( 1, qpm3.subMap.size() ); assertNotNull( qpm3.subMap.get( "cd" ) ); QueryPhraseMap qpm4 = qpm3.subMap.get( "cd" ); assertTrue( qpm4.terminal ); assertEquals( 1F, qpm4.boost, 0); // "bc cd" assertNotNull( qpm.subMap.get( "bc" ) ); qpm2 = qpm.subMap.get( "bc" ); assertFalse( qpm2.terminal ); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "cd" ) ); qpm3 = qpm2.subMap.get( "cd" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // phraseHighlight = false, fieldMatch = true fq = new FieldQuery( query.build(), false, true ); map = fq.rootMaps; assertEquals( 1, map.size() ); assertNull( map.get( null ) ); assertNotNull( map.get( F ) ); qpm = map.get( F ); assertEquals( 3, qpm.subMap.size() ); // "ab bc" assertNotNull( qpm.subMap.get( "ab" ) ); qpm2 = qpm.subMap.get( "ab" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "bc" ) ); qpm3 = qpm2.subMap.get( "bc" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "ab bc cd" assertEquals( 1, qpm3.subMap.size() ); assertNotNull( qpm3.subMap.get( "cd" ) ); qpm4 = qpm3.subMap.get( "cd" ); assertTrue( qpm4.terminal ); assertEquals( 1F, qpm4.boost, 0); // "bc cd" assertNotNull( qpm.subMap.get( "bc" ) ); qpm2 = qpm.subMap.get( "bc" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); assertEquals( 1, qpm2.subMap.size() ); assertNotNull( qpm2.subMap.get( "cd" ) ); qpm3 = qpm2.subMap.get( "cd" ); assertTrue( qpm3.terminal ); assertEquals( 1F, qpm3.boost, 0); // "cd" assertNotNull( qpm.subMap.get( "cd" ) ); qpm2 = qpm.subMap.get( "cd" ); assertTrue( qpm2.terminal ); assertEquals( 1F, qpm2.boost, 0); assertEquals( 0, qpm2.subMap.size() ); } public void testSearchPhrase() throws Exception { Query query = pqF( "a", "b", "c" ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query, true, true ); // "a" List<TermInfo> phraseCandidate = new ArrayList<>(); phraseCandidate.add( new TermInfo( "a", 0, 1, 0, 1 ) ); assertNull( fq.searchPhrase( F, phraseCandidate ) ); // "a b" phraseCandidate.add( new TermInfo( "b", 2, 3, 1, 1 ) ); assertNull( fq.searchPhrase( F, phraseCandidate ) ); // "a b c" phraseCandidate.add( new TermInfo( "c", 4, 5, 2, 1 ) ); assertNotNull( fq.searchPhrase( F, phraseCandidate ) ); assertNull( fq.searchPhrase( "x", phraseCandidate ) ); // phraseHighlight = true, fieldMatch = false fq = new FieldQuery( query, true, false ); // "a b c" assertNotNull( fq.searchPhrase( F, phraseCandidate ) ); assertNotNull( fq.searchPhrase( "x", phraseCandidate ) ); // phraseHighlight = false, fieldMatch = true fq = new FieldQuery( query, false, true ); // "a" phraseCandidate.clear(); phraseCandidate.add( new TermInfo( "a", 0, 1, 0, 1 ) ); assertNotNull( fq.searchPhrase( F, phraseCandidate ) ); // "a b" phraseCandidate.add( new TermInfo( "b", 2, 3, 1, 1 ) ); assertNull( fq.searchPhrase( F, phraseCandidate ) ); // "a b c" phraseCandidate.add( new TermInfo( "c", 4, 5, 2, 1 ) ); assertNotNull( fq.searchPhrase( F, phraseCandidate ) ); assertNull( fq.searchPhrase( "x", phraseCandidate ) ); } public void testSearchPhraseSlop() throws Exception { // "a b c"~0 Query query = pqF( "a", "b", "c" ); // phraseHighlight = true, fieldMatch = true FieldQuery fq = new FieldQuery( query, true, true ); // "a b c" w/ position-gap = 2 List<TermInfo> phraseCandidate = new ArrayList<>(); phraseCandidate.add( new TermInfo( "a", 0, 1, 0, 1 ) ); phraseCandidate.add( new TermInfo( "b", 2, 3, 2, 1 ) ); phraseCandidate.add( new TermInfo( "c", 4, 5, 4, 1 ) ); assertNull( fq.searchPhrase( F, phraseCandidate ) ); // "a b c"~1 query = pqF( 1F, 1, "a", "b", "c" ); // phraseHighlight = true, fieldMatch = true fq = new FieldQuery( query, true, true ); // "a b c" w/ position-gap = 2 assertNotNull( fq.searchPhrase( F, phraseCandidate ) ); // "a b c" w/ position-gap = 3 phraseCandidate.clear(); phraseCandidate.add( new TermInfo( "a", 0, 1, 0, 1 ) ); phraseCandidate.add( new TermInfo( "b", 2, 3, 3, 1 ) ); phraseCandidate.add( new TermInfo( "c", 4, 5, 6, 1 ) ); assertNull( fq.searchPhrase( F, phraseCandidate ) ); } public void testHighlightQuery() throws Exception { makeIndexStrMV(); defgMultiTermQueryTest(new WildcardQuery(new Term(F, "d*g"))); } public void testPrefixQuery() throws Exception { makeIndexStrMV(); defgMultiTermQueryTest(new PrefixQuery(new Term(F, "de"))); } public void testRegexpQuery() throws Exception { makeIndexStrMV(); Term term = new Term(F, "d[a-z].g"); defgMultiTermQueryTest(new RegexpQuery(term)); } public void testRangeQuery() throws Exception { makeIndexStrMV(); defgMultiTermQueryTest(new TermRangeQuery (F, new BytesRef("d"), new BytesRef("e"), true, true)); } private void defgMultiTermQueryTest(Query query) throws IOException { FieldQuery fq = new FieldQuery( query, reader, true, true ); QueryPhraseMap qpm = fq.getFieldTermMap(F, "defg"); assertNotNull (qpm); assertNull (fq.getFieldTermMap(F, "dog")); List<TermInfo> phraseCandidate = new ArrayList<>(); phraseCandidate.add( new TermInfo( "defg", 0, 12, 0, 1 ) ); assertNotNull (fq.searchPhrase(F, phraseCandidate)); } public void testStopRewrite() throws Exception { Query q = new Query() { @Override public String toString(String field) { return "DummyQuery"; } }; make1d1fIndex( "a" ); assertNotNull(reader); new FieldQuery(q, reader, true, true ); } public void testFlattenFilteredQuery() throws Exception { initBoost(); Filter filter = new Filter() { @Override public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException { return null; } @Override public String toString(String field) { return "filterToBeFlattened"; } }; Query query = new BooleanQuery.Builder() .add(pqF( "A" ), Occur.MUST) .add(filter, Occur.FILTER) .build(); query.setBoost(boost); FieldQuery fq = new FieldQuery( query, true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten( query, reader, flatQueries ); assertCollectionQueries( flatQueries, tq( boost, "A" ) ); } public void testFlattenConstantScoreQuery() throws Exception { initBoost(); Query query = new ConstantScoreQuery(pqF( "A" )); query.setBoost(boost); FieldQuery fq = new FieldQuery( query, true, true ); Set<Query> flatQueries = new HashSet<>(); fq.flatten( query, reader, flatQueries ); assertCollectionQueries( flatQueries, tq( boost, "A" ) ); } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
766e9e9c85319e11fc53ab25bde308910f0edcba
b200392f6d13dfacee6d715a3130ea42f0d4ff37
/src/main/java/com/usoft/sdk/b2b/utils/ProtoBufUtil.java
8417ae5790abecacca789a9d6c8944190631dd13
[]
no_license
usoft-china/usoft-sdk-b2b
15519dba5b318382fe5d04be1c1ef76908a1d1d7
0d13085ec1e17b8db96dd612e7419c4cff871594
refs/heads/master
2022-06-24T03:55:11.778151
2021-10-20T05:44:56
2021-10-20T05:44:56
227,731,753
2
0
null
2022-06-17T02:45:59
2019-12-13T01:43:25
Java
UTF-8
Java
false
false
4,040
java
package com.usoft.sdk.b2b.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.protobuf.Descriptors; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; import com.google.protobuf.MessageOrBuilder; import com.google.protobuf.util.JsonFormat; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import java.util.*; /** * ProtoBuf 工具类 * * @author wangcanyi * @date 2018-07-31 17:57 */ public class ProtoBufUtil { /** * ProtoBuf to Json Format */ private static final MyJsonFormat.Printer JSON_FORMAT_PRINTER = MyJsonFormat.printer().preservingProtoFieldNames().includingDefaultValueFields().omittingInsignificantWhitespace(); /** * Parser Json To ProtoBuf */ private static final JsonFormat.Parser JSON_FORMAT_PARSER = JsonFormat.parser().ignoringUnknownFields(); /** * Json列表字符串 转 ProtoBuf实体列表 * * @param message 目标ProtoBuf实体 * @param jsonSourceList Json字符串 * @param <T> * @return * @throws InvalidProtocolBufferException */ public static <T extends Message> List<T> toProtoBufList(T message, String jsonSourceList) throws InvalidProtocolBufferException { if (StringUtils.isBlank(jsonSourceList)) { return new ArrayList<>(0); } JSONArray jsonArray = JSON.parseArray(jsonSourceList); List<T> messageList = new ArrayList<>(jsonArray.size()); for (int i = 0; i < jsonArray.size(); i++) { Object object = jsonArray.get(i); T.Builder builder = message.toBuilder(); builder = toProtoBuf(builder, object.toString()); messageList.add((T) builder.build()); } return messageList; } /** * Json字符串 转 ProtoBuf实体 * * @param builder 目标ProtoBuf实体 * @param jsonSource Json字符串 * @param <T> * @return * @throws Exception */ public static <T extends Message.Builder> T toProtoBuf(T builder, String jsonSource) throws InvalidProtocolBufferException { JSON_FORMAT_PARSER.merge(jsonSource, builder); return builder; } /** * ProtoBuf列表 转 Json字符串 * * @param messageList ProtoBuf实体列表 * @return * @throws InvalidProtocolBufferException */ public static String toJSON(List<? extends MessageOrBuilder> messageList) throws InvalidProtocolBufferException { if (messageList == null) { return ""; } if (messageList.size() == 0) { return JSON.toJSONString(new ArrayList<>(0)); } List<JSONObject> jsonObjectList = new ArrayList<>(messageList.size()); for (MessageOrBuilder message : messageList) { String msgJson = toJSON(message); JSONObject jsonObject = JSON.parseObject(msgJson); jsonObjectList.add(jsonObject); } return JSON.toJSONString(jsonObjectList); } /** * ProtoBuf实体 转 Json字符串 * * @param message ProtoBuf实体 * @return Json字符串 * @throws InvalidProtocolBufferException */ public static String toJSON(MessageOrBuilder message) throws InvalidProtocolBufferException { return JSON_FORMAT_PRINTER.print(message); } /** * ProtoBuf实体 转 Map(只转第一层字段) * * @param message * @return */ public static Map<String, String> toMap(MessageOrBuilder message) { Map<Descriptors.FieldDescriptor, Object> fieldMap = message.getAllFields(); if (MapUtils.isEmpty(fieldMap)) { return new HashMap<>(0); } Map<String, String> result = new LinkedHashMap<>(fieldMap.size()); for (Map.Entry<Descriptors.FieldDescriptor, Object> kv : fieldMap.entrySet()) { Descriptors.FieldDescriptor.JavaType javaType = kv.getKey().getJavaType(); //如果为二进制数组,枚举,实体,则跳过 if (javaType == Descriptors.FieldDescriptor.JavaType.BYTE_STRING || javaType == Descriptors.FieldDescriptor.JavaType.ENUM || javaType == Descriptors.FieldDescriptor.JavaType.MESSAGE) { continue; } result.put(kv.getKey().getName(), kv.getValue().toString()); } return result; } }
[ "wangcanyi@usoftchina.com" ]
wangcanyi@usoftchina.com
c09999dc7934445eef6327980bbe6e4e60ab268a
5f0049608c0b00e49517916c3dc1907f18879af1
/src/main/java/net/kloudspace/block/tile/furance/OreRecipe.java
2cbdbf69e2443985ce041bd5db10211e62fcd4ab
[]
no_license
OG-Kloud/Ore-Redistribution
dcac08f617e309f3f0a32f3591a884ebe7d838fc
c4f43be6bbb21c21110e2ea0e81d27c7e7e24d9b
refs/heads/master
2021-01-21T16:04:02.591405
2017-06-26T02:42:41
2017-06-26T02:42:41
91,870,916
0
0
null
2017-05-20T07:00:46
2017-05-20T06:48:42
null
UTF-8
Java
false
false
703
java
package net.kloudspace.block.tile.furance; import net.minecraft.item.Item; public class OreRecipe { private int ID; public Item input; public Item output; public int requiredTemp; /**Amount of time for this recipe to process at temperature(in ticks)*/ public int requiredTime; public int requiredNumberOfInput; public OreRecipe(Item inputItem, Item outputItem, int temp, int time, int numberRequired) { this.input = inputItem; this.output = outputItem; this.requiredTemp = temp; this.requiredTime = time; this.requiredNumberOfInput = numberRequired; } public int getID() { return ID; } public int setID(int iD) { return ID = iD; } }
[ "noreply@github.com" ]
noreply@github.com
46b9824570f5db2683a5d3d9692c32d42ad47e85
ab0f3f9cab59f477654db7d358b7b22013b6f57a
/src/main/java/com/example/study/stream/PipeStreamDemo.java
0f57172df937b91ae3c03bf75fb8d9186ce6f0ad
[]
no_license
ZhangGitHubHao/demo
8310d8a3bbe6ab60ad248f7532df794eb7fbf19f
2b95fe4c7e555725226ef5730016b758556bcaad
refs/heads/master
2022-07-06T12:51:04.696471
2021-07-21T07:36:40
2021-07-21T07:36:40
232,734,529
0
0
null
2022-06-29T17:53:48
2020-01-09T06:03:27
Java
UTF-8
Java
false
false
2,187
java
package com.example.study.stream; import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.nio.charset.StandardCharsets; public class PipeStreamDemo { public static void main(String[] args) { Work1 work1 = new Work1(); Work2 work2 = new Work2(); try { work2.getPipedOutputStream().connect(work1.getPipedInputStream()); } catch (IOException e) { e.printStackTrace(); } new Thread(work1).start(); new Thread(work2).start(); } } class Work1 implements Runnable { PipedInputStream pipedInputStream = new PipedInputStream(); @Override public void run() { System.out.println("thread1"); try { while (true) { byte[] bytes = new byte[1024]; int len = pipedInputStream.read(bytes); if (len != -1){ System.out.println("输出:"+new String(bytes)); } } } catch (IOException e) { e.printStackTrace(); } finally { try { pipedInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } public PipedInputStream getPipedInputStream() { return pipedInputStream; } } class Work2 implements Runnable { PipedOutputStream pipedOutputStream = new PipedOutputStream(); @Override public void run() { System.out.println("thread2"); try { int i = 0; while (true) { pipedOutputStream.write(("number"+i).getBytes(StandardCharsets.UTF_8)); pipedOutputStream.flush(); i++; Thread.sleep(1000); } } catch (IOException | InterruptedException e) { e.printStackTrace(); } finally { try { pipedOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } public PipedOutputStream getPipedOutputStream() { return pipedOutputStream; } }
[ "zhanghao@fujisoft-china。com" ]
zhanghao@fujisoft-china。com
2e320b8230336e608108c0c7ffe036b0130a9264
503b89dd2280cb11fd7b5660e05db21c9aaa7569
/JAVA/Day08/Solution2.java
87272755829c9700aca55531359f787fdf32252c
[]
no_license
tamycova/30DaysHR
50139390d79f24547b3bf43bfba7c41a2ea38696
4a1a9498382857501160e3e659361a4f35a824bb
refs/heads/master
2021-01-10T03:14:23.808221
2020-11-10T19:55:00
2020-11-10T19:55:00
49,034,458
54
81
null
2020-11-10T19:55:01
2016-01-05T01:39:48
C++
UTF-8
Java
false
false
2,127
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class Day8 { static BufferedReader br; static PrintWriter out; static StringTokenizer st; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); // br = new BufferedReader(new FileReader("in.txt")); // out = new PrintWriter(new FileWriter("out.txt")); int n = readInt(); HashMap<String, String> hm = new HashMap<String, String>(); while (n > 0) { String[] str = readLine().split(" "); StringBuilder name = new StringBuilder(); for (int i = 0; i < str.length; i++) { if (i == 1) { name.append(" " + str[i]); } else { name.append(str[i]); } } String number = next(); hm.put(name.toString(), number); n--; } while (true) { String[] str = readLine().split(" "); if (str[0].equals("\n")) { break; } else { StringBuilder name = new StringBuilder(); for (int i = 0; i < str.length; i++) { if (i == 1) { name.append(" " + str[i]); } else { name.append(str[i]); } } if (hm.containsKey(name.toString())) { System.out.println( name.toString() + "=" + hm.get(name.toString())); } else { System.out.println("Not found"); } } } out.close(); } static String next() throws IOException { while ((st == null) || !st.hasMoreTokens()) { st = new StringTokenizer(br.readLine().trim()); } return st.nextToken(); } static long readLong() throws IOException { return Long.parseLong(next()); } static int readInt() throws IOException { return Integer.parseInt(next()); } static double readDouble() throws IOException { return Double.parseDouble(next()); } static char readCharacter() throws IOException { return next().charAt(0); } static String readLine() throws IOException { return br.readLine().trim(); } }
[ "pratikupacharya@gmail.com" ]
pratikupacharya@gmail.com
949e1925a7598feb3191a202b790e86771a8096d
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
/Code Snippet Repository/Spring/Spring1698.java
ceeeaa37197bb34d7dc78805dfbc5e3b0ebb59b8
[]
no_license
saber13812002/DeepCRM
3336a244d4852a364800af3181e03e868cf6f9f5
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
refs/heads/master
2023-03-16T00:08:06.473699
2018-04-18T05:29:50
2018-04-18T05:29:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
@Test public void testComplexObject() { TestBean tb = new TestBean(); String newName = "Rod"; String tbString = "Kerry_34"; BeanWrapper bw = new BeanWrapperImpl(tb); bw.registerCustomEditor(ITestBean.class, new TestBeanEditor()); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("age", new Integer(55))); pvs.addPropertyValue(new PropertyValue("name", newName)); pvs.addPropertyValue(new PropertyValue("touchy", "valid")); pvs.addPropertyValue(new PropertyValue("spouse", tbString)); bw.setPropertyValues(pvs); assertTrue("spouse is non-null", tb.getSpouse() != null); assertTrue("spouse name is Kerry and age is 34", tb.getSpouse().getName().equals("Kerry") && tb.getSpouse().getAge() == 34); }
[ "Qing.Mi@my.cityu.edu.hk" ]
Qing.Mi@my.cityu.edu.hk
c475d7b96b3d0ea4e6b309f5a82e229a5c16e834
5412cd1d96dc47c6f99b1b4af979098a61ec78f2
/src/IpConvert.java
0fdf53958e86f37c5132d7a75874c73f2a44a459
[]
no_license
zenglingshu/leetcode
2c8b170b01372bc6e776bc83caad7c21e7cf4506
5ca24a7349aa4b185af20a1ea45230a509c9cc44
refs/heads/master
2021-01-10T01:41:00.620823
2015-12-20T07:49:57
2015-12-20T07:49:57
44,047,150
0
0
null
null
null
null
UTF-8
Java
false
false
1,160
java
/** * 将ip转换成long,将long转成ip <br> * * 因为每个点分隔格式的 IP 地址是以 256 位方式表示的数字: 192.168.0.1 意指 1*256^0 + 0*256^1 + 168*256^2 + 192*256^3 = 3232235521 * * Created by lingshu on 15/10/10. */ public class IpConvert { public static int ipToInt(final String addr) { final String[] addressBytes = addr.split("\\."); int length = addressBytes.length; if (length < 3) { return 0; } int ip = 0; try { for (int i = 0; i < 4; i++) { ip <<= 8; ip |= Integer.parseInt(addressBytes[i]); } } catch (Exception e) { e.printStackTrace(); } return ip; } public static String intToIp(int i) { return ((i >> 24 ) & 0xFF) + "." + ((i >> 16 ) & 0xFF) + "." + ((i >> 8 ) & 0xFF) + "." + ( i & 0xFF); } public static void main(String[] args){ String ip = "255.155.155.155"; System.out.println(ipToInt(ip)); System.out.println(intToIp(ipToInt(ip))); } }
[ "lingshu@staff.sina.com.cn" ]
lingshu@staff.sina.com.cn
b702eee51d2e014acdfb63d7fbae709efe9cf7d8
aebcd5a3374fadc51345396ea6227f73985690aa
/DataExtractor/src/main/java/com/dataextractor/model/Layout.java
5c90d342e470f59eac2ba2179a2e0ad05127ce37
[]
no_license
siba7777/SpringBatchSample
ab5eb7aa25923c2a13c0e0eb7fc4f3f16c17bd94
bc2723a1fe5d8267356cc5246368ea306703760b
refs/heads/master
2020-12-12T22:08:43.014959
2020-01-21T08:12:01
2020-01-21T08:12:01
234,241,347
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.dataextractor.model; import java.io.Serializable; import lombok.Data; @Data @SuppressWarnings({ "unused", "serial" }) public class Layout implements Serializable { /** * レイアウトID */ private String id; /** * レイアウト名 */ private String name; /** * ファイルエンコード */ private String encode; public Layout() { } }
[ "kohei_ishikawa@iwi.co.jp" ]
kohei_ishikawa@iwi.co.jp
00f38dd183c15963d6f3bd2450afaeae83abca50
f321db1ace514d08219cc9ba5089ebcfff13c87a
/generated-tests/dynamosa/tests/s1019/10_jmca/evosuite-tests/com/soops/CEN4010/JMCA/JParser/JavaParserTokenManager_ESTest_scaffolding.java
58487a5d5f2147c0bbc73d136407200a22f343d0
[]
no_license
sealuzh/dynamic-performance-replication
01bd512bde9d591ea9afa326968b35123aec6d78
f89b4dd1143de282cd590311f0315f59c9c7143a
refs/heads/master
2021-07-12T06:09:46.990436
2020-06-05T09:44:56
2020-06-05T09:44:56
146,285,168
2
2
null
null
null
null
UTF-8
Java
false
false
4,794
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Jul 04 04:16:24 GMT 2019 */ package com.soops.CEN4010.JMCA.JParser; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; import static org.evosuite.shaded.org.mockito.Mockito.*; @EvoSuiteClassExclude public class JavaParserTokenManager_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "com.soops.CEN4010.JMCA.JParser.JavaParserTokenManager"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {} } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("user.dir", "/home/apaniche/performance/Dataset/gordon_scripts/projects/10_jmca"); java.lang.System.setProperty("java.io.tmpdir", "/tmp"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(JavaParserTokenManager_ESTest_scaffolding.class.getClassLoader() , "com.soops.CEN4010.JMCA.JParser.JavaCharStream", "com.soops.CEN4010.JMCA.JParser.Token$GTToken", "com.soops.CEN4010.JMCA.JParser.JavaParserTokenManager", "com.soops.CEN4010.JMCA.JParser.TokenMgrError", "com.soops.CEN4010.JMCA.JParser.JavaParserConstants", "com.soops.CEN4010.JMCA.JParser.Token" ); } private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException { mock(Class.forName("java.util.Enumeration", false, JavaParserTokenManager_ESTest_scaffolding.class.getClassLoader())); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(JavaParserTokenManager_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "com.soops.CEN4010.JMCA.JParser.JavaParserTokenManager", "com.soops.CEN4010.JMCA.JParser.JavaParserConstants", "com.soops.CEN4010.JMCA.JParser.JavaCharStream", "com.soops.CEN4010.JMCA.JParser.TokenMgrError", "com.soops.CEN4010.JMCA.JParser.Token", "com.soops.CEN4010.JMCA.JParser.Token$GTToken" ); } }
[ "granogiovanni90@gmail.com" ]
granogiovanni90@gmail.com
979c051211ed21282bdf8b558911ad059d93dfa1
fa6b385a314e029d2948f494283b0688456d43c9
/FinalAssignment/DefaultComparator.java
b94188bf442b94727c4d24c1505d96d173348f70
[]
no_license
jairoMolina9/data-structures-qc
81317d719312711004ed2419a6879c8e0101bb7e
41775ef9656828e78f9271da14fbc8b2e7b96d4b
refs/heads/master
2022-12-06T02:22:18.973284
2020-08-15T18:34:54
2020-08-15T18:34:54
253,412,472
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package cs313final; import java.util.Comparator; /* * This file should not be modified */ public class DefaultComparator<T> implements Comparator<T> { @Override public int compare(T o1, T o2) throws ClassCastException { return ((Comparable<T>) o1).compareTo(o2); } }
[ "noreply@github.com" ]
noreply@github.com
6bcc1413b012856bf2e076523e7a9cf586188481
ab7d2d7b9820c4b006b35a9119028313b34f63c5
/src/com/Course/Apple.java
bfa725c39b5ea643a48917b13f7a02541d7e2a2b
[]
no_license
Yancongyu/Myfirstprj
766994608bd34284a73b09c32ceabc1dbc33bc54
b1b95baf670274080b941d86ad0cbeb3b9beb651
refs/heads/master
2021-01-15T19:23:28.612887
2017-08-09T15:07:17
2017-08-09T15:07:17
93,217,781
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package com.Course; /** * Created by Administrator on 2017/5/18. */ public class Apple implements Fruit { Apple(){System.out.println("创建了一个苹果对象");} }
[ "2209467757@qq.com" ]
2209467757@qq.com
9876202f600568c258034e3e6b5c8b049de29199
e3ccaafebe1147dd885d859b8ff8f7898885014b
/protocol/src/main/java/org/jotserver/ot/net/ProtocolProvider.java
59c8df0d36f412d104787e404791efe5000eaf45
[]
no_license
osmarjunior/jOTServer
9802e8dd6ffce3af709c1facbe27b536cdff6d7d
9783fda1554951e4bf76a40076e34f618c87c844
refs/heads/master
2021-01-16T22:00:19.829822
2015-09-08T08:23:59
2015-09-08T08:23:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package org.jotserver.ot.net; public interface ProtocolProvider { Protocol getProtocol(int type); }
[ "dolb90@gmail.com" ]
dolb90@gmail.com
4673223055d4154822297fcb20431c6dc0aa0c68
2667d7565e62b04337b93dc34876dfae8cf11b0d
/gmall-ums-interface/src/main/java/com/atguigu/gmall/ums/entity/UserStatisticsEntity.java
0b260d3e2f23581d50d8e2a7a8b54db350268ccb
[ "Apache-2.0" ]
permissive
caodan689/gmall-0522
b6dc1813686c0a883a9fcadc628b35fcea80b04c
64b13825aeba6039437a1117f62914bfb8ec5167
refs/heads/main
2023-06-24T16:46:45.532401
2020-11-24T03:33:57
2020-11-24T03:33:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,435
java
package com.atguigu.gmall.ums.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.math.BigDecimal; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 统计信息表 * * @author fengge * @email fengge@atguigu.com * @date 2020-11-16 09:40:00 */ @Data @TableName("ums_user_statistics") public class UserStatisticsEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private Long id; /** * 用户id */ private Long userId; /** * 累计消费金额 */ private BigDecimal consumeAmount; /** * 累计优惠金额 */ private BigDecimal couponAmount; /** * 订单数量 */ private Integer orderCount; /** * 优惠券数量 */ private Integer couponCount; /** * 评价数 */ private Integer commentCount; /** * 退货数量 */ private Integer returnOrderCount; /** * 登录次数 */ private Integer loginCount; /** * 关注数量 */ private Integer attendCount; /** * 粉丝数量 */ private Integer fansCount; /** * 收藏的商品数量 */ private Integer collectProductCount; /** * 收藏的专题活动数量 */ private Integer collectSubjectCount; /** * 收藏的评论数量 */ private Integer collectCommentCount; /** * 邀请的朋友数量 */ private Integer inviteFriendCount; }
[ "joedy23@aliyun.com" ]
joedy23@aliyun.com
ca57d166bc3d069ed7a5edc696594d726f63853a
611df8d7165ce7a480fb3532562330cb1b4b21a8
/chatkit/src/main/java/com/stfalcon/chatkit/utils/DateFormatter.java
915167982d0f8f68986a0d860fbdfdc493d6f124
[]
no_license
uncolorr/AroundMe
3b7b4f3974563acd6898db47ade2e05d85be3c51
64d18eefba21d6c154181e09bf311098977c7184
refs/heads/master
2020-12-03T00:15:26.842701
2017-09-24T12:12:17
2017-09-24T12:12:17
96,001,533
0
0
null
null
null
null
UTF-8
Java
false
false
4,914
java
/******************************************************************************* * Copyright 2016 stfalcon.com * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.stfalcon.chatkit.utils; import android.util.Log; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; public final class DateFormatter { private DateFormatter() { throw new AssertionError(); } public static String format(Date date, Template template) { return format(date, template.get()); } public static String format(Date date, String format) { if (date == null) return ""; return new SimpleDateFormat(format, Locale.getDefault()) .format(date); } public static boolean isInMilliseconds(Date date){ return date.getTime() < 5000000000L; } public static boolean isSameDay(Date date1, Date date2) { if (date1 == null || date2 == null) { throw new IllegalArgumentException("Dates must not be null"); } Calendar cal1 = Calendar.getInstance(); if (isInMilliseconds(date1)){ date1.setTime(date1.getTime() * 1000); } cal1.setTime(date1); if (isInMilliseconds(date2)) { date2.setTime(date2.getTime() * 1000); } Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return isSameDay(cal1, cal2); } public static boolean isSameDay(Calendar cal1, Calendar cal2) { if (cal1 == null || cal2 == null) { throw new IllegalArgumentException("Dates must not be null"); } return (//cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && //cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR)); } public static boolean isSameYear(Date date1, Date date2) { if (date1 == null || date2 == null) { throw new IllegalArgumentException("Dates must not be null"); } Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return isSameYear(cal1, cal2); } public static boolean isSameYear(Calendar cal1, Calendar cal2) { if (cal1 == null || cal2 == null) { throw new IllegalArgumentException("Dates must not be null"); } return (cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)); } public static boolean isToday(Calendar calendar) { return isSameDay(calendar, Calendar.getInstance()); } public static boolean isToday(Date date) { Log.i("fg", "isToday"); return isSameDay(date, Calendar.getInstance().getTime()); } public static boolean isYesterday(Calendar calendar) { Calendar yesterday = Calendar.getInstance(); yesterday.add(Calendar.DAY_OF_MONTH, -1); return isSameDay(calendar, yesterday); } public static boolean isYesterday(Date date) { Calendar yesterday = Calendar.getInstance(); yesterday.add(Calendar.DAY_OF_MONTH, -1); return isSameDay(date, yesterday.getTime()); } public static boolean isCurrentYear(Date date) { return isSameYear(date, Calendar.getInstance().getTime()); } public static boolean isCurrentYear(Calendar calendar) { return isSameYear(calendar, Calendar.getInstance()); } /** * Interface used to format dates before they were displayed (e.g. dialogs time, messages date headers etc.). */ public interface Formatter { /** * Formats an string representation of the date object. * * @param date The date that should be formatted. * @return Formatted text. */ String format(Date date); } public enum Template { STRING_DAY_MONTH_YEAR("d MMMM yyyy HH:mm"), STRING_DAY_MONTH("d MMMM"), TIME("HH:mm"); private String template; Template(String template) { this.template = template; } public String get() { return template; } } }
[ "vlsap9696@gmail.com" ]
vlsap9696@gmail.com
076003742b6db443047520ce554f9d1d91c5231a
3f471e40d678b5d7cbe36329ad50d748b5e5786b
/aws-dynamodb-tutorial/src/test/java/com/bahadirakin/dynamodb/rules/LocalDynamoDBCreationRule.java
a966cb8090f1ec23d986f2992ed85d766258587c
[]
no_license
tequila21/Java-Examples
b39acf9ccbae3f8b18fcd186f5995eb3045fadc7
3b3cc50211e3313a0dbbeb7d342220fbd0f7cf80
refs/heads/master
2020-05-25T03:35:01.714213
2017-06-04T21:16:14
2017-06-04T21:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,988
java
package com.bahadirakin.dynamodb.rules; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import com.amazonaws.services.dynamodbv2.local.main.ServerRunner; import com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer; import com.amazonaws.services.dynamodbv2.model.CreateTableRequest; import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput; import org.junit.rules.ExternalResource; import java.io.IOException; import java.net.ServerSocket; /** * Creates a local DynamoDB instance for testing. */ public class LocalDynamoDBCreationRule extends ExternalResource { private final Class<?>[] modelClasses; private DynamoDBProxyServer server; private AmazonDynamoDB amazonDynamoDB; private DynamoDBMapper dynamoDBMapper; public LocalDynamoDBCreationRule(final Class<?>... modelClasses) { this.modelClasses = modelClasses; // This one should be copied during test-compile time. If project's basedir does not contains a folder // named 'native-libs' please try '$ mvn clean install' from command line first System.setProperty("sqlite4java.library.path", "native-libs"); } @Override protected void before() throws Throwable { try { final String port = getAvailablePort(); this.server = ServerRunner.createServerFromCommandLineArgs(new String[]{"-inMemory", "-port", port}); server.start(); amazonDynamoDB = new AmazonDynamoDBClient(new BasicAWSCredentials("access", "secret")); amazonDynamoDB.setEndpoint("http://localhost:" + port); dynamoDBMapper = new DynamoDBMapper(amazonDynamoDB); for (Class<?> model : modelClasses) { final CreateTableRequest createTableRequest = dynamoDBMapper.generateCreateTableRequest(model); createTableRequest.setProvisionedThroughput(new ProvisionedThroughput(10L, 10L)); amazonDynamoDB.createTable(createTableRequest); } } catch (Exception e) { throw new RuntimeException(e); } } @Override protected void after() { if (server == null) { return; } try { server.stop(); } catch (Exception e) { throw new RuntimeException(e); } } public AmazonDynamoDB getAmazonDynamoDB() { return amazonDynamoDB; } public DynamoDBMapper getDynamoDBMapper() { return dynamoDBMapper; } private String getAvailablePort() { try (final ServerSocket serverSocket = new ServerSocket(0)) { return String.valueOf(serverSocket.getLocalPort()); } catch (IOException e) { throw new RuntimeException("Available port was not found", e); } } }
[ "bhdrkn@gmail.com" ]
bhdrkn@gmail.com
96be85493a51ab21e7d12aef196a6c96c28e4c31
763401f232b50750c705e7272870486601585bd2
/bundles/edu.kit.kastel.scbs.pcm2java.tests/res/test/MinExampleGoldStandard/OpInterfacePrimitiveTypes.java
3b109df3cb33c27178da2280aa22a869362f7d03
[]
no_license
KASTEL-SCBS/PCM2Java
8866947e8156d7058c34ac7d5d20f6ef9eeb7e9a
a58a0633855dd9276ede0df5c4340e48edc974f6
refs/heads/master
2022-11-02T00:15:13.748390
2020-06-10T06:18:05
2020-06-10T06:18:05
82,931,272
0
2
null
2019-08-14T13:05:10
2017-02-23T13:45:23
Xtend
UTF-8
Java
false
false
403
java
package aName.contracts.interfaces; public interface OpInterfacePrimitiveTypes { void methodEmpty(); boolean methodBoolean(boolean paraBoolean); byte methodByte(byte paraByte); char methodCharacter(char paraCharacter); int methodInteger(int paraInteger); long methodLong(long paraLong); double methodDouble(double paraDouble); String methodString(String paraString); }
[ "Moritz@DESKTOP-JBVNJGN.local" ]
Moritz@DESKTOP-JBVNJGN.local
786951175c33ee2bfe9dfcba662db027ee21edbf
91cccbc998cc58dd7d0a30cde65baea60501517c
/CadastroFuncionarioGUI.java
e5f26def74ed4283920861367595b857ca1784ca
[]
no_license
OtavioPontes/projetoAP2
c44944cecb74a38715992b72bca9271f4d1c4a73
1b4a3c91e496a97ce64b7dce5b0a85581c1b05af
refs/heads/master
2020-03-21T00:27:25.524289
2018-07-07T21:02:34
2018-07-07T21:02:34
137,892,633
0
0
null
null
null
null
UTF-8
Java
false
false
6,532
java
package projeto; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.JTextField; import javax.swing.ImageIcon; import javax.swing.JButton; public class CadastroFuncionarioGUI { private JFrame frameCadastroFuncionario; private JTextField textFieldNome; private JTextField textFieldCpf; private JTextField textFieldCargo; private ImageIcon icone = new ImageIcon(getClass().getResource("bancoLS.png")); //Variaveis para o armazenamento dos dados private Funcionario func; private String nome; private String cpf; private String cargo; private Endereço end; private CadastroEnderecoGUI cadastroEnd = null; //Construtor Padrão public CadastroFuncionarioGUI() { //Código para deixar a aparencia semelhante ao SO usado try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { // TODO Auto-generated catch block e.printStackTrace(); } criaLayout(); frameCadastroFuncionario.setVisible(true); } //Coloca os componentes no frame private void criaLayout() { frameCadastroFuncionario = new JFrame(); frameCadastroFuncionario.setResizable(false); frameCadastroFuncionario.setTitle("Funcionário"); frameCadastroFuncionario.setBounds(100, 100, 330, 311); frameCadastroFuncionario.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frameCadastroFuncionario.getContentPane().setLayout(null); frameCadastroFuncionario.setLocationRelativeTo(null); frameCadastroFuncionario.setIconImage(icone.getImage()); //Panel para o label do título JPanel panelLableFuncionario = new JPanel(); panelLableFuncionario.setBounds(0, 0, 314, 27); frameCadastroFuncionario.getContentPane().add(panelLableFuncionario); //Label para o título do cabeçalho JLabel labelFuncionario = new JLabel("Cadastro de Funcionário:"); panelLableFuncionario.add(labelFuncionario); //Panel para Label da entrada de dados JPanel panelLabelDados = new JPanel(); panelLabelDados.setBounds(10, 38, 61, 176); frameCadastroFuncionario.getContentPane().add(panelLabelDados); panelLabelDados.setLayout(new GridLayout(4, 1, 0, 0)); /* * Todos os lables relacionados à entrada de dados */ JLabel labelNome = new JLabel("Nome:"); labelNome.setHorizontalAlignment(SwingConstants.RIGHT); panelLabelDados.add(labelNome); JLabel lableCpf = new JLabel("CPF:"); lableCpf.setHorizontalAlignment(SwingConstants.RIGHT); panelLabelDados.add(lableCpf); JLabel lableCargo = new JLabel("Cargo:"); lableCargo.setHorizontalAlignment(SwingConstants.RIGHT); panelLabelDados.add(lableCargo); JLabel labelEndereco = new JLabel("Endereço:"); labelEndereco.setHorizontalAlignment(SwingConstants.RIGHT); panelLabelDados.add(labelEndereco); //Panel agrupando meios de entrada de dados JPanel panelEntradaDados = new JPanel(); panelEntradaDados.setBounds(81, 38, 223, 176); frameCadastroFuncionario.getContentPane().add(panelEntradaDados); panelEntradaDados.setLayout(null); /* * Todos os componentes relacionados à entrada de dados */ textFieldNome = new JTextField(); textFieldNome.setBounds(10, 11, 203, 20); panelEntradaDados.add(textFieldNome); textFieldNome.setColumns(10); textFieldCpf = new JTextField(); textFieldCpf.setColumns(10); textFieldCpf.setBounds(10, 54, 203, 20); panelEntradaDados.add(textFieldCpf); textFieldCargo = new JTextField(); textFieldCargo.setColumns(10); textFieldCargo.setBounds(10, 100, 203, 20); panelEntradaDados.add(textFieldCargo); JButton buttonAddEndereco = new JButton("Adic. Endereço..."); buttonAddEndereco.setBounds(96, 142, 117, 23); panelEntradaDados.add(buttonAddEndereco); buttonAddEndereco.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cadastroEnd = new CadastroEnderecoGUI(); } }); //Button final para realizar o cadastro JButton buttonCadastrar = new JButton("Cadastrar"); buttonCadastrar.setBounds(110, 238, 89, 23); frameCadastroFuncionario.getContentPane().add(buttonCadastrar); buttonCadastrar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(textFieldNome.getText().length() == 0 || textFieldCpf.getText().length() == 0 || textFieldCargo.getText().length() == 0) { JOptionPane.showMessageDialog(null, "Campos em branco não são permitidos."); } else if(cadastroEnd == null){ JOptionPane.showMessageDialog(null, "Por favor, adicione um endereço."); } else if(textFieldCpf.getText().length() != 11) { JOptionPane.showMessageDialog(null, "O CPF deve ter 11 dígitos. Utilize somente números."); } else { nome = textFieldNome.getText(); cpf = textFieldCpf.getText(); cargo = textFieldCargo.getText(); try { end = cadastroEnd.getEnderecoFinal(); }catch (NullPointerException e1) { e1.printStackTrace(); } //Tentativa de criar o objeto funcionário, se o cpf for validado try { func = new Funcionario(nome, end, cpf, cargo); JOptionPane.showMessageDialog(null, "Cadastro realizado com sucesso"); JanelaPrincipalGUI.addFuncionario(func); textFieldCargo.setText(""); textFieldCpf.setText(""); textFieldNome.setText(""); frameCadastroFuncionario.setVisible(false); } catch (Exception e1) { JOptionPane.showMessageDialog(null, "O CPF digitado é inválido. Tente novamente, ultilizando somente números."); } } } }); } }
[ "noreply@github.com" ]
noreply@github.com
74394770470a61d80d716dd3249e98947b33bc9d
c278b2e06e98b0b99ca7350cfc12d2e535db1841
/posp/trans-core/src/main/java/com/yl/pay/pos/entity/IcKey.java
e14a0d65b35d7013ff6a977d7fcb20b9d33f03ae
[]
no_license
SplendorAnLin/paymentSystem
ea778c03179a36755c52498fd3f5f1a5bbeb5d34
db308a354a23bd3a48ff88c16b29a43c4e483e7d
refs/heads/master
2023-02-26T14:16:27.283799
2022-10-20T07:50:35
2022-10-20T07:50:35
191,535,643
5
6
null
2023-02-22T06:42:24
2019-06-12T09:01:15
Java
UTF-8
Java
false
false
2,626
java
package com.yl.pay.pos.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import java.util.Date; /** * IC卡公钥下载 * @author haitao.liu * */ @Entity @Table(name = "IC_KEY") public class IcKey extends BaseEntity { private static final long serialVersionUID = 1L; private String rid; //rid private String keyIndex; //公钥序列 private String expTime; //有效期 private String hashAlgorithmId; //哈什算法标识 private String algorithmId; //公钥算法标识 private String modulus; //公钥模 private String exponent; //公钥指数 private String checkvalue; //公钥校验值 private Date createTime; //创建日期 private Integer seqIndex; //索引号 /** * RID * @return */ @Column(name = "RID", length = 30) public String getRid() { return rid; } public void setRid(String rid) { this.rid = rid; } @Column(name = "KEY_INDEX", length = 30) public String getKeyIndex() { return keyIndex; } public void setKeyIndex(String keyIndex) { this.keyIndex = keyIndex; } @Column(name = "EXP_TIME", length = 30) public String getExpTime() { return expTime; } public void setExpTime(String expTime) { this.expTime = expTime; } @Column(name = "HASH_ALGORITHM_ID", length =10) public String getHashAlgorithmId() { return hashAlgorithmId; } public void setHashAlgorithmId(String hashAlgorithmId) { this.hashAlgorithmId = hashAlgorithmId; } @Column(name = "ALGORITHM_ID", length =10) public String getAlgorithmId() { return algorithmId; } public void setAlgorithmId(String algorithmId) { this.algorithmId = algorithmId; } @Column(name = "MODULUS", length =1000) public String getModulus() { return modulus; } public void setModulus(String modulus) { this.modulus = modulus; } @Column(name = "EXPONENT", length =10) public String getExponent() { return exponent; } public void setExponent(String exponent) { this.exponent = exponent; } @Column(name = "CHECK_VALUE", length =500) public String getCheckvalue() { return checkvalue; } public void setCheckvalue(String checkvalue) { this.checkvalue = checkvalue; } @Column(name = "CREATE_TIME", length =500,columnDefinition = "DATETIME") public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @Column(name = "seq_Index", length = 30) public Integer getSeqIndex() { return seqIndex; } public void setSeqIndex(Integer seqIndex) { this.seqIndex = seqIndex; } }
[ "zl88888@live.com" ]
zl88888@live.com
6a13a14078457da8fcc0812e4beb92ba9ee0c748
36dacd517dc9ade7cac10547172cc500dfe92247
/product-api/src/main/java/com/ivanfranchin/productapi/rest/dto/CreateProductRequest.java
4d147ce92ff8df1ae4451921b938d991b91dfa5f
[]
no_license
ivangfr/springboot-elasticsearch-thymeleaf
3e2c52b548aac6e89decebbc37db20ace82c1f54
e898d4a5d8be540edc07a9b3086ad1ff3ec1fa19
refs/heads/master
2023-07-29T21:38:41.434068
2023-07-07T13:18:03
2023-07-07T13:18:03
146,220,783
7
13
null
null
null
null
UTF-8
Java
false
false
884
java
package com.ivanfranchin.productapi.rest.dto; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import java.math.BigDecimal; import java.util.Set; @Data public class CreateProductRequest { @Schema(title = "product name", example = "Apple 13\" MacBook Pro") @NotBlank private String name; @Schema( title = "product description", example = "Apple 13\" MacBook Pro, Retina Display, 2.3GHz Intel Core i5 Dual Core, 8GB RAM, 128GB SSD, Space Gray, MPXQ2LL/A ") @NotBlank private String description; @Schema(title = "product price", example = "1099.90") @NotNull private BigDecimal price; @Schema(title = "product categories", example = "[\"laptops\", \"apple\"]") private Set<String> categories; }
[ "ivan.franchin@takeaway.com" ]
ivan.franchin@takeaway.com
968f2fdada809936faf5f490593c77e700a918cd
7984a996c085b9bd04f02e89cad3124faea809ed
/Temp/src/serverOneThread/RunClients.java
6bd879aa7fa62f2dd59f04e286080da2b939c2c8
[]
no_license
Andrej-Kunitsin/Study
0be58902fd08e32d6a7a4f4a203bc965e3028620
e25317729da46a6ebcd4b9921615ff50af21a12d
refs/heads/master
2021-01-18T12:25:23.031367
2015-04-09T12:24:17
2015-04-09T12:24:17
33,671,191
1
0
null
2015-04-09T13:43:13
2015-04-09T13:43:13
null
UTF-8
Java
false
false
883
java
package serverOneThread; import java.io.IOException; public class RunClients extends Thread { @Override public void run() { while (true) { String allMessage = null; synchronized (MainServ.list) { for (Clients client : MainServ.list) { try { while (client.inStream.available() > 0) { allMessage = "User " + client.name + " send massage: " + client.inStream.readUTF(); } } catch (IOException e) { e.printStackTrace(); } } } if (allMessage != null) { sendMassageAllClients(allMessage); } } } private void sendMassageAllClients(String massage) { synchronized (MainServ.list) { for (Clients client : MainServ.list) { try { client.outStream.writeUTF(massage); } catch (IOException e) { e.printStackTrace(); } } } } }
[ "jack_killer@Jack-NoteBook" ]
jack_killer@Jack-NoteBook
f75b6a5c33cb7824049fcbce19c255c79b729b0c
be5d92c212a3e7ecfd417a25c28b44956691c49d
/app/src/main/java/com/fullsecurity/server/User.java
7d934a3d6a80a0c3719191ef07a2983d0a5711b9
[]
no_license
jamesbmorris4444/fsclient
97197c780b447849af90ed8e1c20b18940dfad86
30ee690391f00314c8cd977c079391b22baeab1c
refs/heads/master
2022-10-01T13:53:14.445860
2020-06-07T21:05:48
2020-06-07T21:05:48
173,017,194
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package com.fullsecurity.server; public class User { private String name; private int level; public User(String name, int level) { this.name = name; this.level = level; } public String toString() { return "[" + name + "," + level + "]"; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } }
[ "james.m@coppermobile.com" ]
james.m@coppermobile.com
5c04555f7dd953be367cd8fc60d2fcb91df4fbcd
4d51cb9b9e70ec818a666f6929a8e9d336eb6500
/KissanDost/app/src/main/java/com/my/kissandost/sign_up.java
8717e0534845985d4430de2029476cf31433f73c
[]
no_license
mhamzasakhi/Kissan-Dost-Mobile-App
973a3adcdd1cd3e578222c3716a1e0e5cdb8bdaf
45e4a2ea1d3898068aebe08eaf8a2d79080caf54
refs/heads/master
2022-04-09T00:01:06.259666
2020-02-11T12:42:52
2020-02-11T12:42:52
239,757,489
1
0
null
null
null
null
UTF-8
Java
false
false
4,604
java
package com.my.kissandost; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; public class sign_up extends AppCompatActivity { private String status = "false"; private EditText phoneNumber, firstName, lastName, emailId, password, confirmPassword,address; private Button signUp; public String fName, lName, email, pword, confirmpword, pno,add; private DatabaseReference root; private FirebaseAuth fAuth = FirebaseAuth.getInstance(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sign_up); Toast.makeText(getApplicationContext(),"Heeeellllloooo",Toast.LENGTH_SHORT).show(); getSupportActionBar().hide(); //Intent intent = getIntent(); //String number = intent.getStringExtra("Number"); //Log.i("Number", number); //Log.i("Title", title); address = findViewById(R.id.address); phoneNumber = findViewById(R.id.mobileNumber); firstName = findViewById(R.id.firstName); lastName = findViewById(R.id.lastName); emailId = findViewById(R.id.emailId); password = findViewById(R.id.signUpPassword); confirmPassword = findViewById(R.id.confirmPassword); signUp = findViewById(R.id.signUp); //phoneNumber.setText(number); //address.setText(); //phoneNumber.setEnabled(false); signUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fName = firstName.getText().toString(); lName = lastName.getText().toString(); email = emailId.getText().toString(); pno = phoneNumber.getText().toString(); pword = password.getText().toString(); confirmpword = confirmPassword.getText().toString(); add = address.getText().toString(); if (fName.equals("") || lName.equals("") || email.equals("") || pno.equals("") || pword.equals("") || confirmpword.equals("")) { Toast.makeText(getApplicationContext(), "Please Fill All the Inputs", Toast.LENGTH_SHORT).show(); } else { if (pword.equals(confirmpword)) { //signIn(email, pword); root = FirebaseDatabase.getInstance().getReference("EFarmer"); String id = root.push().getKey(); //Log.i("ID :", id); User user = new User(fName, lName, email, pno, pword,add); root.child("Signup").child(id).setValue(user); //Log.i("Status", " Dat successfully added"); Intent intent1 = new Intent(getApplicationContext(),Login.class); startActivity(intent1); } else { Toast.makeText(getApplicationContext(), "password entered incorrectly..Please re-enter password", Toast.LENGTH_SHORT).show(); password.setText(""); confirmPassword.setText(""); } } } }); } private void signIn(String email, String pwd) { fAuth.createUserWithEmailAndPassword(email, pwd) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { Log.d("Status", "signin successful"); } else { Log.w("Status ", task.getException()); Toast.makeText(getApplicationContext(),"Invalid Email Or week password",Toast.LENGTH_SHORT).show(); } } }); } @Override protected void onStart() { super.onStart(); } }
[ "1602028@namal.edu.pk" ]
1602028@namal.edu.pk
6f0381bf0664f1459bc67260a507cb6880212af8
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/java_awt_SystemColor_getTransparency.java
c80cbcaac9e2856770571e428579c71d4f01bc2b
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
153
java
class java_awt_SystemColor_getTransparency{ public static void function() {java.awt.SystemColor obj = new java.awt.SystemColor();obj.getTransparency();}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com