hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
sequence
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
sequence
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
sequence
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e02eabc4ee33b12c4279de643785aef460618ca
1,939
java
Java
spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java
LMDreamFree/spring-framework
3940d2a952cf7b914cd7b1aab737f3996f54ac6b
[ "Apache-2.0" ]
49,076
2015-01-01T07:23:26.000Z
2022-03-31T23:57:00.000Z
spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java
LMDreamFree/spring-framework
3940d2a952cf7b914cd7b1aab737f3996f54ac6b
[ "Apache-2.0" ]
7,918
2015-01-06T17:17:21.000Z
2022-03-31T20:10:05.000Z
spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java
LMDreamFree/spring-framework
3940d2a952cf7b914cd7b1aab737f3996f54ac6b
[ "Apache-2.0" ]
37,778
2015-01-01T08:25:16.000Z
2022-03-31T17:25:08.000Z
34.625
117
0.781331
1,207
/* * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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.springframework.jms.support.destination; import jakarta.jms.ConnectionFactory; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.Mockito.mock; /** * @author Rick Evans * @author Chris Beams */ public class JmsDestinationAccessorTests { @Test public void testChokesIfDestinationResolverIsetToNullExplicitly() throws Exception { ConnectionFactory connectionFactory = mock(ConnectionFactory.class); JmsDestinationAccessor accessor = new StubJmsDestinationAccessor(); accessor.setConnectionFactory(connectionFactory); assertThatIllegalArgumentException().isThrownBy(() -> accessor.setDestinationResolver(null)); } @Test public void testSessionTransactedModeReallyDoesDefaultToFalse() throws Exception { JmsDestinationAccessor accessor = new StubJmsDestinationAccessor(); assertThat(accessor.isPubSubDomain()).as("The [pubSubDomain] property of JmsDestinationAccessor must default to " + "false (i.e. Queues are used by default). Change this test (and the " + "attendant Javadoc) if you have changed the default.").isFalse(); } private static class StubJmsDestinationAccessor extends JmsDestinationAccessor { } }
3e02eb89ba77ae02ccdbad2a3525263068846d89
8,697
java
Java
LemonBubble/lemonbubble-samples/src/main/java/net/lemonsoft/lemonbubble/samples/MainActivity.java
LemonITCN/LemonBubble4Android
3fcf39961fba3ee263baba77e780b94708ba0e96
[ "MIT" ]
35
2018-02-09T03:35:34.000Z
2020-12-17T08:47:19.000Z
LemonBubble/lemonbubble-samples/src/main/java/net/lemonsoft/lemonbubble/samples/MainActivity.java
LemonITCN/LemonBubble4Android
3fcf39961fba3ee263baba77e780b94708ba0e96
[ "MIT" ]
2
2019-02-28T11:08:04.000Z
2019-04-27T02:49:37.000Z
LemonBubble/lemonbubble-samples/src/main/java/net/lemonsoft/lemonbubble/samples/MainActivity.java
LemonITCN/LemonBubble4Android
3fcf39961fba3ee263baba77e780b94708ba0e96
[ "MIT" ]
5
2018-02-11T08:21:44.000Z
2020-12-17T08:47:20.000Z
42.42439
112
0.612395
1,208
package net.lemonsoft.lemonbubble.samples; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PathMeasure; import android.graphics.RectF; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.webkit.WebView; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.Toast; import net.lemonsoft.lemonbubble.LemonBubble; import net.lemonsoft.lemonbubble.LemonBubbleInfo; import net.lemonsoft.lemonbubble.LemonBubbleView; import net.lemonsoft.lemonbubble.enums.LemonBubbleLayoutStyle; import net.lemonsoft.lemonbubble.enums.LemonBubbleLocationStyle; import net.lemonsoft.lemonbubble.interfaces.LemonBubbleLifeCycleDelegate; import net.lemonsoft.lemonbubble.interfaces.LemonBubbleMaskOnTouchContext; import net.lemonsoft.lemonbubble.interfaces.LemonBubblePaintContext; import java.sql.SQLOutput; import java.util.ArrayList; import java.util.List; import java.util.Timer; public class MainActivity extends Activity { private SizeTool _PST = SizeTool.getPrivateSizeTool(); private LinearLayout button1; private LinearLayout button2; private LinearLayout button3; private LinearLayout button4; private LinearLayout button5; private LinearLayout button6; private LinearLayout button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LemonBubbleView.defaultBubbleView().setLifeCycleDelegate(new LemonBubbleLifeCycleDelegate.Adapter() { @Override public void willShow(LemonBubbleView bubbleView, LemonBubbleInfo bubbleInfo) { super.willShow(bubbleView, bubbleInfo); System.out.println("BUBBLE WILL SHOW~"); } @Override public void alreadyShow(LemonBubbleView bubbleView, LemonBubbleInfo bubbleInfo) { super.alreadyShow(bubbleView, bubbleInfo); System.out.println("BUBBLE ALREADY SHOW!"); } @Override public void willHide(LemonBubbleView bubbleView, LemonBubbleInfo bubbleInfo) { super.willHide(bubbleView, bubbleInfo); System.out.println("BUBBLE WILL HIDE~"); } @Override public void alreadyHide(LemonBubbleView bubbleView, LemonBubbleInfo bubbleInfo) { super.alreadyHide(bubbleView, bubbleInfo); System.out.println("BUBBLE ALREADY HIDE!"); } }); button1 = (LinearLayout) findViewById(R.id.btn1); button2 = (LinearLayout) findViewById(R.id.btn2); button3 = (LinearLayout) findViewById(R.id.btn3); button4 = (LinearLayout) findViewById(R.id.btn4); button5 = (LinearLayout) findViewById(R.id.btn5); button6 = (LinearLayout) findViewById(R.id.btn6); button7 = (LinearLayout) findViewById(R.id.btn7); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubble.getRightBubbleInfo()// 增加无限点语法修改bubbleInfo的特性 .setTitle("这是一个成功的提示,这是一个成功的提示") .setTitleFontSize(12)// 修改字体大小 .setTitleColor(Color.RED) .setMaskColor(Color.argb(100, 0, 0, 0))// 修改蒙版颜色 .show(MainActivity.this, 2000); // LemonBubble.showRight(MainActivity.this, "这是一个成功的提示", 2000); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubble.showError(MainActivity.this, "这是一个失败的提示", 2000); } }); button3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubble.showRoundProgress(MainActivity.this, "请求中..."); new Handler().postDelayed(new Runnable() { @Override public void run() { LemonBubble.showRight(MainActivity.this, "请求成功", 2000); } }, 2000); } }); button4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubbleInfo myInfo = LemonBubble.getRoundProgressBubbleInfo(); myInfo.setLocationStyle(LemonBubbleLocationStyle.BOTTOM); myInfo.setLayoutStyle(LemonBubbleLayoutStyle.ICON_LEFT_TITLE_RIGHT); myInfo.setTitle("正在删除"); myInfo.setTitleFontSize(14); myInfo.setBubbleSize(200, 50); myInfo.setProportionOfDeviation(0.1f); LemonBubble.showBubbleInfo(MainActivity.this, myInfo); new Handler().postDelayed(new Runnable() { @Override public void run() { LemonBubble.showRight(MainActivity.this, "删除成功", 2000); } }, 2000); } }); button5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubbleInfo frameInfo = new LemonBubbleInfo(); List<Bitmap> icons = new ArrayList<Bitmap>(); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble1)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble2)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble3)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble4)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble5)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble6)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble7)); icons.add(BitmapFactory.decodeResource(getResources(), R.mipmap.lkbubble8)); frameInfo.setIconArray(icons); frameInfo.setFrameAnimationTime(150); frameInfo.setTitle("正在加载中..."); frameInfo.setTitleColor(Color.DKGRAY); LemonBubble.showBubbleInfo(MainActivity.this, frameInfo); new Handler().postDelayed(new Runnable() { @Override public void run() { LemonBubble.showError(MainActivity.this, "加载失败", 2000); } }, 2000); } }); button6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubbleInfo iconInfo = new LemonBubbleInfo(); List<Bitmap> icon = new ArrayList<Bitmap>(); icon.add(BitmapFactory.decodeResource(getResources(), R.mipmap.icon_icon)); iconInfo.setIconArray(icon); iconInfo.setLocationStyle(LemonBubbleLocationStyle.TOP); iconInfo.setLayoutStyle(LemonBubbleLayoutStyle.ICON_LEFT_TITLE_RIGHT); iconInfo.setTitle("飞行模式已开启"); iconInfo.setProportionOfDeviation(0.05f); iconInfo.setBubbleSize(300, 60); LemonBubble.showBubbleInfo(MainActivity.this, iconInfo, 2000); } }); button7.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LemonBubble.getRoundProgressBubbleInfo() .setTitle("无限请求中...") .setOnMaskTouchContext(new LemonBubbleMaskOnTouchContext() { @Override public void onTouch(LemonBubbleInfo bubbleInfo, LemonBubbleView bubbleView) { bubbleView.hide(); Toast.makeText(getApplicationContext(), "您终止圆形了等待框~", Toast.LENGTH_LONG).show(); } }) .show(MainActivity.this); // startActivity(new Intent().setClass(MainActivity.this, TestActivity.class)); } }); } }
3e02ec43aae0a630ca4caec24e3aefacb3796140
408
java
Java
src/main/java/projectname/auth/exceptions/AttributeCannotBeNullException.java
CarlosMacedo/folder-structure-springboot
323c9d49db263f19082f9d132e35217aab6460b0
[ "MIT" ]
null
null
null
src/main/java/projectname/auth/exceptions/AttributeCannotBeNullException.java
CarlosMacedo/folder-structure-springboot
323c9d49db263f19082f9d132e35217aab6460b0
[ "MIT" ]
null
null
null
src/main/java/projectname/auth/exceptions/AttributeCannotBeNullException.java
CarlosMacedo/folder-structure-springboot
323c9d49db263f19082f9d132e35217aab6460b0
[ "MIT" ]
null
null
null
34
82
0.794118
1,209
package projectname.auth.exceptions; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.BAD_REQUEST) public class AttributeCannotBeNullException extends Exception { public AttributeCannotBeNullException(String attribute, Throwable throwable) { super("The " + attribute + " cannot be null.", throwable); } }
3e02ecd71bf0b39a8da5f9dce051f46e8828c986
1,075
java
Java
JDBCServletsJSPs/MVCDemo/src/main/java/com/rohan/trainings/mvc/model/AverageController.java
nagrohan726/eclipse-workspace
928a983258af1f3c2082f9fece630b7e9130ffc1
[ "MIT" ]
null
null
null
JDBCServletsJSPs/MVCDemo/src/main/java/com/rohan/trainings/mvc/model/AverageController.java
nagrohan726/eclipse-workspace
928a983258af1f3c2082f9fece630b7e9130ffc1
[ "MIT" ]
null
null
null
JDBCServletsJSPs/MVCDemo/src/main/java/com/rohan/trainings/mvc/model/AverageController.java
nagrohan726/eclipse-workspace
928a983258af1f3c2082f9fece630b7e9130ffc1
[ "MIT" ]
null
null
null
29.861111
80
0.788837
1,210
package com.rohan.trainings.mvc.model; import java.io.IOException; import jakarta.servlet.RequestDispatcher; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; /** * Servlet implementation class AverageController */ public class AverageController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int num1 = Integer.parseInt(request.getParameter("number1")); int num2 = Integer.parseInt(request.getParameter("number2")); AverageCalculator model = new AverageCalculator(); int result = model.calculate(num1, num2); request.setAttribute("result", result); RequestDispatcher dispatcher = request.getRequestDispatcher("result.jsp"); dispatcher.forward(request, response); } }
3e02ece4f4c00cd68575049c2f85074891a2d305
3,994
java
Java
corpus/class/eclipse.jdt.ui/5384.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
15
2018-07-10T09:38:31.000Z
2021-11-29T08:28:07.000Z
corpus/class/eclipse.jdt.ui/5384.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
3
2018-11-16T02:58:59.000Z
2021-01-20T16:03:51.000Z
corpus/class/eclipse.jdt.ui/5384.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
6
2018-06-27T20:19:00.000Z
2022-02-19T02:29:53.000Z
29.367647
97
0.669755
1,211
/******************************************************************************* * Copyright (c) 2000, 2011 IBM Corporation 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: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.ui.javaeditor; import java.util.Iterator; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.compiler.CategorizedProblem; /** * Interface of annotations representing markers * and problems. * * @see org.eclipse.core.resources.IMarker * @see org.eclipse.jdt.core.compiler.IProblem */ public interface IJavaAnnotation { /** * Returns the type of the annotation. * * @return the type of the annotation * @see org.eclipse.jface.text.source.Annotation#getType() */ String getType(); /** * Returns whether this annotation is persistent. * * @return <code>true</code> if this annotation is persistent, <code>false</code> otherwise * @see org.eclipse.jface.text.source.Annotation#isPersistent() */ boolean isPersistent(); /** * Returns whether this annotation is marked as deleted. * * @return <code>true</code> if annotation is marked as deleted, <code>false</code> otherwise * @see org.eclipse.jface.text.source.Annotation#isMarkedDeleted() */ boolean isMarkedDeleted(); /** * Returns the text associated with this annotation. * * @return the text associated with this annotation or <code>null</code> * @see org.eclipse.jface.text.source.Annotation#getText() */ String getText(); /** * Returns whether this annotation is overlaid. * * @return <code>true</code> if overlaid */ boolean hasOverlay(); /** * Returns the overlay of this annotation. * * @return the annotation's overlay * @since 3.0 */ IJavaAnnotation getOverlay(); /** * Returns an iterator for iterating over the * annotation which are overlaid by this annotation. * * @return an iterator over the overlaid annotations */ Iterator<IJavaAnnotation> getOverlaidIterator(); /** * Adds the given annotation to the list of * annotations which are overlaid by this annotations. * * @param annotation the problem annotation */ void addOverlaid(IJavaAnnotation annotation); /** * Removes the given annotation from the list of * annotations which are overlaid by this annotation. * * @param annotation the problem annotation */ void removeOverlaid(IJavaAnnotation annotation); /** * Tells whether this annotation is a problem * annotation. * * @return <code>true</code> if it is a problem annotation */ boolean isProblem(); /** * Returns the compilation unit corresponding to the document on which the annotation. * * @return the compilation unit or <code>null</code> if no corresponding compilation unit exists */ ICompilationUnit getCompilationUnit(); /** * Returns the problem arguments or <code>null</code> if no problem arguments can be evaluated. * * @return returns the problem arguments or <code>null</code> if no problem * arguments can be evaluated. */ String[] getArguments(); /** * Returns the problem id or <code>-1</code> if no problem id can be evaluated. * * @return returns the problem id or <code>-1</code> */ int getId(); /** * Returns the marker type associated to this problem or <code>null<code> if no marker type * can be evaluated. See also {@link CategorizedProblem#getMarkerType()}. * * @return the type of the marker which would be associated to the problem or * <code>null<code> if no marker type can be evaluated. */ String getMarkerType(); }
3e02ecf7da3795799be2ca23540fdc4b1134fc77
1,143
java
Java
pure-jcore/src/main/java/threading/ThreadingSyncConsumer.java
mooselau/goose-in-tech
71c17fe0fdd6dc728681048b86e9f7b08dc9bfcc
[ "MIT" ]
null
null
null
pure-jcore/src/main/java/threading/ThreadingSyncConsumer.java
mooselau/goose-in-tech
71c17fe0fdd6dc728681048b86e9f7b08dc9bfcc
[ "MIT" ]
null
null
null
pure-jcore/src/main/java/threading/ThreadingSyncConsumer.java
mooselau/goose-in-tech
71c17fe0fdd6dc728681048b86e9f7b08dc9bfcc
[ "MIT" ]
null
null
null
24.847826
116
0.553806
1,212
package threading; /** * Use Synchronized to demo Producer-Consumer. */ public class ThreadingSyncConsumer { private ThreadingSyncQueue<String> queue; public ThreadingSyncConsumer(ThreadingSyncProducer producer) { queue = producer.getQueue(); } public void entrypoint() { generateWorkers(); } private void start() { while (true) { try { // polling job p(String.format("%s - is waiting new job", Thread.currentThread().getName())); String newTask = queue.take(); p(String.format("%s - new job [%s] taken & processing", Thread.currentThread().getName(), newTask)); // sleep 2s Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } } private void generateWorkers() { Thread workerC = new Thread(this::start); Thread workerD = new Thread(this::start); workerC.start(); workerD.start(); } private void p(String msg) { System.out.println(msg); } }
3e02ed241c0fd524806fb9342786de85b3693a93
946
java
Java
sincogpro/src/com/sincogpro/modelos/Descuento.java
devNica/J-SINCO-GPRO
3aee352fd38d5772fb67ebd592ee156761a4bbcd
[ "MIT" ]
1
2021-01-09T12:32:46.000Z
2021-01-09T12:32:46.000Z
sincogpro/src/com/sincogpro/modelos/Descuento.java
devNica/J-SINCO-GPRO
3aee352fd38d5772fb67ebd592ee156761a4bbcd
[ "MIT" ]
null
null
null
sincogpro/src/com/sincogpro/modelos/Descuento.java
devNica/J-SINCO-GPRO
3aee352fd38d5772fb67ebd592ee156761a4bbcd
[ "MIT" ]
null
null
null
20.12766
79
0.643763
1,213
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sincogpro.modelos; /** * * @author Alejandro Gonzalez */ public class Descuento { private int IDDESCUENTO; private String DESCUENTO; private double PORCENTAJE; public Descuento(){ this.IDDESCUENTO = 1; } public String getDESCUENTO() { return DESCUENTO; } public void setDESCUENTO(String DESCUENTO) { this.DESCUENTO = DESCUENTO; } public double getPORCENTAJE() { return PORCENTAJE; } public void setPORCENTAJE(double PORCENTAJE) { this.PORCENTAJE = PORCENTAJE; } public int getIDDESCUENTO() { return IDDESCUENTO; } public void setIDDESCUENTO(int IDDESCUENTO) { this.IDDESCUENTO = IDDESCUENTO; } }
3e02ed7713f32bb2bdb892bcfdc205686a4134f7
685
java
Java
src/main/java/me/qiancheng/qianworks/logger/controller/UserController.java
iqiancheng/annotation-logger
1ebc3e92ff004f53d1c6a1835b103234f12341fc
[ "Apache-2.0" ]
null
null
null
src/main/java/me/qiancheng/qianworks/logger/controller/UserController.java
iqiancheng/annotation-logger
1ebc3e92ff004f53d1c6a1835b103234f12341fc
[ "Apache-2.0" ]
null
null
null
src/main/java/me/qiancheng/qianworks/logger/controller/UserController.java
iqiancheng/annotation-logger
1ebc3e92ff004f53d1c6a1835b103234f12341fc
[ "Apache-2.0" ]
null
null
null
28.416667
78
0.728739
1,214
package me.qiancheng.qianworks.logger.controller; import me.qiancheng.qianworks.logger.base.EnableLog; import org.slf4j.Logger; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * @author <a href="[email protected]">千橙</a> */ @RestController public class UserController { @EnableLog private static Logger LOG ; @RequestMapping(value = "/test") public void test(@RequestParam(value = "name",required = false)String name ,@RequestParam(value = "pw",required = false)String pw) { // TODO: 8/28/16 } }
3e02edbdf1ff82005d84be3db65ad8bf009c64ad
11,224
java
Java
com.steve-jackson-studios.tenfour/app/src/main/java/com/steve-jackson-studios/tenfour/Data/ChatData.java
sdjack/TenFour
4c709316bfa704d7e22ca60a9e47674a2a9bd6c1
[ "MIT" ]
null
null
null
com.steve-jackson-studios.tenfour/app/src/main/java/com/steve-jackson-studios/tenfour/Data/ChatData.java
sdjack/TenFour
4c709316bfa704d7e22ca60a9e47674a2a9bd6c1
[ "MIT" ]
null
null
null
com.steve-jackson-studios.tenfour/app/src/main/java/com/steve-jackson-studios/tenfour/Data/ChatData.java
sdjack/TenFour
4c709316bfa704d7e22ca60a9e47674a2a9bd6c1
[ "MIT" ]
null
null
null
36.560261
158
0.590699
1,215
package com.steve-jackson-studios.tenfour.Data; import android.os.AsyncTask; import android.text.TextUtils; import com.steve-jackson-studios.tenfour.AppConstants; import com.steve-jackson-studios.tenfour.Observer.Dispatch; import com.steve-jackson-studios.tenfour.Observer.ObservedEvents; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.TreeMap; import java.util.UUID; /** * Created by sjackson on 7/28/2017. * ChatData */ public class ChatData { private static final HashMap<String, ChatSubdivisionData> DATA = new HashMap<>(); private static final HashMap<String, ArrayList<ChatPostData>> SYSTEM_MESSAGES = new HashMap<>(); private static final ArrayList<DataLockListener> LISTENERS = new ArrayList<>(); private static boolean LOCKED = false; private ChatData() {} public static abstract class Fields { public static final String ID = "ID"; public static final String ORDER_ID = "ORDER_ID"; public static final String LOCATION = "LOCATION"; public static final String EVENT_ID = "EVENT_ID"; public static final String SUBDIVISION_ID = "SUBDIVISION_ID"; public static final String REPLY_ID = "REPLY_ID"; public static final String USERNAME = "USERNAME"; public static final String DISPLAY_NAME = "DISPLAY_NAME"; public static final String DISPLAY_INITIALS = "DISPLAY_INITIALS"; public static final String AVATAR_TYPE = "AVATAR_TYPE"; public static final String AVATAR_COLOR = "AVATAR_COLOR"; public static final String SCORE = "SCORE"; public static final String DISPLAY_STATUS = "STATUS"; public static final String LATITUDE = "LATITUDE"; public static final String LONGITUDE = "LONGITUDE"; public static final String MESSAGE = "MESSAGE"; public static final String IMAGE = "IMAGE"; public static final String STICKER = "STICKER"; public static final String LAST_UPDATE = "LAST_UPDATE"; public static final String KARMA = "KARMA"; public static final String REPLY_COUNT = "REPLY_COUNT"; public static final String REACTIONS = "REACTIONS"; public static final String CREATED_ON = "CREATED_ON"; } public static void loadSystemMessage(JSONObject data) { try { String locationId = data.getString(Fields.LOCATION); ArrayList<ChatPostData> systemMessageData = getSystemMessageData(locationId); systemMessageData.add(new ChatPostData(data)); } catch (JSONException e) { e.printStackTrace(); } Dispatch.triggerEvent(ObservedEvents.NOTIFY_AVAILABLE_CHAT_DATA); } public static void loadChatData(JSONObject data) { //Log.d("DEVDEBUG", "loadChatData->JSONObject->LOCKED = " + LOCKED); if (LOCKED) return; lock(); try { if (!data.isNull(Fields.SUBDIVISION_ID)) { String fenceId = data.getString(Fields.SUBDIVISION_ID); if (!data.isNull(Fields.LOCATION)) { String locationId = data.getString(Fields.LOCATION); ChatSubdivisionData model = getData(fenceId); model.loadTemp(locationId, data); } } } catch (JSONException e) { e.printStackTrace(); } finally { unlock(); } } public static void loadChatData(JSONArray source) { //Log.d("DEVDEBUG", "loadChatData->JSONArray->LOCKED = " + LOCKED); //if (LOCKED) return; lock(); new AsyncDataLoader(source).execute(); } public static void loadPreviewData(JSONArray source) { if (LOCKED) return; lock(); new AsyncPreviewLoader(source).execute(); } public static ChatPostData[] getTopStickers(String subdivisionId, String locationId) { if (null == getData(subdivisionId, locationId)) { return null; } return getData(subdivisionId, locationId).stickers(); } public static ArrayList<ChatPostData> getSystemMessageData(String locationId) { ArrayList<ChatPostData> data; if (SYSTEM_MESSAGES.get(locationId) == null) { data = new ArrayList<>(); SYSTEM_MESSAGES.put(locationId, data); } else { data = SYSTEM_MESSAGES.get(locationId); } return data; } public static ChatSubdivisionData getData(String subdivisionId) { ChatSubdivisionData chatSubdivisionData; if (DATA.get(subdivisionId) == null) { chatSubdivisionData = new ChatSubdivisionData(subdivisionId); DATA.put(subdivisionId, chatSubdivisionData); } else { chatSubdivisionData = DATA.get(subdivisionId); } return chatSubdivisionData; } public static ChatLocationData getData(String subdivisionId, String locationId) { ChatSubdivisionData chatSubdivisionData; if (DATA.get(subdivisionId) == null) { chatSubdivisionData = new ChatSubdivisionData(subdivisionId); DATA.put(subdivisionId, chatSubdivisionData); } else { chatSubdivisionData = DATA.get(subdivisionId); } return chatSubdivisionData.getLocation(locationId); } public static Map getLive() { return getData(AppConstants.SUBDIVISION_ID).fetch(); } public static Map getPreview() { if (null != AppConstants.MAP_ACTIVE_SUBDIVISION_ID) { if (null != AppConstants.MAP_ACTIVE_LOCATION_ID && null != getData(AppConstants.MAP_ACTIVE_SUBDIVISION_ID, AppConstants.MAP_ACTIVE_LOCATION_ID)) { return getData(AppConstants.MAP_ACTIVE_SUBDIVISION_ID, AppConstants.MAP_ACTIVE_LOCATION_ID).fetch(); } return getData(AppConstants.MAP_ACTIVE_SUBDIVISION_ID).fetch(); } return null; } public static void setDataLockListener(DataLockListener listener) { LISTENERS.add(listener); } private static void lock() { LOCKED = true; for (int i = 0; i < LISTENERS.size(); i++) { LISTENERS.get(i).onLock(); } } private static void unlock() { for (int i = 0; i < LISTENERS.size(); i++) { LISTENERS.get(i).onUnlock(); } LOCKED = false; Dispatch.triggerEvent(ObservedEvents.NOTIFY_AVAILABLE_CHAT_DATA); } private static void unlockPreview() { for (int i = 0; i < LISTENERS.size(); i++) { LISTENERS.get(i).onUnlock(); } LOCKED = false; Dispatch.triggerEvent(ObservedEvents.NOTIFY_AVAILABLE_PREVIEW_DATA); } public interface DataLockListener { void onLock(); void onUnlock(); } public static int getUsableValue(JSONObject obj, String key, int fallback) throws JSONException { return (!obj.isNull(key)) ? obj.getInt(key) : fallback; } public static String getUsableUUID(JSONObject obj, String key) throws JSONException { String value = (!obj.isNull(key)) ? obj.getString(key) : ""; if (TextUtils.isEmpty(value)) { value = "TEMP" + UUID.randomUUID().toString(); obj.put(key, value); } return value; } public static String getDateTime() { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); Date date = new Date(); return dateFormat.format(date); } private static class AsyncDataLoader extends AsyncTask<Void, Void, Boolean> { private final JSONArray source; AsyncDataLoader(JSONArray source) { this.source = source; } @Override protected void onPostExecute(Boolean result) { unlock(); } @Override protected Boolean doInBackground(Void... voids) { try { int maxCount = source.length(); if (maxCount > 0) { for (int i = 0; i < maxCount; i++) { JSONObject data = (JSONObject) source.get(i); if (!data.isNull(Fields.SUBDIVISION_ID)) { String fenceId = data.getString(Fields.SUBDIVISION_ID); if (!data.isNull(Fields.LOCATION)) { int id = getUsableValue(data, Fields.ORDER_ID, 99); String locationId = data.getString(Fields.LOCATION); ChatSubdivisionData chatSubdivisionData = getData(fenceId); chatSubdivisionData.load(id, locationId, data); chatSubdivisionData.calcWeight(locationId); } } } return true; } } catch (JSONException e) { e.printStackTrace(); } return false; } } private static class AsyncPreviewLoader extends AsyncTask<Void, Void, Boolean> { private final JSONArray source; AsyncPreviewLoader(JSONArray source) { this.source = source; } @Override protected void onPostExecute(Boolean result) { unlockPreview(); } @Override protected Boolean doInBackground(Void... voids) { try { int maxCount = source.length(); if (maxCount > 0) { for (int i = 0; i < maxCount; i++) { JSONObject data = (JSONObject) source.get(i); if (!data.isNull(Fields.SUBDIVISION_ID)) { String fenceId = data.getString(Fields.SUBDIVISION_ID); if (!data.isNull(Fields.LOCATION)) { int id = getUsableValue(data, Fields.ORDER_ID, 99); String locationId = data.getString(Fields.LOCATION); ChatSubdivisionData chatSubdivisionData = getData(fenceId); chatSubdivisionData.load(id, locationId, data); } } } return true; } } catch (JSONException e) { e.printStackTrace(); } return false; } } public static <K, V extends Comparable<V>> Map<K, V> sortByValues(final Map<K, V> map) { Comparator<K> valueComparator = new Comparator<K>() { public int compare(K k1, K k2) { return map.get(k2).compareTo(map.get(k1)); } }; Map<K, V> sortedByValues = new TreeMap<K, V>(valueComparator); sortedByValues.putAll(map); return sortedByValues; } }
3e02eee28653f2bd3942ebba8bfaa31474eb1100
1,656
java
Java
dc3-driver/dc3-driver-mqtt/src/main/java/com/dc3/driver/mqtt/service/MqttSendService.java
292427558/iot-dc3
c9ef98073658d3d48893dbf923e5b25c3a22124a
[ "Apache-2.0" ]
785
2019-01-23T10:00:03.000Z
2022-03-31T06:28:29.000Z
dc3-driver/dc3-driver-mqtt/src/main/java/com/dc3/driver/mqtt/service/MqttSendService.java
292427558/iot-dc3
c9ef98073658d3d48893dbf923e5b25c3a22124a
[ "Apache-2.0" ]
15
2019-06-10T08:18:35.000Z
2022-03-15T00:55:23.000Z
dc3-driver/dc3-driver-mqtt/src/main/java/com/dc3/driver/mqtt/service/MqttSendService.java
292427558/iot-dc3
c9ef98073658d3d48893dbf923e5b25c3a22124a
[ "Apache-2.0" ]
186
2019-03-18T23:17:09.000Z
2022-03-31T16:04:57.000Z
29.052632
112
0.680556
1,216
/* * Copyright 2016-2021 Pnoker. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dc3.driver.mqtt.service; import org.springframework.integration.mqtt.support.MqttHeaders; import org.springframework.messaging.handler.annotation.Header; /** * @author pnoker */ public interface MqttSendService { /** * Use Default Topic & Default Qos Send Data * * @param data string */ void sendToMqtt(String data); /** * Use Default Topic & Custom Qos Send Data * * @param qos Custom Qos * @param data string */ void sendToMqtt(@Header(MqttHeaders.QOS) Integer qos, String data); /** * Use Custom Topic & Default Qos Send Data * * @param topic Custom Topic * @param data string */ void sendToMqtt(@Header(MqttHeaders.TOPIC) String topic, String data); /** * Use Custom Topic & Custom Qos Send Data * * @param topic Custom Topic * @param qos Custom Qos * @param data string */ void sendToMqtt(@Header(MqttHeaders.TOPIC) String topic, @Header(MqttHeaders.QOS) Integer qos, String data); }
3e02efce305f600cbc12d550dae3cec425b62cf3
1,350
java
Java
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/dao/inf/AbstractDao.java
onap/vfc-nfvo-driver-vnfm-svnfm
68bf871950a188ba607023fe9c4433d6ef5b7a9b
[ "Apache-2.0" ]
2
2019-12-17T02:13:03.000Z
2021-10-15T15:23:39.000Z
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/dao/inf/AbstractDao.java
onap/vfc-nfvo-driver-vnfm-svnfm
68bf871950a188ba607023fe9c4433d6ef5b7a9b
[ "Apache-2.0" ]
null
null
null
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/dao/inf/AbstractDao.java
onap/vfc-nfvo-driver-vnfm-svnfm
68bf871950a188ba607023fe9c4433d6ef5b7a9b
[ "Apache-2.0" ]
1
2020-06-10T05:58:10.000Z
2020-06-10T05:58:10.000Z
26.470588
75
0.678519
1,217
/* * Copyright 2016 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.dao.inf; import org.apache.ibatis.session.SqlSession; /** * database abstract class to get the MapperManager. */ public class AbstractDao { private SqlSession session; protected AbstractDao() { //Constructor } public SqlSession getSession() { return session; } public void setSession(SqlSession session) { this.session = session; } /** * get Mybatis Mapper. * * @param type : The class of the instance * @param <T> : The type of the instance * @return Mapper : The instance */ public <T> T getMapperManager(Class<T> type) { return (T)getSession().getMapper(type); } }
3e02f00bfc0c07587ed8deb228a7cfc2a475886b
280
java
Java
junior_003/src/main/java/ru/job4j/sqlru/utils/ConfigException.java
zCRUSADERz/AlexanderYakovlev
9b098fb876b5a60d5e5fdc8274b3b47e994d88ba
[ "Apache-2.0" ]
2
2019-03-03T16:26:31.000Z
2019-03-13T08:35:34.000Z
junior_003/src/main/java/ru/job4j/sqlru/utils/ConfigException.java
zCRUSADERz/AlexanderYakovlev
9b098fb876b5a60d5e5fdc8274b3b47e994d88ba
[ "Apache-2.0" ]
1
2022-02-16T00:55:29.000Z
2022-02-16T00:55:29.000Z
junior_003/src/main/java/ru/job4j/sqlru/utils/ConfigException.java
zCRUSADERz/AlexanderYakovlev
9b098fb876b5a60d5e5fdc8274b3b47e994d88ba
[ "Apache-2.0" ]
null
null
null
18.933333
53
0.68662
1,218
package ru.job4j.sqlru.utils; /** * App configuration exception. * * @author Alexander Yakovlev ([email protected]) * @since 04.08.2018 */ public class ConfigException extends Exception { public ConfigException(String msg, Throwable e) { super(msg, e); } }
3e02f0507e0c1bd044dbdbb54c52fda90899c602
605
java
Java
exercise1/src/abl/generated/Test_PreconditionSensorFactories.java
ensemble-ai/abl-assignment-rts-squad
afe8906023c3cf3c956e580c5f27bd8338979e0b
[ "MIT" ]
1
2019-01-28T05:59:08.000Z
2019-01-28T05:59:08.000Z
starter-inter-agents/src/abl/generated/Test_PreconditionSensorFactories.java
ensemble-ai/abl-assignment-rts-squad
afe8906023c3cf3c956e580c5f27bd8338979e0b
[ "MIT" ]
null
null
null
starter-inter-agents/src/abl/generated/Test_PreconditionSensorFactories.java
ensemble-ai/abl-assignment-rts-squad
afe8906023c3cf3c956e580c5f27bd8338979e0b
[ "MIT" ]
null
null
null
26.304348
84
0.719008
1,219
package abl.generated; import abl.runtime.*; import wm.WME; import wm.WorkingMemorySet; import wm.WMEIndex; import wm.TrackedWorkingMemory; import java.util.*; import java.lang.reflect.Method; import java.lang.reflect.Field; import abl.learning.*; import abl.wmes.*; import abl.actions.*; import abl.sensors.*; public class Test_PreconditionSensorFactories { static public SensorActivation[] preconditionSensorFactory0(int __$behaviorID) { switch (__$behaviorID) { default: throw new AblRuntimeError("Unexpected behaviorID " + __$behaviorID); } } }
3e02f109c3af0c48643a59b268665a0db7069f02
12,880
java
Java
JavaEFS/unlmod/edu/umd/cs/guitar/graph/converter/TST2Text.java
jazad136/EventFlowSlicerJava-releases
85ac191bfd4a79f4c9e3566f409f70fd04047b2f
[ "Apache-2.0" ]
2
2019-04-10T15:46:54.000Z
2021-07-29T22:42:13.000Z
JavaEFS/unlmod/edu/umd/cs/guitar/graph/converter/TST2Text.java
jazad136/EventFlowSlicerJava-releases
85ac191bfd4a79f4c9e3566f409f70fd04047b2f
[ "Apache-2.0" ]
5
2018-12-03T10:03:58.000Z
2019-04-10T15:33:13.000Z
JavaEFS/unlmod/edu/umd/cs/guitar/graph/converter/TST2Text.java
jazad136/EventFlowSlicerJava-releases
85ac191bfd4a79f4c9e3566f409f70fd04047b2f
[ "Apache-2.0" ]
1
2019-04-19T17:01:41.000Z
2019-04-19T17:01:41.000Z
33.454545
119
0.670186
1,220
/******************************************************************************* * Copyright (c) 2018 Jonathan A. Saddler * * 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. * * Contributors: * Jonathan A. Saddler - initial API and implementation *******************************************************************************/ package edu.umd.cs.guitar.graph.converter; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.text.RuleBasedCollator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.NoSuchElementException; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBIntrospector; import javax.xml.bind.Unmarshaller; import edu.umd.cs.guitar.model.XMLHandler; import edu.umd.cs.guitar.model.data.StepType; import edu.umd.cs.guitar.model.data.TestCase; import edu.unl.cse.efs.tools.PathConformance; import edu.unl.cse.efs.tools.StringTools; import edu.unl.cse.efs.tools.WildcardFiles; /** * * This class is designed to create a graphical representation of the content of a TST * file. A test case is simply a sequence of events happening one after the other. * This source code simply creates a file containing nodes representing all * events of a TST, and when rendered connects each node starting from the first event step * found in the file, to its successor step, and connects that successor to its successor, continuing until * the next to last successor is connected to a node representing the last step in the file. * The graph can then be rendered by the Graphviz application. * * In case of special characters, this class also has extra source to replace * any characters that will prevent the Graphviz application from opening, with * Graphviz-compatible characters * * @author Jonathan Saddler (jsaddle) * @version July 7, 2015 */ public class TST2Text { private static File OUT_TXT_FILE; private static File[] IN_TST_FILES; /** * If the user wishes to reverse the effects of bookmarking in the resulting DOT * file, then they should specify the -bk flag in the arguments, which will turn * this mode on, and remove the bookmarked widget numbered-name preceding any colons * found within the EventId's of this TST file. reverse_bookmarking_mode removes * the numbered name before the colon in an EventId as well as the colon itself, from * the resulting graph node. */ private static boolean REVERSE_BOOKMARKING_MODE; private static boolean PARSE_ONE; public static int organization; private static final String EVENT_ID_SPLITTER = "_"; /** * @param args */ public static void main(String[] args) { organization = 0; parseArgs(args); System.out.println("Input accepted..."); doConvertAndWriteToFile(OUT_TXT_FILE, IN_TST_FILES); } public static void parseArgs(String[] args) { boolean oFound, tst1Found, tst2Found, orgFound; oFound = tst1Found = tst2Found = orgFound = false; ArrayList<String> argsLeft = new ArrayList<String>(Arrays.asList(args)); Iterator<String> argsIt = argsLeft.iterator(); String target; ArrayList<File> tstFiles = new ArrayList<File>(); while(argsIt.hasNext()) { target = argsIt.next(); if(target.equals("-org")) { if(orgFound) throw new IllegalArgumentException("-org parameter cannot be defined twice."); orgFound = true; try { argsIt.remove(); String org = argsIt.next(); argsIt.remove(); organization = Integer.parseInt(org); } catch(NoSuchElementException | IllegalArgumentException e) { throw new IllegalArgumentException("Invalid argument passed to -org parameter.\n" + "Organization strategy must be a valid integer >= 0."); } } else if(target.equals("-o")) { if(oFound) throw new IllegalArgumentException("-o parameter cannot be defined twice."); oFound = true; try { argsIt.remove(); String newFilename = argsIt.next(); File newFile = new File(newFilename); if( newFile.isDirectory() || newFilename.charAt(newFilename.length()-1) == File.separatorChar) throw new IllegalArgumentException(); argsIt.remove(); OUT_TXT_FILE = newFile; } catch(NoSuchElementException | IllegalArgumentException e) { throw new IllegalArgumentException("Invalid argument passed to -o parameter.\n" + "Argument passed to -o must be a valid output .dot filename."); } } else { if(!tst1Found) tst1Found = true; else tst2Found = true; try { argsIt.remove(); if(target.contains("*")) { String filename = target; if(StringTools.charactersIn(filename, '*') >= 2) throw new IllegalArgumentException("Invalid wildcard argument passed to the program.\n" + "Input argument containing multiple asterisks is invalid."); int starPos = filename.indexOf('*'); String prePosString = filename.substring(0, starPos); String postPosString = filename.substring(starPos+1); File currentFile = null; try { JAXBContext context = JAXBContext.newInstance(TestCase.class); Unmarshaller um = context.createUnmarshaller(); ArrayList<File> retrieved = new ArrayList<File>(WildcardFiles.findFiles(prePosString, postPosString)); for(File iF : retrieved) { currentFile = iF; // test to see if the file is a valid TST if(!iF.exists()) continue; // skip invalid files else if(iF.isDirectory()) continue; // skip directories found. Object myFile; try { myFile = JAXBIntrospector.getValue(um.unmarshal(iF));} catch(JAXBException e) { continue; // this in particular is not a problem, just an invalid file } if(!(myFile instanceof TestCase)) continue; // passed all the tests, add the file. tstFiles.add(iF); } if(tstFiles.isEmpty()) { System.err.println("WARNING: Arguments specified by " + filename + " contained no valid input TestCase files"); } else { tst1Found = true; if(tstFiles.size() > 1) tst2Found = true; } } catch(IOException e) { throw new IllegalArgumentException("An access violation occurred while parsing input file arguments:\n" + e.getMessage()); } catch(JAXBException e) { String fileString = currentFile != null ? currentFile.getName() : ""; throw new IllegalArgumentException("An XML parsing violation occurred while parsing input file arguments:\n" + fileString + ": " + e.getLinkedException().getMessage()); } } else { File newFile = new File(target); if(newFile.isDirectory()) throw new IllegalArgumentException(); tstFiles.add(newFile); tst1Found = true; } } catch(NoSuchElementException | IllegalArgumentException e) { throw new IllegalArgumentException("Invalid argument passed to -o parameter.\n" + "Argument passed to -o must be a valid output file."); } } } IN_TST_FILES = tstFiles.toArray(new File[0]); if(!tst1Found) throw new IllegalArgumentException("At least one TST file must be provided."); if(!tst2Found) PARSE_ONE = true; if(!oFound) throw new IllegalArgumentException("The output file was not specified."); String folderPath = PathConformance.parseApplicationPath(OUT_TXT_FILE.getAbsolutePath()); if(!folderPath.isEmpty()) { File folder = new File(folderPath); if(!folder.exists()) throw new IllegalArgumentException("Directory of output file specified does not exist"); } } public static void doConvertAndWriteToFile(File outputFile, File[] inTST) { TestCase[] testCasesRead = new TestCase[inTST.length]; try { XMLHandler handler = new XMLHandler(); for(int i = 0; i < inTST.length; i++) { File tFile = inTST[i]; TestCase tst = null; tst = (TestCase) handler.readObjFromFileThrowExceptions(tFile, TestCase.class); if(tst == null) { System.err.println("Unable to read TST file.\nNow exiting..."); System.exit(1); } testCasesRead[i] = tst; } } catch(JAXBException e) { System.err.println("Unable to read TST file.\n" + e.getMessage()); System.err.println("Now exiting..."); System.exit(1); } StringBuffer result = toTextCompressLabel(inTST, testCasesRead, organization); System.out.println("Writing all input files to:\n" + outputFile); try { // Create file FileWriter fstream = new FileWriter(outputFile); BufferedWriter out = new BufferedWriter(fstream); out.write(result.toString()); // Close the output stream out.close(); System.out.println("Done."); } catch (IOException e) {// Catch exception if any System.err.println("Error: Unable to write test cases to file: " + e.getMessage()); } } public static String eventIdCorrection(String eventId) { String res = eventId; res = res.replace(" ", EVENT_ID_SPLITTER); res = res.replace(".", ""); res = res.replace("(", ""); res = res.replace(")", ""); res = res.replace(",", ""); res = res.replace("|", ""); res = res.replace("[", ""); res = res.replace("]", ""); res = res.replace("&", "and"); if(REVERSE_BOOKMARKING_MODE) { int colIndex = res.lastIndexOf(':'); if(colIndex != -1) res = res.substring(colIndex+1); } else res = res.replace(":", ""); return res; } public interface TSTLabels { public void add(int theNumber); public void addTo(int position, int theNumber); public String getFormattedLabel(int position); } public static class Organizer extends ArrayList<ArrayList<Integer>> implements TSTLabels { private boolean compress; public Organizer() { this.compress = false; } public Organizer(boolean compress) { this.compress = compress; } public void add(int theNumber) { ArrayList<Integer> newList = new ArrayList<Integer>(); newList.add(theNumber); super.add(newList); } public void addTo(int position, int theNumber) { get(position).add(theNumber); } public String getFormattedLabel(int position) { if(compress) { } //[ label="x,y,...,z String formattedLabel = ""; ArrayList<Integer> output = get(position); Collections.sort(output); Iterator<Integer> outIt = output.iterator(); formattedLabel += outIt.next(); int count = 0; while(outIt.hasNext()) { // formattedLabel += ","+outIt.next(); if(count == 6) { formattedLabel += ",\n" + outIt.next(); count = 0; } else { formattedLabel += ","+outIt.next(); count++; } } return "[ label=\"" + formattedLabel; } } public static class SetOrganizer extends ArrayList<HashSet<Integer>> implements TSTLabels { public void add(int theNumber) { HashSet<Integer> newSet = new HashSet<Integer>(); newSet.add(theNumber); super.add(newSet); } public void addTo(int position, int theNumber) { get(position).add(theNumber); } public String getFormattedLabel(int position) { //[ label="x,y,...,z String formattedLabel = ""; LinkedList<Integer> output = new LinkedList<Integer>(get(position)); Collections.sort(output); Iterator<Integer> outIt = output.iterator(); formattedLabel += outIt.next(); while(outIt.hasNext()) formattedLabel += ","+outIt.next(); return "[ label=\"" + formattedLabel; } } public static StringBuffer toTextCompressLabel(File[] filenames, TestCase[] tsts, int labelOrganization) { StringBuffer result = new StringBuffer(); for(int i = 0; i < tsts.length; i++) { TestCase tc = tsts[i]; String lastString = PathConformance.parseApplicationName(filenames[i].getAbsolutePath()); lastString = lastString.replace("_BKMK", ""); if(!lastString.isEmpty() && lastString.lastIndexOf("_") != lastString.length()-1) { String lastLetters = lastString.substring(lastString.lastIndexOf('_')+1); result.append(lastLetters + ":\n\n" + tc + "\n--\n"); } else result.append((i+1) + ":\n\n" + tc + "\n--"); } return result; // return the string buffer containing the file. (done!) } }
3e02f1571fd5c62ce7478f393064ab37323ceb96
445
java
Java
src/guimodule/myDisplay.java
dataronio/UCSDUnfoldingMaps
b9519f0a7f477cf53c7b09e6cf5262a1851fb433
[ "MIT" ]
null
null
null
src/guimodule/myDisplay.java
dataronio/UCSDUnfoldingMaps
b9519f0a7f477cf53c7b09e6cf5262a1851fb433
[ "MIT" ]
null
null
null
src/guimodule/myDisplay.java
dataronio/UCSDUnfoldingMaps
b9519f0a7f477cf53c7b09e6cf5262a1851fb433
[ "MIT" ]
null
null
null
15.892857
40
0.608989
1,221
package guimodule; import processing.core.PApplet; public class myDisplay extends PApplet { public void setup() { size(400, 400); background(200,200,200); } public void draw() { // now make a smiley face fill(255, 255, 0); ellipse(200, 200, 390, 390); fill(0, 0, 0); ellipse(120, 130, 50, 70); fill(0, 0, 0); ellipse(280, 130, 50 ,70); noFill(); // no fill in for ellipse arc(200, 280, 75, 75, 0 , PI); } }
3e02f15ef78d434240f2b21b1f99f6953cf8ac66
902
java
Java
VSKFireTV-sample-app/app/src/main/java/com/example/vskfiretv/data/Cookie.java
amzn/sample-fire-tv-app-video-skill
ec42b9f792b84dbb74a3fc5d69e1cadef8a51036
[ "Apache-2.0" ]
13
2019-09-03T18:13:07.000Z
2022-02-13T12:27:47.000Z
VSKFireTV-sample-app/app/src/main/java/com/example/vskfiretv/data/Cookie.java
amzn/sample-fire-tv-app-video-skill
ec42b9f792b84dbb74a3fc5d69e1cadef8a51036
[ "Apache-2.0" ]
null
null
null
VSKFireTV-sample-app/app/src/main/java/com/example/vskfiretv/data/Cookie.java
amzn/sample-fire-tv-app-video-skill
ec42b9f792b84dbb74a3fc5d69e1cadef8a51036
[ "Apache-2.0" ]
7
2019-11-02T19:04:15.000Z
2021-12-06T01:50:17.000Z
19.608696
74
0.619734
1,222
/** * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: LicenseRef-.amazon.com.-AmznSL-1.0 * Licensed under the Amazon Software License http://aws.amazon.com/asl/ */ package com.example.vskfiretv.data; import android.os.Parcel; import android.os.Parcelable; public class Cookie implements Parcelable { public final static Creator<Cookie> CREATOR = new Creator<Cookie>() { @SuppressWarnings({ "unchecked" }) public Cookie createFromParcel(Parcel in) { return new Cookie(in); } public Cookie[] newArray(int size) { return (new Cookie[size]); } } ; protected Cookie(Parcel in) { } public Cookie() { } public void writeToParcel(Parcel dest, int flags) { } public int describeContents() { return 0; } }
3e02f3865cc091b13e0c11088cf01e3e543aa642
4,754
java
Java
modules/org.milleni.dunning/src/main/java/org/milleni/dunning/ws/client/notif/SmtpInfo.java
hilmialyaz/Activiti
8379747bfafca29b97a709e76f27ee4fb40389bc
[ "Apache-1.1" ]
null
null
null
modules/org.milleni.dunning/src/main/java/org/milleni/dunning/ws/client/notif/SmtpInfo.java
hilmialyaz/Activiti
8379747bfafca29b97a709e76f27ee4fb40389bc
[ "Apache-1.1" ]
null
null
null
modules/org.milleni.dunning/src/main/java/org/milleni/dunning/ws/client/notif/SmtpInfo.java
hilmialyaz/Activiti
8379747bfafca29b97a709e76f27ee4fb40389bc
[ "Apache-1.1" ]
null
null
null
26.858757
147
0.57846
1,223
package org.milleni.dunning.ws.client.notif; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for SmtpInfo complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="SmtpInfo"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="Port" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="Server" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="UseSSL" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="User" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SmtpInfo", propOrder = { "password", "port", "server", "useSSL", "user" }) public class SmtpInfo { @XmlElementRef(name = "Password", namespace = "http://milleni.com/Common/Notification/CommonNotification/Service/v1", type = JAXBElement.class) protected JAXBElement<String> password; @XmlElement(name = "Port") protected Integer port; @XmlElementRef(name = "Server", namespace = "http://milleni.com/Common/Notification/CommonNotification/Service/v1", type = JAXBElement.class) protected JAXBElement<String> server; @XmlElement(name = "UseSSL") protected Boolean useSSL; @XmlElementRef(name = "User", namespace = "http://milleni.com/Common/Notification/CommonNotification/Service/v1", type = JAXBElement.class) protected JAXBElement<String> user; /** * Gets the value of the password property. * * @return * possible object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public JAXBElement<String> getPassword() { return password; } /** * Sets the value of the password property. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public void setPassword(JAXBElement<String> value) { this.password = ((JAXBElement<String> ) value); } /** * Gets the value of the port property. * * @return * possible object is * {@link Integer } * */ public Integer getPort() { return port; } /** * Sets the value of the port property. * * @param value * allowed object is * {@link Integer } * */ public void setPort(Integer value) { this.port = value; } /** * Gets the value of the server property. * * @return * possible object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public JAXBElement<String> getServer() { return server; } /** * Sets the value of the server property. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public void setServer(JAXBElement<String> value) { this.server = ((JAXBElement<String> ) value); } /** * Gets the value of the useSSL property. * * @return * possible object is * {@link Boolean } * */ public Boolean isUseSSL() { return useSSL; } /** * Sets the value of the useSSL property. * * @param value * allowed object is * {@link Boolean } * */ public void setUseSSL(Boolean value) { this.useSSL = value; } /** * Gets the value of the user property. * * @return * possible object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public JAXBElement<String> getUser() { return user; } /** * Sets the value of the user property. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public void setUser(JAXBElement<String> value) { this.user = ((JAXBElement<String> ) value); } }
3e02f3dafa131a2a67ab0fd576a298e50c7dd095
833
java
Java
src/main/java/top/auzqy/design/pattern/behavioral/state/example3/eg3_3/CapeMario.java
Auzqy/design-pattern-GOF23-study
59bc409b5a6d87c699f1a9743d55767f4731970f
[ "Apache-2.0" ]
2
2019-08-02T10:43:57.000Z
2020-04-15T05:35:46.000Z
src/main/java/top/auzqy/design/pattern/behavioral/state/example3/eg3_3/CapeMario.java
Auzqy/design-pattern-GOF23-study
59bc409b5a6d87c699f1a9743d55767f4731970f
[ "Apache-2.0" ]
null
null
null
src/main/java/top/auzqy/design/pattern/behavioral/state/example3/eg3_3/CapeMario.java
Auzqy/design-pattern-GOF23-study
59bc409b5a6d87c699f1a9743d55767f4731970f
[ "Apache-2.0" ]
null
null
null
21.921053
70
0.655462
1,224
package top.auzqy.design.pattern.behavioral.state.example3.eg3_3; import top.auzqy.design.pattern.behavioral.state.example3.eg3_1.State; public class CapeMario implements IMario { private MarioStateMachine stateMachine; public CapeMario(MarioStateMachine stateMachine) { this.stateMachine = stateMachine; } @Override public State getName() { return State.CAPE; } @Override public void obtainMushRoom() { // do nothing... } @Override public void obtainCape() { // do nothing... } @Override public void obtainFireFlower() { // do nothing... } @Override public void meetMonster() { stateMachine.setCurrentState(new SmallMario(stateMachine)); stateMachine.setScore(stateMachine.getScore() - 200); } }
3e02f572188646cb0542708fa0de2d75387ad167
1,342
java
Java
src/main/java/be/twofold/fcop/handler/CbmpHandler.java
jandk/fcop
eb3d6e653447fa6a5a23fcf3c33fe0553c0caa0a
[ "MIT" ]
1
2021-08-25T08:11:21.000Z
2021-08-25T08:11:21.000Z
src/main/java/be/twofold/fcop/handler/CbmpHandler.java
jandk/fcop
eb3d6e653447fa6a5a23fcf3c33fe0553c0caa0a
[ "MIT" ]
1
2021-08-25T07:29:20.000Z
2021-08-30T15:44:07.000Z
src/main/java/be/twofold/fcop/handler/CbmpHandler.java
jandk/fcop
eb3d6e653447fa6a5a23fcf3c33fe0553c0caa0a
[ "MIT" ]
null
null
null
29.173913
98
0.651267
1,225
package be.twofold.fcop.handler; import be.twofold.fcop.iff.*; import javax.imageio.*; import java.awt.image.*; import java.io.*; import java.nio.*; public final class CbmpHandler implements FileHandler { private static final int Width = 256; private static final int Height = 256; @Override public String getExtension() { return "png"; } @Override public void process(byte[] content, OutputStream out) throws IOException { try (IffReader reader = new IffReader(new ByteArrayInputStream(content))) { decodeBitmap(reader, out); } } private void decodeBitmap(IffReader reader, OutputStream out) throws IOException { IffChunk chunk = reader.stream() .filter(iffChunk -> iffChunk.getFourCC() == IffFourCC.PX16) .findFirst() .orElseThrow(() -> new IOException("Could not find PX16 chunk")); ShortBuffer pixels = ByteBuffer .wrap(chunk.getContent()) .order(ByteOrder.LITTLE_ENDIAN) .asShortBuffer(); BufferedImage image = new BufferedImage(Width, Height, BufferedImage.TYPE_USHORT_555_RGB); DataBufferUShort buffer = ((DataBufferUShort) image.getRaster().getDataBuffer()); pixels.get(buffer.getData()); ImageIO.write(image, "png", out); } }
3e02f6a8c68cfaf4e985ab3723ebccfcaa37c9a7
971
java
Java
app/src/main/java/com/dumai/xianjindai/view/pickers/common/MessageHandler.java
1373939387/Loan
5b6f631e1fbeae3c59c101360f1c8b9ddf8ef9ba
[ "MIT" ]
5
2018-06-28T03:09:04.000Z
2019-07-15T11:44:15.000Z
app/src/main/java/com/dumai/xianjindai/view/pickers/common/MessageHandler.java
R-Gang/Loan
5b6f631e1fbeae3c59c101360f1c8b9ddf8ef9ba
[ "MIT" ]
null
null
null
app/src/main/java/com/dumai/xianjindai/view/pickers/common/MessageHandler.java
R-Gang/Loan
5b6f631e1fbeae3c59c101360f1c8b9ddf8ef9ba
[ "MIT" ]
9
2018-01-28T02:35:08.000Z
2019-12-31T19:50:28.000Z
25.552632
63
0.649846
1,226
package com.dumai.xianjindai.view.pickers.common; import android.os.Handler; import android.os.Message; import com.dumai.xianjindai.view.pickers.widget.WheelView; final public class MessageHandler extends Handler { public static final int WHAT_INVALIDATE_LOOP_VIEW = 1000; public static final int WHAT_SMOOTH_SCROLL = 2000; public static final int WHAT_ITEM_SELECTED = 3000; final private WheelView wheelView; public MessageHandler(WheelView wheelView) { this.wheelView = wheelView; } @Override public final void handleMessage(Message msg) { switch (msg.what) { case WHAT_INVALIDATE_LOOP_VIEW: wheelView.invalidate(); break; case WHAT_SMOOTH_SCROLL: wheelView.smoothScroll(WheelView.ACTION.FLING); break; case WHAT_ITEM_SELECTED: wheelView.onItemPicked(); break; } } }
3e02f830673f21400f36506e148fc7916a48409d
3,880
java
Java
src/main/java/net/minecraft/server/dedicated/ServerHangWatchdog.java
Akarin-project/Paper2Srg
55798e89ed822e8d59dc55dfc6aa70cef1e47751
[ "MIT" ]
3
2018-06-22T14:09:27.000Z
2021-09-15T02:27:45.000Z
src/main/java/net/minecraft/server/dedicated/ServerHangWatchdog.java
Akarin-project/AkarinModEdition
55798e89ed822e8d59dc55dfc6aa70cef1e47751
[ "MIT" ]
null
null
null
src/main/java/net/minecraft/server/dedicated/ServerHangWatchdog.java
Akarin-project/AkarinModEdition
55798e89ed822e8d59dc55dfc6aa70cef1e47751
[ "MIT" ]
4
2018-06-21T09:44:06.000Z
2021-09-15T02:27:50.000Z
39.591837
251
0.61366
1,227
package net.minecraft.server.dedicated; import java.io.File; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Timer; import java.util.TimerTask; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.server.MinecraftServer; public class ServerHangWatchdog implements Runnable { private static final Logger field_180251_a = LogManager.getLogger(); private final DedicatedServer field_180249_b; private final long field_180250_c; public ServerHangWatchdog(DedicatedServer dedicatedserver) { this.field_180249_b = dedicatedserver; this.field_180250_c = dedicatedserver.func_175593_aQ(); } public void run() { while (this.field_180249_b.func_71278_l()) { long i = this.field_180249_b.func_175587_aJ(); long j = MinecraftServer.func_130071_aq(); long k = j - i; if (k > this.field_180250_c) { ServerHangWatchdog.field_180251_a.fatal("A single server tick took {} seconds (should be max {})", String.format("%.2f", new Object[] { Float.valueOf((float) k / 1000.0F)}), String.format("%.2f", new Object[] { Float.valueOf(0.05F)})); ServerHangWatchdog.field_180251_a.fatal("Considering it to be crashed, server will forcibly shutdown."); ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true); StringBuilder stringbuilder = new StringBuilder(); Error error = new Error(); ThreadInfo[] athreadinfo1 = athreadinfo; int l = athreadinfo.length; for (int i1 = 0; i1 < l; ++i1) { ThreadInfo threadinfo = athreadinfo1[i1]; if (threadinfo.getThreadId() == this.field_180249_b.func_175583_aK().getId()) { error.setStackTrace(threadinfo.getStackTrace()); } stringbuilder.append(threadinfo); stringbuilder.append("\n"); } CrashReport crashreport = new CrashReport("Watching Server", error); this.field_180249_b.func_71230_b(crashreport); CrashReportCategory crashreportsystemdetails = crashreport.func_85058_a("Thread Dump"); crashreportsystemdetails.func_71507_a("Threads", (Object) stringbuilder); File file = new File(new File(this.field_180249_b.func_71238_n(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt"); if (crashreport.func_147149_a(file)) { ServerHangWatchdog.field_180251_a.error("This crash report has been saved to: {}", file.getAbsolutePath()); } else { ServerHangWatchdog.field_180251_a.error("We were unable to save this crash report to disk."); } this.func_180248_a(); } try { Thread.sleep(i + this.field_180250_c - j); } catch (InterruptedException interruptedexception) { ; } } } private void func_180248_a() { try { Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { Runtime.getRuntime().halt(1); } }, 10000L); System.exit(1); } catch (Throwable throwable) { Runtime.getRuntime().halt(1); } } }
3e02f8435409caa1a40c2c780efd6ee330411e6f
659
java
Java
async-programming-javase/src/com/example/application/BusinessApplication.java
deepcloudlabs/dcl350-2021-sep-06
d467c4b39443fa4405f9d45b7682956560ea55b5
[ "MIT" ]
null
null
null
async-programming-javase/src/com/example/application/BusinessApplication.java
deepcloudlabs/dcl350-2021-sep-06
d467c4b39443fa4405f9d45b7682956560ea55b5
[ "MIT" ]
null
null
null
async-programming-javase/src/com/example/application/BusinessApplication.java
deepcloudlabs/dcl350-2021-sep-06
d467c4b39443fa4405f9d45b7682956560ea55b5
[ "MIT" ]
3
2022-03-19T12:59:20.000Z
2022-03-23T19:40:38.000Z
26.36
84
0.670713
1,228
package com.example.application; import java.util.concurrent.TimeUnit; import com.example.service.BusinessService; public class BusinessApplication { public static void main(String[] args) { var srv = new BusinessService(); for (var i=1;i<=10;++i) { srv.fun().thenAcceptAsync( u -> { System.err.println(Thread.currentThread().getName()+": Result is "+u); }); } System.err.println("for loop has ended!"); for (var i=0;i<20;++i) { try { TimeUnit.SECONDS.sleep(1);}catch(Exception e) {} System.err.println(Thread.currentThread().getName()+": Main is working hard "+i); } System.err.println("Application is done."); } }
3e02f85b77dd73588658ae6f6de83b9a5c2b5f2f
9,713
java
Java
output/85df1d92e7a545b986bdcbebb8e0c21b.java
comprakt/comprakt-fuzz-tests
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
[ "Apache-2.0", "MIT" ]
null
null
null
output/85df1d92e7a545b986bdcbebb8e0c21b.java
comprakt/comprakt-fuzz-tests
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
[ "Apache-2.0", "MIT" ]
null
null
null
output/85df1d92e7a545b986bdcbebb8e0c21b.java
comprakt/comprakt-fuzz-tests
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
[ "Apache-2.0", "MIT" ]
null
null
null
35.841328
172
0.487903
1,229
class DYnN0msb6T { } class iI { public boolean tYApmkZ; } class Ny { public static void I4QpHFFdlnG (String[] n) throws yJWlyCt { boolean p7UrdG = !this[ new xQp()[ true.sIERhRMAzyo_8g]] = true.LmoEFJ(); int KN9d1 = -!-!new yFow8OhVxS().w6NrBhDMt = !0011.vC3uTYh(); CK8t58Zq07 ZdlKQhBs; while ( null.A5EGhbe()) return; { int SgTKH1OFl; } while ( --!44907140.VmM) ; boolean BhwCnNTENFJ; } public xjglCoCwl_fqD[][] h1QYkyo1L; public static void _Escmxy8 (String[] GCMoDN) { { void[] D; return; if ( -new boolean[ mC5.e9zxnu4JXAS].GZdGmXVq0AKYx5()) true.jTXvVmR; while ( true[ JFO2cYvyl3H()[ !!this.DhxsAzwc8MKXNb()]]) if ( 301.Y4G4_()) while ( true.zjBuPzrcw()) return; if ( !this.ohr1KAdcOMAq()) { while ( 1.pxtMGaW_sa()) if ( false.Q) while ( true.Q) true[ !-this.dvCsa]; } In6wwpfbQJ[] iJxR6ixI; { { while ( true.Eme93kc1Y) if ( false[ -true.FFd2X()]) { return; } } } } while ( ( -wM80Dtrejff().n)[ !false.wgLUs7Z()]) { int[] y7iVxR; } ; boolean[] NaImO; { ; } return !-this.GYaQxIR(); BpIoWLKHs4iZ[] eH1tieXce = !null.WhQwk5NHehw_; JFVQAamBv[][][][][][][] yOM58Rtr = !false[ new cVzn().R] = -!_eCNjyRH4QCKIj().jYv(); int[] Zbpfbx; boolean[] X = 3054.Zb3X1lgeS8lpbh = !!!!-new void[ this.Rj6()].fy5RRya0_k(); void[] EyQYfySf3Ms9w = Rcq5X3PhQl.NNqq(); void[][] D; null[ --null.ujens]; boolean[] X2f51 = null[ false.tSvaKKS]; { void LRP; int[][][] HSPUEZf8NpxNfX; int[] XGRj5Z; boolean[] UZlYeLE; void[] GYdzc5XmTpdkX; int GlHW; ; void zFm; ; int[] RFn; { while ( ( hP[ !this.c()]).s) true.N8Nze4FsLfuIqd; } int Q_uHDpXzpU; { CVJ11 HYisEf; } } while ( false[ false.BamSUoVZ4]) if ( !!( !!-!new ZQkJ64().hCgbBGmWH23HWb()).OaG6) while ( ( new XcsxtHmdMA3[ !!-M81r.gj2PfGr5k8][ !false.f()]).Vl()) { int SUbjAW; } { ; while ( false[ !null.D3AyoQgit]) ; } } public static void _sa4y (String[] G0) { ; while ( this.DBkn()) -new void[ this.vG0jWILTtktOF][ new void[ ekQvinKB().CX7()].QIh]; ( !--new qY[ !new yn81oVPstPhPs[ vvo2.Dn()].jxF7gbJKICio_a()].EZN()).yTWtgNuH7jS(); while ( !!( BW4x[ -FWhYyS().gBix7()])[ true[ !new c0AjB().z4]]) new yx6upAwxlC()[ -this.Nu7u4gjX]; return A()[ new nM2oQcUyOuiqlJ()[ null.e8HPKGAy6]]; void[][] f7IXO0YYIRls = _oOXs4I6.NcDXbuj52vVf1H; while ( true.zW31CIl()) !true.ZcQv3SM_i4R9x; boolean[] UOjv5hRgqsMo = -A().K(); if ( new int[ !new iXigQB().KFZ].WWdI7Ct2S()) null.BEjyOiUVK2CEl; void[] UdF; return !!null[ -!-!this.JVUkrVAP1OQ()]; boolean k; LO_Kat[] CY2ZWD; new Cdu()[ new i().Hh8OXKEpFUbqIt]; return; { -!!this.ccYV3auEPsb; -!( !( -W_UEaVb().gwgF()).WS).YPAffRuPe1Q(); jP1LPAFiXrrqD tkplY5nBnUGej; while ( false.CYaX) -!this[ this.CHcR]; int[][] dhWyclMD3j; } hrTsy4[][] a = -this.YA = --JSbTBpSbs1().RFvrHdu0Jewu0H(); } public static void qlPjKof6m5Twb (String[] OspMlXz1rJBw) throws d { int[] vUohEsZKdN4; int[] WIoEI0d5fbFEwi; ; while ( -KQfoNgw[ 008376.nBQ()]) { boolean[] oVbA; } int[][][] vUX = 1461.UH; xoRTp[][][][] VtRjB8; if ( ( !!this.hgCMdDDWK9)[ !!this[ new QezCf7().GkO]]) ;else ; { int[] mjqvA6OuCLZQa; { while ( false[ true.A0C()]) while ( kVktP().xAIc) this[ new aL_().KLRaYN1ldJ]; } int DRQQYhc; int DR; void YjSBsyn6Z; boolean SvPsReVkS63kH; while ( !new TH3s()._oyvPXkbZPBz6) ; int gp; --false.KkZRfamabx; void[] ZADm6N4wKoLP; void[][][] jAiYjyVFe6r; while ( --nnqEq().yV()) while ( !( -!false[ false.fsfMT]).KlM1v7KmEEzpr()) while ( !new bvo().lJplBMc3()) new void[ ( 39.BR74A8i7U).mPTxViTM()].tfSwbY8R5n9a(); int[] X6Imcy8D1; UJUQP3bj qL3rkXNK; urD[] AjLw2Cf_; boolean[] EKfP; return; ; !---new TDhu()[ new CXnX2PaEeg3jc().iihnQJkssBG6RE()]; } if ( ( -!!-new hknpY5c().D36()).XC4_()) return; int[][] RN = this.VoH0LBJmQCKigy(); return; { int xPnG7zbT87ZW; ---false.cPVc; if ( 983333.wWsc60rz249O) ; ; return; void Z1fKJY; } int X; } } class QQ5tZy { } class g { public boolean ZByEhmBE5X_W (int VNU7ZWr) { boolean LZt = -rZNHhlD()[ !-this.alZR]; ; boolean[] tdZpMYVx; boolean bp0hIfynasgt = -7005.ONCRhWqk2() = -!-!!q5IUeb3Y.xT_ICGI1S1x; int nYMaxtSdJMvVC = !!--( !null.iJDGmaVq78).aO; } public void el1ZW () throws PUib_lp2T { void[] ZmldH0k; void mgu0icIWNi633; EokzA7rnmJ[][] BTH1mSI = SJ24WaWWpm1hLm[ !--!-BF.LoXJhMHmY92sL]; ; if ( ( ( null.o8()).Rxf).aAi3j4yNaI3) return; { !!( !jVo4dRM.QH43Zpc())[ false[ !-QwqlxLbsbH().iYbkLhiYMN]]; if ( true.rYP()) return; { true[ !( -new void[ -40054216[ o36SsrE4VvGMzN[ --!916[ --!!!false.AX5]]]].WK).m_yAfm]; } if ( -new yp4dS6c().uOrUvp5()) ; { ; } if ( -q04ANISLf6[ false[ -null.lXVfMA9OOho6VV]]) { { boolean[][] H; } } q9OoQ9Utfp2 ioHDfv; void[][][] E; boolean yjTfgezzO9; int[] MYVYVFI; void[] BjILABx; } if ( !false.mOzW93_n) if ( JdbM4_G38().Vd2Vz) { return; }else while ( 51423110[ new Q6C73icRBkR[ !5278.iE7S0VimABv].uDCidNR]) return; boolean[][] thJAFJPI8; while ( this[ !false[ gbpbQoG.YqsjypM0PV5()]]) return; boolean we2m6d; void R3PacMP1JB5 = this[ !( new FQXFZgo()[ this[ !-this[ null.hR9S4h]]])[ new AQl().ukzBCrOX8bmK4E]] = !---null.CTkIwAaKuIgY(); void[] DiceGKQ = ( !WudI__ThccKfc.FNpcxbcCl)[ new boolean[ null.VLOuF1Y781Nd()].uAKhIkCRr()] = -new XfDR()[ !new int[ Xlysh().n()].P_0RJ]; boolean j; } public boolean[] chVqvmwEt3WjV () { int[] H = 394.Gx08fV = !new WNQ8qk6l().xPoUHh(); int[] uUYBTv; Z().Mw05uKqWn3j_; void[][] IdvdKmakz = -!new NXL0p9oes[ !-!!uByDcT7P()[ !!false[ null.A7BkwCL91w()]]].sNyjTft() = Tgpveh3JN.NCMz_(); int[][][] dgq1pqhe5mq; { void zEIE; tYu5gmlw[][][] d_24Hsr4; return; ; return; void[] kx6lihw; U yT53kOphY; void[][] gXKLiVpm3LW8jc; while ( new EMPbAD3oO9sZ().bes_mDXBNTkAgO()) -!-false.xYt; !!true.zXcSpOPC9(); ; --this.Md(); while ( ( !!94.IvqUSG9GDr_hd).L) return; boolean i7997; return; } return !-new ax2().MfGhM7iIuVhjs(); return 1757329.sKNT8Er_2RwT; return; return; boolean[][] B; if ( uM6QOvVQiQi().DnXE) return;else while ( false.QkF()) ( -!!!GHblN5V[ !new l[ -fGqpn7.sdHYu()].s0Yl4()]).H; while ( null.bP()) null.xjG3c9(); if ( An().ffGRcKc_()) while ( -false.uZC0_vxaHEw) return; return; u9HCOZ Y3c6Wl = Qvqo7().fBpdU4XycLFkj = !false[ j2qiwh()[ new boolean[ -false.p6yiedbtK9bH()].M1q31lL]]; if ( ZUEkNKTcGr.M5DX) if ( null[ !new TEf5m2jNo0I[ new int[ -new d_3().s][ null.Bif()]].eAlaNV]) if ( 80040189.eLoPPC) return; boolean[][] zW5 = !--( this.QyHTAMaTuK8K)[ !-t().kbKXVZjjO] = !new Fr_TIbGRLk[ -true[ new vRGlKm_Z0gdDy().oYtasWjSSOTdC4()]][ -!new n().CmgsQpSGUs()]; ; } public boolean[][][] EnepJ () { return; while ( -( ( -BHZYkCRi().vDZT8M1).fyrrlGx0()).WPXPcOhQZ) ; int[][][] w7IGrkLKBU6S; 203.GpDlFy(); -false.UrPhS; void ijiWenXZW3DfV = !this.T0(); ; } public int[] HEK (AtAJzQhK_n669_ Gkwmmku4HPH, boolean[] o5dQSQ, alA[][] jcNO, void EKAPlH) { void bhkdjLv3qjq = !--new vTjGPlB()[ false.nMnQtgOeHsgRI()]; int SRdXafbFjv_3j3; int[] qvvP = new OMqRIH7Ls7JBfp[ 8734.B2X_5pSsHmC()].QZegKsSNVtga; if ( !WP4F().rbh2TIi()) { while ( VXFLlrELC3[ -!( -this.iy4yYSiFZs68W).Oiilsb6CyLUdi]) while ( false.A()) ; }else return; { while ( -new int[ 4955.MrKU()].TVbhgK) while ( -250654262.YP) !jC()[ !new boolean[ -F2fCUq().IX].rA]; void YyLZH; } boolean[] iGIb6rCivb79bV = --!new _J0MUfhk_Y[ AUP2Ab().zq()].BnJRSeztwki(); if ( !true.N) while ( new int[ -!!AIQ()[ null[ -( !this[ -R().Ne3TZ9n()]).DoJ98zmhfTPCn]]].Pcrkch6LNyxYT) while ( 8.mezQuU) kM37BX4I().HdzQe;else return; ; ; C KozqtbGpXv; } public int gTrQXsEh; }
3e02f8a1966d8f64768f1c52a6bb6b5b220f95f0
1,410
java
Java
jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java
michaeljin/jclouds-labs
53d85b62a7ad0b48bca0001c3e903d44480b83dc
[ "Apache-1.1" ]
1
2016-03-21T16:30:24.000Z
2016-03-21T16:30:24.000Z
jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java
michaeljin/jclouds-labs
53d85b62a7ad0b48bca0001c3e903d44480b83dc
[ "Apache-1.1" ]
null
null
null
jclouds-representations/representations-codec/src/main/java/org/jclouds/compute/codec/ToExecResponse.java
michaeljin/jclouds-labs
53d85b62a7ad0b48bca0001c3e903d44480b83dc
[ "Apache-1.1" ]
null
null
null
39.166667
119
0.74539
1,230
/* * 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.jclouds.compute.codec; import com.google.common.base.Function; import org.jclouds.compute.representations.ExecResponse; import org.jclouds.javax.annotation.Nullable; public enum ToExecResponse implements Function<org.jclouds.compute.domain.ExecResponse, ExecResponse> { INSTANCE; @Override public ExecResponse apply(@Nullable org.jclouds.compute.domain.ExecResponse input) { if (input == null) { return null; } return ExecResponse.builder().output(input.getOutput()).error(input.getError()).exitStatus(input.getExitStatus()) .build(); } }
3e02f8e9b6be685dcb4d847a95c0a6ed2b539180
1,345
java
Java
junx-core/src/main/java/io/github/junxworks/junx/core/lifecycle/StartServiceException.java
junxworks/junx
12d95af1ec9946658c6e349c65559e5faf18a0a9
[ "Apache-2.0" ]
5
2018-07-13T08:56:34.000Z
2021-03-16T14:12:18.000Z
junx-core/src/main/java/io/github/junxworks/junx/core/lifecycle/StartServiceException.java
junxworks/junx
12d95af1ec9946658c6e349c65559e5faf18a0a9
[ "Apache-2.0" ]
2
2020-09-19T05:59:37.000Z
2021-09-25T08:04:27.000Z
junx-core/src/main/java/io/github/junxworks/junx/core/lifecycle/StartServiceException.java
junxworks/junx
12d95af1ec9946658c6e349c65559e5faf18a0a9
[ "Apache-2.0" ]
6
2018-09-29T08:46:18.000Z
2021-08-25T15:13:39.000Z
26.372549
89
0.518959
1,231
/* *************************************************************************************** * * @Title: StartServiceException.java * @Package io.github.junxworks.junx.core.lifecycle * @Description: (用一句话描述该文件做什么) * @author: Michael * @date: 2018-7-11 15:34:36 * @version V1.0 * @Copyright: 2018 JunxWorks. All rights reserved. * * ---------------------------------------------------------------------------------- * 文件修改记录 * 文件版本: 修改人: 修改原因: *************************************************************************************** */ package io.github.junxworks.junx.core.lifecycle; import io.github.junxworks.junx.core.exception.BaseRuntimeException; /** * 启动服务异常. * * @author: Michael * @date: 2017-5-7 17:32:52 * @since: v1.0 */ public class StartServiceException extends BaseRuntimeException { /** * @see BaseRuntimeException#BaseRuntimeException(String) */ public StartServiceException(String msg) { super(msg); } /** * @see BaseRuntimeException#BaseRuntimeException(Throwable) */ public StartServiceException(Throwable ex) { super(ex); } /** * @see BaseRuntimeException#BaseRuntimeException(String,Throwable) */ public StartServiceException(String msg, Throwable ex) { super(msg, ex); } }
3e02f953e27878fd27f7c838ed35cc8e737df662
890
java
Java
FlightOption.java
m-ross/csi405final
0f49d098887fc8c42c9fe1d0a8526d707cdf8b41
[ "MIT" ]
null
null
null
FlightOption.java
m-ross/csi405final
0f49d098887fc8c42c9fe1d0a8526d707cdf8b41
[ "MIT" ]
null
null
null
FlightOption.java
m-ross/csi405final
0f49d098887fc8c42c9fe1d0a8526d707cdf8b41
[ "MIT" ]
null
null
null
21.190476
84
0.737079
1,232
package project; import java.util.ArrayList; import java.time.*; public class FlightOption { private String origin; private String destination; private ArrayList<Option> options; public FlightOption(String origin, String destination) { this.origin = origin; this.destination = destination; options = new ArrayList<Option>(); } public FlightOption(String origin, String destination, ArrayList<Option> options) { this.origin = origin; this.destination = destination; this.options = options; } public void addOption(Option option) { options.add(option); } public void addOption(LocalTime travelTime, BookingInfo bookingInfo) { options.add(new Option(travelTime, bookingInfo)); } public String getOrigin() { return origin; } public String getDestination() { return destination; } public ArrayList<Option> getOptions() { return options; } }
3e02fb8f080fd47a74e89e901cf1d6dc4db5b1d9
8,132
java
Java
sdk/java/src/org/opencv/text/OCRHMMDecoder.java
avamartynenko/OpenCV-android-sdk
b667b9e7bdd8f689c14e3166e018ff36dbdfc516
[ "Apache-2.0" ]
7
2020-08-25T05:05:53.000Z
2022-03-10T09:14:51.000Z
sdk/java/src/org/opencv/text/OCRHMMDecoder.java
avamartynenko/OpenCV-android-sdk
b667b9e7bdd8f689c14e3166e018ff36dbdfc516
[ "Apache-2.0" ]
2
2020-10-26T03:08:24.000Z
2020-12-11T15:51:57.000Z
sdk/java/src/org/opencv/text/OCRHMMDecoder.java
avamartynenko/OpenCV-android-sdk
b667b9e7bdd8f689c14e3166e018ff36dbdfc516
[ "Apache-2.0" ]
1
2021-11-16T23:18:11.000Z
2021-11-16T23:18:11.000Z
45.685393
243
0.729587
1,233
// // This file is auto-generated. Please don't modify it! // package org.opencv.text; import org.opencv.core.Mat; import org.opencv.text.BaseOCR; import org.opencv.text.OCRHMMDecoder; // C++: class OCRHMMDecoder /** * OCRHMMDecoder class provides an interface for OCR using Hidden Markov Models. * * <b>Note:</b> * <ul> * <li> * (C++) An example on using OCRHMMDecoder recognition combined with scene text detection can * be found at the webcam_demo sample: * &lt;https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp&gt; * </li> * </ul> */ public class OCRHMMDecoder extends BaseOCR { protected OCRHMMDecoder(long addr) { super(addr); } // internal usage only public static OCRHMMDecoder __fromPtr__(long addr) { return new OCRHMMDecoder(addr); } // // C++: static Ptr_OCRHMMDecoder cv::text::OCRHMMDecoder::create(Ptr_OCRHMMDecoder_ClassifierCallback classifier, String vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table, int mode = OCR_DECODER_VITERBI) // // Unknown type 'Ptr_OCRHMMDecoder_ClassifierCallback' (I), skipping the function // // C++: static Ptr_OCRHMMDecoder cv::text::OCRHMMDecoder::create(String filename, String vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table, int mode = OCR_DECODER_VITERBI, int classifier = OCR_KNN_CLASSIFIER) // /** * Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path * * * @param filename automatically generated * @param vocabulary automatically generated * @param transition_probabilities_table automatically generated * @param emission_probabilities_table automatically generated * @param mode automatically generated * @param classifier automatically generated * @return automatically generated */ public static OCRHMMDecoder create(String filename, String vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table, int mode, int classifier) { return OCRHMMDecoder.__fromPtr__(create_0(filename, vocabulary, transition_probabilities_table.nativeObj, emission_probabilities_table.nativeObj, mode, classifier)); } /** * Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path * * * @param filename automatically generated * @param vocabulary automatically generated * @param transition_probabilities_table automatically generated * @param emission_probabilities_table automatically generated * @param mode automatically generated * @return automatically generated */ public static OCRHMMDecoder create(String filename, String vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table, int mode) { return OCRHMMDecoder.__fromPtr__(create_1(filename, vocabulary, transition_probabilities_table.nativeObj, emission_probabilities_table.nativeObj, mode)); } /** * Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path * * * @param filename automatically generated * @param vocabulary automatically generated * @param transition_probabilities_table automatically generated * @param emission_probabilities_table automatically generated * @return automatically generated */ public static OCRHMMDecoder create(String filename, String vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table) { return OCRHMMDecoder.__fromPtr__(create_2(filename, vocabulary, transition_probabilities_table.nativeObj, emission_probabilities_table.nativeObj)); } // // C++: String cv::text::OCRHMMDecoder::run(Mat image, Mat mask, int min_confidence, int component_level = 0) // public String run(Mat image, Mat mask, int min_confidence, int component_level) { return run_0(nativeObj, image.nativeObj, mask.nativeObj, min_confidence, component_level); } public String run(Mat image, Mat mask, int min_confidence) { return run_1(nativeObj, image.nativeObj, mask.nativeObj, min_confidence); } // // C++: String cv::text::OCRHMMDecoder::run(Mat image, int min_confidence, int component_level = 0) // /** * Recognize text using HMM. * * Takes an image and a mask (where each connected component corresponds to a segmented character) * on input and returns recognized text in the output_text parameter. Optionally * provides also the Rects for individual text elements found (e.g. words), and the list of those * text elements with their confidence values. * * @param image Input image CV_8UC1 or CV_8UC3 with a single text line (or word). * * * text elements found (e.g. words). * * recognition of individual text elements found (e.g. words). * * for the recognition of individual text elements found (e.g. words). * * @param component_level Only OCR_LEVEL_WORD is supported. * @param min_confidence automatically generated * @return automatically generated */ public String run(Mat image, int min_confidence, int component_level) { return run_2(nativeObj, image.nativeObj, min_confidence, component_level); } /** * Recognize text using HMM. * * Takes an image and a mask (where each connected component corresponds to a segmented character) * on input and returns recognized text in the output_text parameter. Optionally * provides also the Rects for individual text elements found (e.g. words), and the list of those * text elements with their confidence values. * * @param image Input image CV_8UC1 or CV_8UC3 with a single text line (or word). * * * text elements found (e.g. words). * * recognition of individual text elements found (e.g. words). * * for the recognition of individual text elements found (e.g. words). * * @param min_confidence automatically generated * @return automatically generated */ public String run(Mat image, int min_confidence) { return run_3(nativeObj, image.nativeObj, min_confidence); } @Override protected void finalize() throws Throwable { delete(nativeObj); } // C++: static Ptr_OCRHMMDecoder cv::text::OCRHMMDecoder::create(String filename, String vocabulary, Mat transition_probabilities_table, Mat emission_probabilities_table, int mode = OCR_DECODER_VITERBI, int classifier = OCR_KNN_CLASSIFIER) private static native long create_0(String filename, String vocabulary, long transition_probabilities_table_nativeObj, long emission_probabilities_table_nativeObj, int mode, int classifier); private static native long create_1(String filename, String vocabulary, long transition_probabilities_table_nativeObj, long emission_probabilities_table_nativeObj, int mode); private static native long create_2(String filename, String vocabulary, long transition_probabilities_table_nativeObj, long emission_probabilities_table_nativeObj); // C++: String cv::text::OCRHMMDecoder::run(Mat image, Mat mask, int min_confidence, int component_level = 0) private static native String run_0(long nativeObj, long image_nativeObj, long mask_nativeObj, int min_confidence, int component_level); private static native String run_1(long nativeObj, long image_nativeObj, long mask_nativeObj, int min_confidence); // C++: String cv::text::OCRHMMDecoder::run(Mat image, int min_confidence, int component_level = 0) private static native String run_2(long nativeObj, long image_nativeObj, int min_confidence, int component_level); private static native String run_3(long nativeObj, long image_nativeObj, int min_confidence); // native support for java finalize() private static native void delete(long nativeObj); }
3e02fc0bf7ef5ff1b5c1ff2f2c40115177dfe774
339
java
Java
src/main/java/ListNode.java
EzioL/leetcode
84f9fc540db6ad6ca65b9f7621bab7af12476c47
[ "BSD-3-Clause" ]
null
null
null
src/main/java/ListNode.java
EzioL/leetcode
84f9fc540db6ad6ca65b9f7621bab7af12476c47
[ "BSD-3-Clause" ]
null
null
null
src/main/java/ListNode.java
EzioL/leetcode
84f9fc540db6ad6ca65b9f7621bab7af12476c47
[ "BSD-3-Clause" ]
null
null
null
13.56
40
0.507375
1,234
/** * Here be dragons ! * * @author: Ezio * created on 2020/5/5 */ public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } ListNode(int x , ListNode next) { val = x; this.next = next; } public void setNext(ListNode next) { this.next = next; } }
3e02fc645cb727c0fd1d7886845074d77b584f1c
9,381
java
Java
javasrc/uk/org/opentrv/test/hdd/DDNExtractorTest.java
brunogirin/OpenTRV-Java
9e289641247b94f0007faeb42b2449829a97fb1e
[ "Apache-2.0" ]
1
2019-04-20T17:25:19.000Z
2019-04-20T17:25:19.000Z
javasrc/uk/org/opentrv/test/hdd/DDNExtractorTest.java
brunogirin/OpenTRV-Java
9e289641247b94f0007faeb42b2449829a97fb1e
[ "Apache-2.0" ]
null
null
null
javasrc/uk/org/opentrv/test/hdd/DDNExtractorTest.java
brunogirin/OpenTRV-Java
9e289641247b94f0007faeb42b2449829a97fb1e
[ "Apache-2.0" ]
3
2018-01-07T19:49:52.000Z
2019-09-30T19:04:33.000Z
50.165775
179
0.668799
1,235
/* The OpenTRV project licenses this file to you under the Apache Licence, Version 2.0 (the "Licence"); you may not use this file except in compliance with the Licence. You may obtain a copy of the Licence at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licence for the specific language governing permissions and limitations under the Licence. Author(s) / Copyright (s): Damon Hart-Davis 2014 */ package uk.org.opentrv.test.hdd; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.util.Calendar; import java.util.SortedSet; import org.junit.Test; import uk.org.opentrv.hdd.ContinuousDailyHDD; import uk.org.opentrv.hdd.DDNExtractor; import uk.org.opentrv.hdd.HDDUtil; /**Test handling of degreedays.net input data. */ public class DDNExtractorTest { /**Sample of degreedays.net multi-base-temperature daily data with two days' values. */ public static final String DDNSampleHeaderAndDays = "Description:,\"Celsius-based heating degree days for base temperatures at and around 15.5C\"\n" + "Source:,\"www.degreedays.net (using temperature data from www.wunderground.com)\"\n" + "Accuracy:,\"Estimates were made to account for missing data: the \"\"% Estimated\"\" column shows how much each figure was affected (0% is best, 100% is worst)\"\n" + "Station:,\"Northolt (0.42W,51.55N)\"\n" + "Station ID:,\"EGWU\"\n" + ",(Column titles show the base temperature in Celsius)\n" + "Date,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,% Estimated\n" + "2011-05-01,0.3,0.5,0.7,1,1.3,1.5,1.8,2.2,2.5,2.9,3.3,3.8,4.2,1\n" + "2011-05-02,1.7,2,2.3,2.7,3,3.4,3.9,4.3,4.8,5.3,5.8,6.3,6.8,0\n"; /**Test parsing of degreedays.net multi-base-temperature daily data. */ @Test public void testDDNExtract() throws Exception { try(final Reader r = new StringReader(DDNSampleHeaderAndDays)) { final ContinuousDailyHDD hdd = DDNExtractor.extractForBaseTemperature(r, 15.501f); assertNotNull(hdd); assertEquals("must accept data close to specified", 15.5f, hdd.getBaseTemperatureAsFloat(), 0.1f); assertNotNull(hdd.getMap()); assertEquals(2, hdd.getMap().size()); assertEquals(Integer.valueOf(20110501), hdd.getMap().firstKey()); assertEquals(Integer.valueOf(20110502), hdd.getMap().lastKey()); assertEquals(1.8f, hdd.getMap().get(20110501).floatValue(), 0.001f); assertEquals(3.9f, hdd.getMap().get(20110502).floatValue(), 0.001f); } try(final Reader r = new StringReader(DDNSampleHeaderAndDays)) { final SortedSet<Float> basetemps = DDNExtractor.availableBaseTemperatures(r); assertNotNull(basetemps); assertEquals(13, basetemps.size()); assertEquals(12.5f, basetemps.first(), 0.01f); assertEquals(18.5f, basetemps.last(), 0.01f); } try(final Reader r = new StringReader(DDNSampleHeaderAndDays)) { final SortedSet<ContinuousDailyHDD> hdds = DDNExtractor.extractForAllBaseTemperatures(r); assertNotNull(hdds); assertEquals(13, hdds.size()); assertEquals(12.5f, hdds.first().getBaseTemperatureAsFloat(), 0.01f); assertEquals(18.5f, hdds.last().getBaseTemperatureAsFloat(), 0.01f); for(final ContinuousDailyHDD hdd : hdds) { assertEquals(2, hdd.getMap().size()); } assertEquals(15.5f, HDDUtil.findHDDWithClosestBaseTemp(hdds, 15.5f).getBaseTemperatureAsFloat(), 0.1f); assertEquals(12.5f, HDDUtil.findHDDWithClosestBaseTemp(hdds, 12.5f).getBaseTemperatureAsFloat(), 0.1f); assertEquals(16.5f, HDDUtil.findHDDWithClosestBaseTemp(hdds, 16.5f).getBaseTemperatureAsFloat(), 0.1f); } } /**Return a stream for the large (ASCII) sample HDD data for EGLL; never null. */ public static InputStream getLargeEGLLHDDCSVStream() { return(DDNExtractorTest.class.getResourceAsStream("EGLL_HDD_15.5C+-3.0C-20140526-36M.csv")); } /**Return a Reader for the large sample HDD data for EGLL; never null. */ public static Reader getLargeEGLLHDDCSVReader() throws IOException { return(new InputStreamReader(getLargeEGLLHDDCSVStream(), "ASCII7")); } /**Return a stream for the huge (ASCII) sample HDD data for EGLL; never null. */ public static InputStream getHugeEGLLHDDCSVStream() { return(DDNExtractorTest.class.getResourceAsStream("EGLLLotsOfBaseTemps.csv")); } /**Return a Reader for the huge sample HDD data for EGLL; never null. */ public static Reader getHugeEGLLHDDCSVReader() throws IOException { return(new InputStreamReader(getHugeEGLLHDDCSVStream(), "ASCII7")); } /**Test extraction from a substantial file. */ @Test public void testDDNExtractLarge() throws Exception { try(final Reader r = getLargeEGLLHDDCSVReader()) { assertNotNull(r); final ContinuousDailyHDD hdd = DDNExtractor.extractForBaseTemperature(r, 15.5f); assertEquals(15.5f, hdd.getBaseTemperatureAsFloat(), 0.001f); assertNotNull(hdd); assertNotNull(hdd.getMap()); assertEquals(1121, hdd.getMap().size()); assertEquals(Integer.valueOf(20110501), hdd.getMap().firstKey()); assertEquals(Integer.valueOf(20140525), hdd.getMap().lastKey()); } } /**Brief tests of date conversion to and from key. */ @Test public void testDateKeyConversion() { final Calendar i1 = Calendar.getInstance(); i1.set(2014, 4, 26); assertEquals(Integer.valueOf(20140526), HDDUtil.keyFromDate(i1)); final Calendar i2 = HDDUtil.dateFromKey(20140525); assertEquals(2014, i2.get(Calendar.YEAR)); assertEquals(4, i2.get(Calendar.MONTH)); assertEquals(25, i2.get(Calendar.DATE)); } /**Return a stream for the ETV (ASCII) simple HDD 2016/02 data for EGLL; never null. */ public static InputStream getETVEGLLHDD201602CSVStream() { return(DDNExtractorTest.class.getResourceAsStream("201602-ETV-16WW-sample-HDD15p5-DegreeDaysNet-EGLL.csv")); } /**Return a Reader for the ETV sample HDD 2016/02 data for EGLL; never null. */ public static Reader getETVEGLLHDD201602CSVReader() throws IOException { return(new InputStreamReader(getETVEGLLHDD201602CSVStream(), "ASCII7")); } /**Return a stream for the ETV (ASCII) simple HDD 2016/03 data for EGLL; never null. */ public static InputStream getETVEGLLHDD201603CSVStream() { return(DDNExtractorTest.class.getResourceAsStream("201603-ETV-16WW-sample-HDD15p5-DegreeDaysNet-EGLL.csv")); } /**Return a Reader for the ETV sample HDD 2016/03 data for EGLL; never null. */ public static Reader getETVEGLLHDD201603CSVReader() throws IOException { return(new InputStreamReader(getETVEGLLHDD201603CSVStream(), "ASCII7")); } /**Test extraction from a simple (single HDD base temperature) file. */ @Test public void testDDNExtractSimple() throws Exception { try(final Reader r = getETVEGLLHDD201603CSVReader()) { final ContinuousDailyHDD hdd = DDNExtractor.extractSimpleHDD(r, 15.5f); assertEquals(15.5f, hdd.getBaseTemperatureAsFloat(), 0.1f); assertNotNull(hdd.getMap()); assertEquals(31, hdd.getMap().size()); assertEquals(10.1f, hdd.getMap().get(20160302), 0.01f); assertEquals(7.9f, hdd.getMap().get(20160329), 0.01f); } } /**Return a stream for the ETV (ASCII) simple HDD 2016H1 data for EGLL; never null. */ public static InputStream getETVEGLLHDD2016H1CSVStream() { return(DDNExtractorTest.class.getResourceAsStream("2016H1-EGLL_HDD_15.5C.csv")); } /**Return a Reader for the ETV sample HDD 2016/03 data for EGLL; never null. */ public static Reader getETVEGLLHDD2016H1CSVReader() throws IOException { return(new InputStreamReader(getETVEGLLHDD2016H1CSVStream(), "ASCII7")); } /**Test extraction from a longer half-year (single HDD base temperature) file. */ @Test public void testDDNExtractSimpleHY() throws Exception { try(final Reader r = getETVEGLLHDD2016H1CSVReader()) { final ContinuousDailyHDD hdd = DDNExtractor.extractSimpleHDD(r, 15.5f); assertEquals(15.5f, hdd.getBaseTemperatureAsFloat(), 0.1f); assertNotNull(hdd.getMap()); assertEquals(182, hdd.getMap().size()); assertEquals(10.2f, hdd.getMap().get(20160101), 0.01f); assertEquals(10.1f, hdd.getMap().get(20160302), 0.01f); assertEquals(7.9f, hdd.getMap().get(20160329), 0.01f); assertEquals(0.6f, hdd.getMap().get(20160630), 0.01f); } } }
3e02fc87f40e46d77bf3235f578ecdffeff13629
611
java
Java
game/src/main/java/org/apollo/game/release/r289/SecondPlayerActionMessageDecoder.java
s1mple-dev/apollo
1881254b118a73a15717f2452fdae81fe3b6942e
[ "0BSD" ]
4
2020-06-24T23:42:53.000Z
2022-01-25T19:10:51.000Z
game/src/main/java/org/apollo/game/release/r289/SecondPlayerActionMessageDecoder.java
s1mple-dev/apollo
1881254b118a73a15717f2452fdae81fe3b6942e
[ "0BSD" ]
null
null
null
game/src/main/java/org/apollo/game/release/r289/SecondPlayerActionMessageDecoder.java
s1mple-dev/apollo
1881254b118a73a15717f2452fdae81fe3b6942e
[ "0BSD" ]
3
2020-06-07T22:31:05.000Z
2021-03-28T04:03:19.000Z
33.944444
97
0.816694
1,236
package org.apollo.game.release.r289; import org.apollo.game.message.impl.PlayerActionMessage; import org.apollo.net.codec.game.DataType; import org.apollo.net.codec.game.GamePacket; import org.apollo.net.codec.game.GamePacketReader; import org.apollo.net.release.MessageDecoder; public final class SecondPlayerActionMessageDecoder extends MessageDecoder<PlayerActionMessage> { @Override public PlayerActionMessage decode(GamePacket packet) { GamePacketReader reader = new GamePacketReader(packet); int index = (int) reader.getUnsigned(DataType.SHORT); return new PlayerActionMessage(2, index); } }
3e02fe0436dc2a27efd3a7888f5f855102da16b5
2,091
java
Java
qmq-server/src/main/java/qunar/tc/qmq/container/Bootstrap.java
jackieha/qmq
fbe256539de3b002c4f9d4c5f0922561ba153636
[ "Apache-2.0" ]
2,499
2018-12-07T06:02:12.000Z
2022-03-31T06:46:36.000Z
qmq-server/src/main/java/qunar/tc/qmq/container/Bootstrap.java
jackieha/qmq
fbe256539de3b002c4f9d4c5f0922561ba153636
[ "Apache-2.0" ]
92
2018-12-07T06:35:03.000Z
2022-03-20T01:54:54.000Z
qmq-server/src/main/java/qunar/tc/qmq/container/Bootstrap.java
jackieha/qmq
fbe256539de3b002c4f9d4c5f0922561ba153636
[ "Apache-2.0" ]
657
2018-12-07T06:04:27.000Z
2022-03-31T14:27:39.000Z
40.211538
108
0.710665
1,237
/* * Copyright 2018 Qunar, Inc. * * 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 qunar.tc.qmq.container; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import qunar.tc.qmq.configuration.DynamicConfig; import qunar.tc.qmq.configuration.DynamicConfigLoader; import qunar.tc.qmq.startup.ServerWrapper; import qunar.tc.qmq.web.QueryMessageServlet; public class Bootstrap { public static void main(String[] args) throws Exception { DynamicConfig config = DynamicConfigLoader.load("broker.properties"); ServerWrapper wrapper = new ServerWrapper(config); Runtime.getRuntime().addShutdownHook(new Thread(wrapper::destroy)); wrapper.start(true); if (wrapper.isSlave()) { final ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); context.setResourceBase(System.getProperty("java.io.tmpdir")); final QueryMessageServlet servlet = new QueryMessageServlet(config, wrapper.getStorage()); ServletHolder servletHolder = new ServletHolder(servlet); servletHolder.setAsyncSupported(true); context.addServlet(servletHolder, "/api/broker/message"); final int port = config.getInt("slave.server.http.port", 8080); final Server server = new Server(port); server.setHandler(context); server.start(); server.join(); } } }
3e02fe1eb83fef36e380f6128e74107dcc927aba
3,634
java
Java
platform/lang-api/src/com/intellij/openapi/vcs/checkin/StepIntersection.java
protector1990/intellij-community
b30024b236e84c803ee0b2df7c39eb18dbcaf827
[ "Apache-2.0" ]
2
2018-12-29T09:53:39.000Z
2018-12-29T09:53:42.000Z
platform/lang-api/src/com/intellij/openapi/vcs/checkin/StepIntersection.java
protector1990/intellij-community
b30024b236e84c803ee0b2df7c39eb18dbcaf827
[ "Apache-2.0" ]
null
null
null
platform/lang-api/src/com/intellij/openapi/vcs/checkin/StepIntersection.java
protector1990/intellij-community
b30024b236e84c803ee0b2df7c39eb18dbcaf827
[ "Apache-2.0" ]
1
2018-10-03T12:35:06.000Z
2018-10-03T12:35:06.000Z
34.609524
118
0.596313
1,238
/* * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.openapi.vcs.checkin; import com.intellij.openapi.util.TextRange; import com.intellij.util.Function; import com.intellij.util.PairConsumer; import com.intellij.util.containers.Convertor; import com.intellij.util.containers.PeekableIteratorWrapper; import org.jetbrains.annotations.NotNull; import java.util.List; public class StepIntersection { /** * Iterate over intersected ranges in two lists, sorted by TextRange. */ public static <T, V> void processIntersections(@NotNull List<T> elements1, @NotNull List<V> elements2, @NotNull Convertor<T, TextRange> convertor1, @NotNull Convertor<V, TextRange> convertor2, @NotNull PairConsumer<T, V> intersectionConsumer) { PeekableIteratorWrapper<T> peekIterator1 = new PeekableIteratorWrapper<>(elements1.iterator()); outerLoop: for (V item2 : elements2) { TextRange range2 = convertor2.convert(item2); while (peekIterator1.hasNext()) { T item1 = peekIterator1.peek(); TextRange range1 = convertor1.convert(item1); if (range1.intersects(range2)) { intersectionConsumer.consume(item1, item2); } if (range2.getEndOffset() < range1.getEndOffset()) { continue outerLoop; } else { peekIterator1.next(); } } break outerLoop; } } public static <T, V> void processElementIntersections(@NotNull T element1, @NotNull List<V> elements2, @NotNull Convertor<T, TextRange> convertor1, @NotNull Convertor<V, TextRange> convertor2, @NotNull PairConsumer<T, V> intersectionConsumer) { TextRange range1 = convertor1.convert(element1); int index = binarySearch(elements2, range1.getStartOffset(), value -> convertor2.convert(value).getEndOffset()); if (index < 0) index = -index - 1; for (int i = index; i < elements2.size(); i++) { V item2 = elements2.get(i); TextRange range2 = convertor2.convert(item2); if (range1.intersects(range2)) { intersectionConsumer.consume(element1, item2); } if (range2.getStartOffset() > range1.getEndOffset()) break; } } private static <T> int binarySearch(@NotNull List<T> elements, int value, @NotNull Function<T, Integer> convertor) { int low = 0; int high = elements.size() - 1; while (low <= high) { int mid = (low + high) / 2; int midValue = convertor.fun(elements.get(mid)); if (midValue < value) { low = mid + 1; } else if (midValue > value) { high = mid - 1; } else { return mid; } } return -(low + 1); } }
3e02ff31b33219b444b3902372a2ce1cf886bd32
544
java
Java
_src/Chapter2/07_bean_for_another_bean/src/main/java/com/springcookbook/controller/HelloController.java
paullewallencom/spring-978-1-7839-8580-7
8cc8471c2b42dca2c31bd8c0e7ce0f9841998426
[ "Apache-2.0" ]
null
null
null
_src/Chapter2/07_bean_for_another_bean/src/main/java/com/springcookbook/controller/HelloController.java
paullewallencom/spring-978-1-7839-8580-7
8cc8471c2b42dca2c31bd8c0e7ce0f9841998426
[ "Apache-2.0" ]
null
null
null
_src/Chapter2/07_bean_for_another_bean/src/main/java/com/springcookbook/controller/HelloController.java
paullewallencom/spring-978-1-7839-8580-7
8cc8471c2b42dca2c31bd8c0e7ce0f9841998426
[ "Apache-2.0" ]
null
null
null
24.727273
67
0.806985
1,239
package com.springcookbook.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.springcookbook.service.UserService; @Controller public class HelloController { @Autowired UserService userService; @RequestMapping("hi") @ResponseBody public String hi() { return "it's working: " + userService.getDataSource().toString(); } }
3e0301b109ef436339f6b9d1228803dcc0f8eda9
1,690
java
Java
as_unit_tests/app/src/test/java/ese/unittests/HamcrestExamples.java
eggeral/android-examples
87e788a338627a5a22b6eaf7e09423887c4dc344
[ "Apache-2.0" ]
null
null
null
as_unit_tests/app/src/test/java/ese/unittests/HamcrestExamples.java
eggeral/android-examples
87e788a338627a5a22b6eaf7e09423887c4dc344
[ "Apache-2.0" ]
null
null
null
as_unit_tests/app/src/test/java/ese/unittests/HamcrestExamples.java
eggeral/android-examples
87e788a338627a5a22b6eaf7e09423887c4dc344
[ "Apache-2.0" ]
null
null
null
31.296296
79
0.700592
1,240
package ese.unittests; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.hamcrest.CoreMatchers.anyOf; import static org.hamcrest.CoreMatchers.anything; import static org.hamcrest.CoreMatchers.describedAs; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.sameInstance; import static org.hamcrest.core.IsNot.not; import static org.junit.Assert.assertThat; public class HamcrestExamples { @Test public void hamcrest() { assertThat(true, is(true)); assertThat(false, is(not(true))); assertThat("test", is(equalTo("test"))); assertThat(true, describedAs("Failed because matcher did not match", is(true))); assertThat(false, is(anything())); assertThat(2, is(anyOf(equalTo(2), equalTo(1), equalTo(3)))); assertThat(new String("test"), instanceOf(String.class)); assertThat("test", is(notNullValue())); assertThat(null, is(nullValue())); List<Integer> list = Arrays.asList(1, 2, 3); List<Integer> list2 = Arrays.asList(1, 2, 3); assertThat(list, is(list2)); assertThat(list, hasItem(1)); assertThat(list, hasItems(1, 3)); Student student = new Student("Max"); Student student2 = student; assertThat(student2, is(sameInstance(student))); } }
3e03027f339cd3703fdcbb1cc74917cc67d6c553
4,769
java
Java
sources/com/google/android/gms/internal/ads/zzhs.java
Minionguyjpro/Ghostly-Skills
d1a1fb2498aec461da09deb3ef8d98083542baaf
[ "MIT" ]
1
2021-11-03T14:24:37.000Z
2021-11-03T14:24:37.000Z
sources/com/google/android/gms/internal/ads/zzhs.java
Minionguyjpro/Ghostly-Skills
d1a1fb2498aec461da09deb3ef8d98083542baaf
[ "MIT" ]
null
null
null
sources/com/google/android/gms/internal/ads/zzhs.java
Minionguyjpro/Ghostly-Skills
d1a1fb2498aec461da09deb3ef8d98083542baaf
[ "MIT" ]
null
null
null
33.118056
166
0.5238
1,241
package com.google.android.gms.internal.ads; import android.os.Environment; import com.google.android.gms.ads.internal.zzbv; import com.google.android.gms.internal.ads.zzhu; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @zzadh public final class zzhs { private final zzhx zzakc; private final zzii zzakd; private final boolean zzake; private zzhs() { this.zzake = false; this.zzakc = new zzhx(); this.zzakd = new zzii(); zzhn(); } public zzhs(zzhx zzhx) { this.zzakc = zzhx; this.zzake = ((Boolean) zzkb.zzik().zzd(zznk.zzbeo)).booleanValue(); this.zzakd = new zzii(); zzhn(); } private final synchronized void zzb(zzhu.zza.zzb zzb) { this.zzakd.zzanl = zzho(); this.zzakc.zzd(zzbfi.zzb(this.zzakd)).zzs(zzb.zzhq()).zzbd(); String valueOf = String.valueOf(Integer.toString(zzb.zzhq(), 10)); zzakb.v(valueOf.length() != 0 ? "Logging Event with event code : ".concat(valueOf) : new String("Logging Event with event code : ")); } private final synchronized void zzc(zzhu.zza.zzb zzb) { FileOutputStream fileOutputStream; File externalStorageDirectory = Environment.getExternalStorageDirectory(); if (externalStorageDirectory != null) { try { fileOutputStream = new FileOutputStream(new File(externalStorageDirectory, "clearcut_events.txt"), true); try { fileOutputStream.write(zzd(zzb).getBytes()); fileOutputStream.write(10); try { fileOutputStream.close(); } catch (IOException unused) { zzakb.v("Could not close Clearcut output stream."); } } catch (IOException unused2) { zzakb.v("Could not write Clearcut to file."); try { fileOutputStream.close(); } catch (IOException unused3) { zzakb.v("Could not close Clearcut output stream."); } } } catch (FileNotFoundException unused4) { zzakb.v("Could not find file for Clearcut"); } catch (Throwable th) { try { fileOutputStream.close(); } catch (IOException unused5) { zzakb.v("Could not close Clearcut output stream."); } throw th; } } } private final synchronized String zzd(zzhu.zza.zzb zzb) { return String.format("id=%s,timestamp=%s,event=%s", new Object[]{this.zzakd.zzanh, Long.valueOf(zzbv.zzer().elapsedRealtime()), Integer.valueOf(zzb.zzhq())}); } public static zzhs zzhm() { return new zzhs(); } private final synchronized void zzhn() { this.zzakd.zzanp = new zzib(); this.zzakd.zzanp.zzalw = new zzie(); this.zzakd.zzanm = new zzig(); } private static long[] zzho() { int i; List<String> zzjc = zznk.zzjc(); ArrayList arrayList = new ArrayList(); Iterator<String> it = zzjc.iterator(); while (true) { i = 0; if (!it.hasNext()) { break; } String[] split = it.next().split(","); int length = split.length; while (i < length) { try { arrayList.add(Long.valueOf(split[i])); } catch (NumberFormatException unused) { zzakb.v("Experiment ID is not a number"); } i++; } } long[] jArr = new long[arrayList.size()]; ArrayList arrayList2 = arrayList; int size = arrayList2.size(); int i2 = 0; while (i < size) { Object obj = arrayList2.get(i); i++; jArr[i2] = ((Long) obj).longValue(); i2++; } return jArr; } public final synchronized void zza(zzht zzht) { if (this.zzake) { try { zzht.zza(this.zzakd); } catch (NullPointerException e) { zzbv.zzeo().zza(e, "AdMobClearcutLogger.modify"); } } } public final synchronized void zza(zzhu.zza.zzb zzb) { if (this.zzake) { if (((Boolean) zzkb.zzik().zzd(zznk.zzbep)).booleanValue()) { zzc(zzb); } else { zzb(zzb); } } } }
3e0302de2a938b79a3c73ab6a5c2b92c7090d284
1,935
java
Java
src/test/java/fr/codechill/spring/model/DockerShareTest.java
CodeChillAlluna/code-chill-server
f602db97d1ac6bf40f087f7dfc92349236a29266
[ "Apache-2.0" ]
6
2018-10-28T09:41:29.000Z
2019-01-28T22:22:41.000Z
src/test/java/fr/codechill/spring/model/DockerShareTest.java
CodeChillAlluna/code-chill-server
f602db97d1ac6bf40f087f7dfc92349236a29266
[ "Apache-2.0" ]
21
2018-09-30T15:05:14.000Z
2019-02-16T22:15:19.000Z
src/test/java/fr/codechill/spring/model/DockerShareTest.java
CodeChillAlluna/code-chill-server
f602db97d1ac6bf40f087f7dfc92349236a29266
[ "Apache-2.0" ]
1
2018-10-12T14:03:35.000Z
2018-10-12T14:03:35.000Z
33.362069
66
0.72093
1,242
package fr.codechill.spring.model; import static org.junit.Assert.assertEquals; import java.util.Date; import org.junit.Test; public class DockerShareTest { @Test public void createEmpty() { Date date = new Date(); DockerShare dockerShare = new DockerShare(); dockerShare.setDockerId(1L); dockerShare.setExpiration(date); dockerShare.setId(1L); dockerShare.setReadOnly(true); dockerShare.setUserId(1L); assertEquals(Long.valueOf(1), dockerShare.getDockerId()); assertEquals(date, dockerShare.getExpiration()); assertEquals(Long.valueOf(1), dockerShare.getUserId()); assertEquals(true, dockerShare.getReadOnly()); assertEquals(Long.valueOf(1), dockerShare.getId()); } @Test public void createFullConstructor() { Date date = new Date(); DockerShare dockerShare = new DockerShare(1L, 1L, true, date); assertEquals(Long.valueOf(1), dockerShare.getDockerId()); assertEquals(date, dockerShare.getExpiration()); assertEquals(Long.valueOf(1), dockerShare.getUserId()); assertEquals(true, dockerShare.isReadOnly()); } @Test public void createMinimalConstructor() { Date date = new Date(); DockerShare dockerShare = new DockerShare(1L, 1L); dockerShare.setExpiration(date); dockerShare.setReadOnly(true); assertEquals(Long.valueOf(1), dockerShare.getDockerId()); assertEquals(date, dockerShare.getExpiration()); assertEquals(Long.valueOf(1), dockerShare.getUserId()); assertEquals(true, dockerShare.isReadOnly()); } @Test public void createConstructor() { Date date = new Date(); DockerShare dockerShare = new DockerShare(1L, 1L, true); dockerShare.setExpiration(date); assertEquals(Long.valueOf(1), dockerShare.getDockerId()); assertEquals(date, dockerShare.getExpiration()); assertEquals(Long.valueOf(1), dockerShare.getUserId()); assertEquals(true, dockerShare.isReadOnly()); } }
3e030316943ffcc520f94b756389511085e28b96
1,751
java
Java
cruise.umplificator/test/cruise/umplificator/examples/RoutesAndLocations/Landmark.java
pwang347/umple
9a924c0ab8ce6ebf258d804fcf24d69e26210bf9
[ "MIT" ]
206
2015-08-26T15:49:05.000Z
2022-03-26T18:31:12.000Z
cruise.umplificator/test/cruise/umplificator/examples/RoutesAndLocations/Landmark.java
pwang347/umple
9a924c0ab8ce6ebf258d804fcf24d69e26210bf9
[ "MIT" ]
837
2015-08-31T18:19:59.000Z
2022-03-21T16:01:27.000Z
cruise.umplificator/test/cruise/umplificator/examples/RoutesAndLocations/Landmark.java
pwang347/umple
9a924c0ab8ce6ebf258d804fcf24d69e26210bf9
[ "MIT" ]
336
2015-08-26T17:00:41.000Z
2022-02-14T19:39:57.000Z
21.096386
77
0.596802
1,243
/*PLEASE DO NOT EDIT THIS CODE*/ /*This code was generated using the UMPLE 1.21.0.4666 modeling language!*/ // line 39 "RoutesAndLocations.ump" // line 175 "RoutesAndLocations.ump" public class Landmark extends Location { //------------------------ // MEMBER VARIABLES //------------------------ //Landmark Attributes private String description; //Landmark State Machines enum LandmarkType { fireStation, policeStation, touristDestination, other } private LandmarkType landmarkType; //------------------------ // CONSTRUCTOR //------------------------ public Landmark(float aLattitude, float aLongitude, String aDescription) { super(aLattitude, aLongitude); description = aDescription; setLandmarkType(LandmarkType.fireStation); } //------------------------ // INTERFACE //------------------------ public boolean setDescription(String aDescription) { boolean wasSet = false; description = aDescription; wasSet = true; return wasSet; } /** * Name of landmark (name of fire station, business, address) */ public String getDescription() { return description; } public String getLandmarkTypeFullName() { String answer = landmarkType.toString(); return answer; } public LandmarkType getLandmarkType() { return landmarkType; } public boolean setLandmarkType(LandmarkType aLandmarkType) { landmarkType = aLandmarkType; return true; } public void delete() { super.delete(); } public String toString() { String outputString = ""; return super.toString() + "["+ "description" + ":" + getDescription()+ "]" + outputString; } }
3e0303a7834fde69d9bfd9f9cc1fdc75a0dae91e
9,769
java
Java
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeyStoreUtils.java
JasonEverling/cas
9d5eb3e7dbf34a29f5f69141602b3f83b48353c8
[ "Apache-2.0" ]
1
2022-03-03T03:28:12.000Z
2022-03-03T03:28:12.000Z
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeyStoreUtils.java
Nurran/cas
43392ae8eefeb36d44a2b06fdedba589d726f4ae
[ "Apache-2.0" ]
1
2022-02-13T01:06:28.000Z
2022-02-13T01:06:31.000Z
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcJsonWebKeyStoreUtils.java
isabella232/cas
fc570ef1f0aa6b18817a955c5158e84d35aa201d
[ "Apache-2.0" ]
1
2022-02-07T21:45:41.000Z
2022-02-07T21:45:41.000Z
44.004505
123
0.602825
1,244
package org.apereo.cas.oidc.jwks; import org.apereo.cas.services.OidcRegisteredService; import org.apereo.cas.util.LoggingUtils; import org.apereo.cas.util.ResourceUtils; import org.apereo.cas.util.function.FunctionUtils; import org.apereo.cas.util.spring.SpringExpressionLanguageValueResolver; import lombok.SneakyThrows; import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; import lombok.val; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.jooq.lambda.fi.util.function.CheckedFunction; import org.jose4j.jwk.EcJwkGenerator; import org.jose4j.jwk.JsonWebKey; import org.jose4j.jwk.JsonWebKeySet; import org.jose4j.jwk.PublicJsonWebKey; import org.jose4j.jwk.RsaJwkGenerator; import org.jose4j.jws.AlgorithmIdentifiers; import org.jose4j.keys.EllipticCurves; import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Optional; import java.util.UUID; import java.util.function.Predicate; import java.util.stream.Collectors; /** * This is {@link OidcJsonWebKeyStoreUtils}. * * @author Misagh Moayyed * @since 6.1.0 */ @UtilityClass @Slf4j public class OidcJsonWebKeyStoreUtils { private static final int JWK_EC_P384_SIZE = 384; private static final int JWK_EC_P512_SIZE = 512; /** * Gets json web key set. * * @param service the service * @param resourceLoader the resource loader * @param usage the usage * @return the json web key set */ public static Optional<JsonWebKeySet> getJsonWebKeySet(final OidcRegisteredService service, final ResourceLoader resourceLoader, final Optional<OidcJsonWebKeyUsage> usage) { return FunctionUtils.doAndHandle( () -> { val serviceJwks = SpringExpressionLanguageValueResolver.getInstance().resolve(service.getJwks()); LOGGER.trace("Loading JSON web key from [{}]", serviceJwks); val resource = getJsonWebKeySetResource(service, resourceLoader); if (resource == null) { LOGGER.warn("No JSON web keys or keystore resource could be found for [{}]", service); return Optional.empty(); } val requestedKid = Optional.ofNullable(service.getJwksKeyId()); return buildJsonWebKeySet(resource, requestedKid, usage); }, (CheckedFunction<Throwable, Optional<JsonWebKeySet>>) throwable -> { LoggingUtils.error(LOGGER, throwable); return Optional.empty(); }) .get(); } /** * Gets json web key from jwks. * * @param jwks the jwks * @param requestedKey the kid * @param usage the usage * @return the json web key from jwks */ public static Optional<JsonWebKeySet> getJsonWebKeyFromJsonWebKeySet( final JsonWebKeySet jwks, final Optional<String> requestedKey, final Optional<OidcJsonWebKeyUsage> usage) { if (jwks.getJsonWebKeys().isEmpty()) { LOGGER.warn("No JSON web keys are available in the keystore"); return Optional.empty(); } val keyResult = getJsonWebKeyByKeyId(jwks, requestedKey, usage) .getJsonWebKeys() .stream() .filter(key -> key.getKey() != null) .collect(Collectors.toList()); if (keyResult.isEmpty()) { LOGGER.warn("Unable to locate JSON web key for [{}]", requestedKey.map(Object::toString)); return Optional.empty(); } return Optional.of(new JsonWebKeySet(keyResult)); } private static List<JsonWebKey> filterJsonWebKeySetKeysBy(final JsonWebKeySet jwks, final Optional<String> keyIdRequest, final Optional<OidcJsonWebKeyUsage> usage) { var filter = (Predicate<JsonWebKey>) k -> k instanceof PublicJsonWebKey; if (keyIdRequest.isPresent()) { filter = filter.and(jsonWebKey -> StringUtils.equalsIgnoreCase(jsonWebKey.getKeyId(), keyIdRequest.get())); } if (usage.isPresent()) { filter = filter.and(jsonWebKey -> usage.get().is(jsonWebKey)); } return jwks.getJsonWebKeys() .stream() .filter(filter) .map(PublicJsonWebKey.class::cast) .collect(Collectors.toList()); } private static JsonWebKeySet getJsonWebKeyByKeyId(final JsonWebKeySet jwks, final Optional<String> kid, final Optional<OidcJsonWebKeyUsage> usage) { if (kid.isPresent()) { var resultJwks = filterJsonWebKeySetKeysBy(jwks, kid, usage); if (usage.isPresent() && resultJwks.isEmpty()) { LOGGER.debug("No JSON web keys found for [{}] and usage [{}]. Skipping usage...", kid.get(), usage.get()); resultJwks = filterJsonWebKeySetKeysBy(jwks, kid, Optional.empty()); } LOGGER.debug("JSON web keys found for [{}] are [{}]", kid.get(), resultJwks); return new JsonWebKeySet(resultJwks); } var resultJwks = filterJsonWebKeySetKeysBy(jwks, Optional.empty(), usage); if (usage.isPresent() && resultJwks.isEmpty()) { LOGGER.debug("No JSON web keys found for usage [{}]. Skipping usage...", usage.get()); resultJwks = filterJsonWebKeySetKeysBy(jwks, Optional.empty(), Optional.empty()); } LOGGER.debug("JSON web keys found are [{}]", resultJwks); return new JsonWebKeySet(resultJwks); } private static Optional<JsonWebKeySet> buildJsonWebKeySet(final Resource resource, final Optional<String> keyId, final Optional<OidcJsonWebKeyUsage> usage) throws Exception { LOGGER.debug("Loading JSON web key from [{}]", resource); val json = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8); LOGGER.debug("Retrieved JSON web key from [{}] as [{}]", resource, json); return buildJsonWebKeySet(json, keyId, usage); } private static Optional<JsonWebKeySet> buildJsonWebKeySet(final String json, final Optional<String> keyId, final Optional<OidcJsonWebKeyUsage> usage) throws Exception { return getJsonWebKeyFromJsonWebKeySet(new JsonWebKeySet(json), keyId, usage); } private static Resource getJsonWebKeySetResource(final OidcRegisteredService service, final ResourceLoader resourceLoader) { val serviceJwks = SpringExpressionLanguageValueResolver.getInstance().resolve(service.getJwks()); if (StringUtils.isNotBlank(serviceJwks)) { if (ResourceUtils.doesResourceExist(serviceJwks)) { return resourceLoader.getResource(serviceJwks); } return new InputStreamResource(new ByteArrayInputStream(serviceJwks.getBytes(StandardCharsets.UTF_8)), "JWKS"); } return null; } /** * Parse json web key set. * * @param json the json * @return the json web key set */ @SneakyThrows public static JsonWebKeySet parseJsonWebKeySet(final String json) { return new JsonWebKeySet(json); } /** * Generate json web key. * * @param jwksType the jwks type * @param jwksKeySize the jwks key size * @param usage the usage * @return the public json web key */ @SneakyThrows public static PublicJsonWebKey generateJsonWebKey(final String jwksType, final int jwksKeySize, final OidcJsonWebKeyUsage usage) { switch (jwksType.trim().toLowerCase()) { case "ec": if (jwksKeySize == JWK_EC_P384_SIZE) { val jwk = EcJwkGenerator.generateJwk(EllipticCurves.P384); jwk.setKeyId(UUID.randomUUID().toString()); jwk.setAlgorithm(AlgorithmIdentifiers.ECDSA_USING_P384_CURVE_AND_SHA384); usage.assignTo(jwk); return jwk; } if (jwksKeySize == JWK_EC_P512_SIZE) { val jwk = EcJwkGenerator.generateJwk(EllipticCurves.P521); jwk.setKeyId(UUID.randomUUID().toString()); jwk.setAlgorithm(AlgorithmIdentifiers.ECDSA_USING_P521_CURVE_AND_SHA512); usage.assignTo(jwk); return jwk; } val jwk = EcJwkGenerator.generateJwk(EllipticCurves.P256); jwk.setKeyId(UUID.randomUUID().toString()); jwk.setAlgorithm(AlgorithmIdentifiers.ECDSA_USING_P521_CURVE_AND_SHA512); usage.assignTo(jwk); return jwk; case "rsa": default: val newJwk = RsaJwkGenerator.generateJwk(jwksKeySize); newJwk.setKeyId(UUID.randomUUID().toString()); usage.assignTo(newJwk); return newJwk; } } }
3e0304a15ace96e9f0282ef77338dc9b20b8d5e8
14,584
java
Java
commons-core/src/main/java/com/deleidos/rtws/commons/util/index/NestedMapRangeIndex.java
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
4
2015-07-09T14:57:07.000Z
2022-02-23T17:48:24.000Z
commons-core/src/main/java/com/deleidos/rtws/commons/util/index/NestedMapRangeIndex.java
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
1
2016-04-20T01:13:29.000Z
2016-04-20T01:13:29.000Z
commons-core/src/main/java/com/deleidos/rtws/commons/util/index/NestedMapRangeIndex.java
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
4
2016-03-10T00:23:17.000Z
2022-03-02T11:17:02.000Z
51.352113
114
0.699739
1,245
/** * Apache License * Version 2.0, January 2004 * http://www.apache.org/licenses/ * * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION * * 1. Definitions. * * "License" shall mean the terms and conditions for use, reproduction, * and distribution as defined by Sections 1 through 9 of this document. * * "Licensor" shall mean the copyright owner or entity authorized by * the copyright owner that is granting the License. * * "Legal Entity" shall mean the union of the acting entity and all * other entities that control, are controlled by, or are under common * control with that entity. For the purposes of this definition, * "control" means (i) the power, direct or indirect, to cause the * direction or management of such entity, whether by contract or * otherwise, or (ii) ownership of fifty percent (50%) or more of the * outstanding shares, or (iii) beneficial ownership of such entity. * * "You" (or "Your") shall mean an individual or Legal Entity * exercising permissions granted by this License. * * "Source" form shall mean the preferred form for making modifications, * including but not limited to software source code, documentation * source, and configuration files. * * "Object" form shall mean any form resulting from mechanical * transformation or translation of a Source form, including but * not limited to compiled object code, generated documentation, * and conversions to other media types. * * "Work" shall mean the work of authorship, whether in Source or * Object form, made available under the License, as indicated by a * copyright notice that is included in or attached to the work * (an example is provided in the Appendix below). * * "Derivative Works" shall mean any work, whether in Source or Object * form, that is based on (or derived from) the Work and for which the * editorial revisions, annotations, elaborations, or other modifications * represent, as a whole, an original work of authorship. For the purposes * of this License, Derivative Works shall not include works that remain * separable from, or merely link (or bind by name) to the interfaces of, * the Work and Derivative Works thereof. * * "Contribution" shall mean any work of authorship, including * the original version of the Work and any modifications or additions * to that Work or Derivative Works thereof, that is intentionally * submitted to Licensor for inclusion in the Work by the copyright owner * or by an individual or Legal Entity authorized to submit on behalf of * the copyright owner. For the purposes of this definition, "submitted" * means any form of electronic, verbal, or written communication sent * to the Licensor or its representatives, including but not limited to * communication on electronic mailing lists, source code control systems, * and issue tracking systems that are managed by, or on behalf of, the * Licensor for the purpose of discussing and improving the Work, but * excluding communication that is conspicuously marked or otherwise * designated in writing by the copyright owner as "Not a Contribution." * * "Contributor" shall mean Licensor and any individual or Legal Entity * on behalf of whom a Contribution has been received by Licensor and * subsequently incorporated within the Work. * * 2. Grant of Copyright License. Subject to the terms and conditions of * this License, each Contributor hereby grants to You a perpetual, * worldwide, non-exclusive, no-charge, royalty-free, irrevocable * copyright license to reproduce, prepare Derivative Works of, * publicly display, publicly perform, sublicense, and distribute the * Work and such Derivative Works in Source or Object form. * * 3. Grant of Patent License. Subject to the terms and conditions of * this License, each Contributor hereby grants to You a perpetual, * worldwide, non-exclusive, no-charge, royalty-free, irrevocable * (except as stated in this section) patent license to make, have made, * use, offer to sell, sell, import, and otherwise transfer the Work, * where such license applies only to those patent claims licensable * by such Contributor that are necessarily infringed by their * Contribution(s) alone or by combination of their Contribution(s) * with the Work to which such Contribution(s) was submitted. If You * institute patent litigation against any entity (including a * cross-claim or counterclaim in a lawsuit) alleging that the Work * or a Contribution incorporated within the Work constitutes direct * or contributory patent infringement, then any patent licenses * granted to You under this License for that Work shall terminate * as of the date such litigation is filed. * * 4. Redistribution. You may reproduce and distribute copies of the * Work or Derivative Works thereof in any medium, with or without * modifications, and in Source or Object form, provided that You * meet the following conditions: * * (a) You must give any other recipients of the Work or * Derivative Works a copy of this License; and * * (b) You must cause any modified files to carry prominent notices * stating that You changed the files; and * * (c) You must retain, in the Source form of any Derivative Works * that You distribute, all copyright, patent, trademark, and * attribution notices from the Source form of the Work, * excluding those notices that do not pertain to any part of * the Derivative Works; and * * (d) If the Work includes a "NOTICE" text file as part of its * distribution, then any Derivative Works that You distribute must * include a readable copy of the attribution notices contained * within such NOTICE file, excluding those notices that do not * pertain to any part of the Derivative Works, in at least one * of the following places: within a NOTICE text file distributed * as part of the Derivative Works; within the Source form or * documentation, if provided along with the Derivative Works; or, * within a display generated by the Derivative Works, if and * wherever such third-party notices normally appear. The contents * of the NOTICE file are for informational purposes only and * do not modify the License. You may add Your own attribution * notices within Derivative Works that You distribute, alongside * or as an addendum to the NOTICE text from the Work, provided * that such additional attribution notices cannot be construed * as modifying the License. * * You may add Your own copyright statement to Your modifications and * may provide additional or different license terms and conditions * for use, reproduction, or distribution of Your modifications, or * for any such Derivative Works as a whole, provided Your use, * reproduction, and distribution of the Work otherwise complies with * the conditions stated in this License. * * 5. Submission of Contributions. Unless You explicitly state otherwise, * any Contribution intentionally submitted for inclusion in the Work * by You to the Licensor shall be under the terms and conditions of * this License, without any additional terms or conditions. * Notwithstanding the above, nothing herein shall supersede or modify * the terms of any separate license agreement you may have executed * with Licensor regarding such Contributions. * * 6. Trademarks. This License does not grant permission to use the trade * names, trademarks, service marks, or product names of the Licensor, * except as required for reasonable and customary use in describing the * origin of the Work and reproducing the content of the NOTICE file. * * 7. Disclaimer of Warranty. Unless required by applicable law or * agreed to in writing, Licensor provides the Work (and each * Contributor provides its Contributions) on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied, including, without limitation, any warranties or conditions * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A * PARTICULAR PURPOSE. You are solely responsible for determining the * appropriateness of using or redistributing the Work and assume any * risks associated with Your exercise of permissions under this License. * * 8. Limitation of Liability. In no event and under no legal theory, * whether in tort (including negligence), contract, or otherwise, * unless required by applicable law (such as deliberate and grossly * negligent acts) or agreed to in writing, shall any Contributor be * liable to You for damages, including any direct, indirect, special, * incidental, or consequential damages of any character arising as a * result of this License or out of the use or inability to use the * Work (including but not limited to damages for loss of goodwill, * work stoppage, computer failure or malfunction, or any and all * other commercial damages or losses), even if such Contributor * has been advised of the possibility of such damages. * * 9. Accepting Warranty or Additional Liability. While redistributing * the Work or Derivative Works thereof, You may choose to offer, * and charge a fee for, acceptance of support, warranty, indemnity, * or other liability obligations and/or rights consistent with this * License. However, in accepting such obligations, You may act only * on Your own behalf and on Your sole responsibility, not on behalf * of any other Contributor, and only if You agree to indemnify, * defend, and hold each Contributor harmless for any liability * incurred by, or claims asserted against, such Contributor by reason * of your accepting any such warranty or additional liability. * * END OF TERMS AND CONDITIONS * * APPENDIX: How to apply the Apache License to your work. * * To apply the Apache License to your work, attach the following * boilerplate notice, with the fields enclosed by brackets "{}" * replaced with your own identifying information. (Don't include * the brackets!) The text should be enclosed in the appropriate * comment syntax for the file format. We also recommend that a * file or class name and description of purpose be included on the * same "printed page" as the copyright notice for easier * identification within third-party archives. * * Copyright {yyyy} {name of copyright owner} * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.deleidos.rtws.commons.util.index; import java.util.Collection; import java.util.LinkedList; import java.util.NavigableMap; import java.util.TreeMap; /** * * @author deckerjos * Index implementing searching over range relationships. This is backwards from a typical * range search where one searches a fixed list of values for those that satisfy a condition (i.e. * find my values that are between x and y). Instead, this indexes the condition; thus one searches * for conditions that are satisfied by a given value. Therefore, if indexing the range expression * "between three and five", searching for any of the values 3, 4 or 5 would all return same result. * Adding the the expression "between one and five", the values 3, 4 and 5 would return both entries, * while searching for 1 or 2 would return only the entry for "between one and five". */ public class NestedMapRangeIndex<T extends Comparable<T>, E> extends RangeIndex<T, E> { /** The index. */ private NavigableMap<T, NavigableMap<T, Collection<E>>> index = new TreeMap<T, NavigableMap<T, Collection<E>>>(); /** * Constructor. Both upper and lower bound edges are treaded inclusively. */ public NestedMapRangeIndex() { super(true, true); } /** * Constructor. * * @param leftInclusive Whether the left (lower bound) edge of the range is inclusive or exclusive. * @param rightInclusive Whether the right (upper bound) edge of the range is inclusive or exclusive. */ public NestedMapRangeIndex(boolean leftInclusive, boolean rightInclusive) { super(leftInclusive,rightInclusive); } /** * Finds all entries who's range expression is satisfied by the given value. */ public Collection<E> find(T value) { LinkedList<E> buffer = new LinkedList<E>(); for(NavigableMap<T, Collection<E>> subindex : index.headMap(value, leftInclusive).values()) { for(Collection<E> match : subindex.tailMap(value, rightInclusive).values()) { buffer.addAll(match); } } return buffer; } /** * Associates the given entry with the given range of values. */ public void associate(Range<T> range, E entry) { associate(range.getLowerLimit(), range.getUpperLimit(), entry); } /** * Associates the given entry with the given range of values. */ public void associate(T lower, T upper, E entry) { if(!index.containsKey(lower)) { index.put(lower, new TreeMap<T, Collection<E>>()); } NavigableMap<T, Collection<E>> subindex = index.get(lower); if(!subindex.containsKey(upper)) { subindex.put(upper, new LinkedList<E>()); } Collection<E> list = subindex.get(upper); list.add(entry); } }
3e0305064ec99662fc0c3f5408bc279bbd299ab0
1,222
java
Java
src/main/java/com/rcextract/minecord/sql/Deserializer.java
RcExtract/Minecord
b3936ad203b86e4384599d74eeb04469e2bb2950
[ "Apache-2.0" ]
1
2021-04-05T08:26:23.000Z
2021-04-05T08:26:23.000Z
src/main/java/com/rcextract/minecord/sql/Deserializer.java
RcExtract/Minecord
b3936ad203b86e4384599d74eeb04469e2bb2950
[ "Apache-2.0" ]
2
2020-05-07T14:20:34.000Z
2021-10-12T13:15:09.000Z
src/main/java/com/rcextract/minecord/sql/Deserializer.java
RcExtract/Minecord
b3936ad203b86e4384599d74eeb04469e2bb2950
[ "Apache-2.0" ]
1
2021-04-05T08:30:20.000Z
2021-04-05T08:30:20.000Z
24.938776
78
0.762684
1,246
package com.rcextract.minecord.sql; @Deprecated @FunctionalInterface public interface Deserializer<A, R> { public R deserialize(A a); /*@FunctionalInterface public static interface FromBoolean<R> extends Deserializer<Boolean, R> { public R deserialize(Boolean b); } @FunctionalInterface public static interface FromCharacter<R> extends Deserializer<Character, R> { public R deserialize(Character c); } @FunctionalInterface public static interface FromDouble<R> extends Deserializer<Double, R> { public R deserialize(Double d); } @FunctionalInterface public static interface FromFloat<R> extends Deserializer<Float, R> { public R deserialize(Float f); } @FunctionalInterface public static interface FromInteger<R> extends Deserializer<Integer, R> { public R deserialize(Integer i); } @FunctionalInterface public static interface FromLong<R> extends Deserializer<Long, R> { public R deserialize(Long l); } @FunctionalInterface public static interface FromShort<R> extends Deserializer<Short, R> { public R deserialize(Short s); } @FunctionalInterface public static interface FromString<R> extends Deserializer<String, R> { public R deserialize(String string); }*/ }
3e030602be26cb4ddedff3192d253203f8c2e154
28,300
java
Java
src/tools/android/java/com/google/devtools/build/android/xml/AttrXmlResourceValue.java
jakubbujny/bazel
377db75fad1a7b0e90bf2656d6cd39f50795c110
[ "Apache-2.0" ]
8
2015-12-25T16:16:53.000Z
2021-07-13T09:58:53.000Z
src/tools/android/java/com/google/devtools/build/android/xml/AttrXmlResourceValue.java
dilbrent/bazel
7b73c5f6abc9e9b574849f760873252ee987e184
[ "Apache-2.0" ]
67
2022-01-12T18:22:13.000Z
2022-01-12T18:24:28.000Z
src/tools/android/java/com/google/devtools/build/android/xml/AttrXmlResourceValue.java
dilbrent/bazel
7b73c5f6abc9e9b574849f760873252ee987e184
[ "Apache-2.0" ]
6
2016-02-10T20:07:36.000Z
2020-11-18T17:44:05.000Z
34.512195
100
0.691378
1,247
// Copyright 2016 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.android.xml; import static com.google.common.base.Predicates.equalTo; import static com.google.common.base.Predicates.not; import com.android.aapt.Resources.Attribute; import com.android.aapt.Resources.Attribute.Symbol; import com.android.aapt.Resources.Value; import com.android.resources.ResourceType; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Ordering; import com.google.devtools.build.android.AndroidDataWritingVisitor; import com.google.devtools.build.android.AndroidDataWritingVisitor.StartTag; import com.google.devtools.build.android.AndroidDataWritingVisitor.ValuesResourceDefinition; import com.google.devtools.build.android.AndroidResourceSymbolSink; import com.google.devtools.build.android.DataSource; import com.google.devtools.build.android.FullyQualifiedName; import com.google.devtools.build.android.XmlResourceValue; import com.google.devtools.build.android.XmlResourceValues; import com.google.devtools.build.android.proto.SerializeFormat; import com.google.protobuf.InvalidProtocolBufferException; import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Objects; import java.util.Set; import javax.annotation.CheckReturnValue; import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import javax.xml.namespace.QName; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; /** * Represents an Android Resource custom attribute. * * <p>Attribute are the most complicated Android resource, and therefore the least documented. Most * of the information about them is found by reading the android compatibility library source. An * Attribute defines a parameter that can be passed into a view class -- as such you can think of * attributes as creating slots for other resources to fit into. Each slot will have at least one * format, and can have multiples. Simple attributes (color, boolean, reference, dimension, float, * integer, string, and fraction) are defined as &lt;attr name="<em>name</em>" format= * "<em>format</em>" /&gt; while the complex ones, flag and enum, have sub parentTags: &lt;attr * name= "<em>name</em>" &gt&lt;flag name="<em>name</em>" value="<em>value</em>"&gt; &lt;/attr&gt;. * * <p>Attributes also have a double duty as defining validation logic for layout resources -- each * layout attribute *must* have a corresponding attribute which will be used to validate the * value/resource reference defined in it. * * <p>AttrXmlValue, due to the multiple types of attributes is actually a composite class that * contains multiple {@link XmlResourceValue} instances for each resource. */ @Immutable public class AttrXmlResourceValue implements XmlResourceValue { private static final String FRACTION = "fraction"; private static final String STRING = "string"; private static final String INTEGER = "integer"; private static final String FLOAT = "float"; private static final String DIMENSION = "dimension"; private static final String BOOLEAN = "boolean"; private static final String COLOR = "color"; private static final String REFERENCE = "reference"; private static final String ENUM = "enum"; private static final String FLAGS = "flags"; private static final QName TAG_ENUM = QName.valueOf(ENUM); private static final QName TAG_FLAG = QName.valueOf("flag"); private final ImmutableMap<String, ResourceXmlAttrValue> formats; private AttrXmlResourceValue(ImmutableMap<String, ResourceXmlAttrValue> formats) { this.formats = formats; } private static Map<String, String> readSubValues(XMLEventReader reader, QName subTagType) throws XMLStreamException { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); while (reader.hasNext() && XmlResourceValues.isTag(XmlResourceValues.peekNextTag(reader), subTagType)) { StartElement element = reader.nextEvent().asStartElement(); builder.put( XmlResourceValues.getElementName(element), XmlResourceValues.getElementValue(element)); XMLEvent endTag = reader.nextEvent(); if (!XmlResourceValues.isEndTag(endTag, subTagType)) { throw new XMLStreamException( String.format("Unexpected [%s]; Expected %s", endTag, "</enum>"), endTag.getLocation()); } } return builder.build(); } private static void endAttrElement(XMLEventReader reader) throws XMLStreamException { XMLEvent endTag = reader.nextTag(); if (!endTag.isEndElement() || !QName.valueOf("attr").equals(endTag.asEndElement().getName())) { throw new XMLStreamException("Unexpected ParentTag:" + endTag, endTag.getLocation()); } } @VisibleForTesting private static final class BuilderEntry implements Map.Entry<String, ResourceXmlAttrValue> { private final String name; private final ResourceXmlAttrValue value; BuilderEntry(String name, ResourceXmlAttrValue value) { this.name = name; this.value = value; } @Override public String getKey() { return name; } @Override public ResourceXmlAttrValue getValue() { return value; } @Override public ResourceXmlAttrValue setValue(ResourceXmlAttrValue value) { throw new UnsupportedOperationException(); } } @SafeVarargs @VisibleForTesting public static XmlResourceValue fromFormatEntries( Map.Entry<String, ResourceXmlAttrValue>... entries) { return of(ImmutableMap.copyOf(Arrays.asList(entries))); } @SuppressWarnings("deprecation") public static XmlResourceValue from(SerializeFormat.DataValueXml proto) throws InvalidProtocolBufferException { ImmutableMap.Builder<String, ResourceXmlAttrValue> formats = ImmutableMap.<String, AttrXmlResourceValue.ResourceXmlAttrValue>builder(); for (Map.Entry<String, SerializeFormat.DataValueXml> entry : proto.getMappedXmlValue().entrySet()) { switch (entry.getKey()) { case FLAGS: formats.put( entry.getKey(), FlagResourceXmlAttrValue.of(entry.getValue().getMappedStringValue())); break; case ENUM: formats.put( entry.getKey(), EnumResourceXmlAttrValue.of(entry.getValue().getMappedStringValue())); break; case REFERENCE: formats.put(entry.getKey(), ReferenceResourceXmlAttrValue.of()); break; case COLOR: formats.put(entry.getKey(), ColorResourceXmlAttrValue.of()); break; case BOOLEAN: formats.put(entry.getKey(), BooleanResourceXmlAttrValue.of()); break; case DIMENSION: formats.put(entry.getKey(), DimensionResourceXmlAttrValue.of()); break; case FLOAT: formats.put(entry.getKey(), FloatResourceXmlAttrValue.of()); break; case INTEGER: formats.put(entry.getKey(), IntegerResourceXmlAttrValue.of()); break; case STRING: formats.put(entry.getKey(), StringResourceXmlAttrValue.of()); break; case FRACTION: formats.put(entry.getKey(), FractionResourceXmlAttrValue.of()); break; default: throw new InvalidProtocolBufferException("Unexpected format: " + entry.getKey()); } } return of(formats.build()); } public static XmlResourceValue from(Value proto) throws InvalidProtocolBufferException { ImmutableMap.Builder<String, ResourceXmlAttrValue> formats = ImmutableMap.builder(); Attribute attribute = proto.getCompoundValue().getAttr(); int formatFlags = attribute.getFormatFlags(); if (formatFlags != 0xFFFF) { //These flags are defined in AOSP in ResourceTypes.h:ResTable_map if ((formatFlags & 1 << 0) != 0) { formats.put("reference", ReferenceResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 1) != 0) { formats.put("string", StringResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 2) != 0) { formats.put("integer", IntegerResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 3) != 0) { formats.put("boolean", BooleanResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 4) != 0) { formats.put("color", ColorResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 5) != 0) { formats.put("float", FloatResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 6) != 0) { formats.put("dimension", DimensionResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 7) != 0) { formats.put("fraction", FractionResourceXmlAttrValue.of()); } if ((formatFlags & 1 << 16) != 0) { Map<String, String> enums = new HashMap<>(); for (Symbol attrSymbol : attribute.getSymbolList()) { String name = attrSymbol.getName().getName().replaceFirst("id/", ""); enums.put(name, Integer.toString(attrSymbol.getValue())); } formats.put("enum", EnumResourceXmlAttrValue.of(enums)); } if ((formatFlags & 1 << 17) != 0) { Map<String, String> flags = new HashMap<>(); for (Symbol attrSymbol : attribute.getSymbolList()) { String name = attrSymbol.getName().getName().replaceFirst("id/", ""); flags.put(name, Integer.toString(attrSymbol.getValue())); } formats.put("flags", FlagResourceXmlAttrValue.of(flags)); } if ((formatFlags & 0xFFFCFF00) != 0) { throw new InvalidProtocolBufferException( "Unexpected format flags: " + formatFlags); } } return of(formats.build()); } /** * Creates a new {@link AttrXmlResourceValue}. Returns null if there are no formats. */ @Nullable public static XmlResourceValue from( StartElement attr, @Nullable String format, XMLEventReader eventReader) throws XMLStreamException { Set<String> formatNames = new HashSet<>(); if (format != null) { Collections.addAll(formatNames, format.split("\\|")); } XMLEvent nextTag = XmlResourceValues.peekNextTag(eventReader); if (nextTag != null && nextTag.isStartElement()) { QName tagName = nextTag.asStartElement().getName(); if (TAG_FLAG.equals(tagName)) { formatNames.add(FLAGS); } else { formatNames.add(tagName.getLocalPart().toLowerCase()); } } ImmutableMap.Builder<String, ResourceXmlAttrValue> formats = ImmutableMap.builder(); for (String formatName : formatNames) { switch (formatName) { case FLAGS: Map<String, String> flags = readSubValues(eventReader, TAG_FLAG); endAttrElement(eventReader); formats.put(formatName, FlagResourceXmlAttrValue.of(flags)); break; case ENUM: Map<String, String> enums = readSubValues(eventReader, TAG_ENUM); endAttrElement(eventReader); formats.put(formatName, EnumResourceXmlAttrValue.of(enums)); break; case REFERENCE: formats.put(formatName, ReferenceResourceXmlAttrValue.of()); break; case COLOR: formats.put(formatName, ColorResourceXmlAttrValue.of()); break; case BOOLEAN: formats.put(formatName, BooleanResourceXmlAttrValue.of()); break; case DIMENSION: formats.put(formatName, DimensionResourceXmlAttrValue.of()); break; case FLOAT: formats.put(formatName, FloatResourceXmlAttrValue.of()); break; case INTEGER: formats.put(formatName, IntegerResourceXmlAttrValue.of()); break; case STRING: formats.put(formatName, StringResourceXmlAttrValue.of()); break; case FRACTION: formats.put(formatName, FractionResourceXmlAttrValue.of()); break; default: throw new XMLStreamException( String.format("Unexpected attr format: %S", formatName), attr.getLocation()); } } return of(formats.build()); } public static XmlResourceValue of(ImmutableMap<String, ResourceXmlAttrValue> formats) { return new AttrXmlResourceValue(formats); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AttrXmlResourceValue other = (AttrXmlResourceValue) o; return Objects.equals(formats, other.formats); } @Override public int hashCode() { return formats.hashCode(); } @Override public String toString() { return MoreObjects.toStringHelper(this).add("formats", formats).toString(); } @Override public void write( FullyQualifiedName key, DataSource source, AndroidDataWritingVisitor mergedDataWriter) { if (formats.isEmpty()) { mergedDataWriter .define(key) .derivedFrom(source) .startTag("attr") .named(key) .closeUnaryTag() .save(); } else { ImmutableList<String> formatKeys = FluentIterable.from(formats.keySet()) .filter(not(equalTo(FLAGS))) .filter(not(equalTo(ENUM))) .toSortedList(Ordering.natural()); StartTag startTag = mergedDataWriter .define(key) .derivedFrom(source) .startTag("attr") .named(key) .optional() .attribute("format") .setFrom(formatKeys) .joinedBy("|"); ValuesResourceDefinition definition; if (formats.keySet().contains(FLAGS) || formats.keySet().contains(ENUM)) { definition = startTag.closeTag(); for (ResourceXmlAttrValue value : formats.values()) { definition = value.writeTo(definition); } definition = definition.addCharactersOf("\n").endTag(); } else { definition = startTag.closeUnaryTag(); } definition.save(); } } @Override public void writeResourceToClass(FullyQualifiedName key, AndroidResourceSymbolSink sink) { sink.acceptSimpleResource(key.type(), key.name()); // Flags and enums generate ID fields. if (formats.keySet().contains(FLAGS) || formats.keySet().contains(ENUM)) { for (ResourceXmlAttrValue value : formats.values()) { value.writeToClass(sink); } } } @SuppressWarnings("deprecation") @Override public int serializeTo(int sourceId, Namespaces namespaces, OutputStream output) throws IOException { SerializeFormat.DataValue.Builder builder = XmlResourceValues.newSerializableDataValueBuilder(sourceId); SerializeFormat.DataValueXml.Builder xmlValueBuilder = SerializeFormat.DataValueXml.newBuilder(); xmlValueBuilder .setType(SerializeFormat.DataValueXml.XmlType.ATTR) .putAllNamespace(namespaces.asMap()); for (Map.Entry<String, ResourceXmlAttrValue> entry : formats.entrySet()) { xmlValueBuilder.putMappedXmlValue( entry.getKey(), entry.getValue().appendTo(builder.getXmlValueBuilder())); } builder.setXmlValue(xmlValueBuilder); return XmlResourceValues.serializeProtoDataValue(output, builder); } @Override public XmlResourceValue combineWith(XmlResourceValue value) { throw new IllegalArgumentException(this + " is not a combinable resource."); } /** Represents the xml value for an attr definition. */ @CheckReturnValue public interface ResourceXmlAttrValue { ValuesResourceDefinition writeTo(ValuesResourceDefinition writer); SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder); void writeToClass(AndroidResourceSymbolSink writer); } // TODO(corysmith): The ResourceXmlAttrValue implementors, other than enum and flag, share a // lot of boilerplate. Determine how to reduce it. /** Represents an Android Enum Attribute resource. */ @VisibleForTesting public static class EnumResourceXmlAttrValue implements ResourceXmlAttrValue { private Map<String, String> values; private EnumResourceXmlAttrValue(Map<String, String> values) { this.values = values; } @VisibleForTesting public static Map.Entry<String, ResourceXmlAttrValue> asEntryOf(String... keyThenValue) { Preconditions.checkArgument(keyThenValue.length > 0); Preconditions.checkArgument(keyThenValue.length % 2 == 0); ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); for (int i = 0; i < keyThenValue.length; i += 2) { builder.put(keyThenValue[i], keyThenValue[i + 1]); } return new BuilderEntry(ENUM, of(builder.build())); } public static ResourceXmlAttrValue of(Map<String, String> values) { return new EnumResourceXmlAttrValue(values); } @Override public int hashCode() { return values.hashCode(); } @Override public boolean equals(Object obj) { if (!(obj instanceof EnumResourceXmlAttrValue)) { return false; } EnumResourceXmlAttrValue other = (EnumResourceXmlAttrValue) obj; return Objects.equals(values, other.values); } @Override public String toString() { return MoreObjects.toStringHelper(getClass()).add("values", values).toString(); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.putAllMappedStringValue(values).build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { for (Map.Entry<String, String> entry : values.entrySet()) { writer = writer .startTag("enum") .attribute("name") .setTo(entry.getKey()) .attribute("value") .setTo(entry.getValue()) .closeUnaryTag() .addCharactersOf("\n"); } return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) { for (Map.Entry<String, String> entry : values.entrySet()) { writer.acceptSimpleResource(ResourceType.ID, entry.getKey()); } } } /** Represents an Android Flag Attribute resource. */ @VisibleForTesting public static class FlagResourceXmlAttrValue implements ResourceXmlAttrValue { private Map<String, String> values; private FlagResourceXmlAttrValue(Map<String, String> values) { this.values = values; } public static ResourceXmlAttrValue of(Map<String, String> values) { // ImmutableMap guarantees a stable order. return new FlagResourceXmlAttrValue(ImmutableMap.copyOf(values)); } @VisibleForTesting public static Map.Entry<String, ResourceXmlAttrValue> asEntryOf(String... keyThenValue) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); Preconditions.checkArgument(keyThenValue.length > 0); Preconditions.checkArgument(keyThenValue.length % 2 == 0); for (int i = 0; i < keyThenValue.length; i += 2) { builder.put(keyThenValue[i], keyThenValue[i + 1]); } return new BuilderEntry(FLAGS, of(builder.build())); } @Override public int hashCode() { return values.hashCode(); } @Override public boolean equals(Object obj) { if (!(obj instanceof FlagResourceXmlAttrValue)) { return false; } FlagResourceXmlAttrValue other = (FlagResourceXmlAttrValue) obj; return Objects.equals(values, other.values); } @Override public String toString() { return MoreObjects.toStringHelper(getClass()).add("values", values).toString(); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.putAllMappedStringValue(values).build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { for (Map.Entry<String, String> entry : values.entrySet()) { writer = writer .startTag("flag") .attribute("name") .setTo(entry.getKey()) .attribute("value") .setTo(entry.getValue()) .closeUnaryTag(); } return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) { for (Map.Entry<String, String> entry : values.entrySet()) { writer.acceptSimpleResource(ResourceType.ID, entry.getKey()); } } } /** Represents an Android Reference Attribute resource. */ @VisibleForTesting public static class ReferenceResourceXmlAttrValue implements ResourceXmlAttrValue { private static final ReferenceResourceXmlAttrValue INSTANCE = new ReferenceResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(REFERENCE, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android Color Attribute resource. */ @VisibleForTesting public static class ColorResourceXmlAttrValue implements ResourceXmlAttrValue { private static final ColorResourceXmlAttrValue INSTANCE = new ColorResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(COLOR, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android Boolean Attribute resource. */ @VisibleForTesting public static class BooleanResourceXmlAttrValue implements ResourceXmlAttrValue { private static final BooleanResourceXmlAttrValue INSTANCE = new BooleanResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(BOOLEAN, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android Float Attribute resource. */ @VisibleForTesting public static class FloatResourceXmlAttrValue implements ResourceXmlAttrValue { private static final FloatResourceXmlAttrValue INSTANCE = new FloatResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(FLOAT, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android Dimension Attribute resource. */ @VisibleForTesting public static class DimensionResourceXmlAttrValue implements ResourceXmlAttrValue { private static final DimensionResourceXmlAttrValue INSTANCE = new DimensionResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(DIMENSION, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android Integer Attribute resource. */ @VisibleForTesting public static class IntegerResourceXmlAttrValue implements ResourceXmlAttrValue { private static final IntegerResourceXmlAttrValue INSTANCE = new IntegerResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(INTEGER, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android String Attribute resource. */ @VisibleForTesting public static class StringResourceXmlAttrValue implements ResourceXmlAttrValue { private static final StringResourceXmlAttrValue INSTANCE = new StringResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(STRING, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } /** Represents an Android Fraction Attribute resource. */ @VisibleForTesting public static class FractionResourceXmlAttrValue implements ResourceXmlAttrValue { private static final FractionResourceXmlAttrValue INSTANCE = new FractionResourceXmlAttrValue(); public static ResourceXmlAttrValue of() { return INSTANCE; } @VisibleForTesting public static BuilderEntry asEntry() { return new BuilderEntry(FRACTION, of()); } @Override public SerializeFormat.DataValueXml appendTo(SerializeFormat.DataValueXml.Builder builder) { return builder.build(); } @Override public ValuesResourceDefinition writeTo(ValuesResourceDefinition writer) { return writer; } @Override public void writeToClass(AndroidResourceSymbolSink writer) {} } @Override public String asConflictStringWith(DataSource source) { return source.asConflictString(); } }
3e0306aee592eabba8a1d39214110c120b3acd33
1,012
java
Java
realtime/src/main/java/cn/leancloud/im/v2/messages/LCIMLocationMessage.java
artem-smotrakov/java-unified-sdk
25ae0b7c3f67895fbbda1023a96e99429a6c0df0
[ "Apache-2.0" ]
48
2019-05-27T11:35:09.000Z
2021-11-29T06:11:33.000Z
realtime/src/main/java/cn/leancloud/im/v2/messages/LCIMLocationMessage.java
artem-smotrakov/java-unified-sdk
25ae0b7c3f67895fbbda1023a96e99429a6c0df0
[ "Apache-2.0" ]
105
2019-05-17T08:47:38.000Z
2022-02-23T10:53:19.000Z
realtime/src/main/java/cn/leancloud/im/v2/messages/LCIMLocationMessage.java
artem-smotrakov/java-unified-sdk
25ae0b7c3f67895fbbda1023a96e99429a6c0df0
[ "Apache-2.0" ]
26
2019-06-08T04:41:33.000Z
2022-03-17T13:26:52.000Z
21.531915
62
0.728261
1,248
package cn.leancloud.im.v2.messages; import cn.leancloud.im.v2.LCIMTypedMessage; import cn.leancloud.im.v2.annotation.LCIMMessageField; import cn.leancloud.im.v2.annotation.LCIMMessageType; import cn.leancloud.types.LCGeoPoint; import java.util.Map; @LCIMMessageType(type = LCIMMessageType.LOCATION_MESSAGE_TYPE) public class LCIMLocationMessage extends LCIMTypedMessage { public LCIMLocationMessage() { } @LCIMMessageField(name = "_lcloc") LCGeoPoint location; @LCIMMessageField(name = "_lctext") String text; @LCIMMessageField(name = "_lcattrs") Map<String, Object> attrs; public String getText() { return this.text; } public void setText(String text) { this.text = text; } public Map<String, Object> getAttrs() { return this.attrs; } public void setAttrs(Map<String, Object> attr) { this.attrs = attr; } public LCGeoPoint getLocation() { return location; } public void setLocation(LCGeoPoint location) { this.location = location; } }
3e0306dec546281e7a20913ebdaeef50beaa6cf8
3,673
java
Java
src/main/java/de/ma_vin/ape/users/security/service/AuthorizeCodeService.java
Ma-Vin/de.ma_vin.ape.users
4135b1db71d9e2ea6cf9442563e9a9a6e01fe36e
[ "Apache-2.0" ]
2
2022-03-18T19:50:13.000Z
2022-03-18T19:50:16.000Z
src/main/java/de/ma_vin/ape/users/security/service/AuthorizeCodeService.java
Ma-Vin/de.ma_vin.ape.users
4135b1db71d9e2ea6cf9442563e9a9a6e01fe36e
[ "Apache-2.0" ]
16
2022-01-28T20:36:32.000Z
2022-03-30T18:10:12.000Z
src/main/java/de/ma_vin/ape/users/security/service/AuthorizeCodeService.java
Ma-Vin/de.ma_vin.ape.users
4135b1db71d9e2ea6cf9442563e9a9a6e01fe36e
[ "Apache-2.0" ]
null
null
null
34.650943
165
0.671658
1,249
package de.ma_vin.ape.users.security.service; import de.ma_vin.ape.users.exceptions.CryptException; import de.ma_vin.ape.users.security.EncoderUtil; import de.ma_vin.ape.utils.properties.SystemProperties; import lombok.*; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; /** * Service to provide operations on authorization codes */ @Service @Data @Log4j2 public class AuthorizeCodeService { @Value("${authorizeCodeExpiresInSeconds}") private Long authorizeCodeExpiresInSeconds; @Value("${tokenSecret}") private String secret; @Value("${encodingAlgorithm}") private String encodingAlgorithm; @Setter(AccessLevel.PRIVATE) private Set<CodeInfo> inMemoryCodes = new HashSet<>(); /** * Clears all existing codes */ public void clearAllCodes() { inMemoryCodes.clear(); } /** * Clears all expired codes */ public void clearExpiredCodes() { LocalDateTime now = SystemProperties.getSystemDateTime(); Set<CodeInfo> codesToRemove = inMemoryCodes.stream() .filter(c -> c.getExpiresAt().isBefore(now)) .collect(Collectors.toSet()); log.debug("{} entries are expired", codesToRemove.size()); inMemoryCodes.removeAll(codesToRemove); } /** * Issues a new code * * @param userId identification of the user who authorize the code * @param clientId identification of the client who was asking for * @param scope optional scope of the code * @return Optional of a new generated code */ public Optional<String> issue(String userId, String clientId, String scope) { LocalDateTime expiresAt = SystemProperties.getSystemDateTime().plus(authorizeCodeExpiresInSeconds, ChronoUnit.SECONDS); try { String message = String.format("%s %s %s %s", userId, clientId, scope != null ? scope : "null", DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(expiresAt)); String code = EncoderUtil.encode(message, secret, encodingAlgorithm); inMemoryCodes.add(new CodeInfo(code, userId, clientId, scope, expiresAt)); return Optional.of(code); } catch (CryptException e) { log.error("Could not create authorization code for user {}, client {} and scope {}", userId, clientId, scope != null ? scope : "null"); return Optional.empty(); } } /** * Determines the {@link CodeInfo} of a given code * * @param code Code whose info is ask for * @return Optional of the {@link CodeInfo}. {@link Optional#empty()} if there is no search result. */ public Optional<CodeInfo> getCodeInfo(String code) { return inMemoryCodes.stream().filter(c -> c.getCode().equals(code)).findFirst(); } /** * Checks whether is a given code is known and valid * * @param code authorization codes to check * @return {@code true} if the token is valid. Otherwise {@code false} */ public boolean isValid(String code) { Optional<CodeInfo> codeInfo = getCodeInfo(code); return codeInfo.isPresent() && codeInfo.get().getExpiresAt().isAfter(SystemProperties.getSystemDateTime()); } @Data @AllArgsConstructor public static class CodeInfo { String code; String userId; String clientId; String scope; LocalDateTime expiresAt; } }
3e0306e5b17c0b6101c07a80e59a3e0c80f470ec
373
java
Java
app/src/main/java/com/tinytongtong/thirdpartylibrarystudy/dagger2/test2/MarkCar1Module.java
tinyvampirepudge/ThirdPartyLibraryStudy
01099f7e52c7c61c0b9cc38f5d24835962573b68
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/tinytongtong/thirdpartylibrarystudy/dagger2/test2/MarkCar1Module.java
tinyvampirepudge/ThirdPartyLibraryStudy
01099f7e52c7c61c0b9cc38f5d24835962573b68
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/tinytongtong/thirdpartylibrarystudy/dagger2/test2/MarkCar1Module.java
tinyvampirepudge/ThirdPartyLibraryStudy
01099f7e52c7c61c0b9cc38f5d24835962573b68
[ "Apache-2.0" ]
null
null
null
17.136364
62
0.68435
1,250
package com.tinytongtong.thirdpartylibrarystudy.dagger2.test2; import dagger.Module; import dagger.Provides; /** * @Description: TODO * @Author [email protected] * @Date 2019/5/15 11:31 AM * @Version TODO */ @Module public class MarkCar1Module { public MarkCar1Module() { } @Provides Engine1 provideEngine1() { return new Engine1(); } }
3e0307ceeaaa314156ed29216e764f1caa504107
5,756
java
Java
Extraction/src/main/java/org/opensextant/extractors/geo/rules/MajorPlaceRule.java
jgibson/Xponents
808abeb4ebfd0c669126ddea95dc1eea10e14cb0
[ "Apache-2.0" ]
null
null
null
Extraction/src/main/java/org/opensextant/extractors/geo/rules/MajorPlaceRule.java
jgibson/Xponents
808abeb4ebfd0c669126ddea95dc1eea10e14cb0
[ "Apache-2.0" ]
null
null
null
Extraction/src/main/java/org/opensextant/extractors/geo/rules/MajorPlaceRule.java
jgibson/Xponents
808abeb4ebfd0c669126ddea95dc1eea10e14cb0
[ "Apache-2.0" ]
null
null
null
35.975
119
0.604587
1,251
/** * Copyright 2014 The MITRE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. * */ package org.opensextant.extractors.geo.rules; import java.util.Map; import org.opensextant.data.Place; import org.opensextant.extractors.geo.PlaceCandidate; import org.opensextant.extractors.geo.PlaceEvidence; import static org.opensextant.util.GeodeticUtility.geohash; import java.lang.Math; /** * Major Place rule -- fire this rule after Country rule. * Try to find all countries in scope first, then major places. * If you try to infer country from major places first you get a lot of false positives. * Country name space is smaller and more reliable. * * LOTS of caveats: these rules enforce the notion that country names are drivers here, and major places amplify. * IF we see a National Capital we can infer a country, provided no countries have been seen in document * IF we see a major place, add that evidence weighting it higher if the country of that major place is also * mentioned in document. * * @author ubaldino * */ public class MajorPlaceRule extends GeocodeRule { private final static String MAJ_PLACE_RULE = "MajorPlace"; public final static String CAPITAL = "MajorPlace.Captial"; public final static String ADMIN = "MajorPlace.Admin"; public final static String POP = "MajorPlace.Population"; private Map<String, Integer> popStats = null; private static final int GEOHASH_RESOLUTION = 5; private static final int POP_MIN = 60000; /** * Major Place assigns a score to places that are national capitals, provinces, or cities with sizable population. * Log(population) adds up to one point to place weight. Population data is indexed by location/grid using geohash. * Source:geonames.org * * @param populationStats * optional population stats. */ public MajorPlaceRule(Map<String, Integer> populationStats) { NAME = MAJ_PLACE_RULE; weight = 2; popStats = populationStats; } /** * Determine if this rule was applied to the candidate. * * @param pc * @return */ public static boolean isRuleFor(PlaceCandidate pc) { if (pc.hasRule(ADMIN) || pc.hasRule(POP) || pc.hasRule(CAPITAL)) { return true; } return false; } /** * attach either a Capital or Admin region ID, giving it some weight based on various properties or context. */ @Override public void evaluate(final PlaceCandidate name, final Place geo) { PlaceEvidence ev = null; if (geo.isNationalCapital()) { // IFF no countries are mentioned, Capitals are good proxies for country. inferCountry(geo); ev = new PlaceEvidence(geo, CAPITAL, weight(weight + 2, geo)); } else if (geo.isAdmin1()) { ev = new PlaceEvidence(geo, ADMIN, weight(weight, geo)); inferBoundary(geo); } else if (popStats != null && geo.isPopulated()) { String gh = geohash(geo); geo.setGeohash(gh); String prefix = gh.substring(0, GEOHASH_RESOLUTION); if (popStats.containsKey(prefix)) { int pop = popStats.get(prefix); if (pop > POP_MIN) { geo.setPopulation(pop); // // Natural log gives a better, slower curve for population weights. // ln(POP_MIN=25000) = 10.1 // // ln(22,000) = 0.0 wt=0 e^10 = 22,000 // ln(60,000) = 11.x wt=1 // ln(165,000) = 12.x wt=2 // ln(444,000) = 13.x wt=3 // Etc. // And to make scale even more gradual, wt - 1 or wt/2, wt/3 // These population stats cannot overtake all other rules entirely. // int wt = (int) ((Math.log(geo.getPopulation()) - 10)) / 3; ev = new PlaceEvidence(geo, POP, weight(wt, geo)); } } } if (ev != null) { ev.setEvaluated(true); name.addEvidence(ev); name.incrementPlaceScore(geo, ev.getWeight() * 0.1); } } /** * Infer the country if a major place is a capital and no other countries have been found yet. * * @param capital */ public void inferCountry(final Place capital) { if (this.countryObserver == null) { return; } if (countryObserver.countryCount() == 0) { this.countryObserver.countryInScope(capital.getCountryCode()); } } public void inferBoundary(final Place prov) { if (this.boundaryObserver != null) { this.boundaryObserver.boundaryLevel1InScope(prov); } } /** * * @param g * @return */ private int weight(final int wt, final Place g) { int adjusted = wt; if (this.countryObserver != null) { if (this.countryObserver.countryObserved(g.getCountryCode())) { ++adjusted; } } return adjusted; } }
3e0309207af8f46ddc4fd1e67fac095cd1edd468
3,668
java
Java
objectModel/Java/objectmodel/src/test/java/com/microsoft/commondatamodel/objectmodel/cdm/cdmcollection/CdmImportCollectionTest.java
aaron-emde/CDM
9472e9c7694821ac4a9bbe608557d2e65aabc73e
[ "CC-BY-4.0", "MIT" ]
null
null
null
objectModel/Java/objectmodel/src/test/java/com/microsoft/commondatamodel/objectmodel/cdm/cdmcollection/CdmImportCollectionTest.java
aaron-emde/CDM
9472e9c7694821ac4a9bbe608557d2e65aabc73e
[ "CC-BY-4.0", "MIT" ]
3
2021-05-11T23:57:12.000Z
2021-08-04T05:03:05.000Z
objectModel/Java/objectmodel/src/test/java/com/microsoft/commondatamodel/objectmodel/cdm/cdmcollection/CdmImportCollectionTest.java
aaron-emde/CDM
9472e9c7694821ac4a9bbe608557d2e65aabc73e
[ "CC-BY-4.0", "MIT" ]
null
null
null
44.192771
90
0.742912
1,252
package com.microsoft.commondatamodel.objectmodel.cdm.cdmcollection; import com.microsoft.commondatamodel.objectmodel.cdm.CdmImport; import com.microsoft.commondatamodel.objectmodel.cdm.CdmManifestDefinition; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.testng.Assert; import org.testng.annotations.Test; public class CdmImportCollectionTest { @Test public void testCdmImportCollectionAdd() { final CdmManifestDefinition document = CdmCollectionHelperFunctions.generateManifest("C:/Nothing"); document.setDirty(false); Assert.assertFalse(document.isDirty()); final CdmImport cdmImport = new CdmImport(document.getCtx(), "corpusPath", "moniker"); final CdmImport addedImport = document.getImports().add(cdmImport); Assert.assertTrue(document.isDirty()); Assert.assertEquals(1, document.getImports().getCount()); Assert.assertEquals(cdmImport, addedImport); Assert.assertEquals(cdmImport, document.getImports().get(0)); Assert.assertEquals("corpusPath", cdmImport.getCorpusPath()); Assert.assertEquals("moniker", cdmImport.getMoniker()); Assert.assertEquals(document.getCtx(), cdmImport.getCtx()); } @Test public void testCdmImportCollectionAddCorpusPath() { final CdmManifestDefinition document = CdmCollectionHelperFunctions.generateManifest("C:/Nothing"); document.setDirty(false); final CdmImport cdmImport = document.getImports().add("corpusPath"); Assert.assertTrue(document.isDirty()); Assert.assertEquals(1, document.getImports().getCount()); Assert.assertEquals(cdmImport, document.getImports().get(0)); Assert.assertEquals("corpusPath", cdmImport.getCorpusPath()); Assert.assertNull(cdmImport.getMoniker()); Assert.assertEquals(document.getCtx(), cdmImport.getCtx()); } @Test public void testCdmImportCollectionAddCorpusPathAndMoniker() { final CdmManifestDefinition document = CdmCollectionHelperFunctions.generateManifest("C:/Nothing"); document.setDirty(false); final CdmImport cdmImport = document.getImports().add("corpusPath", "moniker"); Assert.assertTrue(document.isDirty()); Assert.assertEquals(1, document.getImports().getCount()); Assert.assertEquals(cdmImport, document.getImports().get(0)); Assert.assertEquals("corpusPath", cdmImport.getCorpusPath()); Assert.assertEquals("moniker", cdmImport.getMoniker()); Assert.assertEquals(document.getCtx(), cdmImport.getCtx()); } @Test public void testCdmImportCollectionAddRange() { final CdmManifestDefinition document = CdmCollectionHelperFunctions.generateManifest("C:/Nothing"); document.setDirty(false); final List<CdmImport> importList = new ArrayList<>(Arrays.asList( new CdmImport(document.getCtx(), "CorpusPath1", "Moniker1"), new CdmImport(document.getCtx(), "CorpusPath2", "Moniker2"))); document.getImports().addAll(importList); Assert.assertTrue(document.isDirty()); Assert.assertEquals(2, document.getImports().getCount()); Assert.assertEquals(importList.get(0), document.getImports().get(0)); Assert.assertEquals(importList.get(1), document.getImports().get(1)); Assert.assertEquals("CorpusPath1", importList.get(0).getCorpusPath()); Assert.assertEquals("Moniker1", importList.get(0).getMoniker()); Assert.assertEquals(document.getCtx(), importList.get(0).getCtx()); Assert.assertEquals("CorpusPath2", importList.get(1).getCorpusPath()); Assert.assertEquals("Moniker2", importList.get(1).getMoniker()); Assert.assertEquals(document.getCtx(), importList.get(1).getCtx()); } }
3e0309ef3399faec06059bb13ad41171684c30c1
2,848
java
Java
jonix-onix3/src/main/java/com/tectonica/jonix/onix3/MainSubject.java
prafullkotecha/on.x
0544feb4b1ac8fd7dfd52e34e3f84d46eae5749e
[ "Apache-2.0" ]
null
null
null
jonix-onix3/src/main/java/com/tectonica/jonix/onix3/MainSubject.java
prafullkotecha/on.x
0544feb4b1ac8fd7dfd52e34e3f84d46eae5749e
[ "Apache-2.0" ]
null
null
null
jonix-onix3/src/main/java/com/tectonica/jonix/onix3/MainSubject.java
prafullkotecha/on.x
0544feb4b1ac8fd7dfd52e34e3f84d46eae5749e
[ "Apache-2.0" ]
null
null
null
29.391753
119
0.622238
1,253
/* * Copyright (C) 2012 Zach Melamed * * Latest version available online at https://github.com/zach-m/jonix * Contact me at [email protected] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tectonica.jonix.onix3; import java.io.Serializable; import com.tectonica.jonix.JPU; import com.tectonica.jonix.OnixFlag; import com.tectonica.jonix.codelist.RecordSourceTypes; /* * NOTE: THIS IS AN AUTO-GENERATED FILE, DON'T EDIT MANUALLY */ /** * <h1>Main subject flag</h1> * <p> * An empty element that identifies an instance of the &lt;Subject&gt; composite as representing the main subject * category for the product. The main category may be expressed in more than one subject scheme, <i>ie</i> there may be * two or more instances of the &lt;Subject&gt; composite, using different schemes, each carrying the * &lt;MainSubject/&gt; flag. Optional and non-repeating in each occurrence of the &lt;Subject&gt; composite. * </p> * <table border='1' cellpadding='3'> * <tr> * <td>Format</td> * <td>XML empty element</td> * </tr> * <tr> * <td>Reference name</td> * <td>&lt;MainSubject&gt;</td> * </tr> * <tr> * <td>Short tag</td> * <td>&lt;x425&gt;</td> * </tr> * <tr> * <td>Cardinality</td> * <td>0&#8230;1</td> * </tr> * <tr> * <td>Example</td> * <td>&lt;MainSubject/&gt;</td> * </tr> * </table> */ public class MainSubject implements OnixFlag, Serializable { private static final long serialVersionUID = 1L; public static final String refname = "MainSubject"; public static final String shortname = "x425"; // /////////////////////////////////////////////////////////////////////////////// // ATTRIBUTES // /////////////////////////////////////////////////////////////////////////////// /** * (type: dt.DateOrDateTime) */ public String datestamp; public RecordSourceTypes sourcetype; public String sourcename; // /////////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS // /////////////////////////////////////////////////////////////////////////////// public MainSubject() {} public MainSubject(org.w3c.dom.Element element) { datestamp = JPU.getAttribute(element, "datestamp"); sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype")); sourcename = JPU.getAttribute(element, "sourcename"); } }
3e030a1e8e6c94e97792d36398ee908d049e8dae
1,670
java
Java
CO2/employee.java
TKM-MCA-2020-OOPS-LAB/20MCA201-ABHILASH_JOHN-OOPS-LAB
7355a70c60be2b5f1c927813a7a74e222fd7cffa
[ "MIT" ]
null
null
null
CO2/employee.java
TKM-MCA-2020-OOPS-LAB/20MCA201-ABHILASH_JOHN-OOPS-LAB
7355a70c60be2b5f1c927813a7a74e222fd7cffa
[ "MIT" ]
null
null
null
CO2/employee.java
TKM-MCA-2020-OOPS-LAB/20MCA201-ABHILASH_JOHN-OOPS-LAB
7355a70c60be2b5f1c927813a7a74e222fd7cffa
[ "MIT" ]
1
2021-05-27T16:18:22.000Z
2021-05-27T16:18:22.000Z
32.745098
105
0.579042
1,254
import java.util.Scanner; // Program to create a class for Employee having attributes eNo, eName, eSalary. // Read n employ information and Search for an employee given eNo, using the concept of Array of Objects. import java.util.Scanner; public class employee { int eNo; String eName; double eSalary; public void getdetails(){ System.out.println("\nEnter the Employee details"); Scanner sc = new Scanner(System.in); System.out.println("Employee number : "); eNo=sc.nextInt(); System.out.println("Name : "); sc.nextLine(); eName=sc.nextLine(); System.out.println("Salary : "); eSalary=sc.nextDouble(); } void display(){ System.out.println("Empolyee No :"+eNo); System.out.println("Name :"+eName); System.out.println("Salary Amount"+eSalary+"\n"); } public static void main(String[] args) { System.out.println("\nEnter the No. of Employee's"); Scanner sc1 = new Scanner(System.in); int num = sc1.nextInt(); employee arr[]=new employee[num]; for(int i =0;i<num;i++){ arr[i]=new employee(); arr[i].getdetails(); } System.out.println("\nInformations of all the employee's"); for(int i=0;i<num;i++){ arr[i].display(); } boolean state = false; System.out.println("\nEnter the Employee Number to get details of a employee"); int num2= sc1.nextInt(); for(int i=0;i<num;i++){ if(arr[i].eNo==num2){ System.out.println("\nEmployee details"); arr[i].display(); } } } }
3e030a749a3fcc8b9d157125b5443cc833cef0c6
1,834
java
Java
resources/src/org/webpki/tools/svg/SVGAttributes.java
donnacn/saturn
a4689694deaba4b05dcbaefc677b75514dbdcd09
[ "Apache-2.0" ]
14
2016-04-15T12:52:30.000Z
2022-03-06T05:57:24.000Z
resources/src/org/webpki/tools/svg/SVGAttributes.java
donnacn/saturn
a4689694deaba4b05dcbaefc677b75514dbdcd09
[ "Apache-2.0" ]
10
2017-08-19T16:56:23.000Z
2020-08-13T06:09:49.000Z
resources/src/org/webpki/tools/svg/SVGAttributes.java
donnacn/saturn
a4689694deaba4b05dcbaefc677b75514dbdcd09
[ "Apache-2.0" ]
3
2017-04-12T14:06:56.000Z
2021-06-04T10:52:56.000Z
29.111111
76
0.543075
1,255
/* * Copyright 2015-2020 WebPKI.org (http://webpki.org). * * 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 * * https://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.webpki.tools.svg; public enum SVGAttributes { X ("x"), Y ("y"), X1 ("x1"), X2 ("x2"), Y1 ("y1"), Y2 ("y2"), RX ("rx"), RY ("ry"), DY ("dy"), CX ("cx"), CY ("cy"), R ("r"), D ("d"), STROKE_LINECAP ("stroke-linecap"), STROKE_WIDTH ("stroke-width"), STROKE_DASHES ("stroke-dasharray"), STROKE_OPACITY ("stroke-opacity"), WIDTH ("width"), HEIGHT ("height"), POINTS ("points"), FILTER ("filter"), FILL_COLOR ("fill"), FILL_OPACITY ("fill-opacity"), STROKE_COLOR ("stroke"), FONT_FAMILY ("font-family"), FONT_SIZE ("font-size"), FONT_WEIGHT ("font-weight"), LETTER_SPACING ("letter-spacing"), TRANSFORM ("transform"), TEXT_ANCHOR ("text-anchor"); String svgNotation; SVGAttributes(String svgNotation) { this.svgNotation = svgNotation; } @Override public String toString() { return svgNotation; } }
3e030b2b84af537544eaa64e96b1e279ae2b6890
1,090
java
Java
src/main/java/com/roylaurie/subcomm/client/message/SubcommNoOpMessage.java
Ye-Olde-Repository/subcomm
0caf1ee2467bd1940fb9f967a65974b3d4d3ddad
[ "BSD-3-Clause" ]
null
null
null
src/main/java/com/roylaurie/subcomm/client/message/SubcommNoOpMessage.java
Ye-Olde-Repository/subcomm
0caf1ee2467bd1940fb9f967a65974b3d4d3ddad
[ "BSD-3-Clause" ]
null
null
null
src/main/java/com/roylaurie/subcomm/client/message/SubcommNoOpMessage.java
Ye-Olde-Repository/subcomm
0caf1ee2467bd1940fb9f967a65974b3d4d3ddad
[ "BSD-3-Clause" ]
1
2019-04-23T03:33:22.000Z
2019-04-23T03:33:22.000Z
30.277778
81
0.706422
1,257
package com.roylaurie.subcomm.client.message; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.roylaurie.subcomm.client.SubcommMessage; public final class SubcommNoOpMessage extends SubcommMessage { private static final String NETCHAT_PREFIX = "NOOP"; private static final Pattern NETCHAT_PATTERN = Pattern.compile( "^" + NETCHAT_PREFIX + "$" ); /** * Creates a message object from a single raw netchat message. * @param String netchatMessage * @return SubcommLoginOkMessage NULL if the expected pattern doesn't match. * @throws IllegalArgumentException If the parameter values are unsupported */ public static SubcommNoOpMessage parseNetchatMessage(String netchatMessage) { Matcher matcher = NETCHAT_PATTERN.matcher(netchatMessage); if (!matcher.find()) return null; return new SubcommNoOpMessage(); } public SubcommNoOpMessage() { super(NETCHAT_PREFIX); } @Override public String getNetchatMessage() { return NETCHAT_PREFIX; } }
3e030b5966ddc7855cfe608211c8dec82d6cd852
2,670
java
Java
container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java
gerwinjansen/tomee
4763c8131acffbc7f212d4944d9dea044ab14375
[ "Apache-2.0" ]
378
2015-01-14T09:51:24.000Z
2022-03-26T05:26:01.000Z
container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java
gerwinjansen/tomee
4763c8131acffbc7f212d4944d9dea044ab14375
[ "Apache-2.0" ]
393
2015-11-16T08:44:15.000Z
2022-03-31T07:05:40.000Z
container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/Multiplicity$JAXB.java
gerwinjansen/tomee
4763c8131acffbc7f212d4944d9dea044ab14375
[ "Apache-2.0" ]
767
2015-01-02T19:38:49.000Z
2022-03-28T16:59:10.000Z
39.264706
155
0.704494
1,258
/* * 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.openejb.jee; import org.metatype.sxc.jaxb.JAXBEnum; import org.metatype.sxc.jaxb.RuntimeContext; import org.metatype.sxc.util.XoXMLStreamReader; import javax.xml.namespace.QName; public class Multiplicity$JAXB extends JAXBEnum<Multiplicity> { public Multiplicity$JAXB() { super(Multiplicity.class, null, new QName("http://java.sun.com/xml/ns/javaee".intern(), "multiplicity".intern())); } public Multiplicity parse(final XoXMLStreamReader reader, final RuntimeContext context, final String value) throws Exception { return parseMultiplicity(reader, context, value); } public String toString(final Object bean, final String parameterName, final RuntimeContext context, final Multiplicity multiplicity) throws Exception { return toStringMultiplicity(bean, parameterName, context, multiplicity); } public static Multiplicity parseMultiplicity(final XoXMLStreamReader reader, final RuntimeContext context, final String value) throws Exception { if ("One".equals(value)) { return Multiplicity.ONE; } else if ("Many".equals(value)) { return Multiplicity.MANY; } else { context.unexpectedEnumValue(reader, Multiplicity.class, value, "One", "Many"); return null; } } public static String toStringMultiplicity(final Object bean, final String parameterName, final RuntimeContext context, final Multiplicity multiplicity) throws Exception { if (Multiplicity.ONE == multiplicity) { return "One"; } else if (Multiplicity.MANY == multiplicity) { return "Many"; } else { context.unexpectedEnumConst(bean, parameterName, multiplicity, Multiplicity.ONE, Multiplicity.MANY); return null; } } }
3e030b911a641cfb14dd24e81dd8ca5932c7fdf2
3,512
java
Java
chapter_02/src/test/java/ru/job4j/tracker/TrackerTest.java
Ajderka/job4j
6b1469be968c0104aa78f1d6061b679b5f3fe779
[ "Apache-2.0" ]
null
null
null
chapter_02/src/test/java/ru/job4j/tracker/TrackerTest.java
Ajderka/job4j
6b1469be968c0104aa78f1d6061b679b5f3fe779
[ "Apache-2.0" ]
3
2021-02-03T19:37:10.000Z
2021-12-18T18:29:53.000Z
chapter_02/src/test/java/ru/job4j/tracker/TrackerTest.java
Ajderka/job4j
6b1469be968c0104aa78f1d6061b679b5f3fe779
[ "Apache-2.0" ]
1
2019-09-14T11:14:34.000Z
2019-09-14T11:14:34.000Z
32.841121
74
0.615822
1,259
package ru.job4j.tracker; import org.junit.Test; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; /** * Test. * * @author Ayder Khayredinov ([email protected]). * @version 1. * @since 03.01.2019. */ public class TrackerTest { /** * Test проверяющий добавление ячейки в массив. */ @Test public void whenAddNewItemThenTrackerHasSameItem() { Tracker tracker = new Tracker(); Item item = new Item("test", "testDescription", 123L); assertThat(tracker.add(item), is(item)); assertThat(tracker.findAll().get(0), is(item)); } /** * Test проверяющий поиск ячейки по имени. */ @Test public void whenFindByNameThenTrackerShowFoundItem() { Tracker tracker = new Tracker(); Item item = new Item("test", "testDescription", 123L); tracker.add(item); Item item1 = new Item("test1", "testDescription1", 1231L); tracker.add(item1); Item item2 = new Item("test2", "testDescription2", 1232L); tracker.add(item2); assertThat(tracker.findByName(item1.getName()).get(0), is(item1)); } /** * Test проверяющий ячейки которые были добавлены, показывает их. */ @Test public void whenFindAllThenTrackerShowAllFoundItem() { Tracker tracker = new Tracker(); Item item = new Item("test", "testDescription", 123L); tracker.add(item); Item item1 = new Item("test1", "testDescription1", 1231L); tracker.add(item1); Item item2 = new Item("test2", "testDescription2", 1232L); tracker.add(item2); assertThat(tracker.findAll().get(0), is(item)); assertThat(tracker.findAll().get(1), is(item1)); assertThat(tracker.findAll().get(2), is(item2)); } /** * Test проверяющий поиск ячейки по Id. */ @Test public void whenFindByIdThenTrackerShowFoundItem() { Tracker tracker = new Tracker(); Item item = new Item("test", "testDescription", 123L); tracker.add(item); Item item1 = new Item("test1", "testDescription1", 1231L); tracker.add(item1); Item item2 = new Item("test2", "testDescription2", 1232L); tracker.add(item2); assertThat(tracker.findById(item1.getId()), is(item1)); } /** * Test проверяющий удаление ячейки. */ @Test public void whenDeleteItemThenTrackerHasNotSameItem() { Tracker tracker = new Tracker(); Item item = new Item("test", "testDescription", 123L); tracker.add(item); Item item1 = new Item("test1", "testDescription1", 1231L); tracker.add(item1); Item item2 = new Item("test2", "testDescription2", 1232L); tracker.add(item2); assertThat(tracker.delete(item1.getId()), is(true)); assertThat(tracker.findAll().get(0), is(item)); assertThat(tracker.findAll().get(1), is(item2)); } /** * Test проверяющий замену ячейки. */ @Test public void whenReplaceNameThenReturnNewName() { Tracker tracker = new Tracker(); Item previous = new Item("test1", "testDescription", 123L); tracker.add(previous); Item next = new Item("test2", "testDescription2", 1234L); next.setId(previous.getId()); tracker.replace(previous.getId(), next); assertThat(tracker.findById(previous.getId()), is(next)); assertThat(tracker.replace(previous.getId(), next), is(true)); } }
3e030bf1579b1d7595b780be0fbd112d1cff3e78
4,076
java
Java
src/main/java/org/redkalex/pay/PayNotifyRequest.java
wentch/redkale-plugins
637f3d3688143ba8b9ea44396697fcba995d33a9
[ "Apache-2.0" ]
1
2015-12-25T06:50:11.000Z
2015-12-25T06:50:11.000Z
src/main/java/org/redkalex/pay/PayNotifyRequest.java
wentch/redkale-plugins
637f3d3688143ba8b9ea44396697fcba995d33a9
[ "Apache-2.0" ]
null
null
null
src/main/java/org/redkalex/pay/PayNotifyRequest.java
wentch/redkale-plugins
637f3d3688143ba8b9ea44396697fcba995d33a9
[ "Apache-2.0" ]
null
null
null
25.961783
167
0.599117
1,260
/* * 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 org.redkalex.pay; import java.util.*; import org.redkale.convert.ConvertDisabled; import org.redkale.convert.json.JsonFactory; /** * * 详情见: https://redkale.org * * @author zhangjx */ public class PayNotifyRequest { protected String appid = ""; //APP账号ID protected short payType; //支付类型; protected String body; protected Map<String, String> headers; protected Map<String, String> attach; public PayNotifyRequest() { } public PayNotifyRequest(short paytype, String body) { this.payType = paytype; this.body = body; } public PayNotifyRequest(short paytype, Map<String, String> attach) { this.payType = paytype; this.attach = attach; } public PayNotifyRequest(short paytype) { this.payType = paytype; } public PayNotifyRequest(String appid, short paytype) { this.appid = appid; this.payType = paytype; } public PayNotifyRequest headers(Map<String, String> headers) { this.headers = headers; return this; } public PayNotifyRequest attachByRemoveEmptyValue(Map<String, String> params) { final TreeMap<String, String> map = new TreeMap<>(params); List<String> emptyKeys = new ArrayList<>(); for (Map.Entry<String, String> en : map.entrySet()) { //去掉空值的参数 if (en.getValue().isEmpty()) emptyKeys.add(en.getKey()); } emptyKeys.forEach(x -> map.remove(x)); this.attach = map; return this; } public void checkVaild() { if (this.payType < 1) throw new RuntimeException("payType is illegal"); if (this.payType == Pays.PAYTYPE_ALIPAY && (this.appid == null || this.appid.isEmpty())) throw new RuntimeException("appid is illegal"); if ((this.body == null || this.body.isEmpty()) && (this.attach == null || this.attach.isEmpty())) throw new RuntimeException("text and attach both is empty"); } public PayNotifyRequest addAttach(String key, Object value) { if (this.attach == null) this.attach = new TreeMap<>(); this.attach.put(key, String.valueOf(value)); return this; } public String attach(String name) { return attach == null ? null : attach.get(name); } public String attach(String name, String defValue) { return attach == null ? defValue : attach.getOrDefault(name, defValue); } public String getAppid() { return appid; } public void setAppid(String appid) { this.appid = appid; } public short getPayType() { return payType; } public void setPayType(short payType) { this.payType = payType; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public Map<String, String> getAttach() { return attach; } public void setAttach(Map<String, String> attach) { this.attach = attach; } public Map<String, String> getHeaders() { return headers; } public void setHeaders(Map<String, String> headers) { this.headers = headers; } @Override public String toString() { return JsonFactory.root().getConvert().convertTo(this); } @Deprecated @ConvertDisabled public short getPaytype() { return payType; } @Deprecated @ConvertDisabled public void setPaytype(short payType) { this.payType = payType; } @Deprecated @ConvertDisabled public Map<String, String> getMap() { return attach; } @Deprecated @ConvertDisabled public void setMap(Map<String, String> map) { this.attach = map; } }
3e030cda90a36e91cfe9e3541a8950383c41cc49
1,489
java
Java
raider-core/src/test/java/com/kg/raider/RaiderTest.java
kavehg/raider
0db578901f800bd1354096778aaae7e450da20f5
[ "Apache-2.0" ]
1
2016-03-21T22:53:38.000Z
2016-03-21T22:53:38.000Z
raider-core/src/test/java/com/kg/raider/RaiderTest.java
kavehg/raider
0db578901f800bd1354096778aaae7e450da20f5
[ "Apache-2.0" ]
5
2019-03-12T17:26:08.000Z
2019-03-14T19:00:40.000Z
raider-core/src/test/java/com/kg/raider/RaiderTest.java
kavehg/raider
0db578901f800bd1354096778aaae7e450da20f5
[ "Apache-2.0" ]
null
null
null
26.122807
63
0.571525
1,261
package com.kg.raider; import com.kg.raider.pb.MetricPB; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.zeromq.ZContext; import org.zeromq.ZMQ; /** * User: kaveh * Date: 8/9/13 * Time: 10:09 PM */ public class RaiderTest { @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void testSending() throws Exception { ZContext context = new ZContext(); ZMQ.Socket sendSocket = context.createSocket(ZMQ.PUSH); sendSocket.connect("tcp://localhost:9999"); // give time to connect Thread.sleep(5000); long start = System.nanoTime(); for(int i = 0; i < 100000; i++) { MetricPB metricToReport = MetricPB.newBuilder() .setKey("test.metric." + i) .setTimestamp(System.nanoTime()) .setValue(1.93f + i) .build(); sendSocket.send(metricToReport.toByteArray(), 0); } MetricPB metricToReport = MetricPB.newBuilder() .setKey("test.metric.FINISHED") .setTimestamp(System.nanoTime()) .setValue(1.93f) .build(); sendSocket.send(metricToReport.toByteArray(), 0); long elapsed = System.nanoTime() - start; float sec = elapsed / 1000000000.0f; System.out.println("Done. [" + sec + " sec]"); } }
3e030cec7257ea5fee65e65a529d33ece5fb2841
3,406
java
Java
src/main/java/io/swagger/model/AvailableShippingMethod.java
yusong-shen/ecommerce-checkout-api-server
9c472c4971389f57e0b4ec0f716d6f56eaa6647f
[ "Apache-2.0" ]
2
2017-04-27T18:49:15.000Z
2020-08-03T15:26:29.000Z
src/main/java/io/swagger/model/AvailableShippingMethod.java
yusong-shen/ecommerce-checkout-api-server
9c472c4971389f57e0b4ec0f716d6f56eaa6647f
[ "Apache-2.0" ]
null
null
null
src/main/java/io/swagger/model/AvailableShippingMethod.java
yusong-shen/ecommerce-checkout-api-server
9c472c4971389f57e0b4ec0f716d6f56eaa6647f
[ "Apache-2.0" ]
null
null
null
23.489655
122
0.66559
1,262
package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** * AvailableShippingMethod */ @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2017-04-21T21:14:37.723Z") public class AvailableShippingMethod { @JsonProperty("code") private String code = null; @JsonProperty("name") private String name = null; @JsonProperty("amount") private String amount = null; @JsonProperty("delivery_date") private String deliveryDate = null; public AvailableShippingMethod code(String code) { this.code = code; return this; } /** * Get code * @return code **/ @ApiModelProperty(value = "") public String getCode() { return code; } public void setCode(String code) { this.code = code; } public AvailableShippingMethod name(String name) { this.name = name; return this; } /** * Get name * @return name **/ @ApiModelProperty(value = "") public String getName() { return name; } public void setName(String name) { this.name = name; } public AvailableShippingMethod amount(String amount) { this.amount = amount; return this; } /** * Get amount * @return amount **/ @ApiModelProperty(value = "") public String getAmount() { return amount; } public void setAmount(String amount) { this.amount = amount; } public AvailableShippingMethod deliveryDate(String deliveryDate) { this.deliveryDate = deliveryDate; return this; } /** * Get deliveryDate * @return deliveryDate **/ @ApiModelProperty(value = "") public String getDeliveryDate() { return deliveryDate; } public void setDeliveryDate(String deliveryDate) { this.deliveryDate = deliveryDate; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AvailableShippingMethod availableShippingMethod = (AvailableShippingMethod) o; return Objects.equals(this.code, availableShippingMethod.code) && Objects.equals(this.name, availableShippingMethod.name) && Objects.equals(this.amount, availableShippingMethod.amount) && Objects.equals(this.deliveryDate, availableShippingMethod.deliveryDate); } @Override public int hashCode() { return Objects.hash(code, name, amount, deliveryDate); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AvailableShippingMethod {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" deliveryDate: ").append(toIndentedString(deliveryDate)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
3e030e13b734201f9e5c1bc99b3a082de801b805
1,333
java
Java
src/test/java/com/leetcode/strings/easy/FindFirstPalindromicStringInTheArray_2108Test.java
Nalhin/Leetcode
1ab17f073c35f6d5babf6d0dd2a89dd248e599c8
[ "MIT" ]
1
2021-01-10T10:56:31.000Z
2021-01-10T10:56:31.000Z
src/test/java/com/leetcode/strings/easy/FindFirstPalindromicStringInTheArray_2108Test.java
Nalhin/Leetcode
1ab17f073c35f6d5babf6d0dd2a89dd248e599c8
[ "MIT" ]
null
null
null
src/test/java/com/leetcode/strings/easy/FindFirstPalindromicStringInTheArray_2108Test.java
Nalhin/Leetcode
1ab17f073c35f6d5babf6d0dd2a89dd248e599c8
[ "MIT" ]
1
2020-12-19T11:52:20.000Z
2020-12-19T11:52:20.000Z
37.027778
83
0.766692
1,263
package com.leetcode.strings.easy; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.params.provider.Arguments.arguments; class FindFirstPalindromicStringInTheArray_2108Test { private final FindFirstPalindromicStringInTheArray_2108 solution = new FindFirstPalindromicStringInTheArray_2108(); private static class TestArgumentsProvider implements ArgumentsProvider { @Override public Stream<? extends Arguments> provideArguments(ExtensionContext context) { return Stream.of( arguments(new String[] {"abc", "car", "ada", "racecar", "cool"}, "ada"), arguments(new String[] {"notapalindrome", "racecar"}, "racecar"), arguments(new String[] {"def", "ghi"}, "")); } } @ParameterizedTest @ArgumentsSource(TestArgumentsProvider.class) void firstPalindrome(String[] words, String expectedResult) { String actualResult = solution.firstPalindrome(words); assertThat(actualResult).isEqualTo(expectedResult); } }
3e030e67e6d50b6aa779f8dc0deae8671d795da8
2,179
java
Java
sdk/src/main/java/com/meniga/sdk/models/offers/reimbursementaccounts/operators/MenigaReimbursementAccountOperationsImp.java
meniga/mobile-sdk-android
c1254e002c53c319dc18dcc3c6aaadea13547ffd
[ "MIT" ]
4
2017-04-12T08:51:05.000Z
2021-01-06T09:06:46.000Z
sdk/src/main/java/com/meniga/sdk/models/offers/reimbursementaccounts/operators/MenigaReimbursementAccountOperationsImp.java
meniga/mobile-sdk-android
c1254e002c53c319dc18dcc3c6aaadea13547ffd
[ "MIT" ]
90
2017-12-19T15:53:59.000Z
2022-03-14T08:12:49.000Z
sdk/src/main/java/com/meniga/sdk/models/offers/reimbursementaccounts/operators/MenigaReimbursementAccountOperationsImp.java
meniga/mobile-sdk-android
c1254e002c53c319dc18dcc3c6aaadea13547ffd
[ "MIT" ]
1
2017-12-19T08:06:46.000Z
2017-12-19T08:06:46.000Z
40.351852
132
0.835704
1,264
package com.meniga.sdk.models.offers.reimbursementaccounts.operators; import com.google.gson.Gson; import com.meniga.sdk.MenigaSDK; import com.meniga.sdk.helpers.Result; import com.meniga.sdk.models.offers.reimbursementaccounts.MenigaOfferAccountInfo; import com.meniga.sdk.models.offers.reimbursementaccounts.MenigaReimbursementAccount; import com.meniga.sdk.models.offers.reimbursementaccounts.MenigaReimbursementAccountPage; import com.meniga.sdk.models.offers.reimbursementaccounts.MenigaReimbursementAccountTypePage; import com.meniga.sdk.webservices.requests.CreateReimbursementAccount; import com.meniga.sdk.webservices.requests.GetReimbursementAccountById; import com.meniga.sdk.webservices.requests.GetReimbursementAccountTypes; import com.meniga.sdk.webservices.requests.GetReimbursementAccounts; /** * Copyright 2017 Meniga Iceland Inc. */ public class MenigaReimbursementAccountOperationsImp implements MenigaReimbursementAccountOperations { @Override public Result<MenigaReimbursementAccount> createOfferAccount(String name, String accountType, MenigaOfferAccountInfo accountInfo) { CreateReimbursementAccount req = new CreateReimbursementAccount(); Gson gson = new Gson(); req.name = name; req.accountType = accountType; req.accountInfo = gson.toJson(accountInfo); return MenigaSDK.executor().addReimbursementAccount(req); } @Override public Result<MenigaReimbursementAccountPage> getReimbursementAccounts(Boolean includeInactive) { GetReimbursementAccounts req = new GetReimbursementAccounts(); req.includeInactive = includeInactive; return MenigaSDK.executor().getReimbursementAccounts(req); } @Override public Result<MenigaReimbursementAccountTypePage> getReimbursementAccountTypes(Integer skip, Integer take) { GetReimbursementAccountTypes req = new GetReimbursementAccountTypes(); req.skip = skip; req.take = take; return MenigaSDK.executor().getReimbursementAccountTypes(req); } @Override public Result<MenigaReimbursementAccount> getReimbursementAccountById(int id) { GetReimbursementAccountById req = new GetReimbursementAccountById(id); return MenigaSDK.executor().getReimbursementAccountById(req); } }
3e030f1773238ecd1b6516ce947e2397ae843ebd
312
java
Java
testUtil/src/main/java/ucar/unidata/util/test/category/NeedsCdmUnitTest.java
c3iotai/thredds
dc56350d868d62f4757933e1bb6ff87595a151d1
[ "BSD-3-Clause" ]
83
2019-07-04T13:40:24.000Z
2022-03-03T02:25:16.000Z
testUtil/src/main/java/ucar/unidata/util/test/category/NeedsCdmUnitTest.java
c3iotai/thredds
dc56350d868d62f4757933e1bb6ff87595a151d1
[ "BSD-3-Clause" ]
655
2019-06-28T15:08:16.000Z
2022-03-29T17:12:46.000Z
testUtil/src/main/java/ucar/unidata/util/test/category/NeedsCdmUnitTest.java
c3iotai/thredds
dc56350d868d62f4757933e1bb6ff87595a151d1
[ "BSD-3-Clause" ]
87
2019-07-03T18:17:49.000Z
2022-03-30T01:53:16.000Z
26
112
0.75641
1,266
package ucar.unidata.util.test.category; /** * A marker to be used with JUnit categories to indicate that a test method or test class requires access to the * cdmUnitTest shared directory in order to complete successfully. * * @author cwardgar * @since 2015/03/06 */ public interface NeedsCdmUnitTest { }
3e030f6b81468d18a9deff2d2dab7fa2350b9a95
954
java
Java
Mage.Sets/src/mage/cards/f/FarbogRevenant.java
FateRevoked/mage
90418ddafda100a3b4e57597aad31af5428d7116
[ "MIT" ]
2
2020-04-04T22:36:47.000Z
2020-04-04T22:57:35.000Z
Mage.Sets/src/mage/cards/f/FarbogRevenant.java
FateRevoked/mage
90418ddafda100a3b4e57597aad31af5428d7116
[ "MIT" ]
43
2020-07-27T06:53:24.000Z
2022-03-28T23:03:21.000Z
Mage.Sets/src/mage/cards/f/FarbogRevenant.java
FateRevoked/mage
90418ddafda100a3b4e57597aad31af5428d7116
[ "MIT" ]
3
2018-07-26T19:00:47.000Z
2020-04-30T23:12:14.000Z
23.268293
74
0.685535
1,267
package mage.cards.f; import java.util.UUID; import mage.MageInt; import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.SkulkAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; /** * * @author fireshoes */ public final class FarbogRevenant extends CardImpl { public FarbogRevenant(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); this.subtype.add(SubType.SPIRIT); this.power = new MageInt(1); this.toughness = new MageInt(3); // Skulk this.addAbility(new SkulkAbility()); // Lifelink this.addAbility(LifelinkAbility.getInstance()); } public FarbogRevenant(final FarbogRevenant card) { super(card); } @Override public FarbogRevenant copy() { return new FarbogRevenant(this); } }
3e031079b42be3fc6c7e78eef488bd37d586ebff
814
java
Java
src/main/java/com/g56/controller/menu/ResultMenuController.java
Andrepereira2001/feup-lpoo-2021
7a9c3286f27f0291aa8a23e2883473c61d22ee92
[ "MIT" ]
null
null
null
src/main/java/com/g56/controller/menu/ResultMenuController.java
Andrepereira2001/feup-lpoo-2021
7a9c3286f27f0291aa8a23e2883473c61d22ee92
[ "MIT" ]
null
null
null
src/main/java/com/g56/controller/menu/ResultMenuController.java
Andrepereira2001/feup-lpoo-2021
7a9c3286f27f0291aa8a23e2883473c61d22ee92
[ "MIT" ]
null
null
null
29.071429
123
0.737101
1,268
package com.g56.controller.menu; import com.g56.Game; import com.g56.controller.Controller; import com.g56.gui.GUI; import com.g56.model.game.field.FileFieldBuilder; import com.g56.model.menu.Menu; import com.g56.model.menu.ResultMenu; import com.g56.states.GameState; import com.g56.states.MenuState; import java.awt.*; import java.io.IOException; import java.net.URISyntaxException; public class ResultMenuController extends Controller<ResultMenu> { public ResultMenuController(ResultMenu model) { super(model); } @Override public void step(Game game, GUI.ACTION action, long time) throws IOException, URISyntaxException, FontFormatException { if(action== GUI.ACTION.ENTER || action == GUI.ACTION.QUIT){ game.setState(new MenuState(new Menu())); } } }
3e03108137b7005d21a3ccc62525e61b8d815062
4,434
java
Java
mr/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java
UnimibSoftEngCourse1819/laboratorio-4-esercizio-sonarqube-mahout-claudiom4sir
6267e5d8f6b13136f0c8151ea7e514b9733266ff
[ "Apache-2.0" ]
2,073
2015-01-01T15:35:21.000Z
2022-03-31T06:18:06.000Z
mr/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java
UnimibSoftEngCourse1819/laboratorio-4-esercizio-sonarqube-mahout-claudiom4sir
6267e5d8f6b13136f0c8151ea7e514b9733266ff
[ "Apache-2.0" ]
224
2015-01-01T16:36:19.000Z
2021-01-27T23:22:45.000Z
mr/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java
UnimibSoftEngCourse1819/laboratorio-4-esercizio-sonarqube-mahout-claudiom4sir
6267e5d8f6b13136f0c8151ea7e514b9733266ff
[ "Apache-2.0" ]
1,109
2015-01-01T23:32:26.000Z
2022-03-28T07:27:17.000Z
36.04878
110
0.705683
1,269
/** * 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.mahout.cf.taste.impl.common; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.locks.ReentrantLock; import org.apache.mahout.cf.taste.common.Refreshable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A helper class for implementing {@link Refreshable}. This object is typically included in an implementation * {@link Refreshable} to implement {@link Refreshable#refresh(Collection)}. It execute the class's own * supplied update logic, after updating all the object's dependencies. This also ensures that dependencies * are not updated multiple times. */ public final class RefreshHelper implements Refreshable { private static final Logger log = LoggerFactory.getLogger(RefreshHelper.class); private final List<Refreshable> dependencies; private final ReentrantLock refreshLock; private final Callable<?> refreshRunnable; /** * @param refreshRunnable * encapsulates the containing object's own refresh logic */ public RefreshHelper(Callable<?> refreshRunnable) { this.dependencies = new ArrayList<>(3); this.refreshLock = new ReentrantLock(); this.refreshRunnable = refreshRunnable; } /** Add a dependency to be refreshed first when the encapsulating object does. */ public void addDependency(Refreshable refreshable) { if (refreshable != null) { dependencies.add(refreshable); } } public void removeDependency(Refreshable refreshable) { if (refreshable != null) { dependencies.remove(refreshable); } } /** * Typically this is called in {@link Refreshable#refresh(java.util.Collection)} and is the entire body of * that method. */ @Override public void refresh(Collection<Refreshable> alreadyRefreshed) { if (refreshLock.tryLock()) { try { alreadyRefreshed = buildRefreshed(alreadyRefreshed); for (Refreshable dependency : dependencies) { maybeRefresh(alreadyRefreshed, dependency); } if (refreshRunnable != null) { try { refreshRunnable.call(); } catch (Exception e) { log.warn("Unexpected exception while refreshing", e); } } } finally { refreshLock.unlock(); } } } /** * Creates a new and empty {@link Collection} if the method parameter is {@code null}. * * @param currentAlreadyRefreshed * {@link Refreshable}s to refresh later on * @return an empty {@link Collection} if the method param was {@code null} or the unmodified method * param. */ public static Collection<Refreshable> buildRefreshed(Collection<Refreshable> currentAlreadyRefreshed) { return currentAlreadyRefreshed == null ? new HashSet<Refreshable>(3) : currentAlreadyRefreshed; } /** * Adds the specified {@link Refreshable} to the given collection of {@link Refreshable}s if it is not * already there and immediately refreshes it. * * @param alreadyRefreshed * the collection of {@link Refreshable}s * @param refreshable * the {@link Refreshable} to potentially add and refresh */ public static void maybeRefresh(Collection<Refreshable> alreadyRefreshed, Refreshable refreshable) { if (!alreadyRefreshed.contains(refreshable)) { alreadyRefreshed.add(refreshable); log.info("Added refreshable: {}", refreshable); refreshable.refresh(alreadyRefreshed); log.info("Refreshed: {}", alreadyRefreshed); } } }
3e0310a9207691e60aa6905e35888f8304c3e675
561
java
Java
src/utils/RegretData.java
BaldwinHe/CatchTigerChess
b3f0192c867efebf6528368a23c09c9cb8ecd43a
[ "MIT" ]
null
null
null
src/utils/RegretData.java
BaldwinHe/CatchTigerChess
b3f0192c867efebf6528368a23c09c9cb8ecd43a
[ "MIT" ]
1
2019-07-28T03:24:15.000Z
2019-07-28T03:24:15.000Z
src/utils/RegretData.java
BaldwinHe/CatchTigerChess
b3f0192c867efebf6528368a23c09c9cb8ecd43a
[ "MIT" ]
null
null
null
22.44
79
0.670232
1,270
/* * 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 utils; /** * Chess move data * @author 杨焕煜 */ public class RegretData { public int src_x = 0; public int src_y = 0; public int des_x = 0; public int des_y = 0; public boolean degree_0 = false; public boolean degree_45 = false; public boolean degree_90 = false; public boolean degree_135 = false; public int pieceId; }
3e0310ac86a5de107433da57869397a801c9ae04
2,135
java
Java
app/src/test/java/com/eigendaksh/trendingrepositories/testutils/TestUtils.java
ashutoshpurushottam/TrendingRepositories
961aa33498c246385676340645915114331308c4
[ "MIT" ]
null
null
null
app/src/test/java/com/eigendaksh/trendingrepositories/testutils/TestUtils.java
ashutoshpurushottam/TrendingRepositories
961aa33498c246385676340645915114331308c4
[ "MIT" ]
null
null
null
app/src/test/java/com/eigendaksh/trendingrepositories/testutils/TestUtils.java
ashutoshpurushottam/TrendingRepositories
961aa33498c246385676340645915114331308c4
[ "MIT" ]
null
null
null
33.888889
107
0.63466
1,271
package com.eigendaksh.trendingrepositories.testutils; import com.eigendaksh.trendingrepositories.model.AdapterFactory; import com.eigendaksh.trendingrepositories.model.ZonedDateTimeAdapter; import com.squareup.moshi.Moshi; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Type; public class TestUtils { private static TestUtils INSTANCE = new TestUtils(); private static final Moshi TEST_MOSHI = initializeMoshi(); private TestUtils() { } public static <T> T loadJson(String path, Type type) { try { String json = getFileString(path); //noinspection unchecked return (T) TEST_MOSHI.adapter(type).fromJson(json); } catch (IOException e) { throw new IllegalArgumentException("Could not deserialize: " + path + " into type: " + type); } } public static <T> T loadJson(String path, Class<T> clazz) { try { String json = getFileString(path); //noinspection unchecked return (T) TEST_MOSHI.adapter(clazz).fromJson(json); } catch (IOException e) { throw new IllegalArgumentException("Could not deserialize: " + path + " into class: " + clazz); } } private static String getFileString(String path) { try { StringBuilder sb = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader( INSTANCE.getClass().getClassLoader().getResourceAsStream(path))); String line; while ((line = reader.readLine()) != null) { sb.append(line); } return sb.toString(); } catch (IOException e) { throw new IllegalArgumentException("Could not read from resource at: " + path); } } private static Moshi initializeMoshi() { Moshi.Builder builder = new Moshi.Builder(); builder.add(AdapterFactory.Companion.getINSTANCE()); builder.add(new ZonedDateTimeAdapter()); return builder.build(); } }
3e0310b00b93a66dcedd2383d38daa8693e0d5b6
2,076
java
Java
event/src/main/java/net/md_5/bungee/event/asm/SafeClassDefiner.java
starlis/BungeeCord
5a8c42959306833dccf63424e2c02a201da91140
[ "BSD-3-Clause" ]
1
2022-01-12T20:38:13.000Z
2022-01-12T20:38:13.000Z
event/src/main/java/net/md_5/bungee/event/asm/SafeClassDefiner.java
starlis/BungeeCord
5a8c42959306833dccf63424e2c02a201da91140
[ "BSD-3-Clause" ]
null
null
null
event/src/main/java/net/md_5/bungee/event/asm/SafeClassDefiner.java
starlis/BungeeCord
5a8c42959306833dccf63424e2c02a201da91140
[ "BSD-3-Clause" ]
null
null
null
31.938462
103
0.61079
1,272
package net.md_5.bungee.event.asm; import lombok.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import com.google.common.base.Preconditions; import org.objectweb.asm.Type; @NoArgsConstructor(access = AccessLevel.PACKAGE) public class SafeClassDefiner implements ClassDefiner { /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner(); private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new ConcurrentHashMap<>(); @Override public Class<?> defineClass(ClassLoader parentLoader, Type type, byte[] data) { GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new); String name = type.getClassName(); synchronized (loader.getClassLoadingLock(name)) { Preconditions.checkState(!loader.hasClass(name), "%s already defined", name); Class<?> c = loader.define(name, data); assert c.getName().equals(name); return c; } } private static class GeneratedClassLoader extends ClassLoader { static { ClassLoader.registerAsParallelCapable(); } protected GeneratedClassLoader(ClassLoader parent) { super(parent); } private Class<?> define(String name, byte[] data) { synchronized (getClassLoadingLock(name)) { assert !hasClass(name); Class<?> c = defineClass(name, data, 0, data.length); resolveClass(c); return c; } } @Override public Object getClassLoadingLock(String name) { return super.getClassLoadingLock(name); } public boolean hasClass(String name) { synchronized (getClassLoadingLock(name)) { try { Class.forName(name); return true; } catch (ClassNotFoundException e) { return false; } } } } }
3e0311f5db657744a9cc5b903371f00f626e9579
10,884
java
Java
app/src/main/java/com/lingju/assistant/view/AccountingEditDialog.java
LingjuAI/AssistantBySDK
354c3abcd5aeaf6d1581ea093a5d72b4fc6a51e0
[ "Apache-2.0" ]
40
2017-09-05T17:44:52.000Z
2021-11-10T12:46:05.000Z
app/src/main/java/com/lingju/assistant/view/AccountingEditDialog.java
LingjuAI/AssistantBySDK
354c3abcd5aeaf6d1581ea093a5d72b4fc6a51e0
[ "Apache-2.0" ]
1
2017-09-09T10:59:22.000Z
2017-09-09T10:59:54.000Z
app/src/main/java/com/lingju/assistant/view/AccountingEditDialog.java
LingjuAI/AssistantBySDK
354c3abcd5aeaf6d1581ea093a5d72b4fc6a51e0
[ "Apache-2.0" ]
12
2017-11-19T02:24:35.000Z
2022-03-22T05:55:50.000Z
32.981818
168
0.737137
1,273
package com.lingju.assistant.view; import android.app.Activity; import android.graphics.drawable.LevelListDrawable; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.lingju.assistant.R; import com.lingju.assistant.view.base.BaseEditDialog; import com.lingju.model.Accounting; import com.lingju.model.dao.AssistDao; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class AccountingEditDialog extends BaseEditDialog implements View.OnClickListener{ private OnAccountingEditListener defaultListener; private Accounting[] accounts; private int checkedType[]; private double amount[]; private long time; private View typeViews[]=new View[3]; private TextView proTexts[]=new TextView[3]; private TextView amountTexts[]=new TextView[3]; private EditText memoText; private TextView timeText; private TextView ecText; private TextView icText; private SimpleDateFormat sf=new SimpleDateFormat("yyyy年MM月dd日"); private int count; private int expenseCount=0; private int incomeCount=0; private int amountEditIndex=0; private int projectEditIndex=0; private View mTaskView; public AccountingEditDialog(Activity context, Accounting[] accounts, OnAccountingEditListener defaultListener) { super(context, R.style.lingju_dialog1); setCancelable(false); this.accounts=accounts; this.count=this.accounts.length; this.defaultListener=defaultListener; } /*public AccoutingEditDialog(Context context, int theme) { super(context, theme); } public AccoutingEditDialog(Context context, boolean cancelable, OnCancelListener cancelListener) { super(context, cancelable, cancelListener); }*/ public void setAccount(Accounting[] account) { this.accounts = account; } public Accounting[] getAccount() { return accounts; } @Override public void setAmount(double amount) { this.amount[amountEditIndex] = amount; amountTexts[amountEditIndex].setText(Double.toString(amount/100)+(amount%100==0?"":"."+amount%100)); resetCount(); } /** 重置收支统计 **/ private void resetCount(){ expenseCount=0; incomeCount=0; for(int i=0;i<count;i++){ if(accounts[i]==null)continue; if(checkedType[i]==0){ expenseCount+=amount[i]; } else{ incomeCount+=amount[i]; } } ecText.setText(traslate(expenseCount)); icText.setText(traslate(incomeCount)); } @Override public void setTime(long time) { this.time = time; timeText.setText(sf.format(new Date(time))); } @Override public void setProject(String proText) { Log.e("AccountingEditDialog", "setProject proText="+proText+",projectEditIndex="+projectEditIndex+",this.proTexts[projectEditIndex]"+this.proTexts[projectEditIndex]); if(accounts[projectEditIndex]!=null) accounts[projectEditIndex].setEtype(proText); if(this.proTexts[projectEditIndex]!=null) this.proTexts[projectEditIndex].setText(proText); } public void setDefaultEditListener(OnAccountingEditListener listener) { this.defaultListener=listener; } @Override public boolean confirm(){ int index=1; for(int i=0;i<count;i++){ if(accounts[i]==null)continue; if(TextUtils.isEmpty(proTexts[i].getText())){ if(defaultListener!=null){ defaultListener.onError("第"+(index++)+"个记账项目不能为空"); return false; } } accounts[i].setAmount(amount[i]); accounts[i].setAtype(checkedType[i]); accounts[i].setMemo(memoText.getText().toString()); accounts[i].setEtype(proTexts[i].getText().toString()); accounts[i].setCreated(new Timestamp(time)); if(accounts[i].getId()!=null&&accounts[i].getId()>0){ AssistDao.getInstance().updateAccount(accounts[i]); } else AssistDao.getInstance().insertAccount(accounts[i]); } cancel(); return true; } @Override protected void initTaskView(LinearLayout llTaskContainer) { mTaskView = View.inflate(mContext, R.layout.accounting_edit_dialog, null); typeViews[0]= mTaskView.findViewById(R.id.aib_type1); typeViews[1]= mTaskView.findViewById(R.id.aib_type2); typeViews[2]= mTaskView.findViewById(R.id.aib_type3); proTexts[0]=(TextView) mTaskView.findViewById(R.id.aib_project1); proTexts[1]=(TextView) mTaskView.findViewById(R.id.aib_project2); proTexts[2]=(TextView) mTaskView.findViewById(R.id.aib_project3); amountTexts[0]=(TextView) mTaskView.findViewById(R.id.aib_amount1); amountTexts[1]=(TextView) mTaskView.findViewById(R.id.aib_amount2); amountTexts[2]=(TextView) mTaskView.findViewById(R.id.aib_amount3); memoText=(EditText) mTaskView.findViewById(R.id.aib_memo); timeText=(TextView) mTaskView.findViewById(R.id.aib_time); ecText=(TextView) mTaskView.findViewById(R.id.aib_expense); icText=(TextView) mTaskView.findViewById(R.id.aib_income); mTaskView.findViewById(R.id.aed_close).setOnClickListener(this); mTaskView.findViewById(R.id.aed_cancel).setOnClickListener(this); mTaskView.findViewById(R.id.aib_amount_box1).setOnClickListener(this); mTaskView.findViewById(R.id.aib_amount_box2).setOnClickListener(this); mTaskView.findViewById(R.id.aib_amount_box3).setOnClickListener(this); mTaskView.findViewById(R.id.aib_project_box1).setOnClickListener(this); mTaskView.findViewById(R.id.aib_project_box2).setOnClickListener(this); mTaskView.findViewById(R.id.aib_project_box3).setOnClickListener(this); timeText.setOnClickListener(this); mTaskView.findViewById(R.id.aed_confirm).setOnClickListener(this); mTaskView.findViewById(R.id.aib_type1).setOnClickListener(this); mTaskView.findViewById(R.id.aib_type2).setOnClickListener(this); mTaskView.findViewById(R.id.aib_type3).setOnClickListener(this); mTaskView.findViewById(R.id.aib_delete1).setOnClickListener(this); mTaskView.findViewById(R.id.aib_delete2).setOnClickListener(this); mTaskView.findViewById(R.id.aib_delete3).setOnClickListener(this); if(accounts!=null){ checkedType=new int[count]; amount=new double[count]; LevelListDrawable ld; for(int i=0;i<count;i++){ checkedType[i]=accounts[i].getAtype(); amount[i]=accounts[i].getAmount(); ld=(LevelListDrawable) typeViews[i].getBackground(); ld.setLevel(checkedType[i]); if(checkedType[i]==0){ expenseCount+=amount[i]; } else{ incomeCount+=amount[i]; } amountTexts[i].setText(Double.toString(amount[i]/100)+(amount[i]%100==0?"":"."+amount[i]%100)); proTexts[i].setText(accounts[i].getEtype()); } time=accounts[0].getCreated()!=null?accounts[0].getCreated().getTime():System.currentTimeMillis(); if(count>=2){ mTaskView.findViewById(R.id.aib_count_box).setVisibility(View.VISIBLE); mTaskView.findViewById(R.id.aib_sub_box2).setVisibility(View.VISIBLE); mTaskView.findViewById(R.id.aib_delete1).setVisibility(View.VISIBLE); if(count==3){ mTaskView.findViewById(R.id.aib_sub_box3).setVisibility(View.VISIBLE); } } ecText.setText(traslate(expenseCount)); icText.setText(traslate(incomeCount)); memoText.setText(accounts[0].getMemo()); timeText.setText(sf.format(accounts[0].getCreated())); } llTaskContainer.addView(mTaskView); } private String traslate(int v){ return Integer.toString(v/100)+(v%100==0?"":"."+v%100); } @Override public void onClick(View v) { switch(v.getId()){ case R.id.aed_cancel: case R.id.aed_close: cancel(); if(defaultListener!=null){ defaultListener.onCancel(); } break; case R.id.aed_confirm: if(confirm()&&defaultListener!=null){ defaultListener.onConfirm(); } break; case R.id.aib_amount_box1: if(defaultListener!=null){ amountEditIndex=0; defaultListener.changeAmount(amount[0]); } break; case R.id.aib_amount_box2: if(defaultListener!=null){ amountEditIndex=1; defaultListener.changeAmount(amount[1]); } break; case R.id.aib_amount_box3: if(defaultListener!=null){ amountEditIndex=2; defaultListener.changeAmount(amount[2]); } break; case R.id.aib_time: if(defaultListener!=null){ defaultListener.changeDate(time>0?time:System.currentTimeMillis()); } break; case R.id.aib_project_box1: if(defaultListener!=null){ projectEditIndex=0; defaultListener.changePro(proTexts[0].getText().toString(),checkedType[0]); } break; case R.id.aib_project_box2: if(defaultListener!=null){ projectEditIndex=1; defaultListener.changePro(proTexts[1].getText().toString(),checkedType[1]); } break; case R.id.aib_project_box3: if(defaultListener!=null){ projectEditIndex=2; defaultListener.changePro(proTexts[2].getText().toString(),checkedType[2]); } break; case R.id.aib_type1: checkedType[0]=checkedType[0]==1?0:1; ((LevelListDrawable)typeViews[0].getBackground()).setLevel(checkedType[0]); resetCount(); break; case R.id.aib_type2: checkedType[1]=checkedType[1]==1?0:1; ((LevelListDrawable)typeViews[1].getBackground()).setLevel(checkedType[1]); resetCount(); break; case R.id.aib_type3: checkedType[2]=checkedType[2]==1?0:1; ((LevelListDrawable)typeViews[2].getBackground()).setLevel(checkedType[2]); resetCount(); break; case R.id.aib_delete1: mTaskView.findViewById(R.id.aib_sub_box1).setVisibility(View.GONE); accounts[0]=null; if(mTaskView.findViewById(R.id.aib_sub_box2).getVisibility()==View.GONE){ mTaskView.findViewById(R.id.aib_delete3).setVisibility(View.GONE); } else if(mTaskView.findViewById(R.id.aib_sub_box3).getVisibility()==View.GONE){ mTaskView.findViewById(R.id.aib_delete2).setVisibility(View.GONE); } resetCount(); break; case R.id.aib_delete2: mTaskView.findViewById(R.id.aib_sub_box2).setVisibility(View.GONE); accounts[1]=null; if(mTaskView.findViewById(R.id.aib_sub_box1).getVisibility()==View.GONE){ mTaskView.findViewById(R.id.aib_delete3).setVisibility(View.GONE); } else if(mTaskView.findViewById(R.id.aib_sub_box3).getVisibility()==View.GONE){ mTaskView.findViewById(R.id.aib_delete1).setVisibility(View.GONE); } resetCount(); break; case R.id.aib_delete3: mTaskView.findViewById(R.id.aib_sub_box3).setVisibility(View.GONE); accounts[2]=null; if(mTaskView.findViewById(R.id.aib_sub_box2).getVisibility()==View.GONE){ mTaskView.findViewById(R.id.aib_delete1).setVisibility(View.GONE); } else if(mTaskView.findViewById(R.id.aib_sub_box1).getVisibility()==View.GONE){ mTaskView.findViewById(R.id.aib_delete2).setVisibility(View.GONE); } resetCount(); break; } } public interface OnAccountingEditListener { public void onError(String msg); public void onConfirm(); public void onCancel(); public void changeAmount(double amount); public void changeDate(long date); public void changePro(String pro, int type); } }
3e0312796266e56ec1d80083020e8979c35b4f0b
2,174
java
Java
core/src/main/java/de/quantummaid/mapmaid/builder/resolving/factories/primitives/BuiltInPrimitiveSerializer.java
quantummaiddeveloper/mapmaid
348ed54a2dd46ffb66204ae573f242a01acb73c5
[ "Apache-2.0" ]
5
2020-04-07T08:32:23.000Z
2020-12-18T16:31:58.000Z
core/src/main/java/de/quantummaid/mapmaid/builder/resolving/factories/primitives/BuiltInPrimitiveSerializer.java
quantummaiddeveloper/mapmaid
348ed54a2dd46ffb66204ae573f242a01acb73c5
[ "Apache-2.0" ]
49
2020-01-06T10:21:13.000Z
2022-03-09T09:25:31.000Z
core/src/main/java/de/quantummaid/mapmaid/builder/resolving/factories/primitives/BuiltInPrimitiveSerializer.java
quantummaiddeveloper/mapmaid
348ed54a2dd46ffb66204ae573f242a01acb73c5
[ "Apache-2.0" ]
1
2020-07-23T05:21:28.000Z
2020-07-23T05:21:28.000Z
33.446154
113
0.729991
1,274
/* * Copyright (c) 2020 Richard Hauswald - https://quantummaid.de/. * * 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 de.quantummaid.mapmaid.builder.resolving.factories.primitives; import de.quantummaid.mapmaid.mapper.serialization.serializers.customprimitives.CustomPrimitiveSerializer; import de.quantummaid.reflectmaid.typescanner.TypeIdentifier; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.RequiredArgsConstructor; import lombok.ToString; import java.util.List; @ToString @EqualsAndHashCode @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public final class BuiltInPrimitiveSerializer implements CustomPrimitiveSerializer { private final Class<?> baseType; private final List<TypeIdentifier> alsoRegister; public static CustomPrimitiveSerializer builtInPrimitiveSerializer(final Class<?> baseType, final List<TypeIdentifier> alsoRegister) { return new BuiltInPrimitiveSerializer(baseType, alsoRegister); } @Override public List<TypeIdentifier> requiredTypes() { return alsoRegister; } @Override public Object serialize(final Object object) { return object; } @Override public String description() { return "toString()"; } @Override public Class<?> baseType() { return baseType; } }
3e031289edb0fe031ec121efdd91f257f1642e27
1,348
java
Java
src/main/java/br/com/zup/nossocartao/proposta/controller/NovaPropostaResponse.java
migguerra/bootcamp-01-template-proposta
f5ba52c7722c064f11fbcc2a5975501475c19566
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zup/nossocartao/proposta/controller/NovaPropostaResponse.java
migguerra/bootcamp-01-template-proposta
f5ba52c7722c064f11fbcc2a5975501475c19566
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zup/nossocartao/proposta/controller/NovaPropostaResponse.java
migguerra/bootcamp-01-template-proposta
f5ba52c7722c064f11fbcc2a5975501475c19566
[ "Apache-2.0" ]
null
null
null
18.465753
57
0.752226
1,275
package br.com.zup.nossocartao.proposta.controller; import java.math.BigDecimal; import javax.validation.constraints.NotNull; import br.com.zup.nossocartao.proposta.Proposta; import br.com.zup.nossocartao.proposta.StatusSolicitacao; public class NovaPropostaResponse { private Long id; private String cpfCnpj; private String email; private String nome; private String endereco; private BigDecimal salario; @NotNull private StatusSolicitacao restricaoStatus; private String numeroCartao; public NovaPropostaResponse(Proposta dadosBanco) { this.id = dadosBanco.getId(); this.cpfCnpj = dadosBanco.getCpfCnpj(); this.email = dadosBanco.getEmail(); this.nome = dadosBanco.getNome(); this.endereco = dadosBanco.getEndereco(); this.salario = dadosBanco.getSalario(); this.restricaoStatus = dadosBanco.getRestricaoStatus(); this.numeroCartao = dadosBanco.getNumeroCartao(); } public Long getId() { return id; } public String getCpfCnpj() { return cpfCnpj; } public String getEmail() { return email; } public String getNome() { return nome; } public String getEndereco() { return endereco; } public BigDecimal getSalario() { return salario; } public StatusSolicitacao getRestricaoStatus() { return restricaoStatus; } public String getNumeroCartao() { return numeroCartao; } }
3e0312c7a6bf49e25cd23042a4be8c8f249294f2
89
java
Java
wechat-core/src/main/java/com/itfvck/wechatframework/core/util/http/HttpProxy.java
itfvck/wechat-framework
afeab0970ee7e61ca57bed4bc107f512c4f996bc
[ "Apache-2.0" ]
35
2016-10-26T01:18:06.000Z
2021-05-12T11:25:14.000Z
wechat-core/src/main/java/com/itfvck/wechatframework/core/util/http/HttpProxy.java
itfvck/wechat-framework
afeab0970ee7e61ca57bed4bc107f512c4f996bc
[ "Apache-2.0" ]
null
null
null
wechat-core/src/main/java/com/itfvck/wechatframework/core/util/http/HttpProxy.java
itfvck/wechat-framework
afeab0970ee7e61ca57bed4bc107f512c4f996bc
[ "Apache-2.0" ]
13
2016-09-06T02:15:51.000Z
2019-05-27T09:24:12.000Z
14.833333
51
0.707865
1,276
package com.itfvck.wechatframework.core.util.http; public class HttpProxy { }
3e0312ff380d831e123727ac848187f1bcaa48ce
1,538
java
Java
src/java/tester/Test22.java
ayepezv/WebAppCatastro
0ff68975a8d7dd259bcf9aa3e1a21f3121b969a3
[ "MIT" ]
null
null
null
src/java/tester/Test22.java
ayepezv/WebAppCatastro
0ff68975a8d7dd259bcf9aa3e1a21f3121b969a3
[ "MIT" ]
null
null
null
src/java/tester/Test22.java
ayepezv/WebAppCatastro
0ff68975a8d7dd259bcf9aa3e1a21f3121b969a3
[ "MIT" ]
null
null
null
34.177778
106
0.606632
1,277
/* * 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 tester; import catastro.recaudacion.entidades.Titulo; import catastro.recaudacion.funciones.FTitulos; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; /** * * @author Geovanny Cudco */ public class Test22 { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { // TODO code application logic here try { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date parsed = format.parse("2018-06-01"); Date parsed1 = format.parse("2018-08-07"); java.sql.Date sql = new java.sql.Date(parsed.getTime()); java.sql.Date sql1 = new java.sql.Date(parsed1.getTime()); List<Titulo> lstTitulos = FTitulos.consultarTitulosIndividualesEntreFechas(sql, sql1); System.out.println("Fecha inicio " + sql + " fecha fin " + sql1+" total "+lstTitulos.size()); System.out.println("Total pendientes: "+FTitulos.titulosPendientes(7415)); System.out.println("Total pagados: "+FTitulos.titulosPendientes(7415)); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); } } }
3e031411039386f2828290cfa5df268ce6f02d60
1,476
java
Java
src/main/java/org/nuxeo/studio/components/common/serializer/adapter/SchemaAdapter.java
nuxeo/nuxeo-studio-components-common
c541ea07506da0238846e54233b858cf69dff861
[ "Apache-2.0" ]
null
null
null
src/main/java/org/nuxeo/studio/components/common/serializer/adapter/SchemaAdapter.java
nuxeo/nuxeo-studio-components-common
c541ea07506da0238846e54233b858cf69dff861
[ "Apache-2.0" ]
7
2018-10-22T14:15:47.000Z
2021-11-24T16:19:20.000Z
src/main/java/org/nuxeo/studio/components/common/serializer/adapter/SchemaAdapter.java
nuxeo/nuxeo-studio-components-common
c541ea07506da0238846e54233b858cf69dff861
[ "Apache-2.0" ]
null
null
null
35.142857
90
0.735095
1,278
/* * (C) Copyright 2017 Nuxeo SA (http://nuxeo.com/) and others. * * 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. * * Contributors: * Arnaud Kervern */ package org.nuxeo.studio.components.common.serializer.adapter; import org.nuxeo.studio.components.common.mapper.descriptors.SchemaBindingDescriptor; import org.nuxeo.studio.components.common.serializer.adapter.schema.Schema; import org.nuxeo.studio.components.common.serializer.adapter.schema.SimpleSchemaReader; public class SchemaAdapter implements SerializerAdapter<SchemaBindingDescriptor, Schema> { @Override public Schema adapt(SchemaBindingDescriptor descriptor) { if (!descriptor.isEnabled) { return null; } Schema schema = new Schema(descriptor.name, descriptor.prefix); SimpleSchemaReader reader = new SimpleSchemaReader(descriptor.src); reader.load(); schema.addFields(reader.getFields()); return schema; } }
3e0314ad5b4d8de35cb74d4cd2d4db4dcd11fd91
5,417
java
Java
android/apolloui/src/main/java/io/muun/apollo/presentation/ui/adapter/ItemAdapter.java
florravenna/apollo
bddcb5fc5b9cc714b61565bddba07f45c18335ad
[ "MIT" ]
151
2018-10-10T23:49:48.000Z
2022-03-30T11:54:56.000Z
android/apolloui/src/main/java/io/muun/apollo/presentation/ui/adapter/ItemAdapter.java
florravenna/apollo
bddcb5fc5b9cc714b61565bddba07f45c18335ad
[ "MIT" ]
48
2019-09-07T09:45:53.000Z
2022-03-31T17:54:06.000Z
android/apolloui/src/main/java/io/muun/apollo/presentation/ui/adapter/ItemAdapter.java
florravenna/apollo
bddcb5fc5b9cc714b61565bddba07f45c18335ad
[ "MIT" ]
29
2019-06-13T08:45:17.000Z
2022-03-24T19:38:22.000Z
26.816832
93
0.635592
1,279
package io.muun.apollo.presentation.ui.adapter; import io.muun.apollo.presentation.ui.adapter.holder.BaseViewHolder; import io.muun.apollo.presentation.ui.adapter.holder.ViewHolderFactory; import io.muun.apollo.presentation.ui.adapter.viewmodel.ItemViewModel; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import javax.annotation.Nullable; public class ItemAdapter extends RecyclerView.Adapter<BaseViewHolder<ItemViewModel>> { public interface SearchCriteria { boolean filter(ItemViewModel viewModel, String query); } public interface OnItemClickListener { void onItemClick(ItemViewModel item); } private final ViewHolderFactory viewHolderFactory; private List<ItemViewModel> items; private List<ItemViewModel> unfilteredItems; private OnItemClickListener onItemClickListener; /** * Constructor with ViewHolderFactory. */ public ItemAdapter(ViewHolderFactory viewHolderFactory) { this.viewHolderFactory = viewHolderFactory; this.items = new ArrayList<>(); this.unfilteredItems = new ArrayList<>(); this.onItemClickListener = (item) -> { }; } @Override public int getItemCount() { return items.size(); } @Override public BaseViewHolder<ItemViewModel> onCreateViewHolder(ViewGroup parent, int viewType) { final View itemView = LayoutInflater.from(parent.getContext()) .inflate(viewType, parent, false); itemView.setClickable(true); return viewHolderFactory.create(viewType, itemView); } @Override public void onBindViewHolder(BaseViewHolder<ItemViewModel> holder, int position) { final ItemViewModel item = items.get(position); holder.bind(item); holder.itemView.setOnClickListener(view -> onItemClick(item)); } @Override public int getItemViewType(int position) { return items.get(position).type(viewHolderFactory); } public List<ItemViewModel> getItems() { return items; } /** * Get the first item of a given ItemViewModel class, or null. */ @Nullable public <T extends ItemViewModel> T getFirstOfType(Class<T> cls) { for (final ItemViewModel item: items) { if (cls.isInstance(item)) { return (T) item; } } return null; } /** * Get the number of a items of a given ItemViewModel class. */ public <T extends ItemViewModel> int getCountOfType(Class<T> cls) { int count = 0; for (final ItemViewModel item: items) { if (cls.isInstance(item)) { count += 1; } } return count; } /** * Get the index for the first item of a given ItemViewModel class, or -1. */ public <T extends ItemViewModel> int getFirstIndexOfType(Class<T> cls) { for (int i = 0; i < items.size(); i++) { if (cls.isInstance(items.get(i))) { return i; } } return -1; } /** * Set this adapter's items and notifyDataSetChanged. */ public void setItems(List<ItemViewModel> items) { setItemsWithoutNotifying(items); notifyDataSetChanged(); } /** * Set this adapter's items. */ public void setItemsWithoutNotifying(List<ItemViewModel> items) { this.items = items; this.unfilteredItems = new LinkedList<>(items); } /** * Clear this adapter's items. */ public void clear() { this.items.clear(); this.unfilteredItems.clear(); notifyDataSetChanged(); } public boolean isEmpty() { return items.isEmpty(); } /** * Prepend all of the elements in the specified collection to the beginning of * this adapter. */ public void addFirst(List<ItemViewModel> items) { addItems(0, items); } /** * Appends all of the elements in the specified collection to the end of * this adapter. */ public void addItems(List<ItemViewModel> items) { addItems(getItemCount(), items); } /** * Add items to this adapter. */ protected void addItems(int index, List<ItemViewModel> items) { this.items.addAll(index, items); this.unfilteredItems.addAll(index, items); notifyDataSetChanged(); } /** * Filter this adapter's items according to a query string. */ public void filter(SearchCriteria criteria, String query) { final Set<ItemViewModel> orderedSet = new LinkedHashSet<>(); for (ItemViewModel item : unfilteredItems) { if (criteria.filter(item, query)) { orderedSet.add(item); } } this.items = new ArrayList<>(orderedSet); notifyDataSetChanged(); } public void resetFilter() { setItems(unfilteredItems); } public void setOnItemClickListener(OnItemClickListener listener) { this.onItemClickListener = listener; } private void onItemClick(ItemViewModel item) { onItemClickListener.onItemClick(item); } }
3e0316f432e6fc2ac798a865fb90df64e1d217cc
2,987
java
Java
src/main/java/dev/necauqua/mods/cm/mixin/client/RenderLivingMixin.java
Snapshotlight/chiseled-me
63edfd051e8ae4c9fdd1349f8018db73fb5ed0e9
[ "MIT" ]
21
2019-02-03T10:21:18.000Z
2022-03-14T12:07:24.000Z
src/main/java/dev/necauqua/mods/cm/mixin/client/RenderLivingMixin.java
Snapshotlight/chiseled-me
63edfd051e8ae4c9fdd1349f8018db73fb5ed0e9
[ "MIT" ]
107
2019-02-16T00:28:17.000Z
2022-03-29T15:48:52.000Z
src/main/java/dev/necauqua/mods/cm/mixin/client/RenderLivingMixin.java
Snapshotlight/chiseled-me
63edfd051e8ae4c9fdd1349f8018db73fb5ed0e9
[ "MIT" ]
13
2019-05-11T12:26:06.000Z
2021-12-18T23:24:39.000Z
39.302632
141
0.686642
1,280
/* * Copyright (c) 2017-2021 Anton Bulakh <[email protected]> * Licensed under MIT, see the LICENSE file for details. */ package dev.necauqua.mods.cm.mixin.client; import dev.necauqua.mods.cm.api.IRenderSized; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.EntityLiving; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(RenderLiving.class) public abstract class RenderLivingMixin { private double $cm$self, $cm$coarseSelf, $cm$holder; // undo the scaling of the leash @ModifyConstant(method = "renderLeash", constant = @Constant(doubleValue = 1.6)) double renderLeashHeight(double constant, EntityLiving entityLiving, double x, double y, double z, float entityYaw, float partialTicks) { $cm$coarseSelf = ((IRenderSized) entityLiving).getSizeCM(); $cm$self = ((IRenderSized) entityLiving).getSizeCM(partialTicks); $cm$holder = ((IRenderSized) entityLiving.getLeashHolder()).getSizeCM(partialTicks); return constant - entityLiving.height + entityLiving.height / $cm$coarseSelf * $cm$self; } @ModifyVariable(method = "renderLeash", ordinal = 14, at = @At("STORE")) double renderLeashHeightFix(double variable, EntityLiving entityLiving) { return variable - entityLiving.height / $cm$coarseSelf * $cm$self; } @ModifyConstant(method = "renderLeash", constant = @Constant(doubleValue = 0.4)) double renderLeashWidth(double constant, EntityLiving entityLiving) { return constant * $cm$self / $cm$coarseSelf; } @ModifyVariable(method = "renderLeash", ordinal = 16, at = @At("STORE")) double renderLeashX(double variable) { return variable / $cm$self; } @ModifyVariable(method = "renderLeash", ordinal = 17, at = @At("STORE")) double renderLeashY(double variable) { return variable / $cm$self; } @ModifyVariable(method = "renderLeash", ordinal = 18, at = @At("STORE")) double renderLeashZ(double variable) { return variable / $cm$self; } @ModifyConstant(method = "renderLeash", constant = @Constant(doubleValue = 0.025)) double renderLeashScale(double constant) { return constant / $cm$self * $cm$holder; } @ModifyConstant(method = "renderLeash", constant = { @Constant(doubleValue = 0.25), @Constant(doubleValue = 0.7, ordinal = 0), @Constant(doubleValue = 0.7, ordinal = 3), // except second and third 0.7 @Constant(doubleValue = 0.5, ordinal = 1), // except first 0.5 @Constant(doubleValue = 0.5, ordinal = 2), @Constant(doubleValue = 0.5, ordinal = 3), }) double renderLeashHolderOffsets(double constant) { return constant * $cm$holder; } }
3e031a54e845d8ddd279a9d1c87dedd026a7594f
600
java
Java
engine/src/main/java/org/camunda/bpm/engine/repository/ResumePreviousBy.java
joansmith2/camunda-bpm-platform
fca40c811a2e3c0cdd60ec7026f845aacb790f03
[ "Apache-2.0" ]
4
2016-10-28T13:10:55.000Z
2017-04-25T07:12:40.000Z
engine/src/main/java/org/camunda/bpm/engine/repository/ResumePreviousBy.java
joansmith2/camunda-bpm-platform
fca40c811a2e3c0cdd60ec7026f845aacb790f03
[ "Apache-2.0" ]
1
2022-03-31T21:02:16.000Z
2022-03-31T21:02:16.000Z
engine/src/main/java/org/camunda/bpm/engine/repository/ResumePreviousBy.java
joansmith2/camunda-bpm-platform
fca40c811a2e3c0cdd60ec7026f845aacb790f03
[ "Apache-2.0" ]
1
2019-09-07T01:31:19.000Z
2019-09-07T01:31:19.000Z
31.578947
140
0.766667
1,281
package org.camunda.bpm.engine.repository; /** * Contains the constants for the possible values the property {@link ProcessApplicationDeploymentBuilder#resumePreviousVersionsBy(String)}. */ public enum ResumePreviousBy { ; /** * Resume previous deployments that contain processes with the same key as in the new deployment */ public static final String RESUME_BY_PROCESS_DEFINITION_KEY = "process-definition-key"; /** * Resume previous deployments that have the same name as the new deployment */ public static final String RESUME_BY_DEPLOYMENT_NAME = "deployment-name"; }
3e031c2ea9ccdb62f2ee7963dd7cdf561f30babf
3,096
java
Java
clouddriver-cloudfoundry/src/main/java/com/netflix/spinnaker/clouddriver/cloudfoundry/deploy/ops/DeleteCloudFoundryServiceBindingAtomicOperation.java
iandelahorne/clouddriver
6427be720cc2f94df635928b0ef6cd899f4bca76
[ "Apache-2.0" ]
382
2015-11-16T17:54:23.000Z
2022-03-24T05:35:37.000Z
clouddriver-cloudfoundry/src/main/java/com/netflix/spinnaker/clouddriver/cloudfoundry/deploy/ops/DeleteCloudFoundryServiceBindingAtomicOperation.java
iandelahorne/clouddriver
6427be720cc2f94df635928b0ef6cd899f4bca76
[ "Apache-2.0" ]
2,541
2015-11-17T11:22:10.000Z
2022-03-28T22:30:12.000Z
clouddriver-cloudfoundry/src/main/java/com/netflix/spinnaker/clouddriver/cloudfoundry/deploy/ops/DeleteCloudFoundryServiceBindingAtomicOperation.java
iandelahorne/clouddriver
6427be720cc2f94df635928b0ef6cd899f4bca76
[ "Apache-2.0" ]
1,229
2015-11-16T19:22:35.000Z
2022-03-28T18:32:40.000Z
35.586207
117
0.700904
1,283
/* * Copyright 2021 Armory, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.spinnaker.clouddriver.cloudfoundry.deploy.ops; import com.netflix.spinnaker.clouddriver.cloudfoundry.client.model.v2.Resource; import com.netflix.spinnaker.clouddriver.cloudfoundry.client.model.v2.ServiceBinding; import com.netflix.spinnaker.clouddriver.cloudfoundry.deploy.description.DeleteCloudFoundryServiceBindingDescription; import com.netflix.spinnaker.clouddriver.data.task.Task; import com.netflix.spinnaker.clouddriver.data.task.TaskRepository; import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation; import java.util.List; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class DeleteCloudFoundryServiceBindingAtomicOperation implements AtomicOperation<Void> { private static final String PHASE = "DELETE_SERVICE_BINDINGS"; private final DeleteCloudFoundryServiceBindingDescription description; private static Task getTask() { return TaskRepository.threadLocalTask.get(); } @Override public Void operate(List<Void> priorOutputs) { List<String> unbindingServiceInstanceNames = description.getServiceUnbindingRequests().stream() .map(s -> s.getServiceInstanceName()) .collect(Collectors.toList()); getTask() .updateStatus( PHASE, "Unbinding Cloud Foundry application '" + description.getServerGroupName() + "' from services: " + unbindingServiceInstanceNames); List<Resource<ServiceBinding>> bindings = description .getClient() .getApplications() .getServiceBindingsByApp(description.getServerGroupId()); removeBindings(bindings, unbindingServiceInstanceNames); getTask() .updateStatus( PHASE, "Successfully unbound Cloud Foundry application '" + description.getServerGroupName() + "' from services: " + unbindingServiceInstanceNames); return null; } private void removeBindings( List<Resource<ServiceBinding>> bindings, List<String> unbindingServiceInstanceNames) { bindings.stream() .filter(b -> unbindingServiceInstanceNames.contains(b.getEntity().getName())) .forEach( b -> { description .getClient() .getServiceInstances() .deleteServiceBinding(b.getMetadata().getGuid()); }); } }
3e031ce16cf35bff01d9098ad94215fabfb2b704
5,658
java
Java
config/config/src/test/java/io/helidon/config/internal/ConfigUtilsTest.java
ascelion/helidon-patch
2c46b003b62a133a25ee8da96e642a03e3f36e89
[ "Apache-2.0" ]
1
2018-12-06T22:45:39.000Z
2018-12-06T22:45:39.000Z
config/config/src/test/java/io/helidon/config/internal/ConfigUtilsTest.java
ascelion/helidon-patch
2c46b003b62a133a25ee8da96e642a03e3f36e89
[ "Apache-2.0" ]
4
2021-02-08T21:26:28.000Z
2022-01-21T23:48:59.000Z
config/config/src/test/java/io/helidon/config/internal/ConfigUtilsTest.java
ascelion/helidon-patch
2c46b003b62a133a25ee8da96e642a03e3f36e89
[ "Apache-2.0" ]
2
2018-09-24T08:35:28.000Z
2018-09-29T09:39:29.000Z
36.74026
115
0.65836
1,284
/* * Copyright (c) 2017, 2018 Oracle and/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. * 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 io.helidon.config.internal; import java.time.Duration; import java.util.Arrays; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.annotation.Priority; import io.helidon.config.internal.ConfigUtils.ScheduledTask; import static org.hamcrest.MatcherAssert.assertThat; import org.hamcrest.Matchers; import org.hamcrest.core.IsInstanceOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import org.junit.jupiter.api.Test; /** * Tests {@link ConfigUtils}. */ public class ConfigUtilsTest { private void testAsStream(Iterable<Integer> integers) { List<Integer> list = ConfigUtils.asStream(integers).sorted(Integer::compare).collect(Collectors.toList()); assertThat(list, Matchers.hasSize(4)); assertThat(list.get(0), equalTo(0)); assertThat(list.get(1), equalTo(10)); assertThat(list.get(2), equalTo(20)); assertThat(list.get(3), equalTo(30)); } @Test public void testAsStream() { testAsStream(Arrays.asList(20, 0, 30, 10)); testAsStream(Arrays.asList(10, 30, 0, 20)); testAsStream(Arrays.asList(0, 10, 20, 30)); } private void testAsPrioritizedStream(Iterable<Provider> providers) { List<Provider> list = ConfigUtils.asPrioritizedStream(providers, 0).collect(Collectors.toList()); assertThat(list, Matchers.hasSize(4)); assertThat(list.get(0), IsInstanceOf.instanceOf(Provider3.class)); assertThat(list.get(1), IsInstanceOf.instanceOf(Provider1.class)); assertThat(list.get(2), IsInstanceOf.instanceOf(Provider4.class)); assertThat(list.get(3), IsInstanceOf.instanceOf(Provider2.class)); } @Test public void testAsPrioritizedStream() { testAsPrioritizedStream(Arrays.asList(new Provider1(), new Provider2(), new Provider3(), new Provider4())); testAsPrioritizedStream(Arrays.asList(new Provider4(), new Provider3(), new Provider2(), new Provider1())); testAsPrioritizedStream(Arrays.asList(new Provider2(), new Provider4(), new Provider1(), new Provider3())); } @Test public void testScheduledTaskInterruptedRepeatedly() throws InterruptedException { AtomicInteger counter = new AtomicInteger(); ScheduledTask task = new ScheduledTask(Executors.newSingleThreadScheduledExecutor(), counter::incrementAndGet, Duration.ofMillis(80)); task.schedule(); task.schedule(); task.schedule(); task.schedule(); task.schedule(); //not yet finished assertThat(counter.get(), is(0)); TimeUnit.MILLISECONDS.sleep(120); assertThat(counter.get(), is(1)); } @Test public void testScheduledTaskExecutedRepeatedly() throws InterruptedException { CountDownLatch execLatch = new CountDownLatch(5); ScheduledTask task = new ScheduledTask(Executors.newSingleThreadScheduledExecutor(), execLatch::countDown, Duration.ZERO); /* Because invoking 'schedule' can cancel an existing action, keep track of cancelations in case the latch expires without reaching 0. */ final long RESCHEDULE_DELAY_MS = 5; final int ACTIONS_TO_SCHEDULE = 5; int cancelations = 0; for (int i = 0; i < ACTIONS_TO_SCHEDULE; i++ ) { if (task.schedule()) { cancelations++; } TimeUnit.MILLISECONDS.sleep(RESCHEDULE_DELAY_MS); } /* The latch can either complete -- because all the scheduled actions finished -- or it can expire at the timeout because at least one action did not finish, in which case the remaining latch value should not exceed the number of actions canceled. (Do not check for exact equality; some attempts to cancel an action might occur after the action was deemed to be not-yet-run or in-progress but actually runs to completion before the cancel is actually invoked. */ assertThat( "Current execLatch count: " + execLatch.getCount() + ", cancelations: " + "" + cancelations, execLatch.await(3000, TimeUnit.MILLISECONDS) || execLatch.getCount() <= cancelations, is(true)); } // // providers ... // interface Provider { } @Priority(20) static class Provider1 implements Provider { } static class Provider2 implements Provider { } @Priority(30) static class Provider3 implements Provider { } @Priority(10) static class Provider4 implements Provider { } }
3e031d1ac4dd3973863be84b26c8efc2747b0b3d
4,140
java
Java
report/src/main/java/zipkin2/internal/AgentV2SpanBaseWriter.java
jxd134/easeagent
e348aa3c8f6a26847f1aa5318139d5964a46bbed
[ "Apache-2.0" ]
403
2021-01-15T08:40:18.000Z
2022-03-31T13:08:01.000Z
report/src/main/java/zipkin2/internal/AgentV2SpanBaseWriter.java
LogoLee/easeagent
b5b44aa7ec74a043a8bbd94cc457703cd183c3e3
[ "Apache-2.0" ]
78
2021-01-18T04:22:40.000Z
2022-03-25T23:57:44.000Z
report/src/main/java/zipkin2/internal/AgentV2SpanBaseWriter.java
LogoLee/easeagent
b5b44aa7ec74a043a8bbd94cc457703cd183c3e3
[ "Apache-2.0" ]
77
2021-01-15T10:19:25.000Z
2022-03-22T14:39:20.000Z
31.12782
88
0.583575
1,285
/* * Copyright (c) 2017, MegaEase * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package zipkin2.internal; import zipkin2.Span; public class AgentV2SpanBaseWriter implements WriteBuffer.Writer<Span> { final String traceIDFieldName = "\"traceId\":\""; final String parentIDFieldName = ",\"parentId\":\""; final String spanIDFieldName = ",\"id\":\""; final String kindFieldName = ",\"kind\":\""; final String nameFieldName = ",\"name\":\""; final String timestampFieldName = ",\"timestamp\":"; final String durationFieldName = ",\"duration\":"; final String debugFieldValue = ",\"debug\":true"; final String sharedFieldValue = ",\"shared\":true"; @Override public int sizeInBytes(Span value) { int sizeInBytes = 0; //traceId sizeInBytes += traceIDFieldName.length() + 1; // 1 represent the last quote sign sizeInBytes += value.traceId().length(); //parentId if (value.parentId() != null) { sizeInBytes += parentIDFieldName.length() + 1; sizeInBytes += value.parentId().length(); } // spanId sizeInBytes += spanIDFieldName.length() + 1; sizeInBytes += value.id().length(); // kind if (value.kind() != null) { sizeInBytes += kindFieldName.length() + 1; sizeInBytes += value.kind().name().length(); } // name if (value.name() != null) { sizeInBytes += nameFieldName.length() + 1; sizeInBytes += JsonEscaper.jsonEscapedSizeInBytes(value.name()); } // timestamp if (value.timestampAsLong() != 0L) { sizeInBytes += timestampFieldName.length(); sizeInBytes += WriteBuffer.asciiSizeInBytes(value.timestampAsLong()); } //duration if (value.durationAsLong() != 0L) { sizeInBytes += durationFieldName.length(); sizeInBytes += WriteBuffer.asciiSizeInBytes(value.durationAsLong()); } if (Boolean.TRUE.equals(value.debug())) { sizeInBytes += debugFieldValue.length(); } if (Boolean.TRUE.equals(value.shared())) { sizeInBytes += sharedFieldValue.length(); } return sizeInBytes; } @Override public void write(Span value, WriteBuffer b) { b.writeAscii(traceIDFieldName); b.writeAscii(value.traceId()); b.writeByte('\"'); if (value.parentId() != null) { b.writeAscii(parentIDFieldName); b.writeAscii(value.parentId()); b.writeByte('\"'); } b.writeAscii(spanIDFieldName); b.writeAscii(value.id()); b.writeByte(34); if (value.kind() != null) { b.writeAscii(kindFieldName); b.writeAscii(value.kind().toString()); b.writeByte('\"'); } if (value.name() != null) { b.writeAscii(nameFieldName); b.writeUtf8(JsonEscaper.jsonEscape(value.name())); b.writeByte('\"'); } if (value.timestampAsLong() != 0L) { b.writeAscii(timestampFieldName); b.writeAscii(value.timestampAsLong()); } if (value.durationAsLong() != 0L) { b.writeAscii(durationFieldName); b.writeAscii(value.durationAsLong()); } if (Boolean.TRUE.equals(value.debug())) { b.writeAscii(debugFieldValue); } if (Boolean.TRUE.equals(value.shared())) { b.writeAscii(sharedFieldValue); } } }
3e031e4b47b186a9bc0ea09c245cdb6f970225f8
15,802
java
Java
doma/src/main/java/org/seasar/doma/internal/expr/ExpressionTokenizer.java
seasarorg/doma
385b00bf0d098bf3e37855565c14933e325b2f83
[ "Apache-1.1" ]
12
2015-01-19T02:43:05.000Z
2021-03-31T09:00:08.000Z
doma/src/main/java/org/seasar/doma/internal/expr/ExpressionTokenizer.java
seasarorg/doma
385b00bf0d098bf3e37855565c14933e325b2f83
[ "Apache-1.1" ]
9
2015-07-21T05:18:18.000Z
2022-01-21T23:19:45.000Z
doma/src/main/java/org/seasar/doma/internal/expr/ExpressionTokenizer.java
seasarorg/doma
385b00bf0d098bf3e37855565c14933e325b2f83
[ "Apache-1.1" ]
6
2015-07-21T03:35:03.000Z
2020-01-30T04:37:16.000Z
33.621277
79
0.393748
1,286
/* * Copyright 2004-2010 the Seasar Foundation and the Others. * * 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.seasar.doma.internal.expr; import static org.seasar.doma.internal.expr.ExpressionTokenType.*; import static org.seasar.doma.internal.util.AssertionUtil.*; import java.nio.CharBuffer; import org.seasar.doma.message.Message; /** * @author taedium * */ public class ExpressionTokenizer { protected final String expression; protected CharBuffer buf; protected CharBuffer duplicatedBuf; protected ExpressionTokenType type; protected String token; protected int position; protected boolean binaryOpAvailable; public ExpressionTokenizer(String expression) { assertNotNull(expression); this.expression = expression; buf = CharBuffer.wrap(expression); duplicatedBuf = buf.duplicate(); peek(); } public ExpressionTokenType next() { switch (type) { case EOE: token = null; type = EOE; return EOE; default: ExpressionTokenType currentType = type; prepareToken(); peek(); return currentType; } } protected void prepareToken() { position = buf.position(); duplicatedBuf.limit(position); token = duplicatedBuf.toString(); duplicatedBuf = buf.duplicate(); } public String getToken() { return token; } public int getPosition() { return position; } public void setPosition(int position, boolean binaryOpAvailable) { this.position = position; this.binaryOpAvailable = binaryOpAvailable; duplicatedBuf.position(position); buf = duplicatedBuf.duplicate(); peek(); } protected void peek() { if (buf.hasRemaining()) { char c = buf.get(); if (buf.hasRemaining()) { char c2 = buf.get(); if (buf.hasRemaining()) { char c3 = buf.get(); if (buf.hasRemaining()) { char c4 = buf.get(); if (buf.hasRemaining()) { char c5 = buf.get(); peekFiveChars(c, c2, c3, c4, c5); } else { peekFourChars(c, c2, c3, c4); } } else { peekThreeChars(c, c2, c3); } } else { peekTwoChars(c, c2); } } else { peekOneChar(c); } } else { type = EOE; } } protected void peekFiveChars(char c, char c2, char c3, char c4, char c5) { if (c == 'f' && c2 == 'a' && c3 == 'l' && c4 == 's' && c5 == 'e') { if (isWordTerminated()) { type = FALSE_LITERAL; binaryOpAvailable = true; return; } } buf.position(buf.position() - 1); peekFourChars(c, c2, c3, c4); } protected void peekFourChars(char c, char c2, char c3, char c4) { if (c == 'n' && c2 == 'u' && c3 == 'l' && c4 == 'l') { if (isWordTerminated()) { type = NULL_LITERAL; binaryOpAvailable = true; return; } } else if (c == 't' && c2 == 'r' && c3 == 'u' && c4 == 'e') { if (isWordTerminated()) { type = TRUE_LITERAL; binaryOpAvailable = true; return; } } buf.position(buf.position() - 1); peekThreeChars(c, c2, c3); } protected void peekThreeChars(char c, char c2, char c3) { if (c == 'n' && c2 == 'e' && c3 == 'w') { if (isWordTerminated()) { type = NEW_OPERATOR; return; } } buf.position(buf.position() - 1); peekTwoChars(c, c2); } protected void peekTwoChars(char c, char c2) { if (binaryOpAvailable) { if (c == '&' && c2 == '&') { type = AND_OPERATOR; binaryOpAvailable = false; return; } else if (c == '|' && c2 == '|') { type = OR_OPERATOR; binaryOpAvailable = false; return; } else if (c == '=' && c2 == '=') { type = EQ_OPERATOR; binaryOpAvailable = false; return; } else if (c == '!' && c2 == '=') { type = NE_OPERATOR; binaryOpAvailable = false; return; } else if (c == '>' && c2 == '=') { type = GE_OPERATOR; binaryOpAvailable = false; return; } else if (c == '<' && c2 == '=') { type = LE_OPERATOR; binaryOpAvailable = false; return; } } buf.position(buf.position() - 1); peekOneChar(c); } protected void peekOneChar(char c) { if (binaryOpAvailable) { if (c == '>') { type = GT_OPERATOR; binaryOpAvailable = false; return; } else if (c == '<') { type = LT_OPERATOR; binaryOpAvailable = false; return; } else if (c == '+') { type = ADD_OPERATOR; binaryOpAvailable = false; return; } else if (c == '-') { type = SUBTRACT_OPERATOR; binaryOpAvailable = false; return; } else if (c == '*') { type = MULTIPLY_OPERATOR; binaryOpAvailable = false; return; } else if (c == '/') { type = DIVIDE_OPERATOR; binaryOpAvailable = false; return; } else if (c == '%') { type = MOD_OPERATOR; binaryOpAvailable = false; return; } } if (Character.isWhitespace(c)) { type = WHITESPACE; return; } else if (c == ',') { type = COMMA_OPERATOR; return; } else if (c == '(') { type = OPENED_PARENS; return; } else if (c == ')') { type = CLOSED_PARENS; binaryOpAvailable = true; return; } else if (c == '!') { type = NOT_OPERATOR; return; } else if (c == '\'') { type = CHAR_LITERAL; if (buf.hasRemaining()) { buf.get(); if (buf.hasRemaining()) { char c3 = buf.get(); if (c3 == '\'') { binaryOpAvailable = true; return; } } } throw new ExpressionException(Message.DOMA3016, expression, buf.position()); } else if (c == '"') { type = STRING_LITERAL; boolean closed = false; while (buf.hasRemaining()) { char c2 = buf.get(); if (c2 == '"') { if (buf.hasRemaining()) { buf.mark(); char c3 = buf.get(); if (c3 != '"') { buf.reset(); closed = true; break; } } else { closed = true; } } } if (!closed) { throw new ExpressionException(Message.DOMA3004, expression, buf.position()); } binaryOpAvailable = true; } else if ((c == '+' || c == '-')) { buf.mark(); if (buf.hasRemaining()) { char c2 = buf.get(); if (Character.isDigit(c2)) { peekNumber(); return; } buf.reset(); } type = ILLEGAL_NUMBER_LITERAL; } else if (Character.isDigit(c)) { peekNumber(); } else if (Character.isJavaIdentifierStart(c)) { type = VARIABLE; binaryOpAvailable = true; while (buf.hasRemaining()) { buf.mark(); char c2 = buf.get(); if (!Character.isJavaIdentifierPart(c2)) { buf.reset(); break; } } } else if (c == '.') { type = FIELD_OPERATOR; binaryOpAvailable = true; if (!buf.hasRemaining()) { throw new ExpressionException(Message.DOMA3021, expression, buf.position()); } buf.mark(); char c2 = buf.get(); if (Character.isJavaIdentifierStart(c2)) { while (buf.hasRemaining()) { buf.mark(); char c3 = buf.get(); if (!Character.isJavaIdentifierPart(c3)) { if (c3 == '(') { type = METHOD_OPERATOR; binaryOpAvailable = false; } buf.reset(); return; } } } else { throw new ExpressionException(Message.DOMA3022, expression, buf.position(), c2); } } else if (c == '@') { if (!buf.hasRemaining()) { throw new ExpressionException(Message.DOMA3023, expression, buf.position()); } buf.mark(); char c2 = buf.get(); if (Character.isJavaIdentifierStart(c2)) { while (buf.hasRemaining()) { buf.mark(); char c3 = buf.get(); if (!Character.isJavaIdentifierPart(c3)) { if (c3 == '(') { type = FUNCTION_OPERATOR; binaryOpAvailable = false; buf.reset(); return; } else if (c3 == '@') { peekStaticMember(); return; } else if (c3 == '.') { while (buf.hasRemaining()) { buf.mark(); char c4 = buf.get(); if (!Character.isJavaIdentifierPart(c4)) { if (c4 == '.') { continue; } else if (c4 == '@') { peekStaticMember(); return; } throw new ExpressionException( Message.DOMA3031, expression, buf.position(), c4); } } throw new ExpressionException(Message.DOMA3032, expression, buf.position()); } throw new ExpressionException(Message.DOMA3025, expression, buf.position()); } } } else { throw new ExpressionException(Message.DOMA3024, expression, buf.position(), c2); } } else { type = OTHER; } } protected void peekStaticMember() { type = STATIC_FIELD_OPERATOR; binaryOpAvailable = true; if (!buf.hasRemaining()) { throw new ExpressionException(Message.DOMA3029, expression, buf.position()); } buf.mark(); char c = buf.get(); if (Character.isJavaIdentifierStart(c)) { while (buf.hasRemaining()) { buf.mark(); char c2 = buf.get(); if (!Character.isJavaIdentifierPart(c2)) { if (c2 == '(') { type = STATIC_METHOD_OPERATOR; binaryOpAvailable = false; } buf.reset(); return; } } } else { throw new ExpressionException(Message.DOMA3030, expression, buf.position(), c); } } protected void peekNumber() { type = INT_LITERAL; boolean decimal = false; while (buf.hasRemaining()) { buf.mark(); char c2 = buf.get(); if (Character.isDigit(c2)) { continue; } else if (c2 == '.') { if (decimal) { type = ILLEGAL_NUMBER_LITERAL; return; } decimal = true; if (buf.hasRemaining()) { char c3 = buf.get(); if (!Character.isDigit(c3)) { type = ILLEGAL_NUMBER_LITERAL; return; } } else { type = ILLEGAL_NUMBER_LITERAL; return; } } else if (c2 == 'F') { type = FLOAT_LITERAL; break; } else if (c2 == 'D') { type = DOUBLE_LITERAL; break; } else if (c2 == 'L') { type = LONG_LITERAL; break; } else if (c2 == 'B') { type = BIGDECIMAL_LITERAL; break; } else { buf.reset(); break; } } if (!isWordTerminated()) { type = ILLEGAL_NUMBER_LITERAL; } binaryOpAvailable = true; } protected boolean isWordTerminated() { buf.mark(); if (buf.hasRemaining()) { char c = buf.get(); if (!Character.isJavaIdentifierPart(c)) { buf.reset(); return true; } } else { return true; } return false; } }
3e031f251abdd6703ed41e6de625c8f032cc361b
1,184
java
Java
hw03-student-testing-application-part3/src/test/java/ru/otus/spring/hw/service/IOLocalizedServiceImplTest.java
andreyzhegalov/2020-11-otus-spring-zhegalov
2ce92e73e852e5ec4558f23b810e7b2db85b48ca
[ "MIT" ]
null
null
null
hw03-student-testing-application-part3/src/test/java/ru/otus/spring/hw/service/IOLocalizedServiceImplTest.java
andreyzhegalov/2020-11-otus-spring-zhegalov
2ce92e73e852e5ec4558f23b810e7b2db85b48ca
[ "MIT" ]
13
2020-12-01T18:18:34.000Z
2021-04-24T08:29:08.000Z
hw03-student-testing-application-part3/src/test/java/ru/otus/spring/hw/service/IOLocalizedServiceImplTest.java
andreyzhegalov/2020-11-otus-spring-zhegalov
2ce92e73e852e5ec4558f23b810e7b2db85b48ca
[ "MIT" ]
null
null
null
30.358974
112
0.742399
1,287
package ru.otus.spring.hw.service; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.then; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) class IOLocalizedServiceImplTest { @Mock private IOService ioService; @Mock private LocalizationService localizationService; @Test void shouldReadFromIOService() { new IOLocalizedServiceImpl(ioService, localizationService).read(); then(ioService).should().read(); } @Test void shouldPrintTextFromLocalizationService() { given(localizationService.getText(any(), any())).willReturn(""); new IOLocalizedServiceImpl(ioService, localizationService).printLocalizedMessage("key", "arg1", "arg2"); then(localizationService).should().getText(eq("key"), eq("arg1"), eq("arg2")); then(ioService).should().print(anyString()); } }
3e0321147d4c7c5a0becabaeb1437b24a6314e9e
2,053
java
Java
proteus-client/src/main/java/io/netifi/proteus/rsocket/UnwrappingRSocket.java
shisheng-1/proteus-java
cd7752941e579bf2dda0804c46674e37e718a28a
[ "Apache-2.0" ]
48
2017-12-27T09:15:49.000Z
2020-11-20T07:16:47.000Z
proteus-client/src/main/java/io/netifi/proteus/rsocket/UnwrappingRSocket.java
shisheng-1/proteus-java
cd7752941e579bf2dda0804c46674e37e718a28a
[ "Apache-2.0" ]
11
2018-02-13T05:08:16.000Z
2019-04-12T03:52:53.000Z
proteus-client/src/main/java/io/netifi/proteus/rsocket/UnwrappingRSocket.java
shisheng-1/proteus-java
cd7752941e579bf2dda0804c46674e37e718a28a
[ "Apache-2.0" ]
4
2018-02-28T09:27:51.000Z
2021-11-13T04:42:30.000Z
34.216667
86
0.720409
1,288
/* * Copyright 2019 The Proteus Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.netifi.proteus.rsocket; import io.netifi.proteus.frames.*; import io.netty.buffer.ByteBuf; import io.rsocket.Payload; import io.rsocket.RSocket; import io.rsocket.util.ByteBufPayload; // Need to unwrap RSocketRpc Messages public class UnwrappingRSocket extends AbstractUnwrappingRSocket { public UnwrappingRSocket(RSocket source) { super(source); } @Override protected Payload unwrap(Payload payload) { try { ByteBuf data = payload.sliceData(); ByteBuf metadata = payload.sliceMetadata(); FrameType frameType = FrameHeaderFlyweight.frameType(metadata); ByteBuf unwrappedMetadata = unwrapMetadata(frameType, metadata); return ByteBufPayload.create(data.retain(), unwrappedMetadata.retain()); } finally { payload.release(); } } private ByteBuf unwrapMetadata(FrameType frameType, ByteBuf metadata) { switch (frameType) { case AUTHORIZATION_WRAPPER: ByteBuf innerFrame = AuthorizationWrapperFlyweight.innerFrame(metadata); return unwrapMetadata(FrameHeaderFlyweight.frameType(innerFrame), innerFrame); case GROUP: return GroupFlyweight.metadata(metadata); case BROADCAST: return BroadcastFlyweight.metadata(metadata); case SHARD: return ShardFlyweight.metadata(metadata); default: throw new IllegalStateException("unknown frame type " + frameType); } } }
3e0322fba916cadaa0276c0464fdf15a4cda2d4e
75
java
Java
src/main/java/com/tsys/parts/part_a/PartA.java
DhavalDalal/Guice-Spike
1cbf7ce465f576417c7b64ffbf3833c783a3a348
[ "Apache-2.0" ]
null
null
null
src/main/java/com/tsys/parts/part_a/PartA.java
DhavalDalal/Guice-Spike
1cbf7ce465f576417c7b64ffbf3833c783a3a348
[ "Apache-2.0" ]
null
null
null
src/main/java/com/tsys/parts/part_a/PartA.java
DhavalDalal/Guice-Spike
1cbf7ce465f576417c7b64ffbf3833c783a3a348
[ "Apache-2.0" ]
null
null
null
9.375
30
0.706667
1,289
package com.tsys.parts.part_a; public interface PartA { void call(); }
3e032372534101d7454617287562a9fa7a241785
1,734
java
Java
jHOLLight/src/edu/pitt/math/jhol/ssreflect/parser/tree/WlogNode.java
fbrausse/flyspeck
66f4ef0f9252c382333586fc07787e64d8a4bbfb
[ "MIT" ]
125
2016-03-22T22:29:23.000Z
2022-02-15T05:43:43.000Z
jHOLLight/src/edu/pitt/math/jhol/ssreflect/parser/tree/WlogNode.java
fbrausse/flyspeck
66f4ef0f9252c382333586fc07787e64d8a4bbfb
[ "MIT" ]
4
2015-10-13T17:38:34.000Z
2020-11-26T19:54:19.000Z
jHOLLight/src/edu/pitt/math/jhol/ssreflect/parser/tree/WlogNode.java
fbrausse/flyspeck
66f4ef0f9252c382333586fc07787e64d8a4bbfb
[ "MIT" ]
9
2017-06-21T08:48:56.000Z
2021-05-13T02:07:27.000Z
20.4
81
0.625144
1,290
package edu.pitt.math.jhol.ssreflect.parser.tree; import java.util.ArrayList; /** * wlog [disch]: vars / expr */ public class WlogNode extends TacticNode { // The tactics applied to the original goal after the subgoal is proved private final TacticNode thenTactic; // The subgoal private final ObjectNode obj; // Variables private final ArrayList<IdNode> vars; /** * Default constructor */ public WlogNode(TacticNode thenTactic, ObjectNode obj, ArrayList<IdNode> vars) { // thenTactic could be null assert(obj != null); if (thenTactic == null) thenTactic = new TacticChainNode(); this.thenTactic = thenTactic; this.obj = obj; this.vars = new ArrayList<IdNode>(vars); } @Override protected String getString() { StringBuilder str = new StringBuilder(); str.append("wlog"); str.append(" [" + thenTactic + "]"); str.append(": "); int n = vars.size(); for (int i = 0; i < n; i++) { str.append(vars.get(i)); if (i < n - 1) str.append(", "); } str.append('/'); str.append(obj); return str.toString(); } @Override protected void translate(StringBuffer buffer) { if (obj.getType() != ObjectNode.TERM) throw new RuntimeException("wlog: TERM expected: " + obj); buffer.append('('); // subgoal obj.translate(buffer); // tactic buffer.append(" (term_tac (wlog_tac "); // then_tactic thenTactic.translate(buffer); // variables buffer.append('['); int n = vars.size(); for (int i = 0; i < n; i++) { IdNode id = vars.get(i); buffer.append('`'); buffer.append(id.getId()); buffer.append('`'); if (i < n - 1) buffer.append("; "); } buffer.append(']'); buffer.append("))"); buffer.append(')'); } }
3e0323b15fe1c32de9105a212d485b661522d1a5
9,287
java
Java
kythe/java/com/google/devtools/kythe/extractors/java/standalone/AbstractJavacWrapper.java
wcalandro/kythe
64969a853711c228b4e3cfc3ce91b84b5bb853d7
[ "Apache-2.0" ]
1,168
2015-01-27T10:19:25.000Z
2018-10-30T15:07:11.000Z
kythe/java/com/google/devtools/kythe/extractors/java/standalone/AbstractJavacWrapper.java
wcalandro/kythe
64969a853711c228b4e3cfc3ce91b84b5bb853d7
[ "Apache-2.0" ]
2,811
2015-01-29T16:19:04.000Z
2018-11-01T19:48:06.000Z
kythe/java/com/google/devtools/kythe/extractors/java/standalone/AbstractJavacWrapper.java
wcalandro/kythe
64969a853711c228b4e3cfc3ce91b84b5bb853d7
[ "Apache-2.0" ]
165
2015-01-27T19:06:27.000Z
2018-10-30T17:31:10.000Z
40.030172
100
0.694196
1,291
/* * Copyright 2014 The Kythe Authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.devtools.kythe.extractors.java.standalone; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import com.google.common.flogger.FluentLogger; import com.google.common.hash.Hashing; import com.google.devtools.kythe.extractors.java.JavaCompilationUnitExtractor; import com.google.devtools.kythe.extractors.shared.CompilationDescription; import com.google.devtools.kythe.extractors.shared.EnvironmentUtils; import com.google.devtools.kythe.extractors.shared.FileVNames; import com.google.devtools.kythe.extractors.shared.IndexInfoUtils; import com.google.devtools.kythe.proto.Analysis.CompilationUnit; import com.google.devtools.kythe.proto.Analysis.FileData; import com.google.devtools.kythe.util.JsonUtil; import com.sun.tools.javac.main.CommandLine; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Optional; /** * General logic for a javac-based {@link CompilationUnit} extractor. * * <p>Environment Variables Used (note that these can also be set as JVM system properties): * * <p>KYTHE_VNAMES: optional path to a JSON configuration file for {@link FileVNames} to populate * the {@link CompilationUnit}'s required input {@link VName}s * * <p>KYTHE_CORPUS: if a vname generated via KYTHE_VNAMES does not provide a corpus, the {@link * VName} will be populated with this corpus (default {@link EnvironmentUtils.DEFAULT_CORPUS}) * * <p>KYTHE_ROOT_DIRECTORY: required root path for file inputs; the {@link FileData} paths stored in * the {@link CompilationUnit} will be made to be relative to this directory * * <p>KYTHE_OUTPUT_FILE: if set to a non-empty value, write the resulting .kzip file to this path * instead of using KYTHE_OUTPUT_DIRECTORY * * <p>KYTHE_OUTPUT_DIRECTORY: directory path to store the resulting .kzip file, if KYTHE_OUTPUT_FILE * is not set */ public abstract class AbstractJavacWrapper { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); protected abstract Collection<CompilationDescription> processCompilation( String[] arguments, JavaCompilationUnitExtractor javaCompilationUnitExtractor) throws Exception; protected abstract void passThrough(String[] args) throws Exception; /** * Given the command-line arguments to javac, construct a {@link CompilationUnit} and write it to * a .kindex file. Parameters to the extraction logic are passed by environment variables (see * class comment). */ public void process(String[] args) { JsonUtil.usingTypeRegistry(JsonUtil.JSON_TYPE_REGISTRY); try { if (!passThroughIfAnalysisOnly(args)) { Optional<String> vnamesConfig = EnvironmentUtils.tryReadEnvironmentVariable("KYTHE_VNAMES"); JavaCompilationUnitExtractor extractor; if (!vnamesConfig.isPresent()) { String corpus = EnvironmentUtils.defaultCorpus(); extractor = new JavaCompilationUnitExtractor( corpus, EnvironmentUtils.readEnvironmentVariable("KYTHE_ROOT_DIRECTORY")); } else { extractor = new JavaCompilationUnitExtractor( FileVNames.fromFile(vnamesConfig.get()), EnvironmentUtils.readEnvironmentVariable("KYTHE_ROOT_DIRECTORY")); } Collection<CompilationDescription> indexInfos = processCompilation(getCleanedUpArguments(args), extractor); outputIndexInfo(indexInfos); if (indexInfos.stream().anyMatch(cd -> cd.getCompilationUnit().getHasCompileErrors())) { System.err.println("Errors encountered during compilation"); System.exit(1); } } } catch (IOException e) { System.err.printf( "Unexpected IO error (probably while writing to index file): %s%n", e.toString()); System.err.println(Throwables.getStackTraceAsString(e)); System.exit(2); } catch (Exception e) { System.err.printf( "Unexpected error compiling and indexing java compilation: %s%n", e.toString()); System.err.println(Throwables.getStackTraceAsString(e)); System.exit(2); } } private static void outputIndexInfo(Collection<CompilationDescription> indexInfos) throws IOException { String outputFile = System.getenv("KYTHE_OUTPUT_FILE"); if (!Strings.isNullOrEmpty(outputFile)) { if (outputFile.endsWith(IndexInfoUtils.KZIP_FILE_EXT)) { IndexInfoUtils.writeKzipToFile(indexInfos, outputFile); } else { System.err.printf("Unsupported output file: %s%n", outputFile); System.exit(2); } return; } String outputDir = EnvironmentUtils.readEnvironmentVariable("KYTHE_OUTPUT_DIRECTORY"); // Just rely on the underlying compilation unit's signature to get the filename, if we're not // writing to a single kzip file. for (CompilationDescription indexInfo : indexInfos) { String name = indexInfo .getCompilationUnit() .getVName() .getSignature() .trim() .replaceAll("^/+|/+$", "") .replace('/', '_'); String path = IndexInfoUtils.getKzipPath(outputDir, name).toString(); IndexInfoUtils.writeKzipToFile(indexInfo, path); } } private static String[] getCleanedUpArguments(String[] args) throws IOException { // Expand all @file arguments List<String> expandedArgs = Lists.newArrayList(CommandLine.parse(args)); // We skip some arguments that would normally be passed to javac: // -J, these are flags to the java environment running javac. // -XD, these are internal flags used for special debug information // when compiling javac itself. // -Werror, we do not want to treat any warnings as errors. // -target, we do not care about the compiler outputs boolean skipArg = false; List<String> cleanedUpArgs = new ArrayList<>(); for (String arg : expandedArgs) { if (arg.equals("-target")) { skipArg = true; continue; } else if (!(skipArg || arg.startsWith("-J") || arg.startsWith("-XD") || arg.startsWith("-Werror") // The errorprone plugin complicates the build due to certain other // flags it requires (such as -XDcompilePolicy=byfile) and is not // necessary for extraction. || arg.startsWith("-Xplugin:ErrorProne"))) { cleanedUpArgs.add(arg); } skipArg = false; } String[] cleanedUpArgsArray = new String[cleanedUpArgs.size()]; return cleanedUpArgs.toArray(cleanedUpArgsArray); } private boolean passThroughIfAnalysisOnly(String[] args) throws Exception { // If '-proc:only' is passed as an argument, this is not a source file compilation, but an // analysis. We will let the real java compiler do its work. boolean hasProcOnly = false; for (String arg : args) { if (arg.equals("-proc:only")) { hasProcOnly = true; break; } } if (hasProcOnly) { passThrough(args); return true; } return false; } protected static String createTargetFromSourceFiles(List<String> sourceFiles) { List<String> sortedSourceFiles = Ordering.natural().sortedCopy(sourceFiles); String joinedSourceFiles = Joiner.on(":").join(sortedSourceFiles); return "#" + Hashing.sha256().hashUnencodedChars(joinedSourceFiles); } protected static List<String> splitPaths(String path) { return path == null ? Collections.<String>emptyList() : Splitter.on(':').splitToList(path); } protected static List<String> splitCSV(String lst) { return lst == null ? Collections.<String>emptyList() : Splitter.on(',').splitToList(lst); } static Optional<Integer> readSourcesBatchSize() { return EnvironmentUtils.tryReadEnvironmentVariable("KYTHE_JAVA_SOURCE_BATCH_SIZE") .map( s -> { try { return Integer.parseInt(s); } catch (NumberFormatException err) { logger.atWarning().withCause(err).log("Invalid KYTHE_JAVA_SOURCE_BATCH_SIZE"); return null; } }); } protected static List<String> getSourceList(Collection<File> files) { List<String> sources = new ArrayList<>(); for (File file : files) { sources.add(file.getPath()); } return sources; } }
3e0323bb98725285419e9c1e69f0c1cced7006ab
4,199
java
Java
src/main/java/com/google/security/zynamics/binnavi/Database/CDatabaseConnection.java
mayl8822/binnavi
4cfdd91cdda2a6150f537df91a8c4221ae50bb6d
[ "Apache-2.0" ]
3,083
2015-08-19T13:31:12.000Z
2022-03-30T09:22:21.000Z
src/main/java/com/google/security/zynamics/binnavi/Database/CDatabaseConnection.java
mayl8822/binnavi
4cfdd91cdda2a6150f537df91a8c4221ae50bb6d
[ "Apache-2.0" ]
99
2015-08-19T14:42:49.000Z
2021-04-13T10:58:32.000Z
src/main/java/com/google/security/zynamics/binnavi/Database/CDatabaseConnection.java
mayl8822/binnavi
4cfdd91cdda2a6150f537df91a8c4221ae50bb6d
[ "Apache-2.0" ]
613
2015-08-19T14:15:44.000Z
2022-03-26T04:40:55.000Z
41.99
103
0.769945
1,292
// Copyright 2011-2016 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException; import com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException; import com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException; import com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException; import com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseException; import com.google.security.zynamics.binnavi.Database.Exceptions.InvalidExporterDatabaseFormatException; import com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException; import com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseLoadProgressReporter; import com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider; import com.google.security.zynamics.binnavi.Resources.Constants; import com.google.security.zynamics.zylib.general.Pair; import java.sql.SQLException; /** * Creates connections to BinNavi databases. */ public final class CDatabaseConnection { /** * You are not supposed to instantiate this class. */ private CDatabaseConnection() { } /** * Reports progress to the user. * * @param reporter Notifies the user about events during database loading. * @param event The event to report to the user. * * @throws LoadCancelledException Thrown if the user canceled loading manually. */ private static void reportProgress(final IDatabaseLoadProgressReporter<LoadEvents> reporter, final LoadEvents event) throws LoadCancelledException { if (!reporter.report(event)) { throw new LoadCancelledException(); } } public static Pair<CConnection, SQLProvider> connect( final CDatabaseConfiguration m_databaseConfiguration, final IDatabaseLoadProgressReporter<LoadEvents> reporter) throws CouldntLoadDriverException, CouldntConnectException, CouldntInitializeDatabaseException, InvalidDatabaseException, InvalidExporterDatabaseFormatException, LoadCancelledException { try { reportProgress(reporter, LoadEvents.CONNECTING_TO_DATABASE); final CConnection connection = new CConnection(m_databaseConfiguration); final AbstractSQLProvider sql = new PostgreSQLProvider(connection); reportProgress(reporter, LoadEvents.CHECKING_EXPORTER_TABLE_FORMAT); if (!sql.isExporterDatabaseFormatValid()) { throw new InvalidExporterDatabaseFormatException( "E00202: Database exporter format is not compatible with " + Constants.PROJECT_NAME_VERSION); } reportProgress(reporter, LoadEvents.CHECKING_INITIALIZATION_STATUS); final DatabaseVersion databaseVersion = sql.getDatabaseVersion(); final DatabaseVersion currentVersion = new DatabaseVersion(Constants.PROJECT_VERSION); if ((databaseVersion.compareTo(currentVersion) == 0) && !sql.isInitialized()) { reportProgress(reporter, LoadEvents.INITIALIZING_DATABASE_TABLES); sql.initializeDatabase(); } if ((databaseVersion.compareTo(currentVersion) == 0) && !sql.isInitialized()) { throw new CouldntInitializeDatabaseException("E00052: Database could not be initialized."); } return new Pair<CConnection, SQLProvider>(connection, sql); } catch (final CouldntLoadDataException e) { throw new CouldntConnectException(e, 0, ""); } catch (final SQLException e) { throw new CouldntConnectException(e, e.getErrorCode(), e.getSQLState()); } } }
3e032465a75f37afee9ed28faf856ba9f32e3ef8
7,459
java
Java
krad/krad-web-framework/src/main/java/org/kuali/rice/krad/datadictionary/MaintenanceDocumentEntry.java
ua-eas/devops-automation-ksd-kc5.2.1-rice
4c2c124f650b12037948ed9c36560983e82b667d
[ "ECL-2.0" ]
null
null
null
krad/krad-web-framework/src/main/java/org/kuali/rice/krad/datadictionary/MaintenanceDocumentEntry.java
ua-eas/devops-automation-ksd-kc5.2.1-rice
4c2c124f650b12037948ed9c36560983e82b667d
[ "ECL-2.0" ]
null
null
null
krad/krad-web-framework/src/main/java/org/kuali/rice/krad/datadictionary/MaintenanceDocumentEntry.java
ua-eas/devops-automation-ksd-kc5.2.1-rice
4c2c124f650b12037948ed9c36560983e82b667d
[ "ECL-2.0" ]
null
null
null
35.369668
122
0.663942
1,293
/** * Copyright 2005-2015 The Kuali Foundation * * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.rice.krad.datadictionary; import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException; import org.kuali.rice.krad.datadictionary.exception.ClassValidationException; import org.kuali.rice.krad.document.Document; import org.kuali.rice.krad.maintenance.MaintenanceDocumentAuthorizer; import org.kuali.rice.krad.maintenance.MaintenanceDocumentAuthorizerBase; import org.kuali.rice.krad.maintenance.MaintenanceDocumentBase; import org.kuali.rice.krad.maintenance.Maintainable; import org.kuali.rice.krad.maintenance.MaintenanceDocumentPresentationControllerBase; import java.util.ArrayList; import java.util.List; /** * Data dictionary entry class for <code>MaintenanceDocument</code> * * @author Kuali Rice Team ([email protected]) */ public class MaintenanceDocumentEntry extends DocumentEntry { private static final long serialVersionUID = 4990040987835057251L; protected Class<?> dataObjectClass; protected Class<? extends Maintainable> maintainableClass; protected List<String> lockingKeys = new ArrayList<String>(); protected boolean allowsNewOrCopy = true; protected boolean preserveLockingKeysOnCopy = false; protected boolean allowsRecordDeletion = false; public MaintenanceDocumentEntry() { super(); setDocumentClass(getStandardDocumentBaseClass()); documentAuthorizerClass = MaintenanceDocumentAuthorizerBase.class; documentPresentationControllerClass = MaintenanceDocumentPresentationControllerBase.class; } public Class<? extends Document> getStandardDocumentBaseClass() { return MaintenanceDocumentBase.class; } /* This attribute is used in many contexts, for example, in maintenance docs, it's used to specify the classname of the BO being maintained. */ public void setDataObjectClass(Class<?> dataObjectClass) { if (dataObjectClass == null) { throw new IllegalArgumentException("invalid (null) dataObjectClass"); } this.dataObjectClass = dataObjectClass; } public Class<?> getDataObjectClass() { return dataObjectClass; } /** * @see org.kuali.rice.krad.datadictionary.DocumentEntry#getEntryClass() */ @SuppressWarnings("unchecked") @Override public Class getEntryClass() { return dataObjectClass; } /* The maintainableClass element specifies the name of the java class which is responsible for implementing the maintenance logic. The normal one is KualiMaintainableImpl.java. */ public void setMaintainableClass(Class<? extends Maintainable> maintainableClass) { if (maintainableClass == null) { throw new IllegalArgumentException("invalid (null) maintainableClass"); } this.maintainableClass = maintainableClass; } public Class<? extends Maintainable> getMaintainableClass() { return maintainableClass; } /** * @return List of all lockingKey fieldNames associated with this LookupDefinition, in the order in which they were * added */ public List<String> getLockingKeyFieldNames() { return lockingKeys; } /** * Gets the allowsNewOrCopy attribute. * * @return Returns the allowsNewOrCopy. */ public boolean getAllowsNewOrCopy() { return allowsNewOrCopy; } /** * The allowsNewOrCopy element contains a value of true or false. * If true, this indicates the maintainable should allow the * new and/or copy maintenance actions. */ public void setAllowsNewOrCopy(boolean allowsNewOrCopy) { this.allowsNewOrCopy = allowsNewOrCopy; } /** * Directly validate simple fields, call completeValidation on Definition fields. * * @see org.kuali.rice.krad.datadictionary.DocumentEntry#completeValidation() */ public void completeValidation() { super.completeValidation(); for (String lockingKey : lockingKeys) { if (!DataDictionary.isPropertyOf(dataObjectClass, lockingKey)) { throw new AttributeValidationException( "unable to find attribute '" + lockingKey + "' for lockingKey in dataObjectClass '" + dataObjectClass.getName()); } } for (ReferenceDefinition reference : defaultExistenceChecks) { reference.completeValidation(dataObjectClass, null); } if (documentAuthorizerClass != null && !MaintenanceDocumentAuthorizer.class.isAssignableFrom(documentAuthorizerClass)) { throw new ClassValidationException( "This maintenance document for '" + getDataObjectClass().getName() + "' has an invalid " + "documentAuthorizerClass ('" + documentAuthorizerClass.getName() + "'). " + "Maintenance Documents must use an implementation of MaintenanceDocumentAuthorizer."); } } /** * @see java.lang.Object#toString() */ public String toString() { return "MaintenanceDocumentEntry for documentType " + getDocumentTypeName(); } public List<String> getLockingKeys() { return lockingKeys; } /* The lockingKeys element specifies a list of fields that comprise a unique key. This is used for record locking during the file maintenance process. */ public void setLockingKeys(List<String> lockingKeys) { for (String lockingKey : lockingKeys) { if (lockingKey == null) { throw new IllegalArgumentException("invalid (null) lockingKey"); } } this.lockingKeys = lockingKeys; } /** * @return the preserveLockingKeysOnCopy */ public boolean getPreserveLockingKeysOnCopy() { return this.preserveLockingKeysOnCopy; } /** * @param preserveLockingKeysOnCopy the preserveLockingKeysOnCopy to set */ public void setPreserveLockingKeysOnCopy(boolean preserveLockingKeysOnCopy) { this.preserveLockingKeysOnCopy = preserveLockingKeysOnCopy; } /** * @return the allowRecordDeletion */ public boolean getAllowsRecordDeletion() { return this.allowsRecordDeletion; } /** * @param allowsRecordDeletion the allowRecordDeletion to set */ public void setAllowsRecordDeletion(boolean allowsRecordDeletion) { this.allowsRecordDeletion = allowsRecordDeletion; } }
3e0324831fa27b0e5dbb55f922b62999bef4b3e3
1,621
java
Java
src/main/java/org/zzz/actor/Pid.java
zzzming/java-dag-scheduler
932361dfbc7ae28ae380aeaa0e6eb802e2f56045
[ "Apache-2.0" ]
22
2017-01-11T18:00:44.000Z
2022-01-16T07:36:53.000Z
src/main/java/org/zzz/actor/Pid.java
zzzming/java-dag-scheduler
932361dfbc7ae28ae380aeaa0e6eb802e2f56045
[ "Apache-2.0" ]
null
null
null
src/main/java/org/zzz/actor/Pid.java
zzzming/java-dag-scheduler
932361dfbc7ae28ae380aeaa0e6eb802e2f56045
[ "Apache-2.0" ]
8
2017-11-10T10:01:47.000Z
2021-03-28T12:51:48.000Z
22.513889
84
0.598396
1,294
/** * */ package org.zzz.actor; import java.util.Map; import java.util.Optional; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; /** * @author ming luo * */ public final class Pid { private Map<String, UUID> pidMap = new ConcurrentHashMap<>(); private Map<UUID, Actor> actors = new ConcurrentHashMap<>(); /** * Private constructor. */ private Pid() {} /** * Thread safe singleton. * * @return the ResultProcessPlugin */ public static Pid getInstance() { return Loader.instance; } /** * Java memory model guarantees this class initialisation. */ private static class Loader { private static final Pid instance = new Pid(); } public void register(final String alias, final Actor actor) { if (null == pidMap.putIfAbsent(alias, actor.getPid())) { register(actor); } } public void register(final Actor actor) { actors.putIfAbsent(actor.getPid(), actor); } public UUID getPid(final String alias) { return pidMap.get(alias); } public void send (final UUID toId, final Object message, final UUID fromId) { new Thread(() -> { this.actors.get(toId).invoke(fromId, message); }).start(); } public void send (final String alias, final Object message, final UUID fromId) { Optional<UUID> op = Optional.of(getPid(alias)); if (op.isPresent()) { send(op.get(), message, fromId); } } public int getActorSize() { return this.actors.size(); } }
3e032488730c9ac373fff5b37e3dd8951d2e0e2f
376
java
Java
test/java/LIM2Metrics/ComplexityMetrics/NL_NLE_class_max/NL_NLE_class_max.java
sagodiz/SonarQube-plug-in
4f8e111baecc4c9f9eaa5cd3d7ebeb1e365ace2c
[ "BSD-4-Clause" ]
20
2015-06-16T17:39:10.000Z
2022-03-20T22:39:40.000Z
test/java/LIM2Metrics/ComplexityMetrics/NL_NLE_class_max/NL_NLE_class_max.java
sagodiz/SonarQube-plug-in
4f8e111baecc4c9f9eaa5cd3d7ebeb1e365ace2c
[ "BSD-4-Clause" ]
29
2015-12-29T19:07:22.000Z
2022-03-22T10:39:02.000Z
test/java/LIM2Metrics/ComplexityMetrics/NL_NLE_class_max/NL_NLE_class_max.java
sagodiz/SonarQube-plug-in
4f8e111baecc4c9f9eaa5cd3d7ebeb1e365ace2c
[ "BSD-4-Clause" ]
12
2015-08-28T01:22:18.000Z
2021-09-25T08:17:31.000Z
13.428571
42
0.449468
1,295
package regtest; //NL = 3, NLE = 2 class NL_NLE_class_max{ //NL = 1, NLE = 1 void foo(){ if(true){} else{} } //NL = 2, NLE = 2 void goo(){ if(true){ while(true){} } else{} } //NL = 3, NLE = 1 void hoo(){ if(true){} else if(true){} else if(true){} } public static void main(String[] args){} }
3e0324b11ea0bfc2f8dc67f7d673ff55edeed9de
1,891
java
Java
sylph-spi/src/main/java/com/github/harbby/sylph/spi/job/JobParser.java
wuchunfu/sylph
59874af86fc5d7147390a1d4bd3483596e3108d9
[ "Apache-2.0" ]
2
2018-06-19T05:32:05.000Z
2018-06-22T03:32:58.000Z
sylph-spi/src/main/java/com/github/harbby/sylph/spi/job/JobParser.java
ideal-hp/sylph
59874af86fc5d7147390a1d4bd3483596e3108d9
[ "Apache-2.0" ]
null
null
null
sylph-spi/src/main/java/com/github/harbby/sylph/spi/job/JobParser.java
ideal-hp/sylph
59874af86fc5d7147390a1d4bd3483596e3108d9
[ "Apache-2.0" ]
null
null
null
25.554054
76
0.644632
1,296
/* * Copyright (C) 2018 The Sylph Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.harbby.sylph.spi.job; import com.github.harbby.sylph.spi.OperatorType; import java.io.Serializable; import java.util.Collections; import java.util.Set; public abstract class JobParser implements Serializable { public Set<DependOperator> getDependOperators() { return Collections.emptySet(); } @Override public abstract String toString(); public static class DependOperator implements Serializable { private final String connector; private final OperatorType type; private String className; public DependOperator(String connector, OperatorType type) { this.connector = connector; this.type = type; } public static DependOperator of(String className, OperatorType type) { return new DependOperator(className, type); } public void setClassName(String className) { this.className = className; } public String getClassName() { return className; } public OperatorType getType() { return type; } public String getConnector() { return connector; } } }
3e0324f3c0fb0d04707f0c3994c72d6c93922042
2,002
java
Java
src/ReligionClient/src/main/java/com/rss/reqeust/AddressModel.java
script-brew/2020-01_software-architecture_term-project
b051e726e08a99cd8f3c4c402e75dc29ed645b32
[ "MIT" ]
null
null
null
src/ReligionClient/src/main/java/com/rss/reqeust/AddressModel.java
script-brew/2020-01_software-architecture_term-project
b051e726e08a99cd8f3c4c402e75dc29ed645b32
[ "MIT" ]
null
null
null
src/ReligionClient/src/main/java/com/rss/reqeust/AddressModel.java
script-brew/2020-01_software-architecture_term-project
b051e726e08a99cd8f3c4c402e75dc29ed645b32
[ "MIT" ]
null
null
null
20.639175
110
0.593407
1,297
package com.rss.reqeust; import com.google.gson.annotations.SerializedName; import com.rss.entity.Address; public class AddressModel { @SerializedName("id") private int id; @SerializedName("city") private String city; @SerializedName("gu") private String gu; @SerializedName("dong") private String dong; @SerializedName("zibun") private int zibun; @SerializedName("postalCode") private String postalCode; @SerializedName("apartment") private String apartment; public AddressModel() { id = 0; } public AddressModel(String city, String gu, String dong, int zibun, String postalCode, String apartment) { this(); this.city = city; this.gu = gu; this.dong = dong; this.zibun = zibun; this.postalCode = postalCode; this.apartment = apartment; } public Address toAddress() { Address address = new Address(city, gu, dong, zibun, postalCode, apartment); address.setId(id); return address; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getGu() { return gu; } public void setGu(String gu) { this.gu = gu; } public String getDong() { return dong; } public void setDong(String dong) { this.dong = dong; } public int getZibun() { return zibun; } public void setZibun(int zibun) { this.zibun = zibun; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public String getApartment() { return apartment; } public void setApartment(String apartment) { this.apartment = apartment; } }
3e03258d6a67c52da2233ac73f9287c01f9d057e
1,153
java
Java
InformationMachineAPILib/src/main/java/co/iamdata/api/models/GetUserProducts.java
information-machine/information-machine-api-android
1e110f1eabc9c107efe4b1e8b92f22c42dc736f3
[ "MIT" ]
2
2015-06-04T14:32:33.000Z
2015-06-05T13:46:01.000Z
InformationMachineAPILib/src/main/java/co/iamdata/api/models/GetUserProducts.java
information-machine/information-machine-api-android
1e110f1eabc9c107efe4b1e8b92f22c42dc736f3
[ "MIT" ]
null
null
null
InformationMachineAPILib/src/main/java/co/iamdata/api/models/GetUserProducts.java
information-machine/information-machine-api-android
1e110f1eabc9c107efe4b1e8b92f22c42dc736f3
[ "MIT" ]
1
2019-04-21T21:31:55.000Z
2019-04-21T21:31:55.000Z
23.06
70
0.639202
1,298
/* * InformationMachineAPILib * * */ package co.iamdata.api.models; import java.util.*; import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonSetter; public class GetUserProducts implements java.io.Serializable { private static final long serialVersionUID = 5456585329483068911L; private MetaPaged meta; private List<ProductData> result; /** GETTER * TODO: Write general description for this method */ @JsonGetter("meta") public MetaPaged getMeta ( ) { return this.meta; } /** SETTER * TODO: Write general description for this method */ @JsonSetter("meta") public void setMeta (MetaPaged value) { this.meta = value; } /** GETTER * TODO: Write general description for this method */ @JsonGetter("result") public List<ProductData> getResult ( ) { return this.result; } /** SETTER * TODO: Write general description for this method */ @JsonSetter("result") public void setResult (List<ProductData> value) { this.result = value; } }
3e0326a62bf1a2161a8f034ca66f2ac2619a8224
459
java
Java
app/src/main/java/org/wjh/mylib/bean/Photos.java
MyAndroidStore/MyLib
9566aecb34ddea2f29ec00c494511a90eba5dd06
[ "Apache-2.0" ]
null
null
null
app/src/main/java/org/wjh/mylib/bean/Photos.java
MyAndroidStore/MyLib
9566aecb34ddea2f29ec00c494511a90eba5dd06
[ "Apache-2.0" ]
null
null
null
app/src/main/java/org/wjh/mylib/bean/Photos.java
MyAndroidStore/MyLib
9566aecb34ddea2f29ec00c494511a90eba5dd06
[ "Apache-2.0" ]
null
null
null
15.827586
44
0.555556
1,299
package org.wjh.mylib.bean; public class Photos { private String uri; private String path; public Photos(String uri, String path) { this.uri = uri; this.path = path; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } }
3e0326a7cf1c94a40f35f076950da5bea6c05fba
25,206
java
Java
services/cbs/src/main/java/com/huaweicloud/sdk/cbs/v1/CbsMeta.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
50
2020-05-18T11:35:20.000Z
2022-03-15T02:07:05.000Z
services/cbs/src/main/java/com/huaweicloud/sdk/cbs/v1/CbsMeta.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
45
2020-07-06T03:34:12.000Z
2022-03-31T09:41:54.000Z
services/cbs/src/main/java/com/huaweicloud/sdk/cbs/v1/CbsMeta.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
27
2020-05-28T11:08:44.000Z
2022-03-30T03:30:37.000Z
40.200957
146
0.627271
1,300
package com.huaweicloud.sdk.cbs.v1; import com.huaweicloud.sdk.core.TypeCasts; import com.huaweicloud.sdk.core.http.FieldExistence; import com.huaweicloud.sdk.core.http.HttpMethod; import com.huaweicloud.sdk.core.http.HttpRequestDef; import com.huaweicloud.sdk.core.http.LocationType; import com.huaweicloud.sdk.cbs.v1.model.*; import java.util.List; import java.util.Map; import java.time.OffsetDateTime; @SuppressWarnings("unchecked") public class CbsMeta { public static final HttpRequestDef<CollectHotQuestionsRequest, CollectHotQuestionsResponse> collectHotQuestions = genForcollectHotQuestions(); private static HttpRequestDef<CollectHotQuestionsRequest, CollectHotQuestionsResponse> genForcollectHotQuestions() { // basic HttpRequestDef.Builder<CollectHotQuestionsRequest, CollectHotQuestionsResponse> builder = HttpRequestDef.builder(HttpMethod.GET, CollectHotQuestionsRequest.class, CollectHotQuestionsResponse.class) .withName("CollectHotQuestions") .withUri("/v1/{project_id}/qabots/{qabot_id}/qa-pairs/hots") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("start_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getStartTime, (req, v) -> { req.setStartTime(v); }) ); builder.<String>withRequestField("end_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getEndTime, (req, v) -> { req.setEndTime(v); }) ); builder.<String>withRequestField("top", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getTop, (req, v) -> { req.setTop(v); }) ); builder.<String>withRequestField("domain", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getDomain, (req, v) -> { req.setDomain(v); }) ); builder.<String>withRequestField("domain_id", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getDomainId, (req, v) -> { req.setDomainId(v); }) ); builder.<Boolean>withRequestField("exclude", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(Boolean.class), f -> f.withMarshaller(CollectHotQuestionsRequest::getExclude, (req, v) -> { req.setExclude(v); }) ); // response return builder.build(); } public static final HttpRequestDef<CollectKeyWordsRequest, CollectKeyWordsResponse> collectKeyWords = genForcollectKeyWords(); private static HttpRequestDef<CollectKeyWordsRequest, CollectKeyWordsResponse> genForcollectKeyWords() { // basic HttpRequestDef.Builder<CollectKeyWordsRequest, CollectKeyWordsResponse> builder = HttpRequestDef.builder(HttpMethod.GET, CollectKeyWordsRequest.class, CollectKeyWordsResponse.class) .withName("CollectKeyWords") .withUri("/v1/{project_id}/qabots/{qabot_id}/requests/keywords") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectKeyWordsRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("start_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectKeyWordsRequest::getStartTime, (req, v) -> { req.setStartTime(v); }) ); builder.<String>withRequestField("end_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectKeyWordsRequest::getEndTime, (req, v) -> { req.setEndTime(v); }) ); builder.<Integer>withRequestField("top", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(Integer.class), f -> f.withMarshaller(CollectKeyWordsRequest::getTop, (req, v) -> { req.setTop(v); }) ); // response return builder.build(); } public static final HttpRequestDef<CollectReplyRatesRequest, CollectReplyRatesResponse> collectReplyRates = genForcollectReplyRates(); private static HttpRequestDef<CollectReplyRatesRequest, CollectReplyRatesResponse> genForcollectReplyRates() { // basic HttpRequestDef.Builder<CollectReplyRatesRequest, CollectReplyRatesResponse> builder = HttpRequestDef.builder(HttpMethod.GET, CollectReplyRatesRequest.class, CollectReplyRatesResponse.class) .withName("CollectReplyRates") .withUri("/v1/{project_id}/qabots/{qabot_id}/requests/reply-rates") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectReplyRatesRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("start_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectReplyRatesRequest::getStartTime, (req, v) -> { req.setStartTime(v); }) ); builder.<String>withRequestField("end_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectReplyRatesRequest::getEndTime, (req, v) -> { req.setEndTime(v); }) ); builder.<CollectReplyRatesRequest.IntervalEnum>withRequestField("interval", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(CollectReplyRatesRequest.IntervalEnum.class), f -> f.withMarshaller(CollectReplyRatesRequest::getInterval, (req, v) -> { req.setInterval(v); }) ); builder.<String>withRequestField("time_zone", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectReplyRatesRequest::getTimeZone, (req, v) -> { req.setTimeZone(v); }) ); builder.<String>withRequestField("domain", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectReplyRatesRequest::getDomain, (req, v) -> { req.setDomain(v); }) ); // response return builder.build(); } public static final HttpRequestDef<CollectSessionStatsRequest, CollectSessionStatsResponse> collectSessionStats = genForcollectSessionStats(); private static HttpRequestDef<CollectSessionStatsRequest, CollectSessionStatsResponse> genForcollectSessionStats() { // basic HttpRequestDef.Builder<CollectSessionStatsRequest, CollectSessionStatsResponse> builder = HttpRequestDef.builder(HttpMethod.GET, CollectSessionStatsRequest.class, CollectSessionStatsResponse.class) .withName("CollectSessionStats") .withUri("/v1/{project_id}/qabots/{qabot_id}/requests/session-stats") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectSessionStatsRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("start_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectSessionStatsRequest::getStartTime, (req, v) -> { req.setStartTime(v); }) ); builder.<String>withRequestField("end_time", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectSessionStatsRequest::getEndTime, (req, v) -> { req.setEndTime(v); }) ); builder.<CollectSessionStatsRequest.IntervalEnum>withRequestField("interval", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(CollectSessionStatsRequest.IntervalEnum.class), f -> f.withMarshaller(CollectSessionStatsRequest::getInterval, (req, v) -> { req.setInterval(v); }) ); builder.<String>withRequestField("time_zone", LocationType.Query, FieldExistence.NULL_IGNORE, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CollectSessionStatsRequest::getTimeZone, (req, v) -> { req.setTimeZone(v); }) ); // response return builder.build(); } public static final HttpRequestDef<CreateSessionRequest, CreateSessionResponse> createSession = genForcreateSession(); private static HttpRequestDef<CreateSessionRequest, CreateSessionResponse> genForcreateSession() { // basic HttpRequestDef.Builder<CreateSessionRequest, CreateSessionResponse> builder = HttpRequestDef.builder(HttpMethod.POST, CreateSessionRequest.class, CreateSessionResponse.class) .withName("CreateSession") .withUri("/v1/{project_id}/qabots/{qabot_id}/sessions") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CreateSessionRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); // response return builder.build(); } public static final HttpRequestDef<CreateTbSessionRequest, CreateTbSessionResponse> createTbSession = genForcreateTbSession(); private static HttpRequestDef<CreateTbSessionRequest, CreateTbSessionResponse> genForcreateTbSession() { // basic HttpRequestDef.Builder<CreateTbSessionRequest, CreateTbSessionResponse> builder = HttpRequestDef.builder(HttpMethod.POST, CreateTbSessionRequest.class, CreateTbSessionResponse.class) .withName("CreateTbSession") .withUri("/v1/{project_id}/taskbot/voicecall/bots/{bot_id}/sessions") .withContentType("application/json"); // requests builder.<String>withRequestField("bot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(CreateTbSessionRequest::getBotId, (req, v) -> { req.setBotId(v); }) ); // response return builder.build(); } public static final HttpRequestDef<DeleteSessionRequest, DeleteSessionResponse> deleteSession = genFordeleteSession(); private static HttpRequestDef<DeleteSessionRequest, DeleteSessionResponse> genFordeleteSession() { // basic HttpRequestDef.Builder<DeleteSessionRequest, DeleteSessionResponse> builder = HttpRequestDef.builder(HttpMethod.DELETE, DeleteSessionRequest.class, DeleteSessionResponse.class) .withName("DeleteSession") .withUri("/v1/{project_id}/qabots/{qabot_id}/sessions/{session_id}") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(DeleteSessionRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("session_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(DeleteSessionRequest::getSessionId, (req, v) -> { req.setSessionId(v); }) ); // response return builder.build(); } public static final HttpRequestDef<DeleteTbSessionRequest, DeleteTbSessionResponse> deleteTbSession = genFordeleteTbSession(); private static HttpRequestDef<DeleteTbSessionRequest, DeleteTbSessionResponse> genFordeleteTbSession() { // basic HttpRequestDef.Builder<DeleteTbSessionRequest, DeleteTbSessionResponse> builder = HttpRequestDef.builder(HttpMethod.DELETE, DeleteTbSessionRequest.class, DeleteTbSessionResponse.class) .withName("DeleteTbSession") .withUri("/v1/{project_id}/taskbot/voicecall/bots/{bot_id}/sessions/{session_id}") .withContentType("application/json"); // requests builder.<String>withRequestField("bot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(DeleteTbSessionRequest::getBotId, (req, v) -> { req.setBotId(v); }) ); builder.<String>withRequestField("session_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(DeleteTbSessionRequest::getSessionId, (req, v) -> { req.setSessionId(v); }) ); // response return builder.build(); } public static final HttpRequestDef<ExecuteQaChatRequest, ExecuteQaChatResponse> executeQaChat = genForexecuteQaChat(); private static HttpRequestDef<ExecuteQaChatRequest, ExecuteQaChatResponse> genForexecuteQaChat() { // basic HttpRequestDef.Builder<ExecuteQaChatRequest, ExecuteQaChatResponse> builder = HttpRequestDef.builder(HttpMethod.POST, ExecuteQaChatRequest.class, ExecuteQaChatResponse.class) .withName("ExecuteQaChat") .withUri("/v1/{project_id}/qabots/{qabot_id}/chat") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(ExecuteQaChatRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<PostRequestsReq>withRequestField("body", LocationType.Body, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(PostRequestsReq.class), f -> f.withMarshaller(ExecuteQaChatRequest::getBody, (req, v) -> { req.setBody(v); }) ); // response return builder.build(); } public static final HttpRequestDef<ExecuteSessionRequest, ExecuteSessionResponse> executeSession = genForexecuteSession(); private static HttpRequestDef<ExecuteSessionRequest, ExecuteSessionResponse> genForexecuteSession() { // basic HttpRequestDef.Builder<ExecuteSessionRequest, ExecuteSessionResponse> builder = HttpRequestDef.builder(HttpMethod.POST, ExecuteSessionRequest.class, ExecuteSessionResponse.class) .withName("ExecuteSession") .withUri("/v1/{project_id}/qabots/{qabot_id}/sessions/{session_id}") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(ExecuteSessionRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("session_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(ExecuteSessionRequest::getSessionId, (req, v) -> { req.setSessionId(v); }) ); builder.<PostQaSessionReq>withRequestField("body", LocationType.Body, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(PostQaSessionReq.class), f -> f.withMarshaller(ExecuteSessionRequest::getBody, (req, v) -> { req.setBody(v); }) ); // response return builder.build(); } public static final HttpRequestDef<ExecuteTbSessionRequest, ExecuteTbSessionResponse> executeTbSession = genForexecuteTbSession(); private static HttpRequestDef<ExecuteTbSessionRequest, ExecuteTbSessionResponse> genForexecuteTbSession() { // basic HttpRequestDef.Builder<ExecuteTbSessionRequest, ExecuteTbSessionResponse> builder = HttpRequestDef.builder(HttpMethod.POST, ExecuteTbSessionRequest.class, ExecuteTbSessionResponse.class) .withName("ExecuteTbSession") .withUri("/v1/{project_id}/taskbot/voicecall/bots/{bot_id}/sessions/{session_id}") .withContentType("application/json"); // requests builder.<String>withRequestField("bot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(ExecuteTbSessionRequest::getBotId, (req, v) -> { req.setBotId(v); }) ); builder.<String>withRequestField("session_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(ExecuteTbSessionRequest::getSessionId, (req, v) -> { req.setSessionId(v); }) ); builder.<ExecuteTbSessionReq>withRequestField("body", LocationType.Body, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(ExecuteTbSessionReq.class), f -> f.withMarshaller(ExecuteTbSessionRequest::getBody, (req, v) -> { req.setBody(v); }) ); // response return builder.build(); } public static final HttpRequestDef<ListSuggestionsRequest, ListSuggestionsResponse> listSuggestions = genForlistSuggestions(); private static HttpRequestDef<ListSuggestionsRequest, ListSuggestionsResponse> genForlistSuggestions() { // basic HttpRequestDef.Builder<ListSuggestionsRequest, ListSuggestionsResponse> builder = HttpRequestDef.builder(HttpMethod.POST, ListSuggestionsRequest.class, ListSuggestionsResponse.class) .withName("ListSuggestions") .withUri("/v1/{project_id}/qabots/{qabot_id}/suggestions") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(ListSuggestionsRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<PostSuggestionsReq>withRequestField("body", LocationType.Body, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(PostSuggestionsReq.class), f -> f.withMarshaller(ListSuggestionsRequest::getBody, (req, v) -> { req.setBody(v); }) ); // response return builder.build(); } public static final HttpRequestDef<TagLaborRequest, TagLaborResponse> tagLabor = genFortagLabor(); private static HttpRequestDef<TagLaborRequest, TagLaborResponse> genFortagLabor() { // basic HttpRequestDef.Builder<TagLaborRequest, TagLaborResponse> builder = HttpRequestDef.builder(HttpMethod.POST, TagLaborRequest.class, TagLaborResponse.class) .withName("TagLabor") .withUri("/v1/{project_id}/qabots/{qabot_id}/requests/{request_id}/labor") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(TagLaborRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("request_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(TagLaborRequest::getRequestId, (req, v) -> { req.setRequestId(v); }) ); // response return builder.build(); } public static final HttpRequestDef<TagSatisfactionRequest, TagSatisfactionResponse> tagSatisfaction = genFortagSatisfaction(); private static HttpRequestDef<TagSatisfactionRequest, TagSatisfactionResponse> genFortagSatisfaction() { // basic HttpRequestDef.Builder<TagSatisfactionRequest, TagSatisfactionResponse> builder = HttpRequestDef.builder(HttpMethod.POST, TagSatisfactionRequest.class, TagSatisfactionResponse.class) .withName("TagSatisfaction") .withUri("/v1/{project_id}/qabots/{qabot_id}/requests/{request_id}/satisfaction") .withContentType("application/json"); // requests builder.<String>withRequestField("qabot_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(TagSatisfactionRequest::getQabotId, (req, v) -> { req.setQabotId(v); }) ); builder.<String>withRequestField("request_id", LocationType.Path, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(String.class), f -> f.withMarshaller(TagSatisfactionRequest::getRequestId, (req, v) -> { req.setRequestId(v); }) ); builder.<PostSatisfactionReq>withRequestField("body", LocationType.Body, FieldExistence.NON_NULL_NON_EMPTY, TypeCasts.uncheckedConversion(PostSatisfactionReq.class), f -> f.withMarshaller(TagSatisfactionRequest::getBody, (req, v) -> { req.setBody(v); }) ); // response return builder.build(); } }
3e0326ffd6ec277238db1f3f1abca8de799e1a0d
1,280
java
Java
modules/system/src/main/java/com/nonelonely/modules/system/service/TagService.java
fangrx/my-blog
85813412fb790f3e90cbce7092ad156a99f7eff1
[ "Apache-2.0" ]
null
null
null
modules/system/src/main/java/com/nonelonely/modules/system/service/TagService.java
fangrx/my-blog
85813412fb790f3e90cbce7092ad156a99f7eff1
[ "Apache-2.0" ]
null
null
null
modules/system/src/main/java/com/nonelonely/modules/system/service/TagService.java
fangrx/my-blog
85813412fb790f3e90cbce7092ad156a99f7eff1
[ "Apache-2.0" ]
null
null
null
20.645161
69
0.65
1,301
package com.nonelonely.modules.system.service; import com.nonelonely.common.enums.StatusEnum; import com.nonelonely.modules.system.domain.Tag; import com.nonelonely.modules.system.domain.bo.TagBO; import org.springframework.data.domain.Example; import org.springframework.data.domain.Page; import org.springframework.data.jpa.repository.Query; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; /** * @author nonelonely * @date 2020/01/01 */ public interface TagService { /** * 获取分页列表数据 * @param example 查询实例 * @return 返回分页数据 */ Page<Tag> getPageList(Example<Tag> example); /** * 根据ID查询数据 * @param id 主键ID */ Tag getById(Long id); /** * 保存数据 * @param tag 实体对象 */ Tag save(Tag tag); /** * 状态(启用,冻结,删除)/批量状态处理 */ @Transactional Boolean updateStatus(StatusEnum statusEnum, List<Long> idList); /** * 查找文章/笔记相关tag并selected * * @param referId * @param type 文章还是笔记{@code TagType} * @return */ List<TagBO> findSelectedTagsByReferId(Long referId, String type); /** * 查询标签使用数到首页标签面板上显示 * * @return */ List<Map<String, Object>> findTagsTab(int limlt); }
3e032713782bf8bc3bc6198976f3ed991ff043e4
1,148
java
Java
zhq-core/src/main/java/cn/zhuhongqing/utils/loader/WebResourceLoader.java
legend0702/zhq
dd8706069cd65ae554d26fc782d8e3199aa1d44b
[ "Apache-2.0" ]
3
2016-05-28T10:52:28.000Z
2017-12-22T07:31:24.000Z
zhq-core/src/main/java/cn/zhuhongqing/utils/loader/WebResourceLoader.java
legend0702/zhq
dd8706069cd65ae554d26fc782d8e3199aa1d44b
[ "Apache-2.0" ]
null
null
null
zhq-core/src/main/java/cn/zhuhongqing/utils/loader/WebResourceLoader.java
legend0702/zhq
dd8706069cd65ae554d26fc782d8e3199aa1d44b
[ "Apache-2.0" ]
1
2017-12-22T07:31:41.000Z
2017-12-22T07:31:41.000Z
22.509804
76
0.730836
1,302
package cn.zhuhongqing.utils.loader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import cn.zhuhongqing.exception.UtilsException; import cn.zhuhongqing.utils.StringPool; /** * Load reource from jar which is under the WEB-INF/lib.(Suppose this jar is * inside your WEB-INF/lib) * * @author HongQing.Zhu * */ public class WebResourceLoader implements ResourceLoader { static String root; static { try { String path = ClassLoader.getSystemClassLoader() .getResource(StringPool.EMPTY).toURI().getPath(); root = new File(path).getParentFile().getParentFile() .getCanonicalPath(); root = root == null ? StringPool.EMPTY : root; } catch (IOException | URISyntaxException e) { throw new UtilsException(e); } } public File loadAsFile(String path) { return new File(root, path); } public InputStream loaderAsStream(String path) { try { return new FileInputStream(loadAsFile(path)); } catch (FileNotFoundException e) { throw new UtilsException(e); } } }
3e0327730f749e8274b441d88c604d876e9076ee
1,290
java
Java
src/main/java/dev/sebastianb/wackyvessels/block/VesselChair.java
Terra-Studios/WackyVessels
521759479a535f92f5c23bdb09f0a3e5740f5763
[ "MIT" ]
1
2021-06-18T01:30:02.000Z
2021-06-18T01:30:02.000Z
src/main/java/dev/sebastianb/wackyvessels/block/VesselChair.java
SebaSphere/WackyVessels
521759479a535f92f5c23bdb09f0a3e5740f5763
[ "MIT" ]
null
null
null
src/main/java/dev/sebastianb/wackyvessels/block/VesselChair.java
SebaSphere/WackyVessels
521759479a535f92f5c23bdb09f0a3e5740f5763
[ "MIT" ]
2
2021-06-23T14:22:13.000Z
2021-06-28T16:02:38.000Z
40.3125
128
0.755814
1,303
package dev.sebastianb.wackyvessels.block; import dev.sebastianb.wackyvessels.entity.SitEntity; import dev.sebastianb.wackyvessels.entity.WackyVesselsEntityTypes; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.StairsBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class VesselChair extends StairsBlock { public VesselChair(Settings settings) { super(Blocks.COBBLESTONE.getDefaultState(), settings); // default is cobblestone since I can't be bothered rn to look into how it actually works } @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { SitEntity entity = new SitEntity(WackyVesselsEntityTypes.SIT_ENTITY, world, state.get(FACING)); entity.updatePosition(pos.getX(), pos.getY(), pos.getZ()); player.updatePosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); world.spawnEntity(entity); player.startRiding(entity); return ActionResult.SUCCESS; } }
3e0327f83e7602b17ca4d3eb6f8bdf97cc7b4b95
5,062
java
Java
Corpus/swt/107.java
JamesCao2048/BlizzardData
a524bec4f0d297bb748234eeb1c2fcdee3dce7d7
[ "MIT" ]
1
2022-01-15T02:47:45.000Z
2022-01-15T02:47:45.000Z
Corpus/swt/107.java
JamesCao2048/BlizzardData
a524bec4f0d297bb748234eeb1c2fcdee3dce7d7
[ "MIT" ]
null
null
null
Corpus/swt/107.java
JamesCao2048/BlizzardData
a524bec4f0d297bb748234eeb1c2fcdee3dce7d7
[ "MIT" ]
null
null
null
31.055215
132
0.719281
1,304
/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation 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: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.tests.junit; import junit.framework.*; import junit.textui.*; import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.graphics.*; /** * Automated Test Suite for class org.eclipse.swt.widgets.Label * * @see org.eclipse.swt.widgets.Label */ public class Test_org_eclipse_swt_widgets_Label extends Test_org_eclipse_swt_widgets_Control { public Test_org_eclipse_swt_widgets_Label(String name) { super(name); } public static void main(String[] args) { TestRunner.run(suite()); } @Override protected void setUp() { super.setUp(); label = new Label(shell, 0); setWidget(label); } @Override public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){ try { label = new Label(null, 0); fail("No exception thrown"); //should never get here } catch (IllegalArgumentException e) { } label = new Label(shell, 0); int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER, SWT.SEPARATOR, SWT.HORIZONTAL, SWT.VERTICAL, SWT.SHADOW_IN, SWT.SHADOW_OUT}; for (int i = 0; i < cases.length; i++) label = new Label(shell, cases[i]); } @Override public void test_computeSizeIIZ() { // super class test is sufficient } public void test_getAlignment(){ int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER}; for (int i=0; i<cases.length; i++) { label = new Label(shell, cases[i]); assertEquals(label.getAlignment(), cases[i]); } } public void test_getImage(){ Image[] cases = {null, new Image(null, 100, 100)}; for(int i=0; i<cases.length; i++){ label.setImage(cases[i]); assertEquals(label.getImage(), cases[i]); if (cases[i]!=null) cases[i].dispose(); } } public void test_getText(){ String[] cases = {"", "some name", "sdasdlkjshcdascecoewcwe"}; for(int i=0; i<cases.length; i++){ label.setText(cases[i]); assertEquals(label.getText(), cases[i]); } } public void test_setAlignmentI(){ int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER}; for (int i=0; i<cases.length; i++) { label.setAlignment(cases[i]); assertEquals(label.getAlignment(), cases[i]); } } @Override public void test_setFocus() { // super class test is sufficient } public void test_setTextLjava_lang_String(){ try { label.setText(null); fail("No exception thrown for string == null"); } catch (IllegalArgumentException e) { } } public static Test suite() { TestSuite suite = new TestSuite(); java.util.Vector<String> methodNames = methodNames(); java.util.Enumeration<String> e = methodNames.elements(); while (e.hasMoreElements()) { suite.addTest(new Test_org_eclipse_swt_widgets_Label(e.nextElement())); } return suite; } public static java.util.Vector<String> methodNames() { java.util.Vector<String> methodNames = new java.util.Vector<String>(); methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); methodNames.addElement("test_computeSizeIIZ"); methodNames.addElement("test_getAlignment"); methodNames.addElement("test_getImage"); methodNames.addElement("test_getText"); methodNames.addElement("test_setAlignmentI"); methodNames.addElement("test_setFocus"); methodNames.addElement("test_setTextLjava_lang_String"); methodNames.addElement("test_consistency_MenuDetect"); methodNames.addElement("test_consistency_DragDetect"); methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names return methodNames; } @Override protected void runTest() throws Throwable { if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); else if (getName().equals("test_getAlignment")) test_getAlignment(); else if (getName().equals("test_getImage")) test_getImage(); else if (getName().equals("test_getText")) test_getText(); else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); else if (getName().equals("test_setFocus")) test_setFocus(); else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); else if (getName().equals("test_consistency_MenuDetect")) test_consistency_MenuDetect(); else if (getName().equals("test_consistency_DragDetect")) test_consistency_DragDetect(); else super.runTest(); } /* custom */ Label label; public void test_consistency_MenuDetect () { consistencyEvent(10, 5, 3, 0, ConsistencyUtility.MOUSE_CLICK); } public void test_consistency_DragDetect () { consistencyEvent(10, 5, 20, 10, ConsistencyUtility.MOUSE_DRAG); } }
3e03285c05c28fc859aea9de7e1e59f52740b5d6
2,431
java
Java
src/main/java/site/teamo/leetcode2/q888/Solution.java
telundusiji/leet-code
6befe815d6afed8a67b92c5aa05f551226043a67
[ "MIT" ]
null
null
null
src/main/java/site/teamo/leetcode2/q888/Solution.java
telundusiji/leet-code
6befe815d6afed8a67b92c5aa05f551226043a67
[ "MIT" ]
null
null
null
src/main/java/site/teamo/leetcode2/q888/Solution.java
telundusiji/leet-code
6befe815d6afed8a67b92c5aa05f551226043a67
[ "MIT" ]
null
null
null
21.900901
87
0.426162
1,305
package site.teamo.leetcode2.q888; /** * @author 爱做梦的锤子 * @create 2021/2/1 */ import java.util.HashSet; /** * 888. 公平的糖果棒交换 * 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 根糖果棒的大小,B[j] 是鲍勃拥有的第 j 根糖果棒的大小。 * <p> * 因为他们是朋友,所以他们想交换一根糖果棒,这样交换后,他们都有相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的总和。) * <p> * 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大小,ans[1] 是 Bob 必须交换的糖果棒的大小。 * <p> * 如果有多个答案,你可以返回其中任何一个。保证答案存在。 * <p> * <p> * <p> * 示例 1: * <p> * 输入:A = [1,1], B = [2,2] * 输出:[1,2] * 示例 2: * <p> * 输入:A = [1,2], B = [2,3] * 输出:[1,2] * 示例 3: * <p> * 输入:A = [2], B = [1,3] * 输出:[2,3] * 示例 4: * <p> * 输入:A = [1,2,5], B = [2,4] * 输出:[5,4] * <p> * <p> * 提示: * <p> * 1 <= A.length <= 10000 * 1 <= B.length <= 10000 * 1 <= A[i] <= 100000 * 1 <= B[i] <= 100000 * 保证爱丽丝与鲍勃的糖果总量不同。 * 答案肯定存在。 */ public class Solution { public int[] fairCandySwap(int[] A, int[] B) { int sumA = 0; int sumB = 0; for (int i : A) { sumA = sumA + i; } for (int i : B) { sumB = sumB + i; } for (int i = 0; i < A.length; i++) { for (int j = 0; j < B.length; j++) { if (isFair(A[i], B[j], sumA, sumB)) { int[] result = new int[2]; result[0] = A[i]; result[1] = B[j]; return result; } } } return null; } private boolean isFair(int ai, int bj, int sumA, int sumB) { return sumA - ai + bj == sumB - bj + ai; } public int[] fairCandySwap2(int[] A, int[] B) { int sumA = 0; int sumB = 0; HashSet<Integer> set = new HashSet<>(); for (int i : A) { sumA = sumA + i; } for (int i : B) { sumB = sumB + i; set.add(i); } /** * sumA - ai + bj == sumB - bj + ai * bj = (sumB-sumA+2ai)/2 = (sumB-sumA)/2 +ai */ int temp = (sumB - sumA) / 2; for (int i : A) { if (set.contains(temp + i)) { int[] result = new int[2]; result[0] = i; result[1] = temp + i; return result; } } return null; } public static void main(String[] args) { int[] result = new Solution().fairCandySwap2(new int[]{1, 1}, new int[]{2, 2}); System.out.println(); } }
3e0329905c4a4874f54e0ac4021ffe378524dd43
3,141
java
Java
src/test/java/com/qa/ims/persistence/domain/OrderTest.java
Safwan-Akhtar/ims-demo-test
dca4039fb72d2a38cdaff5493b94a75d479e2ae6
[ "MIT" ]
null
null
null
src/test/java/com/qa/ims/persistence/domain/OrderTest.java
Safwan-Akhtar/ims-demo-test
dca4039fb72d2a38cdaff5493b94a75d479e2ae6
[ "MIT" ]
null
null
null
src/test/java/com/qa/ims/persistence/domain/OrderTest.java
Safwan-Akhtar/ims-demo-test
dca4039fb72d2a38cdaff5493b94a75d479e2ae6
[ "MIT" ]
null
null
null
21.367347
64
0.720471
1,306
package com.qa.ims.persistence.domain; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; public class OrderTest { private Order order; private Order other; @Before public void setup() { order = new Order(1L, 1L, Double.valueOf(40.00)); other = new Order(1L, 1L, Double.valueOf(40.00)); } @Test public void setterTest() { assertNotNull(order.getOrder_id()); assertNotNull(order.getCust_id()); assertNotNull(order.getTotalPrice()); order.setOrder_id(null); assertNull(order.getOrder_id()); order.setCust_id(null); assertNull(order.getCust_id()); order.setTotalPrice(null); assertNull(order.getTotalPrice()); } @Test public void equalsWithNull() { assertFalse(order.equals(null)); } @Test public void equalsWithDifferentObject() { assertFalse(order.equals(new Object())); } @Test public void createOrderWithId() { assertEquals(1L, order.getOrder_id(), 0); assertEquals(1L, order.getCust_id(), 0); assertEquals(40.00, order.getTotalPrice(), 0); } @Test public void checkEquality() { assertTrue(order.equals(order)); } @Test public void checkEqualityBetweenDifferentObjects() { assertTrue(order.equals(other)); } @Test public void orderIdNullButOtherIdNotNull() { order.setOrder_id(null); assertFalse(order.equals(other)); } @Test public void customerIdNotEqual() { other.setCust_id(2L); assertFalse(order.equals(other)); } @Test public void checkEqualityBetweenDifferentObjectsNullOrderId() { order.setOrder_id(null); other.setOrder_id(null); assertTrue(order.equals(other)); } @Test public void nullPrice() { order.setTotalPrice(null); assertFalse(order.equals(other)); } @Test public void nullIdOnBoth() { order.setTotalPrice(null); other.setTotalPrice(null); assertTrue(order.equals(other)); } @Test public void otherPriceDifferent() { other.setTotalPrice(20.00); assertFalse(order.equals(other)); } @Test public void nullCustomerId() { order.setCust_id(null); assertFalse(order.equals(other)); } @Test public void nullCustomerIdOnBoth() { order.setCust_id(null); other.setCust_id(null); assertTrue(order.equals(other)); } @Test public void otherOrderIdDifferent() { other.setCust_id(2L); assertFalse(order.equals(other)); } @Test public void constructorWithoutOrderId() { Order order = new Order(1L, 40.00); assertNull(order.getOrder_id()); assertNotNull(order.getCust_id()); assertNotNull(order.getTotalPrice()); } @Test public void hashCodeTest() { assertEquals(order.hashCode(), other.hashCode()); } @Test public void hashCodeTestWithNull() { Order order = new Order(null, null); Order other = new Order(null, null); assertEquals(order.hashCode(), other.hashCode()); } @Test public void toStringTest() { String toString = "order_id:1 cust_id:1 totalPrice:40.0"; assertEquals(toString, order.toString()); } }
3e032aa3d9efed4ce6361dd44c9af323d7b3dfd2
1,918
java
Java
src/main/java/sonia/scm/script/domain/Listener.java
eheimbuch/reverse-mirror
87b352db88800e5d82ea2cf8ae977102612ca1a2
[ "MIT" ]
1
2019-08-29T13:24:05.000Z
2019-08-29T13:24:05.000Z
src/main/java/sonia/scm/script/domain/Listener.java
eheimbuch/reverse-mirror
87b352db88800e5d82ea2cf8ae977102612ca1a2
[ "MIT" ]
12
2020-05-14T17:25:54.000Z
2022-02-12T19:49:57.000Z
src/main/java/sonia/scm/script/domain/Listener.java
scm-manager/scm-script-plugin
e71669c1d2c26d187687c76e1a561702fb57385b
[ "MIT" ]
null
null
null
31.442623
81
0.757039
1,307
/* * MIT License * * Copyright (c) 2020-present Cloudogu GmbH and Contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package sonia.scm.script.domain; import lombok.Setter; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @Setter @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Listener { private String eventType; private boolean asynchronous; public Listener() { } public Listener(Class<?> eventClass, boolean asynchronous) { this(eventClass.getName(), asynchronous); } public Listener(String eventType, boolean asynchronous) { this.eventType = eventType; this.asynchronous = asynchronous; } public String getEventType() { return eventType; } public boolean isAsynchronous() { return asynchronous; } }
3e032ae961cf0cb1ce96a9b1cecd512a74513132
1,272
java
Java
src/hmrmi/remote/nameserver/NameServer.java
lichobaron/HistoricMemoryRMI
5e39248a794b17ef3216e0c5aba5fa7cd182d759
[ "MIT" ]
null
null
null
src/hmrmi/remote/nameserver/NameServer.java
lichobaron/HistoricMemoryRMI
5e39248a794b17ef3216e0c5aba5fa7cd182d759
[ "MIT" ]
null
null
null
src/hmrmi/remote/nameserver/NameServer.java
lichobaron/HistoricMemoryRMI
5e39248a794b17ef3216e0c5aba5fa7cd182d759
[ "MIT" ]
null
null
null
22.714286
89
0.560535
1,308
package hmrmi.remote.nameserver; import java.rmi.*; import java.rmi.server.*; import java.util.List; import java.util.ArrayList; import hmrmi.remote.archivos.Archivo; import hmrmi.remote.archivos.ArchivoInterface; public class NameServer extends UnicastRemoteObject implements NameServerInterface { private List<Node> nodes; private boolean ready; public NameServer() throws RemoteException { this.nodes = new ArrayList<>(); this.ready = false; } public List<Node> getNodes() { return this.nodes; } public void setNodes(List<Node> nodes){ this.nodes = nodes; } public boolean isReady() { return this.ready; } public void setReady(boolean ready) { this.ready = ready; } public void addNode(Node node){ int pos = findNode(node); if(pos != -1){ nodes.remove(pos); } this.nodes.add(node); } public int findNode(Node mNode){ int i = 0; for(Node node : nodes){ if(mNode.getIp().equals(node.getIp()) && mNode.getPort() == node.getPort()){ return i; } i++; } return -1; } }
3e032b32a633373f5c5ef459ed88890fc31b8a5d
2,667
java
Java
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/IValueManager.java
Cynyard999/dbeaver
29b44b16cfb5291c96fdec1a1a50e6b76e1c1d68
[ "Apache-2.0" ]
22,779
2017-12-23T15:47:03.000Z
2022-03-31T15:48:15.000Z
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/IValueManager.java
Cynyard999/dbeaver
29b44b16cfb5291c96fdec1a1a50e6b76e1c1d68
[ "Apache-2.0" ]
10,922
2017-12-23T12:01:39.000Z
2022-03-31T23:52:18.000Z
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/IValueManager.java
Cynyard999/dbeaver
29b44b16cfb5291c96fdec1a1a50e6b76e1c1d68
[ "Apache-2.0" ]
2,552
2017-12-26T21:31:27.000Z
2022-03-31T09:05:03.000Z
34.636364
140
0.724784
1,309
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2021 DBeaver Corp and others * * 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.jkiss.dbeaver.ui.data; import org.eclipse.jface.action.IContributionManager; import org.jkiss.code.NotNull; import org.jkiss.code.Nullable; import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.model.exec.DBCException; import org.jkiss.dbeaver.model.preferences.DBPPropertyManager; /** * UI Value Manager. */ public interface IValueManager { String GROUP_ACTIONS_ADDITIONAL = "actions_add"; /** * Fills context menu for certain value * * @param manager context menu manager * @param controller value controller * @param activeEditor active editor * @throws DBCException on error */ void contributeActions(@NotNull IContributionManager manager, @NotNull IValueController controller, @Nullable IValueEditor activeEditor) throws DBCException; /** * Fills value's custom properties * @param propertySource property source * @param controller value controller */ void contributeProperties(@NotNull DBPPropertyManager propertySource, @NotNull IValueController controller); /** * Returns array of edit types supported by this value manager. */ @NotNull IValueController.EditType[] getSupportedEditTypes(); /** * Creates value editor. * Value editor could be: * <li>inline editor (control created withing inline placeholder)</li> * <li>dialog (modal or modeless)</li> * <li>workbench editor</li> * Modeless dialogs and editors must implement IValueEditor and * must register themselves within value controller. On close they must unregister themselves within * value controller. * @param controller value controller @return true if editor was successfully opened. * makes since only for inline editors, otherwise return value is ignored. * @return true on success * @throws DBException on error */ @Nullable IValueEditor createEditor(@NotNull IValueController controller) throws DBException; }