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
list
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
list
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
list
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
3e16632eb8dc5fa281c0f6d1a5f17a767155a5fb
9,408
java
Java
closure-compiler/src/com/google/javascript/jscomp/CompilerInput.java
LordGuilberGS/js-symbolic-executor
18266513cc9bc885434890c8612aa26f0e2eab8b
[ "Apache-2.0" ]
5
2015-10-11T08:32:50.000Z
2019-02-01T22:59:18.000Z
closure-compiler/src/com/google/javascript/jscomp/CompilerInput.java
LordGuilberGS/js-symbolic-executor
18266513cc9bc885434890c8612aa26f0e2eab8b
[ "Apache-2.0" ]
null
null
null
closure-compiler/src/com/google/javascript/jscomp/CompilerInput.java
LordGuilberGS/js-symbolic-executor
18266513cc9bc885434890c8612aa26f0e2eab8b
[ "Apache-2.0" ]
null
null
null
31.152318
80
0.683673
9,538
/* * Copyright 2009 Google 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.google.javascript.jscomp; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.javascript.jscomp.deps.DependencyInfo; import com.google.javascript.jscomp.deps.JsFileParser; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; import java.io.IOException; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; /** * A class for the internal representation of an input to the compiler. * Wraps a {@link SourceAst} and maintain state such as module for the input and * whether the input is an extern. Also calculates provided and required types. * * */ public class CompilerInput implements SourceAst, DependencyInfo { private static final long serialVersionUID = 1L; // Info about where the file lives. private JSModule module; private boolean isExtern; final private String name; // The AST. private final SourceAst ast; // Provided and required symbols. private final Set<String> provides = Sets.newHashSet(); private final Set<String> requires = Sets.newHashSet(); private boolean generatedDependencyInfoFromSource = false; // An error manager for handling problems when dealing with // provides/requires. private ErrorManager errorManager; // An AbstractCompiler for doing parsing. private AbstractCompiler compiler; public CompilerInput(SourceAst ast) { this(ast, ast.getSourceFile().getName(), false); } public CompilerInput(SourceAst ast, boolean isExtern) { this(ast, ast.getSourceFile().getName(), isExtern); } public CompilerInput(SourceAst ast, String inputName, boolean isExtern) { this.ast = ast; this.name = inputName; this.isExtern = isExtern; } public CompilerInput(JSSourceFile file) { this(file, false); } public CompilerInput(JSSourceFile file, boolean isExtern) { this.ast = new JsAst(file); this.name = file.getName(); this.isExtern = isExtern; } /** Returns a name for this input. Must be unique across all inputs. */ @Override public String getName() { return name; } /** Gets the path relative to closure-base, if one is available. */ @Override public String getPathRelativeToClosureBase() { // TODO(nicksantos): Implement me. throw new UnsupportedOperationException(); } @Override public Node getAstRoot(AbstractCompiler compiler) { return ast.getAstRoot(compiler); } @Override public void clearAst() { ast.clearAst(); } @Override public SourceFile getSourceFile() { return ast.getSourceFile(); } @Override public void setSourceFile(SourceFile file) { ast.setSourceFile(file); } /** Returns the SourceAst object on which this input is based. */ public SourceAst getSourceAst() { return ast; } /** Sets an error manager for routing error messages. */ public void setErrorManager(ErrorManager errorManager) { this.errorManager = errorManager; } /** Sets an abstract compiler for doing parsing. */ public void setCompiler(AbstractCompiler compiler) { this.compiler = compiler; setErrorManager(compiler.getErrorManager()); } /** Gets a list of types depended on by this input. */ @Override public Collection<String> getRequires() { Preconditions.checkNotNull(errorManager, "Expected setErrorManager to be called first"); try { regenerateDependencyInfoIfNecessary(); return Collections.<String>unmodifiableSet(requires); } catch (IOException e) { errorManager.report(CheckLevel.ERROR, JSError.make(AbstractCompiler.READ_ERROR, getName())); return ImmutableList.<String>of(); } } /** Gets a list of types provided by this input. */ @Override public Collection<String> getProvides() { Preconditions.checkNotNull(errorManager, "Expected setErrorManager to be called first"); try { regenerateDependencyInfoIfNecessary(); return Collections.<String>unmodifiableSet(provides); } catch (IOException e) { errorManager.report(CheckLevel.ERROR, JSError.make(AbstractCompiler.READ_ERROR, getName())); return ImmutableList.<String>of(); } } /** * Regenerates the provides/requires if we need to do so. */ private void regenerateDependencyInfoIfNecessary() throws IOException { // If the code is NOT a JsAst, then it was not originally JS code. // Look at the Ast for dependency info. if (!(ast instanceof JsAst)) { Preconditions.checkNotNull(compiler, "Expected setCompiler to be called first"); DepsFinder finder = new DepsFinder(); Node root = getAstRoot(compiler); if (root == null) { return; } finder.visitTree(getAstRoot(compiler)); // TODO(nicksantos|user): This caching behavior is a bit // odd, and only works if you assume the exact call flow that // clients are currently using. In that flow, they call // getProvides(), then remove the goog.provide calls from the // AST, and then call getProvides() again. // // This won't work for any other call flow, or any sort of incremental // compilation scheme. The API needs to be fixed so callers aren't // doing weird things like this, and then we should get rid of the // multiple-scan strategy. provides.addAll(finder.provides); requires.addAll(finder.requires); } else { // Otherwise, look at the source code. if (!generatedDependencyInfoFromSource) { // Note: it's ok to use getName() instead of // getPathRelativeToClosureBase() here because we're not using // this to generate deps files. (We're only using it for // symbol dependencies.) DependencyInfo info = (new JsFileParser(errorManager)).parseFile( getName(), getName(), getCode()); provides.addAll(info.getProvides()); requires.addAll(info.getRequires()); generatedDependencyInfoFromSource = true; } } } private static class DepsFinder { private final List<String> provides = Lists.newArrayList(); private final List<String> requires = Lists.newArrayList(); private final CodingConvention codingConvention = new ClosureCodingConvention(); void visitTree(Node n) { visitSubtree(n, null); } void visitSubtree(Node n, Node parent) { if (n.getType() == Token.CALL) { String require = codingConvention.extractClassNameIfRequire(n, parent); if (require != null) { requires.add(require); } String provide = codingConvention.extractClassNameIfProvide(n, parent); if (provide != null) { provides.add(provide); } return; } else if (parent != null && parent.getType() != Token.EXPR_RESULT && parent.getType() != Token.SCRIPT) { return; } for (Node child = n.getFirstChild(); child != null; child = child.getNext()) { visitSubtree(child, n); } } } /** * Gets the source line for the indicated line number. * * @param lineNumber the line number, 1 being the first line of the file. * @return The line indicated. Does not include the newline at the end * of the file. Returns {@code null} if it does not exist, * or if there was an IO exception. */ public String getLine(int lineNumber) { return getSourceFile().getLine(lineNumber); } /** * Get a region around the indicated line number. The exact definition of a * region is implementation specific, but it must contain the line indicated * by the line number. A region must not start or end by a carriage return. * * @param lineNumber the line number, 1 being the first line of the file. * @return The line indicated. Returns {@code null} if it does not exist, * or if there was an IO exception. */ public Region getRegion(int lineNumber) { return getSourceFile().getRegion(lineNumber); } public String getCode() throws IOException { return getSourceFile().getCode(); } /** Returns the module to which the input belongs. */ public JSModule getModule() { return module; } /** Sets the module to which the input belongs. */ public void setModule(JSModule module) { // An input may only belong to one module. Preconditions.checkArgument( module == null || this.module == null || this.module == module); this.module = module; } public boolean isExtern() { return isExtern; } void setIsExtern(boolean isExtern) { this.isExtern = isExtern; } }
3e16634247a72cbe141aafae85518008114e0565
2,809
java
Java
src/main/java/jeffaschenk/infra/tomcat/instance/generator/model/TomcatArchive.java
jaschenk/Tomcat-Instance-Generator-2.0.0
4caa326494a8fb5db11daead7bbdc62119ee28e8
[ "Apache-2.0" ]
1
2019-03-24T00:54:16.000Z
2019-03-24T00:54:16.000Z
src/main/java/jeffaschenk/infra/tomcat/instance/generator/model/TomcatArchive.java
jaschenk/Tomcat-Instance-Generator-2.0.0
4caa326494a8fb5db11daead7bbdc62119ee28e8
[ "Apache-2.0" ]
null
null
null
src/main/java/jeffaschenk/infra/tomcat/instance/generator/model/TomcatArchive.java
jaschenk/Tomcat-Instance-Generator-2.0.0
4caa326494a8fb5db11daead7bbdc62119ee28e8
[ "Apache-2.0" ]
1
2020-10-21T10:28:41.000Z
2020-10-21T10:28:41.000Z
28.414141
92
0.568432
9,539
package jeffaschenk.infra.tomcat.instance.generator.model; import jeffaschenk.infra.tomcat.instance.generator.knowledgebase.DefaultDefinitions; import lombok.Data; /** * TomcatArchive * * Created by upchh@example.com on 2/22/2017. */ @Data public class TomcatArchive { private String downloadURL; private String extrasURL; private String name; private String shortName; private boolean available; private Integer size; /** * TomcatArchive */ public TomcatArchive() { } /** * TomcatArchive * Defines a Tomcat Archive. * * @param downloadURL - Archive Full Download URL. * @param extrasURL - Archive Full URL for any Extras. * @param name Name of Archive, example: 'apache-tomcat-8.5.xx' * @param available Boolean indicating if Archive is available or not. */ public TomcatArchive(String downloadURL, String extrasURL, String name, boolean available) { this.downloadURL = downloadURL; this.extrasURL = extrasURL; this.name = name; this.shortName = getShortVersionFromName(name); this.available = available; } /** * Helper method to contrive short Version Name from Full Name of Archive. * @param name reference of full Archive. * @return String containing obtained Short Name or Null, if unable to resolve. */ public static String getShortVersionFromName(String name) { if (name.lastIndexOf('-')+1 <= name.length()) { String sname = name.substring(name.lastIndexOf('-') + 1); int x = sname.indexOf(DefaultDefinitions.ZIP_ARCHIVE_SUFFIX); if (x > 0) { return sname.substring(0, x); } else { return sname; } } else { return null; } } /** * Helper method to contrive the name of the head Directory based upon our Archive Name. * @return String containing contrived value. */ public String getHeadName() { if (this.getName().indexOf(".zip'") <= name.length()) { int x = this.getName().indexOf(DefaultDefinitions.ZIP_ARCHIVE_SUFFIX); if (x > 0) { return this.getName().substring(0, x); } } /** * Return Original full Name... */ return this.getName(); } @Override public String toString() { return "TomcatArchive{" + "shortName='" + shortName + '\'' + ", name='" + name + '\'' + ", downloadURL='" + downloadURL + '\'' + ", extrasURL='" + extrasURL + '\'' + ", available=" + available + ", size=" + size + '}'; } }
3e16634d5d44a75041e125eaae494bbe68e05292
458
java
Java
src/main/java/org/amc/game/chessserver/observers/ObserverFactory.java
subwoofer359/AMCChessGame
8d5c152705dd004c0d7978292ed2934b4b026bdd
[ "MIT" ]
null
null
null
src/main/java/org/amc/game/chessserver/observers/ObserverFactory.java
subwoofer359/AMCChessGame
8d5c152705dd004c0d7978292ed2934b4b026bdd
[ "MIT" ]
null
null
null
src/main/java/org/amc/game/chessserver/observers/ObserverFactory.java
subwoofer359/AMCChessGame
8d5c152705dd004c0d7978292ed2934b4b026bdd
[ "MIT" ]
null
null
null
17.615385
53
0.655022
9,540
package org.amc.game.chessserver.observers; import org.amc.game.GameObserver; /** * A factory for GameObserver instances * * @author Adrian Mclaughlin * */ public interface ObserverFactory { /** * Creates a GameObserver instance * * @return GameObserver */ GameObserver createObserver(); /** * @return Class of GameObserver for this factory */ Class<? extends GameObserver> forObserverClass(); }
3e166367910b4d977185cf9634bb910d93fee9cd
431
java
Java
src/Cliente.java
amorimluiz/ContasBancarias
abb1db0c2f3b9513661ee8616be4b34aceff04bf
[ "MIT" ]
null
null
null
src/Cliente.java
amorimluiz/ContasBancarias
abb1db0c2f3b9513661ee8616be4b34aceff04bf
[ "MIT" ]
null
null
null
src/Cliente.java
amorimluiz/ContasBancarias
abb1db0c2f3b9513661ee8616be4b34aceff04bf
[ "MIT" ]
null
null
null
22.684211
50
0.563805
9,541
public class Cliente{ String cpf; Lista cntsCliente; public Cliente(String cdgPessoa){ this.cpf = cdgPessoa; this.cntsCliente = new Lista(); } public void carregarContas(Lista contas){ Elemento aux = contas.prim.prox; while(aux != null){ if(aux.conta.cpf.equals(cpf)) cntsCliente.enfileirar(aux.conta); aux = aux.prox; } } }
3e166379f6b7c6a8f6074a131578275c72d403f0
5,624
java
Java
classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/jdk/internal/org/objectweb/asm/commons/SimpleRemapper.java
Suyashtnt/Bytecoder
d957081d50f2d30b3206447b805b1ca9da69c8c2
[ "Apache-2.0" ]
543
2017-06-14T14:53:33.000Z
2022-03-23T14:18:09.000Z
classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/jdk/internal/org/objectweb/asm/commons/SimpleRemapper.java
Suyashtnt/Bytecoder
d957081d50f2d30b3206447b805b1ca9da69c8c2
[ "Apache-2.0" ]
381
2017-10-31T14:29:54.000Z
2022-03-25T15:27:27.000Z
classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/jdk/internal/org/objectweb/asm/commons/SimpleRemapper.java
Suyashtnt/Bytecoder
d957081d50f2d30b3206447b805b1ca9da69c8c2
[ "Apache-2.0" ]
50
2018-01-06T12:35:14.000Z
2022-03-13T14:54:33.000Z
44.283465
102
0.703592
9,542
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file: * * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000-2011 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package jdk.internal.org.objectweb.asm.commons; import java.util.Collections; import java.util.Map; /** * A {@link Remapper} using a {@link Map} to define its mapping. * * @author Eugene Kuleshov */ public class SimpleRemapper extends Remapper { private final Map<String, String> mapping; /** * Constructs a new {@link SimpleRemapper} with the given mapping. * * @param mapping a map specifying a remapping as follows: * <ul> * <li>for method names, the key is the owner, name and descriptor of the method (in the * form &lt;owner&gt;.&lt;name&gt;&lt;descriptor&gt;), and the value is the new method * name. * <li>for invokedynamic method names, the key is the name and descriptor of the method (in * the form .&lt;name&gt;&lt;descriptor&gt;), and the value is the new method name. * <li>for field names, the key is the owner and name of the field (in the form * &lt;owner&gt;.&lt;name&gt;), and the value is the new field name. * <li>for internal names, the key is the old internal name, and the value is the new * internal name. * </ul> */ public SimpleRemapper(final Map<String, String> mapping) { this.mapping = mapping; } /** * Constructs a new {@link SimpleRemapper} with the given mapping. * * @param oldName the key corresponding to a method, field or internal name (see {@link * #SimpleRemapper(Map)} for the format of these keys). * @param newName the new method, field or internal name. */ public SimpleRemapper(final String oldName, final String newName) { this.mapping = Collections.singletonMap(oldName, newName); } @Override public String mapMethodName(final String owner, final String name, final String descriptor) { String remappedName = map(owner + '.' + name + descriptor); return remappedName == null ? name : remappedName; } @Override public String mapInvokeDynamicMethodName(final String name, final String descriptor) { String remappedName = map('.' + name + descriptor); return remappedName == null ? name : remappedName; } @Override public String mapFieldName(final String owner, final String name, final String descriptor) { String remappedName = map(owner + '.' + name); return remappedName == null ? name : remappedName; } @Override public String map(final String key) { return mapping.get(key); } }
3e166487eec55ea8a072b8a25a00f4455f1d1abd
2,231
java
Java
src/main/java/com/microfocus/application/automation/tools/sse/sdk/request/GetRequest.java
motteww/hpe-application-automation-tools-plugin
7b7382488346e9fa3f298dbb5639c867440818d8
[ "MIT" ]
26
2017-08-18T16:10:52.000Z
2021-12-17T04:25:39.000Z
src/main/java/com/microfocus/application/automation/tools/sse/sdk/request/GetRequest.java
motteww/hpe-application-automation-tools-plugin
7b7382488346e9fa3f298dbb5639c867440818d8
[ "MIT" ]
471
2017-08-15T11:24:15.000Z
2022-03-31T10:46:49.000Z
src/main/java/com/microfocus/application/automation/tools/sse/sdk/request/GetRequest.java
motteww/hpe-application-automation-tools-plugin
7b7382488346e9fa3f298dbb5639c867440818d8
[ "MIT" ]
83
2017-08-17T15:22:37.000Z
2022-03-03T19:25:10.000Z
43.745098
118
0.76199
9,543
/* * Certain versions of software and/or documents ("Material") accessible here may contain branding from * Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, * the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP * and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE * marks are the property of their respective owners. * __________________________________________________________________ * MIT License * * (c) Copyright 2012-2021 Micro Focus or one of its affiliates. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * ___________________________________________________________________ */ package com.microfocus.application.automation.tools.sse.sdk.request; import com.microfocus.application.automation.tools.sse.sdk.Client; /*** * * @author Effi Bar-She'an * @author Dani Schreiber * */ public abstract class GetRequest extends GeneralGetRequest { protected final String _runId; protected GetRequest(Client client, String runId) { super(client); _runId = runId; } }
3e16648b75357ce5ad3040d387985dcb96a63820
6,346
java
Java
mobile-app/app/src/main/java/com/incampusit/staryaar/Profile/Liked_Videos/Liked_Video_F.java
pankaj-j-sharma/star-yaar
9b9f9483585aa7d69cd0948de4424dbc449dd6d4
[ "Apache-2.0" ]
null
null
null
mobile-app/app/src/main/java/com/incampusit/staryaar/Profile/Liked_Videos/Liked_Video_F.java
pankaj-j-sharma/star-yaar
9b9f9483585aa7d69cd0948de4424dbc449dd6d4
[ "Apache-2.0" ]
null
null
null
mobile-app/app/src/main/java/com/incampusit/staryaar/Profile/Liked_Videos/Liked_Video_F.java
pankaj-j-sharma/star-yaar
9b9f9483585aa7d69cd0948de4424dbc449dd6d4
[ "Apache-2.0" ]
null
null
null
30.509615
103
0.615191
9,544
package com.incampusit.staryaar.Profile.Liked_Videos; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.Toast; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.incampusit.staryaar.Home.Home_Get_Set; import com.incampusit.staryaar.Profile.MyVideos_Adapter; import com.incampusit.staryaar.R; import com.incampusit.staryaar.SimpleClasses.ApiRequest; import com.incampusit.staryaar.SimpleClasses.Callback; import com.incampusit.staryaar.SimpleClasses.Variables; import com.incampusit.staryaar.WatchVideos.WatchVideos_F; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; /* * A simple {@link Fragment} subclass. */ public class Liked_Video_F extends Fragment { public static RecyclerView recyclerView; ArrayList<Home_Get_Set> data_list; MyVideos_Adapter adapter; View view; Context context; String user_id; RelativeLayout no_data_layout; public Liked_Video_F() { // Required empty public constructor } @SuppressLint("ValidFragment") public Liked_Video_F(String user_id) { this.user_id = user_id; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_user_likedvideo, container, false); context = getContext(); recyclerView = view.findViewById(R.id.recylerview); final GridLayoutManager layoutManager = new GridLayoutManager(context, 3); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); data_list = new ArrayList<>(); adapter = new MyVideos_Adapter(context, data_list, new MyVideos_Adapter.OnItemClickListener() { @Override public void onItemClick(int postion, Home_Get_Set item, View view) { OpenWatchVideo(postion); } }); recyclerView.setAdapter(adapter); no_data_layout = view.findViewById(R.id.no_data_layout); Call_Api_For_get_Allvideos(); return view; } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (view != null && isVisibleToUser) { Call_Api_For_get_Allvideos(); } } //this will get the all liked videos data of user and then parse the data private void Call_Api_For_get_Allvideos() { JSONObject parameters = new JSONObject(); try { parameters.put("fb_id", user_id); } catch (JSONException e) { e.printStackTrace(); } ApiRequest.Call_Api(context, Variables.my_liked_video, parameters, new Callback() { @Override public void Responce(String resp) { Parse_data(resp); } }); } public void Parse_data(String responce) { data_list.clear(); try { JSONObject jsonObject = new JSONObject(responce); String code = jsonObject.optString("code"); if (code.equals("200")) { JSONArray msgArray = jsonObject.getJSONArray("msg"); JSONObject data = msgArray.getJSONObject(0); JSONObject user_info = data.optJSONObject("user_info"); JSONArray user_videos = data.getJSONArray("user_videos"); if (!user_videos.toString().equals("[" + "0" + "]")) { no_data_layout.setVisibility(View.GONE); for (int i = 0; i < user_videos.length(); i++) { JSONObject itemdata = user_videos.optJSONObject(i); Home_Get_Set item = new Home_Get_Set(); item.fb_id = itemdata.optString("fb_id"); item.first_name = user_info.optString("first_name"); item.last_name = user_info.optString("last_name"); item.profile_pic = user_info.optString("profile_pic"); JSONObject count = itemdata.optJSONObject("count"); item.like_count = count.optString("like_count"); item.video_comment_count = count.optString("video_comment_count"); item.views = count.optString("view"); JSONObject sound_data = itemdata.optJSONObject("sound"); item.sound_id = sound_data.optString("id"); item.sound_name = sound_data.optString("sound_name"); item.sound_pic = sound_data.optString("thum"); item.video_id = itemdata.optString("id"); item.liked = itemdata.optString("liked"); item.gif = Variables.base_url + itemdata.optString("gif"); item.video_url = Variables.base_url + itemdata.optString("video"); item.thum = Variables.base_url + itemdata.optString("thum"); item.created_date = itemdata.optString("created"); item.video_description = itemdata.optString("description"); data_list.add(item); } } else { no_data_layout.setVisibility(View.VISIBLE); } adapter.notifyDataSetChanged(); } else { Toast.makeText(context, "" + jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } } private void OpenWatchVideo(int postion) { Intent intent = new Intent(getActivity(), WatchVideos_F.class); intent.putExtra("arraylist", data_list); intent.putExtra("position", postion); startActivity(intent); } }
3e1664c5288a37fa28bfc151cf66802f44548265
1,231
java
Java
src/test/resources/TypecheckingTestResource/test23.java
RoySRC/MiniJavaCompiler
72a985959f6f31cb8c90260d7861713a18c8f1ae
[ "MIT" ]
null
null
null
src/test/resources/TypecheckingTestResource/test23.java
RoySRC/MiniJavaCompiler
72a985959f6f31cb8c90260d7861713a18c8f1ae
[ "MIT" ]
null
null
null
src/test/resources/TypecheckingTestResource/test23.java
RoySRC/MiniJavaCompiler
72a985959f6f31cb8c90260d7861713a18c8f1ae
[ "MIT" ]
null
null
null
15.582278
46
0.566206
9,545
/** * The following class typechecks */ class p_mainClass { public static void main(String[] args){ System.out.println(new fakeMain().run()); } } class fakeMain { public int run(){ Vehicle a; Vehicle b; int ret; a = new Vehicle(); b = new Vehicle(); ret = a.create(5, 2); ret = b.create(2, 10); ret = a.move(); ret = b.setOn(true); ret = b.move(); ret = b.setOn(false); ret = b.move(); ret = a.setOn(true); ret = a.move(); ret = b.move(); return 0; } } class Vehicle { int moveSpeed; int capacity; boolean on; public int create(int speed, int xCapacity){ moveSpeed = speed; capacity = xCapacity; on = false; return 0; } public int getSpeed(){ return moveSpeed; } public int setSpeed(int a){ moveSpeed = a; return 0; } public int setOn(boolean a){ on = a; return 0; } public int move(){ if(on){ System.out.println(12); System.out.println(moveSpeed); System.out.println(13); System.out.println(14); System.out.println(capacity); System.out.println(55); }else{ System.out.println(99999999999999); } return moveSpeed; } }
3e16656ec8502c8838845c0d4b4f9832ee5a6ebe
3,455
java
Java
org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/codesystems/HspcPractitionerPracticeAffiliationType.java
DBCG/org.hl7.fhir.core
6f32a85d6610d1b401377d28e561a7830281d691
[ "Apache-2.0" ]
98
2019-03-01T21:59:41.000Z
2022-03-23T15:52:06.000Z
org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/codesystems/HspcPractitionerPracticeAffiliationType.java
DBCG/org.hl7.fhir.core
6f32a85d6610d1b401377d28e561a7830281d691
[ "Apache-2.0" ]
573
2019-02-27T17:51:31.000Z
2022-03-31T21:18:44.000Z
org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/codesystems/HspcPractitionerPracticeAffiliationType.java
DBCG/org.hl7.fhir.core
6f32a85d6610d1b401377d28e561a7830281d691
[ "Apache-2.0" ]
112
2019-01-31T10:50:26.000Z
2022-03-21T09:55:06.000Z
41.626506
188
0.687699
9,546
package org.hl7.fhir.dstu2016may.model.codesystems; /* Copyright (c) 2011+, HL7, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of HL7 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 import org.hl7.fhir.exceptions.FHIRException; public enum HspcPractitionerPracticeAffiliationType { /** * The provider's connection with the organization as a practitioner is in an educaitonal manner, i.e. as an educator or student. */ _5B595190ACEB48DEB0D68950A8829183, /** * added to help the parsers */ NULL; public static HspcPractitionerPracticeAffiliationType fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) return null; if ("5b595190-aceb-48de-b0d6-8950a8829183".equals(codeString)) return _5B595190ACEB48DEB0D68950A8829183; throw new FHIRException("Unknown HspcPractitionerPracticeAffiliationType code '"+codeString+"'"); } public String toCode() { switch (this) { case _5B595190ACEB48DEB0D68950A8829183: return "5b595190-aceb-48de-b0d6-8950a8829183"; case NULL: return null; default: return "?"; } } public String getSystem() { return "http://hl7.org/fhir/practitioner-hspc-practiceAffiliationType"; } public String getDefinition() { switch (this) { case _5B595190ACEB48DEB0D68950A8829183: return "The provider's connection with the organization as a practitioner is in an educaitonal manner, i.e. as an educator or student."; case NULL: return null; default: return "?"; } } public String getDisplay() { switch (this) { case _5B595190ACEB48DEB0D68950A8829183: return "School affiliation"; case NULL: return null; default: return "?"; } } }
3e1665e29ced0740b018da76408ce378339a82d7
15,430
java
Java
netreflected/src/netcoreapp3.1/system.configuration.configurationmanager_version_4.0.3.0_culture_neutral_publickeytoken_cc7b13ffcd2ddd51/system/configuration/ConfigurationManager.java
mariomastrodicasa/JCOReflector
a88b6de9d3cc607fd375ab61df8c61f44de88c93
[ "MIT" ]
35
2020-08-30T03:19:42.000Z
2022-03-12T09:22:23.000Z
netreflected/src/netcoreapp3.1/system.configuration.configurationmanager_version_4.0.3.0_culture_neutral_publickeytoken_cc7b13ffcd2ddd51/system/configuration/ConfigurationManager.java
mariomastrodicasa/JCOReflector
a88b6de9d3cc607fd375ab61df8c61f44de88c93
[ "MIT" ]
50
2020-06-22T17:03:18.000Z
2022-03-30T21:19:05.000Z
netreflected/src/netcoreapp3.1/system.configuration.configurationmanager_version_4.0.3.0_culture_neutral_publickeytoken_cc7b13ffcd2ddd51/system/configuration/ConfigurationManager.java
mariomastrodicasa/JCOReflector
a88b6de9d3cc607fd375ab61df8c61f44de88c93
[ "MIT" ]
12
2020-08-30T03:19:45.000Z
2022-03-05T02:22:37.000Z
56.727941
744
0.738496
9,547
/* * MIT License * * Copyright (c) 2021 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.configuration; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section import system.configuration.Configuration; import system.configuration.ConfigurationUserLevel; import system.configuration.ExeConfigurationFileMap; import system.configuration.ConfigurationFileMap; import system.collections.specialized.NameValueCollection; import system.configuration.ConnectionStringSettingsCollection; /** * The base .NET class managing System.Configuration.ConfigurationManager, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Configuration.ConfigurationManager" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Configuration.ConfigurationManager</a> */ public class ConfigurationManager extends NetObject { /** * Fully assembly qualified name: System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 */ public static final String assemblyFullName = "System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"; /** * Assembly name: System.Configuration.ConfigurationManager */ public static final String assemblyShortName = "System.Configuration.ConfigurationManager"; /** * Qualified class name: System.Configuration.ConfigurationManager */ public static final String className = "System.Configuration.ConfigurationManager"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { String classToCreate = className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); if (JCOReflector.getDebug()) JCOReflector.writeLog("Creating %s", classToCreate); JCType typeCreated = bridge.GetType(classToCreate); if (JCOReflector.getDebug()) JCOReflector.writeLog("Created: %s", (typeCreated != null) ? typeCreated.toString() : "Returned null value"); return typeCreated; } catch (JCException e) { JCOReflector.writeLog(e); return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } /** * Internal constructor. Use with caution */ public ConfigurationManager(java.lang.Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public java.lang.Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link ConfigurationManager}, a cast assert is made to check if types are compatible. * @param from {@link IJCOBridgeReflected} instance to be casted * @return {@link ConfigurationManager} instance * @throws java.lang.Throwable in case of error during cast operation */ public static ConfigurationManager cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new ConfigurationManager(from.getJCOInstance()); } // Constructors section public ConfigurationManager() throws Throwable { } // Methods section public static Configuration OpenExeConfiguration(ConfigurationUserLevel userLevel) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.OverflowException, system.threading.AbandonedMutexException, system.ApplicationException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.NotSupportedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objOpenExeConfiguration = (JCObject)classType.Invoke("OpenExeConfiguration", userLevel == null ? null : userLevel.getJCOInstance()); return new Configuration(objOpenExeConfiguration); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Configuration OpenExeConfiguration(java.lang.String exePath) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.OverflowException, system.threading.AbandonedMutexException, system.ApplicationException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.NotSupportedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objOpenExeConfiguration = (JCObject)classType.Invoke("OpenExeConfiguration", exePath); return new Configuration(objOpenExeConfiguration); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Configuration OpenMachineConfiguration() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.OverflowException, system.threading.AbandonedMutexException, system.ApplicationException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.NotSupportedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objOpenMachineConfiguration = (JCObject)classType.Invoke("OpenMachineConfiguration"); return new Configuration(objOpenMachineConfiguration); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Configuration OpenMappedExeConfiguration(ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.OverflowException, system.threading.AbandonedMutexException, system.ApplicationException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.NotSupportedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objOpenMappedExeConfiguration = (JCObject)classType.Invoke("OpenMappedExeConfiguration", fileMap == null ? null : fileMap.getJCOInstance(), userLevel == null ? null : userLevel.getJCOInstance()); return new Configuration(objOpenMappedExeConfiguration); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Configuration OpenMappedExeConfiguration(ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel, boolean preLoad) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.OverflowException, system.threading.AbandonedMutexException, system.ApplicationException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.NotSupportedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objOpenMappedExeConfiguration = (JCObject)classType.Invoke("OpenMappedExeConfiguration", fileMap == null ? null : fileMap.getJCOInstance(), userLevel == null ? null : userLevel.getJCOInstance(), preLoad); return new Configuration(objOpenMappedExeConfiguration); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Configuration OpenMappedMachineConfiguration(ConfigurationFileMap fileMap) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.OverflowException, system.threading.AbandonedMutexException, system.ApplicationException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.NotSupportedException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objOpenMappedMachineConfiguration = (JCObject)classType.Invoke("OpenMappedMachineConfiguration", fileMap == null ? null : fileMap.getJCOInstance()); return new Configuration(objOpenMappedMachineConfiguration); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static NetObject GetSection(java.lang.String sectionName) throws Throwable, system.NotSupportedException, system.ArgumentNullException, system.ArgumentException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objGetSection = (JCObject)classType.Invoke("GetSection", sectionName); return new NetObject(objGetSection); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static void RefreshSection(java.lang.String sectionName) throws Throwable, system.NotSupportedException, system.ArgumentNullException, system.ArgumentException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { classType.Invoke("RefreshSection", sectionName); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Properties section public static NameValueCollection getAppSettings() throws Throwable, system.ArgumentException, system.ArgumentNullException, system.configuration.ConfigurationErrorsException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject val = (JCObject)classType.Get("AppSettings"); return new NameValueCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static ConnectionStringSettingsCollection getConnectionStrings() throws Throwable, system.ArgumentException, system.ArgumentNullException, system.configuration.ConfigurationErrorsException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.configuration.ConfigurationException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject val = (JCObject)classType.Get("ConnectionStrings"); return new ConnectionStringSettingsCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }
3e166603b5f6231f7e2e417f212633cdf9c31a70
2,541
java
Java
src/test/java/info/debatty/java/lsh/LSHMinHashTest.java
soham-samanta/java-LSH
69b6930a5e095f1d13878e485d4fbfd5cb4be22b
[ "MIT" ]
284
2015-01-29T13:16:01.000Z
2022-03-02T02:43:46.000Z
src/test/java/info/debatty/java/lsh/LSHMinHashTest.java
soham-samanta/java-LSH
69b6930a5e095f1d13878e485d4fbfd5cb4be22b
[ "MIT" ]
26
2015-02-28T03:45:59.000Z
2021-02-18T04:10:28.000Z
src/test/java/info/debatty/java/lsh/LSHMinHashTest.java
soham-samanta/java-LSH
69b6930a5e095f1d13878e485d4fbfd5cb4be22b
[ "MIT" ]
82
2015-06-05T03:48:05.000Z
2022-02-21T07:21:24.000Z
31.37037
80
0.669815
9,548
/* * The MIT License * * Copyright 2016 Thibault Debatty. * * 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 info.debatty.java.lsh; import java.util.Random; import org.junit.Test; /** * * @author Thibault Debatty */ public class LSHMinHashTest { /** * Test of hash method, of class LSHMinHash. */ @Test public void testHash() { System.out.println("hash"); // proportion of 0's in the vectors // if the vectors are dense (lots of 1's), the average jaccard similarity // will be very high (especially for large vectors), and LSH // won't be able to distinguish them // as a result, all vectors will be binned in the same bucket... double sparsity = 0.75; // Number and size of vectors int count = 1000; int n = 10000; int stages = 2; int buckets = 10; // Let's generate some random sets boolean[][] vectors = new boolean[count][n]; Random rand = new Random(); for (int i = 0; i < count; i++) { for (int j = 0; j < n; j++) { vectors[i][j] = rand.nextDouble() > sparsity; } } LSHMinHash lsh = new LSHMinHash(stages, buckets, n); int[][] counts = new int[stages][buckets]; // Perform hashing for (boolean[] vector : vectors) { int[] hash = lsh.hash(vector); for (int i = 0; i < hash.length; i++) { // this will raise an ArrayIndexOutOfBoundsException // if the bin values are negatives or too large counts[i][hash[i]]++; } } } }
3e16662a45bd793b8b73c1ad335c160ab5c8fd2e
245
java
Java
src/main/java/com/itineric/javarvis/core/automation/pattern2command/PatternMatchingContext.java
javarvis/javarvis-core
7c922f9d8b8244d22bd19295153a2ca455375ae4
[ "Apache-2.0" ]
3
2021-02-02T20:37:05.000Z
2021-10-04T19:36:26.000Z
src/main/java/com/itineric/javarvis/core/automation/pattern2command/PatternMatchingContext.java
javarvis/javarvis-core
7c922f9d8b8244d22bd19295153a2ca455375ae4
[ "Apache-2.0" ]
null
null
null
src/main/java/com/itineric/javarvis/core/automation/pattern2command/PatternMatchingContext.java
javarvis/javarvis-core
7c922f9d8b8244d22bd19295153a2ca455375ae4
[ "Apache-2.0" ]
null
null
null
18.846154
63
0.746939
9,549
package com.itineric.javarvis.core.automation.pattern2command; import java.util.List; public interface PatternMatchingContext { String getText(); List<String> getParameters(); void setParameters(List<String> parameters); }
3e166636f99010fa335be7ae47c769da9303ee21
21,199
java
Java
aws-java-sdk-imagebuilder/src/main/java/com/amazonaws/services/imagebuilder/model/CreateImageRequest.java
ericvincent83/aws-sdk-java
c491416f3ea9411a04d9bafedee6c6874a79e48d
[ "Apache-2.0" ]
3,372
2015-01-03T00:35:43.000Z
2022-03-31T15:56:24.000Z
aws-java-sdk-imagebuilder/src/main/java/com/amazonaws/services/imagebuilder/model/CreateImageRequest.java
ericvincent83/aws-sdk-java
c491416f3ea9411a04d9bafedee6c6874a79e48d
[ "Apache-2.0" ]
2,391
2015-01-01T12:55:24.000Z
2022-03-31T08:01:50.000Z
aws-java-sdk-imagebuilder/src/main/java/com/amazonaws/services/imagebuilder/model/CreateImageRequest.java
ericvincent83/aws-sdk-java
c491416f3ea9411a04d9bafedee6c6874a79e48d
[ "Apache-2.0" ]
2,876
2015-01-01T14:38:37.000Z
2022-03-29T19:53:10.000Z
37.061189
159
0.653569
9,550
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.imagebuilder.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/imagebuilder-2019-12-02/CreateImage" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CreateImageRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed. * </p> */ private String imageRecipeArn; /** * <p> * The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. * </p> */ private String containerRecipeArn; /** * <p> * The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your * pipeline. * </p> */ private String distributionConfigurationArn; /** * <p> * The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your * image will be built and tested. * </p> */ private String infrastructureConfigurationArn; /** * <p> * The image tests configuration of the image. * </p> */ private ImageTestsConfiguration imageTestsConfiguration; /** * <p> * Collects additional information about the image being created, including the operating system (OS) version and * package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by * default. * </p> */ private Boolean enhancedImageMetadataEnabled; /** * <p> * The tags of the image. * </p> */ private java.util.Map<String, String> tags; /** * <p> * The idempotency token used to make this request idempotent. * </p> */ private String clientToken; /** * <p> * The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed. * </p> * * @param imageRecipeArn * The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and * assessed. */ public void setImageRecipeArn(String imageRecipeArn) { this.imageRecipeArn = imageRecipeArn; } /** * <p> * The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed. * </p> * * @return The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and * assessed. */ public String getImageRecipeArn() { return this.imageRecipeArn; } /** * <p> * The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed. * </p> * * @param imageRecipeArn * The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and * assessed. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withImageRecipeArn(String imageRecipeArn) { setImageRecipeArn(imageRecipeArn); return this; } /** * <p> * The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. * </p> * * @param containerRecipeArn * The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. */ public void setContainerRecipeArn(String containerRecipeArn) { this.containerRecipeArn = containerRecipeArn; } /** * <p> * The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. * </p> * * @return The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. */ public String getContainerRecipeArn() { return this.containerRecipeArn; } /** * <p> * The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. * </p> * * @param containerRecipeArn * The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withContainerRecipeArn(String containerRecipeArn) { setContainerRecipeArn(containerRecipeArn); return this; } /** * <p> * The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your * pipeline. * </p> * * @param distributionConfigurationArn * The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs * of your pipeline. */ public void setDistributionConfigurationArn(String distributionConfigurationArn) { this.distributionConfigurationArn = distributionConfigurationArn; } /** * <p> * The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your * pipeline. * </p> * * @return The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs * of your pipeline. */ public String getDistributionConfigurationArn() { return this.distributionConfigurationArn; } /** * <p> * The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your * pipeline. * </p> * * @param distributionConfigurationArn * The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs * of your pipeline. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withDistributionConfigurationArn(String distributionConfigurationArn) { setDistributionConfigurationArn(distributionConfigurationArn); return this; } /** * <p> * The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your * image will be built and tested. * </p> * * @param infrastructureConfigurationArn * The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which * your image will be built and tested. */ public void setInfrastructureConfigurationArn(String infrastructureConfigurationArn) { this.infrastructureConfigurationArn = infrastructureConfigurationArn; } /** * <p> * The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your * image will be built and tested. * </p> * * @return The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which * your image will be built and tested. */ public String getInfrastructureConfigurationArn() { return this.infrastructureConfigurationArn; } /** * <p> * The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your * image will be built and tested. * </p> * * @param infrastructureConfigurationArn * The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which * your image will be built and tested. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withInfrastructureConfigurationArn(String infrastructureConfigurationArn) { setInfrastructureConfigurationArn(infrastructureConfigurationArn); return this; } /** * <p> * The image tests configuration of the image. * </p> * * @param imageTestsConfiguration * The image tests configuration of the image. */ public void setImageTestsConfiguration(ImageTestsConfiguration imageTestsConfiguration) { this.imageTestsConfiguration = imageTestsConfiguration; } /** * <p> * The image tests configuration of the image. * </p> * * @return The image tests configuration of the image. */ public ImageTestsConfiguration getImageTestsConfiguration() { return this.imageTestsConfiguration; } /** * <p> * The image tests configuration of the image. * </p> * * @param imageTestsConfiguration * The image tests configuration of the image. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withImageTestsConfiguration(ImageTestsConfiguration imageTestsConfiguration) { setImageTestsConfiguration(imageTestsConfiguration); return this; } /** * <p> * Collects additional information about the image being created, including the operating system (OS) version and * package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by * default. * </p> * * @param enhancedImageMetadataEnabled * Collects additional information about the image being created, including the operating system (OS) version * and package list. This information is used to enhance the overall experience of using EC2 Image Builder. * Enabled by default. */ public void setEnhancedImageMetadataEnabled(Boolean enhancedImageMetadataEnabled) { this.enhancedImageMetadataEnabled = enhancedImageMetadataEnabled; } /** * <p> * Collects additional information about the image being created, including the operating system (OS) version and * package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by * default. * </p> * * @return Collects additional information about the image being created, including the operating system (OS) * version and package list. This information is used to enhance the overall experience of using EC2 Image * Builder. Enabled by default. */ public Boolean getEnhancedImageMetadataEnabled() { return this.enhancedImageMetadataEnabled; } /** * <p> * Collects additional information about the image being created, including the operating system (OS) version and * package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by * default. * </p> * * @param enhancedImageMetadataEnabled * Collects additional information about the image being created, including the operating system (OS) version * and package list. This information is used to enhance the overall experience of using EC2 Image Builder. * Enabled by default. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withEnhancedImageMetadataEnabled(Boolean enhancedImageMetadataEnabled) { setEnhancedImageMetadataEnabled(enhancedImageMetadataEnabled); return this; } /** * <p> * Collects additional information about the image being created, including the operating system (OS) version and * package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by * default. * </p> * * @return Collects additional information about the image being created, including the operating system (OS) * version and package list. This information is used to enhance the overall experience of using EC2 Image * Builder. Enabled by default. */ public Boolean isEnhancedImageMetadataEnabled() { return this.enhancedImageMetadataEnabled; } /** * <p> * The tags of the image. * </p> * * @return The tags of the image. */ public java.util.Map<String, String> getTags() { return tags; } /** * <p> * The tags of the image. * </p> * * @param tags * The tags of the image. */ public void setTags(java.util.Map<String, String> tags) { this.tags = tags; } /** * <p> * The tags of the image. * </p> * * @param tags * The tags of the image. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; } /** * Add a single Tags entry * * @see CreateImageRequest#withTags * @returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest addTagsEntry(String key, String value) { if (null == this.tags) { this.tags = new java.util.HashMap<String, String>(); } if (this.tags.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.tags.put(key, value); return this; } /** * Removes all the entries added into Tags. * * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest clearTagsEntries() { this.tags = null; return this; } /** * <p> * The idempotency token used to make this request idempotent. * </p> * * @param clientToken * The idempotency token used to make this request idempotent. */ public void setClientToken(String clientToken) { this.clientToken = clientToken; } /** * <p> * The idempotency token used to make this request idempotent. * </p> * * @return The idempotency token used to make this request idempotent. */ public String getClientToken() { return this.clientToken; } /** * <p> * The idempotency token used to make this request idempotent. * </p> * * @param clientToken * The idempotency token used to make this request idempotent. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateImageRequest withClientToken(String clientToken) { setClientToken(clientToken); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getImageRecipeArn() != null) sb.append("ImageRecipeArn: ").append(getImageRecipeArn()).append(","); if (getContainerRecipeArn() != null) sb.append("ContainerRecipeArn: ").append(getContainerRecipeArn()).append(","); if (getDistributionConfigurationArn() != null) sb.append("DistributionConfigurationArn: ").append(getDistributionConfigurationArn()).append(","); if (getInfrastructureConfigurationArn() != null) sb.append("InfrastructureConfigurationArn: ").append(getInfrastructureConfigurationArn()).append(","); if (getImageTestsConfiguration() != null) sb.append("ImageTestsConfiguration: ").append(getImageTestsConfiguration()).append(","); if (getEnhancedImageMetadataEnabled() != null) sb.append("EnhancedImageMetadataEnabled: ").append(getEnhancedImageMetadataEnabled()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()).append(","); if (getClientToken() != null) sb.append("ClientToken: ").append(getClientToken()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateImageRequest == false) return false; CreateImageRequest other = (CreateImageRequest) obj; if (other.getImageRecipeArn() == null ^ this.getImageRecipeArn() == null) return false; if (other.getImageRecipeArn() != null && other.getImageRecipeArn().equals(this.getImageRecipeArn()) == false) return false; if (other.getContainerRecipeArn() == null ^ this.getContainerRecipeArn() == null) return false; if (other.getContainerRecipeArn() != null && other.getContainerRecipeArn().equals(this.getContainerRecipeArn()) == false) return false; if (other.getDistributionConfigurationArn() == null ^ this.getDistributionConfigurationArn() == null) return false; if (other.getDistributionConfigurationArn() != null && other.getDistributionConfigurationArn().equals(this.getDistributionConfigurationArn()) == false) return false; if (other.getInfrastructureConfigurationArn() == null ^ this.getInfrastructureConfigurationArn() == null) return false; if (other.getInfrastructureConfigurationArn() != null && other.getInfrastructureConfigurationArn().equals(this.getInfrastructureConfigurationArn()) == false) return false; if (other.getImageTestsConfiguration() == null ^ this.getImageTestsConfiguration() == null) return false; if (other.getImageTestsConfiguration() != null && other.getImageTestsConfiguration().equals(this.getImageTestsConfiguration()) == false) return false; if (other.getEnhancedImageMetadataEnabled() == null ^ this.getEnhancedImageMetadataEnabled() == null) return false; if (other.getEnhancedImageMetadataEnabled() != null && other.getEnhancedImageMetadataEnabled().equals(this.getEnhancedImageMetadataEnabled()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getClientToken() == null ^ this.getClientToken() == null) return false; if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getImageRecipeArn() == null) ? 0 : getImageRecipeArn().hashCode()); hashCode = prime * hashCode + ((getContainerRecipeArn() == null) ? 0 : getContainerRecipeArn().hashCode()); hashCode = prime * hashCode + ((getDistributionConfigurationArn() == null) ? 0 : getDistributionConfigurationArn().hashCode()); hashCode = prime * hashCode + ((getInfrastructureConfigurationArn() == null) ? 0 : getInfrastructureConfigurationArn().hashCode()); hashCode = prime * hashCode + ((getImageTestsConfiguration() == null) ? 0 : getImageTestsConfiguration().hashCode()); hashCode = prime * hashCode + ((getEnhancedImageMetadataEnabled() == null) ? 0 : getEnhancedImageMetadataEnabled().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); return hashCode; } @Override public CreateImageRequest clone() { return (CreateImageRequest) super.clone(); } }
3e16669eaaf0c006fec4914664f0f11df23d7e8e
340
java
Java
common/common-util/src/main/java/com/pg85/otg/util/materials/LocalMaterialTag.java
evernife/OpenTerrainGenerator
9b6bed00e50b71511b3004e4600ff2a6651ae21c
[ "MIT" ]
175
2017-04-17T01:37:52.000Z
2022-02-21T17:40:17.000Z
common/common-util/src/main/java/com/pg85/otg/util/materials/LocalMaterialTag.java
evernife/OpenTerrainGenerator
9b6bed00e50b71511b3004e4600ff2a6651ae21c
[ "MIT" ]
729
2017-04-23T15:53:51.000Z
2022-03-15T03:54:15.000Z
common/common-util/src/main/java/com/pg85/otg/util/materials/LocalMaterialTag.java
evernife/OpenTerrainGenerator
9b6bed00e50b71511b3004e4600ff2a6651ae21c
[ "MIT" ]
123
2017-04-30T15:53:56.000Z
2022-03-15T19:15:07.000Z
16.190476
64
0.741176
9,551
package com.pg85.otg.util.materials; /** * Represents one of Minecraft's material tags. * Immutable. */ public abstract class LocalMaterialTag extends LocalMaterialBase { @Override public boolean isTag() { return true; } @Override public boolean matches(LocalMaterialData material) { return material.isBlockTag(this); } }
3e1666e80aca16b03b8472a60df0598744a6ce2b
1,458
java
Java
ProjetoBlackjack/src/PacoteBlackJack/Jogador.java
matheusmas132/Blackjack-in-Java
99c9d34bf77d5297f524a9a2d9ed3beda4cda204
[ "MIT" ]
null
null
null
ProjetoBlackjack/src/PacoteBlackJack/Jogador.java
matheusmas132/Blackjack-in-Java
99c9d34bf77d5297f524a9a2d9ed3beda4cda204
[ "MIT" ]
null
null
null
ProjetoBlackjack/src/PacoteBlackJack/Jogador.java
matheusmas132/Blackjack-in-Java
99c9d34bf77d5297f524a9a2d9ed3beda4cda204
[ "MIT" ]
null
null
null
25.137931
101
0.643347
9,552
/* * 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 PacoteBlackJack; import java.util.ArrayList; import java.util.List; /** * * @author matheus */ public class Jogador extends Pessoa{ private String email; private List<Carta> cartasSacadas; public Jogador(String nome, String dataDeNascimento, int cpf, String nacionalidade, String email){ super(nome, dataDeNascimento, cpf, nacionalidade); this.email = email; cartasSacadas = new ArrayList(); } protected String getEmail(){ return email; } protected void setEmail(String email){ this.email = email; } protected void imprimeDadosJogador(){ System.out.println("Dados do "+getNome()+":"); System.out.println("data de nascimento: "+getDataDeNascimento()); System.out.println("CPF: "+getCPF()); System.out.println("Nacionalidade: "+getNacionalidade()); System.out.println("Email: "+getEmail()); } @Override public void mensagemVitoria(){ System.out.println("Venci! uhuuuu"); } protected int getPontos(){ int total = 0; for(Carta c : cartasSacadas){ total += c.getValor(); } return total; } public void adicionarCartaSacada(Carta c){ this.cartasSacadas.add(c); } }
3e166856cdd56844cd1523f4da341f654de50350
6,370
java
Java
src/main/java/com/erp/db/model/UserInfo.java
diwang011/erp
401238ffd1182b16bd998c75fe403476d97bb6a1
[ "MIT" ]
null
null
null
src/main/java/com/erp/db/model/UserInfo.java
diwang011/erp
401238ffd1182b16bd998c75fe403476d97bb6a1
[ "MIT" ]
null
null
null
src/main/java/com/erp/db/model/UserInfo.java
diwang011/erp
401238ffd1182b16bd998c75fe403476d97bb6a1
[ "MIT" ]
null
null
null
28.061674
79
0.63438
9,553
package com.erp.db.model; public class UserInfo { /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.id * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private Integer id; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.username * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private String username; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.password * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private String password; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.usertype * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private String usertype; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.realname * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private String realname; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.consumerId * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private String consumerId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column userinfo.privateKey * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ private String privateKey; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.id * * @return the value of userinfo.id * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.id * * @param id the value for userinfo.id * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.username * * @return the value of userinfo.username * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public String getUsername() { return username; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.username * * @param username the value for userinfo.username * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setUsername(String username) { this.username = username; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.password * * @return the value of userinfo.password * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public String getPassword() { return password; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.password * * @param password the value for userinfo.password * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setPassword(String password) { this.password = password; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.usertype * * @return the value of userinfo.usertype * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public String getUsertype() { return usertype; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.usertype * * @param usertype the value for userinfo.usertype * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setUsertype(String usertype) { this.usertype = usertype; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.realname * * @return the value of userinfo.realname * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public String getRealname() { return realname; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.realname * * @param realname the value for userinfo.realname * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setRealname(String realname) { this.realname = realname; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.consumerId * * @return the value of userinfo.consumerId * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public String getConsumerId() { return consumerId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.consumerId * * @param consumerId the value for userinfo.consumerId * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setConsumerId(String consumerId) { this.consumerId = consumerId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column userinfo.privateKey * * @return the value of userinfo.privateKey * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public String getPrivateKey() { return privateKey; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column userinfo.privateKey * * @param privateKey the value for userinfo.privateKey * * @mbggenerated Wed May 31 17:22:58 CST 2017 */ public void setPrivateKey(String privateKey) { this.privateKey = privateKey; } }
3e16688c9b6087e2418510500d8959c937ca9dda
4,302
java
Java
src/main/java/com/philips/research/philipsonfhir/fhirproxy/support/bulkdata/async/AsyncSession.java
PhilipsOnFhir/fhir-proxy
6690169428fe363abf557da834a193aa618bb803
[ "BSD-3-Clause-Clear" ]
null
null
null
src/main/java/com/philips/research/philipsonfhir/fhirproxy/support/bulkdata/async/AsyncSession.java
PhilipsOnFhir/fhir-proxy
6690169428fe363abf557da834a193aa618bb803
[ "BSD-3-Clause-Clear" ]
null
null
null
src/main/java/com/philips/research/philipsonfhir/fhirproxy/support/bulkdata/async/AsyncSession.java
PhilipsOnFhir/fhir-proxy
6690169428fe363abf557da834a193aa618bb803
[ "BSD-3-Clause-Clear" ]
null
null
null
32.104478
125
0.645514
9,554
package com.philips.research.philipsonfhir.fhirproxy.support.bulkdata.async; import ca.uhn.fhir.context.FhirContext; import com.philips.research.philipsonfhir.fhirproxy.support.bulkdata.fhir.BundleRetriever; import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.IBaseResource; import java.util.Date; import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.stream.Collectors; public class AsyncSession { private static FhirContext ourCtx = FhirContext.forDstu3(); private final Date transActionTime; private final AsyncSessionProcessor processor; private final FhirRequest fhirRequest; private AsyncResult asyncResult; public AsyncSession(FhirRequest fhirRequest) { this.transActionTime = new Date(); this.fhirRequest = fhirRequest; processor = new AsyncSessionProcessor(); (new Thread(processor)).start(); } public boolean isReady() { return processor.isDone; } public Date getTransActionTime() { return transActionTime; } // public static void processBundle(AsyncResult asyncResult, Bundle bundle, IFhirServer fhirServer) throws FHIRException { // AsyncService.logger.debug( "process Bundle" ); // // Bundle currentBundle = bundle; // while ( currentBundle.getLink( Bundle.LINK_NEXT ) != null ) { // AsyncService.logger.debug( "process Bundle - load next" ); // Bundle nextPage = fhirServer.loadPage( currentBundle ); // asyncResult.addBundle( nextPage ); // currentBundle = nextPage; // } // AsyncService.logger.debug( "process Bundle done" ); // // } public List<Resource> getResultResources(String resourceName) { return processor.getResult().resultTreeMap.get(resourceName).values() .stream().collect(Collectors.toList()); } public List<String> getResultResourceNames() { return processor.getResult().resultTreeMap.keySet().stream() .collect(Collectors.toList()); } public String getCallUrl() { return fhirRequest.getCallUrl(); } public int getResourceCount(String resourceName) { return processor.getResult().resultTreeMap.get( resourceName ).size(); } public boolean returnNdJson() { return this.fhirRequest.returnNdJson(); } public String getProcessDescription() { if ( this.fhirRequest.getFhirOperationCall() != null ) { return this.fhirRequest.getFhirOperationCall().getDescription(); } else { return "processing"; } } public Map<String, OperationOutcome> getErrorMap() { if ( this.fhirRequest.getFhirOperationCall() != null ) { return this.fhirRequest.getFhirOperationCall().getErrors(); } return new TreeMap<>(); } private class AsyncSessionProcessor implements Runnable { private boolean isDone = false; @Override public synchronized void run() { AsyncService.logger.info( "Async processing start" ); try { IBaseResource iBaseResource = fhirRequest.getResource(); asyncResult = new AsyncResult(); if ( iBaseResource instanceof Bundle) { Bundle bundle = (Bundle)iBaseResource; asyncResult.addBundle( bundle ); BundleRetriever bundleRetriever = new BundleRetriever( fhirRequest.getFhirServer(), bundle ); asyncResult.addResources( bundleRetriever.retrieveAllResources() ); // processBundle( asyncResult, bundle, fhirRequest.getFhirServer() ); } else if ( iBaseResource instanceof Resource) { asyncResult.addResource( (Resource)iBaseResource ); } } catch (FHIRException e ) { e.printStackTrace(); } AsyncService.logger.info( "Async processing done" ); isDone = true; } public AsyncResult getResult() { return asyncResult; } } }
3e1669b61e2f454d9cd128ceca5c738a6761c5b7
23,863
java
Java
modules/paged_data/src/main/java/org/exbin/auxiliary/paged_data/PagedData.java
exbin/exbin-utils-java
1573d4d0fcb0cea28679cfc85646f2b9ad140bd8
[ "Apache-2.0" ]
null
null
null
modules/paged_data/src/main/java/org/exbin/auxiliary/paged_data/PagedData.java
exbin/exbin-utils-java
1573d4d0fcb0cea28679cfc85646f2b9ad140bd8
[ "Apache-2.0" ]
1
2021-10-01T21:07:46.000Z
2021-10-01T21:35:34.000Z
modules/paged_data/src/main/java/org/exbin/auxiliary/paged_data/PagedData.java
exbin/exbin-utils-java
1573d4d0fcb0cea28679cfc85646f2b9ad140bd8
[ "Apache-2.0" ]
null
null
null
33.992877
185
0.545112
9,555
/* * Copyright (C) ExBin Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.exbin.auxiliary.paged_data; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.InvalidParameterException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; /** * Encapsulation class for binary data blob. * * Data are stored using paging. Last page might be shorter than page size, but * not empty. * * @version 0.2.1 2021/10/31 * @author ExBin Project (https://exbin.org) */ @ParametersAreNonnullByDefault public class PagedData implements EditableBinaryData { public static final int DEFAULT_PAGE_SIZE = 4096; public static final long MAX_DATA_SIZE = Long.MAX_VALUE; private int pageSize = DEFAULT_PAGE_SIZE; @Nonnull private final List<DataPage> data = new ArrayList<>(); @Nullable private DataPageProvider dataPageProvider = null; public PagedData() { } public PagedData(DataPageProvider dataPageProvider) { this.dataPageProvider = dataPageProvider; } public PagedData(int pageSize) { this.pageSize = pageSize; } @Override public boolean isEmpty() { return data.isEmpty(); } @Override public long getDataSize() { return (data.size() > 1 ? (data.size() - 1) * pageSize : 0) + (data.size() > 0 ? data.get(data.size() - 1).getDataLength() : 0); } @Override public void setDataSize(long size) { if (size < 0) { throw new InvalidParameterException("Size cannot be negative"); } long dataSize = getDataSize(); if (size > dataSize) { int lastPage = (int) (dataSize / pageSize); int lastPageSize = (int) (dataSize % pageSize); long remaining = size - dataSize; // extend last page if (lastPageSize > 0) { byte[] page = getPage(lastPage); int nextPageSize = remaining + lastPageSize > pageSize ? pageSize : (int) remaining + lastPageSize; byte[] newPage = new byte[nextPageSize]; System.arraycopy(page, 0, newPage, 0, lastPageSize); setPage(lastPage, createNewPage(newPage)); remaining -= (nextPageSize - lastPageSize); lastPage++; } while (remaining > 0) { int nextPageSize = remaining > pageSize ? pageSize : (int) remaining; data.add(createNewPage(new byte[nextPageSize])); remaining -= nextPageSize; } } else if (size < dataSize) { int lastPage = (int) (size / pageSize); int lastPageSize = (int) (size % pageSize); // shrink last page if (lastPageSize > 0) { byte[] page = getPage(lastPage); byte[] newPage = new byte[lastPageSize]; System.arraycopy(page, 0, newPage, 0, lastPageSize); setPage(lastPage, createNewPage(newPage)); lastPage++; } for (int pageIndex = data.size() - 1; pageIndex >= lastPage; pageIndex--) { data.remove(pageIndex); } } } @Override public byte getByte(long position) { byte[] page = getPage((int) (position / pageSize)); try { return page[(int) (position % pageSize)]; } catch (ArrayIndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } } @Override public void setByte(long position, byte value) { byte[] page; page = getPage((int) (position / pageSize)); try { page[(int) (position % pageSize)] = value; } catch (ArrayIndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } } @Override public void insertUninitialized(long startFrom, long length) { if (length < 0) { throw new IllegalArgumentException("Length of inserted block must be nonnegative"); } if (startFrom < 0) { throw new IllegalArgumentException("Position of inserted block must be nonnegative"); } long dataSize = getDataSize(); if (startFrom > dataSize) { throw new OutOfBoundsException("Inserted block must be inside or directly after existing data"); } if (length > MAX_DATA_SIZE - getDataSize()) { throw new DataOverflowException("Maximum array size overflow"); } if (startFrom >= dataSize) { setDataSize(startFrom + length); } else if (length > 0) { long copyLength = dataSize - startFrom; dataSize = dataSize + length; setDataSize(dataSize); long sourceEnd = dataSize - length; long targetEnd = dataSize; // Backward copy while (copyLength > 0) { byte[] sourcePage = getPage((int) (sourceEnd / pageSize)); int sourceOffset = (int) (sourceEnd % pageSize); if (sourceOffset == 0) { sourcePage = getPage((int) ((sourceEnd - 1) / pageSize)); sourceOffset = sourcePage.length; } byte[] targetPage = getPage((int) (targetEnd / pageSize)); int targetOffset = (int) (targetEnd % pageSize); if (targetOffset == 0) { targetPage = getPage((int) ((targetEnd - 1) / pageSize)); targetOffset = targetPage.length; } int copySize = sourceOffset > targetOffset ? targetOffset : sourceOffset; if (copySize > copyLength) { copySize = (int) copyLength; } System.arraycopy(sourcePage, sourceOffset - copySize, targetPage, targetOffset - copySize, copySize); copyLength -= copySize; sourceEnd -= copySize; targetEnd -= copySize; } } } @Override public void insert(long startFrom, long length) { insertUninitialized(startFrom, length); fillData(startFrom, length); } @Override public void insert(long startFrom, BinaryData insertedData) { long length = insertedData.getDataSize(); insertUninitialized(startFrom, length); replace(startFrom, insertedData, 0, length); } @Override public void insert(long startFrom, BinaryData insertedData, long insertedDataOffset, long insertedDataLength) { insertUninitialized(startFrom, insertedDataLength); replace(startFrom, insertedData, insertedDataOffset, insertedDataLength); } @Override public void insert(long startFrom, byte[] insertedData) { insert(startFrom, insertedData, 0, insertedData.length); } @Override public void insert(long startFrom, byte[] insertedData, int insertedDataOffset, int insertedDataLength) { if (insertedDataLength <= 0) { return; } insertUninitialized(startFrom, insertedDataLength); while (insertedDataLength > 0) { byte[] targetPage = getPage((int) (startFrom / pageSize)); int targetOffset = (int) (startFrom % pageSize); int blockLength = pageSize - targetOffset; if (blockLength > insertedDataLength) { blockLength = insertedDataLength; } try { System.arraycopy(insertedData, insertedDataOffset, targetPage, targetOffset, blockLength); } catch (ArrayIndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } insertedDataOffset += blockLength; insertedDataLength -= blockLength; startFrom += blockLength; } } @Override public long insert(long startFrom, InputStream inputStream, long dataSize) throws IOException { if (dataSize > MAX_DATA_SIZE - getDataSize()) { throw new DataOverflowException("Maximum array size overflow"); } if (startFrom > getDataSize()) { setDataSize(startFrom); } long loadedData = 0; int pageOffset = (int) (startFrom % pageSize); byte[] buffer = new byte[pageSize]; while (dataSize == -1 || dataSize > 0) { int dataToRead = pageSize - pageOffset; if (dataSize >= 0 && dataSize < dataToRead) { dataToRead = (int) dataSize; } if (pageOffset > 0 && dataToRead > pageOffset) { // Align to data pages dataToRead = pageOffset; } int redLength = 0; while (dataToRead > 0) { int red = inputStream.read(buffer, redLength, dataToRead); if (red == -1) { break; } else { redLength += red; dataToRead -= red; } } insert(startFrom, buffer, 0, redLength); startFrom += redLength; dataSize -= redLength; loadedData += redLength; pageOffset = 0; } return loadedData; } @Override public void fillData(long startFrom, long length) { fillData(startFrom, length, (byte) 0); } @Override public void fillData(long startFrom, long length, byte fill) { if (length < 0) { throw new IllegalArgumentException("Length of filled block must be nonnegative"); } if (startFrom < 0) { throw new IllegalArgumentException("Position of filler block must be nonnegative"); } if (startFrom + length > getDataSize()) { throw new OutOfBoundsException("Filled block must be inside existing data"); } while (length > 0) { byte[] page = getPage((int) (startFrom / pageSize)); int pageOffset = (int) (startFrom % pageSize); int fillSize = page.length - pageOffset; if (fillSize > length) { fillSize = (int) length; } Arrays.fill(page, pageOffset, pageOffset + fillSize, fill); length -= fillSize; startFrom += fillSize; } } @Nonnull @Override public PagedData copy() { PagedData targetData = new PagedData(); targetData.insert(0, this); return targetData; } @Nonnull @Override public PagedData copy(long startFrom, long length) { PagedData targetData = new PagedData(); targetData.insertUninitialized(0, length); targetData.replace(0, this, startFrom, length); return targetData; } @Override public void copyToArray(long startFrom, byte[] target, int offset, int length) { while (length > 0) { byte[] page = getPage((int) (startFrom / pageSize)); int pageOffset = (int) (startFrom % pageSize); int copySize = pageSize - pageOffset; if (copySize > length) { copySize = length; } try { System.arraycopy(page, pageOffset, target, offset, copySize); } catch (ArrayIndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } length -= copySize; offset += copySize; startFrom += copySize; } } @Override public void remove(long startFrom, long length) { if (length < 0) { throw new IllegalArgumentException("Length of removed block must be nonnegative"); } if (startFrom < 0) { throw new IllegalArgumentException("Position of removed block must be nonnegative"); } if (startFrom + length > getDataSize()) { throw new OutOfBoundsException("Removed block must be inside existing data"); } if (length > 0) { replace(startFrom, this, startFrom + length, getDataSize() - startFrom - length); setDataSize(getDataSize() - length); } } @Override public void clear() { data.clear(); } /** * returns number of pages currently used. * * @return count of pages */ public int getPagesCount() { return data.size(); } /** * Returns currently used page size. * * @return page size in bytes */ public int getPageSize() { return pageSize; } /** * Gets data page allowing direct access to it. * * @param pageIndex page index * @return data page */ @Nonnull public byte[] getPage(int pageIndex) { try { return data.get(pageIndex).getData(); } catch (IndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } } /** * Sets data page replacing existing page by reference. * * @param pageIndex page index * @param dataPage data page */ public void setPage(int pageIndex, DataPage dataPage) { try { data.set(pageIndex, dataPage); } catch (IndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } } @Override public void replace(long targetPosition, BinaryData replacingData) { replace(targetPosition, replacingData, 0, replacingData.getDataSize()); } @Override public void replace(long targetPosition, BinaryData replacingData, long startFrom, long length) { if (targetPosition + length > getDataSize()) { throw new OutOfBoundsException("Data can be replaced only inside or at the end"); } if (replacingData instanceof PagedData) { if (replacingData != this || (startFrom > targetPosition) || (startFrom + length < targetPosition)) { while (length > 0) { byte[] page = getPage((int) (targetPosition / pageSize)); int offset = (int) (targetPosition % pageSize); byte[] sourcePage = ((PagedData) replacingData).getPage((int) (startFrom / ((PagedData) replacingData).getPageSize())); int sourceOffset = (int) (startFrom % ((PagedData) replacingData).getPageSize()); int copySize = pageSize - offset; if (copySize > ((PagedData) replacingData).getPageSize() - sourceOffset) { copySize = ((PagedData) replacingData).getPageSize() - sourceOffset; } if (copySize > length) { copySize = (int) length; } try { System.arraycopy(sourcePage, sourceOffset, page, offset, copySize); } catch (ArrayIndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } length -= copySize; targetPosition += copySize; startFrom += copySize; } } else { targetPosition += length - 1; startFrom += length - 1; while (length > 0) { byte[] page = getPage((int) (targetPosition / pageSize)); int upTo = (int) (targetPosition % pageSize) + 1; byte[] sourcePage = ((PagedData) replacingData).getPage((int) (startFrom / ((PagedData) replacingData).getPageSize())); int sourceUpTo = (int) (startFrom % ((PagedData) replacingData).getPageSize()) + 1; int copySize = upTo; if (copySize > sourceUpTo) { copySize = sourceUpTo; } if (copySize > length) { copySize = (int) length; } int offset = upTo - copySize; int sourceOffset = sourceUpTo - copySize; System.arraycopy(sourcePage, sourceOffset, page, offset, copySize); length -= copySize; targetPosition -= copySize; startFrom -= copySize; } } } else { while (length > 0) { byte[] page = getPage((int) (targetPosition / pageSize)); int offset = (int) (targetPosition % pageSize); int copySize = pageSize - offset; if (copySize > length) { copySize = (int) length; } replacingData.copyToArray(startFrom, page, offset, copySize); length -= copySize; targetPosition += copySize; startFrom += copySize; } } } @Override public void replace(long targetPosition, byte[] replacingData) { replace(targetPosition, replacingData, 0, replacingData.length); } @Override public void replace(long targetPosition, byte[] replacingData, int replacingDataOffset, int length) { if (targetPosition + length > getDataSize()) { throw new OutOfBoundsException("Data can be replaced only inside or at the end"); } while (length > 0) { byte[] page = getPage((int) (targetPosition / pageSize)); int offset = (int) (targetPosition % pageSize); int copySize = pageSize - offset; if (copySize > length) { copySize = length; } try { System.arraycopy(replacingData, replacingDataOffset, page, offset, copySize); } catch (ArrayIndexOutOfBoundsException ex) { throw new OutOfBoundsException(ex); } length -= copySize; targetPosition += copySize; replacingDataOffset += copySize; } } @Override public void loadFromStream(InputStream inputStream) throws IOException { data.clear(); byte[] buffer = new byte[pageSize]; int cnt; int offset = 0; while ((cnt = inputStream.read(buffer, offset, buffer.length - offset)) > 0) { if (cnt + offset < pageSize) { offset = offset + cnt; } else { data.add(createNewPage(buffer)); buffer = new byte[pageSize]; offset = 0; } } if (offset > 0) { byte[] tail = new byte[offset]; System.arraycopy(buffer, 0, tail, 0, offset); data.add(createNewPage(tail)); } } @Override public void saveToStream(OutputStream outputStream) throws IOException { for (DataPage dataPage : data) { outputStream.write(dataPage.getData()); } } @Nonnull @Override public OutputStream getDataOutputStream() { return new PagedDataOutputStream(this); } @Nonnull @Override public InputStream getDataInputStream() { return new PagedDataInputStream(this); } @Nonnull private DataPage createNewPage(byte[] pageData) { if (dataPageProvider != null) { return dataPageProvider.createPage(pageData); } return new ByteArrayData(pageData); } @Nullable public DataPageProvider getDataPageProvider() { return dataPageProvider; } public void setDataPageProvider(@Nullable DataPageProvider dataPageProvider) { this.dataPageProvider = dataPageProvider; } @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { if (obj instanceof BinaryData) { BinaryData other = (BinaryData) obj; long dataSize = getDataSize(); if (other.getDataSize() != dataSize) { return false; } int pageIndex = 0; int bufferSize = dataSize > pageSize ? pageSize : (int) dataSize; byte[] buffer = new byte[bufferSize]; int offset = 0; int remain = (int) dataSize; while (remain > 0) { int length = remain > bufferSize ? bufferSize : remain; other.copyToArray(offset, buffer, 0, length); // In Java 9+ // if (!Arrays.equals(data.get(pageIndex).getData(), 0, length, buffer, 0, length)) { // return false; // } { byte[] pageData = data.get(pageIndex).getData(); for (int i = 0; i < length; i++) { if (pageData[i] != buffer[i]) { return false; } } } offset += length; remain -= length; pageIndex++; } return true; } return false; } final PagedData other = (PagedData) obj; long dataSize = getDataSize(); if (other.getDataSize() != dataSize) { return false; } int pageIndex = 0; int otherPageIndex = 0; long offset = 0; long remain = dataSize; while (remain > 0) { int pageOffset = (int) (offset % pageSize); int otherPageOffset = (int) (offset % other.pageSize); int length = remain > pageSize - pageOffset ? pageSize - pageOffset : (int) remain; if (length > other.pageSize - otherPageOffset) { length = other.pageSize - otherPageOffset; } // In Java 9+ // if (!Arrays.equals(data.get(pageIndex).getData(), pageOffset, pageOffset + length, other.data.get(otherPageIndex).getData(), otherPageOffset, otherPageOffset + length)) { // return false; // } { byte[] pageData = data.get(pageIndex).getData(); byte[] otherPageData = other.data.get(otherPageIndex).getData(); int pageTestPos = pageOffset; int otherPageTestPos = otherPageOffset; for (int i = 0; i < length; i++) { if (pageData[pageTestPos] != otherPageData[otherPageTestPos]) { return false; } pageTestPos++; otherPageTestPos++; } } offset += length; remain -= length; pageIndex++; } return true; } @Override public int hashCode() { return Objects.hash(getDataSize()); } @Override public void dispose() { } }
3e1669f06ffa7f11e8c0282c6b0eac3064fb181b
330
java
Java
server/appengine/src/main/java/who/WhoGuiceServletConfig.java
Harshit-techno/app
5e11f444cf853ad50286fc619d6560ed2abc8885
[ "Apache-2.0" ]
2,357
2020-03-18T13:48:36.000Z
2022-03-25T08:40:54.000Z
server/appengine/src/main/java/who/WhoGuiceServletConfig.java
Harshit-techno/app
5e11f444cf853ad50286fc619d6560ed2abc8885
[ "Apache-2.0" ]
1,594
2020-03-17T17:31:55.000Z
2022-03-29T02:38:26.000Z
server/appengine/src/main/java/who/WhoGuiceServletConfig.java
Harshit-techno/app
5e11f444cf853ad50286fc619d6560ed2abc8885
[ "Apache-2.0" ]
712
2020-03-17T20:34:26.000Z
2022-03-31T11:45:31.000Z
23.571429
72
0.806061
9,556
package who; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.servlet.GuiceServletContextListener; public class WhoGuiceServletConfig extends GuiceServletContextListener { @Override protected Injector getInjector() { return Guice.createInjector(new WhoServletModule()); } }
3e166a6a9cdfe54cbdcbf4e783ada23a36755a8d
3,149
java
Java
src/features/nyit/AtomicSlurs.java
angoodkind/DARPA_AA
fd554d34db28102e1e53919d565e2f2ddeda0d90
[ "MIT" ]
1
2018-09-06T08:11:15.000Z
2018-09-06T08:11:15.000Z
src/features/nyit/AtomicSlurs.java
angoodkind/DARPA_AA
fd554d34db28102e1e53919d565e2f2ddeda0d90
[ "MIT" ]
null
null
null
src/features/nyit/AtomicSlurs.java
angoodkind/DARPA_AA
fd554d34db28102e1e53919d565e2f2ddeda0d90
[ "MIT" ]
null
null
null
36.616279
141
0.632582
9,557
package features.nyit; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import extractors.data.Answer; import extractors.data.DataNode; import extractors.data.ExtractionModule; import extractors.data.Feature; import keystroke.KeyStroke; public class AtomicSlurs implements ExtractionModule { private HashMap<Integer, LinkedList<Long>> featureMap = new HashMap<Integer, LinkedList<Long>>(1800); private int[] alphaNumeric = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}; private int[] punctuation = {44, 45, 46, 59, 222, 47, 92, 91, 93, 192}; private void createSearchSpace() { featureMap.clear(); for (Integer i : alphaNumeric) for (Integer j : alphaNumeric) featureMap.put(i * 1000 + j, new LinkedList<Long>()); for (Integer i : alphaNumeric) for (Integer j : punctuation) featureMap.put(i * 1000 + j, new LinkedList<Long>()); for (Integer i : alphaNumeric) featureMap.put(i * 1000 + 32, new LinkedList<Long>()); } @Override public Collection<Feature> extract(DataNode data) { createSearchSpace(); LinkedList<KeyStroke> buffer = new LinkedList<KeyStroke>(); for (Answer a : data) { buffer.clear(); for (KeyStroke k : a.getKeyStrokeList()) { /////////////////Main Logic/////////////////////// buffer.add(k); if (buffer.size() > 3) { if (isSlur(buffer)) featureMap.get(buffer.get(0).getKeyCode() * 1000 + buffer.get(1).getKeyCode()).add(buffer.get(2).getWhen() - buffer.get(1).getWhen()); buffer.poll(); } ////////////////////////////////////////////////// } } LinkedList<Feature> output = new LinkedList<Feature>(); for (Integer i : alphaNumeric) for (Integer j : alphaNumeric) output.add(new Feature("S_" + KeyStroke.vkCodetoString(i) + "_" + KeyStroke.vkCodetoString(j), featureMap.get(i*1000 + j))); for (Integer i : alphaNumeric) for (Integer j : punctuation) output.add(new Feature("S_" + KeyStroke.vkCodetoString(i) + "_" + KeyStroke.vkCodetoString(j), featureMap.get(i*1000 + j))); for (Integer i : alphaNumeric) output.add(new Feature("S_" + KeyStroke.vkCodetoString(i) + "_" + KeyStroke.vkCodetoString(32), featureMap.get(i*1000 + 32))); return output; } private boolean isSlur(LinkedList<KeyStroke> buffer) { // if the featureMap contains the hash value of the first two keys if (featureMap.keySet().contains(buffer.get(0).getKeyCode() * 1000 + buffer.get(1).getKeyCode())) { // if the keys follow the pattern press, press, release, release if (buffer.get(0).isKeyPress() && buffer.get(1).isKeyPress() && buffer.get(2).isKeyRelease() && buffer.get(3).isKeyRelease()) { // if the keys follow pattern A, B, A, B if (buffer.get(0).getKeyCode() == buffer.get(2).getKeyCode() && buffer.get(1).getKeyCode() == buffer.get(3).getKeyCode()) { return true; } } } return false; } @Override public String getName() { return "Atomic Slurs"; } }
3e166b060b89085f9bf57d8d8eb0a2b43b9adb5d
168
java
Java
hu.bme.mit.theta.cfa/src/main/java/hu/bme/mit/theta/cfa/dsl/package-info.java
simon5521/theta
9e22bb69f0272fa4b004b1748cce523342d65466
[ "Apache-2.0" ]
14
2020-02-18T20:16:18.000Z
2022-03-28T13:39:52.000Z
hu.bme.mit.theta.cfa/src/main/java/hu/bme/mit/theta/cfa/dsl/package-info.java
simon5521/theta
9e22bb69f0272fa4b004b1748cce523342d65466
[ "Apache-2.0" ]
93
2020-03-03T12:51:44.000Z
2022-03-30T18:00:32.000Z
hu.bme.mit.theta.cfa/src/main/java/hu/bme/mit/theta/cfa/dsl/package-info.java
simon5521/theta
9e22bb69f0272fa4b004b1748cce523342d65466
[ "Apache-2.0" ]
21
2020-02-16T01:03:34.000Z
2022-03-08T19:08:13.000Z
24
75
0.714286
9,558
/** * This package contains a domain specific language (DSL) for parsing CFAs. * * @see hu.bme.mit.theta.cfa.dsl.CfaDslManager */ package hu.bme.mit.theta.cfa.dsl;
3e166ba5668410823227a0691da17d42586ccb4e
827
java
Java
pmd-php/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java
magnologan/pmd
76af873708d4c8aecbfd5b1b7d8e9a7859ad54bd
[ "Apache-2.0" ]
null
null
null
pmd-php/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java
magnologan/pmd
76af873708d4c8aecbfd5b1b7d8e9a7859ad54bd
[ "Apache-2.0" ]
null
null
null
pmd-php/src/test/java/net/sourceforge/pmd/LanguageVersionTest.java
magnologan/pmd
76af873708d4c8aecbfd5b1b7d8e9a7859ad54bd
[ "Apache-2.0" ]
null
null
null
33.08
151
0.729141
9,559
package net.sourceforge.pmd; import java.util.Arrays; import java.util.Collection; import net.sourceforge.pmd.lang.LanguageRegistry; import net.sourceforge.pmd.lang.LanguageVersion; import net.sourceforge.pmd.lang.php.PhpLanguageModule; import org.junit.runners.Parameterized.Parameters; public class LanguageVersionTest extends AbstractLanguageVersionTest { public LanguageVersionTest(String name, String terseName, String version, LanguageVersion expected) { super(name, terseName, version, expected); } @Parameters public static Collection data() { return Arrays.asList(new Object[][] { { PhpLanguageModule.NAME, PhpLanguageModule.TERSE_NAME, "", LanguageRegistry.getLanguage(PhpLanguageModule.NAME).getDefaultVersion() } }); } }
3e166bcbee2b878abed5479980c4c0de6c4b33e6
2,149
java
Java
aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/model/transform/ListTagsForResourceRequestMarshaller.java
jplippi/aws-sdk-java
147eefec220e2944dc571283af6552611bc94301
[ "Apache-2.0" ]
1
2020-08-27T17:36:34.000Z
2020-08-27T17:36:34.000Z
aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/model/transform/ListTagsForResourceRequestMarshaller.java
jplippi/aws-sdk-java
147eefec220e2944dc571283af6552611bc94301
[ "Apache-2.0" ]
3
2020-04-15T20:08:15.000Z
2021-06-30T19:58:16.000Z
aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/model/transform/ListTagsForResourceRequestMarshaller.java
jplippi/aws-sdk-java
147eefec220e2944dc571283af6552611bc94301
[ "Apache-2.0" ]
1
2020-10-10T15:59:17.000Z
2020-10-10T15:59:17.000Z
40.54717
146
0.76268
9,560
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.route53.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.route53.model.*; import com.amazonaws.transform.Marshaller; /** * ListTagsForResourceRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ListTagsForResourceRequestMarshaller implements Marshaller<Request<ListTagsForResourceRequest>, ListTagsForResourceRequest> { public Request<ListTagsForResourceRequest> marshall(ListTagsForResourceRequest listTagsForResourceRequest) { if (listTagsForResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<ListTagsForResourceRequest> request = new DefaultRequest<ListTagsForResourceRequest>(listTagsForResourceRequest, "AmazonRoute53"); request.setHttpMethod(HttpMethodName.GET); String uriResourcePath = "/2013-04-01/tags/{ResourceType}/{ResourceId}"; uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "ResourceType", listTagsForResourceRequest.getResourceType()); uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY .marshall(uriResourcePath, "ResourceId", listTagsForResourceRequest.getResourceId()); request.setResourcePath(uriResourcePath); return request; } }
3e166c6f962be05c4ff63397b9e660f67ae536ac
273
java
Java
src/main/java/com/valhallagame/ymer/message/notification/UnregisterNotificationListenerParameter.java
saiaku-gaming/ymer
9530093fd051aed85235627953a644ea3c5e71d1
[ "MIT" ]
null
null
null
src/main/java/com/valhallagame/ymer/message/notification/UnregisterNotificationListenerParameter.java
saiaku-gaming/ymer
9530093fd051aed85235627953a644ea3c5e71d1
[ "MIT" ]
null
null
null
src/main/java/com/valhallagame/ymer/message/notification/UnregisterNotificationListenerParameter.java
saiaku-gaming/ymer
9530093fd051aed85235627953a644ea3c5e71d1
[ "MIT" ]
null
null
null
21
60
0.85348
9,561
package com.valhallagame.ymer.message.notification; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor public final class UnregisterNotificationListenerParameter { String gameSessionId; }
3e166dbaa02a4c2043ebdf9b3f3457eb1dbb71cd
6,971
java
Java
zheng-core/src/main/java/com/github/zhengframework/configuration/ConfigurationBeanMapper.java
zheng-framework/zhengframework
136970ce81693dfe6d59fe977bd62e2b32654a8c
[ "Apache-2.0" ]
3
2020-05-02T13:11:20.000Z
2020-09-14T06:42:04.000Z
zheng-core/src/main/java/com/github/zhengframework/configuration/ConfigurationBeanMapper.java
zheng-framework/zhengframework
136970ce81693dfe6d59fe977bd62e2b32654a8c
[ "Apache-2.0" ]
6
2020-05-10T04:12:08.000Z
2021-09-20T20:58:01.000Z
zheng-core/src/main/java/com/github/zhengframework/configuration/ConfigurationBeanMapper.java
zheng-framework/zhengframework
136970ce81693dfe6d59fe977bd62e2b32654a8c
[ "Apache-2.0" ]
null
null
null
42.248485
104
0.709798
9,562
package com.github.zhengframework.configuration; /*- * #%L * zheng-core * %% * Copyright (C) 2020 Zheng MingHai * %% * 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. * #L% */ import static com.github.zhengframework.configuration.ConfigurationDefineUtils.checkConfigurationDefine; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper; import com.github.drapostolos.typeparser.TypeParser; import com.github.zhengframework.common.SuppressForbidden; import com.github.zhengframework.configuration.annotation.ConfigurationInfo; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.function.BiConsumer; @SuppressForbidden public class ConfigurationBeanMapper { private static final JavaPropsMapper mapper = JavaPropsMapper.builder() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false) .configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS, false) .configure(DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false) .configure(DeserializationFeature.FAIL_ON_NULL_CREATOR_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS, false) .configure(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY, false) .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true) .build(); private static <T> T resolveClass(Configuration configuration, Class<T> tClass) { try { T t = mapper.readMapAs(configuration.asMap(), tClass); for (Field field : tClass.getDeclaredFields()) { if (field.isAnnotationPresent(JsonIgnore.class)) { field.setAccessible(true); Class<?> fieldType = field.getType(); if (Map.class.isAssignableFrom(fieldType)) { Configuration prefix = configuration.prefix(field.getName()); TypeParser parser = TypeParser.newBuilder().build(); Type genericType = field.getGenericType(); ParameterizedType parameterizedType = (ParameterizedType) genericType; Type[] typeArguments = parameterizedType.getActualTypeArguments(); Type keyType = typeArguments[0]; Type valueType = typeArguments[1]; HashMap<Object, Object> map = new HashMap<>(); for (Entry<String, String> entry : prefix.asMap().entrySet()) { map.put( parser.parseType(entry.getKey(), keyType), parser.parseType(entry.getValue(), valueType)); } field.set(t, map); } } } return t; } catch (IOException | IllegalAccessException e) { throw new RuntimeException("resolve configuration error", e); } } public static <T> T resolve(Configuration configuration, String prefix, Class<T> aClass) { if (Strings.isNullOrEmpty(prefix)) { return resolveClass(configuration, aClass); } else { return resolveClass(configuration.prefix(prefix), aClass); } } public static <T> Set<T> resolveSet(Configuration configuration, String prefix, Class<T> aClass) { Preconditions.checkState(!Strings.isNullOrEmpty(prefix), "prefix cannot null or empty"); List<Configuration> configurationList = configuration.prefixList(prefix); Set<T> objects = new LinkedHashSet<>(configurationList.size()); for (Configuration configuration1 : configurationList) { objects.add(resolveClass(configuration1, aClass)); } return objects; } public static <T> Map<String, T> resolveMap( Configuration configuration, String prefix, Class<T> aClass) { Preconditions.checkState(!Strings.isNullOrEmpty(prefix), "prefix cannot null or empty"); Map<String, Configuration> configurationMap = configuration.prefixMap(prefix); LinkedHashMap<String, T> map = new LinkedHashMap<>(configurationMap.size()); for (Entry<String, Configuration> entry : configurationMap.entrySet()) { map.put(entry.getKey(), resolveClass(entry.getValue(), aClass)); } return map; } public static <C> Map<String, C> resolve(Configuration configuration, Class<? extends C> aClass) { checkConfigurationDefine(aClass); Map<String, C> map = new HashMap<>(); ConfigurationInfo configurationInfo = aClass.getAnnotation(ConfigurationInfo.class); String prefix = configurationInfo.prefix(); if (configurationInfo.supportGroup()) { Boolean group = configuration.getBoolean(prefix + ".group", false); if (!group) { C resolve = resolve(configuration, prefix, aClass); map.put("", resolve); } else { Map<String, ? extends C> resolveMap = resolveMap(configuration, prefix, aClass); resolveMap.forEach((BiConsumer<String, C>) map::put); } } else { C resolve = resolve(configuration, prefix, aClass); map.put("", resolve); } return Collections.unmodifiableMap(map); } public static <C> void resolve( Configuration configuration, Class<? extends C> aClass, BiConsumer<String, C> consumer) { checkConfigurationDefine(aClass); ConfigurationInfo configurationInfo = aClass.getAnnotation(ConfigurationInfo.class); String prefix = configurationInfo.prefix(); if (configurationInfo.supportGroup()) { Boolean group = configuration.getBoolean(prefix + ".group", false); if (!group) { C resolve = resolve(configuration, prefix, aClass); consumer.accept("", resolve); } else { Map<String, ? extends C> resolveMap = resolveMap(configuration, prefix, aClass); resolveMap.forEach(consumer); } } else { C resolve = resolve(configuration, prefix, aClass); consumer.accept("", resolve); } } }
3e166dc9150d8f22dd503dbd05c047621dc4a38f
17,021
java
Java
SMUGA/src/GUI/research/TestMuts.java
Evolutionary-Algorithms/Symbiotic-MuGA
e90155318209bed099dbec740339355c7c188b76
[ "Apache-2.0" ]
null
null
null
SMUGA/src/GUI/research/TestMuts.java
Evolutionary-Algorithms/Symbiotic-MuGA
e90155318209bed099dbec740339355c7c188b76
[ "Apache-2.0" ]
null
null
null
SMUGA/src/GUI/research/TestMuts.java
Evolutionary-Algorithms/Symbiotic-MuGA
e90155318209bed099dbec740339355c7c188b76
[ "Apache-2.0" ]
null
null
null
40.52619
169
0.650432
9,563
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * TestRecombination.java * * Created on 6/Nov/2010, 10:41:15 */ package GUI.research; import genetic.SolverUtils.SimpleSolver; import genetic.Solver.Genetic_Algorithm; import genetic.population.MultiPopulation; import genetic.population.Population; import genetic.population.SimplePopulation; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Shape; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Random; import javax.swing.DefaultListModel; import javax.swing.JList; import operator.mutation.Mutation; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.annotations.XYShapeAnnotation; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYDotRenderer; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import problem.Individual; import problem.RC_Individual; import utils.Individuals.SimpleRC; import utils.DynamicLoad; import utils.GAJarFile; /** * * @author manso */ public class TestMuts extends javax.swing.JFrame { Color[] color = {Color.RED, Color.BLUE, Color.GREEN, Color.ORANGE, Color.YELLOW, Color.MAGENTA}; int N_POINTS = 4000; int MAXCOPIES = 5; JFreeChart chart; ChartPanel chartPanel; Individual ind; XYSeriesCollection dataset; XYPlot plot; Mutation mutation = new Mutation() { @Override public Population execute(Population pop) { throw new UnsupportedOperationException("Not supported yet."); } }; SimpleSolver solver = new Genetic_Algorithm(); /** * Creates new form TestRecombination */ public TestMuts() { initComponents(); MultiPopulation pop = new MultiPopulation(); pop.createRandomPopulation(2, new SimpleRC()); solver.setParents(pop); loadJar("operator.mutation.real", lstCrossover); mutation = (Mutation) DynamicLoad.makeObject("operator.mutation.real." + lstCrossover.getSelectedValue().toString()); mutation.setSolver(solver); chartPanel = creatChart(new SimpleRC()); panel.add(chartPanel); panel.setSize(new java.awt.Dimension(500, 500)); panel.revalidate(); panel.repaint(); } private ChartPanel creatChart(Individual p) { // Random rnd = new Random(); Population pop = solver.getParents(); // Population tmp = new MultiPopulation(); // solver.setParents(pop); // mutation.solver = solver; // // tmp.createRandomPopulation(2, p); // // // tmp.evaluate(); // // for (int pi = 0; pi < tmp.getNumGenotypes(); pi++) { // Individual i = tmp.getGenotype(pi); // i.setNumCopys(rnd.nextInt(MAXCOPIES) + 1); // //shrink genes //// for (int j = 0; j < i.getNumGenes(); j++) { //// i.setGeneValue(j, i.getGeneValue(j) / 2.0); //// } // pop.addGenotype(i); // } dataset = createDataset(pop); // create a scatter chart... chart = ChartFactory.createScatterPlot( mutation.getClass().getSimpleName(), "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false); plot = chart.getXYPlot(); XYDotRenderer render = new XYDotRenderer(); render.setDotHeight(2); render.setDotWidth(2); //cor dos pontos // for (int i = 0; i < 5; i++) { render.setSeriesPaint(0, Color.BLACK); // } plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.setRenderer(render); plot.setBackgroundPaint(Color.WHITE); for (int i = 0; i < pop.getNumGenotypes(); i++) { Individual p1 = pop.getGenotype(i); // Individual p2 = pop.getGenotype((i + 1) % pop.getNumGenotypes() ); double x1 = p1.getGeneValue(0); double y1 = p1.getGeneValue(1); // Ellipse2D expansion = new Ellipse2D.Double(x1 - DIM, y1 - DIM, DIM * 2, DIM * 2); // plot.addAnnotation(new XYShapeAnnotation(expansion, new BasicStroke(8.0f * p1.getNumCopies()), Color.BLACK)); // Shape e2 = new Ellipse2D.Double(x1, y1, 0.1*p1.getNumCopies(), 0.1*p1.getNumCopies()); Shape e2 = new Rectangle2D.Double(x1, y1, 0.1, 0.1); plot.addAnnotation(new XYShapeAnnotation(e2, new BasicStroke(10.0f), color[((i) % color.length)])); } // add the chart to a panel... chartPanel = new ChartPanel(chart); return chartPanel; } private XYSeriesCollection createDataset(Population pop) { mutation.setProbability(1.0); Population child = mutation.execute(pop.getClone()); XYSeries[] series = new XYSeries[pop.getNumGenotypes() + 1]; series[0] = new XYSeries("offspring"); for (int i = 0; i < pop.getNumGenotypes(); i++) { series[i + 1] = new XYSeries("p(" + pop.getGenotype(i).getNumCopies() + ")"); } //put one point in each the corner double min = ((RC_Individual) pop.getIndividual(0)).getMinValue(); double max = ((RC_Individual) pop.getIndividual(0)).getmaxValue(); series[0].add(min, min); series[0].add(min, max); series[0].add(max, max); series[0].add(max, min); for (int i = 0; i < N_POINTS; i++) { Population p = pop.getClone(); p.evaluate(); child = mutation.execute(p); for (int j = 0; j < child.getNumGenotypes(); j++) { series[0].add(child.getGenotype(j).getGeneValue(0), child.getGenotype(j).getGeneValue(1)); } } XYSeriesCollection data = new XYSeriesCollection(); for (int i = 0; i < series.length; i++) { data.addSeries(series[i]); } return data; } private void loadJar(String model, JList lst) { ArrayList<String> rec = GAJarFile.getClassName(model); DefaultListModel modelL = new DefaultListModel(); //select the default int indexOfDefault = 0; for (int i = 0; i < rec.size(); i++) { modelL.add(i, rec.get(i)); // if (rec.get(i).equalsIgnoreCase("default")) { // indexOfDefault = i; // } } lst.setModel(modelL); //set the default selected lst.setSelectedIndex(indexOfDefault); lst.repaint(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { panel = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); lstCrossover = new javax.swing.JList(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); sldCurrent = new javax.swing.JSlider(); txtCurrentValue = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); btAddOne = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); panel.setPreferredSize(new java.awt.Dimension(900, 900)); panel.setLayout(new java.awt.BorderLayout()); getContentPane().add(panel, java.awt.BorderLayout.CENTER); jPanel4.setPreferredSize(new java.awt.Dimension(200, 800)); jPanel4.setLayout(new java.awt.BorderLayout()); lstCrossover.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Multiset_AX", "Multiset_AX_mean", "Multiset_AX_mean2", "RCGA_AX", " " }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); lstCrossover.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lstCrossoverMouseClicked(evt); } }); jScrollPane1.setViewportView(lstCrossover); jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER); jLabel1.setText("Generation"); sldCurrent.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sldCurrentStateChanged(evt); } }); txtCurrentValue.setText("50"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(sldCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtCurrentValue, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(4, 4, 4) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txtCurrentValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(sldCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel4.add(jPanel1, java.awt.BorderLayout.PAGE_END); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jButton1.setText("SimpleiPop"); jButton1.setPreferredSize(new java.awt.Dimension(119, 100)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("MultiPop"); jButton2.setPreferredSize(new java.awt.Dimension(119, 100)); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); btAddOne.setText("Add One"); btAddOne.setPreferredSize(new java.awt.Dimension(119, 100)); btAddOne.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btAddOneActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)) .addComponent(btAddOne, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(39, 39, 39)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btAddOne, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(18, Short.MAX_VALUE)) ); jPanel4.add(jPanel2, java.awt.BorderLayout.PAGE_START); getContentPane().add(jPanel4, java.awt.BorderLayout.LINE_START); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed solver.setParents(new SimplePopulation()); btAddOneActionPerformed(evt); lstCrossoverMouseClicked(null); }//GEN-LAST:event_jButton1ActionPerformed private void lstCrossoverMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lstCrossoverMouseClicked String cross = "operator.mutation.real." + lstCrossover.getSelectedValue().toString(); mutation = (Mutation) DynamicLoad.makeObject(cross); mutation.setSolver(solver); chartPanel = creatChart(new SimpleRC()); panel.removeAll(); panel.add(chartPanel); panel.setSize(new java.awt.Dimension(500, 500)); panel.revalidate(); panel.repaint(); }//GEN-LAST:event_lstCrossoverMouseClicked private void sldCurrentStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sldCurrentStateChanged txtCurrentValue.setText(sldCurrent.getValue() + ""); }//GEN-LAST:event_sldCurrentStateChanged private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed solver.setParents(new MultiPopulation()); btAddOneActionPerformed(evt); lstCrossoverMouseClicked(null); }//GEN-LAST:event_jButton2ActionPerformed private void btAddOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddOneActionPerformed Random rnd = new Random(); Individual ind = new SimpleRC(); ind.setNumCopys(rnd.nextInt(MAXCOPIES) + 1); ind.evaluate(); solver.getParents().addGenotype(ind); lstCrossoverMouseClicked(null); }//GEN-LAST:event_btAddOneActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TestMuts().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btAddOne; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JList lstCrossover; private javax.swing.JPanel panel; private javax.swing.JSlider sldCurrent; private javax.swing.JTextField txtCurrentValue; // End of variables declaration//GEN-END:variables }
3e166e0a414c53e302a2359ddb7362d03e04003c
1,225
java
Java
aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java
cdelg/bnd
bdb3390ce8c49c7c244bd501a0dc543ba5adfe9c
[ "Apache-2.0" ]
null
null
null
aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java
cdelg/bnd
bdb3390ce8c49c7c244bd501a0dc543ba5adfe9c
[ "Apache-2.0" ]
null
null
null
aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java
cdelg/bnd
bdb3390ce8c49c7c244bd501a0dc543ba5adfe9c
[ "Apache-2.0" ]
null
null
null
17.753623
65
0.674286
9,564
package aQute.lib.io; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; public class ByteBufferInputStream extends InputStream { private final ByteBuffer bb; public ByteBufferInputStream(ByteBuffer buffer) { buffer.mark(); bb = buffer; } @Override public int read() throws IOException { if (!bb.hasRemaining()) { return -1; } return 0xFF & bb.get(); } @Override public int read(byte[] b, int off, int len) throws IOException { int remaining = bb.remaining(); if (remaining <= 0) { return -1; } int length = Math.min(len, remaining); bb.get(b, off, length); return length; } @Override public long skip(long n) throws IOException { if (n <= 0L) { return 0L; } int skipped = Math.min((int) n, bb.remaining()); bb.position(bb.position() + skipped); return skipped; } @Override public int available() throws IOException { return bb.remaining(); } @Override public void close() throws IOException { bb.position(bb.limit()); } @Override public void mark(int readlimit) { bb.mark(); } @Override public void reset() throws IOException { bb.reset(); } @Override public boolean markSupported() { return true; } }
3e166e7d66522d8dff0308ce058f9f526ebc9abe
2,835
java
Java
spring-auto-restdocs-core/src/test/java/capital/scalable/restdocs/response/ArrayLimitingJsonContentModifierTest.java
serac/spring-auto-restdocs
ac91f6483a518e7a270d5e92e0e973944ee4494c
[ "Apache-2.0" ]
null
null
null
spring-auto-restdocs-core/src/test/java/capital/scalable/restdocs/response/ArrayLimitingJsonContentModifierTest.java
serac/spring-auto-restdocs
ac91f6483a518e7a270d5e92e0e973944ee4494c
[ "Apache-2.0" ]
null
null
null
spring-auto-restdocs-core/src/test/java/capital/scalable/restdocs/response/ArrayLimitingJsonContentModifierTest.java
serac/spring-auto-restdocs
ac91f6483a518e7a270d5e92e0e973944ee4494c
[ "Apache-2.0" ]
null
null
null
32.215909
97
0.655379
9,565
/*- * #%L * Spring Auto REST Docs Core * %% * Copyright (C) 2015 - 2020 Scalable Capital GmbH * %% * 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. * #L% */ package capital.scalable.restdocs.response; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; public class ArrayLimitingJsonContentModifierTest { @Test public void testModifyJsonWithMoreThanThreeItems() throws Exception { // given ObjectMapper mapper = new ObjectMapper(); ArrayLimitingJsonContentModifier modifier = new ArrayLimitingJsonContentModifier(mapper); WithArray object = WithArray.withItems(100); JsonNode root = mapper.readTree(mapper.writeValueAsString(object)); // when modifier.modifyJson(root); // then assertThat(root.get("items").size(), is(3)); assertThat(root.get("ignore").isNumber(), is(true)); } @Test public void testModifyJsonWithLessThanThreeItems() throws Exception { // given ObjectMapper mapper = new ObjectMapper(); ArrayLimitingJsonContentModifier modifier = new ArrayLimitingJsonContentModifier(mapper); WithArray object = WithArray.withItems(2); JsonNode root = mapper.readTree(mapper.writeValueAsString(object)); // when modifier.modifyJson(root); // then assertThat(root.get("items").size(), is(2)); assertThat(root.get("ignore").isNumber(), is(true)); } private static class WithArray { private final Integer ignore; private final List<String> items; public WithArray(List<String> items) { this.ignore = 42; this.items = items; } public static WithArray withItems(int count) { List<String> items = new ArrayList<>(count); for (int i = 0; i < count; i++) { items.add(Integer.toString(i)); } return new WithArray(items); } public Integer getIgnore() { return ignore; } public List<String> getItems() { return items; } } }
3e166f5a75b3eaf5ed8a557e505440e59f508fed
226
java
Java
src/main/java/com/harima/nbp/repository/CasoRepository.java
ricardoalzamora/NBObservatorio
6d660ccaee8ac53fd6e908ec8dfe701c60178b65
[ "MIT" ]
null
null
null
src/main/java/com/harima/nbp/repository/CasoRepository.java
ricardoalzamora/NBObservatorio
6d660ccaee8ac53fd6e908ec8dfe701c60178b65
[ "MIT" ]
null
null
null
src/main/java/com/harima/nbp/repository/CasoRepository.java
ricardoalzamora/NBObservatorio
6d660ccaee8ac53fd6e908ec8dfe701c60178b65
[ "MIT" ]
null
null
null
28.25
80
0.845133
9,566
package com.harima.nbp.repository; import com.harima.nbp.models.Caso; import org.springframework.data.repository.PagingAndSortingRepository; public interface CasoRepository extends PagingAndSortingRepository<Caso, Long> { }
3e166fec743e3e96edb91d3a623ffbf46e5fb752
652
java
Java
src/main/java/org/danyuan/application/common/utils/projectpath/ProjectPath.java
ShaoNianL/danyuan-application
6d1390f093cec9f1f9cbfe7f47d05d6c90b24bcf
[ "Apache-2.0" ]
55
2017-07-25T02:43:49.000Z
2021-07-15T01:56:14.000Z
src/main/java/org/danyuan/application/common/utils/projectpath/ProjectPath.java
ShaoNianL/danyuan-application
6d1390f093cec9f1f9cbfe7f47d05d6c90b24bcf
[ "Apache-2.0" ]
3
2017-07-21T09:57:16.000Z
2018-09-18T05:38:13.000Z
src/main/java/org/danyuan/application/common/utils/projectpath/ProjectPath.java
ShaoNianL/danyuan-application
6d1390f093cec9f1f9cbfe7f47d05d6c90b24bcf
[ "Apache-2.0" ]
26
2017-07-21T07:20:30.000Z
2019-05-20T02:04:35.000Z
21.032258
71
0.631902
9,567
package org.danyuan.application.common.utils.projectpath; public class ProjectPath { /** * 方法名: getProjectClassPath * 功 能: TODO(这里用一句话描述这个方法的作用) * 参 数: @param path * 参 数: @return * 返 回: String * 作 者 : Tenghui.Wang * @throws */ public String getProjectClassPath(String path) { return this.getClass().getClassLoader().getResource(path).getPath(); } /** * 方法名: getProjectRootPath * 功 能: TODO(这里用一句话描述这个方法的作用) * 参 数: @param string * 参 数: @return * 返 回: String * 作 者 : Tenghui.Wang * @throws */ public static String getProjectRootPath() { return System.getProperty("user.dir"); } }
3e1671a94fa4835ea691815edbce549288d9aa0b
4,187
java
Java
main/src/main/java/io/github/pulsebeat02/ezmediacore/dither/algorithm/random/RandomDither.java
MinecraftMediaLibrary/EpicMediaLib
00d13b582fdb31fe4c6d13472f483924dba73c53
[ "MIT" ]
55
2021-09-04T08:03:07.000Z
2022-03-31T23:09:02.000Z
main/src/main/java/io/github/pulsebeat02/ezmediacore/dither/algorithm/random/RandomDither.java
MinecraftMediaLibrary/EpicMediaLib
00d13b582fdb31fe4c6d13472f483924dba73c53
[ "MIT" ]
4
2021-05-10T00:52:05.000Z
2021-05-26T01:48:08.000Z
main/src/main/java/io/github/pulsebeat02/ezmediacore/dither/algorithm/random/RandomDither.java
MinecraftMediaLibrary/EpicMediaLib
00d13b582fdb31fe4c6d13472f483924dba73c53
[ "MIT" ]
9
2021-09-04T12:06:27.000Z
2022-03-14T08:58:06.000Z
36.72807
100
0.665871
9,568
/* * MIT License * * Copyright (c) 2021 Brandon Li * * 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 io.github.pulsebeat02.ezmediacore.dither.algorithm.random; import static io.github.pulsebeat02.ezmediacore.dither.load.DitherLookupUtil.COLOR_MAP; import io.github.pulsebeat02.ezmediacore.callback.buffer.BufferCarrier; import io.github.pulsebeat02.ezmediacore.dither.DitherAlgorithm; import io.github.pulsebeat02.ezmediacore.dither.MapPalette; import io.github.pulsebeat02.ezmediacore.dither.buffer.ByteBufCarrier; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.util.concurrent.ThreadLocalRandom; import org.jetbrains.annotations.NotNull; public final class RandomDither implements DitherAlgorithm { private static final ThreadLocalRandom THREAD_LOCAL_RANDOM; public static final int LIGHT_WEIGHT; public static final int NORMAL_WEIGHT; public static final int HEAVY_WEIGHT; static { THREAD_LOCAL_RANDOM = ThreadLocalRandom.current(); LIGHT_WEIGHT = 32; NORMAL_WEIGHT = 64; HEAVY_WEIGHT = 128; } private final int min; private final int max; public RandomDither(final int weight) { this.min = -weight; this.max = weight + 1; } @Override public @NotNull BufferCarrier ditherIntoMinecraft(final int @NotNull [] buffer, final int width) { final int length = buffer.length; final int height = length / width; final ByteBuf data = Unpooled.buffer(length); for (int y = 0; y < height; y++) { final int yIndex = y * width; for (int x = 0; x < width; x++) { final int index = yIndex + x; final int color = buffer[index]; int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = (color) & 0xFF; r = (r += this.random()) > 255 ? 255 : r < 0 ? 0 : r; g = (g += this.random()) > 255 ? 255 : g < 0 ? 0 : g; b = (b += this.random()) > 255 ? 255 : b < 0 ? 0 : b; data.setByte(index, this.getBestColor(r, g, b)); } } return ByteBufCarrier.ofByteBufCarrier(data); } @Override public void dither(final int @NotNull [] buffer, final int width) { final int height = buffer.length / width; for (int y = 0; y < height; y++) { final int yIndex = y * width; for (int x = 0; x < width; x++) { final int index = yIndex + x; final int color = buffer[index]; int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = (color) & 0xFF; r = (r += this.random()) > 255 ? 255 : r < 0 ? 0 : r; g = (g += this.random()) > 255 ? 255 : g < 0 ? 0 : g; b = (b += this.random()) > 255 ? 255 : b < 0 ? 0 : b; buffer[index] = this.getBestColorNormal(r, g, b); } } } private int random() { return THREAD_LOCAL_RANDOM.nextInt(this.min, this.max); } private byte getBestColor(final int red, final int green, final int blue) { return COLOR_MAP[red >> 1 << 14 | green >> 1 << 7 | blue >> 1]; } private int getBestColorNormal(final int r, final int g, final int b) { return MapPalette.getColor(this.getBestColor(r, g, b)).getRGB(); } }
3e1671da3513d38973bbf38a7940ccb403ac94cf
1,546
java
Java
api/src/main/java/com/quasar/backend/controller/MessageController.java
qatix/ops-backend
0bf8fdd2236f51ee9b9fc144e3a807688a2d0604
[ "Apache-2.0" ]
null
null
null
api/src/main/java/com/quasar/backend/controller/MessageController.java
qatix/ops-backend
0bf8fdd2236f51ee9b9fc144e3a807688a2d0604
[ "Apache-2.0" ]
3
2019-11-24T07:22:06.000Z
2021-09-20T20:46:10.000Z
api/src/main/java/com/quasar/backend/controller/MessageController.java
qatix/ops-backend
0bf8fdd2236f51ee9b9fc144e3a807688a2d0604
[ "Apache-2.0" ]
null
null
null
26.20339
82
0.663001
9,569
package com.quasar.backend.controller; import com.quasar.backend.common.utils.R; import com.quasar.backend.common.validator.ValidatorUtils; import com.quasar.backend.entity.Task; import com.quasar.backend.service.MqService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @Slf4j @RestController @RequestMapping("/message") @Api(tags = "MQ接口") public class MessageController { @Autowired private MqService mqService; @GetMapping("/test") public R test() { return R.ok().put("msg", "test api。。。"); } @PostMapping("/send") @ApiOperation("发送任务") public R sendTask(@RequestBody Task task) { //表单校验 ValidatorUtils.validateEntity(task); log.info("task:" + task.toString()); String tags = task.getTags() == null ? "" : task.getTags(); boolean ret = mqService.sendTask(task.getTaskKey(), tags, task.getData()); return R.ok().put("task", task).put("ret", ret); } @PostMapping("/send-async") @ApiOperation("发送任务") public R sendTaskAsync(@RequestBody Task task) { //表单校验 ValidatorUtils.validateEntity(task); log.info("task:" + task.toString()); String tags = task.getTags() == null ? "" : task.getTags(); mqService.sendTaskAsync(task.getTaskKey(), tags, task.getData()); return R.ok().put("task", task); } }
3e167202efde084f6d9f93980a2ff55e9d598a97
513
java
Java
instrumentation/jaxws/jws-1.1/javaagent/src/test/java/io/opentelemetry/test/WebServiceClass.java
goto1134/opentelemetry-java-instrumentation
642f213c12fe54abd478c9418b2bc5472b20b0e5
[ "ECL-2.0", "Apache-2.0", "BSD-3-Clause", "MIT" ]
1
2021-03-12T09:20:36.000Z
2021-03-12T09:20:36.000Z
instrumentation/jaxws/jws-1.1/javaagent/src/test/java/io/opentelemetry/test/WebServiceClass.java
goto1134/opentelemetry-java-instrumentation
642f213c12fe54abd478c9418b2bc5472b20b0e5
[ "ECL-2.0", "Apache-2.0", "BSD-3-Clause", "MIT" ]
32
2020-10-01T12:43:49.000Z
2022-03-02T12:05:10.000Z
instrumentation/jaxws/jws-1.1/javaagent/src/test/java/io/opentelemetry/test/WebServiceClass.java
goto1134/opentelemetry-java-instrumentation
642f213c12fe54abd478c9418b2bc5472b20b0e5
[ "ECL-2.0", "Apache-2.0", "BSD-3-Clause", "MIT" ]
1
2021-02-24T23:30:39.000Z
2021-02-24T23:30:39.000Z
22.304348
94
0.754386
9,570
/* * Copyright The OpenTelemetry Authors * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.test; import javax.jws.WebService; /** * Note: this has to stay outside of 'io.opentelemetry.javaagent' package to be considered for * instrumentation */ // This is pure java to not have any groovy generated public method surprises @WebService public class WebServiceClass { public void doSomethingPublic() {} protected void doSomethingProtected() {} void doSomethingPackagePrivate() {} }
3e167211ea2d2b03c3da8d2f746c069c30ae21aa
3,363
java
Java
site-toolkit/platform-api/src/main/java/org/hippoecm/hst/platform/api/DocumentService.java
athenagroup/brxm
58d3c299f2b925a857e55d689e0cb4ee0258d82c
[ "Apache-2.0" ]
null
null
null
site-toolkit/platform-api/src/main/java/org/hippoecm/hst/platform/api/DocumentService.java
athenagroup/brxm
58d3c299f2b925a857e55d689e0cb4ee0258d82c
[ "Apache-2.0" ]
28
2020-10-29T15:59:43.000Z
2022-03-02T12:50:38.000Z
site-toolkit/platform-api/src/main/java/org/hippoecm/hst/platform/api/DocumentService.java
ajbanck/brxm
79d55e2d88a320719a78e3b4534799495336b572
[ "Apache-2.0" ]
null
null
null
48.042857
137
0.719596
9,571
/* * Copyright 2011-2018 Hippo B.V. (http://www.onehippo.com) * * 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.hippoecm.hst.platform.api; import java.util.List; import javax.jcr.Session; import org.hippoecm.hst.platform.api.beans.ChannelDocument; public interface DocumentService { /** * Returns information about all <b>preview</b> channels a document is part of. A document is identified by its UUID. * When a document is unknown or not part of any channel, an empty list is returned. * * * @param userSession - the jcr session for the current user * @param hostGroup the host group to use the channels from * @param uuid the identifier of the document * * @return a list of 'channel documents' that provide information about all channels the document is part of, * or an empty list if the identifier is unknown or the document is not part of any channel. * */ List<ChannelDocument> getPreviewChannels(Session userSession, String hostGroup, String uuid); /** * @return See {@link #getPreviewChannels(Session, String, String)} only if available, use the branched Hst configuration * for branch {@code branchId} */ List<ChannelDocument> getPreviewChannels(Session userSession, String hostGroup, String uuid, String branchId); /** * Returns a fully qualified URL in SITE context for a document in a mount of a certain type. The document is identified by its UUID. * When the type parameter is null or empty, the value 'live' is used. Note that this method thus returns a fully qualified * URL for the host through which the site(s) are visited, and not through the cms host, which can be a different host * * Note that only one link is returned, even when the document is available in multiple channels (i.e. under * multiple mounts). When multiple mounts match, we use the one that has the closest canonical content path to the * path of the document handle. If multiple mounts have an equally well suited* canonical content path, we use the * mount with the fewest types. These mounts are in general the most generic ones. If multiple mounts have an * equally well suited canonical content path and an equal number of types, we use a random one. * * @param userSession - the jcr session for the current user * @param hostGroup the host group to use the channels from * @param uuid the identifier of the document * @param type the type of the mounts that can be used to generate a link to the document. When null or empty, * the value 'live' is used. * * @return a fully qualified link to the document, or an empty string if no link could be created. * */ String getUrl(Session userSession, String hostGroup, String uuid, String type); }
3e1672134b38e03050fdf200b7fe03f8d835401a
2,460
java
Java
src/main/java/com/guru/login/model/User.java
kamalRanga/inventory
d99b0977039ca9434ea17c2d7c2bb9ea0f12bd4c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/guru/login/model/User.java
kamalRanga/inventory
d99b0977039ca9434ea17c2d7c2bb9ea0f12bd4c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/guru/login/model/User.java
kamalRanga/inventory
d99b0977039ca9434ea17c2d7c2bb9ea0f12bd4c
[ "Apache-2.0" ]
null
null
null
21.391304
128
0.717886
9,572
package com.guru.login.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.Length; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import java.util.Set; @Data @Builder @AllArgsConstructor @NoArgsConstructor @Entity @Table(name = "users") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "user_id") private Integer id; @Column(name = "user_name") @Length(min = 5, message = "*Your user name must have at least 5 characters") @NotEmpty(message = "*Please provide a user name") private String userName; @Column(name = "email") @Email(message = "*Please provide a valid Email") @NotEmpty(message = "*Please provide an email") private String email; @Column(name = "password") @Length(min = 5, message = "*Your password must have at least 5 characters") @NotEmpty(message = "*Please provide your password") private String password; @Column(name = "name") @NotEmpty(message = "*Please provide your name") private String name; @Column(name = "last_name") @NotEmpty(message = "*Please provide your last name") private String lastName; @Column(name = "active") private Boolean active; @ManyToMany(cascade = CascadeType.MERGE) @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set<Role> roles; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Boolean getActive() { return active; } public void setActive(Boolean active) { this.active = active; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } }
3e1673f2be9ad7610fb69bd912766170138188aa
1,720
java
Java
src/main/java/com/wujiabo/fsd/config/WebSecurityConfig.java
wujiabo/FSD-Assignments-05
6dea2d4c32d767a249aa736107838dd8ca7fbd41
[ "Apache-2.0" ]
null
null
null
src/main/java/com/wujiabo/fsd/config/WebSecurityConfig.java
wujiabo/FSD-Assignments-05
6dea2d4c32d767a249aa736107838dd8ca7fbd41
[ "Apache-2.0" ]
null
null
null
src/main/java/com/wujiabo/fsd/config/WebSecurityConfig.java
wujiabo/FSD-Assignments-05
6dea2d4c32d767a249aa736107838dd8ca7fbd41
[ "Apache-2.0" ]
null
null
null
40
115
0.725581
9,573
package com.wujiabo.fsd.config; import com.wujiabo.fsd.service.FsdUserDetailsService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.addFilterBefore(new KaptchaAuthenticationFilter("/login"), UsernamePasswordAuthenticationFilter.class) .authorizeRequests() .antMatchers("/", "/register","/captcha.jpg").permitAll() .antMatchers("/admin/**").hasRole("admin") .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .permitAll(); } @Bean @Override public UserDetailsService userDetailsService() { return new FsdUserDetailsService(); } @Bean PasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(); } }
3e1674072522be5d77a36e894a03ec2985233924
2,729
java
Java
C3/src/main/java/it/unicam/cs/ids/c3/utenti/cliente/Cliente.java
catervpillar/progettoIDS
ba9059eeee89bcd98cddbb0d993046a015319d19
[ "MIT" ]
null
null
null
C3/src/main/java/it/unicam/cs/ids/c3/utenti/cliente/Cliente.java
catervpillar/progettoIDS
ba9059eeee89bcd98cddbb0d993046a015319d19
[ "MIT" ]
null
null
null
C3/src/main/java/it/unicam/cs/ids/c3/utenti/cliente/Cliente.java
catervpillar/progettoIDS
ba9059eeee89bcd98cddbb0d993046a015319d19
[ "MIT" ]
1
2021-05-18T08:58:46.000Z
2021-05-18T08:58:46.000Z
29.344086
112
0.585929
9,574
package it.unicam.cs.ids.c3.utenti.cliente; import it.unicam.cs.ids.c3.utenti.Utente; /** * Questa classe implementa l'interfaccia {@link ClienteInterface} ed estende la classe astratta {@link Utente}. * Ha la responsabilità di gestire un singolo {@link Cliente}. */ public class Cliente extends Utente implements ClienteInterface { private String nome; private String cognome; /** * Costruisce un nuovo {@link Cliente}. * * @param username - L'username del {@link Cliente}. * @param password - La password del {@link Cliente}. * @param email - L'email del {@link Cliente}. * @param nome - Il nome del {@link Cliente}. * @param cognome - Il cognome del {@link Cliente}. */ public Cliente(String username, String password, String email, String nome, String cognome) { super(username, password, email); this.nome = nome; this.cognome = cognome; } /** * Costruisce un {@link Cliente} senza generarne l'ID, utilizzato quando si deserializza dal database. * * @param ID - L'ID del {@link Cliente}. * @param username - L'username del {@link Cliente}. * @param password - la password del {@link Cliente}. * @param email - l'email del {@link Cliente}. * @param nome - il nome del {@link Cliente}. * @param cognome - il cognome del {@link Cliente}. */ public Cliente(String ID, String username, String password, String email, String nome, String cognome) { super(ID, username, password, email); this.nome = nome; this.cognome = cognome; } /** * Metodo getter per l'attributo nome del {@link Cliente}. * * @return il nome del {@link Cliente}. */ public String getNome() { return nome; } /** * Metodo setter per l'attributo nome del {@link Cliente}. * * @param nome - Il nuovo nome. */ public void setNome(String nome) { this.nome = nome; } /** * Metodo getter per l'attributo cognome del {@link Cliente}. * * @return il cognome del {@link Cliente}. */ public String getCognome() { return cognome; } /** * Metodo setter per l'attributo cognome del {@link Cliente}. * * @param cognome - Il nuovo cognome. */ public void setCognome(String cognome) { this.cognome = cognome; } /** * Metodo toString del {@link Cliente}. * * @return nome e cognome del {@link Cliente}. */ @Override public String toString() { return super.toString() + ", " + "nome=" + nome + ", cognome=" + cognome + '}'; } }
3e167553128bd050a92050ba16a80e5fc0829cb1
307
java
Java
thrift/src/main/java/com/bolly/thrift/entity/ConfigHosp.java
chibaolai/java_wheels
b29efadbf3d056e28be77ae683fcecb83e1ad951
[ "MIT" ]
null
null
null
thrift/src/main/java/com/bolly/thrift/entity/ConfigHosp.java
chibaolai/java_wheels
b29efadbf3d056e28be77ae683fcecb83e1ad951
[ "MIT" ]
null
null
null
thrift/src/main/java/com/bolly/thrift/entity/ConfigHosp.java
chibaolai/java_wheels
b29efadbf3d056e28be77ae683fcecb83e1ad951
[ "MIT" ]
null
null
null
13.347826
47
0.700326
9,575
package com.bolly.thrift.entity; public class ConfigHosp { private int hospId; private String apiKey; public ConfigHosp(int hospId, String apiKey) { this.hospId = hospId; this.apiKey = apiKey; } public int getHospId() { return hospId; } public String getApiKey() { return apiKey; } }
3e16783c89048c57cddc74e427e7f55420f436f4
485
java
Java
src/com/dynatrace/diagnostics/plugins/domain/LOCK_MODE.java
Dynatrace/Dynatrace-AppMon-Oracle-Monitor-Plugin
43c330dbfe515a890e50e0ac82d1f82c9e3e3b17
[ "BSD-3-Clause" ]
3
2016-04-06T18:34:40.000Z
2016-06-11T07:00:39.000Z
src/com/dynatrace/diagnostics/plugins/domain/LOCK_MODE.java
Dynatrace/Dynatrace-Oracle-Monitor-Plugin
43c330dbfe515a890e50e0ac82d1f82c9e3e3b17
[ "BSD-3-Clause" ]
null
null
null
src/com/dynatrace/diagnostics/plugins/domain/LOCK_MODE.java
Dynatrace/Dynatrace-Oracle-Monitor-Plugin
43c330dbfe515a890e50e0ac82d1f82c9e3e3b17
[ "BSD-3-Clause" ]
2
2018-07-25T13:43:15.000Z
2019-04-30T12:11:34.000Z
16.724138
49
0.676289
9,576
package com.dynatrace.diagnostics.plugins.domain; public enum LOCK_MODE { NONE("None"), NULL("Null"), ROW_S_SS("Row-S (SS)"), ROW_X_SX("Row-X (SX)"), SHARE("Share"), S_ROW_X_SSX("S/Row-X (SSX)"), EXCLUSIVE("Exclusive"); private String lockMode; LOCK_MODE(String lockMode) { this.lockMode = lockMode; } public String lockMode() { return lockMode; } // Optionally and/or additionally, toString. @Override public String toString() { return lockMode; } }
3e1678be627c404d8c2c20db72a15b792b515789
1,975
java
Java
BeibeProject/src/beans/Atendimento.java
AdrielBento/BEIBE-SAC
259db40f09e31e55b5b3f9f0f4f8593bb4ce3ddc
[ "MIT" ]
null
null
null
BeibeProject/src/beans/Atendimento.java
AdrielBento/BEIBE-SAC
259db40f09e31e55b5b3f9f0f4f8593bb4ce3ddc
[ "MIT" ]
null
null
null
BeibeProject/src/beans/Atendimento.java
AdrielBento/BEIBE-SAC
259db40f09e31e55b5b3f9f0f4f8593bb4ce3ddc
[ "MIT" ]
null
null
null
17.173913
110
0.708861
9,577
package beans; import java.io.Serializable; import java.util.Date; import java.util.concurrent.TimeUnit; public class Atendimento implements Serializable { private Integer id; private Date dataHora; private String status; private String solucao; private String descricao; private TipoAtendimento tipo; private Produto produto; private Usuario usuario; public Atendimento() { } public Atendimento(Integer id, String solucao) { this.id = id; this.solucao = solucao; } public Atendimento(String status, String descricao, TipoAtendimento tipo, Produto produto, Usuario usuario) { this.status = status; this.descricao = descricao; this.tipo = tipo; this.produto = produto; this.usuario = usuario; } public Integer getId() { return id; } public Boolean getLate() { Date hoje = new Date(); long diferencaMilis = Math.abs(hoje.getTime() - dataHora.getTime()); long diff = TimeUnit.DAYS.convert(diferencaMilis, TimeUnit.MILLISECONDS); if (diff > 7) { return true; } return false; } public void setId(Integer id) { this.id = id; } public Date getDataHora() { return dataHora; } public void setDataHora(Date dataHora) { this.dataHora = dataHora; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getSolucao() { return solucao; } public void setSolucao(String solucao) { this.solucao = solucao; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public TipoAtendimento getTipo() { return tipo; } public void setTipo(TipoAtendimento tipo) { this.tipo = tipo; } public Produto getProduto() { return produto; } public void setProduto(Produto produto) { this.produto = produto; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } }
3e16790db0578c6a25ae7d4dd149baa8c9882f51
3,610
java
Java
src/test/java/com/cloudmersive/client/PosTaggerApiTest.java
Cloudmersive/Cloudmersive.APIClient.Java
5b73bd7a0a2c1299d29c2c0b4fd0da9591193238
[ "Apache-2.0" ]
11
2018-01-09T05:28:35.000Z
2021-05-13T02:38:08.000Z
src/test/java/com/cloudmersive/client/PosTaggerApiTest.java
Cloudmersive/Cloudmersive.APIClient.Java
5b73bd7a0a2c1299d29c2c0b4fd0da9591193238
[ "Apache-2.0" ]
7
2019-11-04T06:44:49.000Z
2022-01-31T20:19:52.000Z
src/test/java/com/cloudmersive/client/PosTaggerApiTest.java
Cloudmersive/Cloudmersive.APIClient.Java
5b73bd7a0a2c1299d29c2c0b4fd0da9591193238
[ "Apache-2.0" ]
5
2019-06-03T12:04:02.000Z
2021-05-12T10:10:15.000Z
27.142857
205
0.642105
9,578
/* * nlpapiv2 * The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text. * * OpenAPI spec version: v1 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.cloudmersive.client; import com.cloudmersive.client.invoker.ApiException; import com.cloudmersive.client.model.PosRequest; import com.cloudmersive.client.model.PosResponse; import org.junit.Test; import org.junit.Ignore; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * API tests for PosTaggerApi */ @Ignore public class PosTaggerApiTest { private final PosTaggerApi api = new PosTaggerApi(); /** * Part-of-speech tag a string, filter to adjectives * * Part-of-speech (POS) tag a string, find the adjectives, and return result as JSON * * @throws ApiException * if the Api call fails */ @Test public void posTaggerTagAdjectivesTest() throws ApiException { PosRequest request = null; PosResponse response = api.posTaggerTagAdjectives(request); // TODO: test validations } /** * Part-of-speech tag a string, filter to adverbs * * Part-of-speech (POS) tag a string, find the adverbs, and return result as JSON * * @throws ApiException * if the Api call fails */ @Test public void posTaggerTagAdverbsTest() throws ApiException { PosRequest request = null; PosResponse response = api.posTaggerTagAdverbs(request); // TODO: test validations } /** * Part-of-speech tag a string, filter to nouns * * Part-of-speech (POS) tag a string, find the nouns, and return result as JSON * * @throws ApiException * if the Api call fails */ @Test public void posTaggerTagNounsTest() throws ApiException { PosRequest request = null; PosResponse response = api.posTaggerTagNouns(request); // TODO: test validations } /** * Part-of-speech tag a string, filter to pronouns * * Part-of-speech (POS) tag a string, find the pronouns, and return result as JSON * * @throws ApiException * if the Api call fails */ @Test public void posTaggerTagPronounsTest() throws ApiException { PosRequest request = null; PosResponse response = api.posTaggerTagPronouns(request); // TODO: test validations } /** * Part-of-speech tag a string * * Part-of-speech (POS) tag a string and return result as JSON * * @throws ApiException * if the Api call fails */ @Test public void posTaggerTagSentenceTest() throws ApiException { PosRequest request = null; PosResponse response = api.posTaggerTagSentence(request); // TODO: test validations } /** * Part-of-speech tag a string, filter to verbs * * Part-of-speech (POS) tag a string, find the verbs, and return result as JSON * * @throws ApiException * if the Api call fails */ @Test public void posTaggerTagVerbsTest() throws ApiException { PosRequest request = null; PosResponse response = api.posTaggerTagVerbs(request); // TODO: test validations } }
3e1679ef493e6bda8a8a9158090368bdf3ee3f97
342
java
Java
src/test/java/com/github/charlemaznable/guardians/exception/ExceptionConfiguration.java
CharLemAznable/guardians-core
0e805d3757264cb675bfeac6e92e6e8fc9e5884c
[ "MIT" ]
2
2020-03-24T08:12:28.000Z
2020-03-29T14:55:30.000Z
src/test/java/com/github/charlemaznable/guardians/exception/ExceptionConfiguration.java
CharLemAznable/guardians-core
0e805d3757264cb675bfeac6e92e6e8fc9e5884c
[ "MIT" ]
1
2022-03-04T04:34:36.000Z
2022-03-04T04:34:36.000Z
src/test/java/com/github/charlemaznable/guardians/exception/ExceptionConfiguration.java
CharLemAznable/guardians-core
0e805d3757264cb675bfeac6e92e6e8fc9e5884c
[ "MIT" ]
null
null
null
28.5
70
0.865497
9,579
package com.github.charlemaznable.guardians.exception; import com.github.charlemaznable.guardians.spring.GuardiansImport; import org.springframework.context.annotation.ComponentScan; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @EnableWebMvc @ComponentScan @GuardiansImport public class ExceptionConfiguration { }
3e167a284226d08bace9b7a7cd68fdfb593c1d72
183
java
Java
src/main/java/com/ws/app/service/SynchroMeterReadService.java
827551331/app
d22aaf9bb24e6b08babd97a2ef6693f2a7fe1574
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ws/app/service/SynchroMeterReadService.java
827551331/app
d22aaf9bb24e6b08babd97a2ef6693f2a7fe1574
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ws/app/service/SynchroMeterReadService.java
827551331/app
d22aaf9bb24e6b08babd97a2ef6693f2a7fe1574
[ "Apache-2.0" ]
1
2019-07-02T06:56:09.000Z
2019-07-02T06:56:09.000Z
12.2
42
0.622951
9,580
package com.ws.app.service; /** * 同步远传系统数据 * * @author wang_yw */ public interface SynchroMeterReadService { /** * 同步远传系统读数到营收系统 */ void synchroMeterRead(); }
3e167b349ccdb57c8c66c4e1028460eb66d9a9ce
3,527
java
Java
app/src/main/java/com/freedom/tunes/activities/MainActivity.java
sibayanjasper/tunes
764cbfa2170e7c789f287f091d431a7ea2ae984e
[ "MIT" ]
null
null
null
app/src/main/java/com/freedom/tunes/activities/MainActivity.java
sibayanjasper/tunes
764cbfa2170e7c789f287f091d431a7ea2ae984e
[ "MIT" ]
null
null
null
app/src/main/java/com/freedom/tunes/activities/MainActivity.java
sibayanjasper/tunes
764cbfa2170e7c789f287f091d431a7ea2ae984e
[ "MIT" ]
null
null
null
34.242718
106
0.675361
9,581
package com.freedom.tunes.activities; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.freedom.tunes.R; import com.freedom.tunes.utils.HttpRequest; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Player", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_login) { new HttpRequest().execute(); } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_labels) { // Handle the camera action } else if (id == R.id.nav_tracks) { } else if (id == R.id.nav_artists) { } else if (id == R.id.nav_albums) { } else if (id == R.id.nav_genres) { } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
3e167cc79115138ae6cb40a7e950de12e14e4d45
2,323
java
Java
USACO2020Grind/src/checklist_slow.java
javaarchive/USACOClass2020
4ae563014b9b2da3e1361e175d38e72308a8da89
[ "MIT" ]
null
null
null
USACO2020Grind/src/checklist_slow.java
javaarchive/USACOClass2020
4ae563014b9b2da3e1361e175d38e72308a8da89
[ "MIT" ]
null
null
null
USACO2020Grind/src/checklist_slow.java
javaarchive/USACOClass2020
4ae563014b9b2da3e1361e175d38e72308a8da89
[ "MIT" ]
null
null
null
38.716667
94
0.527335
9,582
import java.io.*; import java.util.*; public class checklist { static int[][] dp; static int[][] Hcows, Gcows; static int dist(int[] a, int[] b){ int A = a[0] - b[0]; int B = a[1] - b[1]; return A * A + B * B; } static void recur(int Hpos,int Gpos, int[] point,boolean useH, int currentDist){ currentDist += dist(point, (useH?Hcows:Gcows)[useH?Hpos:Gpos]); System.out.println(Hpos + " " + Gpos+" : "+currentDist); if(dp[Hpos][Gpos] > currentDist){ dp[Hpos][Gpos] = currentDist; if(Hpos < Hcows.length-1 && Gpos != 0){ recur(Hpos + 1, Gpos, (useH?Hcows:Gcows)[useH?Hpos:Gpos], true, currentDist); } if(Gpos < Gcows.length-1 && Hpos != 0){ recur(Hpos, Gpos + 1, (useH?Hcows:Gcows)[useH?Hpos:Gpos], false, currentDist); } }else{ return; // La prune } } public static void main(String[] args) throws IOException{ String inputfile = "checklist.in"; if (args.length > 0) { inputfile = args[0]; } BufferedReader f = new BufferedReader(new FileReader(inputfile)); // BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("checklist.out"))); StringTokenizer st = new StringTokenizer(f.readLine()); int H = Integer.parseInt(st.nextToken()); int G = Integer.parseInt(st.nextToken()); Hcows = new int[H][2]; Gcows = new int[G][2]; for(int i = 0; i < H; i ++){ st = new StringTokenizer(f.readLine()); Hcows[i][0] = Integer.parseInt(st.nextToken()); Hcows[i][1] = Integer.parseInt(st.nextToken()); } for(int i = 0; i < G; i ++){ st = new StringTokenizer(f.readLine()); Gcows[i][0] = Integer.parseInt(st.nextToken()); Gcows[i][1] = Integer.parseInt(st.nextToken()); } dp = new int[H][G]; for(int i = 0; i < dp.length; i ++){ Arrays.fill(dp[i], Integer.MAX_VALUE); } recur(1, 0, Hcows[0], true, 0); recur(0, 1, Hcows[0], false, 0); pw.println(dp[H - 1][G - 1]); pw.close(); } }
3e167ce2190feeb84ea079533a7b7e4f6316cf34
10,327
java
Java
src/main/java/com/infinities/nova/resource/ServersResource.java
infinitiessoft/nova2.0-api
9fa7915cba5375f1f66b055f20cf2e694e0237e3
[ "Apache-2.0" ]
null
null
null
src/main/java/com/infinities/nova/resource/ServersResource.java
infinitiessoft/nova2.0-api
9fa7915cba5375f1f66b055f20cf2e694e0237e3
[ "Apache-2.0" ]
null
null
null
src/main/java/com/infinities/nova/resource/ServersResource.java
infinitiessoft/nova2.0-api
9fa7915cba5375f1f66b055f20cf2e694e0237e3
[ "Apache-2.0" ]
null
null
null
43.758475
121
0.765469
9,583
/******************************************************************************* * Copyright 2015 InfinitiesSoft Solutions 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.infinities.nova.resource; import java.text.SimpleDateFormat; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.AnnotationIntrospector; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; import com.infinities.api.openstack.commons.dynamicfeature.OpenstackContext; import com.infinities.api.openstack.commons.exception.http.HTTPBadRequestException; import com.infinities.api.openstack.commons.exception.http.HTTPNotImplementedException; import com.infinities.api.openstack.commons.namebinding.CheckProjectId; import com.infinities.nova.servers.controller.ServersController; import com.infinities.nova.servers.model.MinimalServersTemplate; import com.infinities.nova.servers.model.ServerForCreateTemplate; import com.infinities.nova.servers.model.ServerTemplate; import com.infinities.nova.servers.model.ServersTemplate; import com.infinities.nova.servers.model.ServerAction.ChangePassword; import com.infinities.nova.servers.model.ServerAction.ConfirmResize; import com.infinities.nova.servers.model.ServerAction.CreateImage; import com.infinities.nova.servers.model.ServerAction.Pause; import com.infinities.nova.servers.model.ServerAction.Reboot; import com.infinities.nova.servers.model.ServerAction.Rebuild; import com.infinities.nova.servers.model.ServerAction.Resize; import com.infinities.nova.servers.model.ServerAction.Resume; import com.infinities.nova.servers.model.ServerAction.RevertResize; import com.infinities.nova.servers.model.ServerAction.Start; import com.infinities.nova.servers.model.ServerAction.Stop; import com.infinities.nova.servers.model.ServerAction.Suspend; import com.infinities.nova.servers.model.ServerAction.Unpause; @Component @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @CheckProjectId @OpenstackContext public class ServersResource { private final ServersController controller; @Autowired public ServersResource(ServersController controller) { this.controller = controller; } @GET public MinimalServersTemplate index(@PathParam("projectId") String projectId, @Context ContainerRequestContext requestContext) throws Exception { return controller.index(requestContext); } @GET @Path("detail") public ServersTemplate datail(@PathParam("projectId") String projectId, @Context ContainerRequestContext requestContext) throws Exception { return controller.detail(requestContext); } @GET @Path("{serverId}") public ServerTemplate show(@PathParam("projectId") String projectId, @PathParam("serverId") String serverId, @Context ContainerRequestContext requestContext) throws Exception { return controller.show(serverId, requestContext); } @POST public Response create(@PathParam("projectId") String projectId, @Context ContainerRequestContext requestContext, ServerForCreateTemplate serverTemplate) throws Exception { return controller.create(requestContext, serverTemplate.getServer()); } @PUT @Path("{serverId}") public ServerTemplate update(@PathParam("projectId") String projectId, @PathParam("serverId") String serverId, @Context ContainerRequestContext requestContext, ServerForCreateTemplate serverTemplate) throws Exception { return controller.update(requestContext, serverId, serverTemplate.getServer()); } @DELETE @Path("{serverId}") public Response delete(@PathParam("projectId") String projectId, @PathParam("serverId") String serverId, @Context ContainerRequestContext requestContext) throws Exception { controller.delete(serverId, requestContext); return Response.status(Status.NO_CONTENT).build(); } @Path("{serverId}/metadata") public Class<ServerMetadataResource> getServerMetadataResource() { return ServerMetadataResource.class; } @Path("{serverId}/os-security-groups") public Class<ServerSecurityGroupsResource> getServerSecurityGroupsResource() { return ServerSecurityGroupsResource.class; } @Path("{serverId}/ips") public Class<ServerIpsResource> getServerIpsResource() { return ServerIpsResource.class; } @Path("{serverId}/os-volume_attachments") public Class<VolumeAttachmentsResource> getVolumeAttachmentsResource() { return VolumeAttachmentsResource.class; } @Path("{serverId}/os-interface") public Class<InterfaceAttachmentsResource> getInterfaceAttachmentsResource() { return InterfaceAttachmentsResource.class; } @POST @Path("{serverId}/action") public Response action(@PathParam("serverId") String serverId, @Context ContainerRequestContext requestContext, JsonNode node) throws JsonProcessingException, Exception { if (node != null) { if (node.has("changePassword")) { return controller.changePassword(serverId, requestContext, toValue(ChangePassword.class, node.get("changePassword"))); } else if (node.has("reboot")) { return controller.reboot(serverId, requestContext, toValue(Reboot.class, node.get("reboot"))); } else if (node.has("rebuild")) { ServerTemplate template = controller.rebuild(serverId, requestContext, toValue(Rebuild.class, node.get("rebuild"))); return Response.accepted(template).build(); } else if (node.has("resize")) { return controller.resize(serverId, requestContext, toValue(Resize.class, node.get("resize"))); } else if (node.has("confirmResize")) { return controller.confirmResize(serverId, requestContext, toValue(ConfirmResize.class, node.get("confirmResize"))); } else if (node.has("revertResize")) { return controller.revertResize(serverId, requestContext, toValue(RevertResize.class, node.get("revertResize"))); } else if (node.has("createImage")) { return controller.createImage(serverId, requestContext, toValue(CreateImage.class, node.get("createImage"))); } else if (node.has("pause")) { return controller.pause(serverId, requestContext, toValue(Pause.class, node.get("pause"))); } else if (node.has("unpause")) { return controller.unpause(serverId, requestContext, toValue(Unpause.class, node.get("unpause"))); } else if (node.has("suspend")) { return controller.suspend(serverId, requestContext, toValue(Suspend.class, node.get("suspend"))); } else if (node.has("resume")) { return controller.resume(serverId, requestContext, toValue(Resume.class, node.get("resume"))); } else if (node.has("os-start")) { return controller.start(serverId, requestContext, toValue(Start.class, node.get("os-start"))); } else if (node.has("os-stop")) { return controller.stop(serverId, requestContext, toValue(Stop.class, node.get("os-stop"))); } else if (node.has("migrate")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("resetNetwork")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("injectNetworkInfo")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("lock")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("unlock")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("createBackup")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("os-migrateLive")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("os-resetState")) { throw new HTTPNotImplementedException("action not support"); } else if (node.has("evacuate")) { throw new HTTPNotImplementedException("action not support"); } else if (node.hasNonNull(0)) { String msg = "There is no such action:%s"; msg = String.format(msg, node.get(0).asText()); throw new HTTPBadRequestException(msg); } } throw new HTTPBadRequestException("Malformed request body"); } private <R> R toValue(Class<R> c, JsonNode node) throws JsonProcessingException { AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); // if using BOTH JAXB annotations AND Jackson annotations: AnnotationIntrospector secondary = new JacksonAnnotationIntrospector(); ObjectMapper mapper = new ObjectMapper().registerModule(new Hibernate4Module()) .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) .setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")) .enable(SerializationFeature.INDENT_OUTPUT) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) .setAnnotationIntrospector(new AnnotationIntrospectorPair(introspector, secondary)); R object = mapper.treeToValue(node, c); return object; } }
3e167d8f4945072bd9d0cbae9de6c0ba1969e34d
2,204
java
Java
src/main/java/de/netbeacon/utils/json/test/JSONEQ.java
Horstexplorer/Xenia-Backend-Client
7c93c5a8c14f7a7df0e7225c9a7ac66146ddc949
[ "Apache-2.0" ]
null
null
null
src/main/java/de/netbeacon/utils/json/test/JSONEQ.java
Horstexplorer/Xenia-Backend-Client
7c93c5a8c14f7a7df0e7225c9a7ac66146ddc949
[ "Apache-2.0" ]
null
null
null
src/main/java/de/netbeacon/utils/json/test/JSONEQ.java
Horstexplorer/Xenia-Backend-Client
7c93c5a8c14f7a7df0e7225c9a7ac66146ddc949
[ "Apache-2.0" ]
null
null
null
29.783784
75
0.651543
9,584
/* * Copyright 2021 Horstexplorer @ https://www.netbeacon.de * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.netbeacon.utils.json.test; import org.json.JSONArray; import org.json.JSONObject; public class JSONEQ{ public static boolean equals(JSONObject a, JSONObject b){ if(a == null ^ b == null) return false; if(a == null && b == null) return true; JSONObject ac = new JSONObject(a.toString()); JSONObject bc = new JSONObject(b.toString()); if(ac.keySet().size() != bc.keySet().size()) return false; for(String sa : ac.keySet()){ if(!bc.has(sa)) return false; Object oa = ac.get(sa); Object ob = bc.get(sa); if(!equals(oa, ob)) return false; } return true; } public static boolean equals(JSONArray a, JSONArray b){ if(a == null ^ b == null) return false; if(a == null && b == null) return true; JSONArray ac = new JSONArray(a.toString()); JSONArray bc = new JSONArray(b.toString()); if(ac.length() != bc.length()) return false; for(int i = 0; i < ac.length(); i++){ Object oa = ac.get(i); boolean good = false; for(int ii = 0; ii < b.length(); ii++){ Object ob = bc.get(ii); if(equals(oa, ob)){ good = true; bc.remove(ii); break; } } if(!good) return false; } return true; } private static boolean equals(Object a, Object b){ if(a == null ^ b == null) return false; if(a == null && b == null) return true; if(!a.getClass().equals(b.getClass())) return false; if(a instanceof JSONObject){ return equals((JSONObject) a, (JSONObject) b); }else if(a instanceof JSONArray){ return equals((JSONArray) a, (JSONArray) b); }else{ return a.equals(b); } } }
3e167dc268943794912f908d5e44e26c4a474554
4,364
java
Java
src/main/java/net/teamfruit/factorioforge/ui/UIModCellController.java
Team-Fruit/FactorioForge
5fba8dfe2ac3d25b6999f2a77bbd83ce43af246c
[ "MIT" ]
null
null
null
src/main/java/net/teamfruit/factorioforge/ui/UIModCellController.java
Team-Fruit/FactorioForge
5fba8dfe2ac3d25b6999f2a77bbd83ce43af246c
[ "MIT" ]
null
null
null
src/main/java/net/teamfruit/factorioforge/ui/UIModCellController.java
Team-Fruit/FactorioForge
5fba8dfe2ac3d25b6999f2a77bbd83ce43af246c
[ "MIT" ]
null
null
null
30.732394
123
0.728689
9,585
package net.teamfruit.factorioforge.ui; import javafx.animation.FadeTransition; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.animation.TranslateTransition; import javafx.beans.property.DoubleProperty; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.control.ProgressIndicator; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.util.Duration; import net.teamfruit.factorioforge.ui.Memento.DownloadState; public class UIModCellController { private boolean state; private Memento current; @FXML private BorderPane slidePane; @FXML private Button slideButton; @FXML private Pane slideBack; @FXML private Label label; @FXML private Button updateButton; @FXML private ProgressIndicator updateChecking; @FXML private ProgressBar progress; @FXML private void initialize() { } @FXML private void onSlideButtonClicked(final ActionEvent event) { setState(!getState(), false, () -> { if (this.current!=null) this.current.setEnabled(getState()).commitEnabled(); }); } public void setWidthProperty(final DoubleProperty property) { this.label.maxWidthProperty().bind(property.subtract(155)); } public void setState(final boolean state, final boolean fast) { setState(state, fast, null); } public void setState(final boolean state, final boolean fast, final Runnable callback) { if (this.state!=state) if (fast) { this.slideButton.setTranslateX(this.state ? 0 : 26); this.slideBack.prefWidthProperty().set(this.state ? 13 : 26+13); this.state = state; if (callback!=null) callback.run(); } else { this.slideButton.setDisable(true); final TranslateTransition transition1 = new TranslateTransition(); transition1.setNode(this.slideButton); transition1.setDuration(Duration.millis(100)); transition1.setByX(this.state ? 26 : 0); transition1.setToX(this.state ? 0 : 26); transition1.setInterpolator(Interpolator.EASE_OUT); transition1.play(); transition1.setOnFinished((ev) -> { this.state = state; this.slideButton.setDisable(false); if (callback!=null) callback.run(); }); final Timeline transition2 = new Timeline(); transition2.getKeyFrames().add( new KeyFrame(Duration.millis(100), new KeyValue(this.slideBack.prefWidthProperty(), this.state ? 13 : 26+13, Interpolator.EASE_OUT))); transition2.play(); } } public boolean getState() { return this.state; } @FXML private void onUpdateButtonClicked(final ActionEvent event) { this.current.downloadMod(); } public void update(final Memento item) { this.current = item; setState(item.isEnabled(), true); this.slideButton.setDisable(!item.isLocalMod()); this.label.setText(item.getInfo().getTitle()); this.updateButton.setVisible(item.getDownloadState()==DownloadState.NONE&&(item.isUpdateRequired()||!item.isLocalMod())); this.updateButton.setText(item.isLocalMod() ? "Update" : "Download"); this.updateChecking.setVisible(!item.isUpdateChecked()); switch (item.getDownloadState()) { case DOWNLOADING: this.updateButton.setVisible(false); this.progress.progressProperty().unbind(); this.progress.progressProperty().bind(item.getCurrentTask().progressProperty()); break; case FAILED: this.progress.lookup(".bar").setStyle("-fx-background-color: rgba(255, 0, 0, 0.5);"); this.updateButton.setText("Retry"); case CANCELLED: this.updateButton.setVisible(true); case SUCCEEDED: final FadeTransition fade = new FadeTransition(new Duration(1000), this.progress); fade.setDelay(new Duration(1000)); fade.setToValue(0); fade.setOnFinished(ae -> { this.progress.progressProperty().unbind(); this.progress.progressProperty().set(0); this.progress.setOpacity(1); this.progress.lookup(".bar").setStyle("-fx-background-color: rgba(0, 255, 0, 0.5);"); item.setUpdateRequired(false); item.setDownloadState(DownloadState.NONE); }); fade.play(); break; default: this.progress.progressProperty().unbind(); this.progress.progressProperty().set(0); } } }
3e167dd6b43bea71365b083757d59bfba381ce70
2,110
java
Java
Arithmetic_Project/dynamic_plan_and_review/src/main/java/com/rox/LCS/Longest_Common_Subsequence.java
airpoet/bigdata
dc86e9fd63ed59cbd7bf69c1aa37ff6130df3da8
[ "MIT" ]
null
null
null
Arithmetic_Project/dynamic_plan_and_review/src/main/java/com/rox/LCS/Longest_Common_Subsequence.java
airpoet/bigdata
dc86e9fd63ed59cbd7bf69c1aa37ff6130df3da8
[ "MIT" ]
null
null
null
Arithmetic_Project/dynamic_plan_and_review/src/main/java/com/rox/LCS/Longest_Common_Subsequence.java
airpoet/bigdata
dc86e9fd63ed59cbd7bf69c1aa37ff6130df3da8
[ "MIT" ]
2
2019-04-20T03:31:31.000Z
2020-03-19T14:15:50.000Z
21.313131
74
0.341232
9,586
package com.rox.LCS; public class Longest_Common_Subsequence { public int lengthOfLCS(String A, String B) { int n = A.length(); int m = B.length(); char[] a = A.toCharArray(); char[] b = B.toCharArray(); int[][] dp = new int[n][m]; // 第一列 for (int i = 0; i < n; i++) { if (a[i] == b[0]) { dp[i][0] = 1; for (int j = i + 1; j < n; j++) { dp[j][0] = 1; } break; } } // 第一行 for (int i = 0; i < m; i++) { if (a[0] == b[i]) { dp[0][i] = 1; for (int j = i + 1; j < m; j++) { dp[0][j] = 1; } break; } } // 其它行和列(双重 for 循环, 从1开始, 套公式) for (int i = 1; i < n; i++) { for (int j = 1; j < m; j++) { if (a[i] == b[j]) { dp[i][j] = dp[i - 1][j - 1] + 1; } else { dp[i][j] = Math.max(dp[i][j-1],dp[i-1][j]); } } } // 以上已经把所有的表中元素都求出来了, 下面打印一下 for(int i = 0;i<n;i++){ for(int j = 0;j<m;j++){ System.out.print(dp[i][j]+"\t"); } System.out.println(); } return dp[n-1][m-1]; } public static void main(String[] args) { Longest_Common_Subsequence lcs = new Longest_Common_Subsequence(); int len = lcs.lengthOfLCS("androidm","random"); System.out.println("\n最大公共字符串数量为: "+len); } } /** * 矩阵图如下 * * r a n d o m a 0 1 1 1 1 1 n 0 1 2 2 2 2 d 0 1 2 3 3 3 r 1 1 2 3 3 3 o 1 1 2 3 4 4 i 1 1 2 3 4 4 d 1 1 2 3 4 4 m 1 1 2 3 4 5 最大公共字符串数量为: 5 公式如下: 公式: C[i,j] = * 0 若 i=0 或 j=0 * C[i-1, j-1] + 1 若 i, j > 0, x[ i ] = y[ j ] * 左上斜 的数 + 1 * max{ C[ i, j-1 ], C[ i -1, j ] } 若 i, j > 0, x[ i ] != y[ j ] * 左边 || 上面 的数 , 取最大值. */
3e167de1d7d89a14a9f011a5d3a26e5403f5e187
3,666
java
Java
groundsdk/src/androidTest/java/com/parrot/drone/groundsdk/internal/component/ComponentCoreTest.java
Asgardsys/GrounSDK
d4a8feb893b702e49a4aee1bf2dfa8becdffccae
[ "BSD-3-Clause" ]
16
2019-05-15T16:15:03.000Z
2022-01-26T07:42:57.000Z
groundsdk/src/androidTest/java/com/parrot/drone/groundsdk/internal/component/ComponentCoreTest.java
Asgardsys/GrounSDK
d4a8feb893b702e49a4aee1bf2dfa8becdffccae
[ "BSD-3-Clause" ]
7
2019-06-07T15:40:01.000Z
2022-03-30T22:29:35.000Z
groundsdk/src/androidTest/java/com/parrot/drone/groundsdk/internal/component/ComponentCoreTest.java
Asgardsys/GrounSDK
d4a8feb893b702e49a4aee1bf2dfa8becdffccae
[ "BSD-3-Clause" ]
10
2019-10-01T11:40:59.000Z
2022-03-21T16:41:47.000Z
35.592233
87
0.681397
9,587
/* * Copyright (C) 2019 Parrot Drones SAS * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of the Parrot Company nor the names * of its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * PARROT COMPANY BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ package com.parrot.drone.groundsdk.internal.component; import androidx.annotation.NonNull; import com.parrot.drone.groundsdk.internal.session.Session; import org.junit.Before; import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class ComponentCoreTest { private ComponentCore mComponent; private int mChangeCnt; @Before public void setUp() { ComponentStore<CompType> store = new ComponentStore<>(); store.registerObserver(CompType.class, () -> mChangeCnt++); mComponent = new ComponentCore(ComponentDescriptor.of(CompType.class), store) { @NonNull @Override protected Object getProxy(@NonNull Session session) { return this; } }; mChangeCnt = 0; } @Test public void testPublication() { // component should not be published at first assertThat(mComponent.isPublished(), is(false)); assertThat(mChangeCnt, is(0)); // publish component mComponent.publish(); // should now be published and have triggered a change notification assertThat(mComponent.isPublished(), is(true)); assertThat(mChangeCnt, is(1)); // try to publish component again mComponent.publish(); // should neither change publication state nor trigger a change assertThat(mComponent.isPublished(), is(true)); assertThat(mChangeCnt, is(1)); // unpublish component mComponent.unpublish(); // should now be unpublished and have triggered a change notification assertThat(mComponent.isPublished(), is(false)); assertThat(mChangeCnt, is(2)); // try to publish component again mComponent.unpublish(); // should neither change publication state nor trigger a change assertThat(mComponent.isPublished(), is(false)); assertThat(mChangeCnt, is(2)); } }
3e167e015476abcddb8358e1b6b62584763d8ca6
7,885
java
Java
org.eclipse.draw2d/src/org/eclipse/draw2d/graph/SortSubgraphs.java
oswalds/archi
c25d4e2a4ca55620ebd2073ca356634c43868aed
[ "MIT" ]
582
2015-01-10T14:42:22.000Z
2022-03-31T02:06:02.000Z
org.eclipse.draw2d/src/org/eclipse/draw2d/graph/SortSubgraphs.java
oswalds/archi
c25d4e2a4ca55620ebd2073ca356634c43868aed
[ "MIT" ]
740
2015-01-22T11:40:18.000Z
2022-03-30T13:54:36.000Z
org.eclipse.draw2d/src/org/eclipse/draw2d/graph/SortSubgraphs.java
oswalds/archi
c25d4e2a4ca55620ebd2073ca356634c43868aed
[ "MIT" ]
222
2015-01-29T14:33:55.000Z
2022-03-29T09:31:38.000Z
34.432314
82
0.526062
9,588
/******************************************************************************* * Copyright (c) 2003, 2010 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.draw2d.graph; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; /** * Performs a topological sort from left to right of the subgraphs in a compound * directed graph. This ensures that subgraphs do not intertwine. * * @author Randy Hudson * @since 2.1.2 */ @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) class SortSubgraphs extends GraphVisitor { CompoundDirectedGraph g; NestingTree nestingTrees[]; Set orderingGraphEdges = new HashSet(); Set orderingGraphNodes = new HashSet(); NodePair pair = new NodePair(); private void breakSubgraphCycles() { // The stack of nodes which have no unmarked incoming edges List noLefts = new ArrayList(); int index = 1; // Identify all initial nodes for removal for (Iterator iter = orderingGraphNodes.iterator(); iter.hasNext();) { Node node = (Node) iter.next(); if (node.x == 0) sortedInsert(noLefts, node); } Node cycleRoot; do { // Remove all leftmost nodes, updating the nodes to their right while (noLefts.size() > 0) { Node node = (Node) noLefts.remove(noLefts.size() - 1); node.sortValue = index++; orderingGraphNodes.remove(node); // System.out.println("removed:" + node); NodeList rightOf = rightOf(node); if (rightOf == null) continue; for (int i = 0; i < rightOf.size(); i++) { Node right = rightOf.getNode(i); right.x--; if (right.x == 0) sortedInsert(noLefts, right); } } cycleRoot = null; double min = Double.MAX_VALUE; for (Iterator iter = orderingGraphNodes.iterator(); iter.hasNext();) { Node node = (Node) iter.next(); if (node.sortValue < min) { cycleRoot = node; min = node.sortValue; } } if (cycleRoot != null) { // break the cycle; sortedInsert(noLefts, cycleRoot); // System.out.println("breaking cycle with:" + cycleRoot); // Display.getCurrent().beep(); cycleRoot.x = -1; // prevent x from ever reaching 0 } // else if (OGmembers.size() > 0) //System.out.println("FAILED TO FIND CYCLE ROOT"); //$NON-NLS-1$ } while (cycleRoot != null); } private void buildSubgraphOrderingGraph() { RankList ranks = g.ranks; nestingTrees = new NestingTree[ranks.size()]; for (int r = 0; r < ranks.size(); r++) { NestingTree entry = NestingTree.buildNestingTreeForRank(ranks .getRank(r)); nestingTrees[r] = entry; entry.calculateSortValues(); entry.recursiveSort(false); } for (int i = 0; i < nestingTrees.length; i++) { NestingTree entry = nestingTrees[i]; buildSubgraphOrderingGraph(entry); } } private void buildSubgraphOrderingGraph(NestingTree entry) { NodePair pair = new NodePair(); if (entry.isLeaf) return; for (int i = 0; i < entry.contents.size(); i++) { Object right = entry.contents.get(i); if (right instanceof Node) pair.n2 = (Node) right; else { pair.n2 = ((NestingTree) right).subgraph; buildSubgraphOrderingGraph((NestingTree) right); } if (pair.n1 != null && !orderingGraphEdges.contains(pair)) { orderingGraphEdges.add(pair); leftToRight(pair.n1, pair.n2); orderingGraphNodes.add(pair.n1); orderingGraphNodes.add(pair.n2); pair.n2.x++; // Using x field to count predecessors. pair = new NodePair(pair.n2, null); } else { pair.n1 = pair.n2; } } } /** * Calculates the average position P for each node and subgraph. The average * position is stored in the sortValue for each node or subgraph. * * Runs in approximately linear time with respect to the number of nodes, * including virtual nodes. */ private void calculateSortValues() { RankList ranks = g.ranks; g.subgraphs.resetSortValues(); g.subgraphs.resetIndices(); /* * For subgraphs, the sum of all positions is kept, along with the * number of contributions, which is tracked in the subgraph's index * field. */ for (int r = 0; r < ranks.size(); r++) { Rank rank = ranks.getRank(r); for (int j = 0; j < rank.count(); j++) { Node node = rank.getNode(j); node.sortValue = node.index; Subgraph parent = node.getParent(); while (parent != null) { parent.sortValue += node.sortValue; parent.index++; parent = parent.getParent(); } } } /* * For each subgraph, divide the sum of the positions by the number of * contributions, to give the average position. */ for (int i = 0; i < g.subgraphs.size(); i++) { Subgraph subgraph = (Subgraph) g.subgraphs.get(i); subgraph.sortValue /= subgraph.index; } } private void repopulateRanks() { for (int i = 0; i < nestingTrees.length; i++) { Rank rank = g.ranks.getRank(i); rank.clear(); nestingTrees[i].repopulateRank(rank); } } private NodeList rightOf(Node left) { return (NodeList) left.workingData[0]; } private void leftToRight(Node left, Node right) { rightOf(left).add(right); } void sortedInsert(List list, Node node) { int insert = 0; while (insert < list.size() && ((Node) list.get(insert)).sortValue > node.sortValue) insert++; list.add(insert, node); } private void topologicalSort() { for (int i = 0; i < nestingTrees.length; i++) { nestingTrees[i].getSortValueFromSubgraph(); nestingTrees[i].recursiveSort(false); } } void init() { for (int r = 0; r < g.ranks.size(); r++) { Rank rank = g.ranks.getRank(r); for (int i = 0; i < rank.count(); i++) { Node n = (Node) rank.get(i); n.workingData[0] = new NodeList(); } } for (int i = 0; i < g.subgraphs.size(); i++) { Subgraph s = (Subgraph) g.subgraphs.get(i); s.workingData[0] = new NodeList(); } } @Override public void visit(DirectedGraph dg) { g = (CompoundDirectedGraph) dg; init(); buildSubgraphOrderingGraph(); calculateSortValues(); breakSubgraphCycles(); topologicalSort(); repopulateRanks(); } }
3e167ebe074c171923286a9201d681e650f5bc74
2,854
java
Java
onebusaway-cloud-api/src/main/java/org/onebusaway/cloud/api/ExternalServicesBridgeFactory.java
OneBusAway/onebusaway-cloud-services
630d163bcf7aaa293e1aa597760949d36dee5095
[ "Apache-2.0" ]
1
2019-06-05T03:12:37.000Z
2019-06-05T03:12:37.000Z
onebusaway-cloud-api/src/main/java/org/onebusaway/cloud/api/ExternalServicesBridgeFactory.java
OneBusAway/onebusaway-cloud-services
630d163bcf7aaa293e1aa597760949d36dee5095
[ "Apache-2.0" ]
9
2020-02-11T15:05:53.000Z
2021-06-04T02:07:01.000Z
onebusaway-cloud-api/src/main/java/org/onebusaway/cloud/api/ExternalServicesBridgeFactory.java
OneBusAway/onebusaway-cloud-services
630d163bcf7aaa293e1aa597760949d36dee5095
[ "Apache-2.0" ]
5
2018-12-10T18:45:28.000Z
2020-10-22T20:30:42.000Z
33.576471
103
0.66363
9,589
/** * Copyright (C) 2018 Cambridge Systematics, 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 org.onebusaway.cloud.api; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class ExternalServicesBridgeFactory { private final Logger _log = LoggerFactory.getLogger(ExternalServicesBridgeFactory.class); public static final String AWS_KEY = "oba.cloud.aws"; private static final String NOOP_FACTORY = "org.onebusaway.cloud.noop.ExternalServicesNoopFactory"; private static final String AWS_FACTORY = "org.onebusaway.cloud.aws.ExternalServicesAwsFactory"; public ExternalServices getExternalServices() { if (getPropertySet(AWS_KEY)) { ExternalServices es = instantiate(AWS_FACTORY); if (es != null) { return es; } } return instantiate(NOOP_FACTORY); } private boolean getPropertySet(String key) { return "true".equalsIgnoreCase(System.getProperty(key)); } private ExternalServices instantiate(String className) { Class factoryClass = null; try { factoryClass = Class.forName(className); } catch (ClassNotFoundException e) { reportException(className, e); return null; } Constructor factoryConstructor = null; try { factoryConstructor = factoryClass.getConstructor(null); } catch (NoSuchMethodException e) { reportException(className, e); return null; } Object obj = null; try { obj = factoryConstructor.newInstance(null); } catch (InstantiationException e) { reportException(className, e); return null; } catch (IllegalAccessException e) { reportException(className, e); return null; } catch (InvocationTargetException e) { reportException(className, e); return null; } ExternalServicesFactory esf = (ExternalServicesFactory) obj; return esf.getExternalServices(); } private void reportException(String className, Exception e) { _log.info("Exception instantiating " + className, e); } }
3e167f3076caee74926981b619b8f8b57c7afe6a
178
java
Java
java_backup/my java/souvaghya/ayu.java
SayanGhoshBDA/code-backup
8b6135facc0e598e9686b2e8eb2d69dd68198b80
[ "MIT" ]
16
2018-11-26T08:39:42.000Z
2019-05-08T10:09:52.000Z
java_backup/my java/souvaghya/ayu.java
SayanGhoshBDA/code-backup
8b6135facc0e598e9686b2e8eb2d69dd68198b80
[ "MIT" ]
8
2020-05-04T06:29:26.000Z
2022-02-12T05:33:16.000Z
java_backup/my java/souvaghya/ayu.java
SayanGhoshBDA/code-backup
8b6135facc0e598e9686b2e8eb2d69dd68198b80
[ "MIT" ]
5
2020-02-11T16:02:21.000Z
2021-02-05T07:48:30.000Z
11.125
38
0.589888
9,590
class ayu { public static void main(String args[]) { int m; m=65; int i;int j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) System.out.print((char)m); m++; System.out.println(""); } } }
3e167fc745c4be46547d8be05927193bcda48eac
2,889
java
Java
server-core/src/main/java/io/onedev/server/model/support/issue/transitiontrigger/PressButtonTrigger.java
programlife555/onedev
508488c795b0c5ce431e7ec905631771ee408f5c
[ "MIT" ]
null
null
null
server-core/src/main/java/io/onedev/server/model/support/issue/transitiontrigger/PressButtonTrigger.java
programlife555/onedev
508488c795b0c5ce431e7ec905631771ee408f5c
[ "MIT" ]
null
null
null
server-core/src/main/java/io/onedev/server/model/support/issue/transitiontrigger/PressButtonTrigger.java
programlife555/onedev
508488c795b0c5ce431e7ec905631771ee408f5c
[ "MIT" ]
null
null
null
30.410526
100
0.766009
9,591
package io.onedev.server.model.support.issue.transitiontrigger; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.hibernate.validator.constraints.NotEmpty; import io.onedev.server.OneDev; import io.onedev.server.entitymanager.SettingManager; import io.onedev.server.model.User; import io.onedev.server.model.support.administration.GlobalIssueSetting; import io.onedev.server.model.support.issue.fieldspec.FieldSpec; import io.onedev.server.util.SecurityUtils; import io.onedev.server.util.usermatcher.UserMatcher; import io.onedev.server.web.editable.annotation.ChoiceProvider; import io.onedev.server.web.editable.annotation.Editable; import io.onedev.server.web.editable.annotation.NameOfEmptyValue; import io.onedev.server.web.page.project.ProjectPage; import io.onedev.server.web.util.WicketUtils; @Editable(order=100, name="Button is pressed") public class PressButtonTrigger implements TransitionTrigger { private static final long serialVersionUID = 1L; private String buttonLabel; private String authorized; private List<String> promptFields = new ArrayList<>(); @Editable(order=100) @NotEmpty public String getButtonLabel() { return buttonLabel; } public void setButtonLabel(String buttonLabel) { this.buttonLabel = buttonLabel; } @Editable(order=200, name="Authorization") @io.onedev.server.web.editable.annotation.UserMatcher @NotEmpty(message="may not be empty") public String getAuthorized() { return authorized; } public void setAuthorized(String authorized) { this.authorized = authorized; } @Editable(order=500, description="Optionally select fields to prompt when this button is pressed") @ChoiceProvider("getFieldChoices") @NameOfEmptyValue("No fields to prompt") public List<String> getPromptFields() { return promptFields; } public void setPromptFields(List<String> promptFields) { this.promptFields = promptFields; } @SuppressWarnings("unused") private static List<String> getFieldChoices() { List<String> fields = new ArrayList<>(); GlobalIssueSetting issueSetting = OneDev.getInstance(SettingManager.class).getIssueSetting(); for (FieldSpec field: issueSetting.getFieldSpecs()) fields.add(field.getName()); return fields; } public void onRenameField(String oldName, String newName) { for (int i=0; i<getPromptFields().size(); i++) { if (getPromptFields().get(i).equals(oldName)) getPromptFields().set(i, newName); } } public void onDeleteField(String fieldName) { for (Iterator<String> it = getPromptFields().iterator(); it.hasNext();) { if (it.next().equals(fieldName)) it.remove(); } } public boolean isAuthorized() { ProjectPage page = (ProjectPage) WicketUtils.getPage(); User user = SecurityUtils.getUser(); return user != null && UserMatcher.fromString(getAuthorized()).matches(page.getProject(), user); } }
3e16800a5e02f61bb6d5df192f7648c3fefd610e
1,090
java
Java
reladomo/src/test/java/com/gs/fw/common/mithra/test/domain/OrderStatus.java
h143570/reladomo
7a7541a2a09a2d7ed85d6e35166b4635629f13a6
[ "Apache-2.0" ]
null
null
null
reladomo/src/test/java/com/gs/fw/common/mithra/test/domain/OrderStatus.java
h143570/reladomo
7a7541a2a09a2d7ed85d6e35166b4635629f13a6
[ "Apache-2.0" ]
1
2019-06-06T16:46:42.000Z
2019-06-06T16:46:42.000Z
reladomo/src/test/java/com/gs/fw/common/mithra/test/domain/OrderStatus.java
h143570/reladomo
7a7541a2a09a2d7ed85d6e35166b4635629f13a6
[ "Apache-2.0" ]
3
2018-10-02T15:34:51.000Z
2019-05-21T15:26:41.000Z
25.952381
103
0.73578
9,592
/* Copyright 2016 Goldman Sachs. 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.gs.fw.common.mithra.test.domain; import java.sql.Timestamp; import java.util.Date; public class OrderStatus extends OrderStatusAbstract { public OrderStatus() { super(); } public OrderStatus(int orderId, int status, String lastUser, Timestamp lastUpdate, Date expectedDate) { super(); this.setOrderId(orderId); this.setStatus(status); this.setLastUser(lastUser); this.setLastUpdateTime(lastUpdate); this.setExpectedDate(expectedDate); } }
3e168057fe8eca6bf2f6afc3af06556c64a94a56
1,741
java
Java
serviceapi/src/main/java/me/retrodaredevil/solarthing/homeassistant/data/SensorInfo.java
modern-resilience/solarthing
880857598f73567f31920826cc691987d8f7135c
[ "MIT" ]
67
2019-07-03T22:22:45.000Z
2022-02-23T14:29:10.000Z
serviceapi/src/main/java/me/retrodaredevil/solarthing/homeassistant/data/SensorInfo.java
modern-resilience/solarthing
880857598f73567f31920826cc691987d8f7135c
[ "MIT" ]
46
2019-12-19T01:01:46.000Z
2022-03-26T16:24:21.000Z
serviceapi/src/main/java/me/retrodaredevil/solarthing/homeassistant/data/SensorInfo.java
modern-resilience/solarthing
880857598f73567f31920826cc691987d8f7135c
[ "MIT" ]
18
2019-12-01T18:10:36.000Z
2022-01-28T06:39:39.000Z
23.527027
104
0.718553
9,593
package me.retrodaredevil.solarthing.homeassistant.data; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.Instant; import java.util.Map; public class SensorInfo implements HomeAssistantSensorInfo { private final String entityId; private final Instant lastChanged; private final Instant lastUpdated; private final Map<String, String> context; private final String state; private final Map<String, String> attributes; @JsonCreator public SensorInfo( @JsonProperty("entity_id") String entityId, @JsonProperty("last_changed") Instant lastChanged, @JsonProperty("last_updated") Instant lastUpdated, @JsonProperty("context") Map<String, String> context, @JsonProperty("state") String state, @JsonProperty("attributes") Map<String, String> attributes) { this.entityId = entityId; this.lastChanged = lastChanged; this.lastUpdated = lastUpdated; this.context = context; this.state = state; this.attributes = attributes; } @Override public String getEntityId() { return entityId; } @Override public Instant getLastChanged() { return lastChanged; } @Override public Instant getLastUpdated() { return lastUpdated; } @Override public Map<String, String> getContext() { return context; } @Override public String getState() { return state; } @Override public Map<String, String> getAttributes() { return attributes; } @Override public String toString() { return "SensorInfo(" + "entityId='" + entityId + '\'' + ", lastChanged=" + lastChanged + ", lastUpdated=" + lastUpdated + ", context=" + context + ", state='" + state + '\'' + ", attributes=" + attributes + ')'; } }
3e168116917211a7b2be11ee7e3250fbc7194b1f
2,806
java
Java
app/src/main/java/com/com/gang/aiyicomeon/rongyun/Chat_main.java
xiaoganggang/Ayicomeon
0ffca18dafcbe7ac363753805f67cf4473f71912
[ "Apache-2.0" ]
1
2017-04-29T04:47:37.000Z
2017-04-29T04:47:37.000Z
app/src/main/java/com/com/gang/aiyicomeon/rongyun/Chat_main.java
xiaoganggang/Ayicomeon
0ffca18dafcbe7ac363753805f67cf4473f71912
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/com/gang/aiyicomeon/rongyun/Chat_main.java
xiaoganggang/Ayicomeon
0ffca18dafcbe7ac363753805f67cf4473f71912
[ "Apache-2.0" ]
1
2020-03-07T04:22:56.000Z
2020-03-07T04:22:56.000Z
40.085714
115
0.677477
9,594
package com.com.gang.aiyicomeon.rongyun; import android.net.Uri; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.os.Bundle; import com.example.administrator.ayicomeon.R; import java.util.ArrayList; import java.util.List; import io.rong.imkit.fragment.ConversationListFragment; import io.rong.imlib.model.Conversation; public class Chat_main extends FragmentActivity { private ViewPager mViewPage; private FragmentPagerAdapter mFragmentPagerAdapter;//将tab页面持久在内存中 private Fragment mConversationList; private Fragment mConversationFragment; private List<Fragment> mFragment = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat_main); //通过方法,获取融云会话列表的对象 mConversationList = initConversationList(); mViewPage = (ViewPager) findViewById(R.id.liaotia_viewpage); mFragment.add(HomeFragment.getInstance()); mFragment.add(mConversationList); //这就是单例模式的好处,不用多次声明对象 mFragment.add(FriendFragment.getInstance()); mFragmentPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { return mFragment.get(position); } @Override public int getCount() { return mFragment.size(); } }; mViewPage.setAdapter(mFragmentPagerAdapter); } private Fragment initConversationList() { if (mConversationFragment == null) { ConversationListFragment listFragment = new ConversationListFragment(); Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon() .appendPath("conversationlist") .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") //设置私聊会话是否聚合显示 .appendQueryParameter(Conversation.ConversationType.GROUP.getName(), "false")//群组 .appendQueryParameter(Conversation.ConversationType.DISCUSSION.getName(), "false")//讨论组 .appendQueryParameter(Conversation.ConversationType.PUBLIC_SERVICE.getName(), "false")//公共服务号 .appendQueryParameter(Conversation.ConversationType.APP_PUBLIC_SERVICE.getName(), "false")//订阅号 .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "false")//系统 .build(); listFragment.setUri(uri); return listFragment; } else { return null; } } }
3e1681232ed6def859d753341b1c6163ad176b5c
292
java
Java
src/tokens/Type.java
lucianoserafim/compilador
a83648570ad801c0f8e30ac2353b4d8bf92ca8cf
[ "Apache-2.0" ]
null
null
null
src/tokens/Type.java
lucianoserafim/compilador
a83648570ad801c0f8e30ac2353b4d8bf92ca8cf
[ "Apache-2.0" ]
null
null
null
src/tokens/Type.java
lucianoserafim/compilador
a83648570ad801c0f8e30ac2353b4d8bf92ca8cf
[ "Apache-2.0" ]
null
null
null
16.222222
62
0.674658
9,595
package tokens; public class Type extends Palavra { public static final Type INTEIRO = new Type("INTEIRO", -1); public static final Type BOOLEANO = new Type("BOOLEANO", -1); public Type(String palavra, int l){ super(palavra, Tag.BASICO, l); nomeDoToken = palavra; } }
3e168271430a4488420260044a0b54f6c5ab9dcc
9,212
java
Java
src/main/java/NewJFrame.java
5AF1/Study2Do
e1c61389d9cbc1b832f3861c18b54b55b5d3199a
[ "MIT" ]
1
2021-03-30T06:08:20.000Z
2021-03-30T06:08:20.000Z
src/main/java/NewJFrame.java
5AF1/Study2Do
e1c61389d9cbc1b832f3861c18b54b55b5d3199a
[ "MIT" ]
null
null
null
src/main/java/NewJFrame.java
5AF1/Study2Do
e1c61389d9cbc1b832f3861c18b54b55b5d3199a
[ "MIT" ]
null
null
null
36.995984
120
0.572948
9,596
import java.awt.*; import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.*; import javax.swing.BoxLayout; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * * @author mueez */ public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ private DatabaseClass dbObject; private ResultSet rsClass; private JCheckBox cb = new JCheckBox(); private JLabel jlab = new JLabel(); private String onThisDate; public NewJFrame() { initComponents(); this.setVisible(true); dbObject = new DatabaseClass(); System.out.println("arrrrrrrrr"); // setCheckBox(); } public NewJFrame(String thisDate) { initComponents(); this.setVisible(true); dbObject = new DatabaseClass(); setCheckBox(thisDate); } public void setCheckBox(String thisDate) { reset(); // Calendar cal = Calendar.getInstance(); // int date = cal.get(Calendar.DAY_OF_MONTH); // int month = cal.get(Calendar.MONTH); // int year = cal.get(Calendar.YEAR); // month++; //// System.out.println("yeehaaw: " + date + " " + month + " " + year); // String todaysDate = ""; // todaysDate = String.valueOf(year) + "-" + String.valueOf(month) + "-" + String.valueOf(date); //// System.out.println("yeehaaw: "+todaysDate); int i=0; rsClass = dbObject.getDbTaskOnThisDate(thisDate); jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS)); // jPanel1.setBackground(java.awt.Color.WHITE); try { while(rsClass.next()){ // System.out.println("well: " + rsClass.getString(3)); cb = new JCheckBox(); cb.setText(rsClass.getString("task_name")); cb.setFont(new Font("Serif", Font.PLAIN, 14)); cb.setForeground(Color.BLACK); String temp_taskId = rsClass.getString("task_id"); cb.addActionListener( new ActionListener() { // public void actionPerformed(ActionEvent event) // { // JOptionPane.showMessageDialog(null, event.getActionCommand()); // } public void actionPerformed(ActionEvent event) { try { Thread.sleep(2); } catch (InterruptedException ex) { Logger.getLogger(TaskFrame.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("dopweoqpwor"); dbObject.taskComplete(Integer.parseInt(temp_taskId)); setCheckBox(thisDate); } } ); jPanel1.add(cb); jlab = new JLabel(); jlab.setText(rsClass.getString("due_date")); jlab.setFont(new Font("Serif", Font.BOLD, 14)); jlab.setForeground(Color.BLACK); jPanel1.add(jlab); jlab = new JLabel(); // jlab.setText(rs2.getString("class_name") + " - " + rsClass.getString("class_id")); jlab.setText(rsClass.getString("class_id")); jlab.setFont(new Font("Serif", Font.PLAIN, 14)); jlab.setForeground(Color.BLACK); jPanel1.add(jlab); jlab = new JLabel(); jlab.setText(rsClass.getString("task_type")); jlab.setFont(new Font("Serif", Font.PLAIN, 14)); jlab.setForeground(Color.BLACK); jPanel1.add(jlab); jlab = new JLabel(); jlab.setText(rsClass.getString("description")); jlab.setFont(new Font("Serif", Font.PLAIN, 12)); jlab.setForeground(Color.BLACK); jPanel1.add(jlab); // jPanel1.add(Box.createVerticalGlue()); jPanel1.add(Box.createVerticalStrut(20)); } jScrollPane.setViewportView(jPanel1); } catch (SQLException ex) { Logger.getLogger(TaskFrame.class.getName()).log(Level.SEVERE, null, ex); } // jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS)); // jPanel1.setBackground(java.awt.Color.WHITE); // jScrollPane.setViewportView(jPanel1); } public void reset() { jPanel1 = new JPanel(); jScrollPane.setViewportView(jPanel1); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 378, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 276, Short.MAX_VALUE) ); jScrollPane.setViewportView(jPanel1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane; // End of variables declaration//GEN-END:variables }
3e1682ef1d000fbcb0dd6cfcf63bb84ddd300d98
435
java
Java
platform/base/core/src/test/java/com/peregrine/sitemap/HasNameTest.java
eXeLuis/peregrine-cms
1b19de2f7cfb64f802d44305971a21ce85382610
[ "Apache-2.0" ]
54
2017-09-13T21:14:34.000Z
2021-11-30T08:36:46.000Z
platform/base/core/src/test/java/com/peregrine/sitemap/HasNameTest.java
eXeLuis/peregrine-cms
1b19de2f7cfb64f802d44305971a21ce85382610
[ "Apache-2.0" ]
751
2018-09-22T15:38:00.000Z
2022-03-21T00:36:45.000Z
platform/base/core/src/test/java/com/peregrine/sitemap/HasNameTest.java
eXeLuis/peregrine-cms
1b19de2f7cfb64f802d44305971a21ce85382610
[ "Apache-2.0" ]
44
2017-10-11T00:01:26.000Z
2022-03-07T09:14:35.000Z
22.894737
67
0.703448
9,597
package com.peregrine.sitemap; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; import static org.junit.Assert.assertEquals; @RunWith(MockitoJUnitRunner.class) public final class HasNameTest { private final HasName model = new HasName() {}; @Test public void getName() { assertEquals(model.getClass().getName(), model.getName()); } }
3e168353d553c2f2ab81a0c2a0c6cc4cfbf407ac
861
java
Java
android/src/main/java/com/alinz/parkerdan/shareextension/SharePackage.java
maddijoyce/react-native-share-extension
30830e73569502e4ffa6b21481320d4e435a6038
[ "MIT" ]
6
2019-10-29T20:39:54.000Z
2021-01-20T19:13:15.000Z
android/src/main/java/com/alinz/parkerdan/shareextension/SharePackage.java
maddijoyce/react-native-share-extension
30830e73569502e4ffa6b21481320d4e435a6038
[ "MIT" ]
2
2017-11-11T07:28:05.000Z
2020-07-21T23:13:16.000Z
android/src/main/java/com/alinz/parkerdan/shareextension/SharePackage.java
maddijoyce/react-native-share-extension
30830e73569502e4ffa6b21481320d4e435a6038
[ "MIT" ]
14
2019-09-30T07:30:06.000Z
2021-06-09T16:36:30.000Z
30.75
88
0.794425
9,598
package com.alinz.parkerdan.shareextension; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.uimanager.ViewManager; import com.facebook.react.ReactPackage; import java.util.Arrays; import java.util.Collections; import java.util.List; public class SharePackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new ShareModule(reactContext)); } public List<Class<? extends JavaScriptModule>> createJSModules() { return Collections.emptyList(); } @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } }
3e16846f234628b2e76e0359a187017af2654745
1,074
java
Java
src/etudiant.java
HugoGapaillart/Depot-Java
f1c9210ee952776d58f7bf4d36a36ee28bb31984
[ "MIT" ]
null
null
null
src/etudiant.java
HugoGapaillart/Depot-Java
f1c9210ee952776d58f7bf4d36a36ee28bb31984
[ "MIT" ]
null
null
null
src/etudiant.java
HugoGapaillart/Depot-Java
f1c9210ee952776d58f7bf4d36a36ee28bb31984
[ "MIT" ]
null
null
null
23.347826
122
0.656425
9,599
import java.util.List; import java.util.ArrayList; public class Etudiant { public String nom; public String prenom; public int age; public String classe; private List<Chien> chiens; private List<Demon> demons; public Etudiant(String p_nom, String p_prenom, int p_age, String p_classe) { nom = p_nom; prenom = p_prenom; age = p_age; classe = p_classe; chiens = new ArrayList<>(); demons = new ArrayList<>(); } public void sePresenter() { System.out.println("Bonjour, je m'appelle " + nom + " " + prenom + " j'ai " + age + " ans, je suis en " + classe + "."); for(int i = 0; i < chiens.size(); i++) { chiens.get(i).sePresenter(); } for(int i = 0; i < demons.size(); i++) { demons.get(i).presenter(); } } //ajouter un chien a l'etudiant public void ajouterChien(Chien p_chien) { chiens.add(p_chien); } //retirer un chien a l'etudiant public void retirerChien(int numeroChien) { chiens.remove(numeroChien); } //ajouter un demon a l'etudiant public void ajouterDemon(Demon p_demon) { demons.add(p_demon); } }
3e16879989241b541b7167bb2245516fca784186
1,965
java
Java
third_party/java/htmlparser/src/nu/validator/saxtree/NodeType.java
terjanq/caja
646d54c379f8f3eed0f8859a2c5beaa6b9ee8484
[ "Apache-2.0" ]
1,172
2015-04-20T10:04:46.000Z
2021-01-28T19:10:42.000Z
third_party/java/htmlparser/src/nu/validator/saxtree/NodeType.java
terjanq/caja
646d54c379f8f3eed0f8859a2c5beaa6b9ee8484
[ "Apache-2.0" ]
89
2015-05-08T21:28:00.000Z
2020-11-24T05:45:25.000Z
third_party/java/htmlparser/src/nu/validator/saxtree/NodeType.java
terjanq/caja
646d54c379f8f3eed0f8859a2c5beaa6b9ee8484
[ "Apache-2.0" ]
147
2015-04-18T12:13:11.000Z
2021-02-01T05:10:46.000Z
25.519481
78
0.642239
9,600
/* * Copyright (c) 2007 Henri Sivonen * Copyright (c) 2008 Mozilla Foundation * * 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 nu.validator.saxtree; /** * The node type. * @version $Id: NodeType.java 367 2008-07-02 18:27:22Z hsivonen $ * @author hsivonen */ public enum NodeType { /** * A CDATA section. */ CDATA, /** * A run of characters. */ CHARACTERS, /** * A comment. */ COMMENT, /** * A document. */ DOCUMENT, /** * A document fragment. */ DOCUMENT_FRAGMENT, /** * A DTD. */ DTD, /** * An element. */ ELEMENT, /** * An entity. */ ENTITY, /** * A run of ignorable whitespace. */ IGNORABLE_WHITESPACE, /** * A processing instruction. */ PROCESSING_INSTRUCTION, /** * A skipped entity. */ SKIPPED_ENTITY }
3e16885ee5f727665cb5c7d6e407ad0b31a1591c
5,484
java
Java
Preference/src/DBSearcher.java
voidblue/PreferenceWebPage
7b36a6b0df09b84aa46fb63f9b191c84b46509d6
[ "Apache-2.0" ]
null
null
null
Preference/src/DBSearcher.java
voidblue/PreferenceWebPage
7b36a6b0df09b84aa46fb63f9b191c84b46509d6
[ "Apache-2.0" ]
null
null
null
Preference/src/DBSearcher.java
voidblue/PreferenceWebPage
7b36a6b0df09b84aa46fb63f9b191c84b46509d6
[ "Apache-2.0" ]
null
null
null
35.153846
150
0.5155
9,601
import javax.crypto.Cipher; import javax.swing.*; import java.sql.*; public class DBSearcher { String[] userInput; static String[] sqlBlocks; static int[] blockInputCounts; private DBSearcher(String[] userInput) { this.userInput = userInput; } public static DBSearcher getInstance(String[] userInput) { blockInputCounts = new int[] {0, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8}; sqlBlocks = new String[] { "select SUM(한라산), SUM(오름), SUM(성산일출봉), SUM(섬), SUM(올레길), SUM(폭포), SUM(동굴), " + "SUM(해수욕장), SUM(비자림), SUM(한라수목원), SUM(서귀포자연휴양림), SUM(절물자연후양림)" + ", SUM(용두암), SUM(주상절리대), SUM(한림공원), SUM(국립제주방물관), SUM(도립미술관), " + "SUM(민속자연사박물관), SUM(제주돌문화공원), SUM(제주세계자연유산센터), SUM(이중섭박물관)" + ", SUM(서복전시관), SUM(제주43평화공원), SUM(동문시장), SUM(중앙로지하상가), SUM(바오젠거리)" + ", SUM(제주오일장), SUM(서귀포매일올레시장), SUM(신라면세점), SUM(롯데면세점)" + ", SUM(제주관광공사면세점), SUM(공항JDC면세점), SUM(제주목관아), SUM(항몽유적지)" + ", SUM(성읍민속마을), SUM(삼양동선사유적), SUM(제주추사관), SUM(관덕정), SUM(이중섭거주지)" + ", SUM(하멜기념비), SUM(미로공원), SUM(에코랜드), SUM(제주경마공원), SUM(불교사찰)" + ", SUM(아쿠아플라넷), SUM(테디베어박물관), SUM(소인국테마파크), SUM(잠수함관광)" + ", SUM(신비의도로), SUM(생각하는정원), SUM(드라마촬영지), SUM(제주별빛누리공원)" + ", SUM(유람선), SUM(제주바다체험장), SUM(골프장), SUM(카지노)" + "from trainingOutput " + "JOIN trainingInput ON (trainingInput.key-18009) = trainingOutput.key\n" + "WHERE ", "visitTimes=? ", "AND birthYear=? ", "AND transportaion=? ", "AND numOfPeople=? ", "AND mainDestination=? ", "AND alone=? AND couple=? AND family=? AND collegue=? AND friends=? AND amity=? AND othersCompanion=? ", "AND job=? ", "AND stayDuration=? ", "AND considerReason1=? ", "AND triptype=? ", "AND month=? ", "AND region=? ", "AND considerReason2=? ", "AND gender=? ", "AND education=? ", "AND infoGet=? ", "AND minor=? ", "AND hotel=? AND motel=? AND guestHouse=? AND pension=? AND resort=? AND friendsHouse=? AND noAccomodation=? AND otherAccomodation=? " }; return new DBSearcher(userInput); } private Connection getConnection() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://220.149.42.125:3306/preference?useUnicode=true&characterEncoding=euckr" , "root", "456111"); return connection; } public String getOthersSelect() throws SQLException, ClassNotFoundException { String result = searchOthers(19); return result; } private String searchOthers(int lastBlock) throws SQLException, ClassNotFoundException { String sql = getSQL(sqlBlocks, lastBlock); int blockInputCount = getBlockInputCount(lastBlock); Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sql); for (int i = 1; i <= blockInputCount; i++) { preparedStatement.setInt(i, Integer.parseInt(userInput[i-1])); } ResultSet resultSet = preparedStatement.executeQuery(); ResultSetMetaData meta = resultSet.getMetaData(); // String result = ""; String maxField = getMaxField(resultSet, meta); if (maxField == null) return searchOthers(lastBlock-1); // else result = maxField.substring(4, maxField.length()-1); resultSet.close(); preparedStatement.close(); connection.close(); // System.out.println("결과 : " + result); return maxField; } private String getMaxField(ResultSet resultSet, ResultSetMetaData meta) throws SQLException { String maxName = null; int max = 0; int count = meta.getColumnCount(); while(resultSet.next()) { for (int i = 1; i <= count; i++) { String name = meta.getColumnName(i); int num = resultSet.getInt(name); if (num > max) { max = num; // maxName = name; maxName = name.substring(4, name.length()-1) + "@"; } else if (num == max) { // maxName += "*" + name; maxName += name.substring(4, name.length()-1) + "@"; } } // System.out.println("최대 : " + maxName + " -> " + max); } return maxName; } private int getBlockInputCount(int lastBlock) { int result = 0; for (int i = 0; i < lastBlock; i++) result += blockInputCounts[i]; return result; } private String getSQL(String[] arrSQL, int lastBlock) { String result = ""; for (int i = 0; i < lastBlock; i++) { result += arrSQL[i]; } result += ";"; // System.out.println(result); return result; } }
3e16896b6d8dbd10b1e03620b3fdab8869da65c0
5,068
java
Java
src/goryachev/secdb/internal/DBEngineIO.java
andy-goryachev/SecDB
7199c37a3329d9bb43832e0cfd856ec234502edc
[ "Apache-2.0" ]
3
2019-08-24T02:49:15.000Z
2022-01-01T17:54:24.000Z
src/goryachev/secdb/internal/DBEngineIO.java
andy-goryachev/SecDB
7199c37a3329d9bb43832e0cfd856ec234502edc
[ "Apache-2.0" ]
null
null
null
src/goryachev/secdb/internal/DBEngineIO.java
andy-goryachev/SecDB
7199c37a3329d9bb43832e0cfd856ec234502edc
[ "Apache-2.0" ]
null
null
null
22.629464
117
0.613533
9,602
// Copyright © 2019-2021 Andy Goryachev <upchh@example.com> package goryachev.secdb.internal; import goryachev.common.io.DReader; import goryachev.common.io.DWriter; import goryachev.common.io.DWriterBytes; import goryachev.common.log.Log; import goryachev.common.util.CKit; import goryachev.common.util.Hex; import goryachev.common.util.SKey; import goryachev.secdb.IRef; import goryachev.secdb.IStore; import goryachev.secdb.bplustree.BPlusTreeNode; import goryachev.secdb.util.ByteArrayIStream; /** * DBEngine serializer/deserializer. */ public class DBEngineIO { /** marks DataHolder.REF instead of DataHolder.VAL */ private static final int REF_MARKER = 255; /** size threshold below which small values are stored in the leaf node */ public static final int MAX_INLINE_SIZE = REF_MARKER - 1; protected static final Log log = Log.get("DBEngineIO"); public static <R extends IRef> R store(IStore<R> store, BPlusTreeNode<SKey,DataHolder<R>> node) throws Exception { DWriterBytes wr = new DWriterBytes(); try { if(node instanceof DBLeafNode) { DBLeafNode n = (DBLeafNode)node; int sz = n.size(); wr.writeInt8(sz); writeKeys(wr, sz, n); writeValues(store, wr, n); } else if(node instanceof DBInternalNode) { DBInternalNode n = (DBInternalNode)node; int sz = n.size(); wr.writeInt8(-sz); writeKeys(wr, sz, n); writeNodeRefs(store, wr, n); } else { throw new Error("?" + node); } byte[] b = wr.toByteArray(); R ref = store.store(new ByteArrayIStream(b), true); log.trace(() -> "STORE " + ref + "\n" + Hex.toHexStringASCII(b)); return ref; } finally { CKit.close(wr); } } public static <R extends IRef> BPlusTreeNode<SKey,DataHolder<R>> read(IStore<R> store, byte[] buf) throws Exception { // log.debug(() -> "\n" + Hex.toHexStringASCII(buf)); DReader rd = new DReader(buf); try { // TODO perhaps add constructors that take arrays of (keys,refs/values) int sz = rd.readInt8(); if(sz >= 0) { // leaf node DBLeafNode n = new DBLeafNode(store); readKeys(rd, sz, n); readValues(store, rd, n); return n; } else { // internal node DBInternalNode n = new DBInternalNode(store); sz = -sz; readKeys(rd, sz, n); readNodeRefs(store, rd, n); return n; } } finally { CKit.close(rd); } } private static void writeKeys(DWriter wr, int sz, BPlusTreeNode<SKey,DataHolder> n) throws Exception { for(int i=0; i<sz; i++) { SKey k = n.keyAt(i); String s = k.toString(); wr.writeString(s); } } private static void readKeys(DReader rd, int sz, BPlusTreeNode<SKey,DataHolder> n) throws Exception { for(int i=0; i<sz; i++) { String s = rd.readString(); SKey key = new SKey(s); n.addKey(key); } } private static void writeValues(IStore store, DWriter wr, DBLeafNode n) throws Exception { int sz = n.getValueCount(); wr.writeUInt8(sz); for(int i=0; i<sz; i++) { DataHolder d = n.valueAt(i); writeDataHolder(store, d, wr); } } private static void readValues(IStore store, DReader rd, DBLeafNode n) throws Exception { int sz = rd.readUInt8(); for(int i=0; i<sz; i++) { DataHolder d = readDataHolder(store, rd); n.addValue(d); } } private static <R extends IRef> void writeNodeRefs(IStore<R> store, DWriter wr, DBInternalNode n) throws Exception { int sz = n.getChildCount(); wr.writeUInt8(sz); for(int i=0; i<sz; i++) { // data holder type = REF wr.writeUInt8(REF_MARKER); NodeHolder<R> h = n.nodeHolderAt(i); if(h.isModified()) { // store node first R ref = store(store, h.getNode()); store.writeRef(ref, wr); } else { // store ref R ref = h.getRef(); store.writeRef(ref, wr); } } } private static void readNodeRefs(IStore store, DReader rd, DBInternalNode n) throws Exception { int sz = rd.readUInt8(); for(int i=0; i<sz; i++) { DataHolder d = readDataHolder(store, rd); n.addChild(d); } } private static <R extends IRef> void writeDataHolder(IStore<R> store, DataHolder<R> d, DWriter wr) throws Exception { if(d.isRef()) { wr.writeUInt8(REF_MARKER); store.writeRef(d.getRef(), wr); } else { byte[] b = d.getBytes(); int len = b.length; if(len > MAX_INLINE_SIZE) { throw new Error("too long: " + len); } wr.writeUInt8(len); wr.write(b); } } private static <R extends IRef> DataHolder<R> readDataHolder(IStore<R> store, DReader rd) throws Exception { int sz = rd.readUInt8(); if(sz == REF_MARKER) { R ref = store.readRef(rd); return new DataHolder.RefHolder(store, ref); } else { // inline value byte[] b = rd.readFully(sz); return new DataHolder.ValueHolder(store, b); } } }
3e1689be64b0eadc5f6975a49f7563ed9af429db
1,564
java
Java
app/src/main/java/ru/alekssey7227/lifetime/backend/Time.java
D1scoDancer/Lifetime
386f2f62e26c1b16b53b21c886ee6ee6149ee332
[ "Apache-2.0" ]
null
null
null
app/src/main/java/ru/alekssey7227/lifetime/backend/Time.java
D1scoDancer/Lifetime
386f2f62e26c1b16b53b21c886ee6ee6149ee332
[ "Apache-2.0" ]
1
2021-05-20T11:59:02.000Z
2021-05-21T16:52:22.000Z
app/src/main/java/ru/alekssey7227/lifetime/backend/Time.java
D1scoDancer/Lifetime
386f2f62e26c1b16b53b21c886ee6ee6149ee332
[ "Apache-2.0" ]
null
null
null
24.825397
136
0.686061
9,603
package ru.alekssey7227.lifetime.backend; import androidx.annotation.NonNull; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; import ru.alekssey7227.lifetime.R; import ru.alekssey7227.lifetime.activities.MainActivity; //TODO: getProperTime() - класс сам определяет в каком формате вернуть время public class Time { private static final DecimalFormat decimalFormat; private long minutes; static { DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault()); symbols.setDecimalSeparator('.'); decimalFormat = new DecimalFormat("0.##", symbols); } public Time(long minutes) { this.minutes = minutes; } public long getTimeInMinutes() { return minutes; } public void setTimeInMinutes(long minutes) { this.minutes = minutes; } public double getTimeInHours() { return minutes / 60.0; } public void setTimeInHours(double hours) { this.minutes = (long) (hours * 60); } public String getTimeInMinutesString() { return decimalFormat.format(minutes); } public String getTimeInHoursString() { return decimalFormat.format(getTimeInHours()); } public String getTimeInHoursStringFormatted() { return decimalFormat.format(getTimeInHours()) + " " + MainActivity.getInstance().getResources().getString(R.string.time_format); } @NonNull @Override public String toString() { return getTimeInMinutesString(); } }
3e1689c069f35829a2c944e4821c223a604aab5b
3,870
java
Java
src/main/java/tv/twitch/moonmoon/rpengine2/model/attribute/Attribute.java
windy1/RPEngine2
e5ef28ae9e43403751de5a7ead7edb40b1d36727
[ "MIT" ]
1
2020-11-27T19:56:53.000Z
2020-11-27T19:56:53.000Z
src/main/java/tv/twitch/moonmoon/rpengine2/model/attribute/Attribute.java
windy1/RPEngine2
e5ef28ae9e43403751de5a7ead7edb40b1d36727
[ "MIT" ]
1
2021-01-31T19:15:40.000Z
2021-01-31T19:15:40.000Z
src/main/java/tv/twitch/moonmoon/rpengine2/model/attribute/Attribute.java
windy1/RPEngine2
e5ef28ae9e43403751de5a7ead7edb40b1d36727
[ "MIT" ]
2
2021-03-16T19:15:02.000Z
2021-07-30T08:17:43.000Z
24.037267
87
0.582946
9,604
package tv.twitch.moonmoon.rpengine2.model.attribute; import tv.twitch.moonmoon.rpengine2.model.Model; import java.time.Instant; import java.util.Objects; import java.util.Optional; /** * An attribute is a key-value pair that describes something about a * {@link tv.twitch.moonmoon.rpengine2.model.player.RpPlayer}. Values may be one of the * {@link AttributeType}s. */ public class Attribute implements Model { private final int id; private final Instant created; private final String name; private final String display; private final AttributeType type; private final Object defaultValue; private final String formatString; private final boolean identity; private final boolean marker; private final boolean title; public Attribute( int id, Instant created, String name, String display, AttributeType type, Object defaultValue, String formatString, boolean identity, boolean marker, boolean title ) { this.id = id; this.created = Objects.requireNonNull(created); this.name = Objects.requireNonNull(name); this.display = Objects.requireNonNull(display); this.type = Objects.requireNonNull(type); this.defaultValue = defaultValue; this.formatString = formatString; this.identity = identity; this.marker = marker; this.title = title; } @Override public int getId() { return id; } @Override public Instant getCreated() { return created; } /** * Returns this Attribute's unique name * * @return Attribute name */ public String getName() { return name; } /** * Returns this Attributes display name * * @return Display name */ public String getDisplay() { return display; } /** * Returns this attributes {@link AttributeType} * * @return Attribute type */ public AttributeType getType() { return type; } /** * Returns the default value for this attribute or empty if none * * @return Default value */ public Optional<Object> getDefaultValue() { return Optional.ofNullable(defaultValue); } /** * Returns the format string for this attribute or empty if none * * @return Format string */ public Optional<String> getFormatString() { return Optional.ofNullable(formatString); } /** * Returns true if this is the identity attribute * * @return True if identity attribute */ public boolean isIdentity() { return identity; } /** * Returns true if this is the marker attribute * * @return true if marker attribute */ public boolean isMarker() { return marker; } /** * Returns true if this is the title attribute * * @return True if title attribute */ public boolean isTitle() { return title; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Attribute attribute = (Attribute) o; return Objects.equals(name, attribute.name); } @Override public int hashCode() { return Objects.hash(name); } @Override public String toString() { return "Attribute{" + "id=" + id + ", created=" + created + ", name='" + name + '\'' + ", display='" + display + '\'' + ", type=" + type + ", defaultValue=" + defaultValue + ", formatString='" + formatString + '\'' + ", identity=" + identity + ", marker=" + marker + '}'; } }
3e1689d225c5f5342d03545ced06356d125a33c0
249
java
Java
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/exceptions/ContentFetchException.java
ntanh1402/crawler4j
0265a0354a5134fed9e5c2731e500191efe668f0
[ "Apache-2.0" ]
null
null
null
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/exceptions/ContentFetchException.java
ntanh1402/crawler4j
0265a0354a5134fed9e5c2731e500191efe668f0
[ "Apache-2.0" ]
null
null
null
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/exceptions/ContentFetchException.java
ntanh1402/crawler4j
0265a0354a5134fed9e5c2731e500191efe668f0
[ "Apache-2.0" ]
null
null
null
27.666667
92
0.751004
9,605
package edu.uci.ics.crawler4j.crawler.exceptions; /** * Created by Avi Hayun on 12/8/2014. * * <p>Thrown when there is a problem with the content fetching - this is a tagging exception */ public class ContentFetchException extends Exception {}
3e168a1fecbe978d1f5b6f8bd5b80aea65120b8d
682
java
Java
security/src/main/java/com/imran/security/SecurityApplication.java
shaikh-imran1/InDepthRestAPI
138a0529a8c50d5f685d637fa83c46da9f9c690d
[ "Apache-2.0" ]
null
null
null
security/src/main/java/com/imran/security/SecurityApplication.java
shaikh-imran1/InDepthRestAPI
138a0529a8c50d5f685d637fa83c46da9f9c690d
[ "Apache-2.0" ]
null
null
null
security/src/main/java/com/imran/security/SecurityApplication.java
shaikh-imran1/InDepthRestAPI
138a0529a8c50d5f685d637fa83c46da9f9c690d
[ "Apache-2.0" ]
1
2020-11-02T09:41:33.000Z
2020-11-02T09:41:33.000Z
32.47619
81
0.841642
9,606
package com.imran.security; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @SpringBootApplication public class SecurityApplication { public static void main(String[] args) { SpringApplication.run(SecurityApplication.class, args); } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } }
3e168b1727f3b7b7b45e89ecb86935f2866b21d8
2,796
java
Java
aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/DescribeConversionTasksRequestMarshaller.java
jplippi/aws-sdk-java
147eefec220e2944dc571283af6552611bc94301
[ "Apache-2.0" ]
1
2020-08-27T17:36:34.000Z
2020-08-27T17:36:34.000Z
aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/DescribeConversionTasksRequestMarshaller.java
jplippi/aws-sdk-java
147eefec220e2944dc571283af6552611bc94301
[ "Apache-2.0" ]
3
2020-04-15T20:08:15.000Z
2021-06-30T19:58:16.000Z
aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/DescribeConversionTasksRequestMarshaller.java
jplippi/aws-sdk-java
147eefec220e2944dc571283af6552611bc94301
[ "Apache-2.0" ]
1
2020-10-10T15:59:17.000Z
2020-10-10T15:59:17.000Z
45.836066
188
0.753219
9,607
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.ec2.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.ec2.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.StringUtils; /** * DescribeConversionTasksRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DescribeConversionTasksRequestMarshaller implements Marshaller<Request<DescribeConversionTasksRequest>, DescribeConversionTasksRequest> { public Request<DescribeConversionTasksRequest> marshall(DescribeConversionTasksRequest describeConversionTasksRequest) { if (describeConversionTasksRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<DescribeConversionTasksRequest> request = new DefaultRequest<DescribeConversionTasksRequest>(describeConversionTasksRequest, "AmazonEC2"); request.addParameter("Action", "DescribeConversionTasks"); request.addParameter("Version", "2016-11-15"); request.setHttpMethod(HttpMethodName.POST); com.amazonaws.internal.SdkInternalList<String> describeConversionTasksRequestConversionTaskIdsList = (com.amazonaws.internal.SdkInternalList<String>) describeConversionTasksRequest .getConversionTaskIds(); if (!describeConversionTasksRequestConversionTaskIdsList.isEmpty() || !describeConversionTasksRequestConversionTaskIdsList.isAutoConstruct()) { int conversionTaskIdsListIndex = 1; for (String describeConversionTasksRequestConversionTaskIdsListValue : describeConversionTasksRequestConversionTaskIdsList) { if (describeConversionTasksRequestConversionTaskIdsListValue != null) { request.addParameter("ConversionTaskId." + conversionTaskIdsListIndex, StringUtils.fromString(describeConversionTasksRequestConversionTaskIdsListValue)); } conversionTaskIdsListIndex++; } } return request; } }
3e168b2b7ca093460a4ba2e2d26e5030151c2da5
1,561
java
Java
ElasticUtils/elasticutils-elasticsearch6/src/main/java/de/bytefish/elasticutils/elasticsearch6/client/bulk/listener/LoggingBulkProcessorListener.java
softWindXxx/ElasticUtils
82ef5460571c29aa544f6994516ef6d21130cafc
[ "MIT" ]
34
2016-11-22T06:44:42.000Z
2022-03-23T06:15:45.000Z
ElasticUtils/elasticutils-elasticsearch6/src/main/java/de/bytefish/elasticutils/elasticsearch6/client/bulk/listener/LoggingBulkProcessorListener.java
softWindXxx/ElasticUtils
82ef5460571c29aa544f6994516ef6d21130cafc
[ "MIT" ]
10
2021-03-18T19:45:30.000Z
2021-03-19T13:21:16.000Z
ElasticUtils/elasticutils-elasticsearch6/src/main/java/de/bytefish/elasticutils/elasticsearch6/client/bulk/listener/LoggingBulkProcessorListener.java
softWindXxx/ElasticUtils
82ef5460571c29aa544f6994516ef6d21130cafc
[ "MIT" ]
23
2016-11-04T14:42:48.000Z
2020-10-26T06:46:40.000Z
39.025
149
0.719411
9,608
// Copyright (c) Philipp Wagner. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. package de.bytefish.elasticutils.elasticsearch6.client.bulk.listener; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.bulk.BulkProcessor; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.common.logging.Loggers; public class LoggingBulkProcessorListener implements BulkProcessor.Listener { private static final Logger log = Loggers.getLogger(LoggingBulkProcessorListener.class, LoggingBulkProcessorListener.class.getName()); public LoggingBulkProcessorListener() { } @Override public void beforeBulk(long executionId, BulkRequest request) { if(log.isDebugEnabled()) { log.debug("ExecutionId = {}, Actions = {}, Estimated Size = {}", executionId, request.numberOfActions(), request.estimatedSizeInBytes()); } } @Override public void afterBulk(long executionId, BulkRequest request, BulkResponse response) { if(log.isDebugEnabled()) { log.debug("ExecutionId = {}, Actions = {}, Estimated Size = {}", executionId, request.numberOfActions(), request.estimatedSizeInBytes()); } } @Override public void afterBulk(long executionId, BulkRequest request, Throwable failure) { if(log.isErrorEnabled()) { log.error("ExecutionId = {}, Error = {}", executionId, failure); } } }
3e168bd7cca67a53f309e2d8997af4bd8cfa683d
1,160
java
Java
marklogic-client-api/src/main/java/com/marklogic/client/type/PlanSearchOptions.java
andreas-felix/java-client-api
c6544ce9220ea12c534ac09df9795d64cadae529
[ "Apache-2.0" ]
46
2015-05-06T19:30:30.000Z
2021-09-30T20:50:35.000Z
marklogic-client-api/src/main/java/com/marklogic/client/type/PlanSearchOptions.java
andreas-felix/java-client-api
c6544ce9220ea12c534ac09df9795d64cadae529
[ "Apache-2.0" ]
1,075
2015-01-02T05:33:02.000Z
2022-03-15T15:48:17.000Z
marklogic-client-api/src/main/java/com/marklogic/client/type/PlanSearchOptions.java
andreas-felix/java-client-api
c6544ce9220ea12c534ac09df9795d64cadae529
[ "Apache-2.0" ]
77
2015-05-07T17:37:52.000Z
2022-03-14T07:10:32.000Z
34.117647
75
0.747414
9,609
/* * Copyright (c) 2019 MarkLogic 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 com.marklogic.client.type; // IMPORTANT: Do not edit. This file is generated. /** * An option controlling the scoring and weighting of fromSearch() * for a row pipeline. */ public interface PlanSearchOptions { XsDoubleVal getQualityWeight(); ScoreMethod getScoreMethod(); PlanSearchOptions withQualityWeight(double qualityWeight); PlanSearchOptions withQualityWeight(XsDoubleVal qualityWeight); PlanSearchOptions withScoreMethod(ScoreMethod scoreMethod); enum ScoreMethod { LOGTFIDF, LOGTF, SIMPLE; } }
3e168bef08cb788fbd9da12e2dacc3b0c9420b36
4,188
java
Java
lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java
tommyettinger/gdx-lml
1a3586df66cea44dab63e203927299fa344e5659
[ "Apache-2.0" ]
174
2015-03-29T18:42:16.000Z
2021-12-04T18:23:10.000Z
lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java
tommyettinger/gdx-lml
1a3586df66cea44dab63e203927299fa344e5659
[ "Apache-2.0" ]
96
2015-10-23T17:03:49.000Z
2020-12-08T01:21:37.000Z
lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java
tommyettinger/gdx-lml
1a3586df66cea44dab63e203927299fa344e5659
[ "Apache-2.0" ]
46
2015-10-23T16:41:27.000Z
2021-09-06T14:50:38.000Z
42.734694
120
0.677889
9,610
package com.github.czyzby.lml.vis.util; import com.github.czyzby.kiwi.util.common.Strings; import com.github.czyzby.kiwi.util.gdx.asset.Disposables; import com.kotcrab.vis.ui.widget.color.ColorPicker; /** Manages a single {@link ColorPicker} instance. Since color picker is a heavy widget that should be reused, this * class aims to force use of a single picker in LML. Unless you want to use color picker with the default settings, you * might want to call {@link #setInstance(ColorPicker)} or {@link #initiateInstance(String, String)} before parsing LML * templates to fully customize the widget. If you have ever used the color picker with LML attributes (or manually, * with this container's methods), remember to call {@link #dispose()} when you no longer need the widget. * * @author MJ */ public class ColorPickerContainer { private static ColorPicker INSTANCE; /** Static utility, do not initiate. */ private ColorPickerContainer() { } /** @return direct reference to the managed {@link ColorPicker}. Might be null or disposed. * @see #requestInstance() */ public static ColorPicker getInstance() { return INSTANCE; } /** @return an instance of {@link ColorPicker} managed by this class. Never null, although might be already * disposed. * @see #getInstance() */ public static ColorPicker requestInstance() { if (INSTANCE == null) { initiateInstance(); } return INSTANCE; } /** Disposes of current instance (if present) and creates a new default instance. */ public static void reloadInstance() { dispose(); initiateInstance(); } /** Disposes of current instance (if present) and creates a new instance. * * @param title will become window's title. * @param styleName determines the style of {@link ColorPicker}. */ public static void reloadInstance(final String title, final String styleName) { dispose(); initiateInstance(title, styleName); } /** Creates an instance of {@link ColorPicker} which will be accessible through {@link #getInstance()} and * {@link #requestInstance()} methods. */ public static void initiateInstance() { INSTANCE = new ColorPicker(Strings.EMPTY_STRING); } /** Creates an instance of {@link ColorPicker} which will be accessible through {@link #getInstance()} and * {@link #requestInstance()} methods. * * @param title will become window's title. * @param styleName determines the style of {@link ColorPicker}. */ public static void initiateInstance(final String title, final String styleName) { INSTANCE = new ColorPicker(styleName, title, null); } /** Changes currently managed {@link ColorPicker} instance. Note that previous instance - if it exists - has to be * manually disposed of, so if you want to replace another color picker with a new one, make sure to properly * destroy it before calling this method. * * @param colorPicker will become managed {@link ColorPicker} instance. * @see #initiateInstance() * @see #initiateInstance(String, String) * @see #reloadInstance() * @see #reloadInstance(String, String) */ public static void setInstance(final ColorPicker colorPicker) { INSTANCE = colorPicker; } /** @return true if current {@link ColorPicker} instance is {@code null} or already disposed. If this method returns * true, current picker returned by {@link #getInstance()} cannot be used and one of initiation methods * should be invoked. * @see #initiateInstance() * @see #initiateInstance(String, String) * @see #setInstance(ColorPicker) */ public static boolean isDisposed() { return INSTANCE == null || INSTANCE.isDisposed(); } /** Disposes of managed {@link ColorPicker} instance (if present and not disposed yet). Null-safe, should never * throw an exception - unless the disposition method itself throws one. */ public static void dispose() { if (!isDisposed()) { Disposables.disposeOf(INSTANCE); } } }
3e168d05655c01a8e9f289467219d5b602ddea0c
1,174
java
Java
src/main/java/com/mattworzala/resource/registry/Registry.java
mworzala/resource
d350d0df1915fb2944a6665d5cc2d5584480b5f8
[ "MIT" ]
null
null
null
src/main/java/com/mattworzala/resource/registry/Registry.java
mworzala/resource
d350d0df1915fb2944a6665d5cc2d5584480b5f8
[ "MIT" ]
null
null
null
src/main/java/com/mattworzala/resource/registry/Registry.java
mworzala/resource
d350d0df1915fb2944a6665d5cc2d5584480b5f8
[ "MIT" ]
null
null
null
30.894737
123
0.70017
9,611
package com.mattworzala.resource.registry; import com.mattworzala.resource.Identifier; import com.mattworzala.resource.Resource; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; public interface Registry<R extends Resource> { @Nullable static <R extends Resource> R get(@NotNull Registry<R> registry, @NotNull Identifier id) { return registry.get(id); } @Nullable static <R extends Resource> R get(@NotNull Registry<R> registry, @NotNull String namespacedId) { return registry.get(namespacedId); } static <R extends Resource> void register(@NotNull Registry<R> registry, @NotNull Identifier id, @NotNull R resource) { if (!(registry instanceof MutableRegistry)) throw new IllegalArgumentException("Cannot register " + id + " to immutable registry!"); ((MutableRegistry<R>) registry).register(id, resource); } /* ------ */ @Nullable default R get(@NotNull String namespacedId) { return get(Identifier.of(namespacedId)); } @Nullable R get(@NotNull Identifier id); @NotNull Stream<R> stream(); }
3e168d130a84f2c1a6b14c4f21295bc1a0854fcb
4,351
java
Java
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/EditMavenArtifactDialog.java
btos0207/dbaever
0573b0cc8ae8c9b9672fd6202581addb9643ec63
[ "Apache-2.0" ]
null
null
null
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/EditMavenArtifactDialog.java
btos0207/dbaever
0573b0cc8ae8c9b9672fd6202581addb9643ec63
[ "Apache-2.0" ]
null
null
null
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/EditMavenArtifactDialog.java
btos0207/dbaever
0573b0cc8ae8c9b9672fd6202581addb9643ec63
[ "Apache-2.0" ]
1
2020-11-04T04:52:36.000Z
2020-11-04T04:52:36.000Z
35.414634
144
0.677686
9,612
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2017 Serge Rider (hzdkv@example.com) * Copyright (C) 2011-2012 Eugene Fradkin (efpyi@example.com) * * 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.dialogs.driver; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; import org.jkiss.dbeaver.registry.maven.MavenArtifactReference; import org.jkiss.dbeaver.ui.UIUtils; import org.jkiss.utils.CommonUtils; /** * EditMavenArtifactDialog */ class EditMavenArtifactDialog extends Dialog { private MavenArtifactReference artifact; private Text groupText; private Text artifactText; private Text classifierText; private Combo versionText; public EditMavenArtifactDialog(Shell shell, MavenArtifactReference artifact) { super(shell); this.artifact = artifact == null ? new MavenArtifactReference("", "", null, MavenArtifactReference.VERSION_PATTERN_RELEASE) : artifact; } public MavenArtifactReference getArtifact() { return artifact; } @Override protected boolean isResizable() { return true; } @Override protected Control createDialogArea(Composite parent) { getShell().setText("Edit Maven Artifact"); Composite composite = (Composite) super.createDialogArea(parent); ((GridLayout)composite.getLayout()).numColumns = 2; GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 200; groupText = UIUtils.createLabelText(composite, "Group Id", artifact.getGroupId()); groupText.setLayoutData(gd); artifactText = UIUtils.createLabelText(composite, "Artifact Id", artifact.getArtifactId()); artifactText.setLayoutData(gd); classifierText = UIUtils.createLabelText(composite, "Classifier", CommonUtils.notEmpty(artifact.getClassifier())); classifierText.setLayoutData(gd); versionText = UIUtils.createLabelCombo(composite, "Version", SWT.DROP_DOWN | SWT.BORDER); versionText.setLayoutData(gd); versionText.setText(artifact.getVersion()); versionText.add(MavenArtifactReference.VERSION_PATTERN_RELEASE); versionText.add(MavenArtifactReference.VERSION_PATTERN_LATEST); ModifyListener ml = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { updateButtons(); } }; groupText.addModifyListener(ml); artifactText.addModifyListener(ml); classifierText.addModifyListener(ml); versionText.addModifyListener(ml); return composite; } @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); updateButtons(); } private void updateButtons() { getButton(IDialogConstants.OK_ID).setEnabled( !CommonUtils.isEmpty(groupText.getText()) && !CommonUtils.isEmpty(artifactText.getText()) && !CommonUtils.isEmpty(versionText.getText()) ); } @Override protected void okPressed() { String classifier = classifierText.getText(); artifact = new MavenArtifactReference( groupText.getText(), artifactText.getText(), CommonUtils.isEmpty(classifier) ? null : classifier, versionText.getText()); super.okPressed(); } }
3e168d5bd04473a8edac90e2c5c263ecc1406081
3,014
java
Java
jOOQ/src/main/java/org/jooq/ExecuteListenerProvider.java
Vertabelo/jOOQ
e65f62d833286ea0689748e3be47dabe94a9f511
[ "Apache-2.0" ]
1
2015-01-19T00:51:30.000Z
2015-01-19T00:51:30.000Z
jOOQ/src/main/java/org/jooq/ExecuteListenerProvider.java
Vertabelo/jOOQ
e65f62d833286ea0689748e3be47dabe94a9f511
[ "Apache-2.0" ]
null
null
null
jOOQ/src/main/java/org/jooq/ExecuteListenerProvider.java
Vertabelo/jOOQ
e65f62d833286ea0689748e3be47dabe94a9f511
[ "Apache-2.0" ]
null
null
null
39.142857
80
0.66722
9,613
/** * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) * All rights reserved. * * This work is dual-licensed * - under the Apache Software License 2.0 (the "ASL") * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") * ============================================================================= * You may choose which license applies to you: * * - If you're using this work with Open Source databases, you may choose * either ASL or jOOQ License. * - If you're using this work with at least one commercial database, you must * choose jOOQ License * * For more information, please visit http://www.jooq.org/licenses * * Apache Software License 2.0: * ----------------------------------------------------------------------------- * 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. * * jOOQ License and Maintenance Agreement: * ----------------------------------------------------------------------------- * Data Geekery grants the Customer the non-exclusive, timely limited and * non-transferable license to install and use the Software under the terms of * the jOOQ License and Maintenance Agreement. * * This library is distributed with a LIMITED WARRANTY. See the jOOQ License * and Maintenance Agreement for more details: http://www.jooq.org/licensing */ package org.jooq; import org.jooq.impl.DefaultExecuteListenerProvider; /** * A provider for {@link ExecuteListener} instances. * <p> * In order to facilitate the lifecycle management of * <code>ExecuteListener</code> instances that are provided to a jOOQ * {@link Configuration}, clients can implement this API. To jOOQ, it is thus * irrelevant, if execute listeners are stateful or stateless, local to an * execution, or global to an application. * * @author Lukas Eder * @see ExecuteListener * @see Configuration */ public interface ExecuteListenerProvider { /** * Provide an <code>ExecuteListener</code> instance. * <p> * Implementations are free to choose whether this method returns new * instances at every call or whether the same instance is returned * repetitively. * <p> * An <code>ExecuteListener</code> shall be provided exactly once per query * execution lifecycle, i.e. per <code>ExecuteContext</code>. * * @return An <code>ExecuteListener</code> instance. * @see ExecuteListener * @see ExecuteContext * @see DefaultExecuteListenerProvider */ ExecuteListener provide(); }
3e168df2d1219eda855750a3b967dde5dd8a13ad
456
java
Java
IceSoapTest/src/test/java/com/alexgilleran/icesoap/parser/test/xmlclasses/PipeTestInner.java
AlexGilleran/icesoap
370f3a52be9dc7bd619aa751aedceb2a5703a072
[ "Apache-2.0" ]
84
2015-02-13T23:41:48.000Z
2022-03-10T14:17:26.000Z
IceSoapTest/src/test/java/com/alexgilleran/icesoap/parser/test/xmlclasses/PipeTestInner.java
AlexGilleran/icesoap
370f3a52be9dc7bd619aa751aedceb2a5703a072
[ "Apache-2.0" ]
19
2015-10-27T09:22:52.000Z
2022-03-09T09:22:53.000Z
IceSoapTest/src/test/java/com/alexgilleran/icesoap/parser/test/xmlclasses/PipeTestInner.java
AlexGilleran/icesoap
370f3a52be9dc7bd619aa751aedceb2a5703a072
[ "Apache-2.0" ]
18
2015-04-02T11:38:14.000Z
2019-11-08T13:03:42.000Z
17.538462
56
0.730263
9,614
/** * */ package com.alexgilleran.icesoap.parser.test.xmlclasses; import com.alexgilleran.icesoap.annotation.XMLField; /** * @author Alex Gilleran * */ public class PipeTestInner { @XMLField("InnerValue1 | //InnerValue11") private String innerValue1; @XMLField("InnerValue2 | //InnerValue22") private String innerValue2; public String getInnerValue1() { return innerValue1; } public String getInnerValue2() { return innerValue2; } }
3e168e016f0acee784d9db5fd333e78e1f7703e6
1,655
java
Java
src/main/java/com/liangxiaoqiao/leetcode/day/medium/NAryTreeLevelOrderTraversal.java
liangxiaoqiao/LeetCodeDay
42d7a3fc86fd24c259c0bfc041a49bab3dcdd773
[ "Apache-2.0" ]
null
null
null
src/main/java/com/liangxiaoqiao/leetcode/day/medium/NAryTreeLevelOrderTraversal.java
liangxiaoqiao/LeetCodeDay
42d7a3fc86fd24c259c0bfc041a49bab3dcdd773
[ "Apache-2.0" ]
null
null
null
src/main/java/com/liangxiaoqiao/leetcode/day/medium/NAryTreeLevelOrderTraversal.java
liangxiaoqiao/LeetCodeDay
42d7a3fc86fd24c259c0bfc041a49bab3dcdd773
[ "Apache-2.0" ]
null
null
null
23.985507
347
0.595166
9,615
package com.liangxiaoqiao.leetcode.day.medium; import java.util.List; /* * English * id: 429 * title: N-ary Tree Level Order Traversal * href: https://leetcode.com/problems/n-ary-tree-level-order-traversal * desc: Given an n-ary tree, return the level order traversal of its nodes\' values. (ie, from left to right, level by level).\nFor example, given a 3-ary tree:\n We should return its level order traversal:\n[\n [1],\n [3,2,4],\n [5,6]\n]\n Note:\nThe depth of the tree is at most 1000.\nThe total number of nodes is at most 5000. * <p> * 中文 * 序号: 429 * 标题: N叉树的层序遍历 * 链接: https://leetcode-cn.com/problems/n-ary-tree-level-order-traversal * 描述: 给定一个 N 叉树,返回其节点值的层序遍历。 (即从左到右,逐层遍历)。\n例如,给定一个 3叉树 :\n 返回其层序遍历:\n[\n [1],\n [3,2,4],\n [5,6]\n]\n 说明:\n树的深度不会超过 1000。\n树的节点总数不会超过 5000。 * <p> * acceptance: 61.7% * difficulty: Medium * private: False */ //TODO init /* /* // Definition for a Node. class Node { public int val; public List<Node> children; public Node() {} public Node(int _val) { val = _val; } public Node(int _val, List<Node> _children) { val = _val; children = _children; } }; */ public class NAryTreeLevelOrderTraversal { public List<List<Integer>> levelOrder(Node root) { return null; } private class Node { public int val; public List<Node> children; public Node() { } public Node(int _val) { val = _val; } public Node(int _val, List<Node> _children) { val = _val; children = _children; } } }
3e168e729d21584e84f6fd6771873f3daad4155e
1,834
java
Java
rest-sample/src/test/java/ru/stqa/pft/rest/RestTests.java
stambolsky/java_pft
b8699b458e15a7d7e6c1885d4ab348db5035c74c
[ "Apache-2.0" ]
null
null
null
rest-sample/src/test/java/ru/stqa/pft/rest/RestTests.java
stambolsky/java_pft
b8699b458e15a7d7e6c1885d4ab348db5035c74c
[ "Apache-2.0" ]
null
null
null
rest-sample/src/test/java/ru/stqa/pft/rest/RestTests.java
stambolsky/java_pft
b8699b458e15a7d7e6c1885d4ab348db5035c74c
[ "Apache-2.0" ]
null
null
null
39.869565
135
0.695747
9,616
package ru.stqa.pft.rest; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; import org.apache.http.client.fluent.Request; import org.apache.http.message.BasicNameValuePair; import org.testng.annotations.Test; import java.io.IOException; import java.util.Set; import static org.testng.AssertJUnit.assertEquals; public class RestTests extends TestBase { @Test public void testCreateIssue() throws IOException { skipIfNotFixed(339); Set<Issue> oldIssues = getIssues(); Issue newIssue = new Issue().withSubject("Test issue SergeyTambolski").withDescription("New test issue"); int issueId = createIssue(newIssue); Set<Issue> newIssues = getIssues(); oldIssues.add(newIssue.withId(issueId)); assertEquals(newIssues, oldIssues); } private Set<Issue> getIssues() throws IOException { String json = getExecutor().execute(Request.Get("http://bugify.stqa.ru/api/issues.json?limit=500")).returnContent().asString(); JsonElement parsed = new JsonParser().parse(json); JsonElement issues = parsed.getAsJsonObject().get("issues"); return new Gson().fromJson(issues, new TypeToken<Set<Issue>>(){}.getType()); } private int createIssue(Issue newIssue) throws IOException { String json = getExecutor().execute(Request.Post("http://bugify.stqa.ru/api/issues.json?limit=500") .bodyForm(new BasicNameValuePair("subject", newIssue.getSubject()), new BasicNameValuePair("description", newIssue.getDescription()))) .returnContent().asString(); JsonElement parsed = new JsonParser().parse(json); return parsed.getAsJsonObject().get("issue_id").getAsInt(); } }
3e168f000e6c2dcddbd009cac94bf3902e8707a9
821
java
Java
LeetCode/src/test/java/org/redquark/onlinejudges/leetcode/array/SearchA2DMatrixTest.java
ani03sha/OnlineJudge
e39e0e4da4e039c12ce7645aceecec0a84ecbebd
[ "Apache-2.0" ]
18
2021-05-24T03:37:33.000Z
2022-03-14T10:44:52.000Z
LeetCode/src/test/java/org/redquark/onlinejudges/leetcode/array/SearchA2DMatrixTest.java
ani03sha/OnlineJudge
e39e0e4da4e039c12ce7645aceecec0a84ecbebd
[ "Apache-2.0" ]
null
null
null
LeetCode/src/test/java/org/redquark/onlinejudges/leetcode/array/SearchA2DMatrixTest.java
ani03sha/OnlineJudge
e39e0e4da4e039c12ce7645aceecec0a84ecbebd
[ "Apache-2.0" ]
4
2022-01-07T15:51:32.000Z
2022-02-15T15:38:54.000Z
27.366667
69
0.56151
9,617
package org.redquark.onlinejudges.leetcode.array; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; public class SearchA2DMatrixTest { private final SearchA2DMatrix testObject = new SearchA2DMatrix(); @Test public void testSearchMatrix() { int[][] matrix = new int[][]{ {1, 3, 5, 7}, {10, 11, 16, 20}, {23, 30, 34, 60} }; int target = 3; assertTrue(testObject.searchMatrix(matrix, target)); matrix = new int[][]{ {1, 3, 5, 7}, {10, 11, 16, 20}, {23, 30, 34, 60} }; target = 13; assertFalse(testObject.searchMatrix(matrix, target)); } }
3e168f1de93b6a0094f03d9358a3002bcf250a10
644
java
Java
src/main/java/extend/MyDouble.java
cybzzz/Jisp
74bf194089d93838ef434ae99aa4686426331b4a
[ "MIT" ]
null
null
null
src/main/java/extend/MyDouble.java
cybzzz/Jisp
74bf194089d93838ef434ae99aa4686426331b4a
[ "MIT" ]
null
null
null
src/main/java/extend/MyDouble.java
cybzzz/Jisp
74bf194089d93838ef434ae99aa4686426331b4a
[ "MIT" ]
null
null
null
17.405405
49
0.543478
9,618
package extend; import java.util.Objects; public final class MyDouble extends Atom { public Double num; public MyDouble() { } public MyDouble(double num) { this.num = num; } @Override public String toString() { return num.toString(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MyDouble myDouble)) { return false; } return Objects.equals(num, myDouble.num); } @Override public int hashCode() { return num != null ? num.hashCode() : 0; } }
3e168f29d35830f2e90ccfb5a4e7ee2a8135c6db
8,371
java
Java
FeedbackRest/src/main/java/com/feedback/rest/controller/FeedbackRestController.java
smadanu-git/FeedbackWebApp
f42bef57ad5567f2cafe37db01a7c6cfb628ba60
[ "MIT" ]
null
null
null
FeedbackRest/src/main/java/com/feedback/rest/controller/FeedbackRestController.java
smadanu-git/FeedbackWebApp
f42bef57ad5567f2cafe37db01a7c6cfb628ba60
[ "MIT" ]
null
null
null
FeedbackRest/src/main/java/com/feedback/rest/controller/FeedbackRestController.java
smadanu-git/FeedbackWebApp
f42bef57ad5567f2cafe37db01a7c6cfb628ba60
[ "MIT" ]
null
null
null
38.75463
116
0.755824
9,619
package com.feedback.rest.controller; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.feedback.dto.DropdownDTO; import com.feedback.dto.EmployeeDTO; import com.feedback.dto.FeedbackDTO; import com.feedback.dto.Response; import com.feedback.security.JwtTokenUtil; import com.feedback.service.FeedbackService; import com.google.gson.JsonObject; @RestController @CrossOrigin @RequestMapping(path = "/api") public class FeedbackRestController { @Autowired private FeedbackService feedbackService; @Autowired private JwtTokenUtil jwtTokenUtil; @PostMapping(path = "/myReviews", produces = "application/json") public ResponseEntity<Response> getMyReviews(HttpServletRequest request) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { String token = jwtTokenUtil.getTokenFromRequest(request); String userName = jwtTokenUtil.getUsernameFromToken(token); List<FeedbackDTO> reviewList = feedbackService.getMyReviews(userName); resp.setCode(HttpStatus.OK.value()); resp.setResponse(reviewList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); ex.printStackTrace(); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/saveReviews", produces = "application/json") public ResponseEntity<Response> saveMyReviews(HttpServletRequest request, @RequestBody FeedbackDTO myReviews) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { String token = jwtTokenUtil.getTokenFromRequest(request); String userName = jwtTokenUtil.getUsernameFromToken(token); List<FeedbackDTO> reviewList = feedbackService.saveReviews(myReviews, userName); resp.setCode(HttpStatus.OK.value()); resp.setResponse(reviewList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/addEmployee", produces = "application/json") public ResponseEntity<Response> addEmployee(HttpServletRequest request, @RequestBody EmployeeDTO employee) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { List<EmployeeDTO> employeeList = feedbackService.addEmployee(employee); resp.setCode(HttpStatus.OK.value()); resp.setResponse(employeeList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/modifyEmployee", produces = "application/json") public ResponseEntity<Response> modifyEmployee(HttpServletRequest request, @RequestBody EmployeeDTO employee) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { List<EmployeeDTO> employeeList = feedbackService.editEmployee(employee); resp.setCode(HttpStatus.OK.value()); resp.setResponse(employeeList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/deleteEmployee", produces = "application/json") public ResponseEntity<Response> deleteEmployee(HttpServletRequest request, @RequestBody EmployeeDTO employee) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { List<EmployeeDTO> employeeList = feedbackService.deleteEmployee(employee); resp.setCode(HttpStatus.OK.value()); resp.setResponse(employeeList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/employees", produces = "application/json") public ResponseEntity<Response> getAllEmployee(HttpServletRequest request, @RequestBody EmployeeDTO employee) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { List<EmployeeDTO> employeeList = feedbackService.getAllEmployees(); resp.setCode(HttpStatus.OK.value()); resp.setResponse(employeeList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/feedbacks", produces = "application/json") public ResponseEntity<Response> getFeedbacksList(HttpServletRequest request, @RequestBody JsonObject obj) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { long revieweeId = obj.get("revieweeId").getAsLong(); List<DropdownDTO> feedbckList = feedbackService.getEmployeeFeedback(revieweeId); resp.setCode(HttpStatus.OK.value()); resp.setResponse(feedbckList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/feedbackParticipants", produces = "application/json") public ResponseEntity<Response> getFeedbackParticipants(HttpServletRequest request, @RequestBody JsonObject obj) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { long feedbackId = obj.get("feedbackId").getAsLong(); List<FeedbackDTO> feedbckList = feedbackService.getFeedbackReviewers(0, feedbackId); resp.setCode(HttpStatus.OK.value()); resp.setResponse(feedbckList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } @PostMapping(path = "/addParticipants", produces = "application/json") public ResponseEntity<Response> addparticipants(HttpServletRequest request, @RequestBody FeedbackDTO feedbackDto) { Response resp = new Response(); ResponseEntity<Response> respEntity = null; try { List<FeedbackDTO> feedbckList = feedbackService.addparticipants(feedbackDto); resp.setCode(HttpStatus.OK.value()); resp.setResponse(feedbckList); respEntity = new ResponseEntity<Response>(resp, HttpStatus.OK); } catch (Exception ex) { resp.setCode(HttpStatus.BAD_REQUEST.value()); List<String> err = new ArrayList<String>(); err.add(ex.getMessage()); resp.setErrors(err); respEntity = new ResponseEntity<Response>(resp, HttpStatus.BAD_REQUEST); } return respEntity; } }
3e168f8112d258eb771d13366828d0d57698109b
3,290
java
Java
src/main/java/io/ballerina/plugins/idea/editor/inserthandlers/BallerinaQuotesInsertHandler.java
ballerina-platform/plugin-intellij
bbeacdde34c3d27a24b1e0a729afe8ebf6fd7ab5
[ "Apache-2.0" ]
7
2020-09-09T12:00:37.000Z
2021-12-17T13:39:40.000Z
src/main/java/io/ballerina/plugins/idea/editor/inserthandlers/BallerinaQuotesInsertHandler.java
ballerina-platform/plugin-intellij
bbeacdde34c3d27a24b1e0a729afe8ebf6fd7ab5
[ "Apache-2.0" ]
34
2020-11-02T06:32:39.000Z
2022-03-11T01:39:06.000Z
src/main/java/io/ballerina/plugins/idea/editor/inserthandlers/BallerinaQuotesInsertHandler.java
ballerina-platform/plugin-intellij
bbeacdde34c3d27a24b1e0a729afe8ebf6fd7ab5
[ "Apache-2.0" ]
3
2020-09-09T12:00:43.000Z
2021-09-07T10:05:28.000Z
42.727273
114
0.694225
9,620
/* * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) 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.ballerina.plugins.idea.editor.inserthandlers; import com.intellij.codeInsight.editorActions.TypedHandlerDelegate; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorModificationUtil; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import io.ballerina.plugins.idea.BallerinaLanguage; import io.ballerina.plugins.idea.psi.BallerinaTypes; import org.jetbrains.annotations.NotNull; /** * Handles auto completion for the closing quotes. */ public class BallerinaQuotesInsertHandler extends TypedHandlerDelegate { @NotNull @Override public Result beforeCharTyped(char c, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull FileType fileType) { if (c != '\"' || !file.getLanguage().is(BallerinaLanguage.INSTANCE)) { return Result.CONTINUE; } // We need to save the file before checking. Otherwise issues can occur when we press enter in a string. PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); // Checks whether the cursor is already placed inside a ballerina string. int caretOff = editor.getCaretModel().getOffset(); if (isInStringLiteral(file, caretOff)) { // If the cursor is already placed inside a string, auto closing shouldn't be triggered. char prevChar = editor.getDocument().getText(new TextRange(caretOff - 1, caretOff)).charAt(0); char nextChar = editor.getDocument().getText(new TextRange(caretOff, caretOff + 1)).charAt(0); if (c == prevChar && c == nextChar) { EditorModificationUtil.moveCaretRelatively(editor, 1); return Result.STOP; } else { return Result.CONTINUE; } } else { // Adds the closing quotes and places the cursor in-between the quotes. EditorModificationUtil.insertStringAtCaret(editor, "\"", false, 0); PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); return Result.CONTINUE; } } private boolean isInStringLiteral(PsiFile file, int offset) { PsiElement element = file.findElementAt(offset); if (element == null) { return false; } return element.getNode().getElementType() == BallerinaTypes.QUOTED_STRING_LITERAL; } }
3e1690832dc91fdca3d348fb57028d0d7706fc7c
743
java
Java
jbpm-xes/src/main/java/org/jbpm/xes/XESExportService.java
akoufoudakis/jbpm
c0b02549779ec1c01664023ad79d28c851905ba6
[ "Apache-2.0" ]
841
2017-03-13T16:37:04.000Z
2022-03-17T22:56:48.000Z
jbpm-xes/src/main/java/org/jbpm/xes/XESExportService.java
akoufoudakis/jbpm
c0b02549779ec1c01664023ad79d28c851905ba6
[ "Apache-2.0" ]
1,104
2017-03-13T18:33:12.000Z
2022-03-30T23:30:46.000Z
jbpm-xes/src/main/java/org/jbpm/xes/XESExportService.java
akoufoudakis/jbpm
c0b02549779ec1c01664023ad79d28c851905ba6
[ "Apache-2.0" ]
606
2017-03-13T14:17:07.000Z
2022-03-24T23:48:11.000Z
33.772727
75
0.74428
9,621
/* * Copyright 2019 Red Hat, Inc. and/or its affiliates. * * 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.jbpm.xes; public interface XESExportService { String export(XESProcessFilter filter) throws Exception; }
3e169143e9d9c95d8bd186cc9325ee5082ec455d
343
java
Java
NLPCCd/Hadoop/10430_2.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
NLPCCd/Hadoop/10430_2.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
NLPCCd/Hadoop/10430_2.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
21.4375
56
0.752187
9,622
//,temp,sample_5715.java,2,12,temp,sample_8190.java,2,12 //,2 public class xxx { private void checkVersion() throws IOException { Version loadedVersion = loadVersion(); if (loadedVersion.equals(getCurrentVersion())) { return; } if (loadedVersion.isCompatibleTo(getCurrentVersion())) { log.info("storing timeline store version info"); } } };
3e169301c68557b0453c3103cc87afd3c6035283
202
java
Java
common/src/main/java/ru/ajana/work/common/oop/InterfaceDemo.java
andrej59/app-work
d30e290a3c730490fda5e8c7e45e55745755a5b1
[ "Apache-2.0" ]
null
null
null
common/src/main/java/ru/ajana/work/common/oop/InterfaceDemo.java
andrej59/app-work
d30e290a3c730490fda5e8c7e45e55745755a5b1
[ "Apache-2.0" ]
7
2019-11-13T06:22:07.000Z
2022-01-21T23:22:47.000Z
common/src/main/java/ru/ajana/work/common/oop/InterfaceDemo.java
andrej59/app-work
d30e290a3c730490fda5e8c7e45e55745755a5b1
[ "Apache-2.0" ]
null
null
null
15.538462
43
0.70297
9,623
package ru.ajana.work.common.oop; /** * @author Andrey Kharintsev on 15.03.2018 */ public interface InterfaceDemo { public static final String VALUE = "123"; public abstract void method(); }
3e1693ca0b694fd6b0e0cf540daed6e83b822b36
407
java
Java
jdraw-assignment/src/main/java/jdraw/figures/OvalTool.java
valentinjacot/backupETHZ
36605c4f532eb65efb4a391ed0f17a07102f7d5b
[ "MIT" ]
1
2019-12-25T10:21:30.000Z
2019-12-25T10:21:30.000Z
jdraw-assignment/src/main/java/jdraw/figures/OvalTool.java
valentinjacot/backupETHZ
36605c4f532eb65efb4a391ed0f17a07102f7d5b
[ "MIT" ]
null
null
null
jdraw-assignment/src/main/java/jdraw/figures/OvalTool.java
valentinjacot/backupETHZ
36605c4f532eb65efb4a391ed0f17a07102f7d5b
[ "MIT" ]
null
null
null
18.5
66
0.710074
9,624
package jdraw.figures; import java.awt.Point; import jdraw.framework.DrawContext; public class OvalTool extends AbstractTool{ public OvalTool(DrawContext context, String Name, String Icon) { super(context); this.name = Name; this.icon = Icon; } @Override protected AbstractFigure createFigure(Point p) { // TODO Auto-generated method stub return new Oval(p.x,p.y,0,0); } }
3e169491fd292762943d3e4b841a394627d58252
138
java
Java
src/main/java/alliance/controller/interfaces/RuleAndRegulationControllerInterface.java
Andyccs/cz2002-eproctor
380243aa8b12a562982d9e78890e10213b3b22d3
[ "MIT" ]
1
2020-09-10T14:48:38.000Z
2020-09-10T14:48:38.000Z
src/main/java/alliance/controller/interfaces/RuleAndRegulationControllerInterface.java
Andyccs/cz2002-eproctor
380243aa8b12a562982d9e78890e10213b3b22d3
[ "MIT" ]
1
2016-04-25T05:17:40.000Z
2016-04-25T05:17:40.000Z
src/main/java/alliance/controller/interfaces/RuleAndRegulationControllerInterface.java
Andyccs/cz2006-eproctor
380243aa8b12a562982d9e78890e10213b3b22d3
[ "MIT" ]
null
null
null
17.25
55
0.797101
9,625
package alliance.controller.interfaces; public interface RuleAndRegulationControllerInterface{ public void startVideoCall(); }
3e1695379857b298aadf7bdf1d84741651035b05
11,698
java
Java
app/src/main/java/com/joostvdoorn/glutenvrij/scanner/camera/CameraManager.java
JoostvDoorn/GlutenVrijApp
7c8ab0a967ad5b72c8af6474f68fa653c71ad5c5
[ "MIT" ]
6
2015-01-18T09:49:00.000Z
2017-07-23T14:07:23.000Z
app/src/main/java/com/joostvdoorn/glutenvrij/scanner/camera/CameraManager.java
JoostvDoorn/GlutenVrijApp
7c8ab0a967ad5b72c8af6474f68fa653c71ad5c5
[ "MIT" ]
2
2015-03-12T18:47:36.000Z
2017-11-20T19:52:06.000Z
app/src/main/java/com/joostvdoorn/glutenvrij/scanner/camera/CameraManager.java
JoostvDoorn/GlutenVrijApp
7c8ab0a967ad5b72c8af6474f68fa653c71ad5c5
[ "MIT" ]
null
null
null
35.240964
100
0.697521
9,626
/* * Copyright (C) 2008 ZXing 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.joostvdoorn.glutenvrij.scanner.camera; import android.content.Context; import android.content.SharedPreferences; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.Camera; import android.os.Build; import android.os.Handler; import android.preference.PreferenceManager; import android.util.Log; import android.view.SurfaceHolder; import com.joostvdoorn.glutenvrij.scanner.PlanarYUVLuminanceSource; import com.joostvdoorn.glutenvrij.scanner.PreferencesActivity; import java.io.IOException; /** * This object wraps the Camera service object and expects to be the only one talking to it. The * implementation encapsulates the steps needed to take preview-sized images, which are used for * both preview and decoding. * * @author kenaa@example.com (Daniel Switkin) */ public final class CameraManager { private static final String TAG = CameraManager.class.getSimpleName(); private static final int MIN_FRAME_WIDTH = 240; private static final int MIN_FRAME_HEIGHT = 240; private static final int MAX_FRAME_WIDTH = 480; private static final int MAX_FRAME_HEIGHT = 360; private static CameraManager cameraManager; static final int SDK_INT; // Later we can use Build.VERSION.SDK_INT static { int sdkInt; try { sdkInt = Integer.parseInt(Build.VERSION.SDK); } catch (NumberFormatException nfe) { // Just to be safe sdkInt = 10000; } SDK_INT = sdkInt; } private final Context context; private final CameraConfigurationManager configManager; private Camera camera; private Rect framingRect; private Rect framingRectInPreview; private boolean initialized; private boolean previewing; private boolean reverseImage; private final boolean useOneShotPreviewCallback; /** * Preview frames are delivered here, which we pass on to the registered handler. Make sure to * clear the handler so it will only receive one message. */ private final PreviewCallback previewCallback; /** Autofocus callbacks arrive here, and are dispatched to the Handler which requested them. */ private final AutoFocusCallback autoFocusCallback; /** * Initializes this static object with the Context of the calling Activity. * * @param context The Activity which wants to use the camera. */ public static void init(Context context) { if (cameraManager == null) { cameraManager = new CameraManager(context); } } /** * Gets the CameraManager singleton instance. * * @return A reference to the CameraManager singleton. */ public static CameraManager get() { return cameraManager; } private CameraManager(Context context) { this.context = context; this.configManager = new CameraConfigurationManager(context); // Camera.setOneShotPreviewCallback() has a race condition in Cupcake, so we use the older // Camera.setPreviewCallback() on 1.5 and earlier. For Donut and later, we need to use // the more efficient one shot callback, as the older one can swamp the system and cause it // to run out of memory. We can't use SDK_INT because it was introduced in the Donut SDK. useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > 3; // 3 = Cupcake previewCallback = new PreviewCallback(configManager, useOneShotPreviewCallback); autoFocusCallback = new AutoFocusCallback(); } /** * Opens the camera driver and initializes the hardware parameters. * * @param holder The surface object which the camera will draw preview frames into. * @throws IOException Indicates the camera driver failed to open. */ public void openDriver(SurfaceHolder holder) throws IOException { if (camera == null) { camera = Camera.open(); if (camera == null) { throw new IOException(); } } camera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(camera); } configManager.setDesiredCameraParameters(camera); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); reverseImage = prefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false); if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) { FlashlightManager.enableFlashlight(); } } /** * Closes the camera driver if still in use. */ public void closeDriver() { if (camera != null) { FlashlightManager.disableFlashlight(); camera.release(); camera = null; // Make sure to clear these each time we close the camera, so that any scanning rect // requested by intent is forgotten. framingRect = null; framingRectInPreview = null; } } /** * Asks the camera hardware to begin drawing preview frames to the screen. */ public void startPreview() { if (camera != null && !previewing) { camera.startPreview(); previewing = true; } } /** * Tells the camera to stop drawing preview frames. */ public void stopPreview() { if (camera != null && previewing) { if (!useOneShotPreviewCallback) { camera.setPreviewCallback(null); } camera.stopPreview(); previewCallback.setHandler(null, 0); autoFocusCallback.setHandler(null, 0); previewing = false; } } /** * A single preview frame will be returned to the handler supplied. The data will arrive as byte[] * in the message.obj field, with width and height encoded as message.arg1 and message.arg2, * respectively. * * @param handler The handler to send the message to. * @param message The what field of the message to be sent. */ public void requestPreviewFrame(Handler handler, int message) { if (camera != null && previewing) { previewCallback.setHandler(handler, message); if (useOneShotPreviewCallback) { camera.setOneShotPreviewCallback(previewCallback); } else { camera.setPreviewCallback(previewCallback); } } } /** * Asks the camera hardware to perform an autofocus. * * @param handler The Handler to notify when the autofocus completes. * @param message The message to deliver. */ public void requestAutoFocus(Handler handler, int message) { if (camera != null && previewing) { autoFocusCallback.setHandler(handler, message); try { camera.autoFocus(autoFocusCallback); } catch(java.lang.RuntimeException e) { // This catch is for stability purposes } } } /** * Calculates the framing rect which the UI should draw to show the user where to place the * barcode. This target helps with alignment as well as forces the user to hold the device * far enough away to ensure the image will be in focus. * * @return The rectangle to draw on screen in window coordinates. */ public Rect getFramingRect() { if (framingRect == null) { if (camera == null) { return null; } Point screenResolution = configManager.getScreenResolution(); int width = screenResolution.x * 3 / 4; if (width < MIN_FRAME_WIDTH) { width = MIN_FRAME_WIDTH; } else if (width > MAX_FRAME_WIDTH) { width = MAX_FRAME_WIDTH; } int height = screenResolution.y * 3 / 4; if (height < MIN_FRAME_HEIGHT) { height = MIN_FRAME_HEIGHT; } else if (height > MAX_FRAME_HEIGHT) { height = MAX_FRAME_HEIGHT; } int leftOffset = (screenResolution.x - width) / 2; int topOffset = (screenResolution.y - height) / 2; framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height); Log.d(TAG, "Calculated framing rect: " + framingRect); } return framingRect; } /** * Like {@link #getFramingRect} but coordinates are in terms of the preview frame, * not UI / screen. */ public Rect getFramingRectInPreview() { if (framingRectInPreview == null) { Rect rect = new Rect(getFramingRect()); Point cameraResolution = configManager.getCameraResolution(); Point screenResolution = configManager.getScreenResolution(); rect.left = rect.left * cameraResolution.x / screenResolution.x; rect.right = rect.right * cameraResolution.x / screenResolution.x; rect.top = rect.top * cameraResolution.y / screenResolution.y; rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y; framingRectInPreview = rect; } return framingRectInPreview; } /** * Allows third party apps to specify the scanning rectangle dimensions, rather than determine * them automatically based on screen resolution. * * @param width The width in pixels to scan. * @param height The height in pixels to scan. */ public void setManualFramingRect(int width, int height) { Point screenResolution = configManager.getScreenResolution(); if (width > screenResolution.x) { width = screenResolution.x; } if (height > screenResolution.y) { height = screenResolution.y; } int leftOffset = (screenResolution.x - width) / 2; int topOffset = (screenResolution.y - height) / 2; framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height); Log.d(TAG, "Calculated manual framing rect: " + framingRect); framingRectInPreview = null; } /** * A factory method to build the appropriate LuminanceSource object based on the format * of the preview buffers, as described by Camera.Parameters. * * @param data A preview frame. * @param width The width of the image. * @param height The height of the image. * @return A PlanarYUVLuminanceSource instance. */ public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) { Rect rect = getFramingRectInPreview(); int previewFormat = configManager.getPreviewFormat(); String previewFormatString = configManager.getPreviewFormatString(); switch (previewFormat) { // This is the standard Android format which all devices are REQUIRED to support. // In theory, it's the only one we should ever care about. case PixelFormat.YCbCr_420_SP: // This format has never been seen in the wild, but is compatible as we only care // about the Y channel, so allow it. case PixelFormat.YCbCr_422_SP: return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height(), reverseImage); default: // The Samsung Moment incorrectly uses this variant instead of the 'sp' version. // Fortunately, it too has all the Y data up front, so we can read it. if ("yuv420p".equals(previewFormatString)) { return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height(), reverseImage); } } throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/' + previewFormatString); } }
3e169595ba79459c2f0e4ab6e203aca42994f920
2,014
java
Java
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
duzhanfei/shardingsphere
548ea929023903e93716eadedcf8faea5c36aa17
[ "Apache-2.0" ]
2
2020-10-23T01:31:16.000Z
2020-10-23T01:38:24.000Z
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
duzhanfei/shardingsphere
548ea929023903e93716eadedcf8faea5c36aa17
[ "Apache-2.0" ]
null
null
null
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
duzhanfei/shardingsphere
548ea929023903e93716eadedcf8faea5c36aa17
[ "Apache-2.0" ]
null
null
null
42.851064
173
0.785005
9,627
/* * 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.shardingsphere.encrypt.rule.builder; import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration; import org.apache.shardingsphere.encrypt.rule.EncryptRule; import org.apache.shardingsphere.infra.rule.ShardingSphereRuleBuilder; import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry; import org.junit.Test; import java.util.Collections; import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; public final class EncryptRuleBuilderTest { static { ShardingSphereServiceLoader.register(ShardingSphereRuleBuilder.class); } @SuppressWarnings({"rawtypes", "unchecked"}) @Test public void assertBuild() { EncryptRuleConfiguration ruleConfig = mock(EncryptRuleConfiguration.class); ShardingSphereRuleBuilder builder = OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), ShardingSphereRuleBuilder.class).get(ruleConfig); assertThat(builder.build(ruleConfig, Collections.emptyList()), instanceOf(EncryptRule.class)); } }
3e1695ca244ad9603a53724187052d1ff5708581
1,434
java
Java
arms/src/main/java/me/xiaobailong24/mvvmarms/mvvm/ViewModelFactory.java
gosailing/MVVMArms
96a2a5061162cc61de9326cc78eb7e7b0575220e
[ "Apache-2.0" ]
476
2017-08-02T08:02:33.000Z
2021-12-17T03:26:21.000Z
arms/src/main/java/me/xiaobailong24/mvvmarms/mvvm/ViewModelFactory.java
gosailing/MVVMArms
96a2a5061162cc61de9326cc78eb7e7b0575220e
[ "Apache-2.0" ]
16
2017-08-11T16:01:45.000Z
2019-01-14T02:36:28.000Z
arms/src/main/java/me/xiaobailong24/mvvmarms/mvvm/ViewModelFactory.java
gosailing/MVVMArms
96a2a5061162cc61de9326cc78eb7e7b0575220e
[ "Apache-2.0" ]
83
2017-08-02T08:03:58.000Z
2021-05-30T14:30:20.000Z
29.875
106
0.632497
9,628
package me.xiaobailong24.mvvmarms.mvvm; import android.arch.lifecycle.ViewModel; import android.arch.lifecycle.ViewModelProvider; import android.support.annotation.NonNull; import java.util.Map; import javax.inject.Inject; import javax.inject.Provider; /** * @author xiaobailong24 * @date 2017/6/16 * MVVM ViewModelFactory */ public class ViewModelFactory implements ViewModelProvider.Factory { private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators; @Inject public ViewModelFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) { this.creators = creators; } @NonNull @SuppressWarnings("unchecked") @Override public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { Provider<? extends ViewModel> creator = creators.get(modelClass); if (creator == null) { for (Map.Entry<Class<? extends ViewModel>, Provider<ViewModel>> entry : creators.entrySet()) { if (modelClass.isAssignableFrom(entry.getKey())) { creator = entry.getValue(); break; } } } if (creator == null) { throw new IllegalArgumentException("unknown model class " + modelClass); } try { return (T) creator.get(); } catch (Exception e) { throw new RuntimeException(e); } } }
3e169621a0c8ede770cb314add465ad2e18da037
3,086
java
Java
src/testcases/CWE89_SQL_Injection/s03/CWE89_SQL_Injection__PropertiesFile_executeBatch_81_goodG2B.java
diktat-static-analysis/juliet-benchmark-java
7e55922d154c26ef34ff3327073f030ff7393b2a
[ "MIT" ]
null
null
null
src/testcases/CWE89_SQL_Injection/s03/CWE89_SQL_Injection__PropertiesFile_executeBatch_81_goodG2B.java
diktat-static-analysis/juliet-benchmark-java
7e55922d154c26ef34ff3327073f030ff7393b2a
[ "MIT" ]
null
null
null
src/testcases/CWE89_SQL_Injection/s03/CWE89_SQL_Injection__PropertiesFile_executeBatch_81_goodG2B.java
diktat-static-analysis/juliet-benchmark-java
7e55922d154c26ef34ff3327073f030ff7393b2a
[ "MIT" ]
null
null
null
33.912088
138
0.532728
9,629
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE89_SQL_Injection__PropertiesFile_executeBatch_81_goodG2B.java Label Definition File: CWE89_SQL_Injection.label.xml Template File: sources-sinks-81_goodG2B.tmpl.java */ /* * @description * CWE: 89 SQL Injection * BadSource: PropertiesFile Read data from a .properties file (in property named data) * GoodSource: A hardcoded string * Sinks: executeBatch * GoodSink: Use prepared statement and executeBatch (properly) * BadSink : data concatenated into SQL statement used in executeBatch(), which could result in SQL Injection * Flow Variant: 81 Data flow: data passed in a parameter to an abstract method * * */ package testcases.CWE89_SQL_Injection.s03; import testcasesupport.*; import javax.servlet.http.*; import java.sql.*; import java.util.logging.Level; public class CWE89_SQL_Injection__PropertiesFile_executeBatch_81_goodG2B extends CWE89_SQL_Injection__PropertiesFile_executeBatch_81_base { public void action(String data ) throws Throwable { if (data != null) { String names[] = data.split("-"); int successCount = 0; Connection dbConnection = null; Statement sqlStatement = null; try { dbConnection = IO.getDBConnection(); sqlStatement = dbConnection.createStatement(); for (int i = 0; i < names.length; i++) { /* POTENTIAL FLAW: data concatenated into SQL statement used in executeBatch(), which could result in SQL Injection */ sqlStatement.addBatch("update users set hitcount=hitcount+1 where name='" + names[i] + "'"); } int resultsArray[] = sqlStatement.executeBatch(); for (int i = 0; i < names.length; i++) { if (resultsArray[i] > 0) { successCount++; } } IO.writeLine("Succeeded in " + successCount + " out of " + names.length + " queries."); } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error getting database connection", exceptSql); } finally { try { if (sqlStatement != null) { sqlStatement.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Statament", exceptSql); } try { if (dbConnection != null) { dbConnection.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql); } } } } }
3e16962a06d22b4c0566e82b329e2a552e19bc52
2,061
java
Java
DynamicAnalyzer/src/test/java/util/BodyGenerator.java
lu-fennell/JGS-1
c97acaa40d5e451c3cf4dcae9b06c4061ef8ea50
[ "BSD-3-Clause" ]
1
2016-09-12T19:30:02.000Z
2016-09-12T19:30:02.000Z
DynamicAnalyzer/src/test/java/util/BodyGenerator.java
lu-fennell/JGS-1
c97acaa40d5e451c3cf4dcae9b06c4061ef8ea50
[ "BSD-3-Clause" ]
1
2019-08-15T09:49:58.000Z
2019-08-15T09:49:58.000Z
DynamicAnalyzer/src/test/java/util/BodyGenerator.java
lu-fennell/JGS-1
c97acaa40d5e451c3cf4dcae9b06c4061ef8ea50
[ "BSD-3-Clause" ]
2
2019-05-26T17:57:57.000Z
2019-08-15T09:53:58.000Z
32.203125
122
0.63901
9,630
package util; import soot.*; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; /** * This Helper Class takes a existing Class File and * collects all Method Bodies, that are appearing within that File * @author Karsten Fix, 22.08.17 */ public class BodyGenerator extends BodyTransformer{ /** Saves a list of Bodies */ private List<Body> bodies = new ArrayList<>(); public BodyGenerator(String className) { G.reset(); // <editor-fold desc="Setting up Class Path, adding Threads Class Path to Soot"> String classPath = Scene.v().getSootClassPath(); List<String> cpath = new ArrayList<>(); ClassLoader cxClassloader = Thread.currentThread().getContextClassLoader(); if (cxClassloader instanceof URLClassLoader) { for (URL url : Arrays.asList(((URLClassLoader) (Thread.currentThread().getContextClassLoader())).getURLs())) { cpath.add(url.getFile()); } } Scene.v().setSootClassPath(String.join(":", cpath) + ":" + classPath); // </editor-fold> PackManager.v().getPack("jtp").add(new Transform("jtp.bg", this)); soot.Main.main(new String[] {className, "-p", "jtp.bg", "enabled:true"}); } /** * This method is called of the {@link Main#main(String[])}, if the * arguments are set right. * And it is called, because the {@link BodyGenerator#BodyGenerator(String)} does this. * @param body The Body, that is then collected. * @param s The String of the Phase Name (in this case: jtp.bg) * @param map Some additional Options, such as enabled: true, etc. */ @Override protected void internalTransform(Body body, String s, Map<String, String> map) { bodies.add(body); } /** * Gets a list of all Bodies, that have been collected. * @return A list of Jimple Bodies. */ public List<Body> getBodies() { return bodies; } }
3e1696b08bb60332eff04add4ed180b9ce54a4fc
1,316
java
Java
appservice/resource-manager/v2016_08_01/src/main/java/com/microsoft/azure/management/appservice/v2016_08_01/implementation/StorageMigrationResponseImpl.java
minaltolpadi/azure-sdk-for-java
a6bb33fc71f21ee92d4246d6b5fe30ad8a5689cb
[ "MIT" ]
3
2021-09-15T16:25:19.000Z
2021-12-17T05:41:00.000Z
appservice/resource-manager/v2016_08_01/src/main/java/com/microsoft/azure/management/appservice/v2016_08_01/implementation/StorageMigrationResponseImpl.java
minaltolpadi/azure-sdk-for-java
a6bb33fc71f21ee92d4246d6b5fe30ad8a5689cb
[ "MIT" ]
306
2019-09-27T06:41:56.000Z
2019-10-14T08:19:57.000Z
appservice/resource-manager/v2016_08_01/src/main/java/com/microsoft/azure/management/appservice/v2016_08_01/implementation/StorageMigrationResponseImpl.java
minaltolpadi/azure-sdk-for-java
a6bb33fc71f21ee92d4246d6b5fe30ad8a5689cb
[ "MIT" ]
1
2019-10-05T04:59:12.000Z
2019-10-05T04:59:12.000Z
25.307692
123
0.696049
9,631
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.appservice.v2016_08_01.implementation; import com.microsoft.azure.management.appservice.v2016_08_01.StorageMigrationResponse; import com.microsoft.azure.arm.model.implementation.WrapperImpl; class StorageMigrationResponseImpl extends WrapperImpl<StorageMigrationResponseInner> implements StorageMigrationResponse { private final AppServiceManager manager; StorageMigrationResponseImpl(StorageMigrationResponseInner inner, AppServiceManager manager) { super(inner); this.manager = manager; } @Override public AppServiceManager manager() { return this.manager; } @Override public String id() { return this.inner().id(); } @Override public String kind() { return this.inner().kind(); } @Override public String name() { return this.inner().name(); } @Override public String operationId() { return this.inner().operationId(); } @Override public String type() { return this.inner().type(); } }
3e16978489dc7c2b7bbbee52e14cb3ab7a0b33a0
2,113
java
Java
opba-protocols/xs2a-protocol/src/main/java/de/adorsys/opba/protocol/xs2a/service/xs2a/authenticate/embedded/Xs2aAskForPassword.java
Takaokataoka/open-banking-gateway
20016140717adac3b80769396d21c7248d525017
[ "Apache-2.0" ]
118
2019-11-05T14:32:48.000Z
2022-03-31T21:55:56.000Z
opba-protocols/xs2a-protocol/src/main/java/de/adorsys/opba/protocol/xs2a/service/xs2a/authenticate/embedded/Xs2aAskForPassword.java
Takaokataoka/open-banking-gateway
20016140717adac3b80769396d21c7248d525017
[ "Apache-2.0" ]
844
2019-11-19T10:26:23.000Z
2022-02-02T19:28:36.000Z
opba-protocols/xs2a-protocol/src/main/java/de/adorsys/opba/protocol/xs2a/service/xs2a/authenticate/embedded/Xs2aAskForPassword.java
Takaokataoka/open-banking-gateway
20016140717adac3b80769396d21c7248d525017
[ "Apache-2.0" ]
59
2019-11-12T13:10:30.000Z
2022-03-24T03:44:02.000Z
44.020833
115
0.76053
9,632
package de.adorsys.opba.protocol.xs2a.service.xs2a.authenticate.embedded; import de.adorsys.opba.protocol.api.common.ProtocolAction; import de.adorsys.opba.protocol.bpmnshared.service.context.ContextUtil; import de.adorsys.opba.protocol.bpmnshared.service.exec.ValidatedExecution; import de.adorsys.opba.protocol.xs2a.config.protocol.ProtocolUrlsConfiguration; import de.adorsys.opba.protocol.xs2a.context.Xs2aContext; import de.adorsys.opba.protocol.xs2a.service.xs2a.Xs2aRedirectExecutor; import de.adorsys.opba.protocol.xs2a.util.logresolver.Xs2aLogResolver; import lombok.RequiredArgsConstructor; import org.flowable.engine.RuntimeService; import org.flowable.engine.delegate.DelegateExecution; import org.springframework.stereotype.Service; /** * Asks PSU for his PIN/Password by redirect him to password input page. Suspends process to wait for users' input. */ @Service("xs2aAskForPassword") @RequiredArgsConstructor public class Xs2aAskForPassword extends ValidatedExecution<Xs2aContext> { private final RuntimeService runtimeService; private final Xs2aRedirectExecutor redirectExecutor; private final Xs2aLogResolver logResolver = new Xs2aLogResolver(getClass()); @Override protected void doRealExecution(DelegateExecution execution, Xs2aContext context) { logResolver.log("doRealExecution: execution ({}) with context ({})", execution, context); redirectExecutor.redirect(execution, context, urls -> { ProtocolUrlsConfiguration.UrlSet urlSet = ProtocolAction.SINGLE_PAYMENT.equals(context.getAction()) ? urls.getPis() : urls.getAis(); return urlSet.getParameters().getProvidePsuPassword(); }); } @Override protected void doMockedExecution(DelegateExecution execution, Xs2aContext context) { logResolver.log("doMockedExecution: execution ({}) with context ({})", execution, context); ContextUtil.getAndUpdateContext( execution, (Xs2aContext ctx) -> ctx.setPsuPassword("mock-password") ); runtimeService.trigger(execution.getId()); } }
3e1697d306b803deabd792c13978d4356767492a
761
java
Java
src/main/java/io/connectedhealth_idaas/eventbuilder/pojos/edi/hipaa/SRT.java
jayfray12/iDAAS-EventBuilder
769248c81f3e7e594dc637fd1b21b2b558fa4fd8
[ "Apache-2.0" ]
null
null
null
src/main/java/io/connectedhealth_idaas/eventbuilder/pojos/edi/hipaa/SRT.java
jayfray12/iDAAS-EventBuilder
769248c81f3e7e594dc637fd1b21b2b558fa4fd8
[ "Apache-2.0" ]
null
null
null
src/main/java/io/connectedhealth_idaas/eventbuilder/pojos/edi/hipaa/SRT.java
jayfray12/iDAAS-EventBuilder
769248c81f3e7e594dc637fd1b21b2b558fa4fd8
[ "Apache-2.0" ]
1
2021-06-17T14:44:01.000Z
2021-06-17T14:44:01.000Z
36.238095
76
0.879106
9,633
package io.connectedhealth_idaas.eventbuilder.pojos.edi.hipaa; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; public class SRT { private String SRT_01_ChangeTypeCode; private String SRT_02_RouteCode; private String SRT_03_RateValueQualifier; private String SRT_04_RateValueQualifier; private String SRT_05_RateApplicationTypeCode; private String SRT_06_Scale; private String SRT_07_Scale; private String SRT_08_MinimumWeightLogic; private String SRT_09_LoadingRestriction; private String SRT_10_LoadingRestriction; private String SRT_11_Percent,IntegerFormat; private String SRT_12_SpecialChargeorAllowanceCode; private String SRT_13_SpecialChargeDescription; public String toString() { return ReflectionToStringBuilder.toString(this);} }
3e1698c02304aef786c759c3c127d1cbc591d6d9
971
java
Java
authcenter/auth-user/src/main/java/com/xzg/framework/sys/user/entity/SysRoleUser.java
xiongzhenggang/microservice-auth
68b2c58526f7b57212d1a1faaff431863d342a29
[ "Apache-2.0" ]
2
2020-03-03T11:45:12.000Z
2020-06-09T06:11:35.000Z
authcenter/auth-user/src/main/java/com/xzg/framework/sys/user/entity/SysRoleUser.java
xiongzhenggang/microservice-auth
68b2c58526f7b57212d1a1faaff431863d342a29
[ "Apache-2.0" ]
null
null
null
authcenter/auth-user/src/main/java/com/xzg/framework/sys/user/entity/SysRoleUser.java
xiongzhenggang/microservice-auth
68b2c58526f7b57212d1a1faaff431863d342a29
[ "Apache-2.0" ]
1
2020-03-26T05:20:10.000Z
2020-03-26T05:20:10.000Z
24.897436
61
0.794027
9,634
package com.xzg.framework.sys.user.entity; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import lombok.*; import java.util.Date; /** * @autho * @date 2019/7/30 */ @Setter @Getter @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) @TableName("sys_user_role_rel") public class SysRoleUser extends Model<SysRoleUser> { public SysRoleUser(Long userId, Long roleId ){ this.userId = userId; this.roleId =roleId; } private Long userId; private Long roleId; private String createUser; private String updateUser; @TableId private Long id; @TableField(fill = FieldFill.INSERT) private Date createTime; @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; private boolean deleteFlag; }
3e16991b5ac7f109f465247b4f56dcf9f5c56f9d
517
java
Java
ExtractedJars/PACT_com.pactforcure.app/javafiles/io/fabric/sdk/android/services/settings/SettingsController.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
3
2019-05-01T09:22:08.000Z
2019-07-06T22:21:59.000Z
ExtractedJars/PACT_com.pactforcure.app/javafiles/io/fabric/sdk/android/services/settings/SettingsController.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
null
null
null
ExtractedJars/PACT_com.pactforcure.app/javafiles/io/fabric/sdk/android/services/settings/SettingsController.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
1
2020-11-26T12:22:02.000Z
2020-11-26T12:22:02.000Z
28.722222
92
0.802708
9,635
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package io.fabric.sdk.android.services.settings; // Referenced classes of package io.fabric.sdk.android.services.settings: // SettingsData, SettingsCacheBehavior public interface SettingsController { public abstract SettingsData loadSettingsData(); public abstract SettingsData loadSettingsData(SettingsCacheBehavior settingscachebehavior); }
3e1699399563fdca6974f324e44a54b8bcce7b21
10,056
java
Java
Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/info/FileBitPatternInfo.java
bdcht/ghidra
9e732318148cd11edeb4862afd23d56418551812
[ "Apache-2.0" ]
17
2022-01-15T03:52:37.000Z
2022-03-30T18:12:17.000Z
Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/info/FileBitPatternInfo.java
BStudent/ghidra
0cdc722921cef61b7ca1b7236bdc21079fd4c03e
[ "Apache-2.0" ]
9
2022-01-15T03:58:02.000Z
2022-02-21T10:22:49.000Z
Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/info/FileBitPatternInfo.java
BStudent/ghidra
0cdc722921cef61b7ca1b7236bdc21079fd4c03e
[ "Apache-2.0" ]
3
2019-12-02T13:36:50.000Z
2019-12-04T05:40:12.000Z
32.025478
104
0.75179
9,636
/* ### * IP: GHIDRA * * 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 ghidra.bitpatterns.info; import java.io.*; import java.util.ArrayList; import java.util.List; import org.jdom.*; import org.jdom.input.SAXBuilder; import ghidra.util.Msg; import ghidra.util.xml.XmlUtilities; /** * An object of this class stores all the function bit pattern information for an executable. * It records the number of bytes and instructions for each category (first, pre, and return), as * well as the language ID and ghidraURL of the executable. Using JAXB, objects of this class converted * to/from XML files for analysis and storage. */ public class FileBitPatternInfo { static final String XML_ELEMENT_NAME = "FileBitPatternInfo"; private int numFirstBytes = 0; private int numFirstInstructions = 0; private int numPreBytes = 0; private int numPreInstructions = 0; private int numReturnBytes = 0; private int numReturnInstructions = 0; private String languageID = null; private String ghidraURL = null; private List<FunctionBitPatternInfo> funcBitPatternInfo; //possible TODO: Use SaveState instead of JAXB to do the XML serialization? /** * Default no-arg constructor. Used by JAXB for XML serialization. */ public FileBitPatternInfo() { funcBitPatternInfo = new ArrayList<FunctionBitPatternInfo>(); } /** * Get the number of bytes gathered, starting at the entry point of a function. * @return number of first bytes */ public int getNumFirstBytes() { return numFirstBytes; } /** * Set the number of bytes gathered, starting at the entry point of a function * @param numFirstBytes number of bytes */ public void setNumFirstBytes(int numFirstBytes) { this.numFirstBytes = numFirstBytes; } /** * Get the number of instructions gathered, starting with instruction at the * entry point of the function * @return number of instructions */ public int getNumFirstInstructions() { return numFirstInstructions; } /** * Set the number of initial instructions gathered. * @param numFirstInstructions number of instructions */ public void setNumFirstInstructions(int numFirstInstructions) { this.numFirstInstructions = numFirstInstructions; } /** * Get the number of bytes gathered immediately before (but not including) the entry point * of a function * @return number of bytes gathered */ public int getNumPreBytes() { return numPreBytes; } /** * Set the number of bytes gathered immediately before (but not including) the entry point * of a function * @param numPreBytes number of bytes */ public void setNumPreBytes(int numPreBytes) { this.numPreBytes = numPreBytes; } /** * Get the number of instructions gathered immediately before (but not including) a function start * @return number of instructions */ public int getNumPreInstructions() { return numPreInstructions; } /** * Set the number of instructions gathered immediately before (but not including) a function start * * @param numPreInstructions number of instructions */ public void setNumPreInstructions(int numPreInstructions) { this.numPreInstructions = numPreInstructions; } /** * Get the list of {@link FunctionBitPatternInfo} objects for the program (one object per function) * @return List whose elements record information about each function start in the program */ public List<FunctionBitPatternInfo> getFuncBitPatternInfo() { return funcBitPatternInfo; } /** * Set the list of {@link FunctionBitPatternInfo} objects for the program (one object per function) * @param funcStartInfo List whose elements record information about each function start in the * program */ public void setFuncBitPatternInfo(List<FunctionBitPatternInfo> funcBitPatternInfo) { this.funcBitPatternInfo = funcBitPatternInfo; } /** * Get the language ID string of the program * @return the language ID */ public String getLanguageID() { return languageID; } /** * Set the language ID string of the program * @param id the language id */ public void setLanguageID(String id) { this.languageID = id; } /** * Set the GhidraURL of the program * @param url the url */ public void setGhidraURL(String url) { this.ghidraURL = url; } /** * Get the GhidraURL of the program * @return the url */ public String getGhidraURL() { return ghidraURL; } /** * Get the number of return bytes gathered, i.e., the number of bytes gathered immediately before * (and including) a return instruction. * @return number of return bytes */ public int getNumReturnBytes() { return numReturnBytes; } /** * Set the number of return bytes, i.e., the number of bytes gathered immediately before * (and including) a return instruction. * @param numReturnBytes number of return bytes */ public void setNumReturnBytes(int numReturnBytes) { this.numReturnBytes = numReturnBytes; } /** * Get the number of instructions immediately before (and including) a return instruction * @return number of return instructions */ public int getNumReturnInstructions() { return numReturnInstructions; } /** * Set the number of instructions immediately before (and including) a return instruction * @param numReturnInstructions number of return instructions */ public void setNumReturnInstructions(int numReturnInstructions) { this.numReturnInstructions = numReturnInstructions; } /** * Converts this object into XML * * @return new jdom {@link Element} */ public Element toXml() { Element result = new Element(XML_ELEMENT_NAME); XmlUtilities.setStringAttr(result, "ghidraURL", ghidraURL); XmlUtilities.setStringAttr(result, "languageID", languageID); XmlUtilities.setIntAttr(result, "numFirstBytes", numFirstBytes); XmlUtilities.setIntAttr(result, "numFirstInstructions", numFirstInstructions); XmlUtilities.setIntAttr(result, "numPreBytes", numPreBytes); XmlUtilities.setIntAttr(result, "numPreInstructions", numPreInstructions); XmlUtilities.setIntAttr(result, "numReturnBytes", numReturnBytes); XmlUtilities.setIntAttr(result, "numReturnInstructions", numReturnInstructions); Element funcBitPatternInfoListEle = new Element("funcBitPatternInfoList"); for (FunctionBitPatternInfo fbpi : funcBitPatternInfo) { funcBitPatternInfoListEle.addContent(fbpi.toXml()); } result.addContent(funcBitPatternInfoListEle); return result; } /** * Creates a {@link FileBitPatternInfo} instance from XML. * * @param e XML element to convert * @return new {@link FileBitPatternInfo}, never null * @throws IOException if file IO error or xml data problem */ public static FileBitPatternInfo fromXml(Element e) throws IOException { String ghidraURL = e.getAttributeValue("ghidraURL"); String languageID = e.getAttributeValue("languageID"); int numFirstBytes = XmlUtilities.parseInt(XmlUtilities.requireStringAttr(e, "numFirstBytes")); int numFirstInstructions = XmlUtilities.parseInt(XmlUtilities.requireStringAttr(e, "numFirstInstructions")); int numPreBytes = XmlUtilities.parseInt(XmlUtilities.requireStringAttr(e, "numPreBytes")); int numPreInstructions = XmlUtilities.parseInt(XmlUtilities.requireStringAttr(e, "numPreInstructions")); int numReturnBytes = XmlUtilities.parseInt(XmlUtilities.requireStringAttr(e, "numReturnBytes")); int numReturnInstructions = XmlUtilities.parseInt(XmlUtilities.requireStringAttr(e, "numReturnInstructions")); List<FunctionBitPatternInfo> funcBitPatternInfoList = new ArrayList<>(); Element funcBitPatternInfoListEle = e.getChild("funcBitPatternInfoList"); if (funcBitPatternInfoListEle != null) { for (Element childElement : XmlUtilities.getChildren(funcBitPatternInfoListEle, FunctionBitPatternInfo.XML_ELEMENT_NAME)) { funcBitPatternInfoList.add(FunctionBitPatternInfo.fromXml(childElement)); } } FileBitPatternInfo result = new FileBitPatternInfo(); result.setFuncBitPatternInfo(funcBitPatternInfoList); result.setGhidraURL(ghidraURL); result.setLanguageID(languageID); result.setNumFirstBytes(numFirstBytes); result.setNumFirstInstructions(numFirstInstructions); result.setNumPreBytes(numPreBytes); result.setNumPreInstructions(numPreInstructions); result.setNumReturnBytes(numReturnBytes); result.setNumReturnInstructions(numReturnInstructions); return result; } /** * Converts this object to XML and writes it to the specified file. * * @param destFile name of xml file to create * @throws IOException if file io error */ public void toXmlFile(File destFile) throws IOException { Element rootEle = toXml(); Document doc = new Document(rootEle); XmlUtilities.writePrettyDocToFile(doc, destFile); } /** * Creates a {@link FileBitPatternInfo} instance from a XML file. * * @param inputFile name of xml file to read * @return new {@link FileBitPatternInfo} instance, never null * @throws IOException if file io error or xml data format problem */ public static FileBitPatternInfo fromXmlFile(File inputFile) throws IOException { SAXBuilder sax = XmlUtilities.createSecureSAXBuilder(false, false); try (InputStream fis = new FileInputStream(inputFile)) { Document doc = sax.build(fis); Element rootElem = doc.getRootElement(); return fromXml(rootElem); } catch (JDOMException | IOException e) { Msg.error(FileBitPatternInfo.class, "Bad file bit pattern file " + inputFile, e); throw new IOException("Failed to read file bit pattern " + inputFile, e); } } }
3e1699cc96884f5c0135c16a5189944e500135f7
359
java
Java
com/xmlmind/fo/properties/shorthand/BorderLeft.java
JaneMandy/CS
4a95148cbeb3804b9c50da003d1a7cb12254cb58
[ "Apache-2.0" ]
1
2022-02-24T01:32:41.000Z
2022-02-24T01:32:41.000Z
com/xmlmind/fo/properties/shorthand/BorderLeft.java
JaneMandy/CS
4a95148cbeb3804b9c50da003d1a7cb12254cb58
[ "Apache-2.0" ]
null
null
null
com/xmlmind/fo/properties/shorthand/BorderLeft.java
JaneMandy/CS
4a95148cbeb3804b9c50da003d1a7cb12254cb58
[ "Apache-2.0" ]
null
null
null
32.636364
106
0.707521
9,637
package com.xmlmind.fo.properties.shorthand; import com.xmlmind.fo.properties.Value; public class BorderLeft extends BorderShorthand { public BorderLeft(int var1, String var2, int var3, boolean var4, byte[] var5, int[] var6, Value var7) { super(var1, var2, var3, var4, var5, var6, var7); this.simpleProperties = new int[]{48, 47, 46}; } }