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
9238c023ebad3fb5ee84c259ca7582b6169b6f8f
455
java
Java
common/src/main/java/org/rest/common/util/order/OrderByNameIgnoreCase.java
vdvorak83/REST
2f0197d21f033418b4257b2f48b70f99411c337d
[ "MIT" ]
1
2019-04-22T08:49:17.000Z
2019-04-22T08:49:17.000Z
common/src/main/java/org/rest/common/util/order/OrderByNameIgnoreCase.java
vdvorak83/REST
2f0197d21f033418b4257b2f48b70f99411c337d
[ "MIT" ]
null
null
null
common/src/main/java/org/rest/common/util/order/OrderByNameIgnoreCase.java
vdvorak83/REST
2f0197d21f033418b4257b2f48b70f99411c337d
[ "MIT" ]
1
2019-11-16T10:03:10.000Z
2019-11-16T10:03:10.000Z
21.666667
89
0.712088
998,559
package org.rest.common.util.order; import org.rest.common.persistence.model.INameableEntity; import com.google.common.collect.Ordering; public final class OrderByNameIgnoreCase<T extends INameableEntity> extends Ordering<T> { public OrderByNameIgnoreCase() { super(); } // API @Override public final int compare(final T left, final T right) { return left.getName().compareToIgnoreCase(right.getName()); } }
9238c1957f31dfb9d440a2ed78cfdc493a7dcfe2
3,174
java
Java
src/main/java/de/kosit/validationtool/daemon/ConfigHandler.java
itplr-kosit/validator
7bffb32eb633ec583df9bdd0587e44e5b7d1fdc8
[ "Apache-2.0" ]
39
2018-03-28T10:15:31.000Z
2022-03-18T11:18:17.000Z
src/main/java/de/kosit/validationtool/daemon/ConfigHandler.java
itplr-kosit/validator
7bffb32eb633ec583df9bdd0587e44e5b7d1fdc8
[ "Apache-2.0" ]
77
2018-03-19T07:54:28.000Z
2022-03-03T21:43:21.000Z
src/main/java/de/kosit/validationtool/daemon/ConfigHandler.java
itplr-kosit/validator
7bffb32eb633ec583df9bdd0587e44e5b7d1fdc8
[ "Apache-2.0" ]
24
2018-03-15T12:01:40.000Z
2022-01-20T09:40:43.000Z
33.0625
130
0.68368
998,560
/* * Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * * 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.kosit.validationtool.daemon; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringWriter; import java.net.URI; import java.util.List; import java.util.Optional; import org.apache.commons.io.IOUtils; import com.sun.net.httpserver.HttpExchange; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import de.kosit.validationtool.api.Configuration; import de.kosit.validationtool.config.Keys; import de.kosit.validationtool.impl.ConversionService; import de.kosit.validationtool.model.scenarios.Scenarios; /** * Handler that returns the actual configuration used for this daemon instance. * * @author Andreas Penski */ @Slf4j @RequiredArgsConstructor class ConfigHandler extends BaseHandler { private final List<Configuration> configuration; private final ConversionService conversionService; @Override public void handle(final HttpExchange exchange) throws IOException { try { final Optional<String> xml = getSource(); if (xml.isPresent()) { write(exchange, xml.get().getBytes(), APPLICATION_XML); } else { error(exchange, 404, "No configuration found"); } } catch (final Exception e) { log.error("Error grabbing configuration", e); error(exchange, 500, "Error grabbing configuration: " + e.getMessage()); } } private Optional<String> getSource() { final URI fileUri = (URI) this.configuration.get(0).getAdditionalParameters().get(Keys.SCENARIOS_FILE); return fileUri != null ? loadFile(fileUri) : loadFromConfig(); } private static Optional<String> loadFile(final URI fileUri) { try ( final Reader in = new InputStreamReader(fileUri.toURL().openStream()); final StringWriter out = new StringWriter() ) { IOUtils.copy(in, out); return Optional.of(out.toString()); } catch (final IOException e) { return Optional.empty(); } } private Optional<String> loadFromConfig() { final Optional<String> result; final Scenarios scenarios = (Scenarios) this.configuration.get(0).getAdditionalParameters().get(Keys.SCENARIO_DEFINITION); if (scenarios != null) { final String s = this.conversionService.writeXml(scenarios); result = Optional.of(s); } else { result = Optional.empty(); } return result; } }
9238c34f6957ccf9451e47e1c3ed54cd34ecf3c7
3,029
java
Java
org/apache/poi/xssf/usermodel/XSSFMap.java
AlhonGelios/AO
3e78fefe875ab102016e1259874886970e3c5c2a
[ "Apache-2.0" ]
null
null
null
org/apache/poi/xssf/usermodel/XSSFMap.java
AlhonGelios/AO
3e78fefe875ab102016e1259874886970e3c5c2a
[ "Apache-2.0" ]
null
null
null
org/apache/poi/xssf/usermodel/XSSFMap.java
AlhonGelios/AO
3e78fefe875ab102016e1259874886970e3c5c2a
[ "Apache-2.0" ]
null
null
null
31.226804
101
0.641466
998,561
package org.apache.poi.xssf.usermodel; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.Internal; import org.apache.poi.xssf.model.MapInfo; import org.apache.poi.xssf.model.SingleXmlCells; import org.apache.poi.xssf.usermodel.XSSFRelation; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFTable; import org.apache.poi.xssf.usermodel.helpers.XSSFSingleXmlCell; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMap; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSchema; import org.w3c.dom.Node; public class XSSFMap { private CTMap ctMap; private MapInfo mapInfo; public XSSFMap(CTMap ctMap, MapInfo mapInfo) { this.ctMap = ctMap; this.mapInfo = mapInfo; } @Internal public CTMap getCtMap() { return this.ctMap; } @Internal public CTSchema getCTSchema() { String schemaId = this.ctMap.getSchemaID(); return this.mapInfo.getCTSchemaById(schemaId); } public Node getSchema() { Node xmlSchema = null; CTSchema schema = this.getCTSchema(); xmlSchema = schema.getDomNode().getFirstChild(); return xmlSchema; } public List getRelatedSingleXMLCell() { ArrayList relatedSimpleXmlCells = new ArrayList(); int sheetNumber = this.mapInfo.getWorkbook().getNumberOfSheets(); for(int i = 0; i < sheetNumber; ++i) { XSSFSheet sheet = this.mapInfo.getWorkbook().getSheetAt(i); Iterator i$ = sheet.getRelations().iterator(); while(i$.hasNext()) { POIXMLDocumentPart p = (POIXMLDocumentPart)i$.next(); if(p instanceof SingleXmlCells) { SingleXmlCells singleXMLCells = (SingleXmlCells)p; Iterator i$1 = singleXMLCells.getAllSimpleXmlCell().iterator(); while(i$1.hasNext()) { XSSFSingleXmlCell cell = (XSSFSingleXmlCell)i$1.next(); if(cell.getMapId() == this.ctMap.getID()) { relatedSimpleXmlCells.add(cell); } } } } } return relatedSimpleXmlCells; } public List getRelatedTables() { ArrayList tables = new ArrayList(); Iterator i$ = this.mapInfo.getWorkbook().iterator(); while(i$.hasNext()) { Sheet sheet = (Sheet)i$.next(); Iterator i$1 = ((XSSFSheet)sheet).getRelationParts().iterator(); while(i$1.hasNext()) { POIXMLDocumentPart.RelationPart rp = (POIXMLDocumentPart.RelationPart)i$1.next(); if(rp.getRelationship().getRelationshipType().equals(XSSFRelation.TABLE.getRelation())) { XSSFTable table = (XSSFTable)rp.getDocumentPart(); if(table.mapsTo(this.ctMap.getID())) { tables.add(table); } } } } return tables; } }
9238c37b07b77fff7ff8a155848924caf6887009
19,399
java
Java
modules/bootstrap/src/main/java/org/xito/boot/BootSecurityManager.java
drichan/xito
811f29e8ecda8072ce2a0eb4373ec16f6b083c99
[ "Apache-2.0" ]
null
null
null
modules/bootstrap/src/main/java/org/xito/boot/BootSecurityManager.java
drichan/xito
811f29e8ecda8072ce2a0eb4373ec16f6b083c99
[ "Apache-2.0" ]
null
null
null
modules/bootstrap/src/main/java/org/xito/boot/BootSecurityManager.java
drichan/xito
811f29e8ecda8072ce2a0eb4373ec16f6b083c99
[ "Apache-2.0" ]
1
2018-10-19T07:49:02.000Z
2018-10-19T07:49:02.000Z
33.146758
156
0.600391
998,562
// Copyright 2007 Xito.org // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // 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.xito.boot; import java.awt.*; import java.awt.event.*; import java.text.*; import java.util.*; import java.util.logging.*; import java.lang.ref.*; import javax.swing.*; import java.security.*; import org.xito.boot.util.*; /** * <p> * Security manager for bootstrap environment. * </p> * <p> * The security manager tracks windows created by an * application, allowing those windows to be disposed when the * application exits but the JVM does not. If security is not * enabled then the first application to call System.exit will * halt the JVM. * </p> * <p> * Some functionality in this Security Manager is derived from the Security Manager * found at netx project on SourceForge created by Jon Maxwell * </p> * * @author <a href="mailto:lyhxr@example.com">Deane Richan</a> * @author <a href="mailto:upchh@example.com">Jon A. Maxwell (JAM)</a> - initial author * @version $Revision: 1.32 $ */ public class BootSecurityManager extends SecurityManager { private Class exitClass = null; private Vector weakWindows = new Vector(); //have to use real vector because of change from 1.4.2 to 1.4.2_08 and 1.5 private WeakVector weakApplications = new WeakVector(); /** listener installs the app's classloader on the event dispatch thread */ private SecurityWindowListener windowListener = new SecurityWindowListener(); private WeakReference activeApplication; public static final String XITO_SECURITY_LOG_CAT = "xito.security"; protected static final Logger securityLogger = Logger.getLogger(XITO_SECURITY_LOG_CAT); /** * Creates a SecurityManager. */ public BootSecurityManager() { super(); // this has the side-effect of creating the Swing shared Frame // owner. Since no application is running at this time, it is // not added to any window list when checkTopLevelWindow is // called for it (and not disposed). } /** * Returns whether the exit class is present on the stack, or * true if no exit class is set. */ private boolean isExitClass(Class stack[]) { if (exitClass == null) return false; for (int i=0; i < stack.length; i++) if (stack[i] == exitClass) return true; return false; } /** * Returns true if the Class item is on the Stack */ private boolean isOnStack(Class stack[], Class item) { for (int i=0; i < stack.length; i++) if (stack[i] == item) return true; return false; } /** * Returns true if the Class Name item is on the Stack * @param * @param className is a full class name or can end in * */ private boolean isOnStack(Class stack[], String className) { boolean useWildCard = false; if(className.endsWith("*")) { useWildCard = true; className = className.substring(0,className.lastIndexOf('*')-1); } for (int i=0; i < stack.length; i++) { if(useWildCard){ if (stack[i].getName().startsWith(className)) return true; } else { if (stack[i].getName().equals(className)) return true; } } return false; } /** * Set the exit class, which is the only class that can exit the * JVM; if not set then any class can exit the JVM. * * @param exitClass the exit class * @throws IllegalStateException if the exit class is already set */ public void setExitClass(Class exitClass) throws IllegalStateException { if (this.exitClass != null) throw new IllegalStateException("Exit Class already set"); this.exitClass = exitClass; } /** * Get the exit class, which is the only class that can exit the * JVM; if not set then any class can exit the JVM. * */ protected Object getExitClass() { return this.exitClass; } /** * Return the current Application, or null if none can be * determined. */ public AppInstance getApplication() { return getApplication(getClassContext()); } /** * Return the application the opened the specified window (only * call from event dispatch thread). */ protected AppInstance getApplication(Window window) { Iterator it = weakApplications.iterator(); while(it.hasNext()) { AppInstance app = (AppInstance)it.next(); if(app == null) { it.remove(); continue; } WeakVector windows = app.getWindows(); for(int i=0;i<windows.size();i++) { Object w = windows.get(i); if(w != null && w == window) return app; } } return null; } /** * Return the current Application, or null. */ protected AppInstance getApplication(final Class stack[]) { AppInstance app = (AppInstance)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // this needs to be tightened up for (int i=0; i < stack.length; i++) { ClassLoader loader = stack[i].getClassLoader(); if (loader instanceof AppClassLoader) { AppClassLoader apploader = (AppClassLoader)loader; if (apploader.getAppInstance() != null) { return apploader.getAppInstance(); } } } return null; } }); return app; } /** * Returns the application's thread group if the application can * be determined; otherwise returns super.getThreadGroup() */ public ThreadGroup getThreadGroup() { AppInstance app = getApplication(); if (app == null) return super.getThreadGroup(); return app.getThreadGroup(); } /** * Throws a SecurityException if the permission is denied, * otherwise return normally. This method always denies * permission to change the security manager or policy. */ public void checkPermission(final Permission perm) { //First ask the Super if this permission is allowed SecurityException exp = null; try { super.checkPermission(perm); } catch(SecurityException secExp) { exp = secExp; } //Check to see if they are trying to Change Security Manager if(perm.getName().equals("setSecurityManager") && Boot.isLaunchingExternal()==false) { showSetSecurityManagerWarning(); //Throw an exception throw new SecurityException("Application not allowed to change Security Manager"); } //Throw the original Expception if(exp != null) { throw exp; } } /** * Prompt the user to grant permission for an action. This can only be called from Trusted code * If this method returns true then the user granted permission and the Trusted code can perform * an operation on behalf of untrusted code * * @param subtitle for org.xito * @param msg for org.xito * @param perm to be granted * @param execDesc of the App requesting the Grant */ public boolean promptForPermission(String subtitle, String msg, Permission perm, ExecutableDesc execDesc) { try { super.checkPermission(new AllPermission()); } catch(SecurityException secExp) { //this is ok it means the caller is not trusted so just return false return false; } //Must be using Boot Policy if(!(Policy.getPolicy() instanceof BootPolicy)) { return false; } return ((BootPolicy)Policy.getPolicy()).promptForPermission(subtitle, msg, perm, execDesc); } /** * Show a Warning about setting a Security Manager in the Shared VM */ private void showSetSecurityManagerWarning() { if(Boot.isHeadless() == true) return; String title = Resources.bundle.getString("boot.security.warning.title"); title = java.text.MessageFormat.format(title, Boot.getAppDisplayName()); String subtitle = Resources.bundle.getString("boot.security.manager.changed.subtitle"); String msg = Resources.bundle.getString("boot.security.manager.changed.msg"); msg = java.text.MessageFormat.format(msg, Boot.getAppDisplayName()); Boot.showError(title,subtitle,msg, null); } /** * Show a warning message about the security violation */ private void showSecurityViolation(final Permission permission) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String permissionName = null; if(permission != null) permissionName = permission.toString(); JOptionPane.showMessageDialog(null, "Security Violation: "+ permissionName +" caused by: unknown", "Security Violation", JOptionPane.OK_OPTION); return null; } }); return; } /** * Checks whether the window can be displayed without an * warning banner, and adds the window to the list of windows to * be disposed when the calling application exits. */ public boolean checkTopLevelWindow(Object window) { //If prompting user then pause until finished /* AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Policy policy = Policy.getPolicy(); if(policy instanceof BootPolicy) { Thread promptThread = ((BootPolicy)policy).getPromptThread(); if(promptThread != null && promptThread.isAlive() && promptThread != Thread.currentThread()) { try { promptThread.join(); } catch(InterruptedException exp) { securityLogger.log(Level.SEVERE, exp.getMessage(), exp); } } } return null; } }); */ weakWindows.add(window); AppInstance app = getApplication(); // remember window -> application mapping for focus, close on exit if (app != null && window instanceof Window) { Window w = (Window) window; weakApplications.add(app); w.addWindowListener(windowListener); // for dynamic context classloader app.addWindow(w); } // change coffee cup to app default icon ImageIcon icon = Boot.getAppIcon(); if ((window instanceof Window) && (icon != null)) { Window w = (Window)window; while(w != null) { if (w instanceof Frame) { ((Frame)w).setIconImage(icon.getImage()); } w = ((Window)w).getOwner(); } } return super.checkTopLevelWindow(window); } /** * Checks to see if a Window has been created since the Security Manager was Started * If there is not a visible window then the BootStrap may use this information to * end the Session */ protected boolean checkWindowVisible() { //Check All Windows for(int i=0;i<weakWindows.size();i++) { Window w = (Window)weakWindows.get(i); if(w != null && w.isVisible()) { return true; } } //Check Boot Context Frames Frame frames[] = Frame.getFrames(); for(int i=0;i<frames.length;i++) { if(frames[i].isVisible()) return true; } //If we make it down here then there are no visible windows return false; } /** * Checks whether the caller can exit the VM. In this implementation only the ExitClass or the Boot class * have permission to Exit the VM. If another application attempts to exit the VM the Application will be * Identified by searching the classloaders of the call Stack and then the App will be destroyed. * If the call to checkExit is not done via the Runtime class then checkExit will behave the same as the default * security manager */ public void checkExit(int status) { //Check to see if we are in Launch External mode if so then Anybody can exit the VM so just return if(Boot.isLaunchingExternal()) { return; } //Check to see if Runtime is actually trying to exit the VM or is //Somebody just calling SecurityManager.checkVM like JFrame does when setDefaultCloseOperation is called Class stack[] = getClassContext(); boolean realCall = false; if(isOnStack(stack, Runtime.class)) { realCall = true; } //If not a real call just let Super implementation handle it if(realCall == false) { //Check for JFrame or Frame on the Stack if(isOnStack(stack, java.awt.Frame.class)) { return; } else if(isOnStack(stack, javax.swing.JFrame.class)) { return; } else { super.checkExit(status); return; } } //First see if the Exit Class is on the Stack if so then its ok to exit if(isExitClass(stack)) { return; } //Check to see if Boot is on the Stack if so then it is ok to exit if(isOnStack(stack, Boot.class)) { return; } //Check to see if Apple Application on Stack //if exit called from com.apple.eawt.Application then user clicked quit from App Menu if(isOnStack(stack, "com.apple.eawt.Application*")) return; //Now check to see if we should destroy a running App // but when they really call, stop only the app instead of the JVM AppInstance app = getApplication(stack); //At this point we can't tell what to do. This could happen if the App is using //setDefaultCloseOperation on Frame or JFrame set to Exit VM //In such a case we can't tell which app is trying to Exit //So we assume the Active Application based on last active Window is the App if (app == null) { app = windowListener.getActiveApplication(); } //Now attempt to Destory the Application if (app != null) { app.destroy(); throw new SecurityException("Exit VM not allowed by this application"); } if(checkWindowVisible()) { securityLogger.info("Some Visible Apps are still active. Not shutting down VM"); throw new SecurityException("Exit VM not allowed by this application"); } else if(Boot.isHeadless()==false) { //shutdown because all visible Windows have been disposed securityLogger.info("Shutting Down because all Visible UI has been disposed!"); return; } //Finally Check permissions by calling super super.checkExit(status); } /** * Throws a <code>SecurityException</code> if the * calling thread is not allowed to dynamic link the library code * specified by the string argument file. The argument is either a * simple library name or a complete filename. * <p> * This method is invoked for the current security manager by * methods <code>load</code> and <code>loadLibrary</code> of class * <code>Runtime</code>. * <p> * This method calls <code>checkPermission</code> with the * <code>RuntimePermission("loadLibrary."+lib)</code> permission. * <p> * If you override this method, then you should make a call to * <code>super.checkLink</code> * at the point the overridden method would normally throw an * exception. * * @param lib the name of the library. * @exception SecurityException if the calling thread does not have * permission to dynamically link the library. * @exception NullPointerException if the <code>lib</code> argument is * <code>null</code>. * @see java.lang.Runtime#load(java.lang.String) * @see java.lang.Runtime#loadLibrary(java.lang.String) * @see #checkPermission(java.security.Permission) checkPermission */ public void checkLink(String lib) { Class[] execStack = getClassContext(); for(int i=0;i<execStack.length;i++) { //Skip these classes on the Stack if(execStack[i] == this.getClass()) continue; if(execStack[i] == Runtime.class) continue; if(execStack[i] == System.class) continue; //See if a System class is trying to load the library if(execStack[i].getClassLoader() == ClassLoader.getSystemClassLoader()) { super.checkLink(lib); return; } } //Thread.dumpStack(); super.checkLink(lib); } /***************************************************** * Listener for Windows *****************************************************/ private class SecurityWindowListener extends WindowAdapter { private WeakReference activeApplication; /** * Get the currently know application based on last window Active */ public AppInstance getActiveApplication() { if(activeApplication != null) return (AppInstance)activeApplication.get(); else return null; } public void windowActivated(WindowEvent e) { AppInstance app = getApplication(e.getWindow()); if(app != null) { activeApplication = new WeakReference(app); } else { activeApplication = null; } } public void windowDeactivated(WindowEvent e) { activeApplication = null; } public void windowClosed(WindowEvent e) { AppInstance closingApp = getApplication(e.getWindow()); if(closingApp == null) return; WeakVector windows = closingApp.getWindows(); Iterator it = windows.iterator(); boolean openWindows = false; while(it.hasNext()) { Window w = (Window)it.next(); if(w != null && w.isDisplayable()) openWindows = true; } //If no open windows check active threads and exit VM if we should if(openWindows == false) { if(Boot.isHeadless() == false && Boot.isLaunchingExternal()) { Boot.endSession(true); return; } } } }; }
9238c3f6fb993622f0f4711349befa2a1051dd22
1,521
java
Java
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RemoteIterator.java
DadanielZ/hadoop
4a70a0d81601f20ba8cecb37fae12b6a8be327b4
[ "Apache-2.0" ]
14,425
2015-01-01T15:34:43.000Z
2022-03-31T15:28:37.000Z
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RemoteIterator.java
DadanielZ/hadoop
4a70a0d81601f20ba8cecb37fae12b6a8be327b4
[ "Apache-2.0" ]
3,805
2015-03-20T15:58:53.000Z
2022-03-31T23:58:37.000Z
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RemoteIterator.java
DadanielZ/hadoop
4a70a0d81601f20ba8cecb37fae12b6a8be327b4
[ "Apache-2.0" ]
9,521
2015-01-01T19:12:52.000Z
2022-03-31T03:07:51.000Z
35.372093
75
0.731755
998,563
/** * 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.hadoop.fs; import java.io.IOException; import java.util.NoSuchElementException; /** * An iterator over a collection whose elements need to be fetched remotely */ public interface RemoteIterator<E> { /** * Returns <tt>true</tt> if the iteration has more elements. * * @return <tt>true</tt> if the iterator has more elements. * @throws IOException if any IO error occurs */ boolean hasNext() throws IOException; /** * Returns the next element in the iteration. * * @return the next element in the iteration. * @throws NoSuchElementException iteration has no more elements. * @throws IOException if any IO error occurs */ E next() throws IOException; }
9238c4d652e814b9ccb2a6c59c312d3fb28088d9
1,938
java
Java
src/main/java/com/sunnsoft/sloa/actions/system/Login.java
seed-age/circulate
dc66e5450922afcad021833091f9b23fa4580c74
[ "Info-ZIP" ]
1
2019-08-14T08:29:34.000Z
2019-08-14T08:29:34.000Z
src/main/java/com/sunnsoft/sloa/actions/system/Login.java
seed-age/circulate
dc66e5450922afcad021833091f9b23fa4580c74
[ "Info-ZIP" ]
null
null
null
src/main/java/com/sunnsoft/sloa/actions/system/Login.java
seed-age/circulate
dc66e5450922afcad021833091f9b23fa4580c74
[ "Info-ZIP" ]
null
null
null
24.225
131
0.75903
998,564
package com.sunnsoft.sloa.actions.system; import com.opensymphony.xwork2.ActionSupport; import com.sunnsoft.sloa.config.Config; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; import org.springframework.security.web.csrf.CsrfToken; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Login extends ActionSupport implements ServletResponseAware,ServletRequestAware{ /** * */ private static final long serialVersionUID = 1L; private HttpServletResponse response; private HttpServletRequest request; private Config config; public void setConfig(Config config) { this.config = config; } public String getPublicKey(){ return this.config.getLoginPublicKey(); } private String error; public String getError() { return error; } public void setError(String error) { this.error = error; } private boolean logout; public boolean isLogout() { return logout; } public void setLogout(boolean logout) { this.logout = logout; } @Override public void setServletResponse(HttpServletResponse response) { this.response = response; } @Override public String execute() throws Exception { this.response.addHeader("ext-login", "true");//重要,如果登录系统后,用户session失效后点击按钮会跳到Login页面,EXT的ajax功能通过此request head 初始化内部登录框。 if(this.logout){ this.response.addHeader("ext-logout", "true");//重要,在csrf模式下只能post提交请求,因此该标记表示当前动作是登录,此时应该reload浏览器地址自动跳转到登陆页面,此问题只有使用extjs框架才会有。 } Object csrf =request.getAttribute("_csrf"); if( csrf != null && csrf instanceof CsrfToken){ this.response.addHeader("X-CSRF-TOKEN", ((CsrfToken)csrf).getToken()); } if(this.error != null){ this.response.addHeader("ext-error", this.error);//根据不同错误弹出不同的提示。 } return "success"; } @Override public void setServletRequest(HttpServletRequest request) { this.request = request; } }
9238c506f9388d30aa9bbe42143bcfb7985c0a12
8,088
java
Java
src/automationTask2022/automateTaskSteps.java
FzArnob/automationTask2022
434ce589201a9d7df9f4544730b6719a13f98b5f
[ "MIT" ]
null
null
null
src/automationTask2022/automateTaskSteps.java
FzArnob/automationTask2022
434ce589201a9d7df9f4544730b6719a13f98b5f
[ "MIT" ]
null
null
null
src/automationTask2022/automateTaskSteps.java
FzArnob/automationTask2022
434ce589201a9d7df9f4544730b6719a13f98b5f
[ "MIT" ]
null
null
null
26.535948
108
0.660468
998,565
package automationTask2022; import org.apache.commons.io.FileUtils; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.sql.Timestamp; import java.util.Date; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.opera.OperaDriver; import org.openqa.selenium.remote.DesiredCapabilities; public class automateTaskSteps { public static WebDriver driver; public static String Rdir; public static String Rname; public static String St; public static int ssCount; public static void sleep(int ms){ try { Thread.sleep(ms); } catch(InterruptedException e) { e.printStackTrace(); } } public static void writeFile(String value){ String PATH = System.getProperty("user.dir")+"/reports/"; String directoryName = PATH.concat(Rdir); String fileName = "log "+Rname + ".txt"; File directory = new File(directoryName); if (! directory.exists()){ directory.mkdirs(); } File file = new File(directoryName + "/" + fileName); try{ FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); BufferedWriter bw = new BufferedWriter(fw); bw.write(value); bw.close(); } catch (IOException e){ e.printStackTrace(); System.exit(-1); } } public static String getTimeStamp() { Date date= new Date(); long time = date.getTime(); Timestamp ts = new Timestamp(time); String res = String.valueOf(ts).replace(":", "_"); return " "+res; } public static void takeScreenShot(String filename) throws IOException { File file = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(file, new File(System.getProperty("user.dir")+"/reports/"+Rdir+"/"+filename+".png")); } public static void reportLog(String log) throws IOException { System.out.println(log); writeFile("Step_"+String.valueOf(ssCount)+"\n"+log+"\n\n"); takeScreenShot("Step_"+String.valueOf(ssCount)+" ss "+getTimeStamp()); ssCount++; } public static WebDriver LoadSiteInChrome() { // setting browser driver property System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"/Drivers/chromedriver.exe"); WebDriver driver = new ChromeDriver(); // Task 1 driver.get("http://automationpractice.com/index.php"); // initiate report St = getTimeStamp(); Rname = St; Rdir = "Chrome report"+St; ssCount = 1; return driver; } public static WebDriver LoadSiteInFirefox() { // setting browser driver property System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"/Drivers/geckodriver.exe"); WebDriver driver = new FirefoxDriver(); // Task 1 driver.get("http://automationpractice.com/index.php"); // initiate report St = getTimeStamp(); Rname = St; Rdir = "Firefox report"+St; ssCount = 1; return driver; } public static WebDriver LoadSiteInOpera() { // setting browser driver propertySystem.setProperty("webdriver.opera.driver", "E:\\operadriver.exe"); // it will open the opera browser System.setProperty("webdriver.opera.driver", System.getProperty("user.dir")+"/Drivers/operadriver97.exe"); WebDriver driver = new OperaDriver(); // Task 1 driver.get("http://automationpractice.com/index.php"); // initiate report St = getTimeStamp(); Rname = St; Rdir = "Opera report"+St; ssCount = 1; return driver; } public static void task2(String[] userData) throws IOException { // Task 2 System.out.println("// Create user account test"); // Create user account test createAccount user = new createAccount(driver); reportLog(user.createAccountWithData(userData)); } public static void task3to7(String[] loginData) throws IOException { // Task 3 System.out.println("// Log into user account test"); // Log into user account test loginUser login = new loginUser(driver); reportLog(login.loginWithData(loginData)); // Task 4 System.out.println("// Casual Dresses Section"); // Casual Dresses Section casualDressesSection cdress = new casualDressesSection(driver); // goto Casual Dresses with url // reportLog(cdress.gotoSection(true)); // user interaction click reportLog(cdress.gotoSection(false)); // parameter <true> for checking with url // add dress to cart reportLog(cdress.addDressToCart()); // // Task 5 System.out.println("// T-shirts Section"); // T-shirts Section tShirtSection tshirt = new tShirtSection(driver); // goto T-shirt with url // reportLog(tshirt.gotoSection(true)); // user interaction click // add filter by clicking the color text System.out.println("// case 01: add filter by clicking the 'Blue' text"); reportLog(tshirt.gotoSection(false)); // parameter <true> for checking with url reportLog(tshirt.addColorFilter("Blue")); // add filter by clicking the color box System.out.println("// case 02: add filter by clicking the Blue text"); reportLog(tshirt.gotoSection(false)); // parameter <true> for checking with url reportLog(tshirt.addColorFilter("Blue", 14)); // add t-shirt to cart reportLog(tshirt.addTShirtToCart(0)); // Task 6 System.out.println("// Checkout Section"); // Checkout Section checkoutSection checkout = new checkoutSection(driver); // goto checkout with url // reportLog(checkout.gotoCheckout(true)); // user interaction click reportLog(checkout.gotoCheckout(false)); reportLog(checkout.submitSummary()); reportLog(checkout.submitAddress()); reportLog(checkout.submitShipping()); reportLog(checkout.submitPayment("cheque")); reportLog(checkout.confirmOrder()); // Task 7 System.out.println("// Sign out Section"); // Sign out Section signoutUser signoutSection = new signoutUser(driver); reportLog(signoutSection.signOut()); } public static void main(String[] args) throws IOException { // 1st account // Format: // {"String email", // "String gender", // "String fname", // "String lname", // "String pass", // "String bday", // "String bmonth", // "String byear", // "String newsletter", // "String offers", // "String company", // "String address1", // "String address2", // "String city", // "String state", // "String zip", // "String country", // "String addinfo", // "String hphone", // "String mphone", // "String alias"} String[] userData1 = { "hzdkv@example.com", // change the numbers in email to test new data "1", "John", "Kobber", "12345", "3", "9", "1999", "true", "true", "FINIEN", "4578 ", "Young Road", "Wilder", "Idaho", "83676", "United States", "Graphics Designer", "208-482-8798", "208-579-8139", "Office Address" }; String[] loginData1 = { "hzdkv@example.com", // change the numbers in email to test new data "12345" }; String[] userData2 = { "anpch@example.com", "2", "Peny", "Modreguz", "abcde", "13", "7", "1999", "true", "true", "FINIEN", "4578 ", "Young Road", "Wilder", "Idaho", "83676", "United States", "Visual Artist", "208-482-8798", "208-579-8139", "Office Address" }; String[] loginData2 = { "anpch@example.com", "abcde" }; // Task 1 // Compatibility testing with different browsers (Select one for test) // driver = LoadSiteInChrome(); // driver = LoadSiteInFirefox(); driver = LoadSiteInOpera(); // Create two accounts task2(userData1); // Sign out to test new data new signoutUser(driver).signOut(); task2(userData2); // Sign out to test new data new signoutUser(driver).signOut(); // Test Scenario for both users task3to7(loginData1); task3to7(loginData2); driver.quit(); } }
9238c518a4daebc61f592ddff06b7c02713ec1b4
856
java
Java
tests/src/test/java/com/github/tommyettinger/bitnucleus/structs/Junk.java
tommyettinger/BitNucleus
6473257586243e62384104049361b99b621f499d
[ "Apache-2.0" ]
3
2019-02-14T08:14:29.000Z
2019-03-25T07:40:12.000Z
tests/src/test/java/com/github/tommyettinger/bitnucleus/structs/Junk.java
tommyettinger/BitNucleus
6473257586243e62384104049361b99b621f499d
[ "Apache-2.0" ]
null
null
null
tests/src/test/java/com/github/tommyettinger/bitnucleus/structs/Junk.java
tommyettinger/BitNucleus
6473257586243e62384104049361b99b621f499d
[ "Apache-2.0" ]
null
null
null
25.939394
71
0.654206
998,566
package com.github.tommyettinger.bitnucleus.structs; import com.github.tommyettinger.bitnucleus.JunkEnum; /** * Bits used: 8 / 8 * <br> response [0..2] * <br> count [2..8] */ public final class Junk { private static final JunkEnum[] $VALUES$response = JunkEnum.values(); public static JunkEnum response(byte junk) { return $VALUES$response[(int)(junk & 0b00000011)]; } public static byte response(byte junk, JunkEnum value) { return (byte)((junk & 0b00000011) | ((byte)value.ordinal())); } public static int count(byte junk) { return (int)((junk >>> 2) & 0b00111111); } public static byte count(byte junk, int value) { return (byte)((junk & 0b11111100) | ((byte)value << 2)); } public static byte get(JunkEnum response, int count) { return (byte)(((byte)response.ordinal()) | ((byte)count << 2)); } }
9238c6eabcbe5a58acd212abe6eab1104cbcedc6
12,587
java
Java
library/src/main/java/com/devil/library/video/ui/DVVideoCropActivity.java
GuangNian10000/DVMediaSelector-2.1.0
2bc06f7c306e75e398a578dd657efb8eb1ad6066
[ "Apache-2.0" ]
1
2021-11-17T01:30:18.000Z
2021-11-17T01:30:18.000Z
library/src/main/java/com/devil/library/video/ui/DVVideoCropActivity.java
GuangNian10000/DVMediaSelector-2.1.0
2bc06f7c306e75e398a578dd657efb8eb1ad6066
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/devil/library/video/ui/DVVideoCropActivity.java
GuangNian10000/DVMediaSelector-2.1.0
2bc06f7c306e75e398a578dd657efb8eb1ad6066
[ "Apache-2.0" ]
null
null
null
33.836022
183
0.573528
998,567
package com.devil.library.video.ui; import android.app.Activity; import android.content.Intent; import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.Bundle; import android.os.Looper; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import android.text.TextUtils; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.Toast; import com.devil.library.media.R; import com.devil.library.media.utils.FileUtils; import com.devil.library.media.view.TipLoadDialog; import com.devil.library.video.listener.OnVideoTrimListener; import com.devil.library.video.utils.MeasureHelper; import com.devil.library.video.view.DVVideoView; import com.devil.library.video.view.VideoCropView; import com.miyouquan.library.DVPermissionUtils; import java.io.File; import VideoHandle.EpEditor; import VideoHandle.EpVideo; import VideoHandle.OnEditorListener; /** * 视频裁剪界面 */ public class DVVideoCropActivity extends AppCompatActivity implements View.OnClickListener{ /**监听回调*/ public static OnVideoTrimListener videoTrimListener; //上下文 private Activity mActivity; //视频地址 private String videoPath; //视频剪辑保存地址(调用者传入,可以只给地址,不需要先创建文件) private String savePath; //文件最终保存的地址 private File saveFile; //宽高比中的宽 private int widthRatio; //宽高比中的高 private int heightRatio; //视频真实高度 private float videoRealHeight; //视频真实宽度 private float videoRealWidth; //裁剪框 private VideoCropView view_crop; //视频播放view private DVVideoView mVideoView; //加载框 private TipLoadDialog loadDialog; //确定按钮 private Button btn_sure; //返回按钮 private Button btn_back; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; fullScreen(); setContentView(R.layout.activity_dv_crop_video); initView(); initData(); } /** * 全屏 */ private void fullScreen(){ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } /** * 初始化view */ private void initView(){ view_crop = findViewById(R.id.view_crop); view_crop.setCanEdit(false); // ImageUtils.setWidthHeightWithRatio(view_crop, ScreenUtils.getScreenWidth(mActivity),16,9); mVideoView = findViewById(R.id.mVideoView); mVideoView.setDragEnable(true); mVideoView.setZoomEnable(true); mVideoView.setLoop(true); btn_sure = findViewById(R.id.btn_sure); btn_back = findViewById(R.id.btn_back); btn_sure.setOnClickListener(this); btn_back.setOnClickListener(this); } /** * 初始化数据 */ private void initData(){ Intent intent = getIntent(); videoPath = intent.getStringExtra("videoPath"); savePath = intent.getStringExtra("savePath"); widthRatio = intent.getIntExtra("widthRatio",16); heightRatio = intent.getIntExtra("heightRatio",9); if (TextUtils.isEmpty(videoPath)){ showMessage("请先传入视频地址,再打开裁剪界面"); finish(); // throw new RuntimeException("请先传入视频地址,再打开裁剪界面"); } String backTitle = intent.getStringExtra("backTitle"); String sureTitle = intent.getStringExtra("sureTitle"); //设置返回标题 if (!TextUtils.isEmpty(backTitle)){ btn_back.setText("" + backTitle); } //设置确定标题 if(!TextUtils.isEmpty(sureTitle)){ btn_sure.setText("" + sureTitle); } //获取视频宽高 MediaMetadataRetriever retriever = new MediaMetadataRetriever(); retriever.setDataSource(videoPath); String height = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); String width = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); try { videoRealHeight = Float.parseFloat(height); videoRealWidth = Float.parseFloat(width); if (videoRealWidth > videoRealHeight){//横向视频 //把视频展示成widthRatio:heightRatio mVideoView.setHorizontalScaleType(MeasureHelper.SCREEN_SCALE_BY_SELF); mVideoView.setVideoRatio(widthRatio,heightRatio); }else{//竖向视频 //把视频展示成居中裁剪 mVideoView.setVerticalScaleType(MeasureHelper.SCREEN_SCALE_CENTER_CROP); } mVideoView.setVideoRealSize((int)videoRealWidth,(int) videoRealHeight); } catch (NumberFormatException e) { e.printStackTrace(); } retriever.release(); view_crop.post(()->{ float cropViewWidth = view_crop.getWidth(); float cropViewHeight = view_crop.getHeight(); float cropRectWidth = cropViewWidth; float cropRectHeight = cropRectWidth / widthRatio * heightRatio; float topMargin = cropViewHeight / 2 - cropRectHeight / 2; //设置裁剪框位置和大小 view_crop.setMargin(0,topMargin,0,topMargin); //视频控件移动 mVideoView.setCropToolLocation(new float[]{0,topMargin,cropRectWidth,cropRectHeight}); // //在view.post(Runable)里获取,即等布局变化后 // //裁剪框移动 // int[] renderLocation = mVideoView.getRenderLocation(); // int renderX = renderLocation[0]; // view距离 屏幕左边的距离(即x轴方向) // int renderY = renderLocation[1]; // view距离 屏幕顶边的距离(即y轴方向) // int[] renderSize = mVideoView.getRenderSize(); // int[] mVideoViewLocation = mVideoView.getLocation(); // int mVideoViewX = mVideoViewLocation[0]; // view距离 屏幕左边的距离(即x轴方向) // int mVideoViewY = mVideoViewLocation[1]; // view距离 屏幕顶边的距离(即y轴方向) // int[] mVideoViewSize = mVideoView.getSize(); // // int finalY = renderY > 0 ? renderY : mVideoViewY; // int finalHeight = renderSize[1] > mVideoViewSize[1] ? mVideoViewSize[1] : renderSize[1]; // //设置裁剪框上下滑动的距离 // view_crop.setOnlyMoveLimit(finalY,cropViewHeight - finalY - finalHeight); }); mVideoView.setVideoPath(videoPath); mVideoView.start(); } @Override protected void onDestroy() { super.onDestroy(); mVideoView.release(); if (videoTrimListener != null){ videoTrimListener = null; } } @Override public void onClick(View v) { if (v.getId() == R.id.btn_sure){//确定 //检查权限并开始 checkPermissionAndStart(); }else if(v.getId() == R.id.btn_back){//返回 if (videoTrimListener != null){ videoTrimListener.onVideoTrimCancel(); } finish(); } } /** * 检查权限并开始 */ private void checkPermissionAndStart(){ //判断是否有权限操作 String[] permissions = DVPermissionUtils.arrayConcatAll(DVPermissionUtils.PERMISSION_CAMERA,DVPermissionUtils.PERMISSION_FILE_STORAGE,DVPermissionUtils.PERMISSION_MICROPHONE); if (!DVPermissionUtils.verifyHasPermission(this,permissions)){ DVPermissionUtils.requestPermissions(this, permissions, new DVPermissionUtils.OnPermissionListener() { @Override public void onPermissionGranted() { //开始裁剪 startCrop(); } @Override public void onPermissionDenied() { showMessage(getString(R.string.permission_denied_tip)); finish(); } }); }else{ //开始裁剪 startCrop(); } } /** * 开始裁剪 */ private void startCrop(){ if (loadDialog == null){ loadDialog = new TipLoadDialog(this); loadDialog.setCancelable(false); loadDialog.setCanceledOnTouchOutside(false); } loadDialog.setMsgAndType("玩命裁剪中...",TipLoadDialog.ICON_TYPE_LOADING).show(); //开始裁剪 float finalX = 0; float finalY = 0; float finalWidth = 0; float finalHeight = 0; //获取裁剪框位置 float[] cutValue = view_crop.getCutValue(); float cutX = cutValue[0]; float cutY = cutValue[1]; float cutWidth = cutValue[2]; float cutHeight = cutValue[3]; //视频显示位置 int[] location = mVideoView.getRenderLocation(); float videoX = location[0]; float videoY = location[1]; // int[] size = mVideoView.getRenderSize(); // float videoWidth = size[0]; // float videoHeight = size[1]; //计算裁剪框在视频的位置 float[] sizeRatio = mVideoView.getSizeRatio(); float widthRatio = sizeRatio[0]; float heightRatio = sizeRatio[1]; finalX = (cutX - videoX) * widthRatio; finalY = (cutY - videoY) * heightRatio; finalWidth = cutWidth * widthRatio; finalHeight = cutHeight * heightRatio; if ((Math.abs(finalX) + finalWidth) > videoRealWidth){ finalX = 0; finalWidth = videoRealWidth; } if ((Math.abs(finalY) + finalHeight) > videoRealHeight){ finalY = 0; finalHeight = videoRealHeight; } //创建裁剪后保存的文件 saveFile = new File(savePath); if (saveFile.isDirectory()){ String finalSavePath = savePath + File.separator + System.currentTimeMillis() + File.separator + ".mp4"; saveFile = new File(finalSavePath); } FileUtils.createFile(saveFile); //开始裁剪 EpVideo epVideo = new EpVideo(videoPath); epVideo.crop((int)finalWidth,(int)finalHeight,(int)finalX,(int)finalY); EpEditor.OutputOption outputOption = new EpEditor.OutputOption(saveFile.getAbsolutePath()); EpEditor.exec(epVideo, outputOption, new OnEditorListener() { @Override public void onSuccess() { //回调 runOnUiThread(new Runnable() { @Override public void run() { //刷新媒体库 try { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri uri = Uri.fromFile(saveFile); intent.setData(uri); mActivity.sendBroadcast(intent); } catch (Exception e) { e.printStackTrace(); } loadDialog.dismiss(); if (videoTrimListener != null){ videoTrimListener.onVideoTrimSuccess(saveFile.getAbsolutePath()); }else{ showMessage("裁剪成功"); } loadDialog.dismiss(); finish(); } }); } @Override public void onFailure() { runOnUiThread(new Runnable() { @Override public void run() { if (videoTrimListener != null){ videoTrimListener.onVideoTrimError("裁剪失败"); }else{ showMessage("裁剪失败"); } loadDialog.dismiss(); } }); } @Override public void onProgress(final float progress) { //这里获取处理进度 // Log.d("VideoTrim","裁剪进度-->"+progress); runOnUiThread(new Runnable() { @Override public void run() { if (videoTrimListener != null){ videoTrimListener.onVideoTrimProgress(progress); } } }); } }); mVideoView.pause(); } /** * 显示提示信息 * @param message */ private void showMessage(final String message){ if (Looper.myLooper() == Looper.getMainLooper()){ Toast.makeText(mActivity,""+message,Toast.LENGTH_SHORT).show(); }else{ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(mActivity,""+message,Toast.LENGTH_SHORT).show(); } }); } } }
9238c7816571cd8f5b7987a79d84275f1ee49009
3,635
java
Java
Corpus/birt/1257.java
JamesCao2048/BlizzardData
a524bec4f0d297bb748234eeb1c2fcdee3dce7d7
[ "MIT" ]
1
2022-01-15T02:47:45.000Z
2022-01-15T02:47:45.000Z
Corpus/birt/1257.java
JamesCao2048/BlizzardData
a524bec4f0d297bb748234eeb1c2fcdee3dce7d7
[ "MIT" ]
null
null
null
Corpus/birt/1257.java
JamesCao2048/BlizzardData
a524bec4f0d297bb748234eeb1c2fcdee3dce7d7
[ "MIT" ]
null
null
null
27.961538
136
0.723521
998,568
/******************************************************************************* * Copyright (c) 2004 Actuate Corporation . * 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: * Actuate Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.birt.report.designer.internal.ui.editors.schematic.editpolicies; import java.util.ArrayList; import java.util.List; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.handles.ListBandHandle; import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPolicy; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.Request; import org.eclipse.gef.commands.Command; import org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy; import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gef.requests.CreateRequest; /** * add comment here * */ public class ListLayoutEditPolicy extends ConstrainedLayoutEditPolicy { /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createAddCommand(org.eclipse.gef.EditPart, * java.lang.Object) */ protected Command createAddCommand( EditPart child, Object constraint ) { // TODO Auto-generated method stub return null; } /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart, * java.lang.Object) */ protected Command createChangeConstraintCommand( EditPart child, Object constraint ) { // TODO Auto-generated method stub return null; } protected EditPolicy createChildEditPolicy( EditPart child ) { ReportElementResizablePolicy policy = new ReportElementResizablePolicy( ) { protected List createSelectionHandles( ) { List list = new ArrayList( ); //ResizableHandleKit.addMoveHandle((GraphicalEditPart)getHost(), // list); list.add( new ListBandHandle( (GraphicalEditPart) getHost( ) ) ); return list; } }; policy.setResizeDirections( PositionConstants.NONE ); return policy; } /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest) */ protected Command getCreateCommand( CreateRequest request ) { return null; } /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getDeleteDependantCommand(org.eclipse.gef.Request) */ protected Command getDeleteDependantCommand( Request request ) { return null; } /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#getResizeChildrenCommand(org.eclipse.gef.requests.ChangeBoundsRequest) */ protected Command getResizeChildrenCommand( ChangeBoundsRequest request ) { return null; } /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#getConstraintFor(org.eclipse.draw2d.geometry.Point) */ protected Object getConstraintFor( Point point ) { return null; } /* * (non-Javadoc) * * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#getConstraintFor(org.eclipse.draw2d.geometry.Rectangle) */ protected Object getConstraintFor( Rectangle rect ) { return null; } }
9238c7ab4c51c15e114f5abba28af7d1deadca6c
3,273
java
Java
out/production/final_team04/src/ooga/view/Display 8.java
roshnipen/scrolling_platform_game
baff827b9aa1fbbb990bf693fb60ed76b05d09ee
[ "MIT" ]
null
null
null
out/production/final_team04/src/ooga/view/Display 8.java
roshnipen/scrolling_platform_game
baff827b9aa1fbbb990bf693fb60ed76b05d09ee
[ "MIT" ]
null
null
null
out/production/final_team04/src/ooga/view/Display 8.java
roshnipen/scrolling_platform_game
baff827b9aa1fbbb990bf693fb60ed76b05d09ee
[ "MIT" ]
null
null
null
32.73
141
0.695386
998,569
package ooga.view; import javafx.scene.Group; import javafx.scene.Scene; import ooga.GameController; import ooga.GameEndStatus; import ooga.engine.games.GamePlay; import java.lang.reflect.Constructor; import java.util.ResourceBundle; import java.util.function.Consumer; import static ooga.view.Screen.DEFAULT_RESOURCE_PACKAGE; public class Display {//implements Viewer{ private static final ResourceBundle GAME_LABELS = ResourceBundle.getBundle(DEFAULT_RESOURCE_PACKAGE + "mainmenubuttons_eng");; private static final ResourceBundle LEVEL_FILE_LOCATIONS = ResourceBundle.getBundle("LevelFileLocations"); private GameController gameController; private GamePlayScreen gameScreen; private String gametitle; public Display(GameController gameController) { this.gameController = gameController; } public void setMainMenuScreen() { Screen screen = new MainMenuScreen(this::setGameMenuScreen); gameController.setScene(screen.getView()); } private void launchGame(String levelChosen) { String gameLevelComboChosen = String.format("%s,%s",gametitle,levelChosen); String filePath = LEVEL_FILE_LOCATIONS.getString(gameLevelComboChosen); gameController.launchGame(filePath); setGameDisplay(gameController.getGame()); } private void restartGame() { gameController.restartGame(); setGameDisplay(gameController.getGame()); } public void setGameDisplay(GamePlay newGame) { // public void setGameDisplay(GamePlay newGame, Consumer pause, Consumer play, Consumer restart) { // gameScreen = new GamePlayScreen(); gameScreen = new GamePlayScreen(newGame); // gameScreen = new GamePlayScreen(pause, play, restart); if (newGame !=null) { gameScreen.setGameScreen(newGame); } else { throw new RuntimeException("Game never defined"); //TODO maybe remove } gameController.setScene(gameScreen.getView()); } public void updateDisplay() { gameScreen.update();//TODo } public void setGameMenuScreen (String gameLabel) { //TODO this.gametitle = gameLabel; Screen gameMenu; String gameClassName = GAME_LABELS.getString(gameLabel); try { Constructor ruleCellTypeCons = Class.forName("ooga.view." + gameClassName + "MenuScreen").getDeclaredConstructor(Consumer.class); gameMenu = (Screen) ruleCellTypeCons.newInstance((Consumer<String>) this::launchGame); } catch (Exception er) { er.printStackTrace(); throw new RuntimeException ("Error in reflection");//TODO } gameController.setScene(gameMenu.getView()); } public void setSplashScreen(GameEndStatus displayKey) { SplashScreen resultScreen = new SplashScreen(displayKey,this::setMainMenuScreen,this::restartGame); gameController.setScene(resultScreen.getView()); } public void test() { Group root = new Group(); Scene scene = new Scene(root,500,500); gameController.setScene(scene); } public Screen getGameMenu(Consumer<String> e) { Screen gameMenu = new SuperMarioBrosMenuScreen(e); return gameMenu; } }
9238c830228958805c8ed98ebd043f6a859c4137
453
java
Java
examples/ru.iiec.cxxdroid/sources/com/google/android/material/tabs/a.java
vietnux/CodeEditorMobile
acd29a6a647342276eb557f3af579535092ab377
[ "Apache-2.0" ]
null
null
null
examples/ru.iiec.cxxdroid/sources/com/google/android/material/tabs/a.java
vietnux/CodeEditorMobile
acd29a6a647342276eb557f3af579535092ab377
[ "Apache-2.0" ]
null
null
null
examples/ru.iiec.cxxdroid/sources/com/google/android/material/tabs/a.java
vietnux/CodeEditorMobile
acd29a6a647342276eb557f3af579535092ab377
[ "Apache-2.0" ]
null
null
null
26.647059
67
0.724062
998,570
package com.google.android.material.tabs; import android.graphics.drawable.Drawable; import android.view.View; public class a extends View { /* renamed from: b reason: collision with root package name */ public final CharSequence f6548b; /* renamed from: c reason: collision with root package name */ public final Drawable f6549c; /* renamed from: d reason: collision with root package name */ public final int f6550d; }
9238c96e4ffa58c4e0717ad182f256f10f4fec12
376
java
Java
core/src/test/java/com/dottydingo/hyperion/core/Util.java
tharrisx1/hyperion
dbd9d07528991419cee2883d2826b79f92624157
[ "Apache-2.0" ]
4
2017-03-25T00:33:49.000Z
2020-07-20T04:14:57.000Z
core/src/test/java/com/dottydingo/hyperion/core/Util.java
tharrisx1/hyperion
dbd9d07528991419cee2883d2826b79f92624157
[ "Apache-2.0" ]
1
2015-03-06T00:33:02.000Z
2015-03-06T00:33:02.000Z
core/src/test/java/com/dottydingo/hyperion/core/Util.java
tharrisx1/hyperion
dbd9d07528991419cee2883d2826b79f92624157
[ "Apache-2.0" ]
3
2017-11-29T12:57:55.000Z
2019-03-22T02:34:43.000Z
17.090909
51
0.630319
998,571
package com.dottydingo.hyperion.core; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; /** */ public class Util { public static <T> List<T> asList(T... items) { return Arrays.asList(items); } public static <T> Set<T> asSet(T... items) { return new HashSet<>(Arrays.asList(items)); } }
9238c9e0f685a726f46f2af2f3846ac33f477ba5
1,047
java
Java
propertytrees-common/src/main/java/com/propertiestree/common/entity/City.java
sumit4myself/PropertyTrees
4b8ecdbeb4aeaaa7cfc574c3352ee609ea394ead
[ "CC0-1.0" ]
null
null
null
propertytrees-common/src/main/java/com/propertiestree/common/entity/City.java
sumit4myself/PropertyTrees
4b8ecdbeb4aeaaa7cfc574c3352ee609ea394ead
[ "CC0-1.0" ]
null
null
null
propertytrees-common/src/main/java/com/propertiestree/common/entity/City.java
sumit4myself/PropertyTrees
4b8ecdbeb4aeaaa7cfc574c3352ee609ea394ead
[ "CC0-1.0" ]
null
null
null
20.529412
68
0.711557
998,572
package com.propertiestree.common.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class City implements Serializable{ private static final long serialVersionUID = 3601802861079572757L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private int id; @Column(unique = true, nullable = false, updatable = false) private String uuid; private String name; @ManyToOne @JoinColumn(name="state_id") private State state; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
9238ca10327d63851548fbe28618b986e678bc11
773
java
Java
src/main/java/com/mw/portfolio/config/email/EmailConfig.java
mitch-warrenburg/portfolio-server
8bce553fdb327075d822c3d76095140bf3cb7700
[ "MIT" ]
null
null
null
src/main/java/com/mw/portfolio/config/email/EmailConfig.java
mitch-warrenburg/portfolio-server
8bce553fdb327075d822c3d76095140bf3cb7700
[ "MIT" ]
null
null
null
src/main/java/com/mw/portfolio/config/email/EmailConfig.java
mitch-warrenburg/portfolio-server
8bce553fdb327075d822c3d76095140bf3cb7700
[ "MIT" ]
null
null
null
23.424242
66
0.755498
998,573
package com.mw.portfolio.config.email; import com.sendgrid.Email; import com.sendgrid.SendGrid; import lombok.AllArgsConstructor; import lombok.val; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @AllArgsConstructor public class EmailConfig { private final EmailProperties properties; @Bean public SendGrid sendGrid() { return new SendGrid(properties.getApiKey()); } @Bean public Email senderEmail() { val sender = properties.getSender(); return new Email(sender.getAddress(), sender.getName()); } @Bean public Email recipientEmail() { val recipient = properties.getRecipient(); return new Email(recipient.getAddress(), recipient.getName()); } }
9238ca6f95b1b8963c7c49d97688fc5d416f5b9a
1,351
java
Java
app/src/main/java/com/bigbug/android/pp/data/PrayersHandler.java
bigbugbb/PrayerPartner
906e1881227cf6869982cf3d3c66f016996d8a6e
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/bigbug/android/pp/data/PrayersHandler.java
bigbugbb/PrayerPartner
906e1881227cf6869982cf3d3c66f016996d8a6e
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/bigbug/android/pp/data/PrayersHandler.java
bigbugbb/PrayerPartner
906e1881227cf6869982cf3d3c66f016996d8a6e
[ "Apache-2.0" ]
null
null
null
29.369565
95
0.715026
998,574
package com.bigbug.android.pp.data; import android.content.ContentProviderOperation; import android.content.Context; import android.net.Uri; import com.bigbug.android.pp.data.model.Prayer; import com.bigbug.android.pp.provider.AppContract; import com.google.gson.Gson; import com.google.gson.JsonElement; import java.util.ArrayList; import java.util.List; import static com.bigbug.android.pp.util.LogUtils.makeLogTag; public class PrayersHandler extends JSONHandler { private static final String TAG = makeLogTag(PrayersHandler.class); private List<Prayer> mPrayers = new ArrayList<>(); public PrayersHandler(Context context) { super(context); } @Override public void process(JsonElement element) { for (Prayer prayer : new Gson().fromJson(element, Prayer[].class)) { mPrayers.add(prayer); } } @Override public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) { Uri uri = AppContract.addCallerIsSyncAdapterParameter(AppContract.Prayers.CONTENT_URI); list.add(ContentProviderOperation.newDelete(uri).build()); for (Prayer prayer : mPrayers) { ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(uri); // TODO: list.add(builder.build()); } } }
9238ca91fe0c7ac5e960120fb4f5836a6f6efe00
3,317
java
Java
src/main/java/net/azagwen/atbyw/datagen/arrp/Tags.java
TehcJS/ATBYW
fd38667e5e6640f427418e1462663ae37ff66680
[ "CC0-1.0" ]
7
2020-12-18T20:22:45.000Z
2021-08-24T15:26:26.000Z
src/main/java/net/azagwen/atbyw/datagen/arrp/Tags.java
TehcJS/ATBYW
fd38667e5e6640f427418e1462663ae37ff66680
[ "CC0-1.0" ]
42
2020-12-18T20:57:34.000Z
2021-12-26T13:23:09.000Z
src/main/java/net/azagwen/atbyw/datagen/arrp/Tags.java
TehcJS/ATBYW
fd38667e5e6640f427418e1462663ae37ff66680
[ "CC0-1.0" ]
11
2020-12-18T19:26:25.000Z
2021-08-01T20:41:38.000Z
36.054348
129
0.706663
998,575
package net.azagwen.atbyw.datagen.arrp; import com.google.common.collect.Lists; import net.azagwen.atbyw.block.AtbywBlocks; import net.azagwen.atbyw.group.AtbywItemGroup; import net.devtech.arrp.api.RuntimeResourcePack; import net.devtech.arrp.json.tags.JTag; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.util.Identifier; import java.util.ArrayList; import static net.azagwen.atbyw.datagen.arrp.AtbywRRP.ATBYW_RESOURCE_PACK; import static net.azagwen.atbyw.util.AtbywUtils.*; import static net.azagwen.atbyw.main.AtbywMain.*; public class Tags { private static void createBlockTag(RuntimeResourcePack pack, String nameSpace, String tagName, ArrayList<Block> blocks) { JTag tag = JTag.tag(); for (Block block : blocks) { tag.add(getBlockID(block)); } pack.addTag(new Identifier(nameSpace, "blocks/" + tagName), tag); } public static void createItemTag(RuntimeResourcePack pack, String nameSpace, String tagName, ArrayList<Item> items) { JTag tag = JTag.tag(); for (Item item : items) { tag.add(getItemID(item)); } pack.addTag(new Identifier(nameSpace, "items/" + tagName), tag); } public static final ArrayList<Block> BOOKSHELVES = Lists.newArrayList( AtbywBlocks.SPRUCE_BOOKSHELF, AtbywBlocks.BIRCH_BOOKSHELF, AtbywBlocks.JUNGLE_BOOKSHELF, AtbywBlocks.ACACIA_BOOKSHELF, AtbywBlocks.DARK_OAK_BOOKSHELF, AtbywBlocks.CRIMSON_BOOKSHELF, AtbywBlocks.WARPED_BOOKSHELF, AtbywBlocks.OAK_BOOKSHELF_TOGGLE, AtbywBlocks.SPRUCE_BOOKSHELF_TOGGLE, AtbywBlocks.BIRCH_BOOKSHELF_TOGGLE, AtbywBlocks.JUNGLE_BOOKSHELF_TOGGLE, AtbywBlocks.ACACIA_BOOKSHELF_TOGGLE, AtbywBlocks.DARK_OAK_BOOKSHELF_TOGGLE, AtbywBlocks.CRIMSON_BOOKSHELF_TOGGLE, AtbywBlocks.WARPED_BOOKSHELF_TOGGLE ); public static final ArrayList<Block> LARGE_CHAIN_TRANSITION_BOTTOM = Lists.newArrayList( Blocks.CHAIN, Blocks.LANTERN, Blocks.SOUL_LANTERN, AtbywBlocks.REDSTONE_LANTERN ); public static final ArrayList<Block> LARGE_CHAIN_TRANSITION_TOP = Lists.newArrayList( Blocks.CHAIN ); private static ArrayList<Item> getBlockItems(ArrayList<Block> blockList) { ArrayList<Item> blockItems = Lists.newArrayList(); for (Block block : blockList) { blockItems.add(block.asItem()); } return blockItems; } public static void init() { AtbywItemGroup.registerTags(); createBlockTag(ATBYW_RESOURCE_PACK, ATBYW, "large_chain_transition_bottom", LARGE_CHAIN_TRANSITION_BOTTOM); createBlockTag(ATBYW_RESOURCE_PACK, ATBYW, "large_chain_transition_top", LARGE_CHAIN_TRANSITION_TOP); createItemTag(ATBYW_RESOURCE_PACK, ATBYW, "bookshelves", getBlockItems(BOOKSHELVES)); createItemTag(ATBYW_RESOURCE_PACK, ATBYW, "large_chain_transition_bottom", getBlockItems(LARGE_CHAIN_TRANSITION_BOTTOM)); createItemTag(ATBYW_RESOURCE_PACK, ATBYW, "large_chain_transition_top", getBlockItems(LARGE_CHAIN_TRANSITION_TOP)); } }
9238cab15da856f83d8b19d5f819c2bd8f1d4133
550
java
Java
src/Aula17/Exercicios/Exer016.java
wesleyav/curso-loiane-groner-java-basico
5d500f6546ca8244b08e3beafd230f51dca2ffa3
[ "MIT" ]
null
null
null
src/Aula17/Exercicios/Exer016.java
wesleyav/curso-loiane-groner-java-basico
5d500f6546ca8244b08e3beafd230f51dca2ffa3
[ "MIT" ]
null
null
null
src/Aula17/Exercicios/Exer016.java
wesleyav/curso-loiane-groner-java-basico
5d500f6546ca8244b08e3beafd230f51dca2ffa3
[ "MIT" ]
null
null
null
17.741935
116
0.674545
998,576
/* 16.A série de Fibonacci é formada pela seqüência 0,1,1,2,3,5,8,13,21,34,55,... Faça um programa que gere a série até que o valor seja maior que 500. */ package Aula17.Exercicios; import java.util.Scanner; public class Exer016 { public static void main(String[] args) { int primeiro = 1; int segundo = 1; int proximo = 0; System.out.println(primeiro); System.out.println(segundo); while (proximo <= 500) { proximo = primeiro + segundo; primeiro = segundo; segundo = proximo; System.out.println(proximo); } } }
9238cb335710500369f0b0dbbbe26939d5be1e32
2,803
java
Java
src/main/java/t3/tic/bw5/project/properties/appmgmt/ObjectFactory.java
teecube/tic-bw5
f8729bdfb1fb00af88490051bb846582c2eb3dc5
[ "Apache-2.0" ]
null
null
null
src/main/java/t3/tic/bw5/project/properties/appmgmt/ObjectFactory.java
teecube/tic-bw5
f8729bdfb1fb00af88490051bb846582c2eb3dc5
[ "Apache-2.0" ]
null
null
null
src/main/java/t3/tic/bw5/project/properties/appmgmt/ObjectFactory.java
teecube/tic-bw5
f8729bdfb1fb00af88490051bb846582c2eb3dc5
[ "Apache-2.0" ]
null
null
null
42.469697
214
0.723511
998,577
/** * (C) Copyright 2016-2019 teecube * (https://teecu.be) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package t3.tic.bw5.project.properties.appmgmt; import com.tibco.xmlns.applicationmanagement.ServiceType; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory extends com.tibco.xmlns.applicationmanagement.ObjectFactory { protected final static QName _Application_QNAME = new QName("http://www.tibco.com/xmlns/ApplicationManagement", "application"); protected final static QName _BaseService_QNAME = new QName("http://www.tibco.com/xmlns/ApplicationManagement", "baseService"); protected final static QName _Bw_QNAME = new QName("http://www.tibco.com/xmlns/ApplicationManagement", "bw"); /** * Create an instance of {@link ApplicationType } */ public ApplicationType createApplicationType() { return new ApplicationType(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ApplicationType }{@code >}} */ @XmlElementDecl(namespace = "http://www.tibco.com/xmlns/ApplicationManagement", name = "application") public JAXBElement<ApplicationType> createApplication(ApplicationType value) { return new JAXBElement<ApplicationType>(_Application_QNAME, ApplicationType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ServiceType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.tibco.com/xmlns/ApplicationManagement", name = "baseService") public JAXBElement<ServiceType> createBaseService(ServiceType value) { return new JAXBElement<ServiceType>(_BaseService_QNAME, ServiceType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link Bw }{@code >}} */ @XmlElementDecl(namespace = "http://www.tibco.com/xmlns/ApplicationManagement", name = "bw", substitutionHeadNamespace = "http://www.tibco.com/xmlns/ApplicationManagement", substitutionHeadName = "baseService") public JAXBElement<Bw> createBw(Bw value) { return new JAXBElement<Bw>(_Bw_QNAME, Bw.class, null, value); } }
9238cb5a5d2b3e0acdbc299803e18e162bfe4472
2,164
java
Java
src/main/java/sk/antons/web/filter/util/OutputStreamTee.java
antonsjava/web-filter
5d0d85db5627bd6ed2f86dc9382dcdae002daaca
[ "Apache-2.0" ]
null
null
null
src/main/java/sk/antons/web/filter/util/OutputStreamTee.java
antonsjava/web-filter
5d0d85db5627bd6ed2f86dc9382dcdae002daaca
[ "Apache-2.0" ]
null
null
null
src/main/java/sk/antons/web/filter/util/OutputStreamTee.java
antonsjava/web-filter
5d0d85db5627bd6ed2f86dc9382dcdae002daaca
[ "Apache-2.0" ]
null
null
null
26.390244
95
0.669593
998,578
/* * Copyright 2019 Anton Straka * * 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 sk.antons.web.filter.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * Helper class for wrapping OutputStream instances. It enable * to read previously written content. * @author antons */ public class OutputStreamTee extends OutputStream { private OutputStream os; private ByteArrayOutputStream bos; public OutputStreamTee(OutputStream os) { this.os = os; this.bos = new ByteArrayOutputStream(); } public static OutputStreamTee instance(OutputStream os) { return new OutputStreamTee(os); } public static OutputStream nullOutputStream() { return OutputStream.nullOutputStream(); } @Override public void write(int b) throws IOException { os.write(b); bos.write(b); } @Override public void write(byte[] b) throws IOException { os.write(b); bos.write(b); } @Override public void write(byte[] b, int off, int len) throws IOException { os.write(b, off, len); bos.write(b, off, len); } @Override public void flush() throws IOException { os.flush(); bos.flush(); } @Override public void close() throws IOException { os.close(); bos.close(); } public byte[] toByteArray() { return bos.toByteArray(); } public InputStream toInputStream() { return new ByteArrayInputStream(bos.toByteArray()); } }
9238cc298ab64977ac5997b0f291755f374a2cb3
2,076
java
Java
src/test/java/com/yahoo/bullet/query/expressions/NAryExpressionTest.java
NathanSpeidel/bullet-core
60db58225e9de2e6e82a7b2f161586442a0d9698
[ "Apache-2.0" ]
29
2018-06-29T05:35:06.000Z
2021-09-05T10:29:55.000Z
src/test/java/com/yahoo/bullet/query/expressions/NAryExpressionTest.java
NathanSpeidel/bullet-core
60db58225e9de2e6e82a7b2f161586442a0d9698
[ "Apache-2.0" ]
62
2018-06-14T22:31:01.000Z
2022-01-11T19:01:39.000Z
src/test/java/com/yahoo/bullet/query/expressions/NAryExpressionTest.java
NathanSpeidel/bullet-core
60db58225e9de2e6e82a7b2f161586442a0d9698
[ "Apache-2.0" ]
14
2018-06-06T00:30:35.000Z
2022-01-10T23:19:12.000Z
40.705882
138
0.688825
998,579
/* * Copyright 2020, Yahoo Inc. * Licensed under the terms of the Apache License, Version 2.0. * See the LICENSE file associated with the project for terms. */ package com.yahoo.bullet.query.expressions; import com.yahoo.bullet.common.BulletException; import com.yahoo.bullet.querying.evaluators.NAryEvaluator; import com.yahoo.bullet.typesystem.Type; import org.testng.Assert; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.Arrays; public class NAryExpressionTest { @Test public void testConstructor() { NAryExpression expression = new NAryExpression(Arrays.asList(new ValueExpression(1)), Operation.IF); Assert.assertEquals(expression.toString(), "{operands: [{value: 1, type: INTEGER}], op: IF, type: null}"); Assert.assertTrue(expression.getEvaluator() instanceof NAryEvaluator); } @Test(expectedExceptions = NullPointerException.class) public void testConstructorNullValues() { new NAryExpression(null, Operation.IF); } @Test(expectedExceptions = NullPointerException.class) public void testConstructorNullOp() { new NAryExpression(new ArrayList<>(), null); } @Test(expectedExceptions = BulletException.class, expectedExceptionsMessageRegExp = "N-ary expression requires an n-ary operation\\.") public void testConstructorNotNAryOp() { new NAryExpression(new ArrayList<>(), Operation.ADD); } @Test public void testEqualsAndHashCode() { NAryExpression expression = new NAryExpression(Arrays.asList(new ValueExpression(1)), Operation.IF); expression.setType(Type.INTEGER); ExpressionUtils.testEqualsAndHashCode(() -> new NAryExpression(Arrays.asList(new ValueExpression(1)), Operation.IF), new NAryExpression(Arrays.asList(new ValueExpression(2)), Operation.IF), new NAryExpression(Arrays.asList(new ValueExpression(1)), Operation.AND), expression); } }
9238ccab0cea10e93ac01174422b716fe0e41bc4
2,633
java
Java
backend/src/test/java/top/jasonkayzk/ezshare/system/controller/DictControllerTest.java
JasonkayZK/EZShare
5e4ae8b4fc2386e14af157b86fe478c9e17968ba
[ "Apache-2.0" ]
4
2020-01-19T15:08:39.000Z
2022-03-29T06:36:30.000Z
backend/src/test/java/top/jasonkayzk/ezshare/system/controller/DictControllerTest.java
JasonkayZK/EZShare
5e4ae8b4fc2386e14af157b86fe478c9e17968ba
[ "Apache-2.0" ]
23
2020-01-27T07:39:20.000Z
2022-02-26T22:43:39.000Z
backend/src/test/java/top/jasonkayzk/ezshare/system/controller/DictControllerTest.java
JasonkayZK/EZShare
5e4ae8b4fc2386e14af157b86fe478c9e17968ba
[ "Apache-2.0" ]
1
2021-04-13T09:28:18.000Z
2021-04-13T09:28:18.000Z
30.616279
104
0.714774
998,580
package top.jasonkayzk.ezshare.system.controller; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultHandlers; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; @Disabled @SpringBootTest @WebAppConfiguration class DictControllerTest { public static final String pathPrefix = "/system/dict"; @Autowired private WebApplicationContext context; private MockMvc mockMvc; @BeforeEach public void setUp() { mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); } @Test void getDictList() throws Exception { MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(pathPrefix) .param("pageSize", "5") .param("pageNum", "2") .accept(MediaType.APPLICATION_JSON)) // 等同于Assert.assertEquals(200, status); .andExpect(MockMvcResultMatchers.status().isOk()) // 打印出请求和相应的内容 .andDo(MockMvcResultHandlers.print()) .andReturn(); // 将相应的数据转换为字符串 String responseString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); System.out.println(responseString); Map<String, Object> map = new ObjectMapper().readValue(responseString, new TypeReference<>(){}); Assertions.assertEquals(200, map.get("code")); Assertions.assertEquals(5, ((List)((Map)map.get("data")).get("rows")).size()); } @Test void getDict() { } @Test void addDict() { } @Test void updateDict() { } @Test void deleteDicts() { } @Test void export() { } }
9238ccbd172e7a2e92e3aae2afc119d8f8554bbe
1,447
java
Java
src/main/java/robosky/uplands/block/bossroom/MegadungeonAltarBlock.java
robotbrain/ether-dim
ce3185b9bcb0ce5dcb93c5bec13b7cf03fc8ba46
[ "MIT" ]
5
2019-07-30T03:06:39.000Z
2020-01-05T08:12:32.000Z
src/main/java/robosky/uplands/block/bossroom/MegadungeonAltarBlock.java
robotbrain/ether-dim
ce3185b9bcb0ce5dcb93c5bec13b7cf03fc8ba46
[ "MIT" ]
28
2020-05-21T04:39:44.000Z
2021-07-23T16:21:46.000Z
src/main/java/robosky/uplands/block/bossroom/MegadungeonAltarBlock.java
robotbrain/ether-dim
ce3185b9bcb0ce5dcb93c5bec13b7cf03fc8ba46
[ "MIT" ]
5
2020-05-21T03:07:46.000Z
2021-08-04T12:56:21.000Z
36.175
107
0.698687
998,581
package robosky.uplands.block.bossroom; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Material; import net.minecraft.entity.EntityContext; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.tools.FabricToolTags; public final class MegadungeonAltarBlock extends AltarBlock { private static final VoxelShape SHAPE = VoxelShapes.union( Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 1.0, 16.0), Block.createCuboidShape(2.0, 1.0, 2.0, 14.0, 2.0, 14.0), Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 4.0, 12.0), Block.createCuboidShape(5.0, 4.0, 5.0, 11.0, 14.0, 11.0), Block.createCuboidShape(3.0, 14.0, 3.0, 13.0, 15.0, 13.0), Block.createCuboidShape(0.0, 15.0, 0.0, 16.0, 16.0, 16.0) ); public MegadungeonAltarBlock() { super(FabricBlockSettings.of(Material.STONE) .strength(1.5f, 6f) .sounds(BlockSoundGroup.STONE) .breakByTool(FabricToolTags.PICKAXES, 1) .build()); } @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, EntityContext ctx) { return SHAPE; } }
9238cd37d81f9f382c5e94495ae325621e18f5b0
279
java
Java
Desktop/src/net/i2p/app/Outproxy.java
AverinLV/I2PSecChat
9ead4e8212039401f71120be9ed80c78aef686e7
[ "MIT" ]
136
2015-01-04T20:55:03.000Z
2022-01-23T13:02:35.000Z
Desktop/src/net/i2p/app/Outproxy.java
AverinLV/I2PSecChat
9ead4e8212039401f71120be9ed80c78aef686e7
[ "MIT" ]
4
2020-12-09T16:49:01.000Z
2021-02-15T13:35:23.000Z
Desktop/src/net/i2p/app/Outproxy.java
AverinLV/I2PSecChat
9ead4e8212039401f71120be9ed80c78aef686e7
[ "MIT" ]
37
2015-01-28T10:51:13.000Z
2022-02-20T16:49:40.000Z
13.95
68
0.637993
998,582
package net.i2p.app; import java.io.IOException; import java.net.Socket; /** * * @since 0.9.11 */ public interface Outproxy { public static final String NAME = "outproxy"; /** * */ public Socket connect(String host, int port) throws IOException; }
9238cd3d0a0c1e07bb2c291aba55ba398cd428d8
2,833
java
Java
src/test/java/ciir/jfoley/chai/classifier/PerceptronTest.java
jjfiv/chai
7c57afd0f88591e90dfdd0adeb6b6340d8d91749
[ "BSD-3-Clause" ]
4
2015-05-07T17:12:37.000Z
2018-01-24T22:57:10.000Z
src/test/java/ciir/jfoley/chai/classifier/PerceptronTest.java
jjfiv/chai
7c57afd0f88591e90dfdd0adeb6b6340d8d91749
[ "BSD-3-Clause" ]
34
2019-08-07T11:50:42.000Z
2022-03-14T00:11:51.000Z
src/test/java/ciir/jfoley/chai/classifier/PerceptronTest.java
jjfiv/chai
7c57afd0f88591e90dfdd0adeb6b6340d8d91749
[ "BSD-3-Clause" ]
3
2017-05-25T07:07:06.000Z
2022-03-03T21:48:50.000Z
30.793478
61
0.612778
998,583
package ciir.jfoley.chai.classifier; import ciir.jfoley.chai.collections.Pair; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** * @author jfoley */ public class PerceptronTest { @Test public void testSimpleDataset() { List<Pair<Integer, float[]>> dataset = Arrays.asList( Pair.of(1, new float[] {1, 0}), Pair.of(1, new float[] {1, 2}), Pair.of(1, new float[] {1, 0}), Pair.of(1, new float[] {1, 3}), Pair.of(1, new float[] {1, 0}), Pair.of(-1, new float[] {-1, 1}), Pair.of(-1, new float[] {-1, 2}), Pair.of(-1, new float[] {-1, 0}), Pair.of(-1, new float[] {-1, 4}), Pair.of(-1, new float[] {-1, 0}) ); int numDim = 2; int maxIters = 100; Perceptron perceptron = new Perceptron(numDim, maxIters); perceptron.setRandomSeed(13); BinaryClassifierInfo train = perceptron.train(dataset); // easy data, should converge: assertEquals(1.0, train.getAccuracy(), 0.0001); // easy data, should converge fast: assertTrue(train.numIterations < 10); } @Test public void testUnbalancedDataset() { List<Pair<Integer, float[]>> dataset = Arrays.asList( Pair.of(1, new float[] {1, 0}), Pair.of(1, new float[] {1, 2}), Pair.of(1, new float[] {1, 0}), Pair.of(1, new float[] {1, 3}), Pair.of(1, new float[] {1, 0}), Pair.of(-1, new float[] {-1, 0}) ); int numDim = 2; int maxIters = 100; Perceptron perceptron = new Perceptron(numDim, maxIters); perceptron.setRandomSeed(13); BinaryClassifierInfo train = perceptron.train(dataset); // easy data, should converge: assertEquals(1.0, train.getAccuracy(), 0.0001); // easy data, should converge fast: assertTrue(train.numIterations < 10); } @Test public void testHardDataset() { List<Pair<Integer, float[]>> dataset = Arrays.asList( Pair.of(1, new float[] {1, 1}), Pair.of(1, new float[] {1, 1}), Pair.of(1, new float[] {1, 1}), Pair.of(1, new float[] {1, 1}), Pair.of(-1, new float[] {1, 1}) ); int numDim = 2; int maxIters = 100; Perceptron perceptron = new Perceptron(numDim, maxIters); perceptron.setRandomSeed(14); BinaryClassifierInfo train = perceptron.train(dataset); // should get 4/5 right, can't distinguish the last one. assertEquals(maxIters, train.numIterations); assertEquals(0.8, train.getAccuracy(), 0.001); assertEquals(1.0, train.getPositiveRecall(), 0.001); assertEquals(0.8, train.getPositivePrecision(), 0.001); assertEquals(0.0, train.getNegativeRecall(), 0.001); assertEquals(0.0, train.getNegativePrecision(), 0.001); } }
9238ce4facf20367957489b77370d7585a2efc46
1,879
java
Java
mykit-message-common/src/main/java/io/mykit/transaction/message/common/constant/CommonConstant.java
xlj44400/mykit-transaction-message
b710bc8c0c8b2b3010e2ae8492652bcd8801c37c
[ "Apache-2.0" ]
72
2020-03-15T08:50:32.000Z
2022-02-10T03:39:55.000Z
mykit-message-common/src/main/java/io/mykit/transaction/message/common/constant/CommonConstant.java
acrdpm/mykit-transaction-message
822ab663519688afc616ba8dd09ef8bf2e174875
[ "Apache-2.0" ]
6
2020-03-15T11:35:09.000Z
2020-12-23T12:39:08.000Z
mykit-message-common/src/main/java/io/mykit/transaction/message/common/constant/CommonConstant.java
acrdpm/mykit-transaction-message
822ab663519688afc616ba8dd09ef8bf2e174875
[ "Apache-2.0" ]
40
2020-03-15T11:57:56.000Z
2022-02-08T14:22:45.000Z
23.78481
83
0.650878
998,584
/** * Copyright 2020-9999 the original author or authors. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.mykit.transaction.message.common.constant; /** * @author binghe * @version 1.0.0 * @description CommonConstant接口 */ public interface CommonConstant { /** * The constant LINE_SEPARATOR. */ String LINE_SEPARATOR = System.getProperty("line.separator"); /** * The constant DB_MYSQL. */ String DB_MYSQL = "mysql"; /** * The constant DB_SQLSERVER. */ String DB_SQLSERVER = "sqlserver"; /** * The constant DB_ORACLE. */ String DB_ORACLE = "oracle"; /** * The constant PATH_SUFFIX. */ String PATH_SUFFIX = "/mykit_transaction_message"; /** * The constant DB_SUFFIX. */ String DB_SUFFIX = "mykit_transaction_message_"; /** * The constant RECOVER_REDIS_KEY_PRE. */ String RECOVER_REDIS_KEY_PRE = "mykit:transaction:message:%s"; /** * The constant MYKIT_TRANSACTION_MESSAGE_CONTEXT. */ String MYKIT_TRANSACTION_MESSAGE_CONTEXT = "MYKIT_TRANSACTION_MESSAGE_CONTEXT"; /** * The constant TOPIC_TAG_SEPARATOR. */ String TOPIC_TAG_SEPARATOR = ","; /** * The constant SUCCESS. */ int SUCCESS = 1; /** * The constant ERROR. */ int ERROR = 0; }
9238cee3d8237368eb2f908316c2de7584abeb3a
326
java
Java
src/net/syntaxblitz/plucklock/PreferenceString.java
SyntaxBlitz/PluckLock
3a7e0861b377bd3892aa26f836f89b7deb1b059b
[ "MIT" ]
16
2015-11-15T02:21:50.000Z
2021-08-28T13:00:07.000Z
src/net/syntaxblitz/plucklock/PreferenceString.java
SyntaxBlitz/PluckLock
3a7e0861b377bd3892aa26f836f89b7deb1b059b
[ "MIT" ]
4
2015-01-21T17:51:49.000Z
2019-01-08T15:24:15.000Z
src/net/syntaxblitz/plucklock/PreferenceString.java
SyntaxBlitz/PluckLock
3a7e0861b377bd3892aa26f836f89b7deb1b059b
[ "MIT" ]
8
2015-04-11T04:46:23.000Z
2021-12-03T20:08:43.000Z
36.222222
91
0.806748
998,585
package net.syntaxblitz.plucklock; public class PreferenceString { public static String PREFS_VERSION = "prefs_version"; public static String ENABLED = "plucklock_enabled"; public static String THRESHOLD = "threshold_pref_key"; public static String DISABLED_DEVICE_ADMIN = "has_disabled_device_admin"; // at least once }
9238cfdbd79a8623d4e26f0304191f340b179688
18,080
java
Java
src/main/java/org/openflow/protocol/OFPhysicalPort.java
ProtocolObliviousForwarding/POFController
17d221c2c2743bca7ca6da3d742a06ad321ad33f
[ "ECL-2.0", "Apache-2.0" ]
9
2015-10-31T05:27:59.000Z
2020-04-22T09:52:01.000Z
src/main/java/org/openflow/protocol/OFPhysicalPort.java
ProtocolObliviousForwarding/POFController
17d221c2c2743bca7ca6da3d742a06ad321ad33f
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/main/java/org/openflow/protocol/OFPhysicalPort.java
ProtocolObliviousForwarding/POFController
17d221c2c2743bca7ca6da3d742a06ad321ad33f
[ "ECL-2.0", "Apache-2.0" ]
6
2015-02-10T05:18:12.000Z
2021-08-29T02:45:05.000Z
27.013433
104
0.526935
998,586
/** * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior * University * * 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.openflow.protocol; import java.util.Arrays; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.jboss.netty.buffer.ChannelBuffer; import org.openflow.protocol.serializers.OFPhysicalPortJSONSerializer; import org.openflow.util.HexString; import org.openflow.util.ParseString; /** * Modified by Song Jian (lyhxr@example.com), Huawei Technologies Co., Ltd. * Delete items in enum OFPortConfig * delete OFPPC_NO_STP, OFPPC_NO_RECV_STP, OFPPC_NO_FLOOD * Delete items in enum OFPortState * delete OFPPS_STP_LISTEN, OFPPS_STP_LEARN, OFPPS_STP_FORWARD, OFPPS_STP_BLOCK, OFPPS_STP_MASK * add OFPPS_BLOCKED, OFPPS_LIVE * Add items in OFPortFeatures * add OFPPF_40GB_FD, OFPPF_100GB_FD, OFPPF_1TB_FD, OFPPF_OTHER * * Modify class member short portNumber to int portId * Add class member devicedId * Add class member currentSpeed * Add class member maxSpeed * Add class member openflowEnable * And add get/set methods of above class members * Modify the readFrom()/writeTo() members to match the class member change. * Add setAll() methods to set an OFPhysicalPort object * */ /** * Represents ofp_phy_port * @author David Erickson (anpch@example.com) - Mar 25, 2010 */ @JsonSerialize(using=OFPhysicalPortJSONSerializer.class) public class OFPhysicalPort { public static int MINIMUM_LENGTH = 88; public static int OFP_ETH_ALEN = 6; public enum OFPortConfig { OFPPC_PORT_DOWN (1 << 0) { public String toString() { return "port-down (0x1)"; } }, // OFPPC_NO_STP (1 << 1) { // public String toString() { // return "no-stp (0x2)"; // } // }, OFPPC_NO_RECV (1 << 2) { public String toString() { return "no-recv (0x4)"; } }, // OFPPC_NO_RECV_STP (1 << 3) { // public String toString() { // return "no-recv-stp (0x8)"; // } // }, // OFPPC_NO_FLOOD (1 << 4) { // public String toString() { // return "no-flood (0x10)"; // } // }, OFPPC_NO_FWD (1 << 5) { public String toString() { return "no-fwd (0x20)"; } }, OFPPC_NO_PACKET_IN (1 << 6) { public String toString() { return "no-pkt-in (0x40)"; } }; protected int value; private OFPortConfig(int value) { this.value = value; } /** * @return the value */ public int getValue() { return value; } } public enum OFPortState { OFPPS_LINK_DOWN (1 << 0) { public String toString() { return "link-down (0x1)"; } }, /* OFPPS_STP_LISTEN (0 << 8) { public String toString() { return "listen (0x0)"; } }, OFPPS_STP_LEARN (1 << 8) { public String toString() { return "learn-no-relay (0x100)"; } }, OFPPS_STP_FORWARD (2 << 8) { public String toString() { return "forward (0x200)"; } }, OFPPS_STP_BLOCK (3 << 8) { public String toString() { return "block-broadcast (0x300)"; } }, OFPPS_STP_MASK (3 << 8) { public String toString() { return "block-broadcast (0x300)"; } };*/ OFPPS_BLOCKED (1 << 1) { public String toString() { return "blocked (0x2)"; } }, OFPPS_LIVE (1 << 2) { public String toString() { return "live (0x4)"; } }; protected int value; private OFPortState(int value) { this.value = value; } /** * @return the value */ public int getValue() { return value; } } public enum OFPortFeatures { OFPPF_10MB_HD (1 << 0) { public String toString() { return "10mb-hd (0x1)"; } }, OFPPF_10MB_FD (1 << 1) { public String toString() { return "10mb-fd (0x2)"; } }, OFPPF_100MB_HD (1 << 2) { public String toString() { return "100mb-hd (0x4)"; } }, OFPPF_100MB_FD (1 << 3) { public String toString() { return "100mb-fd (0x8)"; } }, OFPPF_1GB_HD (1 << 4) { public String toString() { return "1gb-hd (0x10)"; } }, OFPPF_1GB_FD (1 << 5) { public String toString() { return "1gb-fd (0x20)"; } }, OFPPF_10GB_FD (1 << 6) { public String toString() { return "10gb-fd (0x40)"; } }, OFPPF_40GB_FD (1 << 7) { public String toString() { return "40gb-fd (0x80)"; } }, OFPPF_100GB_FD (1 << 8) { public String toString() { return "100gb-fd (0x100)"; } }, OFPPF_1TB_FD (1 << 9) { public String toString() { return "40gb-fd (0x200)"; } }, OFPPF_OTHER (1 << 10) { public String toString() { return "40gb-fd (0x400)"; } }, OFPPF_COPPER (1 << 11) { public String toString() { return "copper (0x800)"; } }, OFPPF_FIBER (1 << 12) { public String toString() { return "fiber (0x1000)"; } }, OFPPF_AUTONEG (1 << 13) { public String toString() { return "autoneg (0x2000)"; } }, OFPPF_PAUSE (1 << 14) { public String toString() { return "pause (0x4000)"; } }, OFPPF_PAUSE_ASYM (1 << 15) { public String toString() { return "pause-asym (0x8000)"; } }; protected int value; private OFPortFeatures(int value) { this.value = value; } /** * @return the value */ public int getValue() { return value; } } protected int portId; protected int deviceId; protected byte[] hardwareAddress; protected String name; //32B protected int config; protected int state; protected int currentFeatures; protected int advertisedFeatures; protected int supportedFeatures; protected int peerFeatures; protected int currentSpeed; protected int maxSpeed; protected byte openflowEnable; public void setAll(int portId, int deviceId, byte[] hardwareAddress, String name, int config, int state, int currentFeatures, int advertisedFeatures, int supportedFeatures, int peerFeatures, int currentSpeed, int maxSpeed, byte openflowEnable) { this.portId = portId; this.deviceId = deviceId; this.hardwareAddress = hardwareAddress; this.name = name; this.config = config; this.state = state; this.currentFeatures = currentFeatures; this.advertisedFeatures = advertisedFeatures; this.supportedFeatures = supportedFeatures; this.peerFeatures = peerFeatures; this.currentSpeed = currentSpeed; this.maxSpeed = maxSpeed; this.openflowEnable = openflowEnable; } public int getDeviceId() { return deviceId; } public void setDeviceId(int deviceId) { this.deviceId = deviceId; } public int getCurrentSpeed() { return currentSpeed; } public void setCurrentSpeed(int currentSpeed) { this.currentSpeed = currentSpeed; } public int getMaxSpeed() { return maxSpeed; } public void setMaxSpeed(int maxSpeed) { this.maxSpeed = maxSpeed; } public byte getOpenflowEnable() { return openflowEnable; } public void setOpenflowEnable(byte openflowEnable) { this.openflowEnable = openflowEnable; } /** * @return the portNumber */ public int getPortId() { return portId; } /** * @param portId the portId to set */ public void setPortId(int portId) { this.portId = portId; } public void setPortId(OFPort portId) { this.portId = portId.getValue(); } /** * @return the hardwareAddress */ public byte[] getHardwareAddress() { return hardwareAddress; } /** * @param hardwareAddress the hardwareAddress to set */ public void setHardwareAddress(byte[] hardwareAddress) { if (hardwareAddress.length != OFP_ETH_ALEN) throw new RuntimeException("Hardware address must have length " + OFP_ETH_ALEN); this.hardwareAddress = hardwareAddress; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the config */ public int getConfig() { return config; } /** * @param config the config to set */ public void setConfig(int config) { this.config = config; } /** * @return the state */ public int getState() { return state; } /** * @param state the state to set */ public void setState(int state) { this.state = state; } /** * @return the currentFeatures */ public int getCurrentFeatures() { return currentFeatures; } /** * @param currentFeatures the currentFeatures to set */ public void setCurrentFeatures(int currentFeatures) { this.currentFeatures = currentFeatures; } /** * @return the advertisedFeatures */ public int getAdvertisedFeatures() { return advertisedFeatures; } /** * @param advertisedFeatures the advertisedFeatures to set */ public void setAdvertisedFeatures(int advertisedFeatures) { this.advertisedFeatures = advertisedFeatures; } /** * @return the supportedFeatures */ public int getSupportedFeatures() { return supportedFeatures; } /** * @param supportedFeatures the supportedFeatures to set */ public void setSupportedFeatures(int supportedFeatures) { this.supportedFeatures = supportedFeatures; } /** * @return the peerFeatures */ public int getPeerFeatures() { return peerFeatures; } /** * @param peerFeatures the peerFeatures to set */ public void setPeerFeatures(int peerFeatures) { this.peerFeatures = peerFeatures; } /** * Read this message off the wire from the specified ByteBuffer * @param data */ public void readFrom(ChannelBuffer data) { this.portId = data.readInt(); this.deviceId = data.readInt(); if (this.hardwareAddress == null) this.hardwareAddress = new byte[OFP_ETH_ALEN]; data.readBytes(this.hardwareAddress); data.readShort(); this.name = ParseString.NameByteToString(data); this.config = data.readInt(); this.state = data.readInt(); this.currentFeatures = data.readInt(); this.advertisedFeatures = data.readInt(); this.supportedFeatures = data.readInt(); this.peerFeatures = data.readInt(); this.currentSpeed = data.readInt(); this.maxSpeed = data.readInt(); this.openflowEnable = data.readByte(); data.readBytes(7); } /** * Write this message's binary format to the specified ByteBuffer * @param data */ public void writeTo(ChannelBuffer data) { data.writeInt(this.portId); data.writeInt(this.deviceId); data.writeBytes(this.hardwareAddress); data.writeZero(2); data.writeBytes(ParseString.NameStringToBytes(this.name)); data.writeInt(this.config); data.writeInt(this.state); data.writeInt(this.currentFeatures); data.writeInt(this.advertisedFeatures); data.writeInt(this.supportedFeatures); data.writeInt(this.peerFeatures); data.writeInt(this.currentSpeed); data.writeInt(this.maxSpeed); data.writeByte(this.openflowEnable); data.writeZero(7); } public String toBytesString(){ String bytesString = HexString.toHex(portId); bytesString += HexString.toHex(deviceId); bytesString += HexString.toHex(hardwareAddress); bytesString += HexString.ByteZeroEnd(2); bytesString += HexString.NameToHex(name); bytesString += HexString.toHex(config); bytesString += HexString.toHex(state); bytesString += HexString.toHex(currentFeatures); bytesString += HexString.toHex(advertisedFeatures); bytesString += HexString.toHex(supportedFeatures); bytesString += HexString.toHex(peerFeatures); bytesString += HexString.toHex(currentSpeed); bytesString += HexString.toHex(maxSpeed); bytesString += HexString.toHex(openflowEnable); bytesString += HexString.ByteZeroEnd(7); return bytesString; } public String toString(){ String string = ";pid=" + this.portId + ";did=" + this.deviceId + ";addr=" + HexString.toHex(this.hardwareAddress) + ";name=" + this.name + ";cfg=" + this.config + ";sta=" + this.state + ";curf=" + this.currentFeatures + ";adv=" + this.advertisedFeatures + ";sup=" + this.supportedFeatures + ";per=" + this.peerFeatures + ";curs=" + this.currentSpeed + ";maxs=" + this.maxSpeed + ";ofe=" + this.openflowEnable; return string; } @Override public int hashCode() { final int prime = 307; int result = 1; result = prime * result + portId; result = prime * result + deviceId; result = prime * result + Arrays.hashCode(hardwareAddress); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + config; result = prime * result + state; result = prime * result + currentFeatures; result = prime * result + advertisedFeatures; result = prime * result + supportedFeatures; result = prime * result + peerFeatures; result = prime * result + currentSpeed; result = prime * result + maxSpeed; result = prime * result + openflowEnable; return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof OFPhysicalPort)) { return false; } OFPhysicalPort other = (OFPhysicalPort) obj; if (portId != other.portId) { return false; } if (deviceId != other.deviceId) { return false; } if (!Arrays.equals(hardwareAddress, other.hardwareAddress)) { return false; } if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (config != other.config) { return false; } if (state != other.state) { return false; } if (currentFeatures != other.currentFeatures) { return false; } if (advertisedFeatures != other.advertisedFeatures) { return false; } if (supportedFeatures != other.supportedFeatures) { return false; } if (peerFeatures != other.peerFeatures) { return false; } if (currentSpeed != other.currentSpeed) { return false; } if (maxSpeed != other.maxSpeed) { return false; } if (openflowEnable != other.openflowEnable) { return false; } return true; } }
9238d1d5479ec435a24da2d4702079f77b2a7149
4,432
java
Java
src/com/ludateam/wechat/qy/utils/StringUtils.java
tangxu123/qywechat
721a204e89f31ef6cab1ec28dc1b0fc28064efa8
[ "Apache-2.0" ]
null
null
null
src/com/ludateam/wechat/qy/utils/StringUtils.java
tangxu123/qywechat
721a204e89f31ef6cab1ec28dc1b0fc28064efa8
[ "Apache-2.0" ]
null
null
null
src/com/ludateam/wechat/qy/utils/StringUtils.java
tangxu123/qywechat
721a204e89f31ef6cab1ec28dc1b0fc28064efa8
[ "Apache-2.0" ]
null
null
null
28.410256
111
0.578745
998,587
package com.ludateam.wechat.qy.utils;/* * Copyright 2017 Luda Team. * * 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. * Created by Him on 2017/9/29. */ import org.apache.commons.lang3.StringEscapeUtils; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.text.MessageFormat; import java.util.Map; import java.util.Random; import java.util.UUID; public final class StringUtils extends org.apache.commons.lang3.StringUtils { public static String encode(String str){ String encode=null; try { encode = URLEncoder.encode(str, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return encode; } /** * 获取UUID,去掉`-`的 * @return uuid */ public static String getUUID () { return UUID.randomUUID().toString().replace("-", ""); } /** * 将字符串中特定模式的字符转换成map中对应的值 * * use: format("my name is ${name}, and i like ${like}!", {"name":"L.cm", "like": "Java"}) * * @param s 需要转换的字符串 * @param map 转换所需的键值对集合 * @return 转换后的字符串 */ public static String format(String s, Map<String, String> map) { StringBuilder sb = new StringBuilder((int)(s.length() * 1.5)); int cursor = 0; for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf('}', start)) != -1;) { sb.append(s.substring(cursor, start)); String key = s.substring(start + 2, end); sb.append(map.get(StringUtils.trim(key))); cursor = end + 1; } sb.append(s.substring(cursor, s.length())); return sb.toString(); } /** * 字符串格式化 * * use: format("my name is {0}, and i like {1}!", "L.cm", "java") * * int long use {0,number,#} * * @param s * @param args * @return 转换后的字符串 */ public static String format(String s, Object... args) { return MessageFormat.format(s, args); } /** * 替换某个字符 * @param str * @param regex * @param args * @return */ public static String replace(String str,String regex,String... args){ int length = args.length; for (int i = 0; i < length; i++) { str=str.replaceFirst(regex, args[i]); } return str; } /** * 转义HTML用于安全过滤 * @param html * @return */ public static String escapeHtml(String html) { return StringEscapeUtils.escapeHtml4(html); } /** * 清理字符串,清理出某些不可见字符 * @param txt * @return {String} */ public static String cleanChars(String txt) { return txt.replaceAll("[   `·•�\\f\\t\\v]", ""); } // 随机字符串 private static final String _INT = "0123456789"; private static final String _STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private static final String _ALL = _INT + _STR; private static final Random RANDOM = new Random(); /** * 生成的随机数类型 */ public static enum RandomType { INT, STRING, ALL; } /** * 随机数生成 * @param count * @return */ public static String random(int count, RandomType randomType) { if (count == 0) return ""; if (count < 0) { throw new IllegalArgumentException("Requested random string length " + count + " is less than 0."); } char[] buffer = new char[count]; for (int i = 0; i < count; i++) { if (randomType.equals(RandomType.INT)) { buffer[i] = _INT.charAt(RANDOM.nextInt(_INT.length())); } else if (randomType.equals(RandomType.STRING)) { buffer[i] = _STR.charAt(RANDOM.nextInt(_STR.length())); }else { buffer[i] = _ALL.charAt(RANDOM.nextInt(_ALL.length())); } } return new String(buffer); } }
9238d28e8d0ceba388033deef86a099786a1e89f
4,708
java
Java
com/levigo/jbig2/image/BitmapScanline.java
MewX/contendo-viewer-v1.6.3
69fba3cea4f9a43e48f43148774cfa61b388e7de
[ "Apache-2.0" ]
2
2021-07-16T10:43:25.000Z
2021-12-15T13:54:10.000Z
com/levigo/jbig2/image/BitmapScanline.java
MewX/contendo-viewer-v1.6.3
69fba3cea4f9a43e48f43148774cfa61b388e7de
[ "Apache-2.0" ]
1
2021-10-12T22:24:55.000Z
2021-10-12T22:24:55.000Z
com/levigo/jbig2/image/BitmapScanline.java
MewX/contendo-viewer-v1.6.3
69fba3cea4f9a43e48f43148774cfa61b388e7de
[ "Apache-2.0" ]
null
null
null
35.666667
142
0.456882
998,588
/* */ package com.levigo.jbig2.image; /* */ /* */ import com.levigo.jbig2.Bitmap; /* */ import java.awt.image.WritableRaster; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ final class BitmapScanline /* */ extends Scanline /* */ { /* */ private Bitmap bitmap; /* */ private WritableRaster raster; /* */ private int[] lineBuffer; /* */ /* */ public BitmapScanline(Bitmap paramBitmap, WritableRaster paramWritableRaster, int paramInt) { /* 32 */ super(paramInt); /* 33 */ this.bitmap = paramBitmap; /* 34 */ this.raster = paramWritableRaster; /* 35 */ this.lineBuffer = new int[this.length]; /* */ } /* */ /* */ /* */ protected void clear() { /* 40 */ this.lineBuffer = new int[this.length]; /* */ } /* */ /* */ /* */ protected void fetch(int paramInt1, int paramInt2) { /* 45 */ this.lineBuffer = new int[this.length]; /* 46 */ int i = this.bitmap.getByteIndex(paramInt1, paramInt2); /* 47 */ while (paramInt1 < this.length) { /* 48 */ byte b = (byte)(this.bitmap.getByte(i++) ^ 0xFFFFFFFF); /* 49 */ byte b1 = (this.bitmap.getWidth() - paramInt1 > 8) ? 8 : (this.bitmap.getWidth() - paramInt1); /* 50 */ for (int j = b1 - 1; j >= 0; j--, paramInt1++) { /* 51 */ if ((b >> j & 0x1) != 0) { /* 52 */ this.lineBuffer[paramInt1] = 255; /* */ } /* */ } /* */ } /* */ } /* */ /* */ protected void filter(int[] paramArrayOfint1, int[] paramArrayOfint2, Weighttab[] paramArrayOfWeighttab, Scanline paramScanline) { /* 59 */ BitmapScanline bitmapScanline = (BitmapScanline)paramScanline; /* 60 */ int i = paramScanline.length; /* */ /* */ /* 63 */ int j = 1 << paramArrayOfint2[0] - 1; /* 64 */ int[] arrayOfInt1 = this.lineBuffer; /* 65 */ int[] arrayOfInt2 = bitmapScanline.lineBuffer; /* */ /* */ /* 68 */ int k = paramArrayOfint1[0]; /* 69 */ int m = paramArrayOfint2[0]; /* 70 */ if (k != 0) { /* 71 */ for (byte b1 = 0, b2 = 0; b2 < i; b2++) { /* 72 */ Weighttab weighttab = paramArrayOfWeighttab[b2]; /* 73 */ int n = weighttab.weights.length; /* */ /* 75 */ int i1 = j; int i2, i3; /* 76 */ for (i2 = 0, i3 = weighttab.i0; i2 < n && i3 < arrayOfInt1.length; i2++) { /* 77 */ i1 += weighttab.weights[i2] * (arrayOfInt1[i3++] >> k); /* */ } /* */ /* 80 */ i2 = i1 >> m; /* 81 */ arrayOfInt2[b1++] = (i2 < 0) ? 0 : ((i2 > 255) ? 255 : i2); /* */ } /* */ } else { /* 84 */ for (byte b1 = 0, b2 = 0; b2 < i; b2++) { /* 85 */ Weighttab weighttab = paramArrayOfWeighttab[b2]; /* 86 */ int n = weighttab.weights.length; /* */ /* 88 */ int i1 = j; byte b; int i2; /* 89 */ for (b = 0, i2 = weighttab.i0; b < n && i2 < arrayOfInt1.length; b++) { /* 90 */ i1 += weighttab.weights[b] * arrayOfInt1[i2++]; /* */ } /* */ /* 93 */ arrayOfInt2[b1++] = i1 >> m; /* */ } /* */ } /* */ } /* */ /* */ /* */ protected void accumulate(int paramInt, Scanline paramScanline) { /* 100 */ BitmapScanline bitmapScanline = (BitmapScanline)paramScanline; /* */ /* 102 */ int[] arrayOfInt1 = this.lineBuffer; /* 103 */ int[] arrayOfInt2 = bitmapScanline.lineBuffer; /* */ /* 105 */ for (byte b = 0; b < arrayOfInt2.length; b++) { /* 106 */ arrayOfInt2[b] = arrayOfInt2[b] + paramInt * arrayOfInt1[b]; /* */ } /* */ } /* */ /* */ protected void shift(int[] paramArrayOfint) { /* 111 */ int i = paramArrayOfint[0]; /* 112 */ int j = 1 << i - 1; /* */ /* 114 */ int[] arrayOfInt = this.lineBuffer; /* */ /* 116 */ for (byte b = 0; b < arrayOfInt.length; b++) { /* 117 */ int k = arrayOfInt[b] + j >> i; /* 118 */ arrayOfInt[b] = (k < 0) ? 0 : ((k > 255) ? 255 : k); /* */ } /* */ } /* */ /* */ /* */ protected void store(int paramInt1, int paramInt2) { /* 124 */ this.raster.setSamples(paramInt1, paramInt2, this.length, 1, 0, this.lineBuffer); /* */ } /* */ } /* Location: /mnt/r/ConTenDoViewer.jar!/com/levigo/jbig2/image/BitmapScanline.class * Java compiler version: 7 (51.0) * JD-Core Version: 1.1.3 */
9238d2927a65aa97f30ccb6a9fce90c370700579
2,660
java
Java
presto-verifier/src/main/java/com/facebook/presto/verifier/framework/QueryType.java
DonghuiZhuo/presto
6613ef75b0afd5cdd0a3377bab65e49bc2c9a00e
[ "Apache-2.0" ]
24
2015-12-14T19:29:50.000Z
2021-11-23T07:52:31.000Z
presto-verifier/src/main/java/com/facebook/presto/verifier/framework/QueryType.java
DonghuiZhuo/presto
6613ef75b0afd5cdd0a3377bab65e49bc2c9a00e
[ "Apache-2.0" ]
109
2015-11-03T17:03:05.000Z
2021-12-17T06:19:56.000Z
presto-verifier/src/main/java/com/facebook/presto/verifier/framework/QueryType.java
DonghuiZhuo/presto
6613ef75b0afd5cdd0a3377bab65e49bc2c9a00e
[ "Apache-2.0" ]
19
2015-12-18T22:43:25.000Z
2021-12-17T06:13:46.000Z
36.438356
87
0.747368
998,589
/* * 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.facebook.presto.verifier.framework; import com.facebook.presto.sql.tree.CreateTableAsSelect; import com.facebook.presto.sql.tree.Insert; import com.facebook.presto.sql.tree.Query; import com.facebook.presto.sql.tree.ShowCatalogs; import com.facebook.presto.sql.tree.ShowColumns; import com.facebook.presto.sql.tree.ShowFunctions; import com.facebook.presto.sql.tree.ShowSchemas; import com.facebook.presto.sql.tree.ShowSession; import com.facebook.presto.sql.tree.ShowTables; import com.facebook.presto.sql.tree.Statement; import static com.facebook.presto.verifier.framework.QueryType.Category.DATA_PRODUCING; import static com.facebook.presto.verifier.framework.QueryType.Category.METADATA_READ; import static java.util.Objects.requireNonNull; public enum QueryType { CREATE_TABLE_AS_SELECT(DATA_PRODUCING, CreateTableAsSelect.class), INSERT(DATA_PRODUCING, Insert.class), QUERY(DATA_PRODUCING, Query.class), SHOW_CATALOGS(METADATA_READ, ShowCatalogs.class), SHOW_COLUMNS(METADATA_READ, ShowColumns.class), SHOW_FUNCTIONS(METADATA_READ, ShowFunctions.class), SHOW_SCHEMAS(METADATA_READ, ShowSchemas.class), SHOW_SESSION(METADATA_READ, ShowSession.class), SHOW_TABLES(METADATA_READ, ShowTables.class); public enum Category { DATA_PRODUCING, METADATA_READ } private final Category category; private final Class<? extends Statement> statementClass; QueryType(Category category, Class<? extends Statement> statementClass) { this.category = requireNonNull(category, "category is null"); this.statementClass = requireNonNull(statementClass, "statementClass is null"); } public static QueryType of(Statement statement) { for (QueryType queryType : values()) { if (queryType.statementClass.isAssignableFrom(statement.getClass())) { return queryType; } } throw new UnsupportedQueryTypeException(statement.getClass().getSimpleName()); } public Category getCategory() { return category; } }
9238d2bfa53773db42ff07f79a44d25964a442fb
2,154
java
Java
src/org/olap4j/query/AbstractSelection.java
AtScaleInc/olap4j-patch
1acc44aa90279be9968d1002c80a4d83a2843ee1
[ "Apache-2.0" ]
160
2015-01-20T04:20:42.000Z
2022-03-26T08:03:21.000Z
src/org/olap4j/query/AbstractSelection.java
moodmass/olap4j
b8eccd85753ffddb66c9d8b7c2cd7de2bd510ce0
[ "Apache-2.0" ]
39
2015-01-20T10:57:43.000Z
2021-04-26T07:01:23.000Z
src/org/olap4j/query/AbstractSelection.java
moodmass/olap4j
b8eccd85753ffddb66c9d8b7c2cd7de2bd510ce0
[ "Apache-2.0" ]
112
2015-01-12T09:39:37.000Z
2022-01-19T08:28:15.000Z
26.268293
77
0.691272
998,590
/* // Licensed to Julian Hyde under one or more contributor license // agreements. See the NOTICE file distributed with this work for // additional information regarding copyright ownership. // // Julian Hyde 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.olap4j.query; import org.olap4j.metadata.Dimension; import java.util.ArrayList; import java.util.List; /** * Abstract implementation of a selection. * * @author LBoudreau */ abstract class AbstractSelection extends QueryNodeImpl implements Selection { Operator operator; Dimension dimension; List<Selection> selectionContext; public AbstractSelection( Dimension dimension, Operator operator) { this.dimension = dimension; this.operator = operator; } public Dimension getDimension() { return dimension; } public Operator getOperator() { return operator; } public void setOperator(Operator operator) { assert operator != null; this.operator = operator; notifyChange(this,-1); } void tearDown() { } public List<Selection> getSelectionContext() { return selectionContext; } public void addContext(Selection selection) { if (selectionContext == null) { selectionContext = new ArrayList<Selection>(); } selectionContext.add(selection); } public void removeContext(Selection selection) { selectionContext.remove(selection); } public String getUniqueName() { return getRootElement().getUniqueName(); } } // End AbstractSelection.java
9238d3b9db919318f97cd0f18f4595189b057ad4
6,215
java
Java
Planmodeller/src/de.uni_kassel.cn.planDesigner.alica/src/de/uni_kassel/cn/alica/impl/UtilityImpl.java
RedundantEntry/cn-alica-ros-pkg
98ae1f842ec4418a12b2d6863a6b7a35249a8a4a
[ "BSD-3-Clause-Clear" ]
null
null
null
Planmodeller/src/de.uni_kassel.cn.planDesigner.alica/src/de/uni_kassel/cn/alica/impl/UtilityImpl.java
RedundantEntry/cn-alica-ros-pkg
98ae1f842ec4418a12b2d6863a6b7a35249a8a4a
[ "BSD-3-Clause-Clear" ]
null
null
null
Planmodeller/src/de.uni_kassel.cn.planDesigner.alica/src/de/uni_kassel/cn/alica/impl/UtilityImpl.java
RedundantEntry/cn-alica-ros-pkg
98ae1f842ec4418a12b2d6863a6b7a35249a8a4a
[ "BSD-3-Clause-Clear" ]
null
null
null
25.895833
119
0.656476
998,591
// Copyright 2009 Distributed Systems Group, University of Kassel // This program is distributed under the GNU Lesser General Public License (LGPL). // // This file is part of the Carpe Noctem Software Framework. // // The Carpe Noctem Software Framework is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // The Carpe Noctem Software Framework is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. /** * <copyright> * </copyright> * * $Id$ */ package de.uni_kassel.cn.alica.impl; import de.uni_kassel.cn.alica.AlicaPackage; import de.uni_kassel.cn.alica.Utility; import de.uni_kassel.cn.alica.UtilityMode; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Utility</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link de.uni_kassel.cn.alica.impl.UtilityImpl#getExpression <em>Expression</em>}</li> * <li>{@link de.uni_kassel.cn.alica.impl.UtilityImpl#getModes <em>Modes</em>}</li> * </ul> * </p> * * @generated */ public class UtilityImpl extends PlanElementImpl implements Utility { /** * The default value of the '{@link #getExpression() <em>Expression</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExpression() * @generated * @ordered */ protected static final String EXPRESSION_EDEFAULT = ""; /** * The cached value of the '{@link #getExpression() <em>Expression</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExpression() * @generated * @ordered */ protected String expression = EXPRESSION_EDEFAULT; /** * The cached value of the '{@link #getModes() <em>Modes</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getModes() * @generated * @ordered */ protected EList<UtilityMode> modes; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected UtilityImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlicaPackage.Literals.UTILITY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getExpression() { return expression; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExpression(String newExpression) { String oldExpression = expression; expression = newExpression; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlicaPackage.UTILITY__EXPRESSION, oldExpression, expression)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<UtilityMode> getModes() { if (modes == null) { modes = new EObjectContainmentEList<UtilityMode>(UtilityMode.class, this, AlicaPackage.UTILITY__MODES); } return modes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AlicaPackage.UTILITY__MODES: return ((InternalEList<?>)getModes()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AlicaPackage.UTILITY__EXPRESSION: return getExpression(); case AlicaPackage.UTILITY__MODES: return getModes(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AlicaPackage.UTILITY__EXPRESSION: setExpression((String)newValue); return; case AlicaPackage.UTILITY__MODES: getModes().clear(); getModes().addAll((Collection<? extends UtilityMode>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlicaPackage.UTILITY__EXPRESSION: setExpression(EXPRESSION_EDEFAULT); return; case AlicaPackage.UTILITY__MODES: getModes().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlicaPackage.UTILITY__EXPRESSION: return EXPRESSION_EDEFAULT == null ? expression != null : !EXPRESSION_EDEFAULT.equals(expression); case AlicaPackage.UTILITY__MODES: return modes != null && !modes.isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (expression: "); result.append(expression); result.append(')'); return result.toString(); } } //UtilityImpl
9238d4196e4181d3e3066380d82e2dc1e073e61b
661
java
Java
webapps/scag/WEB-INF/src/ru/sibinco/scag/backend/protocol/commands/endpoints/DeleteSvc.java
kirikprotocol/MSAG-Console
3afb52262adbf6519b148abaf3c8c287e4452388
[ "Apache-2.0" ]
null
null
null
webapps/scag/WEB-INF/src/ru/sibinco/scag/backend/protocol/commands/endpoints/DeleteSvc.java
kirikprotocol/MSAG-Console
3afb52262adbf6519b148abaf3c8c287e4452388
[ "Apache-2.0" ]
null
null
null
webapps/scag/WEB-INF/src/ru/sibinco/scag/backend/protocol/commands/endpoints/DeleteSvc.java
kirikprotocol/MSAG-Console
3afb52262adbf6519b148abaf3c8c287e4452388
[ "Apache-2.0" ]
null
null
null
25.346154
84
0.716237
998,592
/* * Copyright (c) 2005 SibInco Inc. All Rights Reserved. */ package ru.sibinco.scag.backend.protocol.commands.endpoints; import ru.sibinco.lib.SibincoException; import ru.sibinco.scag.backend.daemon.Command; /** * The <code>DeleteSvc</code> class represents * <p><p/> * Date: 12.10.2005 * Time: 11:30:10 * * @author &lt;a href="mailto:dycjh@example.com"&gt;Igor Klimenko&lt;/a&gt; */ public class DeleteSvc extends Command { public DeleteSvc(final String svcId, final int disconnect) throws SibincoException { super("deleteSme", "command_gw.dtd"); createStringParam("systemId", svcId); createIntParam("disconnect",disconnect); } }
9238d423c03b3a4adbce544d94edd0f2f30318da
5,217
java
Java
okapi/core/src/main/java/net/sf/okapi/common/encoder/DTDEncoder.java
vistatec/vistatec-okapi
17cd885f5fefd8236a95a0b203272795c42fea88
[ "Apache-2.0" ]
2
2018-08-15T02:40:30.000Z
2019-12-20T12:43:56.000Z
okapi/core/src/main/java/net/sf/okapi/common/encoder/DTDEncoder.java
vistatec/vistatec-okapi
17cd885f5fefd8236a95a0b203272795c42fea88
[ "Apache-2.0" ]
null
null
null
okapi/core/src/main/java/net/sf/okapi/common/encoder/DTDEncoder.java
vistatec/vistatec-okapi
17cd885f5fefd8236a95a0b203272795c42fea88
[ "Apache-2.0" ]
1
2019-08-21T06:22:25.000Z
2019-08-21T06:22:25.000Z
24.725118
84
0.602645
998,593
/*=========================================================================== Copyright (C) 2008-2010 by the Okapi Framework contributors ----------------------------------------------------------------------------- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ===========================================================================*/ package net.sf.okapi.common.encoder; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import net.sf.okapi.common.IParameters; /** * Implements {@link IEncoder} for DTD text. */ public class DTDEncoder implements IEncoder { private CharsetEncoder chsEnc; private String lineBreak; private String encoding; /** * Sets the options for this encoder. This encoder supports the following * @param params the parameters object with all the configuration information * specific to this encoder. * @param encoding the name of the charset encoding to use. * @param lineBreak the type of line break to use. */ @Override public void setOptions (IParameters params, String encoding, String lineBreak) { this.lineBreak = lineBreak; this.encoding = encoding; // Use an encoder only if the output is not UTF-8/16 // since those support all characters if ( "utf-8".equalsIgnoreCase(encoding) || "utf-16".equalsIgnoreCase(encoding) ) { chsEnc = null; } else { chsEnc = Charset.forName(encoding).newEncoder(); } } @Override public String encode (String text, EncoderContext context) { if ( text == null ) return ""; StringBuffer sbTmp = new StringBuffer(text.length()); char ch; for ( int i=0; i<text.length(); i++ ) { ch = text.charAt(i); switch ( ch ) { case '<': sbTmp.append("&lt;"); continue; case '&': sbTmp.append("&amp;"); continue; case '"': sbTmp.append("&quot;"); continue; case '%': sbTmp.append("&#37;"); continue; case '\n': sbTmp.append(lineBreak); break; default: if ( ch > 127 ) { // Extended chars if ( Character.isHighSurrogate(ch) ) { int cp = text.codePointAt(i++); String tmp = new String(Character.toChars(cp)); if (( chsEnc != null ) && !chsEnc.canEncode(tmp) ) { sbTmp.append(String.format("&#x%x;", cp)); } else { sbTmp.append(tmp); } } else { // Should be able to fold to char, supplementary case will be treated if (( chsEnc != null ) && !chsEnc.canEncode(ch) ) { sbTmp.append(String.format("&#x%04x;", (int)ch)); } else { // No encoder or char is supported sbTmp.append(String.valueOf(ch)); } } } else { // ASCII chars sbTmp.append(ch); } } } return sbTmp.toString(); } @Override public String encode (char value, EncoderContext context) { switch ( value ) { case '<': return "&lt;"; case '\"': return "&quot;"; case '%': return "&#37;"; case '&': return "&amp;"; case '\n': return lineBreak; default: if ( value > 127 ) { // Extended chars if (( chsEnc != null ) && ( !chsEnc.canEncode(value) )) { return String.format("&#x%04x;", (int)value); } else { // No encoder or char is supported return String.valueOf(value); } } else { // ASCII chars return String.valueOf(value); } } } @Override public String encode (int value, EncoderContext context) { switch ( value ) { case '<': return "&lt;"; case '\"': return "&quot;"; case '%': return "&#37;"; case '&': return "&amp;"; case '>': return "&gt;"; case '\n': return lineBreak; default: if ( value > 127 ) { // Extended chars if ( Character.isSupplementaryCodePoint(value) ) { String tmp = new String(Character.toChars(value)); if (( chsEnc != null ) && !chsEnc.canEncode(tmp) ) { return String.format("&#x%x;", value); } return tmp; } // Should be able to fold to char, supplementary case will be treated if (( chsEnc != null ) && !chsEnc.canEncode((char)value) ) { return String.format("&#x%04x;", value); } else { // No encoder or char is supported return String.valueOf((char)value); } } else { // ASCII chars return String.valueOf((char)value); } } } @Override public String toNative (String propertyName, String value) { // PROP_ENCODING: Same value in native // PROP_LANGUAGE: Same value in native return value; } @Override public String getLineBreak () { return this.lineBreak; } @Override public CharsetEncoder getCharsetEncoder () { return chsEnc; } @Override public IParameters getParameters() { return null; } @Override public String getEncoding() { return encoding; } }
9238d4acaeea1a7bd6fc790dbe91a40d56b180cc
633
java
Java
silverstripe-client/src/main/java/space/swordfish/silverstripe/client/configuration/ThreadPoolTaskSchedulerConfiguration.java
peavers/cwp-backup-service
bdf6f992c266ba1704577a49a0ac05c8432b7fdd
[ "MIT" ]
2
2018-01-29T09:10:49.000Z
2018-01-31T03:17:42.000Z
silverstripe-client/src/main/java/space/swordfish/silverstripe/client/configuration/ThreadPoolTaskSchedulerConfiguration.java
peavers/cwp-backup-service
bdf6f992c266ba1704577a49a0ac05c8432b7fdd
[ "MIT" ]
null
null
null
silverstripe-client/src/main/java/space/swordfish/silverstripe/client/configuration/ThreadPoolTaskSchedulerConfiguration.java
peavers/cwp-backup-service
bdf6f992c266ba1704577a49a0ac05c8432b7fdd
[ "MIT" ]
null
null
null
33.315789
84
0.845182
998,594
package space.swordfish.silverstripe.client.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; @Configuration public class ThreadPoolTaskSchedulerConfiguration { @Bean public ThreadPoolTaskScheduler threadPoolTaskScheduler() { ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); threadPoolTaskScheduler.setPoolSize(5); threadPoolTaskScheduler.setThreadNamePrefix("ThreadPoolTaskScheduler"); return threadPoolTaskScheduler; } }
9238d7bfa9417b9db03be5fd99831b65085fa50e
111
java
Java
src/main/java/io/shiftleft/model/Constants.java
olivenbaum1/shiftleft-java-demo
3d37c493cd9de0deea2fb6edf3068f2f4259e32b
[ "MIT" ]
12
2017-10-10T15:50:33.000Z
2021-12-12T00:26:31.000Z
src/main/java/io/shiftleft/model/Constants.java
olivenbaum1/shiftleft-java-demo
3d37c493cd9de0deea2fb6edf3068f2f4259e32b
[ "MIT" ]
691
2021-02-10T16:44:05.000Z
2022-01-29T03:42:39.000Z
src/main/java/io/shiftleft/model/Constants.java
note/shiftleft-java-demo
eff31d5ae062c5cfc0ad1f0e4f29ad8d7cf4a1a4
[ "MIT" ]
3,031
2020-06-25T18:17:09.000Z
2022-03-28T06:29:14.000Z
13.875
31
0.738739
998,595
package io.shiftleft.model; public class Constants { public enum Type { CHECKING, SAVING, MONEYMARKET } }
9238d87a80a23fb3ea3f0b8fa572582f639e5b8f
4,905
java
Java
services/iam/src/main/java/com/huaweicloud/sdk/iam/v3/model/KeystoneGroupResult.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
50
2020-05-18T11:35:20.000Z
2022-03-15T02:07:05.000Z
services/iam/src/main/java/com/huaweicloud/sdk/iam/v3/model/KeystoneGroupResult.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
45
2020-07-06T03:34:12.000Z
2022-03-31T09:41:54.000Z
services/iam/src/main/java/com/huaweicloud/sdk/iam/v3/model/KeystoneGroupResult.java
huaweicloud/huaweicloud-sdk-java-v3
a01cd21a3d03f6dffc807bea7c522e34adfa368d
[ "Apache-2.0" ]
27
2020-05-28T11:08:44.000Z
2022-03-30T03:30:37.000Z
25.283505
106
0.610805
998,596
package com.huaweicloud.sdk.iam.v3.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; import java.util.function.Consumer; /** * */ public class KeystoneGroupResult { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "description") private String description; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "id") private String id; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "domain_id") private String domainId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "name") private String name; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "links") private Links links; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "create_time") private Long createTime; public KeystoneGroupResult withDescription(String description) { this.description = description; return this; } /** 用户组描述信息。 * * @return description */ public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public KeystoneGroupResult withId(String id) { this.id = id; return this; } /** 用户组ID。 * * @return id */ public String getId() { return id; } public void setId(String id) { this.id = id; } public KeystoneGroupResult withDomainId(String domainId) { this.domainId = domainId; return this; } /** 用户组所属账号ID。 * * @return domainId */ public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } public KeystoneGroupResult withName(String name) { this.name = name; return this; } /** 用户组名称。 * * @return name */ public String getName() { return name; } public void setName(String name) { this.name = name; } public KeystoneGroupResult withLinks(Links links) { this.links = links; return this; } public KeystoneGroupResult withLinks(Consumer<Links> linksSetter) { if (this.links == null) { this.links = new Links(); linksSetter.accept(this.links); } return this; } /** Get links * * @return links */ public Links getLinks() { return links; } public void setLinks(Links links) { this.links = links; } public KeystoneGroupResult withCreateTime(Long createTime) { this.createTime = createTime; return this; } /** 用户组创建时间。 * * @return createTime */ public Long getCreateTime() { return createTime; } public void setCreateTime(Long createTime) { this.createTime = createTime; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KeystoneGroupResult keystoneGroupResult = (KeystoneGroupResult) o; return Objects.equals(this.description, keystoneGroupResult.description) && Objects.equals(this.id, keystoneGroupResult.id) && Objects.equals(this.domainId, keystoneGroupResult.domainId) && Objects.equals(this.name, keystoneGroupResult.name) && Objects.equals(this.links, keystoneGroupResult.links) && Objects.equals(this.createTime, keystoneGroupResult.createTime); } @Override public int hashCode() { return Objects.hash(description, id, domainId, name, links, createTime); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class KeystoneGroupResult {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" domainId: ").append(toIndentedString(domainId)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" links: ").append(toIndentedString(links)).append("\n"); sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n"); sb.append("}"); return sb.toString(); } /** Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
9238d889a9072014f5952c4d12a252912ee22b2e
2,679
java
Java
src/main/java/proguard/classfile/editor/MemberRemover.java
md-5/proguard-core
6cd532a03c82eb27b14920e38b44130500acdf5d
[ "Apache-2.0" ]
169
2020-06-02T10:20:06.000Z
2022-03-22T11:33:08.000Z
src/main/java/proguard/classfile/editor/MemberRemover.java
md-5/proguard-core
6cd532a03c82eb27b14920e38b44130500acdf5d
[ "Apache-2.0" ]
23
2020-06-02T20:21:00.000Z
2022-01-14T16:47:48.000Z
src/main/java/proguard/classfile/editor/MemberRemover.java
md-5/proguard-core
6cd532a03c82eb27b14920e38b44130500acdf5d
[ "Apache-2.0" ]
25
2020-06-16T12:53:56.000Z
2022-01-16T08:34:26.000Z
27.336735
90
0.684584
998,597
/* * ProGuardCORE -- library to process Java bytecode. * * Copyright (c) 2002-2020 Guardsquare NV * * 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 proguard.classfile.editor; import proguard.classfile.*; import proguard.classfile.visitor.*; import java.util.*; /** * This visitor removes all members it visits in a {@link ProgramClass}. * <p/> * It should be used in two steps: * <ul> * <li>in the first step, the collection step, all program fields to be removed * should be visited. * <li>in the second step, the removal step, the program class containing the * program fields should be visited. This will actually delete all * collected fields. * </ul> * <p/> * For example, to remove all fields in a program class: * <pre> * MemberRemover remover = new MemberRemover(); * programClass.fieldsAccept(remover); * programClass.accept(remover); * </pre> * * @author Johan Leys */ public class MemberRemover implements ClassVisitor, MemberVisitor { private Set<Method> methodsToRemove = new HashSet<>(); private Set<Field> fieldsToRemove = new HashSet<>(); // Implementations for ClassVisitor. @Override public void visitAnyClass(Clazz clazz) {} @Override public void visitProgramClass(ProgramClass programClass) { ClassEditor classEditor = new ClassEditor(programClass); // Remove all collected methods. for (Method method : methodsToRemove) { classEditor.removeMethod(method); } methodsToRemove.clear(); // Remove all collected fields. for (Field field : fieldsToRemove) { classEditor.removeField(field); } fieldsToRemove.clear(); } // Implementations for MemberVisitor. public void visitAnyMember(Clazz clazz, Member member) {} public void visitProgramField(ProgramClass programClass, ProgramField programField) { fieldsToRemove.add(programField); } public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { methodsToRemove.add(programMethod); } }
9238d8d60da3ddcbed30fd62487f40e53c11b67e
1,397
java
Java
server/mprjct3/src/com/unb/matriculeme/dao/Sugestao.java
sant0ro/matriculeMe
e849d8d99ed1ba44848bb1f1cb3c1ea16cfb321a
[ "MIT" ]
9
2016-09-17T18:50:26.000Z
2017-04-18T11:17:30.000Z
server/mprjct3/src/com/unb/matriculeme/dao/Sugestao.java
ovflowd/matriculeMe
e849d8d99ed1ba44848bb1f1cb3c1ea16cfb321a
[ "MIT" ]
30
2016-09-21T00:03:58.000Z
2016-12-03T00:25:47.000Z
server/mprjct3/src/com/unb/matriculeme/dao/Sugestao.java
ovflowd/matriculeMe
e849d8d99ed1ba44848bb1f1cb3c1ea16cfb321a
[ "MIT" ]
5
2016-09-20T12:14:37.000Z
2016-09-22T23:13:08.000Z
18.878378
66
0.615605
998,598
package com.unb.matriculeme.dao; import javax.persistence.*; @Entity public class Sugestao { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @ManyToOne(cascade = {CascadeType.REFRESH, CascadeType.MERGE}) @JoinColumn private Disciplina disciplina; @Column(nullable = false) private int prioridade; @Column private boolean vagas; @Column private String motivo; @Column(nullable = false) private int creditos; public Sugestao() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public Disciplina getDisciplina() { return this.disciplina; } public void setDisciplina(Disciplina disciplina) { this.disciplina = disciplina; } public int getPrioridade() { return prioridade; } public void setPrioridade(int prioridade) { this.prioridade = prioridade; } public boolean isVagas() { return vagas; } public void setVagas(boolean vagas) { this.vagas = vagas; } public String getMotivo() { return motivo; } public void setMotivo(String motivo) { this.motivo = motivo; } public int getCreditos() { return creditos; } public void setCreditos(int creditos) { this.creditos = creditos; } }
9238db10af554d431f9f5bf50ebb3be0fa35b617
188
java
Java
xml-utils/src/main/java/com/what/xml/XmlUtil.java
yishuixing/xml-tools
c8fb6ce38705b7f4e79e980d36d68d3e15ab2d62
[ "Apache-2.0" ]
null
null
null
xml-utils/src/main/java/com/what/xml/XmlUtil.java
yishuixing/xml-tools
c8fb6ce38705b7f4e79e980d36d68d3e15ab2d62
[ "Apache-2.0" ]
null
null
null
xml-utils/src/main/java/com/what/xml/XmlUtil.java
yishuixing/xml-tools
c8fb6ce38705b7f4e79e980d36d68d3e15ab2d62
[ "Apache-2.0" ]
null
null
null
11.75
44
0.601064
998,599
package com.what.xml; public class XmlUtil { public static void main(String[] args) { } public void toXml(Object o) { } public void toBean(String file) { } }
9238db169ec62e6cb4200789a9c648eeb9fcd205
1,943
java
Java
gocd-yum-repo-plugin/src/test/java/com/tw/go/plugin/material/artifactrepository/yum/exec/FileBasedConnectionCheckerTest.java
gugiyug/gocdk
20d1e72098b144614f3b786e4a7d404fa179fbac
[ "Apache-2.0" ]
null
null
null
gocd-yum-repo-plugin/src/test/java/com/tw/go/plugin/material/artifactrepository/yum/exec/FileBasedConnectionCheckerTest.java
gugiyug/gocdk
20d1e72098b144614f3b786e4a7d404fa179fbac
[ "Apache-2.0" ]
null
null
null
gocd-yum-repo-plugin/src/test/java/com/tw/go/plugin/material/artifactrepository/yum/exec/FileBasedConnectionCheckerTest.java
gugiyug/gocdk
20d1e72098b144614f3b786e4a7d404fa179fbac
[ "Apache-2.0" ]
null
null
null
35.327273
119
0.691199
998,600
/* * Copyright 2022 ThoughtWorks, 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.tw.go.plugin.material.artifactrepository.yum.exec; import org.junit.jupiter.api.Test; import java.io.File; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; public class FileBasedConnectionCheckerTest { @Test public void shouldNotThrowExceptionIfFileExistsPasses() { String absolutePath = new File("").getAbsolutePath(); new FileBasedConnectionChecker().checkConnection("file://" + absolutePath, new Credentials(null, null)); } @Test public void shouldThrowExceptionIfUserNameAndPasswordIsProvided() { String absolutePath = new File("").getAbsolutePath(); try { new FileBasedConnectionChecker().checkConnection("file://" + absolutePath, new Credentials("user", "pwd")); fail("should fail"); } catch (Exception e) { assertEquals("File protocol does not support username and/or password.", e.getMessage()); } } @Test public void shouldFailCheckConnectionIfFileDoesNotExist() { try { new FileBasedConnectionChecker().checkConnection("file://foo", new Credentials(null, null)); fail("should fail"); } catch (Exception e) { assertEquals("Invalid file path.", e.getMessage()); } } }
9238db62baef39c54bc69cbab08462f9bcf23ebe
8,815
java
Java
java/com/google/copybara/feedback/FinishHookContext.java
edbaunton/copybara
54cabcac61e06c76aba49e34bdcbbc6d1affda34
[ "Apache-2.0" ]
null
null
null
java/com/google/copybara/feedback/FinishHookContext.java
edbaunton/copybara
54cabcac61e06c76aba49e34bdcbbc6d1affda34
[ "Apache-2.0" ]
null
null
null
java/com/google/copybara/feedback/FinishHookContext.java
edbaunton/copybara
54cabcac61e06c76aba49e34bdcbbc6d1affda34
[ "Apache-2.0" ]
null
null
null
42.177033
101
0.704481
998,601
/* * Copyright (C) 2018 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.copybara.feedback; import static com.google.copybara.exception.ValidationException.checkCondition; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.copybara.DestinationEffect; import com.google.copybara.DestinationEffect.DestinationRef; import com.google.copybara.DestinationEffect.OriginRef; import com.google.copybara.Endpoint; import com.google.copybara.Revision; import com.google.copybara.SkylarkContext; import com.google.copybara.config.SkylarkUtil; import com.google.copybara.exception.ValidationException; import com.google.copybara.transform.SkylarkConsole; import com.google.devtools.build.lib.skylarkinterface.Param; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory; import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.Runtime; import com.google.devtools.build.lib.syntax.SkylarkDict; import com.google.devtools.build.lib.syntax.SkylarkList; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * Gives access to the feedback migration information and utilities. * TODO(danielromero): Consider merging this with FeedbackContext to avoid duplication */ @SkylarkModule(name = "feedback.finish_hook_context", category = SkylarkModuleCategory.BUILTIN, doc = "Gives access to the feedback migration information and utilities.") public class FinishHookContext implements SkylarkContext<FinishHookContext> { private final Action action; private final Endpoint origin; private final Endpoint destination; private final SkylarkRevision resolvedRevision; private final SkylarkConsole console; private final SkylarkDict params; private final ImmutableList<DestinationEffect> destinationEffects; private final List<DestinationEffect> newDestinationEffects = new ArrayList<>(); public FinishHookContext(Action action, Endpoint origin, Endpoint destination, ImmutableList<DestinationEffect> destinationEffects, Revision resolvedRevision, SkylarkConsole console) { this(action, origin, destination, destinationEffects, console, SkylarkDict.empty(), new SkylarkRevision(resolvedRevision)); } private FinishHookContext(Action action, Endpoint origin, Endpoint destination, ImmutableList<DestinationEffect> destinationEffects, SkylarkConsole console, SkylarkDict params, SkylarkRevision resolvedRevision) { this.action = Preconditions.checkNotNull(action); this.origin = Preconditions.checkNotNull(origin); this.destination = Preconditions.checkNotNull(destination); this.destinationEffects = Preconditions.checkNotNull(destinationEffects); this.resolvedRevision = resolvedRevision; this.console = Preconditions.checkNotNull(console); this.params = Preconditions.checkNotNull(params); } @SkylarkCallable(name = "origin", doc = "An object representing the origin. Can be used to" + " query about the state", structField = true) public Endpoint getOrigin() { return origin; } @SkylarkCallable(name = "destination", doc = "An object representing the destination. Can be used" + " to query or modify the destination state", structField = true) public Endpoint getDestination() { return destination; } @SkylarkCallable(name = "effects", doc = "The list of effects that happened in the destination", structField = true) public SkylarkList<DestinationEffect> getChanges() { return SkylarkList.createImmutable(destinationEffects); } @SkylarkCallable(name = "revision", doc = "Get the requested/resolved revision", structField = true) public SkylarkRevision getRevision() { return resolvedRevision; } @SkylarkCallable(name = "console", doc = "Get an instance of the console to report errors or" + " warnings", structField = true) public SkylarkConsole getConsole() { return console; } @SkylarkCallable(name = "params", doc = "Parameters for the function if created with" + " core.dynamic_feedback", structField = true) public SkylarkDict getParams() { return params; } @Override public FinishHookContext withParams(SkylarkDict<?, ?> params) { return new FinishHookContext( action, origin, destination, destinationEffects, console, params, resolvedRevision); } @SkylarkCallable( name = "record_effect", doc = "Records an effect of the current action.", parameters = { @Param(name = "summary", type = String.class, doc = "The summary of this effect"), @Param( name = "origin_refs", type = SkylarkList.class, generic1 = OriginRef.class, doc = "The origin refs"), @Param(name = "destination_ref", type = DestinationRef.class, doc = "The destination ref"), @Param( name = "errors", type = SkylarkList.class, generic1 = String.class, defaultValue = "[]", doc = "An optional list of errors"), @Param( name = "type", type = String.class, doc = "The type of migration effect:<br>" + "<ul>" + "<li><b>'CREATED'</b>: A new review or change was created.</li>" + "<li><b>'UPDATED'</b>: An existing review or change was updated.</li>" + "<li><b>'NOOP'</b>: The change was a noop.</li>" + "<li><b>'INSUFFICIENT_APPROVALS'</b>: The effect couldn't happen because " + "the change doesn't have enough approvals.</li>" + "<li><b>'ERROR'</b>: A user attributable error happened that prevented " + "the destination from creating/updating the change. " + "</ul>", defaultValue = "\"UPDATED\"" ) }) public void recordEffect( String summary, List<OriginRef> originRefs, DestinationRef destinationRef, List<String> errors, String typeStr) throws EvalException { DestinationEffect.Type type = SkylarkUtil.stringToEnum(null, "type", typeStr, DestinationEffect.Type.class); newDestinationEffects.add( new DestinationEffect(type, summary, originRefs, destinationRef, errors)); } /** * Return the new {@link DestinationEffect}s created by this context. */ public List<DestinationEffect> getNewDestinationEffects() { return ImmutableList.copyOf(newDestinationEffects); } @Override public void onFinish(Object result, SkylarkContext actionContext) throws ValidationException { checkCondition( result == null || result.equals(Runtime.NONE), "Finish hook '%s' cannot return any result but returned: %s", action.getName(), result); // Populate effects registered in the action context. This is required because SkylarkAction // makes a copy of the context to inject the parameters, but that instance is not visible from // the caller this.newDestinationEffects.addAll( ((FinishHookContext) actionContext).getNewDestinationEffects()); } @SkylarkModule(name = "feedback.revision_context", category = SkylarkModuleCategory.BUILTIN, doc = "Information about the revision request/resolved for the migration") private static class SkylarkRevision { private final Revision revision; SkylarkRevision(Revision revision) { this.revision = Preconditions.checkNotNull(revision); } @SkylarkCallable(name = "labels", doc = "A dictionary with the labels detected for the" + " requested/resolved revision.", structField = true) public SkylarkDict<String, SkylarkList<String>> getLabels() { return SkylarkDict.copyOf(/* env= */ null, revision.associatedLabels().asMap().entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> SkylarkList.createImmutable(e.getValue())))); } } }
9238db6fb28b9154ca80dfd19ca279456cb8d870
1,500
java
Java
insurance-drools/src/main/java/com/dafy/drools/point/clacPointXls.java
ysq2017/test
2fca42bbcc77bf9eedb816d66e24b00ca966fb55
[ "Apache-2.0" ]
null
null
null
insurance-drools/src/main/java/com/dafy/drools/point/clacPointXls.java
ysq2017/test
2fca42bbcc77bf9eedb816d66e24b00ca966fb55
[ "Apache-2.0" ]
null
null
null
insurance-drools/src/main/java/com/dafy/drools/point/clacPointXls.java
ysq2017/test
2fca42bbcc77bf9eedb816d66e24b00ca966fb55
[ "Apache-2.0" ]
null
null
null
26.785714
92
0.583333
998,603
package com.dafy.drools.point; import org.kie.api.KieServices; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieSession; public class clacPointXls { static KieSession getSession() { KieServices ks = KieServices.Factory.get(); KieContainer kc = ks.getKieClasspathContainer(); return kc.newKieSession("ksession-calcXLS"); } public static void main(String[] args) { // KieSession kSession = getSession(); // // User user = new User(); // user.setName("张学友"); // user.setLevel(1); // Order order1 = new Order(new Date(),90,user,0); // Order order2 = new Order(new Date(),400,user,0); // Order order3 = new Order(new Date(),500,user,0); // Order order4 = new Order(new Date(),6000,user,0); // Order order5 = new Order(new Date(),600,user,20000); // // List<Order> orderList = new ArrayList(); // orderList.add(order1); // orderList.add(order2); // orderList.add(order3); // orderList.add(order4); // orderList.add(order5); // // for(Order order:orderList){ // kSession.insert(order); // } // // int ruleFiredCount = kSession.fireAllRules(); // kSession.dispose(); // // System.out.println("触发了" + ruleFiredCount + "条规则"); // // // for(Order order:orderList){ // System.out.println("amount:"+order.getAmount() +", score:"+ order.getScore()); // } // // // } }
9238dbbf0bdfc6504d0d00e5f1a34d77c28c4a01
2,188
java
Java
programming/Java/comecando-primefaces/src/main/java/com/algaworks/erp/model/Empresa.java
diegocavalca/education
a36b1cfedd1050d642a57b7273a93ad8faf8875b
[ "CC0-1.0" ]
1
2020-10-12T01:35:08.000Z
2020-10-12T01:35:08.000Z
programming/Java/comecando-primefaces/src/main/java/com/algaworks/erp/model/Empresa.java
diegocavalca/Studies
a36b1cfedd1050d642a57b7273a93ad8faf8875b
[ "CC0-1.0" ]
null
null
null
programming/Java/comecando-primefaces/src/main/java/com/algaworks/erp/model/Empresa.java
diegocavalca/Studies
a36b1cfedd1050d642a57b7273a93ad8faf8875b
[ "CC0-1.0" ]
1
2022-01-18T11:01:49.000Z
2022-01-18T11:01:49.000Z
19.362832
63
0.712066
998,604
package com.algaworks.erp.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity public class Empresa implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; @Column(name = "nome_fantasia", nullable = false, length = 80) private String nomeFantasia; @Column(name = "razao_social", nullable = false, length = 120) private String razaoSocial; @Column(nullable = false, length = 18) private String cnpj; @Temporal(TemporalType.DATE) @Column(name = "data_fundacao") private Date dataFundacao; @Enumerated(EnumType.STRING) private TipoEmpresa tipo; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNomeFantasia() { return nomeFantasia; } public void setNomeFantasia(String nomeFantasia) { this.nomeFantasia = nomeFantasia; } public String getRazaoSocial() { return razaoSocial; } public void setRazaoSocial(String razaoSocial) { this.razaoSocial = razaoSocial; } public String getCnpj() { return cnpj; } public void setCnpj(String cnpj) { this.cnpj = cnpj; } public Date getDataFundacao() { return dataFundacao; } public void setDataFundacao(Date dataFundacao) { this.dataFundacao = dataFundacao; } public TipoEmpresa getTipo() { return tipo; } public void setTipo(TipoEmpresa tipo) { this.tipo = tipo; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Empresa other = (Empresa) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
9238dd177dd5f1495ba65ecf2f10fbe72cff0dc4
1,270
java
Java
src/main/java/org/b3log/symphony/util/Base64.java
yangchangming/gzit-web
54448b2e8b6feced71981a3becf99637cb36890c
[ "Apache-2.0" ]
null
null
null
src/main/java/org/b3log/symphony/util/Base64.java
yangchangming/gzit-web
54448b2e8b6feced71981a3becf99637cb36890c
[ "Apache-2.0" ]
null
null
null
src/main/java/org/b3log/symphony/util/Base64.java
yangchangming/gzit-web
54448b2e8b6feced71981a3becf99637cb36890c
[ "Apache-2.0" ]
null
null
null
37.875
626
0.79648
998,605
package org.b3log.symphony.util; public class Base64 { public Base64() {} public static String encodeBase64(String str) { try { return new String(org.apache.commons.codec.binary.Base64.encodeBase64(str.getBytes("UTF-8"))); } catch (Exception e) { e.printStackTrace(); } return ""; } public static String encodeBase64(byte[] data) { try { return new String(org.apache.commons.codec.binary.Base64.encodeBase64(data),"utf-8"); } catch (Exception e) { e.printStackTrace(); } return ""; } public static String decodeBase64(String strhex) { return new String(org.apache.commons.codec.binary.Base64.decodeBase64(strhex.getBytes())); } public static byte[] decodeBase64ToByte(String strhex) { return org.apache.commons.codec.binary.Base64.decodeBase64(strhex.getBytes()); } public static String encodeBase64ForByte(byte[] src) { try { return new String(org.apache.commons.codec.binary.Base64.encodeBase64(src)); } catch (Exception e) { e.printStackTrace(); } return ""; } public static void main(String[] args) { System.out.println(Base64.encodeBase64("edooon")); System.out.println(Base64.encodeBase64("edooonmail3215")); System.out.println(Base64.decodeBase64("ax5kh6jaqkcd2tiexxs8v6xjo8yv8a6b")); } }
9238dd50e2ae260b537ffd3e5fea96f18ffd22d2
14,775
java
Java
message-builder-ccda-pcs-r1_1/src/main/java/ca/infoway/messagebuilder/model/ccda_pcs_r1_1/merged/Performer2_1Bean.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
1
2022-03-09T12:17:41.000Z
2022-03-09T12:17:41.000Z
message-builder-ccda-pcs-r1_1/src/main/java/ca/infoway/messagebuilder/model/ccda_pcs_r1_1/merged/Performer2_1Bean.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
null
null
null
message-builder-ccda-pcs-r1_1/src/main/java/ca/infoway/messagebuilder/model/ccda_pcs_r1_1/merged/Performer2_1Bean.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
null
null
null
34.846698
314
0.620508
998,606
/** * Copyright 2013 Canada Health Infoway, 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. * * Author: $LastChangedBy: tmcgrady $ * Last modified: $LastChangedDate: 2011-05-04 15:47:15 -0400 (Wed, 04 May 2011) $ * Revision: $LastChangedRevision: 2623 $ */ /* This class was auto-generated by the message builder generator tools. */ package ca.infoway.messagebuilder.model.ccda_pcs_r1_1.merged; import ca.infoway.messagebuilder.Code; import ca.infoway.messagebuilder.annotation.Hl7PartTypeMapping; import ca.infoway.messagebuilder.annotation.Hl7XmlMapping; import ca.infoway.messagebuilder.datatype.CE; import ca.infoway.messagebuilder.datatype.CS; import ca.infoway.messagebuilder.datatype.II; import ca.infoway.messagebuilder.datatype.IVLTSCDAR1; import ca.infoway.messagebuilder.datatype.LIST; import ca.infoway.messagebuilder.datatype.impl.CEImpl; import ca.infoway.messagebuilder.datatype.impl.CSImpl; import ca.infoway.messagebuilder.datatype.impl.IIImpl; import ca.infoway.messagebuilder.datatype.impl.IVLTSCDAR1Impl; import ca.infoway.messagebuilder.datatype.impl.LISTImpl; import ca.infoway.messagebuilder.datatype.lang.DateInterval; import ca.infoway.messagebuilder.datatype.lang.Identifier; import ca.infoway.messagebuilder.model.MessagePartBean; import ca.infoway.messagebuilder.model.ccda_pcs_r1_1.domainvalue.x_ServiceEventPerformer; import java.util.List; @Hl7PartTypeMapping({"BaseModel.Performer1","BaseModel.Performer2","EncounterActivities.Performer2","ImmunizationActivity.Performer2","MedicationActivity.Performer2"}) public class Performer2_1Bean extends MessagePartBean implements ca.infoway.messagebuilder.model.ccda_pcs_r1_1.policyactivity.Performer2Choice, ca.infoway.messagebuilder.model.ccda_pcs_r1_1.procedureactivityprocedure.Performer2Choice, ca.infoway.messagebuilder.model.ccda_pcs_r1_1.operativenote.Performer1Choice { private static final long serialVersionUID = 20160107L; private II typeId = new IIImpl(); private LIST<II, Identifier> templateId = new LISTImpl<II, Identifier>(IIImpl.class); private IVLTSCDAR1 time = new IVLTSCDAR1Impl(); private CE modeCode = new CEImpl(); private AssignedEntity_1Bean assignedEntity; private CS typeCode = new CSImpl(); private CE functionCode = new CEImpl(); /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ @Hl7XmlMapping({"typeId"}) public Identifier getTypeId() { return this.typeId.getValue(); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.typeId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ public void setTypeId(Identifier typeId) { this.typeId.setValue(typeId); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.templateId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-*)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.templateId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-*)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.templateId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-*)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.templateId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-*)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.templateId</p> * * <p>Conformance/Cardinality: OPTIONAL (0-*)</p> */ @Hl7XmlMapping({"templateId"}) public List<Identifier> getTemplateId() { return this.templateId.rawList(); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ @Hl7XmlMapping({"time"}) public DateInterval getTime() { return this.time.getValue(); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.time</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ public void setTime(DateInterval time) { this.time.setValue(time); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ @Hl7XmlMapping({"modeCode"}) public Code getModeCode() { return (Code) this.modeCode.getValue(); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: ImmunizationActivity.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: EncounterActivities.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: MedicationActivity.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.modeCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ public void setModeCode(Code modeCode) { this.modeCode.setValue(modeCode); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: * ImmunizationActivity.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: * EncounterActivities.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: * MedicationActivity.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> */ @Hl7XmlMapping({"assignedEntity"}) public AssignedEntity_1Bean getAssignedEntity() { return this.assignedEntity; } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: * ImmunizationActivity.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: * EncounterActivities.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: * MedicationActivity.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer2.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> * * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.assignedEntity</p> * * <p>Conformance/Cardinality: POPULATED (1)</p> */ public void setAssignedEntity(AssignedEntity_1Bean assignedEntity) { this.assignedEntity = assignedEntity; } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.typeCode</p> * * <p>Conformance/Cardinality: MANDATORY (1)</p> */ @Hl7XmlMapping({"typeCode"}) public x_ServiceEventPerformer getTypeCode() { return (x_ServiceEventPerformer) this.typeCode.getValue(); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.typeCode</p> * * <p>Conformance/Cardinality: MANDATORY (1)</p> */ public void setTypeCode(x_ServiceEventPerformer typeCode) { this.typeCode.setValue(typeCode); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.functionCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ @Hl7XmlMapping({"functionCode"}) public Code getFunctionCode() { return (Code) this.functionCode.getValue(); } /** * <p>Un-merged Business Name: (no business name specified)</p> * * <p>Relationship: BaseModel.Performer1.functionCode</p> * * <p>Conformance/Cardinality: OPTIONAL (0-1)</p> */ public void setFunctionCode(Code functionCode) { this.functionCode.setValue(functionCode); } }
9238de0f67c2f23548148059a11d2546a794408d
3,129
java
Java
bin/modules/filemanager/src/main/java/com/beanframework/filemanager/utils/FileUtils.java
williamtanws/beanframework
f89e6708f9e7deb79188cff7e306ae9487f9291c
[ "MIT" ]
1
2019-07-29T06:34:26.000Z
2019-07-29T06:34:26.000Z
bin/modules/filemanager/src/main/java/com/beanframework/filemanager/utils/FileUtils.java
williamtanws/beanframework
f89e6708f9e7deb79188cff7e306ae9487f9291c
[ "MIT" ]
12
2019-04-06T15:47:52.000Z
2021-05-09T04:59:03.000Z
bin/modules/filemanager/src/main/java/com/beanframework/filemanager/utils/FileUtils.java
williamtanws/beanframework
f89e6708f9e7deb79188cff7e306ae9487f9291c
[ "MIT" ]
null
null
null
27.9375
89
0.683605
998,607
package com.beanframework.filemanager.utils; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.PosixFileAttributeView; import java.nio.file.attribute.PosixFileAttributes; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.Set; import org.apache.commons.lang3.StringUtils; public class FileUtils { public static String getExtension(String fileName) { if (StringUtils.INDEX_NOT_FOUND == StringUtils.indexOf(fileName, ".")) return StringUtils.EMPTY; String ext = StringUtils.substring(fileName, StringUtils.lastIndexOf(fileName, ".")); return StringUtils.trimToEmpty(ext); } public static String getFileName(String header) { String[] tempArr1 = header.split(";"); String[] tempArr2 = tempArr1[2].split("="); return tempArr2[1].substring(tempArr2[1].lastIndexOf("\\") + 1).replaceAll("\"", ""); } public static String getPermissions(Path path) throws IOException { PosixFileAttributeView fileAttributeView = Files.getFileAttributeView(path, PosixFileAttributeView.class); PosixFileAttributes readAttributes = fileAttributeView.readAttributes(); Set<PosixFilePermission> permissions = readAttributes.permissions(); return PosixFilePermissions.toString(permissions); } public static String setPermissions(File file, String permsCode, boolean recursive) throws IOException { PosixFileAttributeView fileAttributeView = Files.getFileAttributeView(file.toPath(), PosixFileAttributeView.class); fileAttributeView.setPermissions(PosixFilePermissions.fromString(permsCode)); if (file.isDirectory() && recursive && file.listFiles() != null) { for (File f : file.listFiles()) { setPermissions(f, permsCode, true); } } return permsCode; } public static boolean write(InputStream inputStream, File f) { boolean ret = false; try (OutputStream outputStream = new FileOutputStream(f)) { int read; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, read); } ret = true; } catch (IOException e) { e.printStackTrace(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } return ret; } public static void mkFolder(String fileName) { File f = new File(fileName); if (!f.exists()) { f.mkdir(); } } public static File mkFile(String fileName) { File f = new File(fileName); try { f.createNewFile(); } catch (IOException e) { e.printStackTrace(); } return f; } public static void fileProber(File dirFile) { File parentFile = dirFile.getParentFile(); if (!parentFile.exists()) { fileProber(parentFile); parentFile.mkdir(); } } }
9238dea81adc90e595dea2ce211388988248adbd
322
java
Java
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/redis/RuleConsts.java
wayen2015/Sentinel
1b6eba2871f35c001bc0f64414fb36d831f193a8
[ "Apache-2.0" ]
null
null
null
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/redis/RuleConsts.java
wayen2015/Sentinel
1b6eba2871f35c001bc0f64414fb36d831f193a8
[ "Apache-2.0" ]
null
null
null
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/redis/RuleConsts.java
wayen2015/Sentinel
1b6eba2871f35c001bc0f64414fb36d831f193a8
[ "Apache-2.0" ]
null
null
null
32.2
64
0.754658
998,608
package com.alibaba.csp.sentinel.dashboard.rule.redis; public interface RuleConsts { //流控规则key前缀 public final String RULE_FLOW = "sentinel_rule_flow_"; //限流规则key前缀 public final String RULE_DEGRADE = "sentinel_rule_degrade_"; //系统规则key前缀 public final String RULE_SYSTEM = "sentinel_rule_system_"; }
9238df22684677f31e0d68c86a0a6d4408db5d72
882
java
Java
spring-boot14/spring-boot14-v3/spring-boot14-v3-rest/src/main/java/kr/lul/pages/spring/boot14/v3/rest/controller/FooController.java
JustBurrow/pages
abeb2ad27bef7416dc1d96171a93085f1f89bdbd
[ "Apache-2.0" ]
null
null
null
spring-boot14/spring-boot14-v3/spring-boot14-v3-rest/src/main/java/kr/lul/pages/spring/boot14/v3/rest/controller/FooController.java
JustBurrow/pages
abeb2ad27bef7416dc1d96171a93085f1f89bdbd
[ "Apache-2.0" ]
null
null
null
spring-boot14/spring-boot14-v3/spring-boot14-v3-rest/src/main/java/kr/lul/pages/spring/boot14/v3/rest/controller/FooController.java
JustBurrow/pages
abeb2ad27bef7416dc1d96171a93085f1f89bdbd
[ "Apache-2.0" ]
null
null
null
21.512195
62
0.674603
998,609
package kr.lul.pages.spring.boot14.v3.rest.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import kr.lul.pages.spring.boot14.v3.rest.resp.FooListResp; import kr.lul.pages.spring.boot14.v3.rest.resp.FooResp; /** * @author Just Burrow * @since 2016. 10. 4. */ @RequestMapping("/foos") public interface FooController { /** * @return * @author Just Burrow * @since 2016. 10. 4. */ @GetMapping("/create") public FooResp create(); /** * @return * @author Just Burrow * @since 2016. 10. 4. */ @GetMapping public FooListResp index(); /** * @param id * @return * @author Just Burrow * @since 2016. 10. 4. */ @GetMapping("/{id}") public FooResp foo(@PathVariable("id") int id); }
9238df809263ae5d601df72dcaf24fdf5628de17
489
java
Java
Blocks/src/main/kotlin/de/tesis/dynaware/grapheditor/core/skins/defaults/condition/changer/ConditionChanger.java
Slupik/SchemaBlock
dbcac4d6a9a3ee94710094e8312970b61f3db6f2
[ "Apache-2.0" ]
null
null
null
Blocks/src/main/kotlin/de/tesis/dynaware/grapheditor/core/skins/defaults/condition/changer/ConditionChanger.java
Slupik/SchemaBlock
dbcac4d6a9a3ee94710094e8312970b61f3db6f2
[ "Apache-2.0" ]
null
null
null
Blocks/src/main/kotlin/de/tesis/dynaware/grapheditor/core/skins/defaults/condition/changer/ConditionChanger.java
Slupik/SchemaBlock
dbcac4d6a9a3ee94710094e8312970b61f3db6f2
[ "Apache-2.0" ]
null
null
null
16.862069
76
0.717791
998,610
package de.tesis.dynaware.grapheditor.core.skins.defaults.condition.changer; import javafx.beans.property.BooleanProperty; import javafx.geometry.Point2D; import javafx.scene.Group; /** * All rights reserved & copyright © */ public interface ConditionChanger { Group getRoot(); void setPosition(Point2D position); double getWidth(); double getHeight(); void show(); void hide(); BooleanProperty valueProperty(); void setValue(boolean value); }
9238e00a033a83923faeba471a459aa03ec5465e
4,933
java
Java
src/org/jgroups/util/SeqnoList.java
rhusar/jgroups
d9da69e85b9ec37ef79ba12c260b6f574a0369ba
[ "Apache-2.0" ]
704
2015-01-07T16:18:33.000Z
2022-03-29T14:09:28.000Z
src/org/jgroups/util/SeqnoList.java
rhusar/jgroups
d9da69e85b9ec37ef79ba12c260b6f574a0369ba
[ "Apache-2.0" ]
147
2015-01-07T18:32:53.000Z
2022-03-21T07:52:37.000Z
src/org/jgroups/util/SeqnoList.java
leo-fanglei/JGroups
fe06292f835f9c0ae03855b681104ccfe0cbb204
[ "Apache-2.0" ]
371
2015-01-05T23:16:40.000Z
2022-03-26T09:19:00.000Z
26.809783
119
0.565173
998,611
package org.jgroups.util; import org.jgroups.Constructable; import org.jgroups.Global; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.function.Supplier; /** * A bitset of missing messages with a fixed size. The index (in the bit set) of a seqno is computed as seqno - offset. * @author Bela Ban * @since 3.1 */ public class SeqnoList extends FixedSizeBitSet implements SizeStreamable, Iterable<Long>, Constructable<SeqnoList> { protected long offset; // first seqno /** Only to be used by serialization */ public SeqnoList() { } /** * Creates a SeqnoList with a capacity for size elements. * @param size The max number of seqnos in the bitset * @param offset Lowest seqno. Used to compute the index of a given seqno into the bitset: seqno - offset */ public SeqnoList(int size, long offset) { super(size); this.offset=offset; } public Supplier<? extends SeqnoList> create() { return SeqnoList::new; } public SeqnoList(int size) { this(size, 0); } /** Adds a single seqno */ public SeqnoList add(long seqno) { super.set(index(seqno)); return this; } public SeqnoList add(long ... seqnos) { if(seqnos != null) for(long seqno: seqnos) add(seqno); return this; } /** Adds a seqno range */ public SeqnoList add(long from, long to) { super.set(index(from), index(to)); return this; } /** Removes all seqnos > seqno */ public SeqnoList removeHigherThan(long seqno) { int from=index(seqno + 1), to=size-1; if(from < 0) from=0; if(from <= to && from >= 0) super.clear(from, to); return this; } /** Removes all seqnos < seqno */ public SeqnoList removeLowerThan(long seqno) { int to=index(seqno-1); if(to >= 0) super.clear(0, to); return this; } /** Returns the last seqno, this is also the highest seqno in the list as we add seqnos in order */ public long getLast() { int index=previousSetBit(size - 1); return index == -1? -1 : seqno(index); } /** Returns the first seqno, this is also the lowest seqno in the list as we add seqnos in order */ public long getFirst() { int index=nextSetBit(0); return index < 0? -1 : seqno(index); } @Override public int serializedSize() { return Global.INT_SIZE // number of words + (words.length+1) * Global.LONG_SIZE; // words + offset } @Override public void writeTo(DataOutput out) throws IOException { out.writeInt(size); out.writeLong(offset); for(long word: words) out.writeLong(word); } @Override public void readFrom(DataInput in) throws IOException { size=in.readInt(); offset=in.readLong(); words=new long[wordIndex(size - 1) + 1]; for(int i=0; i < words.length; i++) words[i]=in.readLong(); } public int size() { return super.cardinality(); } public boolean isEmpty() {return cardinality() == 0;} public String toString() { if(isEmpty()) return "{}"; StringBuilder sb=new StringBuilder("(").append(cardinality()).append("): {"); boolean first=true; int num=Util.MAX_LIST_PRINT_SIZE; for(int i=nextSetBit(0); i >= 0; i=nextSetBit(i + 1)) { int endOfRun=nextClearBit(i); if(first) first=false; else sb.append(", "); if(endOfRun != -1 && endOfRun-1 != i) { sb.append(seqno(i)).append('-').append(seqno(endOfRun-1)); i=endOfRun; } else sb.append(seqno(i)); if(--num <= 0) { sb.append(", ... "); break; } } sb.append('}'); return sb.toString(); } public Iterator<Long> iterator() { return new SeqnoListIterator(); } protected int index(long seqno) {return (int)(seqno-offset);} protected long seqno(int index) {return offset + index;} protected class SeqnoListIterator implements Iterator<Long> { protected int index; public boolean hasNext() { return index < size && nextSetBit(index) != -1; } public Long next() { int next_index=nextSetBit(index); if(next_index == -1 || next_index >= size) throw new NoSuchElementException("index: " + next_index); index=next_index+1; return seqno(next_index); } public void remove() { // not supported } } }
9238e026f5c19ede82e80024d219894114f97abf
717
java
Java
src/class/polimorfismo/esercizio/Gatto.java
frnmst/oop-training
0dd5c8d349b5c004633af927cfe8435b05efd62a
[ "WTFPL" ]
1
2022-01-24T10:30:25.000Z
2022-01-24T10:30:25.000Z
src/class/polimorfismo/esercizio/Gatto.java
free-unife/programming-languages-and-lab
0dd5c8d349b5c004633af927cfe8435b05efd62a
[ "WTFPL" ]
null
null
null
src/class/polimorfismo/esercizio/Gatto.java
free-unife/programming-languages-and-lab
0dd5c8d349b5c004633af927cfe8435b05efd62a
[ "WTFPL" ]
null
null
null
26.107143
78
0.70041
998,612
/* * Gatto.java * * Copyright © 2016 Franco Masotti <kenaa@example.com> * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the LICENSE file for more details. */ public class Gatto extends AnimaleDomestico /* Gatto è sottoclasse di AnimaleDomestico */ { public Gatto(String nomeGatto) { super(nomeGatto); } public void verso() { System.out.println("Miao"); } public void mangia(String ilcibo) /* Qui viene ridefinito il metodo mangia */ { //System.out.println("Il gatto "+nomeGatto+" mangia "+ilcibo); System.out.println("Il gatto mangia "+ilcibo); } }
9238e04ac027d32ba35138abda2d1e64224c64d2
1,302
java
Java
subprojects/core/src/main/java/org/gradle/api/internal/changedetection/rules/MaximumNumberTaskStateChangeVisitor.java
MelodicAlbuild/Excess
ce9781a0c3be6d652f169c5c97b3d41dfc75486b
[ "Apache-2.0" ]
2
2018-09-29T05:42:34.000Z
2018-12-12T05:15:10.000Z
subprojects/core/src/main/java/org/gradle/api/internal/changedetection/rules/MaximumNumberTaskStateChangeVisitor.java
MelodicAlbuild/Excess
ce9781a0c3be6d652f169c5c97b3d41dfc75486b
[ "Apache-2.0" ]
null
null
null
subprojects/core/src/main/java/org/gradle/api/internal/changedetection/rules/MaximumNumberTaskStateChangeVisitor.java
MelodicAlbuild/Excess
ce9781a0c3be6d652f169c5c97b3d41dfc75486b
[ "Apache-2.0" ]
2
2017-12-03T17:46:23.000Z
2022-01-11T02:33:52.000Z
36.166667
105
0.748848
998,613
/* * Copyright 2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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.gradle.api.internal.changedetection.rules; public class MaximumNumberTaskStateChangeVisitor implements TaskStateChangeVisitor { private final int maxReportedChanges; private final TaskStateChangeVisitor delegate; private int visited; public MaximumNumberTaskStateChangeVisitor(int maxReportedChanges, TaskStateChangeVisitor delegate) { this.maxReportedChanges = maxReportedChanges; this.delegate = delegate; } @Override public boolean visitChange(TaskStateChange change) { boolean delegateResult = delegate.visitChange(change); visited++; return delegateResult && visited < maxReportedChanges; } }
9238e08989c4f267fc0a4d512797339090402ff2
1,943
java
Java
wxapp/src/test/java/ledong/wxapp/DemoApplicationTests.java
niyaou/ledong-tennis
3710293ef972cec7979f6aa48f78fa0a0c623f4a
[ "Apache-2.0" ]
null
null
null
wxapp/src/test/java/ledong/wxapp/DemoApplicationTests.java
niyaou/ledong-tennis
3710293ef972cec7979f6aa48f78fa0a0c623f4a
[ "Apache-2.0" ]
1
2021-08-09T20:44:51.000Z
2021-08-09T20:44:51.000Z
wxapp/src/test/java/ledong/wxapp/DemoApplicationTests.java
niyaou/ledong-tennis
3710293ef972cec7979f6aa48f78fa0a0c623f4a
[ "Apache-2.0" ]
null
null
null
29.892308
121
0.594956
998,614
package ledong.wxapp; import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.LinkedList; import java.util.Optional; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.junit4.SpringRunner; // @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) // @RunWith(SpringJUnit4ClassRunner.class) // //告诉JUnitSpring配置文件 // @ContextConfiguration(classes = DemoApplicationTests.class) @RunWith(SpringRunner.class) //@SpringBootTest(classes = DemoApplicationTests.class) public class DemoApplicationTests { // @Autowired // private RedisUtil redis; boolean flag = false; @Test public void contextLoads() throws Exception { LinkedList<HashMap<String, Object>> matches = new LinkedList<HashMap<String, Object>>(); HashMap<String, Object> a = new HashMap<String, Object>(); a.put("n", 1); a.put("h", 1); a.put("c", 2); a.put("w", 1); HashMap<String, Object> b = new HashMap<String, Object>(); b.put("n", 2); b.put("h", 1); b.put("c", 2); b.put("w", 2); HashMap<String, Object> c = new HashMap<String, Object>(); c.put("n", 3); c.put("h", 1); c.put("c", 2); c.put("w", 1); matches.push(a); matches.push(b); matches.push(c); // Optional<LinkedList<HashMap<String, Object>>> opt = Optional.ofNullable(matches); // Optional.ofNullable(matches).flatMap(u -> Optional.of(u.pop())).ifPresent(g -> System.out.println(g.get("n"))); Optional.ofNullable(matches).ifPresent(u -> { flag = u.stream().filter(x -> { Object hhh = x.get(x.get("w").equals(1) ? "h" : "c"); System.out.println(hhh); boolean gg = hhh.equals(1); return gg; }).count() == 3L; }); assertTrue(flag); } }
9238e0e645dcac955b4e50cb28f563113e72e0c4
3,931
java
Java
src/main/java/seedu/address/model/person/predicate/NameSchoolAndSubjectContainsKeywordsPredicate.java
andrea-twl/tp
b3429e222f02cd2e12547af827d6a8dc06620286
[ "MIT" ]
null
null
null
src/main/java/seedu/address/model/person/predicate/NameSchoolAndSubjectContainsKeywordsPredicate.java
andrea-twl/tp
b3429e222f02cd2e12547af827d6a8dc06620286
[ "MIT" ]
217
2021-02-20T20:09:40.000Z
2021-04-16T12:20:45.000Z
src/main/java/seedu/address/model/person/predicate/NameSchoolAndSubjectContainsKeywordsPredicate.java
andrea-twl/tp
b3429e222f02cd2e12547af827d6a8dc06620286
[ "MIT" ]
4
2021-02-14T14:19:18.000Z
2021-02-14T14:25:32.000Z
40.112245
118
0.658611
998,615
package seedu.address.model.person.predicate; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; import seedu.address.commons.util.StringUtil; import seedu.address.model.person.Person; import seedu.address.model.subject.Subject; /** * Tests that a {@code Person}'s {@code Name} matches any of the keywords given. */ public class NameSchoolAndSubjectContainsKeywordsPredicate implements Predicate<Person> { private final List<String> nameKeywords; private final List<String> schoolKeywords; private final List<Subject> subjectKeywords; /** * Constructor of NameAndSchoolContainsKeywordsPredicate * * @param nameKeywords List of keywords to be matched with the names * @param schoolKeywords List of keywords to be matched the school * @param subjectKeywords List of keywords to be matched with subjects */ public NameSchoolAndSubjectContainsKeywordsPredicate(List<String> nameKeywords, List<String> schoolKeywords, List<Subject> subjectKeywords) { this.nameKeywords = nameKeywords; this.schoolKeywords = schoolKeywords; this.subjectKeywords = subjectKeywords; } /** * Evaluates if the keyword matches the person's name * @param person The person to be compared to * @return A boolean value representing the evaluation results */ public boolean testByName(Person person) { if (person == null) { return false; } return nameKeywords.stream() .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().fullName, keyword)); } /** * Evaluates if the keyword matches the person's school * @param person The person to be compared to * @return A boolean value representing the evaluation results */ public boolean testBySchool(Person person) { if (person == null) { return false; } if (!person.getSchool().isPresent()) { return false; } return schoolKeywords.stream() .anyMatch(keyword -> StringUtil.containsWordIgnoreCase( person.getSchool().get().fullSchoolName, keyword)); } /** * Evaluates if the keyword matches the person's subjects * @param person The person to be compared to * @return A boolean value representing the evaluation results */ public boolean testBySubject(Person person) { if (person == null) { return false; } return subjectKeywords.stream() .anyMatch(keyword -> StringUtil.containsWordIgnoreCase( person.getSubjects().stream().map(subject -> subject.subjectName) .collect(Collectors.joining(" ")), keyword.subjectName)); } @Override public boolean test(Person person) { boolean isNamePresent = testByName(this.nameKeywords != null ? person : null); boolean isSchoolPresent = testBySchool(this.schoolKeywords != null ? person : null); boolean isSubjectPresent = testBySubject(this.subjectKeywords != null ? person : null); return isNamePresent || isSchoolPresent || isSubjectPresent; } @Override public boolean equals(Object other) { return other == this // short circuit if same object || (other instanceof NameSchoolAndSubjectContainsKeywordsPredicate // instanceof handles nulls && nameKeywords.equals(((NameSchoolAndSubjectContainsKeywordsPredicate) other).nameKeywords) && schoolKeywords.equals(((NameSchoolAndSubjectContainsKeywordsPredicate) other) .schoolKeywords) && subjectKeywords.equals(((NameSchoolAndSubjectContainsKeywordsPredicate) other) .subjectKeywords)); // state check } }
9238e109298c5e9a2353c397385d695fdff2cf72
258
java
Java
app/src/main/java/com/example/jingbin/cloudreader/http/rx/RxCodeConstants.java
wupeng--1988/CloudReader-master
1f35cd070294c6c71749183f51a797445ba1386a
[ "Apache-2.0" ]
10
2017-11-27T03:18:15.000Z
2021-08-10T07:21:44.000Z
app/src/main/java/com/example/jingbin/cloudreader/http/rx/RxCodeConstants.java
zhwtf/CloudReader
2a3ceaaf120ca04628c3fdbc42a963791f93a927
[ "Apache-2.0" ]
1
2017-01-07T10:09:56.000Z
2017-06-20T01:54:51.000Z
app/src/main/java/com/example/jingbin/cloudreader/http/rx/RxCodeConstants.java
zhwtf/CloudReader
2a3ceaaf120ca04628c3fdbc42a963791f93a927
[ "Apache-2.0" ]
10
2018-04-20T08:43:59.000Z
2022-03-16T02:52:53.000Z
19.846154
49
0.697674
998,616
package com.example.jingbin.cloudreader.http.rx; /** * Created by jingbin on 2016/12/2. */ public class RxCodeConstants { // 每日推荐跳转对应type下 public static final int JUMP_TYPE = 0; // 首页跳转到电影栏 public static final int JUMP_TYPE_TO_ONE = 1; }
9238e11e09a522ed6ab4a30fc5b61a51f8737d25
1,588
java
Java
src/main/java/com/github/galimru/boostrsdk/converters/EnumConverterFactory.java
galimru/boostr-java-sdk
123282c7e047fa5bdd81334446655d95587f934a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/galimru/boostrsdk/converters/EnumConverterFactory.java
galimru/boostr-java-sdk
123282c7e047fa5bdd81334446655d95587f934a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/galimru/boostrsdk/converters/EnumConverterFactory.java
galimru/boostr-java-sdk
123282c7e047fa5bdd81334446655d95587f934a
[ "Apache-2.0" ]
null
null
null
31.76
89
0.619018
998,617
package com.github.galimru.boostrsdk.converters; import com.google.gson.annotations.SerializedName; import retrofit2.Converter; import retrofit2.Retrofit; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Type; public class EnumConverterFactory extends Converter.Factory { @Nullable @Override public Converter<?, String> stringConverter(@Nonnull Type type, @Nonnull Annotation[] annotations, @Nonnull Retrofit retrofit) { if (type instanceof Class && ((Class<?>)type).isEnum()) { return new EnumConverter(); } return null; } public static EnumConverterFactory create() { return new EnumConverterFactory(); } private static class EnumConverter implements Converter<Enum<?>, String> { @Nullable @Override public String convert(@Nonnull Enum<?> value) throws IOException { return getSerializedNameValue(value); } public String getSerializedNameValue(Enum<?> caller) { try { SerializedName serializedName = caller.getClass().getField(caller.name()) .getAnnotation(SerializedName.class); return serializedName != null ? serializedName.value() : caller.name(); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } } } }
9238e1cf19b8accb223d5c97814f646e932f008c
854
java
Java
src/main/java/cn/bromine0x23/sgip/handler/SgipPduEncoder.java
bromine0x23/sgip
f16011efeb7d2e6b471c29044e58b8e7218c4c12
[ "WTFPL" ]
6
2018-08-15T07:08:42.000Z
2021-06-16T15:12:57.000Z
src/main/java/cn/bromine0x23/sgip/handler/SgipPduEncoder.java
bromine0x23/sgip
f16011efeb7d2e6b471c29044e58b8e7218c4c12
[ "WTFPL" ]
null
null
null
src/main/java/cn/bromine0x23/sgip/handler/SgipPduEncoder.java
bromine0x23/sgip
f16011efeb7d2e6b471c29044e58b8e7218c4c12
[ "WTFPL" ]
1
2020-06-06T04:42:44.000Z
2020-06-06T04:42:44.000Z
31.777778
102
0.769231
998,618
/* * Copyright © 2017-2021 Bromine0x23 <dycjh@example.com> * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. */ package cn.bromine0x23.sgip.handler; import cn.bromine0x23.sgip.pdu.SgipPdu; import cn.bromine0x23.sgip.util.SgipPduCodec; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; /** * SGIP PDU编码器 * * @author <a href="mailto:dycjh@example.com">Bromine0x23</a> */ public class SgipPduEncoder extends MessageToByteEncoder<SgipPdu> { @Override protected void encode(ChannelHandlerContext context, SgipPdu message, ByteBuf out) throws Exception { SgipPduCodec.encode(message, out); } }
9238e3a14efb03ca9dc53ac3875a5ac4290158cc
10,302
java
Java
main/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java
ackza/openoffice
d49dfe9c625750e261c7ed8d6ccac8d361bf3418
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java
ackza/openoffice
d49dfe9c625750e261c7ed8d6ccac8d361bf3418
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
33.888158
118
0.54601
998,619
/************************************************************** * * 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.openoffice.setup.SetupData; import org.openoffice.setup.InstallData; import org.openoffice.setup.Util.FileExtensionFilter; import java.io.File; import java.io.IOException; import java.util.Enumeration; import java.util.Hashtable; import java.util.Stack; import java.util.Vector; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; public class XMLPackageDescription { /** * fill the package description tree by handling the SAXParser events */ private class PackageDescriptionHandler extends DefaultHandler { private XMLPackageDescription root; private Stack stack; public PackageDescriptionHandler(XMLPackageDescription base) { root = base; stack = new Stack(); } private PackageDescriptionHandler() { /* forbidden */ } public XMLPackageDescription getDescription() { return root; } /* implement the DefaultHandler interface */ public void characters(char[] ch, int start, int length) { XMLPackageDescription entity = (XMLPackageDescription) stack.peek(); entity.value = entity.value == null ? new String(ch, start, length) : entity.value + new String(ch, start, length); } public void startDocument() { stack.push(root); } public void endDocument() { stack.pop(); } public void startElement(String uri, String localName, String qName, Attributes attributes) { XMLPackageDescription parent = (XMLPackageDescription) stack.peek(); XMLPackageDescription entity = new XMLPackageDescription(); entity.key = qName; for (int i = 0; i < attributes.getLength(); i++) { entity.attributes.put(attributes.getQName(i), attributes.getValue(i)); } parent.add(entity); stack.push(entity); } public void endElement(String uri, String localName, String qName) { stack.pop(); } public void error(SAXParseException e) { System.err.println("Parse Error:" + e); } public void processingInstruction(String target, String data) { /* ignore */ } public void skippedEntity(String name) { /* ignore */ } public void warning(SAXParseException e) { System.err.println("Warning:" + e); } } /** * general storage for XML elements */ private String key; /* XML element name */ private String value; /* XML element characters */ private Hashtable attributes; /* XML element attributes */ private Vector children; /* children are of type XMLPackageDescription */ protected XMLPackageDescription() { key = ""; value = null; attributes = new Hashtable(); children = new Vector(); } private void add(XMLPackageDescription p) { children.add(p); } /** * helper routines to find content information */ protected String getKey() { return key; } protected String getAttribute(String key) { return (String) attributes.get(key); } protected String getValue() { return value; } protected XMLPackageDescription getElement(String key) { return getElement(key, null, null); } protected XMLPackageDescription getElement(String key, String attrKey, String attrValue) { for (Enumeration e = children.elements(); e.hasMoreElements();) { XMLPackageDescription child = (XMLPackageDescription) e.nextElement(); if (child.key.equals(key)) { if (attrKey == null) { return child; } else if (attrValue.equals(child.getAttribute(attrKey))) { return child; } } } return null; } /** * find a PackageDescription of type package that has the given name, * recurses into the children */ private XMLPackageDescription findPackage(String name) { String self = (String) attributes.get("name"); if ((self != null) && self.equals(name)) return this; XMLPackageDescription found = null; for (Enumeration e = children.elements(); e.hasMoreElements();) { XMLPackageDescription child = (XMLPackageDescription) e.nextElement(); if (child.getAttribute("parent") != null) { found = child.findPackage(name); if (found != null) { break; } } } return found; } /** * adjust the tree so that all children have a matching parent and not just * the ones they got by reading files in random order */ private void adjust(XMLPackageDescription root) { String self = (String) attributes.get("name"); for (int i = children.size() - 1; i >= 0; --i) { XMLPackageDescription child = (XMLPackageDescription) children.elementAt(i); String childParentName = child.getAttribute("parent"); if (childParentName != null) { child.adjust(root); if ((childParentName != null) && (childParentName.length() > 0) && (! childParentName.equals(self))) { XMLPackageDescription newParent = root.findPackage(childParentName); if (newParent != null) { newParent.add(child); children.remove(i); } } } } } protected void read() { PackageDescriptionHandler handler = new PackageDescriptionHandler(this); try { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); InstallData data = InstallData.getInstance(); File xpdRoot = data.getInfoRoot("xpd"); if ( xpdRoot != null ) { File[] file = xpdRoot.listFiles(new FileExtensionFilter("xpd")); if (file != null) { for (int i = 0; i < file.length; i++) { parser.parse(file[i], handler); } } else { key = ""; value = "no package file found"; } } else { System.err.println("Did not find xpd directory"); } } catch (ParserConfigurationException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } catch (SAXException ex) { ex.printStackTrace(); } adjust(this); } /* provide an iterator through the children */ protected class Elements implements Enumeration { Enumeration e; protected Elements() { e = children.elements(); } public boolean hasMoreElements() { return e.hasMoreElements(); } public Object nextElement() { return e.nextElement(); } } protected Enumeration elements() { return new Elements(); } // FIXME: remove it, dump() is for testing only public void dump() { dump(""); } // FIXME: remove it, dump(String) is for testing only public void dump(String indent) { final String space = " "; if (key != null) { System.out.print(indent + "<" + key); } for (Enumeration e = attributes.keys() ; e.hasMoreElements() ;) { String key = (String) e.nextElement(); String value = (String) attributes.get(key); System.out.print(" " + key + "=\"" + value + "\""); } if (key != null) { System.out.print(">"); } if ((value != null) && (value.length() > 0)) { String trimmedValue = value.trim(); if (trimmedValue.length() > 60) { trimmedValue = trimmedValue.substring(0, 57) + "..."; } if (trimmedValue.length() > 0) { System.out.print(trimmedValue); } } for (Enumeration e = children.elements() ; e.hasMoreElements() ;) { XMLPackageDescription current = (XMLPackageDescription) e.nextElement(); System.out.println(); current.dump(indent + space); } if (children.size() > 0) { System.out.println(); System.out.print(indent); } if (key != null) { System.out.print("</" + key + ">"); } } }
9238e3f88caa4756b3c819e5c285eaf706d50056
167
java
Java
redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/MetaVisitor.java
coral-cloud/x-pipe
d4ad1d9039a83f55439b69ae7d6954171002fa39
[ "Apache-2.0" ]
1,652
2016-04-18T10:34:30.000Z
2022-03-30T06:15:35.000Z
redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/MetaVisitor.java
coral-cloud/x-pipe
d4ad1d9039a83f55439b69ae7d6954171002fa39
[ "Apache-2.0" ]
342
2016-07-27T10:38:01.000Z
2022-03-31T11:11:46.000Z
redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/healthcheck/meta/MetaVisitor.java
coral-cloud/x-pipe
d4ad1d9039a83f55439b69ae7d6954171002fa39
[ "Apache-2.0" ]
492
2016-04-25T05:14:10.000Z
2022-03-16T01:40:38.000Z
13.916667
55
0.652695
998,620
package com.ctrip.xpipe.redis.checker.healthcheck.meta; /** * @author chen.zhu * <p> * Aug 28, 2018 */ public interface MetaVisitor<T> { void accept(T t); }
9238e431b726e3e082cd011aa4962bc1bb42934b
562
java
Java
scoring/aggregates/src/main/java/com/mploed/dddwithspring/scoring/financialSituation/FinancialSituationRootEntity.java
gandrade/ddd-with-spring
6d7cb7561f6eb569bf12fb8bd28b9ee1759a688f
[ "Apache-2.0" ]
null
null
null
scoring/aggregates/src/main/java/com/mploed/dddwithspring/scoring/financialSituation/FinancialSituationRootEntity.java
gandrade/ddd-with-spring
6d7cb7561f6eb569bf12fb8bd28b9ee1759a688f
[ "Apache-2.0" ]
null
null
null
scoring/aggregates/src/main/java/com/mploed/dddwithspring/scoring/financialSituation/FinancialSituationRootEntity.java
gandrade/ddd-with-spring
6d7cb7561f6eb569bf12fb8bd28b9ee1759a688f
[ "Apache-2.0" ]
null
null
null
24.434783
110
0.807829
998,621
package com.mploed.dddwithspring.scoring.financialSituation; import com.mploed.dddwithspring.scoring.ApplicationNumber; class FinancialSituationRootEntity { final ApplicationNumber applicationNumber; private final Incomings incomings; private final Outgoings outgoings; FinancialSituationRootEntity(ApplicationNumber applicationNumber, Incomings incomings, Outgoings outgoings) { this.applicationNumber = applicationNumber; this.incomings = incomings; this.outgoings = outgoings; } int sum() { return incomings.sum() - outgoings.sum(); } }
9238e4eef464f3f2bad9ba8d7ee4532a61f06910
658
java
Java
src/main/java/com/fullcontact/api/libs/fullcontact4j/http/person/model/Macromeasures.java
infusionsoft/fullcontact4j
2f97ca9e93d9863b029be6a0287f7f77180b12e6
[ "Apache-2.0" ]
24
2015-03-01T12:05:40.000Z
2019-11-20T18:03:14.000Z
src/main/java/com/fullcontact/api/libs/fullcontact4j/http/person/model/Macromeasures.java
infusionsoft/fullcontact4j
2f97ca9e93d9863b029be6a0287f7f77180b12e6
[ "Apache-2.0" ]
35
2015-02-02T14:28:42.000Z
2020-07-13T23:55:57.000Z
src/main/java/com/fullcontact/api/libs/fullcontact4j/http/person/model/Macromeasures.java
infusionsoft/fullcontact4j
2f97ca9e93d9863b029be6a0287f7f77180b12e6
[ "Apache-2.0" ]
36
2015-03-01T12:05:48.000Z
2022-03-03T13:44:59.000Z
23.5
65
0.720365
998,622
package com.fullcontact.api.libs.fullcontact4j.http.person.model; import lombok.*; import java.util.*; @NoArgsConstructor(access = AccessLevel.PRIVATE) @AllArgsConstructor @ToString @Getter @EqualsAndHashCode public class Macromeasures { private List<Interest> interests = Collections.emptyList(); @Getter @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PRIVATE) @ToString @EqualsAndHashCode public static class Interest { private String name; private String id; private Double score; private List<String> parents = Collections.emptyList(); private String category; } }
9238e6530efb7b3f90da734a28153b05b089a6bf
193
java
Java
baseadapter/src/main/java/com/fubaisum/baseadapter/MultiViewTypeSupport.java
fubaisum/BaseAdapterHelper
50f26fac6ee4abd76b86df981eeb84f9d7d14d7a
[ "Apache-2.0" ]
null
null
null
baseadapter/src/main/java/com/fubaisum/baseadapter/MultiViewTypeSupport.java
fubaisum/BaseAdapterHelper
50f26fac6ee4abd76b86df981eeb84f9d7d14d7a
[ "Apache-2.0" ]
null
null
null
baseadapter/src/main/java/com/fubaisum/baseadapter/MultiViewTypeSupport.java
fubaisum/BaseAdapterHelper
50f26fac6ee4abd76b86df981eeb84f9d7d14d7a
[ "Apache-2.0" ]
null
null
null
21.444444
43
0.735751
998,623
package com.fubaisum.baseadapter; public interface MultiViewTypeSupport<T> { int getLayoutId(int position, T t); int getViewTypeCount(); int getItemViewType(int position, T t); }
9238e65e3df691c8d2184b01fd6f67212d2ac2d8
2,117
java
Java
src/main/java/se/joarc/EnhancedSurvival/Items/BlazePokeStickListener.java
joarc/enhancedsurvival
975d5b5f0c18aab98862c89b02c96eb10e17a807
[ "MIT" ]
null
null
null
src/main/java/se/joarc/EnhancedSurvival/Items/BlazePokeStickListener.java
joarc/enhancedsurvival
975d5b5f0c18aab98862c89b02c96eb10e17a807
[ "MIT" ]
5
2020-11-04T19:56:51.000Z
2020-11-05T22:47:16.000Z
src/main/java/se/joarc/EnhancedSurvival/Items/BlazePokeStickListener.java
joarc/enhancedsurvival
975d5b5f0c18aab98862c89b02c96eb10e17a807
[ "MIT" ]
null
null
null
44.104167
229
0.640529
998,624
package se.joarc.EnhancedSurvival.Items; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.persistence.PersistentDataType; import static se.joarc.EnhancedSurvival.EnhancedSurvival.nsk_extra; public class BlazePokeStickListener implements Listener { @EventHandler public void onCraftingSpeedBootsEvent(CraftItemEvent e) { CraftingInventory inv = e.getInventory(); if (inv.getResult() == null) return; if (inv.getResult().getType().equals(Material.BLAZE_ROD) && inv.getResult().getItemMeta().hasEnchant(Enchantment.KNOCKBACK)) { boolean fireaspect = false; boolean pokestick = false; for(ItemStack item : inv.getMatrix()) { if (item.getType().equals(Material.ENCHANTED_BOOK)) { EnchantmentStorageMeta spm = (EnchantmentStorageMeta)item.getItemMeta(); if (spm == null) continue; if (spm.hasStoredEnchant(Enchantment.FIRE_ASPECT)) { fireaspect = true; } } else if (item.getType().equals(Material.STICK)) { if (item.getItemMeta().getPersistentDataContainer().has(nsk_extra, PersistentDataType.STRING) && item.getItemMeta().getPersistentDataContainer().get(nsk_extra, PersistentDataType.STRING).equals("pokestick")) { pokestick = true; } } } if (fireaspect && pokestick) { e.setCancelled(false); } else { e.getInventory().getViewers().get(0).sendMessage(ChatColor.RED + "Invalid Crafting Components!"); inv.setResult(new ItemStack(Material.AIR)); e.setCancelled(true); } } } }
9238e6a642778bc7f37155d5eba0e3b2752c96a3
1,628
java
Java
src/main/java/org/olat/modules/quality/ui/security/GeneratorReadOnlySecurityCallback.java
JHDSonline/OpenOLAT
449e1f1753162aac458dda15a6baac146ecbdb16
[ "Apache-2.0" ]
191
2018-03-29T09:55:44.000Z
2022-03-23T06:42:12.000Z
src/main/java/org/olat/modules/quality/ui/security/GeneratorReadOnlySecurityCallback.java
JHDSonline/OpenOLAT
449e1f1753162aac458dda15a6baac146ecbdb16
[ "Apache-2.0" ]
68
2018-05-11T06:19:00.000Z
2022-01-25T18:03:26.000Z
src/main/java/org/olat/modules/quality/ui/security/GeneratorReadOnlySecurityCallback.java
JHDSonline/OpenOLAT
449e1f1753162aac458dda15a6baac146ecbdb16
[ "Apache-2.0" ]
139
2018-04-27T09:46:11.000Z
2022-03-27T08:52:50.000Z
24.757576
82
0.727662
998,625
/** * <a href="http://www.openolat.org"> * OpenOLAT - Online Learning and Training</a><br> * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at the * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> * <p> * Unless required by applicable law or agreed to in writing,<br> * software distributed under the License is distributed on an "AS IS" BASIS, <br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> * See the License for the specific language governing permissions and <br> * limitations under the License. * <p> * Initial code contributed and copyrighted by<br> * frentix GmbH, http://www.frentix.com * <p> */ package org.olat.modules.quality.ui.security; /** * * Initial date: 14 Nov 2018<br> * @author uhensler, ychag@example.com, http://www.frentix.com * */ class GeneratorReadOnlySecurityCallback implements GeneratorSecurityCallback { @Override public boolean canEditGenerator() { return false; } @Override public boolean canEditGeneratorForm(long numOfDataCollections) { return false; } @Override public boolean canEditReportAccessOnline() { return false; } @Override public boolean canEditReportAccessEmail() { return false; } @Override public boolean canEditReportAccessMembers() { return false; } @Override public boolean canActivateGenerators() { return false; } @Override public boolean canDeleteGenerator(long numberDataCollections) { return false; } }
9238e766bd8fd7ae708125c74dc05d20563d1473
811
java
Java
NetflixConductor_Implementations/NetflixConductor_Testability-Evaluation/HotelService/src/main/java/saga/netflix/conductor/hotelservice/controller/HotelServiceConfiguration.java
someresearcher/saga-pattern-evaluation
83fd2977455429ad2f9a6bbfbece2e590ad29271
[ "MIT" ]
null
null
null
NetflixConductor_Implementations/NetflixConductor_Testability-Evaluation/HotelService/src/main/java/saga/netflix/conductor/hotelservice/controller/HotelServiceConfiguration.java
someresearcher/saga-pattern-evaluation
83fd2977455429ad2f9a6bbfbece2e590ad29271
[ "MIT" ]
null
null
null
NetflixConductor_Implementations/NetflixConductor_Testability-Evaluation/HotelService/src/main/java/saga/netflix/conductor/hotelservice/controller/HotelServiceConfiguration.java
someresearcher/saga-pattern-evaluation
83fd2977455429ad2f9a6bbfbece2e590ad29271
[ "MIT" ]
null
null
null
32.44
86
0.819975
998,626
package saga.netflix.conductor.hotelservice.controller; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import saga.netflix.conductor.hotelservice.model.HotelBookingRepository; import saga.netflix.conductor.hotelservice.resources.DtoConverter; @Configuration @EnableAutoConfiguration @Import(ConductorConfiguration.class) public class HotelServiceConfiguration { @Bean public IHotelService hotelService(HotelBookingRepository hotelBookingRepository) { return new HotelService(hotelBookingRepository); } @Bean public DtoConverter dtoConverter() { return new DtoConverter(); } }
9238e91c5bf275fb35f7e7a8e56aa67ac3209ce0
111
java
Java
extensions/lib/base/impl/src/main/java/org/apache/isis/extensions/base/dom/with/WithNameUnique.java
ahus1/isis
e75fa2d61b78757a7e4e0dd4772412f1d72ea3a6
[ "Apache-2.0" ]
null
null
null
extensions/lib/base/impl/src/main/java/org/apache/isis/extensions/base/dom/with/WithNameUnique.java
ahus1/isis
e75fa2d61b78757a7e4e0dd4772412f1d72ea3a6
[ "Apache-2.0" ]
null
null
null
extensions/lib/base/impl/src/main/java/org/apache/isis/extensions/base/dom/with/WithNameUnique.java
ahus1/isis
e75fa2d61b78757a7e4e0dd4772412f1d72ea3a6
[ "Apache-2.0" ]
null
null
null
18.5
56
0.81982
998,627
package org.apache.isis.extensions.base.dom.with; public interface WithNameUnique extends WithNameGetter { }
9238e94be746176e185e89539f1c04ee5b4ade7b
5,774
java
Java
app/src/main/java/de/fwg/qr/scanner/fragmentSettings.java
tb1402/FWG_QR_scanner
281d0bded28b08f4e189e2ce6769cfec25e6344b
[ "MIT" ]
1
2020-07-06T14:39:05.000Z
2020-07-06T14:39:05.000Z
app/src/main/java/de/fwg/qr/scanner/fragmentSettings.java
tb1402/FWG_QR_scanner
281d0bded28b08f4e189e2ce6769cfec25e6344b
[ "MIT" ]
null
null
null
app/src/main/java/de/fwg/qr/scanner/fragmentSettings.java
tb1402/FWG_QR_scanner
281d0bded28b08f4e189e2ce6769cfec25e6344b
[ "MIT" ]
null
null
null
43.742424
167
0.626429
998,628
package de.fwg.qr.scanner; import android.app.AlarmManager; import android.app.AlertDialog; import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceManager; import de.fwg.qr.scanner.history.historyManager; import de.fwg.qr.scanner.tools.preferencesManager; /** * fragment for displaying settings */ public class fragmentSettings extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { PreferenceManager pm = getPreferenceManager(); pm.setSharedPreferencesName(preferencesManager.preferenceName); setPreferencesFromResource(R.xml.settings, rootKey); } public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ListPreference mp = findPreference("mode"); // set listener to darkmode setting ListPreference lp = findPreference("darkmode"); Preference.OnPreferenceChangeListener pcl = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { showRestartDialog(); return true; } }; assert lp != null; lp.setOnPreferenceChangeListener(pcl); //ser listener for mode setting Preference.OnPreferenceChangeListener modeChangeListener=new Preference.OnPreferenceChangeListener(){ @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int newVal=Integer.parseInt((String)newValue); preferencesManager pm=preferencesManager.getInstance(requireContext()); if(pm.areFeaturesUnlocked()){ if(!pm.isRallyeMode()&&newVal==0){ showHistoryDeletionWarningDialog(); return false; } } else{ if(!pm.isRallyeMode()&&newVal==0){ Toast.makeText(requireContext(), getString(R.string.scan_teacher_code), Toast.LENGTH_SHORT).show(); return false; } } return true; } }; assert mp != null; mp.setOnPreferenceChangeListener(modeChangeListener); } /** * Warning, that history will be deleted, shown, when changing from info to rally mode, while having a valid license */ private void showHistoryDeletionWarningDialog(){ AlertDialog.Builder builder=new AlertDialog.Builder(requireActivity()) .setTitle(getString(R.string.dialog_del_warning_title)) .setMessage(getString(R.string.dialog_del_warning_content)) .setPositiveButton(getString(R.string.dialog_del_warning_continue), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new historyManager(requireContext()).clearHistory(); preferencesManager.getInstance(requireContext()).saveString("mode",String.valueOf(0)); requireActivity().recreate(); } }) .setNegativeButton(getString(R.string.dialog_del_warning_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } /** * Restart dialog, to prevent issues with darkmode */ private void showRestartDialog(){ //set up the restart prompt AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity()) .setMessage(R.string.restart_dialog_message).setTitle(R.string.restart_dialog_title) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User clicked OK button PendingIntent pi = PendingIntent.getActivity(requireContext(), 0, new Intent(requireContext(), activityMain.class), PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager am = (AlarmManager) requireActivity().getSystemService(Context.ALARM_SERVICE); if (am != null) { am.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pi); } else { //this is not really a restart, just a kind of dirty solution, but good enough for acting as a fail-safe //although the alarmManager should never be null on a normal android os Intent i = new Intent(requireActivity(), activityMain.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog requireActivity().recreate(); } }); builder.create().show(); } }
9238e95e7b8809afa68b9f9a7dd3e1225eb324ce
10,458
java
Java
api/src/test/java/com/elastisys/scale/cloudpool/api/types/TestMachinePredicates.java
elastisys/scale.cloudadapters
104a2e0f419ba15ff7b7846b35542e7238251f99
[ "Apache-2.0" ]
2
2018-11-06T12:18:12.000Z
2020-03-09T02:42:55.000Z
api/src/test/java/com/elastisys/scale/cloudpool/api/types/TestMachinePredicates.java
elastisys/scale.cloudadapters
104a2e0f419ba15ff7b7846b35542e7238251f99
[ "Apache-2.0" ]
2
2017-10-27T13:24:19.000Z
2021-03-21T09:43:31.000Z
api/src/test/java/com/elastisys/scale/cloudpool/api/types/TestMachinePredicates.java
elastisys/scale.cloudadapters
104a2e0f419ba15ff7b7846b35542e7238251f99
[ "Apache-2.0" ]
5
2016-10-03T14:37:26.000Z
2017-10-27T09:34:44.000Z
51.517241
118
0.623064
998,629
package com.elastisys.scale.cloudpool.api.types; import static com.elastisys.scale.cloudpool.api.types.Machine.isActiveMember; import static com.elastisys.scale.cloudpool.api.types.Machine.isAllocated; import static com.elastisys.scale.cloudpool.api.types.Machine.isStarted; import static com.elastisys.scale.cloudpool.api.types.TestUtils.ips; import static com.elastisys.scale.cloudpool.api.types.TestUtils.machine; import static com.elastisys.scale.cloudpool.api.types.TestUtils.machineNoIp; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.function.Predicate; import org.joda.time.DateTime; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.elastisys.scale.cloudpool.api.types.Machine.ActiveMemberPredicate; import com.elastisys.scale.cloudpool.api.types.Machine.AllocatedMachinePredicate; import com.elastisys.scale.cloudpool.api.types.Machine.MachineWithState; import com.elastisys.scale.commons.util.time.UtcTime; /** * Verifies the behavior of {@link Predicate}s declared for the {@link Machine} * class. */ public class TestMachinePredicates { static final Logger LOG = LoggerFactory.getLogger(TestMachinePredicates.class); /** * Verifies the {@link MachineWithState} {@link Predicate}. */ @Test public void testMachineInStatePredicate() { DateTime now = UtcTime.now(); Machine m1 = machineNoIp("id", MachineState.REQUESTED, now); Machine m2 = machine("id", MachineState.RUNNING, now, ips("1.2.3.4"), ips("1.2.3.5")); Machine m3 = machineNoIp("id", MachineState.PENDING, now); assertFalse(Machine.inState(MachineState.RUNNING).test(m1)); assertTrue(Machine.inState(MachineState.RUNNING).test(m2)); assertFalse(Machine.inState(MachineState.RUNNING).test(m3)); } /** * Verifies the {@link AllocatedMachinePredicate} {@link Predicate}. Only * machines that are REQUESTED/PENDING/RUNNING are to be considered * allocated. */ @Test public void testAllocatedMachinePredicate() { // check all combinations of machineState, membershipStatus and // serviceState MachineState[] machineStates = MachineState.values(); ServiceState[] serviceStates = ServiceState.values(); MembershipStatus[] membershipStatuses = { new MembershipStatus(true, true), new MembershipStatus(true, false), new MembershipStatus(false, true), new MembershipStatus(false, false) }; boolean allocatedFound = false; for (MachineState machineState : machineStates) { for (ServiceState serviceState : serviceStates) { for (MembershipStatus membershipStatus : membershipStatuses) { String combo = String.format("tested combination: %s-%s-%s", machineState, membershipStatus, serviceState); LOG.info(combo); final DateTime timestamp = UtcTime.now(); Machine machine = Machine.builder().id("id").machineState(machineState).cloudProvider("AWS-EC2") .region("us-east-1").machineSize("m1.small").membershipStatus(membershipStatus) .serviceState(serviceState).requestTime(timestamp).launchTime(timestamp) .publicIps(ips("1.2.3.4")).privateIps(ips("1.2.3.5")).build(); Set<MachineState> allocatedStates = new HashSet<>( Arrays.asList(MachineState.REQUESTED, MachineState.PENDING, MachineState.RUNNING)); if (allocatedStates.contains(machine.getMachineState())) { allocatedFound = true; assertTrue(combo, isAllocated().test(machine)); } else { assertFalse(combo, isAllocated().test(machine)); } } } } // verify that at least one allocated machine was found assertTrue(allocatedFound); } /** * Verifies the {@link AllocatedMachinePredicate} {@link Predicate}. Only * machines that are REQUESTED/PENDING/RUNNING are to be considered * allocated. */ @Test public void testStartedMachinePredicate() { // check all combinations of machineState, membershipStatus and // serviceState MachineState[] machineStates = MachineState.values(); ServiceState[] serviceStates = ServiceState.values(); MembershipStatus[] membershipStatuses = { new MembershipStatus(true, true), new MembershipStatus(true, false), new MembershipStatus(false, true), new MembershipStatus(false, false) }; boolean startedFound = false; for (MachineState machineState : machineStates) { for (ServiceState serviceState : serviceStates) { for (MembershipStatus membershipStatus : membershipStatuses) { String combo = String.format("tested combination: %s-%s-%s", machineState, membershipStatus, serviceState); LOG.info(combo); final DateTime timestamp = UtcTime.now(); Machine machine = Machine.builder().id("id").machineState(machineState).cloudProvider("AWS-EC2") .region("us-east-1").machineSize("m1.small").membershipStatus(membershipStatus) .serviceState(serviceState).requestTime(timestamp).launchTime(timestamp) .publicIps(ips("1.2.3.4")).privateIps(ips("1.2.3.5")).build(); Set<MachineState> startedStates = new HashSet<>( Arrays.asList(MachineState.PENDING, MachineState.RUNNING)); if (startedStates.contains(machine.getMachineState())) { startedFound = true; assertTrue(combo, isStarted().test(machine)); } else { assertFalse(combo, isStarted().test(machine)); } } } } // verify that at least one allocated machine was found assertTrue(startedFound); } /** * Verifies the {@link ActiveMemberPredicate} {@link Predicate}. Only * machines that are REQUESTED/PENDING/RUNNING and with an active membership * status are to be considered active members of the pool. */ @Test public void testActiveMemberPredicate() { // check all combinations of machineState, membershipStatus and // serviceState MachineState[] machineStates = MachineState.values(); ServiceState[] serviceStates = ServiceState.values(); MembershipStatus[] membershipStatuses = { new MembershipStatus(true, true), new MembershipStatus(true, false), new MembershipStatus(false, true), new MembershipStatus(false, false) }; boolean activeFound = false; for (MachineState machineState : machineStates) { for (ServiceState serviceState : serviceStates) { for (MembershipStatus membershipStatus : membershipStatuses) { String combo = String.format("tested combination: %s-%s-%s", machineState, membershipStatus, serviceState); LOG.info(combo); final DateTime timestamp = UtcTime.now(); Machine machine = Machine.builder().id("id").machineState(machineState).cloudProvider("AWS-EC2") .region("us-east-1").machineSize("m1.small").membershipStatus(membershipStatus) .serviceState(serviceState).requestTime(timestamp).launchTime(timestamp) .publicIps(ips("1.2.3.4")).privateIps(ips("1.2.3.5")).build(); Set<MachineState> allocatedStates = new HashSet<>( Arrays.asList(MachineState.REQUESTED, MachineState.PENDING, MachineState.RUNNING)); if (allocatedStates.contains(machine.getMachineState()) && machine.getMembershipStatus().isActive()) { activeFound = true; assertTrue(combo, isActiveMember().test(machine)); } else { assertFalse(combo, isActiveMember().test(machine)); } } } } // verify that at least one active member was found assertTrue(activeFound); } /** * Verifies that {@link Machine#isEvictable()} only is <code>true</code> for * machines with evictable set to <code>false</code> in their * {@link MembershipStatus}. */ @Test public void testEvictablePredicate() { // evictable Machine m1 = machineNoIp("id", MachineState.REQUESTED, UtcTime.now()); // not evictable Machine m2 = Machine.builder().id("id").machineState(MachineState.RUNNING).cloudProvider("AWS-EC2") .region("us-east-1").machineSize("m1.small").membershipStatus(MembershipStatus.blessed()) .requestTime(UtcTime.now()).launchTime(UtcTime.now()).publicIps(ips("1.2.3.4")) .privateIps(ips("1.2.3.5")).build(); // evictable Machine m3 = Machine.builder().id("id").machineState(MachineState.RUNNING).cloudProvider("AWS-EC2") .region("us-east-1").machineSize("m1.small").membershipStatus(MembershipStatus.disposable()) .requestTime(UtcTime.now()).launchTime(UtcTime.now()).publicIps(ips("1.2.3.4")) .privateIps(ips("1.2.3.5")).build(); // not evictable Machine m4 = Machine.builder().id("id").machineState(MachineState.RUNNING).cloudProvider("AWS-EC2") .region("us-east-1").machineSize("m1.small").membershipStatus(MembershipStatus.awaitingService()) .requestTime(UtcTime.now()).launchTime(UtcTime.now()).publicIps(ips("1.2.3.4")) .privateIps(ips("1.2.3.5")).build(); assertTrue(Machine.isEvictable().test(m1)); assertFalse(Machine.isEvictable().test(m2)); assertTrue(Machine.isEvictable().test(m3)); assertFalse(Machine.isEvictable().test(m4)); } }
9238ea7ba571e3e53832f2787b31b1d129ac4560
18,339
java
Java
service/eu-service-service/src/test/java/com/mkl/eu/service/service/service/GameServiceTest.java
BAMGames/eu
d1eb2c8cfc45252285a1b1c1293071b464536ac3
[ "MIT" ]
2
2019-08-21T21:21:20.000Z
2019-11-24T15:43:20.000Z
service/eu-service-service/src/test/java/com/mkl/eu/service/service/service/GameServiceTest.java
BAMGames/eu
d1eb2c8cfc45252285a1b1c1293071b464536ac3
[ "MIT" ]
12
2019-11-14T10:22:15.000Z
2022-02-01T00:58:02.000Z
service/eu-service-service/src/test/java/com/mkl/eu/service/service/service/GameServiceTest.java
BAMGames/europa-universalis-implementation
d1eb2c8cfc45252285a1b1c1293071b464536ac3
[ "MIT" ]
2
2016-03-10T17:45:36.000Z
2017-04-12T13:56:55.000Z
40.573009
124
0.670865
998,630
package com.mkl.eu.service.service.service; import com.mkl.eu.client.common.exception.FunctionalException; import com.mkl.eu.client.common.exception.IConstantsCommonException; import com.mkl.eu.client.common.vo.AuthentInfo; import com.mkl.eu.client.common.vo.GameInfo; import com.mkl.eu.client.common.vo.Request; import com.mkl.eu.client.service.service.game.FindGamesRequest; import com.mkl.eu.client.service.service.game.LoadGameRequest; import com.mkl.eu.client.service.service.game.LoadTurnOrderRequest; import com.mkl.eu.client.service.vo.Game; import com.mkl.eu.client.service.vo.GameLight; import com.mkl.eu.client.service.vo.chat.Chat; import com.mkl.eu.client.service.vo.diff.Diff; import com.mkl.eu.client.service.vo.diff.DiffResponse; import com.mkl.eu.client.service.vo.diplo.CountryOrder; import com.mkl.eu.service.service.mapping.GameMapping; import com.mkl.eu.service.service.mapping.chat.ChatMapping; import com.mkl.eu.service.service.mapping.diff.DiffMapping; import com.mkl.eu.service.service.mapping.diplo.CountryOrderMapping; import com.mkl.eu.service.service.persistence.IGameDao; import com.mkl.eu.service.service.persistence.board.ICounterDao; import com.mkl.eu.service.service.persistence.board.IStackDao; import com.mkl.eu.service.service.persistence.chat.IChatDao; import com.mkl.eu.service.service.persistence.diff.IDiffDao; import com.mkl.eu.service.service.persistence.oe.GameEntity; import com.mkl.eu.service.service.persistence.oe.chat.ChatEntity; import com.mkl.eu.service.service.persistence.oe.chat.MessageGlobalEntity; import com.mkl.eu.service.service.persistence.oe.chat.RoomEntity; import com.mkl.eu.service.service.persistence.oe.country.PlayableCountryEntity; import com.mkl.eu.service.service.persistence.oe.diff.DiffEntity; import com.mkl.eu.service.service.persistence.oe.diplo.CountryOrderEntity; import com.mkl.eu.service.service.persistence.ref.IProvinceDao; import com.mkl.eu.service.service.service.impl.GameServiceImpl; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InOrder; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.when; /** * Test of GameService. * * @author MKL. */ @RunWith(MockitoJUnitRunner.class) public class GameServiceTest { @InjectMocks private GameServiceImpl gameService; @Mock private IGameDao gameDao; @Mock private IProvinceDao provinceDao; @Mock private ICounterDao counterDao; @Mock private IStackDao stackDao; @Mock private IChatDao chatDao; @Mock private IDiffDao diffDao; @Mock private GameMapping gameMapping; @Mock private CountryOrderMapping countryOrderMapping; @Mock private ChatMapping chatMapping; @Mock private DiffMapping diffMapping; @Test public void testFindGamesSimple() throws Exception { try { gameService.findGames(null); Assert.fail("Should break because findGames is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("findGames", e.getParams()[0]); } Request<FindGamesRequest> request = new Request<>(); List<GameEntity> games = new ArrayList<>(); GameEntity game = new GameEntity(); game.setId(1L); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(0).setId(11L); game.getCountries().get(0).setUsername("MKL"); game.getCountries().get(0).setName("france"); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(1).setId(12L); game.getCountries().get(1).setUsername("jym"); game.getCountries().get(1).setName("espagne"); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(1).setId(13L); game.getCountries().get(1).setUsername("MKL"); game.getCountries().get(1).setName("russie"); games.add(game); game = new GameEntity(); game.setId(2L); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(0).setId(11L); game.getCountries().get(0).setUsername("MKL"); game.getCountries().get(0).setName("france"); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(1).setId(12L); game.getCountries().get(1).setUsername("jym"); game.getCountries().get(1).setName("espagne"); games.add(game); when(gameDao.findGames(null)).thenReturn(games); when(gameMapping.oeToVoLight(anyObject())).thenAnswer(invocationOnMock -> { GameLight light = new GameLight(); light.setId(((GameEntity) invocationOnMock.getArguments()[0]).getId()); return light; }); List<GameLight> gameLights = gameService.findGames(request); InOrder inOrder = inOrder(gameDao, gameMapping); inOrder.verify(gameDao).findGames(null); inOrder.verify(gameMapping).oeToVoLight(games.get(0)); inOrder.verify(gameMapping).oeToVoLight(games.get(1)); Assert.assertEquals(2, gameLights.size()); Assert.assertEquals(1L, gameLights.get(0).getId().longValue()); Assert.assertEquals(null, gameLights.get(0).getCountry()); Assert.assertEquals(null, gameLights.get(0).getIdCountry()); Assert.assertEquals(0, gameLights.get(0).getUnreadMessages()); Assert.assertEquals(2L, gameLights.get(1).getId().longValue()); Assert.assertEquals(null, gameLights.get(1).getCountry()); Assert.assertEquals(null, gameLights.get(1).getIdCountry()); Assert.assertEquals(0, gameLights.get(1).getUnreadMessages()); } @Test public void testFindGamesComplex() throws Exception { try { gameService.findGames(null); Assert.fail("Should break because findGames is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("findGames", e.getParams()[0]); } Request<FindGamesRequest> request = new Request<>(); request.setRequest(new FindGamesRequest()); request.getRequest().setUsername("MKL"); List<GameEntity> games = new ArrayList<>(); GameEntity game = new GameEntity(); game.setId(1L); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(0).setId(11L); game.getCountries().get(0).setUsername("MKL"); game.getCountries().get(0).setName("france"); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(1).setId(12L); game.getCountries().get(1).setUsername("jym"); game.getCountries().get(1).setName("espagne"); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(1).setId(13L); game.getCountries().get(1).setUsername("MKL"); game.getCountries().get(1).setName("russie"); games.add(game); game = new GameEntity(); game.setId(2L); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(0).setId(21L); game.getCountries().get(0).setUsername("MKL"); game.getCountries().get(0).setName("angleterre"); game.getCountries().add(new PlayableCountryEntity()); game.getCountries().get(1).setId(22L); game.getCountries().get(1).setUsername("jym"); game.getCountries().get(1).setName("pologne"); games.add(game); when(gameDao.findGames(request.getRequest())).thenReturn(games); when(gameMapping.oeToVoLight(anyObject())).thenAnswer(invocationOnMock -> { GameLight light = new GameLight(); light.setId(((GameEntity) invocationOnMock.getArguments()[0]).getId()); return light; }); when(chatDao.getUnreadMessagesNumber(anyLong())).thenAnswer(invocationOnMock -> invocationOnMock.getArguments()[0]); List<GameLight> gameLights = gameService.findGames(request); InOrder inOrder = inOrder(gameDao, chatDao, gameMapping); inOrder.verify(gameDao).findGames(request.getRequest()); inOrder.verify(gameMapping).oeToVoLight(games.get(0)); inOrder.verify(chatDao).getUnreadMessagesNumber(11L); inOrder.verify(gameMapping).oeToVoLight(games.get(0)); inOrder.verify(chatDao).getUnreadMessagesNumber(13L); inOrder.verify(gameMapping).oeToVoLight(games.get(1)); inOrder.verify(chatDao).getUnreadMessagesNumber(21L); Assert.assertEquals(3, gameLights.size()); Assert.assertEquals(1L, gameLights.get(0).getId().longValue()); Assert.assertEquals("france", gameLights.get(0).getCountry()); Assert.assertEquals(11L, gameLights.get(0).getIdCountry().longValue()); Assert.assertEquals(11L, gameLights.get(0).getUnreadMessages()); Assert.assertEquals(1L, gameLights.get(1).getId().longValue()); Assert.assertEquals("russie", gameLights.get(1).getCountry()); Assert.assertEquals(13L, gameLights.get(1).getIdCountry().longValue()); Assert.assertEquals(13L, gameLights.get(1).getUnreadMessages()); Assert.assertEquals(2L, gameLights.get(2).getId().longValue()); Assert.assertEquals("angleterre", gameLights.get(2).getCountry()); Assert.assertEquals(21L, gameLights.get(2).getIdCountry().longValue()); Assert.assertEquals(21L, gameLights.get(2).getUnreadMessages()); } @Test public void testLoadGame() throws Exception { try { gameService.loadGame(null); Assert.fail("Should break because loadGame is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("loadGame", e.getParams()[0]); } Request<LoadGameRequest> request = new Request<>(); try { gameService.loadGame(request); Assert.fail("Should break because loadGame.request is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("loadGame.request", e.getParams()[0]); } request.setRequest(new LoadGameRequest()); try { gameService.loadGame(request); Assert.fail("Should break because loadGame.request.idGame is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("loadGame.request.idGame", e.getParams()[0]); } Long idGame = 12L; Long idCountry = 13L; request.getRequest().setIdGame(idGame); GameEntity gameOe = new GameEntity(); Game gameVo = new Game(); List<MessageGlobalEntity> globalMessages = new ArrayList<>(); List<RoomEntity> rooms = new ArrayList<>(); List<ChatEntity> messages = new ArrayList<>(); when(gameDao.read(idGame)).thenReturn(gameOe); when(gameMapping.oeToVo(gameOe, null)).thenReturn(gameVo); when(gameMapping.oeToVo(gameOe, idCountry)).thenReturn(gameVo); when(chatDao.getGlobalMessages(idGame)).thenReturn(globalMessages); when(chatDao.getRooms(idGame, idCountry)).thenReturn(rooms); when(chatDao.getMessages(idCountry)).thenReturn(messages); when(chatMapping.getChat(globalMessages, rooms, messages, idCountry)).thenReturn(new Chat()); gameService.loadGame(request); InOrder inOrder = inOrder(gameDao, gameMapping, chatDao, chatMapping); inOrder.verify(gameDao).read(idGame); inOrder.verify(gameMapping).oeToVo(gameOe, null); inOrder.verify(chatDao).getGlobalMessages(idGame); inOrder.verify(chatMapping).getChat(globalMessages, null, null, null); request.getRequest().setIdCountry(idCountry); try { gameService.loadGame(request); Assert.fail("Should break because loadGame.request.idCountry is incorrect"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.INVALID_PARAMETER, e.getCode()); Assert.assertEquals("loadGame.request.idCountry", e.getParams()[0]); } request.setAuthent(new AuthentInfo("toto", null)); gameOe.getCountries().add(new PlayableCountryEntity()); gameOe.getCountries().get(0).setId(idCountry); gameOe.getCountries().get(0).setUsername("toto"); gameService.loadGame(request); inOrder = inOrder(gameDao, gameMapping, chatDao, chatMapping); inOrder.verify(gameDao).read(idGame); inOrder.verify(gameMapping).oeToVo(gameOe, idCountry); inOrder.verify(chatDao).getGlobalMessages(idGame); inOrder.verify(chatDao).getRooms(idGame, idCountry); inOrder.verify(chatDao).getMessages(idCountry); inOrder.verify(chatMapping).getChat(globalMessages, rooms, messages, idCountry); } @Test public void testUpdateGame() throws Exception { try { gameService.updateGame(null); Assert.fail("Should break because updateGame is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("updateGame", e.getParams()[0]); } Request<Void> request = new Request<>(); try { gameService.updateGame(request); Assert.fail("Should break because updateGame.game is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("updateGame.game", e.getParams()[0]); } request.setGame(new GameInfo()); try { gameService.updateGame(request); Assert.fail("Should break because updateGame.game.idGame is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("updateGame.game.idGame", e.getParams()[0]); } request.getGame().setIdGame(12L); try { gameService.updateGame(request); Assert.fail("Should break because updateGame.game.versionGame is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("updateGame.game.versionGame", e.getParams()[0]); } request.getGame().setVersionGame(1L); List<DiffEntity> diffs = new ArrayList<>(); DiffEntity diff1 = new DiffEntity(); diff1.setVersionGame(1L); diffs.add(diff1); DiffEntity diff2 = new DiffEntity(); diff2.setVersionGame(2L); diffs.add(diff2); DiffEntity diff3 = new DiffEntity(); diff3.setVersionGame(3L); diffs.add(diff3); DiffEntity diff4 = new DiffEntity(); diff4.setVersionGame(4L); diffs.add(diff4); DiffEntity diff5 = new DiffEntity(); diff5.setVersionGame(5L); diffs.add(diff5); GameEntity game = new GameEntity(); game.setId(12L); game.setVersion(5L); when(gameDao.load(anyLong())).thenReturn(game); when(diffDao.getDiffsSince(12L, null, 1L)).thenReturn(diffs); List<Diff> diffVos = new ArrayList<>(); diffVos.add(new Diff()); diffVos.add(new Diff()); when(diffMapping.oesToVos(anyObject())).thenReturn(diffVos); DiffResponse response = gameService.updateGame(request); InOrder inOrder = inOrder(diffDao, diffMapping); inOrder.verify(diffDao).getDiffsSince(12L, null, 1L); inOrder.verify(diffMapping).oesToVos(anyObject()); Assert.assertEquals(5L, response.getVersionGame().longValue()); Assert.assertEquals(diffVos, response.getDiffs()); request.getGame().setIdGame(1L); request.getGame().setVersionGame(1L); response = gameService.updateGame(request); Assert.assertEquals(5L, response.getVersionGame().longValue()); } @Test public void testLoadTurnOrder() { try { gameService.loadTurnOrder(null); Assert.fail("Should break because loadTurnOrder is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("loadTurnOrder", e.getParams()[0]); } Request<LoadTurnOrderRequest> request = new Request<>(); try { gameService.loadTurnOrder(request); Assert.fail("Should break because loadTurnOrder.request is null"); } catch (FunctionalException e) { Assert.assertEquals(IConstantsCommonException.NULL_PARAMETER, e.getCode()); Assert.assertEquals("loadTurnOrder.request", e.getParams()[0]); } request.setRequest(new LoadTurnOrderRequest(1L)); List<CountryOrderEntity> orderEntities = new ArrayList<>(); orderEntities.add(new CountryOrderEntity()); when(gameDao.findTurnOrder(1L)).thenReturn(orderEntities); List<CountryOrder> ordersVos = new ArrayList<>(); ordersVos.add(new CountryOrder()); ordersVos.add(new CountryOrder()); when(countryOrderMapping.oesToVos(orderEntities, new HashMap<>())).thenReturn(ordersVos); try { List<CountryOrder> orders = gameService.loadTurnOrder(request); Assert.assertEquals(orders, ordersVos); } catch (FunctionalException e) { Assert.fail("Should not break " + e.getMessage()); } } }
9238ebabb803f0747b992e413dfcb00540e1dd5d
41,819
java
Java
broker/src/main/java/com/ebs/broker/model/protobuf/Pub.java
cipriancus/socialistEBS
f019ddf506453579d9e60005fe7d29c600fa3247
[ "Apache-2.0" ]
null
null
null
broker/src/main/java/com/ebs/broker/model/protobuf/Pub.java
cipriancus/socialistEBS
f019ddf506453579d9e60005fe7d29c600fa3247
[ "Apache-2.0" ]
null
null
null
broker/src/main/java/com/ebs/broker/model/protobuf/Pub.java
cipriancus/socialistEBS
f019ddf506453579d9e60005fe7d29c600fa3247
[ "Apache-2.0" ]
null
null
null
32.342614
130
0.607953
998,631
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: pub.proto package com.ebs.broker.model.protobuf; public final class Pub { private Pub() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } public interface PublicationOrBuilder extends // @@protoc_insertion_point(interface_extends:com.ebs.broker.model.protobuf.Publication) com.google.protobuf.MessageOrBuilder { /** * <code>string patientName = 1;</code> */ java.lang.String getPatientName(); /** * <code>string patientName = 1;</code> */ com.google.protobuf.ByteString getPatientNameBytes(); /** * <code>string dateOfBirth = 2;</code> */ java.lang.String getDateOfBirth(); /** * <code>string dateOfBirth = 2;</code> */ com.google.protobuf.ByteString getDateOfBirthBytes(); /** * <code>string height = 3;</code> */ java.lang.String getHeight(); /** * <code>string height = 3;</code> */ com.google.protobuf.ByteString getHeightBytes(); /** * <code>string eyeColor = 4;</code> */ java.lang.String getEyeColor(); /** * <code>string eyeColor = 4;</code> */ com.google.protobuf.ByteString getEyeColorBytes(); /** * <code>string heartRate = 5;</code> */ java.lang.String getHeartRate(); /** * <code>string heartRate = 5;</code> */ com.google.protobuf.ByteString getHeartRateBytes(); /** * <code>string timestamp = 6;</code> */ java.lang.String getTimestamp(); /** * <code>string timestamp = 6;</code> */ com.google.protobuf.ByteString getTimestampBytes(); } /** * Protobuf type {@code com.ebs.broker.model.protobuf.Publication} */ public static final class Publication extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:com.ebs.broker.model.protobuf.Publication) PublicationOrBuilder { private static final long serialVersionUID = 0L; // Use Publication.newBuilder() to construct. private Publication(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Publication() { patientName_ = ""; dateOfBirth_ = ""; height_ = ""; eyeColor_ = ""; heartRate_ = ""; timestamp_ = ""; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Publication( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { java.lang.String s = input.readStringRequireUtf8(); patientName_ = s; break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); dateOfBirth_ = s; break; } case 26: { java.lang.String s = input.readStringRequireUtf8(); height_ = s; break; } case 34: { java.lang.String s = input.readStringRequireUtf8(); eyeColor_ = s; break; } case 42: { java.lang.String s = input.readStringRequireUtf8(); heartRate_ = s; break; } case 50: { java.lang.String s = input.readStringRequireUtf8(); timestamp_ = s; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.ebs.broker.model.protobuf.Pub.internal_static_com_ebs_broker_model_protobuf_Publication_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.ebs.broker.model.protobuf.Pub.internal_static_com_ebs_broker_model_protobuf_Publication_fieldAccessorTable .ensureFieldAccessorsInitialized( com.ebs.broker.model.protobuf.Pub.Publication.class, com.ebs.broker.model.protobuf.Pub.Publication.Builder.class); } public static final int PATIENTNAME_FIELD_NUMBER = 1; private volatile java.lang.Object patientName_; /** * <code>string patientName = 1;</code> */ public java.lang.String getPatientName() { java.lang.Object ref = patientName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); patientName_ = s; return s; } } /** * <code>string patientName = 1;</code> */ public com.google.protobuf.ByteString getPatientNameBytes() { java.lang.Object ref = patientName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); patientName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int DATEOFBIRTH_FIELD_NUMBER = 2; private volatile java.lang.Object dateOfBirth_; /** * <code>string dateOfBirth = 2;</code> */ public java.lang.String getDateOfBirth() { java.lang.Object ref = dateOfBirth_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); dateOfBirth_ = s; return s; } } /** * <code>string dateOfBirth = 2;</code> */ public com.google.protobuf.ByteString getDateOfBirthBytes() { java.lang.Object ref = dateOfBirth_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); dateOfBirth_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int HEIGHT_FIELD_NUMBER = 3; private volatile java.lang.Object height_; /** * <code>string height = 3;</code> */ public java.lang.String getHeight() { java.lang.Object ref = height_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); height_ = s; return s; } } /** * <code>string height = 3;</code> */ public com.google.protobuf.ByteString getHeightBytes() { java.lang.Object ref = height_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); height_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int EYECOLOR_FIELD_NUMBER = 4; private volatile java.lang.Object eyeColor_; /** * <code>string eyeColor = 4;</code> */ public java.lang.String getEyeColor() { java.lang.Object ref = eyeColor_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); eyeColor_ = s; return s; } } /** * <code>string eyeColor = 4;</code> */ public com.google.protobuf.ByteString getEyeColorBytes() { java.lang.Object ref = eyeColor_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); eyeColor_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int HEARTRATE_FIELD_NUMBER = 5; private volatile java.lang.Object heartRate_; /** * <code>string heartRate = 5;</code> */ public java.lang.String getHeartRate() { java.lang.Object ref = heartRate_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); heartRate_ = s; return s; } } /** * <code>string heartRate = 5;</code> */ public com.google.protobuf.ByteString getHeartRateBytes() { java.lang.Object ref = heartRate_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); heartRate_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int TIMESTAMP_FIELD_NUMBER = 6; private volatile java.lang.Object timestamp_; /** * <code>string timestamp = 6;</code> */ public java.lang.String getTimestamp() { java.lang.Object ref = timestamp_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); timestamp_ = s; return s; } } /** * <code>string timestamp = 6;</code> */ public com.google.protobuf.ByteString getTimestampBytes() { java.lang.Object ref = timestamp_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); timestamp_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getPatientNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, patientName_); } if (!getDateOfBirthBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, dateOfBirth_); } if (!getHeightBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, height_); } if (!getEyeColorBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, eyeColor_); } if (!getHeartRateBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, heartRate_); } if (!getTimestampBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 6, timestamp_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getPatientNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, patientName_); } if (!getDateOfBirthBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, dateOfBirth_); } if (!getHeightBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, height_); } if (!getEyeColorBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, eyeColor_); } if (!getHeartRateBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, heartRate_); } if (!getTimestampBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, timestamp_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.ebs.broker.model.protobuf.Pub.Publication)) { return super.equals(obj); } com.ebs.broker.model.protobuf.Pub.Publication other = (com.ebs.broker.model.protobuf.Pub.Publication) obj; if (!getPatientName() .equals(other.getPatientName())) return false; if (!getDateOfBirth() .equals(other.getDateOfBirth())) return false; if (!getHeight() .equals(other.getHeight())) return false; if (!getEyeColor() .equals(other.getEyeColor())) return false; if (!getHeartRate() .equals(other.getHeartRate())) return false; if (!getTimestamp() .equals(other.getTimestamp())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PATIENTNAME_FIELD_NUMBER; hash = (53 * hash) + getPatientName().hashCode(); hash = (37 * hash) + DATEOFBIRTH_FIELD_NUMBER; hash = (53 * hash) + getDateOfBirth().hashCode(); hash = (37 * hash) + HEIGHT_FIELD_NUMBER; hash = (53 * hash) + getHeight().hashCode(); hash = (37 * hash) + EYECOLOR_FIELD_NUMBER; hash = (53 * hash) + getEyeColor().hashCode(); hash = (37 * hash) + HEARTRATE_FIELD_NUMBER; hash = (53 * hash) + getHeartRate().hashCode(); hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + getTimestamp().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.ebs.broker.model.protobuf.Pub.Publication parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.ebs.broker.model.protobuf.Pub.Publication parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.ebs.broker.model.protobuf.Pub.Publication parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.ebs.broker.model.protobuf.Pub.Publication prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code com.ebs.broker.model.protobuf.Publication} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:com.ebs.broker.model.protobuf.Publication) com.ebs.broker.model.protobuf.Pub.PublicationOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.ebs.broker.model.protobuf.Pub.internal_static_com_ebs_broker_model_protobuf_Publication_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.ebs.broker.model.protobuf.Pub.internal_static_com_ebs_broker_model_protobuf_Publication_fieldAccessorTable .ensureFieldAccessorsInitialized( com.ebs.broker.model.protobuf.Pub.Publication.class, com.ebs.broker.model.protobuf.Pub.Publication.Builder.class); } // Construct using com.ebs.broker.model.protobuf.Pub.Publication.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); patientName_ = ""; dateOfBirth_ = ""; height_ = ""; eyeColor_ = ""; heartRate_ = ""; timestamp_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.ebs.broker.model.protobuf.Pub.internal_static_com_ebs_broker_model_protobuf_Publication_descriptor; } @java.lang.Override public com.ebs.broker.model.protobuf.Pub.Publication getDefaultInstanceForType() { return com.ebs.broker.model.protobuf.Pub.Publication.getDefaultInstance(); } @java.lang.Override public com.ebs.broker.model.protobuf.Pub.Publication build() { com.ebs.broker.model.protobuf.Pub.Publication result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.ebs.broker.model.protobuf.Pub.Publication buildPartial() { com.ebs.broker.model.protobuf.Pub.Publication result = new com.ebs.broker.model.protobuf.Pub.Publication(this); result.patientName_ = patientName_; result.dateOfBirth_ = dateOfBirth_; result.height_ = height_; result.eyeColor_ = eyeColor_; result.heartRate_ = heartRate_; result.timestamp_ = timestamp_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.ebs.broker.model.protobuf.Pub.Publication) { return mergeFrom((com.ebs.broker.model.protobuf.Pub.Publication)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.ebs.broker.model.protobuf.Pub.Publication other) { if (other == com.ebs.broker.model.protobuf.Pub.Publication.getDefaultInstance()) return this; if (!other.getPatientName().isEmpty()) { patientName_ = other.patientName_; onChanged(); } if (!other.getDateOfBirth().isEmpty()) { dateOfBirth_ = other.dateOfBirth_; onChanged(); } if (!other.getHeight().isEmpty()) { height_ = other.height_; onChanged(); } if (!other.getEyeColor().isEmpty()) { eyeColor_ = other.eyeColor_; onChanged(); } if (!other.getHeartRate().isEmpty()) { heartRate_ = other.heartRate_; onChanged(); } if (!other.getTimestamp().isEmpty()) { timestamp_ = other.timestamp_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.ebs.broker.model.protobuf.Pub.Publication parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.ebs.broker.model.protobuf.Pub.Publication) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object patientName_ = ""; /** * <code>string patientName = 1;</code> */ public java.lang.String getPatientName() { java.lang.Object ref = patientName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); patientName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string patientName = 1;</code> */ public com.google.protobuf.ByteString getPatientNameBytes() { java.lang.Object ref = patientName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); patientName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string patientName = 1;</code> */ public Builder setPatientName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } patientName_ = value; onChanged(); return this; } /** * <code>string patientName = 1;</code> */ public Builder clearPatientName() { patientName_ = getDefaultInstance().getPatientName(); onChanged(); return this; } /** * <code>string patientName = 1;</code> */ public Builder setPatientNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); patientName_ = value; onChanged(); return this; } private java.lang.Object dateOfBirth_ = ""; /** * <code>string dateOfBirth = 2;</code> */ public java.lang.String getDateOfBirth() { java.lang.Object ref = dateOfBirth_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); dateOfBirth_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string dateOfBirth = 2;</code> */ public com.google.protobuf.ByteString getDateOfBirthBytes() { java.lang.Object ref = dateOfBirth_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); dateOfBirth_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string dateOfBirth = 2;</code> */ public Builder setDateOfBirth( java.lang.String value) { if (value == null) { throw new NullPointerException(); } dateOfBirth_ = value; onChanged(); return this; } /** * <code>string dateOfBirth = 2;</code> */ public Builder clearDateOfBirth() { dateOfBirth_ = getDefaultInstance().getDateOfBirth(); onChanged(); return this; } /** * <code>string dateOfBirth = 2;</code> */ public Builder setDateOfBirthBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); dateOfBirth_ = value; onChanged(); return this; } private java.lang.Object height_ = ""; /** * <code>string height = 3;</code> */ public java.lang.String getHeight() { java.lang.Object ref = height_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); height_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string height = 3;</code> */ public com.google.protobuf.ByteString getHeightBytes() { java.lang.Object ref = height_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); height_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string height = 3;</code> */ public Builder setHeight( java.lang.String value) { if (value == null) { throw new NullPointerException(); } height_ = value; onChanged(); return this; } /** * <code>string height = 3;</code> */ public Builder clearHeight() { height_ = getDefaultInstance().getHeight(); onChanged(); return this; } /** * <code>string height = 3;</code> */ public Builder setHeightBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); height_ = value; onChanged(); return this; } private java.lang.Object eyeColor_ = ""; /** * <code>string eyeColor = 4;</code> */ public java.lang.String getEyeColor() { java.lang.Object ref = eyeColor_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); eyeColor_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string eyeColor = 4;</code> */ public com.google.protobuf.ByteString getEyeColorBytes() { java.lang.Object ref = eyeColor_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); eyeColor_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string eyeColor = 4;</code> */ public Builder setEyeColor( java.lang.String value) { if (value == null) { throw new NullPointerException(); } eyeColor_ = value; onChanged(); return this; } /** * <code>string eyeColor = 4;</code> */ public Builder clearEyeColor() { eyeColor_ = getDefaultInstance().getEyeColor(); onChanged(); return this; } /** * <code>string eyeColor = 4;</code> */ public Builder setEyeColorBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); eyeColor_ = value; onChanged(); return this; } private java.lang.Object heartRate_ = ""; /** * <code>string heartRate = 5;</code> */ public java.lang.String getHeartRate() { java.lang.Object ref = heartRate_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); heartRate_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string heartRate = 5;</code> */ public com.google.protobuf.ByteString getHeartRateBytes() { java.lang.Object ref = heartRate_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); heartRate_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string heartRate = 5;</code> */ public Builder setHeartRate( java.lang.String value) { if (value == null) { throw new NullPointerException(); } heartRate_ = value; onChanged(); return this; } /** * <code>string heartRate = 5;</code> */ public Builder clearHeartRate() { heartRate_ = getDefaultInstance().getHeartRate(); onChanged(); return this; } /** * <code>string heartRate = 5;</code> */ public Builder setHeartRateBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); heartRate_ = value; onChanged(); return this; } private java.lang.Object timestamp_ = ""; /** * <code>string timestamp = 6;</code> */ public java.lang.String getTimestamp() { java.lang.Object ref = timestamp_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); timestamp_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>string timestamp = 6;</code> */ public com.google.protobuf.ByteString getTimestampBytes() { java.lang.Object ref = timestamp_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); timestamp_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>string timestamp = 6;</code> */ public Builder setTimestamp( java.lang.String value) { if (value == null) { throw new NullPointerException(); } timestamp_ = value; onChanged(); return this; } /** * <code>string timestamp = 6;</code> */ public Builder clearTimestamp() { timestamp_ = getDefaultInstance().getTimestamp(); onChanged(); return this; } /** * <code>string timestamp = 6;</code> */ public Builder setTimestampBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); timestamp_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:com.ebs.broker.model.protobuf.Publication) } // @@protoc_insertion_point(class_scope:com.ebs.broker.model.protobuf.Publication) private static final com.ebs.broker.model.protobuf.Pub.Publication DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.ebs.broker.model.protobuf.Pub.Publication(); } public static com.ebs.broker.model.protobuf.Pub.Publication getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Publication> PARSER = new com.google.protobuf.AbstractParser<Publication>() { @java.lang.Override public Publication parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Publication(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Publication> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Publication> getParserForType() { return PARSER; } @java.lang.Override public com.ebs.broker.model.protobuf.Pub.Publication getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static final com.google.protobuf.Descriptors.Descriptor internal_static_com_ebs_broker_model_protobuf_Publication_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_com_ebs_broker_model_protobuf_Publication_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\tpub.proto\022\035com.ebs.broker.model.protob" + "uf\"\177\n\013Publication\022\023\n\013patientName\030\001 \001(\t\022\023" + "\n\013dateOfBirth\030\002 \001(\t\022\016\n\006height\030\003 \001(\t\022\020\n\010e" + "yeColor\030\004 \001(\t\022\021\n\theartRate\030\005 \001(\t\022\021\n\ttime" + "stamp\030\006 \001(\tb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; return null; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); internal_static_com_ebs_broker_model_protobuf_Publication_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_com_ebs_broker_model_protobuf_Publication_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_com_ebs_broker_model_protobuf_Publication_descriptor, new java.lang.String[] { "PatientName", "DateOfBirth", "Height", "EyeColor", "HeartRate", "Timestamp", }); } // @@protoc_insertion_point(outer_class_scope) }
9238ec383c0838fe1d81b83dfcc51d933d337399
2,007
java
Java
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/FaultySubmittedJobGraphStore.java
aixuebo/flink-1.6
9c120d5619b22081b957feb0a3467cf30b0b6c20
[ "BSD-3-Clause" ]
9
2016-09-22T22:53:13.000Z
2019-11-30T03:07:29.000Z
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/FaultySubmittedJobGraphStore.java
aixuebo/flink-1.6
9c120d5619b22081b957feb0a3467cf30b0b6c20
[ "BSD-3-Clause" ]
204
2019-05-21T09:54:29.000Z
2019-07-26T21:04:30.000Z
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/FaultySubmittedJobGraphStore.java
aixuebo/flink-1.6
9c120d5619b22081b957feb0a3467cf30b0b6c20
[ "BSD-3-Clause" ]
2
2016-07-29T06:53:02.000Z
2016-09-09T12:55:02.000Z
30.876923
93
0.771799
998,632
/* * 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.flink.runtime.dispatcher; import org.apache.flink.api.common.JobID; import org.apache.flink.runtime.jobmanager.SubmittedJobGraph; import org.apache.flink.runtime.testutils.InMemorySubmittedJobGraphStore; import javax.annotation.Nullable; /** * {@link InMemorySubmittedJobGraphStore} implementation which can throw artifical errors for * testing purposes. */ final class FaultySubmittedJobGraphStore extends InMemorySubmittedJobGraphStore { @Nullable private Exception recoveryFailure = null; @Nullable private Exception removalFailure = null; void setRecoveryFailure(@Nullable Exception recoveryFailure) { this.recoveryFailure = recoveryFailure; } void setRemovalFailure(@Nullable Exception removalFailure) { this.removalFailure = removalFailure; } @Override public synchronized SubmittedJobGraph recoverJobGraph(JobID jobId) throws Exception { if (recoveryFailure != null) { throw recoveryFailure; } else { return super.recoverJobGraph(jobId); } } @Override public synchronized void removeJobGraph(JobID jobId) throws Exception { if (removalFailure != null) { throw removalFailure; } else { super.removeJobGraph(jobId); } } }
9238ec9149e641dac9c7d4ecdf4540ab6a8b3e53
344
java
Java
src/test/java/me/itzg/selfmonitorkafkaproducer/AppTests.java
itzg/example-self-monitor-kafka-app
38e5755c3204f7ad555f2edd7f06504cba181f20
[ "MIT" ]
4
2018-06-14T12:08:48.000Z
2022-01-20T17:39:20.000Z
src/test/java/me/itzg/selfmonitorkafkaproducer/AppTests.java
itzg/example-self-monitor-kafka-app
38e5755c3204f7ad555f2edd7f06504cba181f20
[ "MIT" ]
null
null
null
src/test/java/me/itzg/selfmonitorkafkaproducer/AppTests.java
itzg/example-self-monitor-kafka-app
38e5755c3204f7ad555f2edd7f06504cba181f20
[ "MIT" ]
1
2020-05-25T16:49:16.000Z
2020-05-25T16:49:16.000Z
20.235294
60
0.787791
998,633
package me.itzg.selfmonitorkafkaproducer; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class AppTests { @Test public void contextLoads() { } }
9238eccf63487778b1553ada40dc7f6aa30e2439
1,279
java
Java
passport-server/src/main/java/org/infinity/passport/domain/App.java
pm6422/passpor
999495e8b79043660798cf0771120f6c9ea3ea17
[ "Apache-2.0" ]
51
2018-10-15T12:03:43.000Z
2022-01-10T12:03:59.000Z
passport-server/src/main/java/org/infinity/passport/domain/App.java
pm6422/passpor
999495e8b79043660798cf0771120f6c9ea3ea17
[ "Apache-2.0" ]
2
2018-11-14T10:01:22.000Z
2020-11-21T08:06:40.000Z
passport-server/src/main/java/org/infinity/passport/domain/App.java
pm6422/passpor
999495e8b79043660798cf0771120f6c9ea3ea17
[ "Apache-2.0" ]
19
2018-10-17T08:33:02.000Z
2022-01-10T12:04:23.000Z
26.645833
62
0.738858
998,634
package org.infinity.passport.domain; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.Set; /** * Spring Data MongoDB collection for the App entity. */ @ApiModel("应用") @Document(collection = "App") @Data @NoArgsConstructor @AllArgsConstructor public class App implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "应用名称", required = true) @NotNull @Size(min = 3, max = 20) @Pattern(regexp = "^[a-zA-Z0-9-]+$", message = "{EP5903}") @Id private String name; @ApiModelProperty(value = "是否可用") private Boolean enabled; @ApiModelProperty(value = "权限名称") @Transient private Set<String> authorities; public App(String name, Boolean enabled) { this.name = name; this.enabled = enabled; } }
9238ecd79ec16559d6ad00ab7f8be0b677f72c88
2,450
java
Java
message-builder-demiftifier/src/main/java/ca/infoway/demiftifier/svgifier/VocabBoxShape.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
1
2022-03-09T12:17:41.000Z
2022-03-09T12:17:41.000Z
message-builder-demiftifier/src/main/java/ca/infoway/demiftifier/svgifier/VocabBoxShape.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
null
null
null
message-builder-demiftifier/src/main/java/ca/infoway/demiftifier/svgifier/VocabBoxShape.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
null
null
null
33.561644
119
0.716327
998,635
/** * Copyright 2013 Canada Health Infoway, 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. * * Author: $LastChangedBy: tmcgrady $ * Last modified: $LastChangedDate: 2013-01-02 17:05:34 -0500 (Wed, 02 Jan 2013) $ * Revision: $LastChangedRevision: 6471 $ */ package ca.infoway.demiftifier.svgifier; import ca.infoway.demiftifier.ConceptDomainLayoutItem; import ca.infoway.demiftifier.VocabularyLayoutItem; public class VocabBoxShape extends VocabularyShape { public VocabBoxShape(VocabularyLayoutItem item, StyleProvider styleProvider) { super(item, styleProvider); } public VocabBoxShape(ConceptDomainLayoutItem item, StyleProvider styleProvider) { super(item, styleProvider); } @Override protected Padding getMargins() { if (this.item.isRootType()) { return Padding.padAllSides(1); } else { return super.getMargins(); } } @Override protected Fill getFillColor() { Fill fillColor = super.getFillColor(); return (fillColor instanceof ColorFill) && this.item.isDuplicate() ? ((ColorFill) fillColor).makeGrey() : fillColor; } @Override protected void initializeLabels() { if (this.labels.isEmpty()) { VocabularyLayoutItem vocabItem = null; if(getItem() instanceof VocabularyLayoutItem) { vocabItem = (VocabularyLayoutItem)getItem(); } FormattedString labelString = new FormattedString(); labelString.addSegment(getItem().getLabel(), this.styleProvider.getDefaultBoldTextFont()); this.styleProvider.assignTextBounds(labelString, null); this.labels.add(labelString); if (vocabItem != null) { FormattedString codeString = new FormattedString(); codeString.addSegment(vocabItem.getSubLabel(), this.styleProvider.getDefaultNonProportionalTextFont()); this.styleProvider.assignTextBounds(codeString, null); this.labels.add(codeString); } } } }
9238ed9d0a96a1aab3cf6e3cb2a0ef9521a08246
15,633
java
Java
src/main/java/pl/edu/pjwstk/kaldi/KaldiMain.java
danijel3/KaldiJava
1fffa1d9a137e97f44c08fb7205bb8317ade3084
[ "Apache-2.0" ]
20
2016-06-12T15:42:57.000Z
2021-09-30T09:16:45.000Z
src/main/java/pl/edu/pjwstk/kaldi/KaldiMain.java
gooran/KaldiJava
1fffa1d9a137e97f44c08fb7205bb8317ade3084
[ "Apache-2.0" ]
null
null
null
src/main/java/pl/edu/pjwstk/kaldi/KaldiMain.java
gooran/KaldiJava
1fffa1d9a137e97f44c08fb7205bb8317ade3084
[ "Apache-2.0" ]
11
2017-02-22T16:27:27.000Z
2021-09-30T09:16:46.000Z
37.310263
119
0.543914
998,636
package pl.edu.pjwstk.kaldi; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.Locale; import java.util.logging.Level; import java.util.regex.Pattern; import javax.sound.sampled.UnsupportedAudioFileException; import pl.edu.pjwstk.kaldi.files.EAF; import pl.edu.pjwstk.kaldi.files.LAB; import pl.edu.pjwstk.kaldi.files.Segmentation; import pl.edu.pjwstk.kaldi.files.Segmentation.Segment; import pl.edu.pjwstk.kaldi.files.TextGrid; import pl.edu.pjwstk.kaldi.programs.KaldiScripts; import pl.edu.pjwstk.kaldi.programs.KaldiUtils; import pl.edu.pjwstk.kaldi.programs.NGram; import pl.edu.pjwstk.kaldi.programs.Shout; import pl.edu.pjwstk.kaldi.programs.Transcriber; import pl.edu.pjwstk.kaldi.utils.Diff; import pl.edu.pjwstk.kaldi.utils.FileUtils; import pl.edu.pjwstk.kaldi.utils.Log; import pl.edu.pjwstk.kaldi.utils.ParseOptions; import pl.edu.pjwstk.kaldi.utils.Settings; import pl.edu.pjwstk.kaldi.utils.WAV; public class KaldiMain { public static void main(String[] args) { try { Locale.setDefault(Locale.ENGLISH); Log.init("KaldiJava", false); // Log.setLevel(Level.INFO); Log.setLevel(Level.ALL); ParseOptions po = new ParseOptions("KaldiJava", "Scripts for KLADI written in JAVA."); po.addArgument(File.class, "input.wav|input_dir", "input WAV file or directory"); po.addArgument("align", 'a', Boolean.class, "perform alignment of a single file", "false"); po.addArgument("forced", 'f', Boolean.class, "perform forced alignment", "false"); po.addArgument("align-dir", 'A', Boolean.class, "perform alignment of all the files within a directory", "false"); po.addArgument("align-elan", 'E', Boolean.class, "perform alignment of an Elan file (given as transcription)", "false"); po.addArgument("diarize", 'D', Boolean.class, "perform speaker diarization", "false"); po.addArgument("trans", 't', File.class, "text file with transcription", "trans.txt"); po.addArgument("gridfile", 'g', File.class, "save result as TextGrid", null); po.addArgument("labfile", 'l', File.class, "save result as HTK label file", null); po.addArgument("settings", 's', File.class, "Load program settings from a file", null); po.addArgument("dump-settings", 'd', File.class, "Save default program settings to a file", null); if (!po.parse(args)) return; po.printOptions(); if (po.getArgument("dump-settings") != null) { Log.info("Dumping settings and exitting."); Settings.dumpSettings((File) po.getArgument("dump-settings")); return; } if (po.getArgument("settings") != null) { Log.info("Loading settings..."); Settings.loadSettings((File) po.getArgument("settings")); } Settings.dumpSettings(); boolean forced_alignment = (boolean) po.getArgument("forced"); if ((boolean) po.getArgument("align-elan")) { KaldiUtils.init(); KaldiUtils.test(); KaldiScripts.init(); KaldiScripts.test(); Transcriber.init(); Transcriber.test(); NGram.test_srilm(); Log.info("Processing ELAN file..."); File input_wav = (File) po.getArgument(0); File input_eaf = (File) po.getArgument("trans"); File textgrid = (File) po.getArgument("gridfile"); File labfile = (File) po.getArgument("labfile"); EAF eaf = new EAF(); eaf.read(input_eaf); Segmentation final_segmentation = null; for (Segment seg : eaf.tiers.get(0).segments) { if (seg.name.split(" ").length < 2) { // TODO Log.warn("one segment"); continue; } File temp_wav = new File(Settings.temp_dir, "eaf_tmp.wav"); // Sox.extract(input_wav, temp_wav, seg.start_time, // seg.end_time); WAV.extract(input_wav, temp_wav, seg.start_time, seg.end_time); File temp_txt = new File(Settings.temp_dir, "eaf_tmp.txt"); PrintWriter temp_writer = new PrintWriter(temp_txt); temp_writer.println(seg.name); temp_writer.close(); Segmentation segmentation = alignFile(temp_wav, temp_txt, null, null); if (final_segmentation == null) { final_segmentation = segmentation; final_segmentation.offsetSegments(seg.start_time); } else final_segmentation.appendSegmenation(segmentation, seg.start_time); } if (textgrid != null) { Log.info("Saving " + textgrid.getName()); TextGrid tg = new TextGrid(final_segmentation); tg.write(textgrid); } if (labfile != null) { Log.info("Saving " + labfile.getName()); LAB lab = new LAB(final_segmentation.tiers.get(0)); lab.write(labfile); } } else if ((boolean) po.getArgument("align-dir")) { KaldiUtils.init(); KaldiUtils.test(); KaldiScripts.init(); KaldiScripts.test(); Transcriber.init(); Transcriber.test(); NGram.test_srilm(); File align_dir = (File) po.getArgument(0); for (File file : align_dir.listFiles()) { if (file.getName().endsWith(".wav")) { String name = file.getName(); name = name.substring(0, name.length() - 4); File input_wav = file; File input_txt = new File(align_dir, name + ".txt"); File textgrid = new File(align_dir, name + ".TextGrid"); File labfile = new File(align_dir, name + ".lab"); Log.info("Aligning file: " + file.getAbsolutePath()); if (labfile.exists() && textgrid.exists()) { Log.warn("File seems already aligned! Skipping..."); continue; } if (!input_wav.canRead()) { Log.warn("Cannot read file " + input_wav.getName() + "! Skipping..."); continue; } if (!input_txt.canRead()) { Log.warn("Cannot read file " + input_txt.getName() + "! Skipping..."); continue; } try { if (forced_alignment) forcedAlignFile(input_wav, input_txt, textgrid, labfile); else alignFile(input_wav, input_txt, textgrid, labfile); } catch (Exception e) { Log.error("Exception processing " + input_wav.getName() + "!", e); } } } } else if ((boolean) po.getArgument("align")) { KaldiUtils.init(); KaldiUtils.test(); KaldiScripts.init(); KaldiScripts.test(); Transcriber.init(); Transcriber.test(); NGram.test_srilm(); Log.info("Starting alignment..."); File input_wav = (File) po.getArgument(0); File input_txt = (File) po.getArgument("trans"); File textgrid = (File) po.getArgument("gridfile"); File labfile = (File) po.getArgument("labfile"); if (forced_alignment) forcedAlignFile(input_wav, input_txt, textgrid, labfile); else alignFile(input_wav, input_txt, textgrid, labfile); } else if ((boolean) po.getArgument("diarize")) { File input_wav = (File) po.getArgument(0); diarize(input_wav); } else Log.error("Don't know what to do"); } catch (FileNotFoundException fne) { Log.error("Cannot find a file needed by this program: " + fne.getMessage()); } catch (Exception e) { Log.error("Main error", e); } Log.info("Program finished!"); } public static void diarize(File input_wav) throws FileNotFoundException { Shout.test(); String name = input_wav.getName(); name = name.substring(0, name.length() - 4); File input_dir = input_wav.getParentFile(); File seg_model = new File(Settings.shout_models, "shout.sad"); File seg_out = new File(input_dir, name + ".seg"); File dia_out = new File(input_dir, name + ".dia"); Shout.shout_segment(input_wav, seg_model, seg_out); Shout.shout_cluster(input_wav, seg_out, dia_out, 2); } public static Segmentation forcedAlignFile(File input_wav, File input_txt, File textgrid, File labfile) throws IOException { Segmentation segmentation; Log.info("Starting forced alignment..."); KaldiScripts.makeL(input_txt); segmentation = KaldiScripts.align(input_wav, input_txt, false); for (Segment seg : segmentation.tiers.get(1).segments) { seg.name = fixPhSegment(seg.name); } Log.info("Saving segmentation..."); if (textgrid != null) { TextGrid outgrid = new TextGrid(segmentation); Log.info("Saving " + textgrid.getName()); outgrid.write(textgrid); } if (labfile != null) { LAB lab = new LAB(segmentation.tiers.get(1)); Log.info("Saving " + labfile.getName()); lab.write(labfile); } return segmentation; } private static Pattern pDisambSym = Pattern.compile("_[ISBE]$"); private static String fixPhSegment(String ph) { if (pDisambSym.matcher(ph).matches()) return ph.substring(0, ph.length() - 2); else return ph; } public static Segmentation alignFile(File input_wav, File input_txt, File textgrid, File labfile) throws IOException, UnsupportedAudioFileException { return alignFile(input_wav, input_txt, textgrid, labfile, 0); } public static Segmentation alignFile(File input_wav, File input_txt, File textgrid, File labfile, int depth) throws IOException, UnsupportedAudioFileException { Segmentation segmentation; float file_len = WAV.getLength(input_wav); if (depth > 5) { throw new RuntimeException("Recursion depth too large..."); } Log.info("Starting decoding process..."); KaldiScripts.makeHCLG(input_txt); segmentation = KaldiScripts.decode(input_wav, false); //segmentation = KaldiScripts.decode_oracle(input_wav, input_txt); if (textgrid != null) { TextGrid decode_temp = new TextGrid(segmentation); decode_temp.write(new File(textgrid.getParentFile(), "decode_" + textgrid.getName())); } else { TextGrid decode_temp = new TextGrid(segmentation); decode_temp.write(new File("temp.TextGrid")); } String ref = FileUtils.readFile(input_txt, " "); Log.info("Comparing decoding output to ref..."); Segmentation fix_seg = Diff.diff(segmentation, ref, file_len); if (textgrid != null) { TextGrid diff_temp = new TextGrid(fix_seg); diff_temp.write(new File(textgrid.getParentFile(), "diff_" + textgrid.getName())); } TextGrid outgrid = new TextGrid(); int w_tier = 0; int ph_tier = 1; outgrid.renameTier(w_tier, "words"); outgrid.renameTier(ph_tier, "phonemes"); Settings.temp_dir2.mkdirs(); File temp_wav = File.createTempFile("seg", ".wav", Settings.temp_dir2); File temp_txt = File.createTempFile("seg", ".txt", Settings.temp_dir2); Log.info("Adding correctly recognized segments..."); if (fix_seg.tiers.size() < 3) { Log.warn("Diff segmentation incorrect!"); return outgrid; } else { for (Segment seg : fix_seg.tiers.get(1).segments) outgrid.addSegment(w_tier, seg.start_time, seg.end_time, seg.name, seg.confidence); for (Segment seg : fix_seg.tiers.get(2).segments) outgrid.addSegment(ph_tier, seg.start_time, seg.end_time, fixPhSegment(seg.name), seg.confidence); } Log.info("Re-aligning mismatched segments..."); for (Segment seg : fix_seg.tiers.get(0).segments) { Log.info("Aligning: " + seg.name + "(" + seg.start_time + "," + seg.end_time + ")"); if (seg.name.trim().length() == 0) { Log.warn("Empty segment! " + seg.start_time + " to " + seg.end_time); continue; } // Sox.extract(input_wav, temp_wav, seg.start_time, seg.end_time); WAV.extract(input_wav, temp_wav, seg.start_time, seg.end_time); PrintWriter writer = new PrintWriter(temp_txt); writer.println(seg.name); writer.close(); try { KaldiScripts.makeL(temp_txt); segmentation = KaldiScripts.align(temp_wav, temp_txt, false); } catch (Exception e) { Log.warn("Exc: " + e); Log.warn("Failed to force align segment: " + seg.name + "(" + temp_wav.getName() + ")"); try { segmentation = alignFile(temp_wav, temp_txt, null, null, depth + 1); } catch (Exception e1) { Log.warn("Exc: " + e1); Log.warn("Failed to re-align segment: " + seg.name); Log.warn("Abandoning!"); continue; } } for (Segment seg2 : segmentation.tiers.get(w_tier).segments) outgrid.addSegment(w_tier, seg.start_time + seg2.start_time, seg.start_time + seg2.end_time, seg2.name, seg2.confidence); for (Segment seg2 : segmentation.tiers.get(ph_tier).segments) outgrid.addSegment(ph_tier, seg.start_time + seg2.start_time, seg.start_time + seg2.end_time, fixPhSegment(seg2.name), seg2.confidence); } Log.info("Saving segmentation..."); outgrid.sort(); if (textgrid != null) { Log.info("Saving " + textgrid.getName()); outgrid.write(textgrid); } if (labfile != null && !outgrid.tiers.isEmpty()) { LAB lab = new LAB(outgrid.tiers.get(0)); Log.info("Saving " + labfile.getName()); lab.write(labfile); } return outgrid; } }
9238ef387b2b9ad2f1b0e13412ba9a9ce2494668
1,901
java
Java
kikaha-modules/kikaha-urouting/source/kikaha/urouting/apt/WebSocketParameterParser.java
jardelnovaes/kikaha
f341df163e34902fbf2f060ab0f53a860b73deca
[ "Apache-2.0" ]
72
2015-06-01T13:42:49.000Z
2021-05-12T10:57:56.000Z
kikaha-modules/kikaha-urouting/source/kikaha/urouting/apt/WebSocketParameterParser.java
heeisenbeergg/kikaha
ebb8bb223856e494483c3dbf0e2d597daef24a7a
[ "Apache-2.0" ]
235
2015-01-16T14:08:36.000Z
2021-06-14T04:11:21.000Z
kikaha-modules/kikaha-urouting/source/kikaha/urouting/apt/WebSocketParameterParser.java
heeisenbeergg/kikaha
ebb8bb223856e494483c3dbf0e2d597daef24a7a
[ "Apache-2.0" ]
27
2015-04-08T05:03:39.000Z
2020-11-30T13:43:17.000Z
44.209302
132
0.753288
998,637
package kikaha.urouting.apt; import static java.lang.String.format; import static kikaha.apt.APT.*; import javax.lang.model.element.*; import java.lang.annotation.Annotation; import java.util.function.Function; import io.undertow.websockets.core.CloseMessage; import kikaha.apt.*; import kikaha.core.modules.websocket.WebSocketSession; import kikaha.urouting.api.*; public class WebSocketParameterParser extends MethodParametersExtractor { public WebSocketParameterParser() { super( createWebSocketAnnotationRules(), WebSocketParameterParser::trySerializeAnyOtherBodyContent ); } static ChainedRules<VariableElement, Function<VariableElement, String>> createWebSocketAnnotationRules(){ final ChainedRules<VariableElement, Function<VariableElement, String>> rules = new ChainedRules<>(); rules .with( isAnnotatedWith( PathParam.class ), v -> getParam( PathParam.class, v.getAnnotation( PathParam.class ).value(), v ) ) .and( isAnnotatedWith( HeaderParam.class ), v -> getParam( HeaderParam.class, v.getAnnotation( HeaderParam.class ).value(), v ) ) .and( typeIs( String.class ), v -> "message" ) .and( typeIs( CloseMessage.class ), v -> "cm" ) .and( typeIs( WebSocketSession.class ), v -> "session" ) .and( typeIs( Throwable.class ), v -> "cause" ); return rules; } static String getParam( final Class<?> targetAnnotation, final String param, final VariableElement parameter ) { final String targetType = asType( parameter ); return format( "dataProvider.get%s( session, \"%s\", %s.class )", targetAnnotation.getSimpleName(), param, targetType ); } @SuppressWarnings( "unused" ) static String trySerializeAnyOtherBodyContent( final ExecutableElement executableElement, final VariableElement parameter ) { final String typeAsString = parameter.asType().toString(); return "dataProvider.getBody( session, message, " + typeAsString + ".class )"; } }
9238ef5ba530ed4bee44b123b2f6316a04e49cd7
1,985
java
Java
sdk/appcontainers/azure-resourcemanager-appcontainers/src/main/java/com/azure/resourcemanager/appcontainers/fluent/models/ReplicaProperties.java
alexbuckgit/azure-sdk-for-java
622f39c5b5dea4a26ffcf3d9ea0b46ae6b8e809a
[ "MIT" ]
1
2022-01-08T06:43:30.000Z
2022-01-08T06:43:30.000Z
sdk/appcontainers/azure-resourcemanager-appcontainers/src/main/java/com/azure/resourcemanager/appcontainers/fluent/models/ReplicaProperties.java
alexbuckgit/azure-sdk-for-java
622f39c5b5dea4a26ffcf3d9ea0b46ae6b8e809a
[ "MIT" ]
null
null
null
sdk/appcontainers/azure-resourcemanager-appcontainers/src/main/java/com/azure/resourcemanager/appcontainers/fluent/models/ReplicaProperties.java
alexbuckgit/azure-sdk-for-java
622f39c5b5dea4a26ffcf3d9ea0b46ae6b8e809a
[ "MIT" ]
null
null
null
29.191176
97
0.681108
998,638
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.appcontainers.fluent.models; import com.azure.core.annotation.Fluent; import com.azure.resourcemanager.appcontainers.models.ReplicaContainer; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; /** Replica resource specific properties. */ @Fluent public final class ReplicaProperties { /* * Timestamp describing when the pod was created by controller */ @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime createdTime; /* * The containers collection under a replica. */ @JsonProperty(value = "containers") private List<ReplicaContainer> containers; /** * Get the createdTime property: Timestamp describing when the pod was created by controller. * * @return the createdTime value. */ public OffsetDateTime createdTime() { return this.createdTime; } /** * Get the containers property: The containers collection under a replica. * * @return the containers value. */ public List<ReplicaContainer> containers() { return this.containers; } /** * Set the containers property: The containers collection under a replica. * * @param containers the containers value to set. * @return the ReplicaProperties object itself. */ public ReplicaProperties withContainers(List<ReplicaContainer> containers) { this.containers = containers; return this; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (containers() != null) { containers().forEach(e -> e.validate()); } } }
9238f08c2369feaf43126ac2cd5dbb78048f3e3b
485
java
Java
api/src/test/java/uk/gov/dhsc/htbhf/claimant/message/CreateNewCardDummyMessageTypeProcessor.java
DepartmentOfHealth-htbhf/htbhf-claimant-service
3b96e2ffb8ea422d2190b08ecc18887c1e96565a
[ "MIT" ]
2
2019-10-03T10:37:56.000Z
2021-03-06T14:26:48.000Z
api/src/test/java/uk/gov/dhsc/htbhf/claimant/message/CreateNewCardDummyMessageTypeProcessor.java
DepartmentOfHealth-htbhf/htbhf-claimant-service
3b96e2ffb8ea422d2190b08ecc18887c1e96565a
[ "MIT" ]
41
2018-12-20T12:43:23.000Z
2020-01-31T13:18:00.000Z
api/src/test/java/uk/gov/dhsc/htbhf/claimant/message/CreateNewCardDummyMessageTypeProcessor.java
DepartmentOfHealth-htbhf/htbhf-claimant-service
3b96e2ffb8ea422d2190b08ecc18887c1e96565a
[ "MIT" ]
3
2020-01-24T14:24:02.000Z
2020-01-24T14:53:25.000Z
25.526316
85
0.769072
998,639
package uk.gov.dhsc.htbhf.claimant.message; import uk.gov.dhsc.htbhf.claimant.entity.Message; import static uk.gov.dhsc.htbhf.claimant.message.MessageType.REQUEST_NEW_CARD; public class CreateNewCardDummyMessageTypeProcessor implements MessageTypeProcessor { @Override public MessageStatus processMessage(Message message) { return MessageStatus.COMPLETED; } @Override public MessageType supportsMessageType() { return REQUEST_NEW_CARD; } }
9238f0d6318821a90bb7dc4dac17aed6ab8bd547
945
java
Java
src/main/java/com/bandwidth/sdk/messaging/models/SendMessageRequest.java
Bandwidth/messaging-java-sdk
0166b7af923f4acc30b3a886f8764688821c1d2f
[ "MIT" ]
1
2021-02-15T17:53:48.000Z
2021-02-15T17:53:48.000Z
src/main/java/com/bandwidth/sdk/messaging/models/SendMessageRequest.java
Bandwidth/messaging-java-sdk
0166b7af923f4acc30b3a886f8764688821c1d2f
[ "MIT" ]
26
2018-11-05T15:42:32.000Z
2020-08-28T16:21:07.000Z
src/main/java/com/bandwidth/sdk/messaging/models/SendMessageRequest.java
Bandwidth/messaging-java-sdk
0166b7af923f4acc30b3a886f8764688821c1d2f
[ "MIT" ]
1
2019-08-09T03:06:25.000Z
2019-08-09T03:06:25.000Z
26.25
65
0.775661
998,640
package com.bandwidth.sdk.messaging.models; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.immutables.value.Value; import java.util.List; import java.util.Optional; @Value.Immutable @JsonSerialize(as = ImmutableSendMessageRequest.class) @JsonDeserialize(as = ImmutableSendMessageRequest.class) public abstract class SendMessageRequest { public abstract List<String> getTo(); public abstract String getFrom(); public abstract Optional<String> getText(); public abstract String getApplicationId(); public abstract Optional<String> getTag(); public abstract List<String> getMedia(); public abstract Optional<String> getPriority(); public abstract Optional<String> getExpiration(); public static ImmutableSendMessageRequest.Builder builder() { return ImmutableSendMessageRequest.builder(); } }
9238f12fd87d8420b57cd1e2feae3d85395f2f81
6,343
java
Java
ride/src/main/java/com/rolandopalermo/facturacion/ec/ride/RIDEGenerator.java
rolandopalermo/facturacion-electronica-ec
9d706e84b1fa2993b3f0755240fc4ff2d7115ce2
[ "MIT" ]
21
2018-10-30T19:17:45.000Z
2019-12-20T14:56:17.000Z
ride/src/main/java/com/rolandopalermo/facturacion/ec/ride/RIDEGenerator.java
DARIO5023/veronica-open-api
226e3aa2b44bfcd41cc357df0931160a98818def
[ "MIT" ]
18
2018-10-30T16:23:14.000Z
2019-12-05T17:26:46.000Z
ride/src/main/java/com/rolandopalermo/facturacion/ec/ride/RIDEGenerator.java
DARIO5023/veronica-open-api
226e3aa2b44bfcd41cc357df0931160a98818def
[ "MIT" ]
25
2018-11-01T22:02:13.000Z
2019-12-27T01:21:35.000Z
49.170543
121
0.691786
998,641
package com.rolandopalermo.facturacion.ec.ride; import com.rolandopalermo.facturacion.ec.common.XMLUtils; import com.rolandopalermo.facturacion.ec.common.exception.VeronicaException; import com.rolandopalermo.facturacion.ec.domain.PaymentMethod; import com.rolandopalermo.facturacion.ec.domain.ReceiptType; import com.rolandopalermo.facturacion.ec.domain.Supplier; import com.rolandopalermo.facturacion.ec.domain.TaxType; import com.rolandopalermo.facturacion.ec.persistence.PaymentMethodRepository; import com.rolandopalermo.facturacion.ec.persistence.ReceiptTypeRepository; import com.rolandopalermo.facturacion.ec.persistence.SupplierRepository; import com.rolandopalermo.facturacion.ec.persistence.TaxTypeRepository; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.data.JRXmlDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.w3c.dom.Document; import javax.annotation.PostConstruct; import java.io.BufferedWriter; import java.io.File; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Base64; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; @Service("rideGenerator") public class RIDEGenerator { private static final String RUC_IDENTIFICACION_EMISOR = "//infoTributaria/ruc"; @Autowired private PaymentMethodRepository paymentMethodRepository; @Autowired private ReceiptTypeRepository receiptTypeRepository; @Autowired private TaxTypeRepository taxTypeRepository; @Autowired private SupplierRepository supplierRepository; private HashMap<String, String> hmapFormasPago; private HashMap<String, String> hmapTiposDocumentos; private HashMap<String, String> hmapTiposImpuestos; @PostConstruct public void init() { List<PaymentMethod> lstPaymentMethods = paymentMethodRepository.findAll(); List<ReceiptType> lstReceiptTypes = receiptTypeRepository.findAll(); List<TaxType> lstTaxTypes = taxTypeRepository.findAll(); hmapFormasPago = (HashMap<String, String>) lstPaymentMethods.stream() .collect(Collectors.toMap(PaymentMethod::getCode, PaymentMethod::getDescription)); hmapTiposDocumentos = (HashMap<String, String>) lstReceiptTypes.stream() .collect(Collectors.toMap(ReceiptType::getCode, ReceiptType::getDescription)); hmapTiposImpuestos = (HashMap<String, String>) lstTaxTypes.stream() .collect(Collectors.toMap(TaxType::getCode, TaxType::getDescription)); } public byte[] buildPDF(String xmlContent, String numeroAutorizacion, String fechaAutorizacion) throws VeronicaException { File comprobante; try { //Create temp XML file comprobante = File.createTempFile(numeroAutorizacion, ".xml"); Path path = Paths.get(comprobante.getAbsolutePath()); try (BufferedWriter writer = Files.newBufferedWriter(path)) { writer.write(xmlContent); } //Read XML DOM Document doc = XMLUtils.convertStringToDocument(xmlContent); String rootElement = XMLUtils.getXmlRootElement(doc); String numeroIdentificacion = XMLUtils.xPath(doc, RUC_IDENTIFICACION_EMISOR); if (numeroIdentificacion == null || numeroIdentificacion.isEmpty()) { throw new VeronicaException( String.format("No se pudo obtener el número de R.U.C. del comprobante %s", xmlContent)); } //Get Logo Optional<Supplier> empresas = supplierRepository.findByIdNumber(numeroIdentificacion); if (!empresas.isPresent()) { throw new VeronicaException( String.format("No se pudo obtener el logo del número de R.U.C. %s", numeroIdentificacion)); } byte[] encodedLogo = Base64.getEncoder().encode(empresas.get().getLogo()); //Select template StringBuilder sbTemplate = new StringBuilder("/com/rolandopalermo/facturacion/ec/ride/RIDE_"); sbTemplate.append(rootElement); sbTemplate.append(".jrxml"); String template = sbTemplate.toString(); InputStream reportStream = RIDEGenerator.class.getResourceAsStream(template); JasperReport jasperReport; jasperReport = JasperCompileManager.compileReport(reportStream); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("numeroAutorizacion", numeroAutorizacion); parameters.put("fechaAutorizacion", fechaAutorizacion); parameters.put("hmapTiposDocumentos", hmapTiposDocumentos); parameters.put("hmapTiposImpuestos", hmapTiposImpuestos); parameters.put("hmapFormasPago", hmapFormasPago); parameters.put("logo", new String(encodedLogo)); JRXmlDataSource xmlDataSource = new JRXmlDataSource(comprobante.getAbsolutePath(), rootElement); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, xmlDataSource); if (jasperPrint == null) { throw new VeronicaException(String.format( "No se pudo generar el PDF para el comprobante con clave de acceso %s", numeroAutorizacion)); } if (!comprobante.delete()) { throw new VeronicaException( String.format("No se puede eliminar el archivo temporal en %s", comprobante.getAbsolutePath())); } return JasperExportManager.exportReportToPdf(jasperPrint); } catch (Exception e) { throw new VeronicaException("Ocurrió un error interno al generar el PDF"); } } }
9238f1b82ec5ea2bad63b7d627b912cbf11def30
2,269
java
Java
plugin/src/main/java/net/codingarea/challenges/plugin/management/server/GeneratorWorldPortalManager.java
kxmpetentes/Challenges
fdd156e42557beeedf4fa417b663712b77a3aa51
[ "Apache-2.0" ]
null
null
null
plugin/src/main/java/net/codingarea/challenges/plugin/management/server/GeneratorWorldPortalManager.java
kxmpetentes/Challenges
fdd156e42557beeedf4fa417b663712b77a3aa51
[ "Apache-2.0" ]
null
null
null
plugin/src/main/java/net/codingarea/challenges/plugin/management/server/GeneratorWorldPortalManager.java
kxmpetentes/Challenges
fdd156e42557beeedf4fa417b663712b77a3aa51
[ "Apache-2.0" ]
null
null
null
31.082192
104
0.738211
998,642
package net.codingarea.challenges.plugin.management.server; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.anweisen.utilities.common.config.Document; import net.codingarea.challenges.plugin.Challenges; import net.codingarea.challenges.plugin.management.challenges.entities.GamestateSaveable; import org.bukkit.Location; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; /** * Manages the portal locations of custom worlds * * @author KxmischesDomi | https://github.com/kxmischesdomi * @since 2.1.0 */ public class GeneratorWorldPortalManager implements GamestateSaveable { public Map<UUID, Location> lastWorldLocations; public GeneratorWorldPortalManager() { lastWorldLocations = new HashMap<>(); Challenges.getInstance().getChallengeManager().registerGameStateSaver(this); } @Nullable public Location getAndRemoveLastWorld(@Nonnull Player player) { return lastWorldLocations.remove(player.getUniqueId()); } public void setLastLocation(@Nonnull Player player, @Nonnull Location location) { lastWorldLocations.put(player.getUniqueId(), location); } public boolean isCustomWorld(@Nonnull String name) { return Challenges.getInstance().getGameWorldStorage().getCustomGeneratedGameWorlds().contains(name); } @Override public String getUniqueName() { return getClass().getSimpleName().toLowerCase(); } @Override public void writeGameState(@NotNull Document document) { for (Entry<UUID, Location> entry : lastWorldLocations.entrySet()) { UUID uuid = entry.getKey(); Location location = entry.getValue(); document.set(uuid.toString(), location); } } @Override public void loadGameState(@NotNull Document document) { for (String key : document.keys()) { try { Location location = document.getInstance(key, Location.class); UUID uuid = UUID.fromString(key); lastWorldLocations.put(uuid, location); } catch (Exception exception) { Challenges.getInstance().getLogger().error("Couldn't load last location of: " + key); exception.printStackTrace(); } } } }
9238f20665bc068c48e53dbdc2463e0491c1b31d
2,031
java
Java
src/main/java/org/t246osslab/easybuggy4sb/vulnerabilities/BruteForceController.java
NIRANKEN/easybuggy4sb
beec2ecf79b04fb2a1b3502a66af317331b4b164
[ "Apache-2.0" ]
30
2017-07-09T12:30:59.000Z
2021-12-27T14:03:26.000Z
src/main/java/org/t246osslab/easybuggy4sb/vulnerabilities/BruteForceController.java
NIRANKEN/easybuggy4sb
beec2ecf79b04fb2a1b3502a66af317331b4b164
[ "Apache-2.0" ]
9
2017-08-25T03:00:27.000Z
2017-08-30T02:23:56.000Z
src/main/java/org/t246osslab/easybuggy4sb/vulnerabilities/BruteForceController.java
NIRANKEN/easybuggy4sb
beec2ecf79b04fb2a1b3502a66af317331b4b164
[ "Apache-2.0" ]
7
2018-11-06T23:33:48.000Z
2021-09-16T12:57:42.000Z
37.611111
113
0.69227
998,643
package org.t246osslab.easybuggy4sb.vulnerabilities; import java.io.IOException; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.t246osslab.easybuggy4sb.controller.DefaultLoginController; @Controller public class BruteForceController extends DefaultLoginController { @Override @RequestMapping(value = "/bruteforce/login", method = RequestMethod.GET) public ModelAndView doGet(ModelAndView mav, HttpServletRequest req, HttpServletResponse res, Locale locale) { req.setAttribute("note", msg.getMessage("msg.note.brute.force", null, locale)); super.doGet(mav, req, res, locale); return mav; } @Override @RequestMapping(value = "/bruteforce/login", method = RequestMethod.POST) public ModelAndView doPost(ModelAndView mav, HttpServletRequest req, HttpServletResponse res, Locale locale) throws IOException { String userid = req.getParameter("userid"); String password = req.getParameter("password"); HttpSession session = req.getSession(true); if (authUser(userid, password)) { session.setAttribute("authNMsg", "authenticated"); session.setAttribute("userid", userid); String target = (String) session.getAttribute("target"); if (target == null) { res.sendRedirect("/admins/main"); } else { session.removeAttribute("target"); res.sendRedirect(target); } return null; } else { session.setAttribute("authNMsg", msg.getMessage("msg.authentication.fail", null, locale)); } return doGet(mav, req, res, locale); } }
9238f26da4f5676cdec000910c063aa96f819be9
6,412
java
Java
interactive_engine/benchmark/src/main/java/com/alibaba/maxgraph/benchmark/InteractiveBenchmark.java
varinic/GraphScope
b8cb7c404ed38841d46bf2cd35d8fe3fa812bf21
[ "Apache-2.0" ]
1,521
2020-10-28T03:20:24.000Z
2022-03-31T12:42:51.000Z
interactive_engine/benchmark/src/main/java/com/alibaba/maxgraph/benchmark/InteractiveBenchmark.java
varinic/GraphScope
b8cb7c404ed38841d46bf2cd35d8fe3fa812bf21
[ "Apache-2.0" ]
850
2020-12-15T03:17:32.000Z
2022-03-31T11:40:13.000Z
interactive_engine/benchmark/src/main/java/com/alibaba/maxgraph/benchmark/InteractiveBenchmark.java
varinic/GraphScope
b8cb7c404ed38841d46bf2cd35d8fe3fa812bf21
[ "Apache-2.0" ]
180
2020-11-10T03:43:21.000Z
2022-03-28T11:13:31.000Z
46.463768
122
0.628197
998,644
/** * Copyright 2020 Alibaba Group Holding Limited. * * 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.alibaba.maxgraph.benchmark; import com.alibaba.maxgraph.common.Configuration; import com.alibaba.maxgraph.common.LdbcQuery; import com.alibaba.maxgraph.io.MaxGraphIORegistry; import com.alibaba.maxgraph.utils.PropertyUtil; import com.alibaba.maxgraph.utils.QueryUtil; import org.apache.commons.lang3.StringUtils; import org.apache.tinkerpop.gremlin.driver.Client; import org.apache.tinkerpop.gremlin.driver.Cluster; import org.apache.tinkerpop.gremlin.driver.MessageSerializer; import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0; import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; public class InteractiveBenchmark { public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Error, Usage: <interactive-benchmark.properties>"); return; } Properties properties = PropertyUtil.getProperties(args[0], false); Configuration configuration = new Configuration(properties); String gremlinServerEndpoint = configuration.getString(Configuration.GREMLIN_SERVER_ENDPOINT); int threadCount = configuration.getInt(Configuration.THREAD_COUNT, 1); int warmUpCount = configuration.getInt(Configuration.WARMUP_EVERY_QUERY, 0); int operationCount = configuration.getInt(Configuration.OPERATION_COUNT_EVERY_QUERY, 10); boolean printQueryName = configuration.getBoolean(Configuration.PRINT_QUERY_NAME, true); boolean printQueryResult = configuration.getBoolean(Configuration.PRINT_QUERY_RESULT, true); String username = configuration.getString(Configuration.GREMLIN_USERNAME, ""); String password = configuration.getString(Configuration.GREMLIN_PASSWORD, ""); List<LdbcQuery> ldbcQueryList = QueryUtil.initQueryList(configuration); AtomicInteger atomicQueryCount = new AtomicInteger(operationCount * threadCount); AtomicInteger atomicParameterIndex = new AtomicInteger(0); class MyRunnable implements Runnable { private Client client; public MyRunnable(String endpoint, String username, String password) { String[] address = endpoint.split(":"); try { Cluster.Builder cluster = Cluster.build() .addContactPoint(address[0]) .port(Integer.parseInt(address[1])) .serializer(initializeSerialize()); if (StringUtils.isNotEmpty(username) && StringUtils.isNotEmpty(password)) { cluster.credentials(username, password); } client = cluster.create().connect(); System.out.println("Connect success."); } catch (Exception e) { System.err.println("Connect failure, caused by : " + e); throw new RuntimeException(e); } } @Override public void run() { for(int index = 0; index < warmUpCount; index++) { System.out.println("Begin Warm up ...."); LdbcQuery ldbcQuery = ldbcQueryList.get(index % ldbcQueryList.size()); HashMap<String, String> queryParameter = ldbcQuery.getSingleParameter(index); ldbcQuery.processGremlinQuery(client, queryParameter, printQueryResult, printQueryName); } System.out.println("Begin standard test..."); while (true) { int currentValue = atomicQueryCount.getAndDecrement(); if(currentValue > 0) { int queryIndex = currentValue % ldbcQueryList.size(); LdbcQuery ldbcQuery = ldbcQueryList.get(queryIndex % ldbcQueryList.size()); int parameterIndex = 0; if(queryIndex == 0) { parameterIndex = atomicParameterIndex.getAndIncrement(); } else { parameterIndex = atomicParameterIndex.get(); } HashMap<String, String> queryParameter = ldbcQuery.getSingleParameter(parameterIndex); ldbcQuery.processGremlinQuery(client, queryParameter, printQueryResult, printQueryName); } else { break; } } client.close(); } } ExecutorService threadPool = Executors.newFixedThreadPool(threadCount); long startTime = System.currentTimeMillis(); for(int i = 0; i < threadCount; i++) { threadPool.submit(new MyRunnable(gremlinServerEndpoint, username, password)); } threadPool.shutdown(); while(true) { if(threadPool.isTerminated()) { long endTime = System.currentTimeMillis(); long executeTime = endTime - startTime; long queryCount = operationCount * threadCount; float qps = (float) queryCount / executeTime * 1000; System.out.println("query count: " + queryCount + "; execute time(ms): " + executeTime + "; qps: " + qps); System.exit(0); } Thread.sleep(10); } } private static MessageSerializer initializeSerialize() { GryoMapper.Builder kryo = GryoMapper.build().addRegistry(MaxGraphIORegistry.getInstance()); return new GryoMessageSerializerV1d0(kryo); } }
9238f2ae90dab482b9980bde00146f1360bdf004
1,674
java
Java
modules/base/injecting/injecting-pico-impl/src/main/java/consulo/injecting/pico/ProvideComponentAdapter.java
MC-JY/consulo
ebd31008fcfd03e144b46a9408d2842d0b06ffc8
[ "Apache-2.0" ]
634
2015-01-01T19:14:25.000Z
2022-03-22T11:42:50.000Z
modules/base/injecting/injecting-pico-impl/src/main/java/consulo/injecting/pico/ProvideComponentAdapter.java
MC-JY/consulo
ebd31008fcfd03e144b46a9408d2842d0b06ffc8
[ "Apache-2.0" ]
410
2015-01-19T09:57:51.000Z
2022-03-22T16:24:59.000Z
modules/base/injecting/injecting-pico-impl/src/main/java/consulo/injecting/pico/ProvideComponentAdapter.java
MC-JY/consulo
ebd31008fcfd03e144b46a9408d2842d0b06ffc8
[ "Apache-2.0" ]
50
2015-03-10T04:14:49.000Z
2022-03-22T07:08:45.000Z
29.368421
137
0.749104
998,645
/* * Copyright 2013-2018 consulo.io * * 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 consulo.injecting.pico; import consulo.injecting.key.InjectingKey; import jakarta.inject.Provider; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * @author VISTALL * @since 2018-08-24 */ class ProvideComponentAdapter<T> implements ComponentAdapter<T> { private final InjectingKey<T> myInterfaceKey; private final Provider<T> myValue; public ProvideComponentAdapter(InjectingKey<T> interfaceKey, Provider<T> value) { myInterfaceKey = interfaceKey; myValue = value; } @Override public String getComponentKey() { return myInterfaceKey.getTargetClassName(); } @Override @SuppressWarnings("unchecked") public Class<T> getComponentImplementation() { return (Class<T>)myValue.get().getClass(); } @Override public T getComponentInstance(@Nonnull DefaultPicoContainer container) throws PicoInitializationException, PicoIntrospectionException { return myValue.get(); } @Override public String toString() { return "ProvideComponentAdapter[" + myInterfaceKey.getTargetClassName() + "]"; } }
9238f2bbc7daab566636d3073892a2572790a1e8
2,036
java
Java
brouter-routing-app/src/main/java/btools/routingapp/CoordinateReaderLocus.java
Inpatics/brouter
bbb79600e17b2f5db060dfdc3fb399988ed559c2
[ "MIT" ]
272
2015-01-06T12:06:57.000Z
2022-03-29T18:57:54.000Z
brouter-routing-app/src/main/java/btools/routingapp/CoordinateReaderLocus.java
Inpatics/brouter
bbb79600e17b2f5db060dfdc3fb399988ed559c2
[ "MIT" ]
304
2015-02-01T20:42:50.000Z
2022-03-31T17:25:19.000Z
brouter-routing-app/src/main/java/btools/routingapp/CoordinateReaderLocus.java
Inpatics/brouter
bbb79600e17b2f5db060dfdc3fb399988ed559c2
[ "MIT" ]
105
2015-01-21T15:55:27.000Z
2022-03-30T02:06:53.000Z
27.146667
148
0.64833
998,646
package btools.routingapp; import java.io.File; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import btools.router.OsmNodeNamed; /** * Read coordinates from a gpx-file */ public class CoordinateReaderLocus extends CoordinateReader { public CoordinateReaderLocus( String basedir ) { super( basedir ); tracksdir = "/Locus/mapItems"; rootdir = "/Locus"; } @Override public long getTimeStamp() throws Exception { File f = new File( basedir + "/Locus/data/database/waypoints.db" ); long t1 = f.lastModified(); // Android 10 delivers file size but can't read it boolean canRead = f.canRead(); return canRead ? t1 : 0L; } @Override public int getTurnInstructionMode() { return 2; // locus style } /* * read the from and to position from a ggx-file * (with hardcoded name for now) */ @Override public void readPointmap() throws Exception { _readPointmap( basedir + "/Locus/data/database/waypoints.db" ); } private void _readPointmap( String filename ) throws Exception { SQLiteDatabase myDataBase = null; try { myDataBase = SQLiteDatabase.openDatabase( filename, null, SQLiteDatabase.OPEN_READONLY); } catch (Exception e) { // not open, do not produce an error return; } Cursor c = myDataBase.rawQuery("SELECT c.name, w.name, w.longitude, w.latitude FROM waypoints w, categories c where w.parent_id = c._id", null); if (c.getCount() == 0) { c.close(); c = myDataBase.rawQuery("SELECT c.name, w.name, w.longitude, w.latitude FROM waypoints w, groups c where w.parent_id = c._id;", null ); } while (c.moveToNext()) { OsmNodeNamed n = new OsmNodeNamed(); String category = c.getString(0); n.name = c.getString(1); n.ilon = (int)( ( c.getDouble(2) + 180. )*1000000. + 0.5); n.ilat = (int)( ( c.getDouble(3) + 90. )*1000000. + 0.5); checkAddPoint( category, n ); } c.close(); myDataBase.close(); } }
9238f4541c1b7a816f9024697e9acd1553a030df
1,536
java
Java
src/main/java/com/microsoft/graph/requests/extensions/DirectoryObjectGetMemberObjectsCollectionRequestBuilder.java
winsonrich/msgraph-sdk-java
e513cd2d6481ed65d40562af7a892d6e0fd27ba0
[ "MIT" ]
1
2018-10-30T03:59:21.000Z
2018-10-30T03:59:21.000Z
src/main/java/com/microsoft/graph/requests/extensions/DirectoryObjectGetMemberObjectsCollectionRequestBuilder.java
winsonrich/msgraph-sdk-java
e513cd2d6481ed65d40562af7a892d6e0fd27ba0
[ "MIT" ]
null
null
null
src/main/java/com/microsoft/graph/requests/extensions/DirectoryObjectGetMemberObjectsCollectionRequestBuilder.java
winsonrich/msgraph-sdk-java
e513cd2d6481ed65d40562af7a892d6e0fd27ba0
[ "MIT" ]
null
null
null
51.2
209
0.712891
998,647
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.extensions; import com.microsoft.graph.core.IBaseClient; import com.microsoft.graph.options.Option; import com.microsoft.graph.requests.generated.BaseDirectoryObjectGetMemberObjectsCollectionRequestBuilder; // This file is available for extending, afterwards please submit a pull request. /** * The class for the Directory Object Get Member Objects Collection Request Builder. */ public class DirectoryObjectGetMemberObjectsCollectionRequestBuilder extends BaseDirectoryObjectGetMemberObjectsCollectionRequestBuilder implements IDirectoryObjectGetMemberObjectsCollectionRequestBuilder { /** * The request builder for this collection of DirectoryObject * * @param requestUrl the request URL * @param client the service client * @param requestOptions the options for this request * @param securityEnabledOnly the securityEnabledOnly */ public DirectoryObjectGetMemberObjectsCollectionRequestBuilder(final String requestUrl, final IBaseClient client, final java.util.List<? extends Option> requestOptions, final Boolean securityEnabledOnly) { super(requestUrl, client, requestOptions, securityEnabledOnly); } }
9238f67700101f12ca6e446ebf7a6ecb8685baba
1,182
java
Java
Sem1/Week 8/TaskTwo/Main.java
Angeliza-Medina/ThursdayTasks
db42558fcf00df4c71cc28e1b0b779637a878038
[ "MIT" ]
null
null
null
Sem1/Week 8/TaskTwo/Main.java
Angeliza-Medina/ThursdayTasks
db42558fcf00df4c71cc28e1b0b779637a878038
[ "MIT" ]
null
null
null
Sem1/Week 8/TaskTwo/Main.java
Angeliza-Medina/ThursdayTasks
db42558fcf00df4c71cc28e1b0b779637a878038
[ "MIT" ]
null
null
null
22.730769
108
0.680203
998,648
class Main{ public static boolean happy = true; public static void main(String[] args){ if (iAmHappy()){ System.out.println("I clap my hands"); }else{ System.out.println("I don't clap my hands"); } int sum = addTwoInt(2, 5); System.out.println(sum); String stringInUppercase = returnStringInUppercase("I turned this string into uppercase!"); System.out.println(stringInUppercase); boolean checkedFirstLetter = isFirstLetterUppercase("The first letter in this string is in uppercase."); System.out.println(checkedFirstLetter); } public static boolean iAmHappy(){ // fill out what is missing here: if(happy == true){ return true; } return false; } public static int addTwoInt(int int1, int int2){ int sum = int1 + int2; return sum; } public static String returnStringInUppercase(String yourString){ return yourString.toUpperCase(); } public static boolean isFirstLetterUppercase(String stringToBeChecked){ boolean checkedFirstChar = Character.isUpperCase(stringToBeChecked.charAt(0)); if(checkedFirstChar){ return true; } return false; } }
9238f7fff39b1e11f24623728272a50a179e606a
22,789
java
Java
onos-yang-tools/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangType.java
onekeynet/OConf
96d70ab96ea5826e3ab0ea69a3cd95c0b12ea805
[ "Apache-2.0" ]
1
2019-06-24T03:08:06.000Z
2019-06-24T03:08:06.000Z
onos-yang-tools/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangType.java
onekeynet/OConf
96d70ab96ea5826e3ab0ea69a3cd95c0b12ea805
[ "Apache-2.0" ]
1
2019-05-11T22:12:52.000Z
2019-05-11T23:59:22.000Z
onos-yang-tools/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangType.java
onekeynet/OConf
96d70ab96ea5826e3ab0ea69a3cd95c0b12ea805
[ "Apache-2.0" ]
null
null
null
39.633043
120
0.544868
998,649
/* * Copyright 2016-present Open Networking Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.yang.compiler.datamodel; import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException; import org.onosproject.yang.compiler.datamodel.utils.DataModelUtils; import org.onosproject.yang.compiler.datamodel.utils.Parsable; import org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus; import org.onosproject.yang.compiler.datamodel.utils.YangConstructType; import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.DataTypeException; import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes; import org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangUint64; import com.google.common.base.MoreObjects; import java.io.Serializable; import java.math.BigInteger; import java.util.Iterator; import java.util.ListIterator; import static org.onosproject.yang.compiler.datamodel.BuiltInTypeObjectFactory.getDataObjectFromString; import static org.onosproject.yang.compiler.datamodel.utils.ResolvableStatus.UNRESOLVED; import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.TYPE_DATA; import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypeUtils.isOfRangeRestrictedType; import static org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes.DERIVED; /* * Reference:RFC 6020. * The "type" statement takes as an argument a string that is the name * of a YANG built-in type or a derived type, followed by an optional * block of sub-statements that are used to put further restrictions * on the type. * * The restrictions that can be applied depend on the type being restricted. * The type's sub-statements * * +------------------+---------+-------------+------------------------------------+ * | substatement | section | cardinality | mapped data type | * +------------------+---------+-------------+------------------------------------+ * | bit | 9.7.4 | 0..n | - YangBit used in YangBits | * | enum | 9.6.4 | 0..n | - YangEnum used in YangEnumeration | * | length | 9.4.4 | 0..1 | - used for string | * | path | 9.9.2 | 0..1 | - path for referred leaf/leaf-list | * | pattern | 9.4.6 | 0..n | - used for string | * | range | 9.2.4 | 0..1 | - used for integer data type | * | require-instance | 9.13.2 | 0..1 | - TODO instance-identifier | * | type | 7.4 | 0..n | - TODO union | * +------------------+---------+-------------+------------------------------------+ */ /** * Represents the data type information. * * @param <T> YANG data type info */ public class YangType<T> extends DefaultLocationInfo implements Cloneable, Parsable, Resolvable, Serializable { private static final long serialVersionUID = 8062016054L; /** * YANG node identifier. */ private YangNodeIdentifier nodeId; /** * YANG data type. */ private YangDataTypes dataType; /** * Additional information about data type, example restriction info, named * values, etc. The extra information is based on the data type. Based on * the data type, the extended info can vary. */ private T dataTypeExtendedInfo; /** * Status of resolution. If completely resolved enum value is "RESOLVED", * if not enum value is "UNRESOLVED", in case reference of grouping/typedef * is added to uses/type but it's not resolved value of enum should be * "INTRA_FILE_RESOLVED". */ private ResolvableStatus resolvableStatus; /** * Resolution for interfile grouping. */ private boolean isTypeForInterFileGroupingResolution; /** * Resolved within the grouping where the type is used. */ private boolean isTypeNotResolvedTillRootNode; /** * Creates a YANG type object. */ public YangType() { nodeId = new YangNodeIdentifier(); resolvableStatus = UNRESOLVED; } /** * Returns prefix associated with data type name. * * @return prefix associated with data type name */ public String getPrefix() { return nodeId.getPrefix(); } /** * Sets prefix associated with data type name. * * @param prefix prefix associated with data type name */ public void setPrefix(String prefix) { nodeId.setPrefix(prefix); } /** * Returns the name of data type. * * @return the name of data type */ public String getDataTypeName() { return nodeId.getName(); } /** * Sets the name of the data type. * * @param typeName the name to set */ public void setDataTypeName(String typeName) { nodeId.setName(typeName); } /** * Returns the type of data. * * @return the data type */ public YangDataTypes getDataType() { return dataType; } /** * Sets the type of data. * * @param dataType data type */ public void setDataType(YangDataTypes dataType) { this.dataType = dataType; } /** * Returns the data type meta data. * * @return the data type meta data */ public T getDataTypeExtendedInfo() { return dataTypeExtendedInfo; } /** * Sets the data type meta data. * * @param dataTypeInfo the meta data to set */ public void setDataTypeExtendedInfo(T dataTypeInfo) { this.dataTypeExtendedInfo = dataTypeInfo; } /** * Returns node identifier. * * @return node identifier */ public YangNodeIdentifier getNodeId() { return nodeId; } /** * Sets node identifier. * * @param nodeId the node identifier */ public void setNodeId(YangNodeIdentifier nodeId) { this.nodeId = nodeId; } /** * Resets the class attributes to its default value. */ public void resetYangType() { nodeId = new YangNodeIdentifier(); resolvableStatus = UNRESOLVED; dataType = null; dataTypeExtendedInfo = null; } /** * Returns the type of the parsed data. * * @return returns TYPE_DATA */ @Override public YangConstructType getYangConstructType() { return TYPE_DATA; } /** * Validates the data on entering the corresponding parse tree node. * * @throws DataModelException a violation of data model rules */ @Override public void validateDataOnEntry() throws DataModelException { // TODO auto-generated method stub, to be implemented by parser } /** * Validates the data on exiting the corresponding parse tree node. * * @throws DataModelException a violation of data model rules */ @Override public void validateDataOnExit() throws DataModelException { // TODO auto-generated method stub, to be implemented by parser } @Override public ResolvableStatus getResolvableStatus() { return resolvableStatus; } @Override public void setResolvableStatus(ResolvableStatus resolvableStatus) { this.resolvableStatus = resolvableStatus; } @Override public Object resolve() throws DataModelException { /* * Check whether the data type is derived. */ if (getDataType() != DERIVED) { throw new DataModelException("Linker Error: Resolve should only be called for derived data types. " + " in " + getLineNumber() + " at " + getCharPosition() + " in " + getFileName() + "\""); } // Check if the derived info is present. YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) getDataTypeExtendedInfo(); if (derivedInfo == null) { throw new DataModelException("Linker Error: Derived information is missing. " + " in " + getLineNumber() + " at " + getCharPosition() + " in " + getFileName() + "\""); } // Initiate the resolution try { setResolvableStatus(derivedInfo.resolve()); } catch (DataModelException e) { throw new DataModelException(e.getMessage()); } return null; } /** * Validates the input data value against the permissible value for the * type as per the YANG file. * * @param value input data value * @throws DataModelException a violation of data model rules */ public void isValidValue(String value) throws DataModelException { switch (getDataType()) { case INT8: case INT16: case INT32: case INT64: case UINT8: case UINT16: case UINT32: case UINT64: { if (getDataTypeExtendedInfo() == null) { getDataObjectFromString(value, getDataType()); } else { if (!((YangRangeRestriction) getDataTypeExtendedInfo()).isValidValueString(value)) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } } break; } case DECIMAL64: { // Fraction-Digits and range needs to get it from yang YangDecimal64<YangRangeRestriction> decimal64 = (YangDecimal64<YangRangeRestriction>) getDataTypeExtendedInfo(); validateDecimal64(value, decimal64.getFractionDigit(), decimal64.getRangeRestrictedExtendedInfo()); break; } case STRING: { if (getDataTypeExtendedInfo() == null) { break; } else if (!(((YangStringRestriction) getDataTypeExtendedInfo()).isValidStringOnLengthRestriction(value) && ((YangStringRestriction) getDataTypeExtendedInfo()) .isValidStringOnPatternRestriction(value))) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } break; } case BOOLEAN: if (!(value.equals(DataModelUtils.TRUE) || value.equals(DataModelUtils.FALSE))) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } break; case ENUMERATION: { Iterator<YangEnum> iterator = ((YangEnumeration) getDataTypeExtendedInfo()).getEnumSet().iterator(); boolean isValidated = false; while (iterator.hasNext()) { YangEnum enumTemp = iterator.next(); if (enumTemp.getNamedValue().equals(value)) { isValidated = true; break; } } if (!isValidated) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } break; } case BITS: { YangBits bits = (YangBits) getDataTypeExtendedInfo(); if (bits.fromString(value) == null) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } break; } case BINARY: { if (!isValidBinary(value, (YangRangeRestriction) getDataTypeExtendedInfo())) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } break; } case LEAFREF: { YangLeafRef<?> leafRef = (YangLeafRef<?>) getDataTypeExtendedInfo(); leafRef.validateDataOnExit(); break; } case IDENTITYREF: { // TODO TBD break; } case EMPTY: { // In case of xml empty value can come as null but in case of // json and all it will come as "" if (value != null && value.length() > 0) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not allowed for a data type " + getDataType()); } break; } case UNION: { ListIterator<YangType<?>> listIterator = ((YangUnion) getDataTypeExtendedInfo()).getTypeList() .listIterator(); boolean isValidated = false; while (listIterator.hasNext()) { YangType<?> type = listIterator.next(); try { type.isValidValue(value); // If it is not thrown exception then validation is success isValidated = true; break; } catch (Exception e) { } } if (!isValidated) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + getDataType()); } break; } case INSTANCE_IDENTIFIER: { // TODO TBD break; } case DERIVED: { YangDataTypes dataType = ((YangDerivedInfo) getDataTypeExtendedInfo()).getEffectiveBuiltInType(); if (isOfRangeRestrictedType(dataType)) { if (((YangDerivedInfo) getDataTypeExtendedInfo()).getResolvedExtendedInfo() == null) { getDataObjectFromString(value, ((YangDerivedInfo) getDataTypeExtendedInfo()) .getEffectiveBuiltInType()); } else { if (!((YangRangeRestriction) ((YangDerivedInfo) getDataTypeExtendedInfo()) .getResolvedExtendedInfo()).isValidValueString(value)) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + dataType); } } } else if (dataType == YangDataTypes.STRING) { Object info = ((YangDerivedInfo) getDataTypeExtendedInfo()) .getResolvedExtendedInfo(); if (info != null) { if (info instanceof YangStringRestriction) { YangStringRestriction stringRestriction = (YangStringRestriction) info; if (!(stringRestriction.isValidStringOnLengthRestriction(value) && stringRestriction.isValidStringOnPatternRestriction(value))) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + dataType); } } } } else if (dataType == YangDataTypes.BITS) { YangTypeDef prevTypedef = ((YangDerivedInfo) getDataTypeExtendedInfo()) .getReferredTypeDef(); YangType type = prevTypedef.getTypeList().iterator().next(); YangBits bits = (YangBits) type.getDataTypeExtendedInfo(); if (bits.fromString(value) == null) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + dataType); } } else if (dataType == YangDataTypes.BINARY) { if (!isValidBinary(value, (YangRangeRestriction) ((YangDerivedInfo) getDataTypeExtendedInfo()).getResolvedExtendedInfo())) { throw new DataTypeException("YANG file error : Input value \"" + value + "\" is not a valid " + dataType); } } else if (dataType == YangDataTypes.DECIMAL64) { YangDerivedInfo derivedInfo = (YangDerivedInfo) getDataTypeExtendedInfo(); YangTypeDef typedef = derivedInfo.getReferredTypeDef(); YangType<YangDecimal64> decimal64Type = (YangType<YangDecimal64>) typedef.getTypeList().iterator().next(); YangDecimal64<YangRangeRestriction> decimal64 = decimal64Type.getDataTypeExtendedInfo(); // Fraction-Digits and range needs to get it from yang validateDecimal64(value, decimal64.getFractionDigit(), decimal64.getRangeRestrictedExtendedInfo()); } break; } default: { throw new DataTypeException("YANG file error : Input value \"" + value + "\" received for " + "unsupported data type " + getDataType()); } } } /** * Checks whether specific string is valid decimal64 value. * * @param value decimal64 value */ private void validateDecimal64(String value, int fractionDigit, YangRangeRestriction rangeRestriction) throws DataModelException { YangDecimal64<YangRangeRestriction> decimal64 = YangDecimal64.fromString(value); decimal64.setFractionDigit(fractionDigit); decimal64.setRangeRestrictedExtendedInfo(rangeRestriction); decimal64.validateDecimal64(); } /** * Checks whether specific string is valid binary. * * @param value binary value * @return true if validation success otherwise false */ private boolean isValidBinary(String value, YangRangeRestriction lengthRestriction) { YangBinary binary = new YangBinary(value); // After decoding binary, its length should not be zero if (binary.getBinaryData().length == 0) { return false; } if (lengthRestriction == null || lengthRestriction.getAscendingRangeIntervals() == null || lengthRestriction.getAscendingRangeIntervals().isEmpty()) { // Length restriction is optional return true; } ListIterator<YangRangeInterval<YangUint64>> rangeListIterator = lengthRestriction.getAscendingRangeIntervals() .listIterator(); boolean isMatched = false; while (rangeListIterator.hasNext()) { YangRangeInterval rangeInterval = rangeListIterator.next(); rangeInterval.setFileName(getFileName()); rangeInterval.setLineNumber(getLineNumber()); rangeInterval.setCharPosition(getCharPosition()); BigInteger startValue = ((YangUint64) rangeInterval.getStartValue()).getValue(); BigInteger endValue = ((YangUint64) rangeInterval.getEndValue()).getValue(); // convert (encode) back and check length if ((binary.toString().length() >= startValue.intValue()) && (binary.toString().length() <= endValue.intValue())) { isMatched = true; break; } } return isMatched; } public boolean isTypeForInterFileGroupingResolution() { return isTypeForInterFileGroupingResolution; } public void setTypeForInterFileGroupingResolution(boolean typeForInterFileGroupingResolution) { isTypeForInterFileGroupingResolution = typeForInterFileGroupingResolution; } public boolean isTypeNotResolvedTillRootNode() { return isTypeNotResolvedTillRootNode; } public void setTypeNotResolvedTillRootNode(boolean typeNotResolvedTillRootNode) { isTypeNotResolvedTillRootNode = typeNotResolvedTillRootNode; } @Override public YangType<T> clone() throws CloneNotSupportedException { YangType<T> clonedNode = (YangType<T>) super.clone(); return clonedNode; } @Override public String toString() { return MoreObjects.toStringHelper(this) .omitNullValues() .add("nodeId", nodeId) .add("dataType", dataType) .add("dataTypeExtendedInfo", dataTypeExtendedInfo) .add("resolvableStatus", resolvableStatus) .add("isTypeForInterFileGroupingResolution", isTypeForInterFileGroupingResolution) .add("isTypeNotResolvedTillRootNode", isTypeNotResolvedTillRootNode) .toString(); } }
9238f83b864abb1f3be93ae7d70b715aaa49c63e
1,485
java
Java
portfolio/src/main/java/com/google/sps/servlets/ClearServlet.java
officialcwang/step
85053e21b1f8f58a29d3f4aef1897de65ff38f3a
[ "Apache-2.0" ]
1
2020-05-29T17:51:36.000Z
2020-05-29T17:51:36.000Z
portfolio/src/main/java/com/google/sps/servlets/ClearServlet.java
officialcwang/step
85053e21b1f8f58a29d3f4aef1897de65ff38f3a
[ "Apache-2.0" ]
1
2020-06-03T03:25:31.000Z
2020-06-03T03:25:31.000Z
portfolio/src/main/java/com/google/sps/servlets/ClearServlet.java
officialcwang/step
85053e21b1f8f58a29d3f4aef1897de65ff38f3a
[ "Apache-2.0" ]
null
null
null
34.534884
99
0.782492
998,650
package com.google.sps.servlets; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api.datastore.DatastoreServiceFactory; import com.google.appengine.api.datastore.Entity; import com.google.appengine.api.datastore.PreparedQuery; import com.google.appengine.api.datastore.Query; import com.google.appengine.api.datastore.Query.SortDirection; import com.google.gson.Gson; import com.google.sps.data.Constants; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Optional; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** Servlet that deletes comments. */ @WebServlet("/delete-data") public class ClearServlet extends HttpServlet { /** * Clear the comments. */ @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { Query query = new Query(Constants.COMMENT_KIND); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); PreparedQuery results = datastore.prepare(query); for (Entity entity : results.asIterable()) { datastore.delete(entity.getKey()); } // Redirect back to the proper container. response.setContentType("text/html;"); response.getWriter().println(); response.sendRedirect("/professional.html"); } }
9238f884c6b1f06ec28da937bf816932d267a2a6
1,829
java
Java
src/test/java/FirstTest.java
Manviksagar/DockerSele
78ba03eaa36ff045023a0665f9697c4e819025e9
[ "MIT" ]
null
null
null
src/test/java/FirstTest.java
Manviksagar/DockerSele
78ba03eaa36ff045023a0665f9697c4e819025e9
[ "MIT" ]
null
null
null
src/test/java/FirstTest.java
Manviksagar/DockerSele
78ba03eaa36ff045023a0665f9697c4e819025e9
[ "MIT" ]
null
null
null
33.254545
106
0.498633
998,651
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; /***************************************************************************** * Author: Onur Baskirt * Description: This is the first Selenium TestNG test. * It opens swtestacademy homepage and prints and checks its title. *******************************************************************************/ public class FirstTest { //-----------------------------------Global Variables----------------------------------- //Declare a Webdriver variable public WebDriver driver; //Declare a test URL variable public String testURL = "https://www.google.com"; //-----------------------------------Test Setup----------------------------------- @BeforeMethod public void setupTest (){ //Create a new ChromeDriver System.setProperty("webdriver.chrome.driver", "C:\\Users\\Va185060\\Desktop\\sag\\chromedriver.exe"); driver = new ChromeDriver(); //Go to www.swtestacademy.com driver.navigate().to(testURL); } //-----------------------------------Tests----------------------------------- @Test public void firstTest () { //Get page title String title = driver.getTitle(); //Print page's title System.out.println("Page Title: " + title); //Assertion Assert.assertEquals(title, "Google", "Title assertion is failed!"); } //-----------------------------------Test TearDown----------------------------------- @AfterMethod public void teardownTest (){ //Close browser and end the session driver.quit(); } }
9238f907e779976917a832c435dbf64bb08d3efe
357
java
Java
Solutions/backkomLsh/GameShop/src/ItemTest.java
pravin1237/ProgrammingPractice
bc15181d5c692ae99b64fdae0ef284b948b20c80
[ "MIT" ]
32
2017-05-17T04:05:31.000Z
2021-02-16T07:40:22.000Z
Solutions/backkomLsh/GameShop/src/ItemTest.java
pravin1237/ProgrammingPractice
bc15181d5c692ae99b64fdae0ef284b948b20c80
[ "MIT" ]
17
2017-05-21T13:35:45.000Z
2017-06-20T00:20:39.000Z
Solutions/backkomLsh/GameShop/src/ItemTest.java
pravin1237/ProgrammingPractice
bc15181d5c692ae99b64fdae0ef284b948b20c80
[ "MIT" ]
35
2017-05-25T06:26:47.000Z
2020-10-02T13:49:02.000Z
23.8
88
0.602241
998,652
/** * Created by Administrator on 2017-05-22. */ public class ItemTest { public static void main(String args[]) { Item i1 = new Item("Excalibur", "The legendary sword of King Arthur", 12, 1024); Item i2 = new Item("Steel Armor", "Protective covering made by steel", 15, 805); i1.describe(); i2.describe(); } }
9238f928087158b541db47b3fe4b6ad46d5f834e
6,063
java
Java
clients/google-api-services-dataflow/v1b3/1.31.0/com/google/api/services/dataflow/model/InstructionOutput.java
yoshi-code-bot/google-api-java-client-services
9f5e3b6073c822db4078d638c980b11a0effc686
[ "Apache-2.0" ]
372
2018-09-05T21:06:51.000Z
2022-03-31T09:22:03.000Z
clients/google-api-services-dataflow/v1b3/1.31.0/com/google/api/services/dataflow/model/InstructionOutput.java
yoshi-code-bot/google-api-java-client-services
9f5e3b6073c822db4078d638c980b11a0effc686
[ "Apache-2.0" ]
1,351
2018-10-12T23:07:12.000Z
2022-03-05T09:25:29.000Z
clients/google-api-services-dataflow/v1b3/1.31.0/com/google/api/services/dataflow/model/InstructionOutput.java
yoshi-code-bot/google-api-java-client-services
9f5e3b6073c822db4078d638c980b11a0effc686
[ "Apache-2.0" ]
307
2018-09-04T20:15:31.000Z
2022-03-31T09:42:39.000Z
30.933673
182
0.705261
998,653
/* * 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. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.dataflow.model; /** * An output of an instruction. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Dataflow API. For a detailed explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class InstructionOutput extends com.google.api.client.json.GenericJson { /** * The codec to use to encode data being written via this output. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.Map<String, java.lang.Object> codec; /** * The user-provided name of this output. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String name; /** * For system-generated byte and mean byte metrics, certain instructions should only report the * key size. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.Boolean onlyCountKeyBytes; /** * For system-generated byte and mean byte metrics, certain instructions should only report the * value size. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.Boolean onlyCountValueBytes; /** * System-defined name for this output in the original workflow graph. Outputs that do not * contribute to an original instruction do not set this. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String originalName; /** * System-defined name of this output. Unique across the workflow. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String systemName; /** * The codec to use to encode data being written via this output. * @return value or {@code null} for none */ public java.util.Map<String, java.lang.Object> getCodec() { return codec; } /** * The codec to use to encode data being written via this output. * @param codec codec or {@code null} for none */ public InstructionOutput setCodec(java.util.Map<String, java.lang.Object> codec) { this.codec = codec; return this; } /** * The user-provided name of this output. * @return value or {@code null} for none */ public java.lang.String getName() { return name; } /** * The user-provided name of this output. * @param name name or {@code null} for none */ public InstructionOutput setName(java.lang.String name) { this.name = name; return this; } /** * For system-generated byte and mean byte metrics, certain instructions should only report the * key size. * @return value or {@code null} for none */ public java.lang.Boolean getOnlyCountKeyBytes() { return onlyCountKeyBytes; } /** * For system-generated byte and mean byte metrics, certain instructions should only report the * key size. * @param onlyCountKeyBytes onlyCountKeyBytes or {@code null} for none */ public InstructionOutput setOnlyCountKeyBytes(java.lang.Boolean onlyCountKeyBytes) { this.onlyCountKeyBytes = onlyCountKeyBytes; return this; } /** * For system-generated byte and mean byte metrics, certain instructions should only report the * value size. * @return value or {@code null} for none */ public java.lang.Boolean getOnlyCountValueBytes() { return onlyCountValueBytes; } /** * For system-generated byte and mean byte metrics, certain instructions should only report the * value size. * @param onlyCountValueBytes onlyCountValueBytes or {@code null} for none */ public InstructionOutput setOnlyCountValueBytes(java.lang.Boolean onlyCountValueBytes) { this.onlyCountValueBytes = onlyCountValueBytes; return this; } /** * System-defined name for this output in the original workflow graph. Outputs that do not * contribute to an original instruction do not set this. * @return value or {@code null} for none */ public java.lang.String getOriginalName() { return originalName; } /** * System-defined name for this output in the original workflow graph. Outputs that do not * contribute to an original instruction do not set this. * @param originalName originalName or {@code null} for none */ public InstructionOutput setOriginalName(java.lang.String originalName) { this.originalName = originalName; return this; } /** * System-defined name of this output. Unique across the workflow. * @return value or {@code null} for none */ public java.lang.String getSystemName() { return systemName; } /** * System-defined name of this output. Unique across the workflow. * @param systemName systemName or {@code null} for none */ public InstructionOutput setSystemName(java.lang.String systemName) { this.systemName = systemName; return this; } @Override public InstructionOutput set(String fieldName, Object value) { return (InstructionOutput) super.set(fieldName, value); } @Override public InstructionOutput clone() { return (InstructionOutput) super.clone(); } }
9238f9ef519aa0f32edcd10084f5d67f933dd307
23,133
java
Java
japiwznm/PnlWznmPrsList.java
mpsitech/wznm-WhizniumSBE
4911d561b28392d485c46e98fb915168d82b3824
[ "MIT" ]
3
2020-09-20T16:24:48.000Z
2021-12-01T19:44:51.000Z
japiwznm/PnlWznmPrsList.java
mpsitech/wznm-WhizniumSBE
4911d561b28392d485c46e98fb915168d82b3824
[ "MIT" ]
null
null
null
japiwznm/PnlWznmPrsList.java
mpsitech/wznm-WhizniumSBE
4911d561b28392d485c46e98fb915168d82b3824
[ "MIT" ]
null
null
null
29.282278
175
0.679808
998,654
/** * \file PnlWznmPrsList.java * Java API code for job PnlWznmPrsList * \copyright (C) 2018-2020 MPSI Technologies GmbH * \author Alexander Wirthmueller (auto-generation) * \date created: 5 Dec 2020 */ // IP header --- ABOVE package apiwznm; import java.util.*; import org.w3c.dom.*; import sbecore.*; public class PnlWznmPrsList { /** * VecVDo (full: VecVWznmPrsListDo) */ public static class VecVDo { public static final int BUTMINIMIZECLICK = 1; public static final int BUTREGULARIZECLICK = 2; public static final int BUTNEWCLICK = 3; public static final int BUTDELETECLICK = 4; public static final int BUTFILTERCLICK = 5; public static final int BUTREFRESHCLICK = 6; public static int getIx( String sref ) { String s = sref.toLowerCase(); if (s.equals("butminimizeclick")) return BUTMINIMIZECLICK; if (s.equals("butregularizeclick")) return BUTREGULARIZECLICK; if (s.equals("butnewclick")) return BUTNEWCLICK; if (s.equals("butdeleteclick")) return BUTDELETECLICK; if (s.equals("butfilterclick")) return BUTFILTERCLICK; if (s.equals("butrefreshclick")) return BUTREFRESHCLICK; return 0; }; public static String getSref( int ix ) { if (ix == BUTMINIMIZECLICK) return("ButMinimizeClick"); if (ix == BUTREGULARIZECLICK) return("ButRegularizeClick"); if (ix == BUTNEWCLICK) return("ButNewClick"); if (ix == BUTDELETECLICK) return("ButDeleteClick"); if (ix == BUTFILTERCLICK) return("ButFilterClick"); if (ix == BUTREFRESHCLICK) return("ButRefreshClick"); return ""; }; }; /** * ContIac (full: ContIacWznmPrsList) */ public class ContIac extends Block { public static final int NUMFTOS = 1; public ContIac( int numFTos ) { this.numFTos = numFTos; mask = new HashSet<Integer>(Arrays.asList(NUMFTOS)); }; public int numFTos; public boolean readXML( Document doc , String basexpath , boolean addbasetag ) { clear(); if (addbasetag) basexpath = Xmlio.checkUclcXPaths(doc, basexpath, "ContIacWznmPrsList"); String itemtag = "ContitemIacWznmPrsList"; if (Xmlio.checkXPath(doc, basexpath)) { numFTos = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Ci", "sref", "numFTos", mask, NUMFTOS); return true; }; return false; }; public void writeXML( Document doc , Element sup , String difftag , boolean shorttags ) { if (difftag.isEmpty()) difftag = "ContIacWznmPrsList"; String itemtag; if (shorttags) itemtag = "Ci"; else itemtag = "ContitemIacWznmPrsList"; Element el = doc.createElement(difftag); if (sup == null) doc.appendChild(el); else sup.appendChild(el); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "numFTos", numFTos); }; public HashSet<Integer> comm( ContIac comp ) { HashSet<Integer> items = new HashSet<Integer>(); if (numFTos == comp.numFTos) items.add(NUMFTOS); return(items); }; public HashSet<Integer> diff( ContIac comp ) { HashSet<Integer> commitems; HashSet<Integer> diffitems; commitems = comm(comp); diffitems = new HashSet<Integer>(Arrays.asList(NUMFTOS)); for (Integer ci: commitems) diffitems.remove(ci); return(diffitems); }; }; /** * ContInf (full: ContInfWznmPrsList) */ public class ContInf extends Block { public static final int BUTFILTERON = 1; public static final int NUMFCSIQST = 2; public ContInf( boolean ButFilterOn , int numFCsiQst ) { this.ButFilterOn = ButFilterOn; this.numFCsiQst = numFCsiQst; mask = new HashSet<Integer>(Arrays.asList(BUTFILTERON, NUMFCSIQST)); }; public boolean ButFilterOn; public int numFCsiQst; public boolean readXML( Document doc , String basexpath , boolean addbasetag ) { clear(); if (addbasetag) basexpath = Xmlio.checkUclcXPaths(doc, basexpath, "ContInfWznmPrsList"); String itemtag = "ContitemInfWznmPrsList"; if (Xmlio.checkXPath(doc, basexpath)) { ButFilterOn = Xmlio.extractBooleanAttrUclc(doc, basexpath, itemtag, "Ci", "sref", "ButFilterOn", mask, BUTFILTERON); numFCsiQst = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Ci", "sref", "numFCsiQst", mask, NUMFCSIQST); return true; }; return false; }; public HashSet<Integer> comm( ContInf comp ) { HashSet<Integer> items = new HashSet<Integer>(); if (ButFilterOn == comp.ButFilterOn) items.add(BUTFILTERON); if (numFCsiQst == comp.numFCsiQst) items.add(NUMFCSIQST); return(items); }; public HashSet<Integer> diff( ContInf comp ) { HashSet<Integer> commitems; HashSet<Integer> diffitems; commitems = comm(comp); diffitems = new HashSet<Integer>(Arrays.asList(BUTFILTERON, NUMFCSIQST)); for (Integer ci: commitems) diffitems.remove(ci); return(diffitems); }; }; /** * StatShr (full: StatShrWznmPrsList) */ public class StatShr extends Block { public static final int IXWZNMVEXPSTATE = 1; public static final int BUTDELETEACTIVE = 2; public StatShr( int ixWznmVExpstate , boolean ButDeleteActive ) { this.ixWznmVExpstate = ixWznmVExpstate; this.ButDeleteActive = ButDeleteActive; mask = new HashSet<Integer>(Arrays.asList(IXWZNMVEXPSTATE, BUTDELETEACTIVE)); }; public int ixWznmVExpstate; public boolean ButDeleteActive; public boolean readXML( Document doc , String basexpath , boolean addbasetag ) { String srefIxWznmVExpstate; clear(); if (addbasetag) basexpath = Xmlio.checkUclcXPaths(doc, basexpath, "StatShrWznmPrsList"); String itemtag = "StatitemShrWznmPrsList"; if (Xmlio.checkXPath(doc, basexpath)) { srefIxWznmVExpstate = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Si", "sref", "srefIxWznmVExpstate", mask, IXWZNMVEXPSTATE); ixWznmVExpstate = VecWznmVExpstate.getIx(srefIxWznmVExpstate); ButDeleteActive = Xmlio.extractBooleanAttrUclc(doc, basexpath, itemtag, "Si", "sref", "ButDeleteActive", mask, BUTDELETEACTIVE); return true; }; return false; }; public HashSet<Integer> comm( StatShr comp ) { HashSet<Integer> items = new HashSet<Integer>(); if (ixWznmVExpstate == comp.ixWznmVExpstate) items.add(IXWZNMVEXPSTATE); if (ButDeleteActive == comp.ButDeleteActive) items.add(BUTDELETEACTIVE); return(items); }; public HashSet<Integer> diff( StatShr comp ) { HashSet<Integer> commitems; HashSet<Integer> diffitems; commitems = comm(comp); diffitems = new HashSet<Integer>(Arrays.asList(IXWZNMVEXPSTATE, BUTDELETEACTIVE)); for (Integer ci: commitems) diffitems.remove(ci); return(diffitems); }; }; /** * StgIac (full: StgIacWznmPrsList) */ public class StgIac extends Block { public static final int TCOGRPWIDTH = 1; public static final int TCOOWNWIDTH = 2; public static final int TCOTITWIDTH = 3; public static final int TCOFNMWIDTH = 4; public static final int TCOLNMWIDTH = 5; public static final int TCOSEXWIDTH = 6; public static final int TCOTELWIDTH = 7; public static final int TCOEMLWIDTH = 8; public StgIac( int TcoGrpWidth , int TcoOwnWidth , int TcoTitWidth , int TcoFnmWidth , int TcoLnmWidth , int TcoSexWidth , int TcoTelWidth , int TcoEmlWidth ) { this.TcoGrpWidth = TcoGrpWidth; this.TcoOwnWidth = TcoOwnWidth; this.TcoTitWidth = TcoTitWidth; this.TcoFnmWidth = TcoFnmWidth; this.TcoLnmWidth = TcoLnmWidth; this.TcoSexWidth = TcoSexWidth; this.TcoTelWidth = TcoTelWidth; this.TcoEmlWidth = TcoEmlWidth; mask = new HashSet<Integer>(Arrays.asList(TCOGRPWIDTH, TCOOWNWIDTH, TCOTITWIDTH, TCOFNMWIDTH, TCOLNMWIDTH, TCOSEXWIDTH, TCOTELWIDTH, TCOEMLWIDTH)); }; public int TcoGrpWidth; public int TcoOwnWidth; public int TcoTitWidth; public int TcoFnmWidth; public int TcoLnmWidth; public int TcoSexWidth; public int TcoTelWidth; public int TcoEmlWidth; public boolean readXML( Document doc , String basexpath , boolean addbasetag ) { clear(); if (addbasetag) basexpath = Xmlio.checkUclcXPaths(doc, basexpath, "StgIacWznmPrsList"); String itemtag = "StgitemIacWznmPrsList"; if (Xmlio.checkXPath(doc, basexpath)) { TcoGrpWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoGrpWidth", mask, TCOGRPWIDTH); TcoOwnWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoOwnWidth", mask, TCOOWNWIDTH); TcoTitWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoTitWidth", mask, TCOTITWIDTH); TcoFnmWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoFnmWidth", mask, TCOFNMWIDTH); TcoLnmWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoLnmWidth", mask, TCOLNMWIDTH); TcoSexWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoSexWidth", mask, TCOSEXWIDTH); TcoTelWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoTelWidth", mask, TCOTELWIDTH); TcoEmlWidth = Xmlio.extractIntegerAttrUclc(doc, basexpath, itemtag, "Si", "sref", "TcoEmlWidth", mask, TCOEMLWIDTH); return true; }; return false; }; public void writeXML( Document doc , Element sup , String difftag , boolean shorttags ) { if (difftag.isEmpty()) difftag = "StgIacWznmPrsList"; String itemtag; if (shorttags) itemtag = "Si"; else itemtag = "StgitemIacWznmPrsList"; Element el = doc.createElement(difftag); if (sup == null) doc.appendChild(el); else sup.appendChild(el); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoGrpWidth", TcoGrpWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoOwnWidth", TcoOwnWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoTitWidth", TcoTitWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoFnmWidth", TcoFnmWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoLnmWidth", TcoLnmWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoSexWidth", TcoSexWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoTelWidth", TcoTelWidth); Xmlio.writeIntegerAttr(doc, el, itemtag, "sref", "TcoEmlWidth", TcoEmlWidth); }; public HashSet<Integer> comm( StgIac comp ) { HashSet<Integer> items = new HashSet<Integer>(); if (TcoGrpWidth == comp.TcoGrpWidth) items.add(TCOGRPWIDTH); if (TcoOwnWidth == comp.TcoOwnWidth) items.add(TCOOWNWIDTH); if (TcoTitWidth == comp.TcoTitWidth) items.add(TCOTITWIDTH); if (TcoFnmWidth == comp.TcoFnmWidth) items.add(TCOFNMWIDTH); if (TcoLnmWidth == comp.TcoLnmWidth) items.add(TCOLNMWIDTH); if (TcoSexWidth == comp.TcoSexWidth) items.add(TCOSEXWIDTH); if (TcoTelWidth == comp.TcoTelWidth) items.add(TCOTELWIDTH); if (TcoEmlWidth == comp.TcoEmlWidth) items.add(TCOEMLWIDTH); return(items); }; public HashSet<Integer> diff( StgIac comp ) { HashSet<Integer> commitems; HashSet<Integer> diffitems; commitems = comm(comp); diffitems = new HashSet<Integer>(Arrays.asList(TCOGRPWIDTH, TCOOWNWIDTH, TCOTITWIDTH, TCOFNMWIDTH, TCOLNMWIDTH, TCOSEXWIDTH, TCOTELWIDTH, TCOEMLWIDTH)); for (Integer ci: commitems) diffitems.remove(ci); return(diffitems); }; }; /** * Tag (full: TagWznmPrsList) */ public class Tag extends Block { public static final int CPT = 1; public static final int TXTRECORD1 = 2; public static final int TXTRECORD2 = 3; public static final int TRS = 4; public static final int TXTSHOWING1 = 5; public static final int TXTSHOWING2 = 6; public static final int TCOGRP = 7; public static final int TCOOWN = 8; public static final int TCOTIT = 9; public static final int TCOFNM = 10; public static final int TCOLNM = 11; public static final int TCOSEX = 12; public static final int TCOTEL = 13; public static final int TCOEML = 14; public Tag( String Cpt , String TxtRecord1 , String TxtRecord2 , String Trs , String TxtShowing1 , String TxtShowing2 , String TcoGrp , String TcoOwn , String TcoTit , String TcoFnm , String TcoLnm , String TcoSex , String TcoTel , String TcoEml ) { this.Cpt = Cpt; this.TxtRecord1 = TxtRecord1; this.TxtRecord2 = TxtRecord2; this.Trs = Trs; this.TxtShowing1 = TxtShowing1; this.TxtShowing2 = TxtShowing2; this.TcoGrp = TcoGrp; this.TcoOwn = TcoOwn; this.TcoTit = TcoTit; this.TcoFnm = TcoFnm; this.TcoLnm = TcoLnm; this.TcoSex = TcoSex; this.TcoTel = TcoTel; this.TcoEml = TcoEml; mask = new HashSet<Integer>(Arrays.asList(CPT, TXTRECORD1, TXTRECORD2, TRS, TXTSHOWING1, TXTSHOWING2, TCOGRP, TCOOWN, TCOTIT, TCOFNM, TCOLNM, TCOSEX, TCOTEL, TCOEML)); }; public String Cpt; public String TxtRecord1; public String TxtRecord2; public String Trs; public String TxtShowing1; public String TxtShowing2; public String TcoGrp; public String TcoOwn; public String TcoTit; public String TcoFnm; public String TcoLnm; public String TcoSex; public String TcoTel; public String TcoEml; public boolean readXML( Document doc , String basexpath , boolean addbasetag ) { clear(); if (addbasetag) basexpath = Xmlio.checkUclcXPaths(doc, basexpath, "TagWznmPrsList"); String itemtag = "TagitemWznmPrsList"; if (Xmlio.checkXPath(doc, basexpath)) { Cpt = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "Cpt", mask, CPT); TxtRecord1 = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TxtRecord1", mask, TXTRECORD1); TxtRecord2 = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TxtRecord2", mask, TXTRECORD2); Trs = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "Trs", mask, TRS); TxtShowing1 = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TxtShowing1", mask, TXTSHOWING1); TxtShowing2 = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TxtShowing2", mask, TXTSHOWING2); TcoGrp = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoGrp", mask, TCOGRP); TcoOwn = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoOwn", mask, TCOOWN); TcoTit = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoTit", mask, TCOTIT); TcoFnm = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoFnm", mask, TCOFNM); TcoLnm = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoLnm", mask, TCOLNM); TcoSex = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoSex", mask, TCOSEX); TcoTel = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoTel", mask, TCOTEL); TcoEml = Xmlio.extractStringAttrUclc(doc, basexpath, itemtag, "Ti", "sref", "TcoEml", mask, TCOEML); return true; }; return false; }; public HashSet<Integer> comm( Tag comp ) { HashSet<Integer> items = new HashSet<Integer>(); if (Cpt.equals(comp.Cpt)) items.add(CPT); if (TxtRecord1.equals(comp.TxtRecord1)) items.add(TXTRECORD1); if (TxtRecord2.equals(comp.TxtRecord2)) items.add(TXTRECORD2); if (Trs.equals(comp.Trs)) items.add(TRS); if (TxtShowing1.equals(comp.TxtShowing1)) items.add(TXTSHOWING1); if (TxtShowing2.equals(comp.TxtShowing2)) items.add(TXTSHOWING2); if (TcoGrp.equals(comp.TcoGrp)) items.add(TCOGRP); if (TcoOwn.equals(comp.TcoOwn)) items.add(TCOOWN); if (TcoTit.equals(comp.TcoTit)) items.add(TCOTIT); if (TcoFnm.equals(comp.TcoFnm)) items.add(TCOFNM); if (TcoLnm.equals(comp.TcoLnm)) items.add(TCOLNM); if (TcoSex.equals(comp.TcoSex)) items.add(TCOSEX); if (TcoTel.equals(comp.TcoTel)) items.add(TCOTEL); if (TcoEml.equals(comp.TcoEml)) items.add(TCOEML); return(items); }; public HashSet<Integer> diff( Tag comp ) { HashSet<Integer> commitems; HashSet<Integer> diffitems; commitems = comm(comp); diffitems = new HashSet<Integer>(Arrays.asList(CPT, TXTRECORD1, TXTRECORD2, TRS, TXTSHOWING1, TXTSHOWING2, TCOGRP, TCOOWN, TCOTIT, TCOFNM, TCOLNM, TCOSEX, TCOTEL, TCOEML)); for (Integer ci: commitems) diffitems.remove(ci); return(diffitems); }; }; /** * DpchAppData (full: DpchAppWznmPrsListData) */ public class DpchAppData extends DpchAppWznm { public static final int SCRJREF = 1; public static final int CONTIAC = 2; public static final int STGIAC = 3; public static final int STGIACQRY = 4; public static final int ALL = 5; public DpchAppData( String scrJref , ContIac contiac , StgIac stgiac , QryWznmPrsList.StgIac stgiacqry , Integer[] mask ) { super(VecWznmVDpch.DPCHAPPWZNMPRSLISTDATA, scrJref); this.mask = new HashSet<Integer>(Arrays.asList(mask)); for (Integer i: mask) if (i == ALL) { this.mask = new HashSet<Integer>(Arrays.asList(SCRJREF, CONTIAC, STGIAC, STGIACQRY)); break; }; if (has(CONTIAC)) this.contiac = contiac; if (has(STGIAC)) this.stgiac = stgiac; if (has(STGIACQRY)) this.stgiacqry = stgiacqry; }; public ContIac contiac; public StgIac stgiac; public QryWznmPrsList.StgIac stgiacqry; public String getSrefsMask() { ArrayList<String> ss = new ArrayList<String>(); if (has(SCRJREF)) ss.add("scrJref"); if (has(CONTIAC)) ss.add("contiac"); if (has(STGIAC)) ss.add("stgiac"); if (has(STGIACQRY)) ss.add("stgiacqry"); return StrMod.vectorToString(ss, ';'); }; public void writeXML( Document doc , Element sup ) { Element el = doc.createElement("DpchAppWznmPrsListData"); if (sup == null) doc.appendChild(el); else sup.appendChild(el); el.setAttribute("xmlns", "http://www.mpsitech.com"); if (has(SCRJREF)) Xmlio.writeString(doc, el, "scrJref", scrJref); if (has(CONTIAC)) contiac.writeXML(doc, el, "", true); if (has(STGIAC)) stgiac.writeXML(doc, el, "", true); if (has(STGIACQRY)) stgiacqry.writeXML(doc, el, "", true); }; }; /** * DpchAppDo (full: DpchAppWznmPrsListDo) */ public class DpchAppDo extends DpchAppWznm { public static final int SCRJREF = 1; public static final int IXVDO = 2; public static final int ALL = 3; public DpchAppDo( String scrJref , int ixVDo , Integer[] mask ) { super(VecWznmVDpch.DPCHAPPWZNMPRSLISTDO, scrJref); this.mask = new HashSet<Integer>(Arrays.asList(mask)); for (Integer i: mask) if (i == ALL) { this.mask = new HashSet<Integer>(Arrays.asList(SCRJREF, IXVDO)); break; }; this.ixVDo = ixVDo; }; public int ixVDo; public String getSrefsMask() { ArrayList<String> ss = new ArrayList<String>(); if (has(SCRJREF)) ss.add("scrJref"); if (has(IXVDO)) ss.add("ixVDo"); return StrMod.vectorToString(ss, ';'); }; public void writeXML( Document doc , Element sup ) { Element el = doc.createElement("DpchAppWznmPrsListDo"); if (sup == null) doc.appendChild(el); else sup.appendChild(el); el.setAttribute("xmlns", "http://www.mpsitech.com"); if (has(SCRJREF)) Xmlio.writeString(doc, el, "scrJref", scrJref); if (has(IXVDO)) Xmlio.writeString(doc, el, "srefIxVDo", VecVDo.getSref(ixVDo)); }; }; /** * DpchEngData (full: DpchEngWznmPrsListData) */ public class DpchEngData extends DpchEngWznm { public static final int SCRJREF = 1; public static final int CONTIAC = 2; public static final int CONTINF = 3; public static final int FEEDFCSIQST = 4; public static final int FEEDFTOS = 5; public static final int STATSHR = 6; public static final int STGIAC = 7; public static final int TAG = 8; public static final int RST = 9; public static final int STATAPPQRY = 10; public static final int STATSHRQRY = 11; public static final int STGIACQRY = 12; public DpchEngData() { super(VecWznmVDpch.DPCHENGWZNMPRSLISTDATA); contiac = new ContIac(0); continf = new ContInf(false, 0); feedFCsiQst = new Feed("FeedFCsiQst"); feedFTos = new Feed("FeedFTos"); statshr = new StatShr(0, false); stgiac = new StgIac(0, 0, 0, 0, 0, 0, 0, 0); tag = new Tag("", "", "", "", "", "", "", "", "", "", "", "", "", ""); rst = new ListWznmQPrsList(); statappqry = (new QryWznmPrsList()).new StatApp(0, 0, 0, 0); statshrqry = (new QryWznmPrsList()).new StatShr(0, 0, 0); stgiacqry = (new QryWznmPrsList()).new StgIac(0, 0, 0); }; public ContIac contiac; public ContInf continf; public Feed feedFCsiQst; public Feed feedFTos; public StatShr statshr; public StgIac stgiac; public Tag tag; public ListWznmQPrsList rst; public QryWznmPrsList.StatApp statappqry; public QryWznmPrsList.StatShr statshrqry; public QryWznmPrsList.StgIac stgiacqry; public String getSrefsMask() { ArrayList<String> ss = new ArrayList<String>(); if (has(SCRJREF)) ss.add("scrJref"); if (has(CONTIAC)) ss.add("contiac"); if (has(CONTINF)) ss.add("continf"); if (has(FEEDFCSIQST)) ss.add("feedFCsiQst"); if (has(FEEDFTOS)) ss.add("feedFTos"); if (has(STATSHR)) ss.add("statshr"); if (has(STGIAC)) ss.add("stgiac"); if (has(TAG)) ss.add("tag"); if (has(RST)) ss.add("rst"); if (has(STATAPPQRY)) ss.add("statappqry"); if (has(STATSHRQRY)) ss.add("statshrqry"); if (has(STGIACQRY)) ss.add("stgiacqry"); return StrMod.vectorToString(ss, ';'); }; public void readXML( Document doc , String basexpath , boolean addbasetag ) { clear(); if (addbasetag) basexpath = Xmlio.checkUclcXPaths(doc, basexpath, "DpchEngWznmPrsListData"); if (Xmlio.checkXPath(doc, basexpath)) { scrJref = Xmlio.extractStringUclc(doc, basexpath, "scrJref", "", mask, SCRJREF); if (contiac.readXML(doc, basexpath, true)) add(CONTIAC); if (continf.readXML(doc, basexpath, true)) add(CONTINF); if (feedFCsiQst.readXML(doc, basexpath, true)) add(FEEDFCSIQST); if (feedFTos.readXML(doc, basexpath, true)) add(FEEDFTOS); if (statshr.readXML(doc, basexpath, true)) add(STATSHR); if (stgiac.readXML(doc, basexpath, true)) add(STGIAC); if (tag.readXML(doc, basexpath, true)) add(TAG); if (rst.readXML(doc, basexpath, true)) add(RST); if (statappqry.readXML(doc, basexpath, true)) add(STATAPPQRY); if (statshrqry.readXML(doc, basexpath, true)) add(STATSHRQRY); if (stgiacqry.readXML(doc, basexpath, true)) add(STGIACQRY); } else { scrJref = ""; contiac = new ContIac(0); continf = new ContInf(false, 0); feedFCsiQst = new Feed("FeedFCsiQst"); feedFTos = new Feed("FeedFTos"); statshr = new StatShr(0, false); stgiac = new StgIac(0, 0, 0, 0, 0, 0, 0, 0); tag = new Tag("", "", "", "", "", "", "", "", "", "", "", "", "", ""); statappqry = (new QryWznmPrsList()).new StatApp(0, 0, 0, 0); statshrqry = (new QryWznmPrsList()).new StatShr(0, 0, 0); stgiacqry = (new QryWznmPrsList()).new StgIac(0, 0, 0); }; }; }; };
9238fb9c1d2399bce6a761447fea2c423cf6d355
317
java
Java
app/src/main/java/com/app/hello/HelloController.java
SCS-ASSE-FS21-Group4/tapas
800edff054df9baf76e32ca65f54a166cdd38e4d
[ "Unlicense" ]
null
null
null
app/src/main/java/com/app/hello/HelloController.java
SCS-ASSE-FS21-Group4/tapas
800edff054df9baf76e32ca65f54a166cdd38e4d
[ "Unlicense" ]
null
null
null
app/src/main/java/com/app/hello/HelloController.java
SCS-ASSE-FS21-Group4/tapas
800edff054df9baf76e32ca65f54a166cdd38e4d
[ "Unlicense" ]
null
null
null
21.133333
62
0.731861
998,655
package com.dockerforjavadevelopers.hello; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; @RestController public class HelloController { @RequestMapping("/") public String index() { return "Group 4\n"; } }
9238fbd8e5215c450c19487ca1c88b6528aed3f7
411
java
Java
src/main/java/com/ferreusveritas/dynamictrees/util/MutableLazyValue.java
copygirl/DynamicTrees
c22f106512ed514df75e500a63b16896f9362b4b
[ "MIT" ]
null
null
null
src/main/java/com/ferreusveritas/dynamictrees/util/MutableLazyValue.java
copygirl/DynamicTrees
c22f106512ed514df75e500a63b16896f9362b4b
[ "MIT" ]
null
null
null
src/main/java/com/ferreusveritas/dynamictrees/util/MutableLazyValue.java
copygirl/DynamicTrees
c22f106512ed514df75e500a63b16896f9362b4b
[ "MIT" ]
null
null
null
19.571429
67
0.703163
998,656
package com.ferreusveritas.dynamictrees.util; import javax.annotation.Nonnull; import java.util.function.Supplier; /** * @author Harley O'Connor */ public interface MutableLazyValue<T> { T get(); void reset(Supplier<T> supplier); void set(@Nonnull T value); static <T> MutableLazyValue<T> supplied(Supplier<T> supplier) { return new MutableSuppliedLazyValue<>(supplier); } }
9238fdbf96440c458e524def6ade790469489703
11,986
java
Java
src/oracle/kv/table/MapValue.java
bantudb/kv
b48aa112e5b988c1d62761281ba6a1bd108c0563
[ "Apache-2.0" ]
null
null
null
src/oracle/kv/table/MapValue.java
bantudb/kv
b48aa112e5b988c1d62761281ba6a1bd108c0563
[ "Apache-2.0" ]
null
null
null
src/oracle/kv/table/MapValue.java
bantudb/kv
b48aa112e5b988c1d62761281ba6a1bd108c0563
[ "Apache-2.0" ]
null
null
null
27.617512
96
0.62306
998,657
/*- * Copyright (C) 2011, 2017 Oracle and/or its affiliates. All rights reserved. * * This file was distributed by Oracle as part of a version of Oracle NoSQL * Database made available at: * * http://www.oracle.com/technetwork/database/database-technologies/nosqldb/downloads/index.html * * Please see the LICENSE file included in the top-level directory of the * appropriate version of Oracle NoSQL Database for a copy of the license and * additional information. */ package oracle.kv.table; import java.io.Reader; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Map; /** * MapValue extends {@link FieldValue} to define a container object that holds * a map of FieldValue objects all of the same type. The getters and setters * use the same semantics as Java Map. Map keys are case-sensitive. * * @since 3.0 */ public interface MapValue extends FieldValue { /** * A constant used as a key for a map value when the value is used as part * of an IndexKey when there is an index on the value of a map's element or * a nested value within the element if the element is a record. */ static final String ANONYMOUS = "[]"; /** * Returns a deep copy of this object. * * @return a deep copy of this object */ @Override public MapValue clone(); /** * Returns a String representation of the value. The value is returned * is a JSON string, and is the same as that returned by * {@link FieldValue#toJsonString}. * * @return a String representation of the value */ @Override public String toString(); /** * Returns the MapDef that defines the content of this map. * * @return the MapDef */ @Override MapDef getDefinition(); /** * Returns the size of the map. * * @return the size */ int size(); /** * Returns an unmodifiable view of the MapValue state. The type of all * fields is the same and is defined by the {@link MapDef} returned by * {@link #getDefinition}. * * @return the map * * @since 3.0.6 */ Map<String, FieldValue> getFields(); /** * Remove the named field if it exists. * * @param fieldName the name of the field to remove * * @return the FieldValue if it existed, otherwise null */ FieldValue remove(String fieldName); /** * Returns the FieldValue with the specified name if it * appears in the map. * * @param fieldName the name of the desired field. * * @return the value for the field or null if the name does not exist in * the map. */ FieldValue get(String fieldName); /** * Puts a JSON null value in the named field, silently overwriting * existing values. This operation is only valid for maps of type JSON. * * @param fieldName name of the desired field * * @return this * * @throws IllegalArgumentException if this map is not of type JSON * * @since 4.3 */ MapValue putJsonNull(String fieldName); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, int value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, long value); /** * Set the named field. Any existing entry is silently overwritten. This * method is used to put a string into a map of type String. The String * value is not parsed or interpreted. The methods {@link #putJson} and * {@link #putEnum} exist to put String values of those types. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, String value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, double value); /** * @hidden * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type * * @since 4.3 */ MapValue putNumber(String fieldName, int value); /** * @hidden * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type * * @since 4.3 */ MapValue putNumber(String fieldName, long value); /** * @hidden * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type * * @since 4.3 */ MapValue putNumber(String fieldName, float value); /** * @hidden * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type * * @since 4.3 */ MapValue putNumber(String fieldName, double value); /** * @hidden * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type * * @since 4.3 */ MapValue putNumber(String fieldName, BigDecimal value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, float value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, boolean value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, byte[] value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue putFixed(String fieldName, byte[] value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue putEnum(String fieldName, String value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type * * @since 4.3 */ MapValue put(String fieldName, Timestamp value); /** * Set the named field. Any existing entry is silently overwritten. * * @param fieldName name of the desired field * * @param value the value to set * * @return this * * @throws IllegalArgumentException if the definition of the map type does * not match the input type */ MapValue put(String fieldName, FieldValue value); /** * Puts a Record into the map. Existing values are silently overwritten. * * @param fieldName the field to use for the map key * * @return an uninitialized RecordValue that matches the type * definition for the map * * @throws IllegalArgumentException if the definition of the map type * is not a RecordDef */ RecordValue putRecord(String fieldName); /** * Puts a Map into the map. Existing values are silently overwritten. * * @param fieldName the field to use for the map key * * @return an uninitialized MapValue that matches the type * definition for the map * * @throws IllegalArgumentException if the definition of the map type * is not a MapDef */ MapValue putMap(String fieldName); /** * Puts an Array into the map. Existing values are silently overwritten. * * @param fieldName the field to use for the map key * * @return an uninitialized ArrayValue that matches the type * definition for the map * * @throws IllegalArgumentException if the definition of the map type * is not an ArrayDef */ ArrayValue putArray(String fieldName); /** * Puts arbitrary JSON into this map in the specified field. Existing * values are silently overwritten. * * @param fieldName the field to use for the map key * * @param jsonInput a JSON string * * @return this * * @throws IllegalArgumentException if this map is not of type JSON or * the JSON input is invalid. * * @since 4.2 */ MapValue putJson(String fieldName, String jsonInput); /** * Puts arbitrary JSON into this map in the specified field. Existing * values are silently overwritten. * * @param fieldName the field to use for the map key * * @param jsonReader a Reader * * @return this * * @throws IllegalArgumentException if this map is not of type JSON or * the JSON input is invalid. * * @since 4.2 */ MapValue putJson(String fieldName, Reader jsonReader); }
9238fdc73ef743d1596b8628715341f99c74d66e
7,883
java
Java
src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java
kingb18/jabref
3fe34a0ee319f49c87258f0aee0360f486107c91
[ "MIT" ]
2,813
2015-01-03T20:12:42.000Z
2022-03-31T09:09:58.000Z
src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java
kingb18/jabref
3fe34a0ee319f49c87258f0aee0360f486107c91
[ "MIT" ]
6,523
2015-02-23T22:52:33.000Z
2022-03-31T22:54:25.000Z
src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java
kingb18/jabref
3fe34a0ee319f49c87258f0aee0360f486107c91
[ "MIT" ]
2,535
2015-01-03T20:14:40.000Z
2022-03-30T08:27:11.000Z
35.035556
119
0.703666
998,658
package org.jabref.logic.integrity; import java.util.Optional; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.database.BibDatabaseMode; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; public class TitleCheckerTest { private TitleChecker checker; private TitleChecker checkerBiblatex; @BeforeEach public void setUp() { BibDatabaseContext databaseContext = new BibDatabaseContext(); BibDatabaseContext databaseBiblatex = new BibDatabaseContext(); databaseContext.setMode(BibDatabaseMode.BIBTEX); checker = new TitleChecker(databaseContext); databaseBiblatex.setMode(BibDatabaseMode.BIBLATEX); checkerBiblatex = new TitleChecker(databaseBiblatex); } @Test public void firstLetterAsOnlyCapitalLetterInSubTitle2() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: This is a sub title 2")); } @Test public void noCapitalLetterInSubTitle2() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: this is a sub title 2")); } @Test public void twoCapitalLettersInSubTitle2() { assertNotEquals(Optional.empty(), checker.checkValue("This is a sub title 1: This is A sub title 2")); } @Test public void middleLetterAsOnlyCapitalLetterInSubTitle2() { assertNotEquals(Optional.empty(), checker.checkValue("This is a sub title 1: this is A sub title 2")); } @Test public void twoCapitalLettersInSubTitle2WithCurlyBrackets() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: This is {A} sub title 2")); } @Test public void middleLetterAsOnlyCapitalLetterInSubTitle2WithCurlyBrackets() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: this is {A} sub title 2")); } @Test public void firstLetterAsOnlyCapitalLetterInSubTitle2AfterContinuousDelimiters() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1...This is a sub title 2")); } @Test public void middleLetterAsOnlyCapitalLetterInSubTitle2AfterContinuousDelimiters() { assertNotEquals(Optional.empty(), checker.checkValue("This is a sub title 1... this is a sub Title 2")); } @Test public void firstLetterAsOnlyCapitalLetterInEverySubTitleWithContinuousDelimiters() { assertEquals(Optional.empty(), checker.checkValue("This is; A sub title 1.... This is a sub title 2")); } @Test public void firstLetterAsOnlyCapitalLetterInEverySubTitleWithRandomDelimiters() { assertEquals(Optional.empty(), checker.checkValue("This!is!!A!Title??")); } @Test public void moreThanOneCapitalLetterInSubTitleWithoutCurlyBrackets() { assertNotEquals(Optional.empty(), checker.checkValue("This!is!!A!TitlE??")); } @Test void bibTexAcceptsTitleWithOnlyFirstCapitalLetter() { assertEquals(Optional.empty(), checker.checkValue("This is a title")); } @Test void bibTexDoesNotAcceptCapitalLettersInsideTitle() { assertNotEquals(Optional.empty(), checker.checkValue("This is a Title")); } @Test void bibTexRemovesCapitalLetterInsideTitle() { assertEquals(Optional.empty(), checker.checkValue("This is a {T}itle")); } @Test void bibTexRemovesEverythingInBracketsAndAcceptsNoTitleInput() { assertEquals(Optional.empty(), checker.checkValue("{This is a Title}")); } @Test void bibTexRemovesEverythingInBrackets() { assertEquals(Optional.empty(), checker.checkValue("This is a {Title}")); } @Test void bibTexAcceptsTitleWithLowercaseFirstLetter() { assertEquals(Optional.empty(), checker.checkValue("{C}urrent {C}hronicle")); } @Test void bibTexAcceptsSubTitlesWithOnlyFirstCapitalLetter() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: This is a sub title 2")); } @Test void bibTexAcceptsSubTitleWithLowercaseFirstLetter() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: this is a sub title 2")); } @Test void bibTexDoesNotAcceptCapitalLettersInsideSubTitle() { assertNotEquals(Optional.empty(), checker.checkValue("This is a sub title 1: This is A sub title 2")); } @Test void bibTexRemovesCapitalLetterInsideSubTitle() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1: this is {A} sub title 2")); } @Test void bibTexSplitsSubTitlesBasedOnDots() { assertEquals(Optional.empty(), checker.checkValue("This is a sub title 1...This is a sub title 2")); } @Test void bibTexSplitsSubTitleBasedOnSpecialCharacters() { assertEquals(Optional.empty(), checker.checkValue("This is; A sub title 1.... This is a sub title 2")); } @Test void bibTexAcceptsCapitalLetterAfterSpecialCharacter() { assertEquals(Optional.empty(), checker.checkValue("This!is!!A!Title??")); } @Test void bibTexAcceptsCapitalLetterOnlyAfterSpecialCharacter() { assertNotEquals(Optional.empty(), checker.checkValue("This!is!!A!TitlE??")); } @Test void bibLaTexAcceptsTitleWithOnlyFirstCapitalLetter() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a title")); } @Test void bibLaTexAcceptsCapitalLettersInsideTitle() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a Title")); } @Test void bibLaTexRemovesCapitalLetterInsideTitle() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a {T}itle")); } @Test void bibLaTexRemovesEverythingInBracketsAndAcceptsNoTitleInput() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("{This is a Title}")); } @Test void bibLaTexRemovesEverythingInBrackets() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a {Title}")); } @Test void bibLaTexAcceptsTitleWithLowercaseFirstLetter() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("{C}urrent {C}hronicle")); } @Test void bibLaTexAcceptsSubTitlesWithOnlyFirstCapitalLetter() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a sub title 1: This is a sub title 2")); } @Test void bibLaTexAcceptsSubTitleWithLowercaseFirstLetter() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a sub title 1: this is a sub title 2")); } @Test void bibLaTexAcceptsCapitalLettersInsideSubTitle() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a sub title 1: This is A sub title 2")); } @Test void bibLaTexRemovesCapitalLetterInsideSubTitle() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a sub title 1: this is {A} sub title 2")); } @Test void bibLaTexSplitsSubTitlesBasedOnDots() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is a sub title 1...This is a sub title 2")); } @Test void bibLaTexSplitsSubTitleBasedOnSpecialCharacters() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This is; A sub title 1.... This is a sub title 2")); } @Test void bibLaTexAcceptsCapitalLetterAfterSpecialCharacter() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This!is!!A!Title??")); } @Test void bibLaTexAcceptsCapitalLetterNotOnlyAfterSpecialCharacter() { assertEquals(Optional.empty(), checkerBiblatex.checkValue("This!is!!A!TitlE??")); } }
9238fe53a718c47ff4bbe2d555d1c072fa8bd6e2
6,841
java
Java
hadoop/mesos/src/java/org/apache/hadoop/mapred/FrameworkExecutor.java
clearstorydata/mesos
4164125048c6635a4d0dbe72daf243457b0f325b
[ "Apache-2.0" ]
1
2015-03-07T00:42:19.000Z
2015-03-07T00:42:19.000Z
hadoop/mesos/src/java/org/apache/hadoop/mapred/FrameworkExecutor.java
taoito/mesos
0e3f2b4b3a24d901d2caf3e57d9f2d0502d7aa58
[ "Apache-2.0" ]
null
null
null
hadoop/mesos/src/java/org/apache/hadoop/mapred/FrameworkExecutor.java
taoito/mesos
0e3f2b4b3a24d901d2caf3e57d9f2d0502d7aa58
[ "Apache-2.0" ]
1
2022-02-19T10:59:37.000Z
2022-02-19T10:59:37.000Z
34.034826
80
0.674024
998,659
package org.apache.hadoop.mapred; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.mapred.TaskStatus.State; import org.apache.hadoop.mapred.TaskTracker.TaskInProgress; import org.hsqldb.lib.Iterator; import org.apache.mesos.Executor; import org.apache.mesos.ExecutorDriver; import org.apache.mesos.MesosExecutorDriver; import org.apache.mesos.Protos.ExecutorInfo; import org.apache.mesos.Protos.FrameworkID; import org.apache.mesos.Protos.FrameworkInfo; import org.apache.mesos.Protos.SlaveID; import org.apache.mesos.Protos.SlaveInfo; import org.apache.mesos.Protos.Status; import org.apache.mesos.Protos.TaskID; import org.apache.mesos.Protos.TaskInfo; import org.apache.mesos.Protos.TaskState; public class FrameworkExecutor implements Executor { public static final Log LOG = LogFactory.getLog(FrameworkExecutor.class); private static FrameworkExecutor instance; private ExecutorDriver driver; private SlaveID slaveId; private JobConf conf; private TaskTracker taskTracker; private Set<TaskID> activeMesosTasks = new HashSet<TaskID>(); @Override public void registered(ExecutorDriver d, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) { try { Thread.currentThread().setContextClassLoader( TaskTracker.class.getClassLoader()); this.driver = d; this.slaveId = slaveId; // TODO: initialize all of JobConf from ExecutorArgs (using JT's conf)? conf = new JobConf(); String jobTracker = executorInfo.getData().toStringUtf8(); LOG.info("Setting JobTracker: " + jobTracker); conf.set("mapred.job.tracker", jobTracker); // Attach our TaskTrackerInstrumentation to figure out when tasks end Class<?>[] instClasses = TaskTracker.getInstrumentationClasses(conf); String newInstClassList = ""; for (Class<?> cls: instClasses) { newInstClassList += cls.getName() + ","; } newInstClassList += MesosTaskTrackerInstrumentation.class.getName(); conf.set("mapred.tasktracker.instrumentation", newInstClassList); // Get hostname from Mesos to make sure we match what it reports to the JT conf.set("slave.host.name", slaveInfo.getHostname()); taskTracker = new TaskTracker(conf); new Thread("TaskTracker run thread") { @Override public void run() { taskTracker.run(); } }.start(); } catch (Exception e) { throw new RuntimeException( "Failed to initialize FrameworkExecutor", e); } } @Override public void reregistered(ExecutorDriver driver, SlaveInfo slaveInfo) {} @Override public void disconnected(ExecutorDriver driver) {} @Override public void launchTask(ExecutorDriver d, TaskInfo task) { LOG.info("Asked to launch Mesos task " + task.getTaskId().getValue()); activeMesosTasks.add(task.getTaskId()); } @Override public void killTask(ExecutorDriver d, TaskID taskId) { LOG.info("Asked to kill Mesos task " + taskId); // TODO: Tell the JobTracker about this using an E2S_KILL_REQUEST message! } @Override public void frameworkMessage(ExecutorDriver d, byte[] msg) { try { HadoopFrameworkMessage hfm = new HadoopFrameworkMessage(msg); switch (hfm.type) { case S2E_SEND_STATUS_UPDATE: { TaskState s = TaskState.valueOf(hfm.arg1); LOG.info("Sending status update: " + hfm.arg2 + " is " + s); d.sendStatusUpdate(org.apache.mesos.Protos.TaskStatus.newBuilder() .setTaskId(TaskID.newBuilder() .setValue(hfm.arg2).build()) .setState(s).build()); break; } case S2E_SHUTDOWN_EXECUTOR: { taskTracker.close(); System.exit(0); } } } catch (Exception e) { throw new RuntimeException( "Failed to deserialize HadoopFrameworkMessage", e); } } public void statusUpdate(Task task, TaskStatus status) { // There are some tasks that get launched implicitly (e.g., the // setup/cleanup tasks) that don't go through the // MesosScheduler/FrameworkScheduler.assignTasks and thus don't // get extraData set properly! This means WE DO NOT EVER SEND // STATUS UPDATES FOR THESE TASKS. For this reason we also don't // need to specify any resources for the executor because Mesos // always assumes these tasks are running. if (task.extraData.equals("")) { LOG.info("Ignoring status update for task " + task); return; } // Create a Mesos TaskID from extraData. TaskID taskId = TaskID.newBuilder() .setValue(task.extraData) .build(); // It appears as though we can get multiple duplicate status // updates for the same task, so check if we still have an active // task so that we only send the status update once. if (!activeMesosTasks.contains(taskId)) { LOG.info("Ignoring (duplicate) status update for task " + task); return; } // Check whether the task has finished (either successfully or // not), and report to Mesos only if it has. State state = status.getRunState(); TaskState mesosState = null; if (state == State.SUCCEEDED || state == State.COMMIT_PENDING) mesosState = TaskState.TASK_FINISHED; else if (state == State.FAILED || state == State.FAILED_UNCLEAN) mesosState = TaskState.TASK_FAILED; else if (state == State.KILLED || state == State.KILLED_UNCLEAN) mesosState = TaskState.TASK_KILLED; if (mesosState == null) { LOG.info("Not sending status update for task " + task + " in state " + state); return; } LOG.info("Attempting to send status update for " + task + " in state " + status.getRunState()); driver.sendStatusUpdate( org.apache.mesos.Protos.TaskStatus.newBuilder() .setTaskId(TaskID.newBuilder().setValue(task.extraData).build()) .setState(mesosState) .build()); activeMesosTasks.remove(taskId); } @Override public void error(ExecutorDriver d, String message) { LOG.error("FrameworkExecutor.error: " + message); } @Override public void shutdown(ExecutorDriver d) {} public static void main(String[] args) { instance = new FrameworkExecutor(); MesosExecutorDriver driver = new MesosExecutorDriver(instance); System.exit(driver.run() == Status.DRIVER_STOPPED ? 0 : 1); } static FrameworkExecutor getInstance() { return instance; } }